From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 4A040BDCB for ; Tue, 6 Sep 2005 21:36:31 +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 j86JaUoJ030963 for ; Tue, 6 Sep 2005 21:36:30 +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 VAA10862 for ; Tue, 6 Sep 2005 21:36:30 +0200 (MET DST) Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j86JaTPx023318 for ; Tue, 6 Sep 2005 21:36:29 +0200 Received: from frontend1.internal (mysql-sessions.internal [10.202.2.149]) by frontend1.messagingengine.com (Postfix) with ESMTP id 8E735CCE9A7; Tue, 6 Sep 2005 15:36:27 -0400 (EDT) Received: from frontend2.messagingengine.com ([10.202.2.151]) by frontend1.internal (MEProxy); Tue, 06 Sep 2005 15:36:27 -0400 X-Sasl-enc: wLw56+riMul/7+kCnbpKM211N5TDhKwWKc6FzV9k59ER 1126035386 Received: from [172.16.112.115] (burnham.ljcrf.edu [192.231.106.2]) by frontend2.messagingengine.com (Postfix) with ESMTP id 0D71957035A; Tue, 6 Sep 2005 15:36:25 -0400 (EDT) Date: Tue, 6 Sep 2005 12:35:35 -0700 (PDT) From: Martin Jambon X-X-Sender: martin@droopy To: Dmitry Bely Cc: caml-list@inria.fr Subject: Re: [Caml-list] camlp4 pa_macro (doc request) In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at nez-perce with ID 431DEFBE.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 431DEFBD.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 toplevel:01 ifdef:01 ifdef:01 toplevel:01 2005,:98 wrote:01 defining:01 expression:01 expression:01 define:01 define:01 dmitry:01 jambon:01 jambon: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.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 On Tue, 6 Sep 2005, Dmitry Bely wrote: > Another question: is there an up-to-date Camlp4 > manual with all standard extensions (like pa_macro) properly documented? I copy-pasted what the source file says. I guess I could setup a web page with examples. Of course, it would be better if it were included in the official documentation. Thanks, Martin >>From camlp4/meta/pa_macro.ml: (* Added statements: At toplevel (structure item): DEFINE DEFINE = DEFINE () = IFDEF THEN (END | ENDIF) IFDEF THEN ELSE (END | ENDIF) IFNDEF THEN (END | ENDIF) IFNDEF THEN ELSE (END | ENDIF) INCLUDE In expressions: IFDEF THEN ELSE (END | ENDIF) IFNDEF THEN ELSE (END | ENDIF) __FILE__ __LOCATION__ In patterns: IFDEF THEN ELSE (END | ENDIF) IFNDEF THEN ELSE (END | ENDIF) As Camlp4 options: -D define -U undefine it -I add to the search path for INCLUDE'd files After having used a DEFINE followed by "= ", you can use it in expressions *and* in patterns. If the expression defining the macro cannot be used as a pattern, there is an error message if it is used in a pattern. The toplevel statement INCLUDE can be used to include a file containing macro definitions; note that files included in such a way can not have any non-macro toplevel items. The included files are looked up in directories passed in via the -I option, falling back to the current directory. The expression __FILE__ returns the current compiled file name. The expression __LOCATION__ returns the current location of itself. *)