[fpc-pascal] FPC Advanced Records
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Fri Mar 9 22:26:30 CET 2012
Jonas Maebe wrote:
> On 09 Mar 2012, at 21:38, Mark Morgan Lloyd wrote:
>
>> Can an Advanced Record, i.e. a record which as well as having fields has at least one embedded function, be safely used as a cast or type transfer overlaying unstructured bytes?
>
> Yes.
Thanks Jonas, I don't think I need to do it but I thought it was a fair
question: better safe than sorry.
OK, so hopefully I can get away with another. I'm looking at a program
written in Delphi, which reads a file containing the image of an IBM
mainframe tape. This has a record:
Type TAWSHeader=Record
ThisSize: Word;
..
ThisSize is defined as being in Intel-style little-endian format, so I'm
going to have problems if compiling the program for SPARC or
(hypothetically) zSeries which are big-endian. If I understand things
correctly I can do this:
Type TAWSHeader=Record
ThisSizeLE: Word;
function ThisSize: Word;
..
but is there any way to define something like an endianness-correcting
type, i.e.:
Type TAWSHeader=Record
ThisSize: WordLE;
..
where by the time ThisSize is accessed any disparity has been corrected?
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-pascal
mailing list