5. Embedded QUEL for Ada : Ada Variables and Data Types : Variable and Type Declarations : Record Type Definitions
 
Share this page                  
Record Type Definitions
The syntax of an EQUEL/Ada record type definition is:
record
              
record_component {record_component}
end record;
where record_component is:
component_declarationvariant_partnull;
where component_declaration is:
identifier {identifier:
              
type_name [type_constraint] [:= initial_value]
In the context of a type declaration, the syntax of a record type definition is:
type identifier is
              record
                            
record_component record_component}
              end record;
Syntax Notes:
1. In a component_declaration, all clauses have the same rules and restrictions as they do in a regular type declaration. For example, as in regular declarations, the preprocessor does not check initial values for correctness.
2. The variant_part accepts the Ada syntax for variant records: if specified, it must be the last component of the record. The variant discriminant name, choice names, and choice ranges are all accepted. There is no syntactic or semantic checking on those variant objects. EQUEL uses only the final component names of the variant part and not any of the variant object names.
3. You can specify the null record.
4. A record_component can also be Ada host code. Consequently, you can include components that will not be used by EQUEL (and with types unknown to EQUEL), by not marking the line with a ## mark. Also, if some variant_part syntaxes are not accepted by EQUEL, you do not have to mark those lines, as EQUEL does not store the variant information. For example:
## type Address_Rec is
## record
##    street: String(1..30);
##    town: String(1..10);
##    zip: Positive;
## end record;
 
## type Employee_Rec is
## record
##    name:   String(1..20);
##    age:    Short_Short_Integer;
##    salary: Float := 0.0;
##    address: Address_Rec;
-- The following two components are unknown to EQUEL
        scale:   Long_Long_Float;
        checked: Boolean := FALSE;
## end record;