From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id EE001BC69 for ; Wed, 27 Jun 2007 00:00:39 +0200 (CEST) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5QM0c1T014649 for ; Wed, 27 Jun 2007 00:00:39 +0200 Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id 9CFA62C2AB5 for ; Tue, 26 Jun 2007 17:00:37 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id S7Vb4z4DNDQR for ; Tue, 26 Jun 2007 17:00:37 -0500 (CDT) Received: from [192.168.2.5] (ppp-70-250-226-84.dsl.hstntx.swbell.net [70.250.226.84]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id E18AF2C2AA4 for ; Tue, 26 Jun 2007 17:00:36 -0500 (CDT) Mime-Version: 1.0 (Apple Message framework v750) Content-Transfer-Encoding: 7bit Message-Id: <1B4EC64C-435D-42C5-95F3-C01869DD41FB@rice.edu> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: caml-list@yquem.inria.fr From: Raj B Subject: C-like macros in OCaml Date: Tue, 26 Jun 2007 17:00:40 -0500 X-Mailer: Apple Mail (2.750) X-Miltered: at concorde with ID 46818C86.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; c-like:01 ocaml:01 c-like:01 ocaml:01 foo:01 enumeration:01 enum:01 camlp:01 preprocessor:01 macros:01 macros:01 define:01 guess:04 bits:05 raj:05 Hi there Is there any way I can achieve the use of C-like preprocessor macros in OCaml? i.e. #define FOO 1 etc. I am using an array of bits (a bitset) where each bit represents a flag, and i would like to access this set by using names rather than remembering which index in the array represents which flag. Similarly, is there any way of getting a C-like enumeration? e.g. enum days {Mon = 1, Tue, Wed...} I guess that OCaml does not provide these by default, but I wonder if someone has done some camlp4 magic to use these. Thanks Raj