* [Caml-list] Conditional compilation in interface files
@ 2004-07-22 21:43 Julian Brown
0 siblings, 0 replies; only message in thread
From: Julian Brown @ 2004-07-22 21:43 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-07-22 21:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-22 21:43 [Caml-list] Conditional compilation in interface files Julian Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).