From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA14261; Thu, 17 Jun 2004 22:00:53 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 WAA06913 for ; Thu, 17 Jun 2004 22:00:52 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i5HK0pSH024743; Thu, 17 Jun 2004 22:00:51 +0200 Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA14148; Thu, 17 Jun 2004 22:00:51 +0200 (MET DST) Date: Thu, 17 Jun 2004 22:00:51 +0200 From: Xavier Leroy To: Shishir Ramam Cc: caml-list@inria.fr Subject: Re: [Caml-list] Using Ocaml keywords as structure members. Message-ID: <20040617220051.A14078@pauillac.inria.fr> References: <40D0750F.2080307@lifl.fr> <20040616171022.31544.qmail@web52804.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <20040616171022.31544.qmail@web52804.mail.yahoo.com>; from sramam@yahoo.com on Wed, Jun 16, 2004 at 10:10:22AM -0700 X-Miltered: at concorde with ID 40D1F873.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 renaming:01 mlname:01 struct:01 mlname:01 struct:01 idl:01 idl:01 typedef:01 typedef:01 ocaml:01 ocaml:01 caml:01 camlidl:01 camlidl:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > I am interesting in converting a data-structure from > C to Ocaml using CamlIdl. I am running into some > trouble because one of the structure members is > named "end". > Apart from renaming the structure member in > C (3rd party, lotsa work!), is there anything else > that I can do? Yes: use the "mlname" attribute. In the IDL file: struct a_test { int start; [mlname(end_)] int end; }; > A common C coding convention is to use > struct definitions of the form - > > --------- > > typedef struct a { > int x; > int y; > } a; > > -------- > Using CamlIdl, this results in a conversion to [incorrect Caml code] I'd suggest to change the IDL file (and only the IDL file) to either typedef struct { int x; int y; } a; // use "a" instead of "struct a" everywhere else or struct a { int x; int y; }; // use "struct a" instead of "a" everywhere else Note that I'm not suggesting you do this change in the .c and .h sources for the original C code. IDL descriptions can (and often need to) omit some aspects of the C interface they describe. - Xavier Leroy ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners