t63_record.pas 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. program t63_record;
  2. { t63 -- record TYPES: field list, non-compacted layout, and the size. CALC's
  3. record is CALC.PAS:126:
  4. CellRec = record
  5. CellStatus : set of Attributes; -- 1: set of 0..5, one byte
  6. Contents : String[70]; -- 71: length byte + 70
  7. Value : Real; -- 6
  8. DEC, FW : 0..20; -- 1+1: a subrange with both bounds
  9. in 0..255 is ONE byte
  10. end; -- = 80
  11. Section 3 of CALC-COMPILE.md measured CellRec at 80 from the original's data
  12. report, so "data=84" here (CellRec 80 + the two @@T temporaries) IS the
  13. assertion that the layout is right: a difference of one byte in any field
  14. moves it. Subrange sizing is load-bearing for the same reason: "0..20" must
  15. be one byte, per RESUME-TP3.md section 2, or CellRec would be 82 and Sheet
  16. 240 bytes too big.
  17. Field SELECTION ("c.DEC", "Sheet[FX,FY].CellStatus") is the next increment;
  18. today it is a loud error, not a wrong address. }
  19. type
  20. Attributes = (Constant, Formula, Txt, OverWritten, Locked, Calculated);
  21. CellRec = record
  22. CellStatus : set of Attributes;
  23. Contents : String[70];
  24. Value : Real;
  25. DEC, FW : 0..20;
  26. end;
  27. var
  28. c : CellRec;
  29. begin
  30. writeln ('a CellRec is 80 bytes')
  31. end.