From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA13303 for caml-red; Mon, 4 Dec 2000 23:01:08 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA27435 for ; Mon, 4 Dec 2000 12:32:10 +0100 (MET) Received: from miss.wu-wien.ac.at (miss.wu-wien.ac.at [137.208.107.17]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id eB4BW9P27208 for ; Mon, 4 Dec 2000 12:32:09 +0100 (MET) Received: (from mottl@localhost) by miss.wu-wien.ac.at (8.9.0/8.9.0) id MAA14467; Mon, 4 Dec 2000 12:32:04 +0100 (MET) Date: Mon, 4 Dec 2000 12:32:04 +0100 From: Markus Mottl To: Olivier Andrieu Cc: OCAML Subject: Re: libplot for OCaml? Message-ID: <20001204123204.A12283@miss.wu-wien.ac.at> References: <20001125114256.A23216@miss.wu-wien.ac.at> <14891.28540.612485.383571@akasha.ijm.jussieu.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <14891.28540.612485.383571@akasha.ijm.jussieu.fr>; from andrieu@oxygene.ijm.jussieu.fr on Mon, Dec 04, 2000 at 11:18:36 +0100 Sender: weis@pauillac.inria.fr On Mon, 04 Dec 2000, Olivier Andrieu wrote: > Markus Mottl writes: > > has anybody already considered implementing an interface to the > > libplot-library? > > [ ...] > > I don't have time to do it right now, but if anybody wants to give > > it a try, I could imagine helping a bit. It doesn't look terribly > > difficult and may be a good exercise to try out camlidl... > I had never heard of both libplot and camlidl, so your post was a > revelation for me ! So, I tried to generate stub code for the libplot > header with camlidl. Seems to work fine, but I have a little problem : > some functions in libplot take FILE* arguments. Since that's not a > `basic' type, it is not handled by camlidl. Nevertheless, I guess it > could be possible to map an in_channel (or out_channel) CAML type to > a FILE struct. Unfortunately, there does not seem to be a basic type for this in camlidl - yet. Maybe the developers can tell us which would be the best way to do it with camlidl? Otherwise, it is always possible to use "c2ml" and"ml2c" for conversions. I haven't tried it, but the following might work: Use the conversion macros and functions defined in "byterun/io.{h,c}": The "Channel"-macro gives you access to the C-representation of OCaml-channels. Then you can get at the Unix file descriptor with: int fd = Channel(some_channel)->fd; Now you can use "fdopen" (see man page for details): FILE *file = fdopen(fd, some_mode); It doesn't look terribly difficult, but some support for this in camlidl would be very nice! Or maybe there are already other (better) ways to do it? Best regards, Markus Mottl -- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl