From: Martin Jambon <martin_jambon@emailuser.net>
To: Christophe Raffalli <christophe.raffalli@univ-savoie.fr>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] camlp4 question
Date: Thu, 8 Sep 2005 10:41:31 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.63.0509081036540.5183@droopy> (raw)
In-Reply-To: <431FF009.9050608@univ-savoie.fr>
On Thu, 8 Sep 2005, Christophe Raffalli wrote:
> I am writing a tool to facilitate the use of callback of camlfunction from C.
> I have a first prototype running for lablGlut, but I want to make it nicer
> using camlp4 (this extension should produce automatically the C wrapper for
> each callback, the user will only have to compile the produced C file).
>
> The pb is that I need to retrieve information given in one module from
> another. The minimum I need to do is to search for the path given to ocamlc
> (the -I options) from camlp4 code, but I would prefer a better way, and I do
> not know how to retrive this PATH anyway.
Maybe write a script which would transmit the -I options to camlp4o and to
ocamlopt/ocamlc (each camlp4 loadable module can define additional options
to pass to camlp4/camlp4o)
Martin
>
> Here is an example to illustrate what I need (the type 'a callback is a type
> to a C wrapper for a function of type 'a) :
>
> -- file glut.ml, part of the lablGlut library --
>
> ...
>
> let visibility_state_of_int = function
> 0 -> NOT_VISIBLE
> | 1 -> VISIBLE
> | _ -> raise (BadEnum "visibility_state")
>
> REGISTER_CONVERSION visibility_state_of_int
>
> external visibilityFunc :
> cb:(state:visibility_state_t->unit) callback->unit
> = "ml_glutVisibilityFunc"
>
> ...
>
> -- file test.ml an example using lablGlut --
>
> open Glut
>
> ...
>
> let state_changed ~state =
> match value with
> NOT_VISIBLE -> printf "window not visible."; print_newline()
> | VISIBLE -> printf "window not visible."; print_newline()
>
> MAKE_WRAPPER state_changed state_changed_cb
> (* here I need to search for the convertion for the type
> visibility_state_of_int which was defined in glut.ml to make the
> C wrapper state_changed_cb : (visibility_state_of_int -> unit) callback *)
>
> let _ = Glut.visibilityFunc state_changed_cb
>
> ...
>
> Can someone help ?
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
--
Martin Jambon, PhD
http://martin.jambon.free.fr
next prev parent reply other threads:[~2005-09-08 17:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-08 8:02 Christophe Raffalli
2005-09-08 8:16 ` Christophe Raffalli
2005-09-08 17:36 ` [Caml-list] " Martin Jambon
2005-09-08 17:44 ` Christophe Raffalli
2005-09-08 17:41 ` Martin Jambon [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-11-30 9:29 Christophe Raffalli
2005-12-01 9:13 ` [Caml-list] " Hendrik Tews
2005-10-28 19:44 Camlp4 question Matt Gushee
2005-11-01 14:04 ` [Caml-list] " Hendrik Tews
2004-10-05 3:45 [Caml-list] camlp4 question Pietro Abate
2004-10-05 5:38 ` Dmitry Lomov
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=Pine.LNX.4.63.0509081036540.5183@droopy \
--to=martin_jambon@emailuser.net \
--cc=caml-list@inria.fr \
--cc=christophe.raffalli@univ-savoie.fr \
/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