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 XAA01409; Thu, 22 Jul 2004 23:44:07 +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 XAA01710 for ; Thu, 22 Jul 2004 23:44:06 +0200 (MET DST) Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i6MLi5SH020058 for ; Thu, 22 Jul 2004 23:44:05 +0200 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1BnlMB-0003oL-00 for ; Thu, 22 Jul 2004 23:44:05 +0200 Received: from panic.cs.bris.ac.uk ([137.222.103.158]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 22 Jul 2004 23:44:03 +0200 Received: from brown by panic.cs.bris.ac.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 22 Jul 2004 23:44:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Julian Brown Subject: [Caml-list] Conditional compilation in interface files Date: Thu, 22 Jul 2004 21:43:58 +0000 (UTC) Organization: University of Bristol Message-ID: Reply-To: brown@cs.bris.ac.uk X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: panic.cs.bris.ac.uk User-Agent: slrn/0.9.8.0 (Linux) X-Miltered: at concorde with ID 41003525.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; hooks:01 -pp:01 camlp:01 helper:01 alloc:01 helper:01 interf:01 interf:01 monolithic:01 ifdef:01 cmo:01 cmo:01 bool:01 bool:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, I have a program which is written in two parts, one of which works OK, and one of which isn't finished yet. These two parts are intermingled somewhat, but I'd like to be able to conditionally compile a version of the working part (on its own) with the hooks into the other part removed, so I can release it. My ideas so far are: * Use -pp with the C preprocessor (but it gets confused by some Ocaml syntax). * Use camlp4 with pa_macro.cmo, but I can't get it working! In particular, I can't get pa_macro.cmo to conditionally compile bits of interface files. I have this: IFDEF SIMONLY THEN class services : object method getdescriptor : int -> Unix.file_descr method getdishelp : disassembler_helper method insertdescriptor : int -> Unix.file_descr -> unit method killdescriptor : int -> unit method newdescriptor : Unix.file_descr -> int method querydescriptor : int -> bool method getoptlimit : int option method setoptlimit : int option -> unit method testoptok : bool method bumpopt : unit end ELSE class services : object method getallocator : Alloc.zone method getindexer : Index.indexer method getprofiler : Profiler.profiler method getdescriptor : int -> Unix.file_descr method getdishelp : disassembler_helper method insertdescriptor : int -> Unix.file_descr -> unit method killdescriptor : int -> unit method newdescriptor : Unix.file_descr -> int method querydescriptor : int -> bool method getoptlimit : int option method setoptlimit : int option -> unit method testoptok : bool method bumpopt : unit end ENDIF;; This gives me: Parse error: [interf] expected after [sig_item_semi] (in [interf]) The docs don't appear to suggest to me that it should work even. Is there a better way of doing this? (And do I have to use the revised syntax for this extension?) I'd like to keep my development code monolithic for now, so I don't really want to separate the unfinished bit into a shared library or anything like that. Any hints appreciated! I'm using Ocaml 3.07, 3.08.0 behaves the same for this. Cheers, Julian ------------------- 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