t_ctor6.mod 606 B

123456789101112131415
  1. MODULE tctor6;
  2. // Runtime record constructor with a CHAR-array field from a string and a
  3. // nested record field from a variable (gnu strcons.mod shape).
  4. TYPE DateType = RECORD year, month, day: CARDINAL END;
  5. TYPE NameType = ARRAY [0..24] OF CHAR;
  6. PersonType = RECORD name: NameType; dob: DateType END;
  7. VAR d : DateType; p : PersonType;
  8. VAR ExitCode : INTEGER;
  9. BEGIN
  10. d.year := 1; d.month := 2; d.day := 3;
  11. d := DateType{1623, 6, 19};
  12. p := PersonType{"Blaise Pascal", d};
  13. IF (p.name[0] = 'B') AND (p.name[7] = 'P') AND (p.dob.year = 1623)
  14. THEN ExitCode := 0 ELSE ExitCode := 1 END
  15. END tctor6.