From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA02176; Thu, 29 Mar 2001 09:54:04 +0200 (MET DST) 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 JAA02183 for ; Thu, 29 Mar 2001 09:54:03 +0200 (MET DST) Received: from ext.lri.fr (ext.lri.fr [129.175.15.4]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f2T7s1910848 for ; Thu, 29 Mar 2001 09:54:01 +0200 (MET DST) Received: from pc803.lri.fr (IDENT:root@pc803 [129.175.8.114]) by ext.lri.fr (8.11.1/jtpda-5.3.2) with ESMTP id f2T7s2u25437 ; Thu, 29 Mar 2001 09:54:02 +0200 (MET DST) Received: by pc803.lri.fr (8.9.3/feuille) id JAA15541 ; Thu, 29 Mar 2001 09:54:02 +0200 X-Authentication-Warning: localhost.localdomain: filliatr set sender to filliatr@pc803 using -f From: Jean-Christophe Filliatre MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15042.59930.557493.133492@pc803> Date: Thu, 29 Mar 2001 09:54:02 +0200 (MEST) To: David Fox Cc: caml-list@inria.fr Subject: Re: [Caml-list] Quick question - accessing variant value from C In-Reply-To: References: X-Mailer: VM 6.49 under Emacs 20.4.1 Reply-To: Jean-Christophe.Filliatre@lri.fr (Jean-Christophe Filliatre) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, You can use the macros Is_long / Is_block to discriminate between Null and Address, since the first one is represented as an integer and the second one as a structured block (in the later case, you can then access the string with the Field macro). Hope this helps, -- Jean-Christophe FILLIATRE mailto:Jean-Christophe.Filliatre@lri.fr http://www.lri.fr/~filliatr David Fox writes: > I have a value of the following type being passed to an external: > > type pointer = Null | Address of string > > and I'd like to determine (in the C code) which variant the value is > and get the pointer to the string. I've stared at mlvalues.h for a > while, but I can't really figure it out. Can anyone help? You won't > regret it... > ------------------- > To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr