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
Date: Thu, 5 Oct 2006 18:14:11 -0300 [thread overview]
Message-ID: <20061005211411.GA23936@malaquias.gwiceb1> (raw)
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.
next reply other threads:[~2006-10-05 21:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-05 21:14 j.romildo [this message]
2006-10-06 5:53 ` [Caml-list] " Jacques Garrigue
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061005211411.GA23936@malaquias.gwiceb1 \
--to=j.romildo@gmail.com \
--cc=caml-list@inria.fr \
--cc=lablgtk@math.nagoya-u.ac.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox