7. Embedded QUEL for Pascal : Pascal Variables and Data Types : Variable and Type Declarations : Record Type Definition
 
Share this page                  
Record Type Definition
The declaration for a record type definition has the following syntax:
type record_type_name =
  record
    field_list [;]
  end;
where field_list is:
field_element {field_element}
[case [tag_name :type_name of
  [case_element {case_element}]
  [otherwise ( field_list )]]
where field_element is:
field_name {, field_name} : type_definition
and case_element is:
case_label {, case_label} : ( field_list )
Syntax Notes:
1. All clauses of a record component have the same rules and restrictions as they do in a regular type declaration. For example, as with regular declarations, the preprocessor does not check dimensions for correctness.
2. In the case list, the case_labels may be numbers or names. The names need not be known to EQUEL.
3. Pascal host code is not a legal EQUEL record component. Consequently, all components of the record must be preceded by the ## mark. To minimize the effect of this restriction, the types quadruple and set of are allowed as legal types in an EQUEL record declaration. It is, however, an error to use variables of those types in EQUEL statements.
4. Components of a packed record cannot be passed to the EQUEL runtime routines. Therefore, you should not declare packed records to EQUEL.
The following example illustrates the use of a record type definition:
##  type
##           AddressRec = record
##              street: packed array[1..30] of Char;
##              town: packed array[1..10] of Char;
##              zip: 1 .. 9999;
##           end;

##           EmployeeRec = record
##              name: packed array[1..20] of Char;
##              age: [byte] 0 .. 128;
##              salary: Real;
##              address: AddressRec;
##              checked: Boolean;
##              scale: Quadruple;
                {Requires ##, but cannot be used by EQUEL}
##  end;