Peter N Lewis wrote:
At 12:32 +0100 7/3/03, Adriaan van Os wrote:
We are running into a real problem while porting the Apple Pascal Interfaces to gpc.
For these two reasons I have an urgent feature request, which is to make --pack-struct available as a compiler option that can be added to the Pascal source code.
Unfortunately, it looks like this will not help :-(
--pack-struct appears to do exactly the same thing as "packed record", which is too strong because of the added restriction of failing with var parameters.
Unfortunately, you are right.
What is needed is a relaxation of the alignment restrictions when building a record, without the onerous restriction of bitfield packing. Presumably this would help with Borland compatibility as well.
Basically, we need something like --record-alignment={1,2,4} (and a corresponding compiler directive we can add to the system interfaces) so that items N bytes or larger are aligned to N bytes (where N is 1 2 or 4).
If this sounds reasonable, and if folks have advice on the exact user interface for this, then I'm willing to take a crack at this in the source to "get my feet wet".
Specific advice would include the exact name "record-alignment", whether it should take a parameter, or instead be --no-record-alignment, --record-alignment1, --record-alignment2, --record-alignment4. The latter would seem more in keeping with the options in general, as I could not find any other compiler directive that took a parameter, but correct me if I'm wrong.
--record-alignment=n (where n=0, 1, 2, 4)
Without this, it'll be *very* challenging to get the Mac Pascal interfaces working, as many of them date back to the '80s on a 68000 which had generally 2 byte alignment.
--pack-struct is a gcc option, not a gpc option, so I wonder if packing is a front-end or a back-end issue. I hope Frank knows. The Apple version of gcc (front-end or back-end) has the following options: malign-mac68k, -malign-power and -malign-natural.
Also, it would be important to know if the restriction of passing fields of packed records as actual variable parameters could be relaxed to only those cases where the field isn't aligned on byte boundaries (as a non ISO-Pascal feature).
Regards,
Adriaan van Os