Re: [fpc-pascal] does the following translation of a c struct to FPC is correct ?

2012-02-26 Thread ik
On Sun, Feb 26, 2012 at 15:19, Jonas Maebe wrote: > > On 26 Feb 2012, at 14:16, ik wrote: > >> I'ved replaced it to >> >> iphdr    = bitpacked record > > This is wrong. The record is a C record, and hence follows {$packrecord c} > rules. "bitpacked record" overrides any current {$packrecords x} s

Re: [fpc-pascal] does the following translation of a c struct to FPC is correct ?

2012-02-26 Thread Jonas Maebe
On 26 Feb 2012, at 14:16, ik wrote: > I'ved replaced it to > > iphdr= bitpacked record This is wrong. The record is a C record, and hence follows {$packrecord c} rules. "bitpacked record" overrides any current {$packrecords x} setting. That is the reason why I used the nested bitpacked re

Re: [fpc-pascal] does the following translation of a c struct to FPC is correct ?

2012-02-26 Thread ik
On Sun, Feb 26, 2012 at 15:08, Jonas Maebe wrote: > > On 26 Feb 2012, at 13:54, ik wrote: > >> to the following Pascal record: >> >> >> iphdr    = record >> {$IFDEF ENDIAN_LITTLE} >>              jhl     : Cardinal; // __u8      ihl:4, >>              version : Cardinal; // version:4 > > The ":4"

Re: [fpc-pascal] does the following translation of a c struct to FPC is correct ?

2012-02-26 Thread Jonas Maebe
On 26 Feb 2012, at 13:54, ik wrote: > to the following Pascal record: > > > iphdr= record > {$IFDEF ENDIAN_LITTLE} > jhl : Cardinal; // __u8 ihl:4, > version : Cardinal; // version:4 The ":4" in C means "4 bits", not 4 bytes. The correct translation in th

[fpc-pascal] does the following translation of a c struct to FPC is correct ?

2012-02-26 Thread ik
Hello, I translated the following struct struct iphdr { #if defined(__LITTLE_ENDIAN_BITFIELD) __u8ihl:4, version:4; #elif defined (__BIG_ENDIAN_BITFIELD) __u8version:4, ihl:4; #else #error "Please fix " #endif __u8tos; _