From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 79F3FBC48 for ; Mon, 18 Apr 2005 13:49:20 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j3IBnK4a016599 for ; Mon, 18 Apr 2005 13:49:20 +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 NAA07702 for ; Mon, 18 Apr 2005 13:49:19 +0200 (MET DST) Received: from ext.lri.fr (ext.lri.fr [129.175.15.4]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j3IBnJtb016596 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Mon, 18 Apr 2005 13:49:19 +0200 Received: from localhost (localhost [127.0.0.1]) by ext.lri.fr (Postfix) with ESMTP id 408B319E7B6; Mon, 18 Apr 2005 13:49:19 +0200 (CEST) Received: from ext.lri.fr ([127.0.0.1]) by localhost (ext.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14310-03; Mon, 18 Apr 2005 13:49:19 +0200 (CEST) Received: from smtp.lri.fr (serveur3-5 [129.175.3.5]) by ext.lri.fr (Postfix) with ESMTP id 2CF7719E79A; Mon, 18 Apr 2005 13:49:19 +0200 (CEST) Received: from pc8-142 (pc9-152 [129.175.9.152]) by smtp.lri.fr (Postfix) with ESMTP id 95B27CED98; Mon, 18 Apr 2005 13:49:18 +0200 (CEST) Received: from filliatr by pc8-142 with local (Exim 3.36 #1 (Debian)) id 1DNUkg-0004ne-00; Mon, 18 Apr 2005 13:49:18 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16995.40638.509323.719418@gargle.gargle.HOWL> Date: Mon, 18 Apr 2005 13:49:18 +0200 To: Paul Argentoff Cc: caml-list@inria.fr Subject: Re: [Caml-list] Ocaml <-> C In-Reply-To: <86pswscp6t.fsf@paul.rtelekom.ru> References: <86pswscp6t.fsf@paul.rtelekom.ru> X-Mailer: VM 7.18 under Emacs 21.3.1 From: Jean-Christophe Filliatre X-Virus-Scanned: by amavisd-new at lri.fr X-Miltered: at concorde with ID 42639EC0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42639EBF.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 filliatre:01 filliatre:01 lri:01 ocaml:01 ...:98 ...:98 writes:01 integer:01 functions:01 macros:01 match:02 parameter:02 chunk:02 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Hello, Paul Argentoff writes: > > Let's say we have a function: > > external f : t option -> unit = "c_f" > > How can I make analysis depending on the parameter, which in Ocaml is: > > match a with > | None -> chunk1 > | Some x -> chunk2 x > > What functions/macros from a standard ocaml includes set can I use? None is represented by an integer (0) and Some is pointing to a block. You can test for the former case with the macro Is_long: if (Is_long(v)) { ... None case ... } else { ... Some case ... ... you access to x here with Field(v, 0) ... } -- Jean-Christophe