From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id B9E9BBDCB for ; Wed, 7 Sep 2005 14:28:36 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j87CSaEs018020 for ; Wed, 7 Sep 2005 14:28:36 +0200 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 OAA21957 for ; Wed, 7 Sep 2005 14:28:35 +0200 (MET DST) Received: from mallaury.nerim.net (smtp-103-wednesday.noc.nerim.net [62.4.17.103]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j87CSZnM018876 for ; Wed, 7 Sep 2005 14:28:35 +0200 Received: from ours.starynkevitch.net (ours.starynkevitch.net [62.212.121.80]) by mallaury.nerim.net (Postfix) with ESMTP id 469164F3FD; Wed, 7 Sep 2005 14:28:27 +0200 (CEST) Received: from basile by ours.starynkevitch.net with local (Exim 4.52) id 1ECz2Y-0002C6-Pe; Wed, 07 Sep 2005 14:28:34 +0200 Date: Wed, 7 Sep 2005 14:28:34 +0200 To: Peter Jolly Cc: caml-list@inria.fr Subject: Re: [Caml-list] camlp4 pa_macro Message-ID: <20050907122834.GA8107@ours.starynkevitch.net> References: <431ED6FB.9010009@jollys.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <431ED6FB.9010009@jollys.org> User-Agent: Mutt/1.5.10i From: Basile STARYNKEVITCH X-Miltered: at nez-perce with ID 431EDCF4.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 431EDCF3.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 basile:01 basile:01 ecrivait:01 ifdef:01 ndebug:01 expr:01 expr:01 printf:01 printf:01 ndebug:01 ocaml:01 poesia:01 prdownloads:01 poesia:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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