From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.9 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, NO_REAL_NAME,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id E92A2BC50 for ; Thu, 5 Oct 2006 23:14:51 +0200 (CEST) Received: from malaquias.no-ip.org ([200.131.216.204]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k95LEoWY021208 for ; Thu, 5 Oct 2006 23:14:51 +0200 Received: by malaquias.no-ip.org (Postfix, from userid 500) id C012B1B40CA; Thu, 5 Oct 2006 18:14:11 -0300 (BRT) Date: Thu, 5 Oct 2006 18:14:11 -0300 From: j.romildo@gmail.com To: lablgtk@math.nagoya-u.ac.jp, caml-list@inria.fr Subject: Help on a port of GtkDatabox with lablgtk Message-ID: <20061005211411.GA23936@malaquias.gwiceb1> Mail-Followup-To: lablgtk@math.nagoya-u.ac.jp, caml-list@inria.fr MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) X-j-chkmail-Score: MSGID : 452575CA.001 on concorde : j-chkmail score : X : 0/20 1 X-Miltered: at concorde with ID 452575CA.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; romildo:01 lablgtk:01 gtk:01 defines:01 gtk:01 ocaml:01 lablgtk:01 ocaml:01 struct:01 bool:01 gobj:01 widget:01 impl:01 compiler:01 ocamlopt:01 Hello. The GtkDatabox library (http://www.eudoxos.net/gtk/gtkdatabox/) defines the folowing class hierarchy: GObject GtkDataboxGraph GtkDataboxXYCGraph GtkDataboxPoints GtkDataboxLines GtkDataboxMarker GtkDataboxCrossSimple GtkDataboxBars GtkDataboxGrid GtdDrawingArea GtkDatabox The class GtkDatabox has the method add, whose C prototype is gboolean gtk_databox_graph_add (GtkDatabox *box, GtkDataboxGraph *graph) I am attempting to port the library to ocaml using lablgtk (the latest snapshot: lablgtk2-20060908). Therefore I have the following definitions in ocaml: module T = struct type databox = [Gtk.drawing_area|`databox] type graph = [`graph] type xyc = [graph|`xyc] type points = [xyc|`points] end external graph_add : [> T.databox] Gtk.obj -> [> T.graph] Gobject.obj -> bool = "ml_gtk_databox_graph_add" class virtual graph (obj : [> T.graph] Gobject.obj) = object method as_graph : T.graph Gobject.obj = obj end class xyc (obj : [> T.xyc] Gobject.obj) = object inherit graph obj end class databox (obj : [> T.databox] Gtk.obj) = object inherit [_] GObj.widget_impl obj method as_databox : T.databox Gtk.obj = obj method add g = graph_add obj g#as_graph end The code is simplified, as at the moment I am not interesting in the properties and signals of GtkDatabox, as well as the functions to create the objects of the relevant classes. Unfortunatly I was not clever enough to write correct ocaml code, hence it is not accepted by the compiler, which says: $ ocamlopt -I . -c -i databox.ml File "databox.ml", line 19, characters 16-19: This expression has type ([> T.xyc ] as 'a) Gobject.obj but is here used with type T.graph Gobject.obj Type 'a = [> `graph | `xyc ] is not compatible with type T.graph = [ `graph ] And finally I coming to these mailing lists to ask for help on how to solve this problem. I am willing also get advices on how to conduct this port. Regards, Romildo PS: Unfortunatly I am short of time, and would like to get answers as soon as possible. But I do not want to make pressure on you. Anyway it is still better to get delayed answers, that no answer at all.