13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ecord tag fields given an identifier occupy the same space as they would ifthey were ordinary fields. Free union variants have no tag fields. Theexample below indicates the memory space allocated to each field in atypical record, including the variant part:PACKED RECORDHAME : STRIHG;SEX : CMALE, FEMALE>;ID : e .. 8191MARRIED:BOOLEAH;CASE HASCHILDREH:BOOLEAH OF{11 words}{1 bit>{13 bits}{ 1 bit}{ 1 bit}EHD;In this case, the total record size is 14 words with the first 11 words going tothe NAME field, the next word for the SEX, ID, MARRIED, andHASCHILDREN fields, and the last two words either going to theNUMCHILDREN and OLDEST fields or to the STERILE and BLOODTYPEfields, depending on the value of the HASCHILDREN tag field.Because the allocation of fields starts with the least significant bit within aword, the SEX, ID, MARRIED, and HASCHILDREN fields are allocatedwithin word 12 as follows:SEX bit eID bits 1 .• 13MARRIED bit 14HASCHILDREN bit 15NUMCHILDREN and OLDEST are allocated words 13and14, respectively.However, if this case variant of the record had been declared asCASE HASCHILDREN:BOOLEAN OFTRUE:CNUMCHILDREN, OLDEST:INTEGER>;then OLDEST would have been allocated word 13 and NUMCHILDRENword 14, because the Compiler allocates fields backward within such a list.(This backward allocation also applies to lists of variables in VARdeclarations.)Variable SizesIII-323

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!