Version française
Home     About     Download     Resources     Contact us    
Browse thread
camlp4 pa_macro
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Basile STARYNKEVITCH <basile@s...>
Subject: Re: [Caml-list] camlp4 pa_macro
Le Wed, Sep 07, 2005 at 01:03:07PM +0100, Peter Jolly écrivait/wrote:
> Dmitry Bely wrote:
> > Is it possible to achieve with pa_macro something like this:
> > 
> > IFDEF NDEBUG THEN
> > DEFINE LOG(expr) = ()
> > ELSE
> > DEFINE LOG(expr) = Printf.printf expr
> > ENDIF
> > ...
> > LOG("x=%d,y=%d" x y);
> > 
> > Unfortunately the code above does not work: debug version is OK, but then
> > NDEBUG is turned on I have
> > 
> > "This expression is not a function, it cannot be applied" on LOG()
> > expression.
> 

For information the pa_trace.ml file (for camlp4 for a pre 3.08
version of ocaml) did exactly what you want to achieve

you might look for POESIA on sourceforge at

http://sourceforge.net/project/showfiles.php?group_id=79887&release_id=1

download the source package http://prdownloads.sourceforge.net/poesia/poesiasoft_snapshot_20july2005.tar.gz?download

and look for the pa_trace.ml inside PoesiaMonIcap

this is orphaned software (GPL). I don't maintain it anymore, and I
believe it don't compile as-is on 3.08 because of the location change
in camlp4 since 3.06. Feel free to patch it for your needs.

Regards

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile(at)starynkevitch(dot)net 
8, rue de la Faïencerie, 92340 Bourg La Reine, France