Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] canonical camlp4-suffix?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <markus@m...>
Subject: Re: [Caml-list] canonical camlp4-suffix?
On Tue, 04 Sep 2001, Daniel de Rauglaudre wrote:
> On Mon, Sep 03, 2001 at 05:58:40PM +0200, Markus Mottl wrote: I
> generally prefer using ".ml" and ".mli" because some tools of the
> compiler does not accept different suffixes (e.g. the debugger). For
> the rules, there are two methods:

Thanks, this is important to know! I don't want to have nasty side
effects when using a non-standard suffix so I'll stay with ".ml" and
".mli" and scan the file for suitable preprocessing options.

> 1/ add in source files comments specifying how compile the file; in the
>    Makefiles, call a shell script reading this comment and launching
>    the good command; it is the method I use in the sources of Camlp4
>    (see the files tools/Makefile.tpl and tools/camlp4_comm.sh in Camlp4
>    sources) and in GeneWeb (same kind of shell script): this shell
>    just calls ocamlc without -pp parameter if the comment is not found.

Ok, I had something like this in mind. Good to know where to find an
example implementation.

> 2/ compile all files with "-pp camlp4o" (or "-pp camlp4r" if you prefer
>    the revised syntax) and use "#load" in your files: this has been possible
>    (however not yet documented) since some versions of Camlp4. For example,

Nice! Though, if I already have to check for a preprocessing tag anyway,
I could also do things as follows:

The topmost line in a file could read like this:

  (*pp camlp4o -I some_dir some_quots.cmo some_more_quots.cmo *)

Then I just check for the 'pp' tag, and if it's there, I just take the
contents of the comment as parameter for the -pp option. This could then
also be a completely different preprocessor (cpp? ;).

Please tell me, if there is any hidden catch with this approach.
Thanks for the hints!

Regards,
Markus Mottl

-- 
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr