Re: [fpc-pascal] alignment of records

2015-08-10 Thread Ralf Quint
On 8/8/2015 12:30 AM, Sven Barth wrote: Am 08.08.2015 00:37 schrieb "Ralf Quint" >: > > On 8/6/2015 8:25 PM, Xiangrong Fang wrote: >> >> It seems that $packrecord does not work at all. > > I always explicitly use PACKED Record as in > > Type ifmap = PACKED Record >

Re: [fpc-pascal] alignment of records

2015-08-08 Thread Luca Olivetti
El 08/08/15 a les 09:30, Sven Barth ha escrit: Am 08.08.2015 00:37 schrieb "Ralf Quint" mailto:freedos...@gmail.com>>: > > On 8/6/2015 8:25 PM, Xiangrong Fang wrote: >> >> It seems that $packrecord does not work at all. > > I always explicitly use PACKED Record as in > > Type ifmap = PACK

Re: [fpc-pascal] alignment of records

2015-08-08 Thread Sven Barth
Am 08.08.2015 00:37 schrieb "Ralf Quint" : > > On 8/6/2015 8:25 PM, Xiangrong Fang wrote: >> >> It seems that $packrecord does not work at all. > > I always explicitly use PACKED Record as in > > Type ifmap = PACKED Record > mem_start: dword; > mem_end: d

Re: [fpc-pascal] alignment of records

2015-08-07 Thread Ralf Quint
On 8/6/2015 8:25 PM, Xiangrong Fang wrote: It seems that $packrecord does not work at all. I always explicitly use PACKED Record as in /T//ypeifmap = PACKED Record/ / mem_start: dword;/ / mem_end: dword;/ ///b//ase_addr: word;/ /

Re: [fpc-pascal] alignment of records

2015-08-07 Thread Peter
On 07/08/15 12:58, Peter wrote: > However, I can't get it to pass Should have been "get it to parse" of course. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] alignment of records

2015-08-07 Thread Peter
On 07/08/15 07:32, Jonas Maebe wrote: > ... > Then it seems that h2pas is pretty broken. > ... FWIW, I had better results in the past using a tool called ToPas http://sourceforge.net/projects/topas/ It will run under wine in linux. However, I can't get it to pass standard #include style directiv

Re: [fpc-pascal] alignment of records

2015-08-07 Thread Sven Barth
Am 07.08.2015 08:07 schrieb "Xiangrong Fang" : >> >> By using the correct types for the fields: http://www.freepascal.org/docs-html/rtl/ctypes/index-3.html >> >> E.g., "unsigned long" is not (always) the same as "dword". >> ​ >> > ​OK, as a matter of fact, the stuff was copied from output of h2pas

Re: [fpc-pascal] alignment of records

2015-08-06 Thread Jonas Maebe
Xiangrong Fang wrote: ​OK, as a matter of fact, the stuff was copied from output of h2pas conversion program. :-) Then it seems that h2pas is pretty broken. However, another issue: if I use this : ​{$CODEALIGN RECORDMIN=4} It worked. No, it didn't. The record definition was still wrong.

Re: [fpc-pascal] alignment of records

2015-08-06 Thread Xiangrong Fang
> > By using the correct types for the fields: > http://www.freepascal.org/docs-html/rtl/ctypes/index-3.html > > E.g., "unsigned long" is not (always) the same as "dword". > ​ > > ​OK, as a matter of fact, the stuff was copied from output of h2pas conversion program. :-) I will use ctypes to test

Re: [fpc-pascal] alignment of records

2015-08-06 Thread Jonas Maebe
Xiangrong Fang wrote: It seems that $packrecord does not work at all. It works fine. I did some research and found this document: http://www.freepascal.org/docs-html/ref/refsu19.html The documentation seems to be outdated regarding the alignment of arrays. Arrays probably used to be align

Re: [fpc-pascal] alignment of records

2015-08-06 Thread Jonas Maebe
Xiangrong Fang wrote: program test; {$mode objfpc}{$PACKRECORDS C} type ifmap = record mem_start: dword; mem_end: dword; base_addr: word; irq: byte; dma: byte; port: byte; end; begin WriteLn('ifmap=', SizeOf(ifmap)); end. The C struct's size is 24, but pas

Re: [fpc-pascal] alignment of records

2015-08-06 Thread Xiangrong Fang
It seems that $packrecord does not work at all. I did some research and found this document: http://www.freepascal.org/docs-html/ref/refsu19.html compiled and ran the example on that page, I got: ​​Size Trec1 : 4 Offset B : 2 Size Trec2 : 3 Offset B : 1 Size Trec3 : 2 Offset B : 1 Size Trec4 :