Re: [polyml] CInterface and CType union

2012-08-20 Thread Pierre-Alain Bourdil
Hi, the structure is pretty simple : // This is a STRUCT3 struct A {...} struct B { enum {E1,E2} kind // ok for mapping enum union { int64_t ref ; // there was a discussion about int64 platform independant conversion. I just defined a Cint64_t as Clong struct A *a; } arg }

Re: [polyml] Word31 from SMLNJ

2012-08-20 Thread Phil Clayton
On 20/08/12 23:03, Gael Mulat wrote: Hi, Trying to port my code from SML/NJ to Poly/ML, I’m stuck with the Word31 structure. In SML/NJ, Word = Word31 and WORD signature defines operators <<, >> and ~>> like this: val op << : word * Word31.word -> word which is the same as val op << : word

[polyml] Word31 from SMLNJ

2012-08-20 Thread Gael Mulat
Hi, Trying to port my code from SML/NJ to Poly/ML, I'm stuck with the Word31 structure. In SML/NJ, Word = Word31 and WORD signature defines operators <<, >> and ~>> like this: val op << : word * Word31.word -> word This means that Word31 is the right operand for this operator, even in word32

Re: [polyml] CInterface and CType union

2012-08-20 Thread David Matthews
On 20/08/2012 17:04, Gabriel Dos Reis wrote: On Mon, Aug 20, 2012 at 10:27 AM, David Matthews wrote: On 20/08/2012 15:28, Pierre-Alain Bourdil wrote: In ForeignTest, the vol2tree method use fromClong to differentiate between NullTree, or Tree. My union, is made of 2 variants : a struct point

Re: [polyml] CInterface and CType union

2012-08-20 Thread Gabriel Dos Reis
On Mon, Aug 20, 2012 at 10:27 AM, David Matthews wrote: > On 20/08/2012 15:28, Pierre-Alain Bourdil wrote: >> >> >> In ForeignTest, the vol2tree method use fromClong to differentiate >> between NullTree, or Tree. My union, is made of 2 variants : a struct >> pointer and a int64_t . I can't figure

Re: [polyml] CInterface and CType union

2012-08-20 Thread David Matthews
On 20/08/2012 15:28, Pierre-Alain Bourdil wrote: In ForeignTest, the vol2tree method use fromClong to differentiate between NullTree, or Tree. My union, is made of 2 variants : a struct pointer and a int64_t . I can't figure out how to decide if a given vol is a pointer or an int64_t. is there

Re: [polyml] CInterface and CType union

2012-08-20 Thread Pierre-Alain Bourdil
In ForeignTest, the vol2tree method use fromClong to differentiate between NullTree, or Tree. My union, is made of 2 variants : a struct pointer and a int64_t . I can't figure out how to decide if a given vol is a pointer or an int64_t. is there a solution ? The inverse conversion is pretty

Re: [polyml] CInterface and CType union

2012-08-20 Thread David Matthews
Hi, I guess you would want to map between a union in C and a datatype in ML. That would require the union type to contain sufficient information to allow the conversion process to know which variant of the datatype to use, which isn't necessarily true of a C union. You might be able to adapt