Re: C Bitfields in D

2010-12-08 Thread BLS
On 08/12/2010 02:23, Simen kjaeraas wrote: Andrej Mitrovic wrote: Cool! But, when is "ctod.exe" coming out? :p That should have been "cpptod". ;) As soon as you write it. See d.announce SWIG for D :)

Re: C Bitfields in D

2010-12-07 Thread Simen kjaeraas
Andrej Mitrovic wrote: Cool! But, when is "ctod.exe" coming out? :p That should have been "cpptod". ;) As soon as you write it. -- Simen

Re: C Bitfields in D

2010-12-07 Thread Andrej Mitrovic
On 12/8/10, Andrej Mitrovic wrote: > On 12/8/10, Walter Bright wrote: >> Andrej Mitrovic wrote: >>> I haven't tried but maybe htod can help, try copypasting the code to a >>> header file and run it through htod. There's also some flags htod can >>> take to simplify the output, iirc. But maybe hto

Re: C Bitfields in D

2010-12-07 Thread Andrej Mitrovic
On 12/8/10, Walter Bright wrote: > Andrej Mitrovic wrote: >> I haven't tried but maybe htod can help, try copypasting the code to a >> header file and run it through htod. There's also some flags htod can >> take to simplify the output, iirc. But maybe htod isn't clever enough >> to do bitfields..

Re: C Bitfields in D

2010-12-07 Thread Walter Bright
Andrej Mitrovic wrote: I haven't tried but maybe htod can help, try copypasting the code to a header file and run it through htod. There's also some flags htod can take to simplify the output, iirc. But maybe htod isn't clever enough to do bitfields.. htod does bitfields. Give it a try!

Re: C Bitfields in D

2010-12-07 Thread Jesse Phillips
Jonathan M Davis Wrote: > Okay. I'm trying to get some C code to be properly callable from some D code, > which naturally involves some extern(C) blocks. One of the types that I have > to > deal with looks something like this: > > typedef struct > { > unsigned i:1; > } my_s

Re: C Bitfields in D

2010-12-07 Thread Ali Çehreli
Stanislav Blinov wrote: >> But bitfields in C may not use the same alignments used by >> bitfields!() on DMD so I think you have to test the sanity of the >> whole thing for each combination of D compiler, operating system and C >> compiler. > > hm... what alignments are you talking about? bitfie

Re: C Bitfields in D

2010-12-07 Thread Stanislav Blinov
bearophile wrote: Stanislav Blinov: I'm under the impression that struct my_struct { mixin(bitfields!( uint, "i", 1, uint, "", 31)); } should do the trick. But bitfields in C may not use the same alignments used by bitfields!() on DMD so I think you have to test the sanity of the whole thi

Re: C Bitfields in D

2010-12-07 Thread bearophile
Stanislav Blinov: > I'm under the impression that > > struct my_struct > { > mixin(bitfields!( > uint, "i", 1, > uint, "", 31)); > } > > should do the trick. But bitfields in C may not use the same alignments used by bitfields!() on DMD so I think you have to test the sanity of the whole thing

Re: C Bitfields in D

2010-12-07 Thread Andrej Mitrovic
I haven't tried but maybe htod can help, try copypasting the code to a header file and run it through htod. There's also some flags htod can take to simplify the output, iirc. But maybe htod isn't clever enough to do bitfields.. On 12/7/10, Stanislav Blinov wrote: > 07.12.2010 11:58, Jonathan M D

Re: C Bitfields in D

2010-12-07 Thread Stanislav Blinov
07.12.2010 11:58, Jonathan M Davis пишет: Okay. I'm trying to get some C code to be properly callable from some D code, which naturally involves some extern(C) blocks. One of the types that I have to deal with looks something like this: typedef struct { unsigned i:1; } my

C Bitfields in D

2010-12-07 Thread Jonathan M Davis
Okay. I'm trying to get some C code to be properly callable from some D code, which naturally involves some extern(C) blocks. One of the types that I have to deal with looks something like this: typedef struct { unsigned i:1; } my_struct; I have no idea how to do such a bitf