HP Pascal/iX Reference Manual (31502-90022)

5:- 5
CONST
true_values = Boolean_table [5 OF true];
init_values1 = table [100 OF 0];
init_values2 = table [60 OF 0, 40 OF 1];
identity = matrix [row [1, 0, 0, 0, 0],
row [0, 1, 0, 0, 0],
row [0, 0, 1, 0, 0],
row [0, 0, 0, 1, 0],
row [0, 0, 0, 0, 1]];
colors = color_array [color_string ['RED', 3 OF ' '],
color_string ['YELLOW'],
color_string ['BLUE', 2 OF ' ']];
The name of the previously declared constant may be specified within a
structured constant. The previous example can also be written as
indicated below. Note that for the special case of PAC that if all of
the components are not specified, as in the example below, the remaining
components are filled with blanks as assignment compatibility indicates.
CONST
red = 'RED';
yellow = 'YELLOW';
blue = 'BLUE';
colors = color_array [ color_string[red];
color_string[yellow];
color_string[blue] ];
Record Constructor
A
record constant
is a declared constant defined with a
record
constructor
that specifies values for the fields of a record type. A
record constant may be used to initialize a variable in the body of a
block. Individual fields of a record constant in the body of a block may
be selected, but not when defining other constants.
A
record constructor
consists of a previously declared record type
identifier and a list in square brackets of fields and values. All
fields of the record type must appear, but not necessarily in the order
of their declaration. Values in the construct or must be assignment
compatible with the fields. Note that a record constructor is only legal
in the CONST section of a declaration part. It cannot appear in other
sections or in an executable statement.
For records with variants, the constructor must specify the tag field
before any variant fields. Then only the variant fields associated with
the value of the tag may appear. For records with tagless variants, the
initial variant field selects the variant.
The values may be constant values or constructors. To use a constructor
as a value, the field in the record type must be defined with a type
identifier. A record constant may not contain a file.
Syntax
Record_constructor: