HP Pascal/iX Reference Manual (31502-90022)

4-: 17
Record Selector
A
record selector
accesses a
field
of a record. The record selector
follows a record designator and consists of a period and the name of a
field. A record designator is the variable name of a record, the
selected component of a structure that is a record, or a function call
that returns a record.
The WITH statement "opens the scope" of a record. This makes it
unnecessary to specify a record selector.
Syntax
Record_selector:
Example
PROGRAM show_recordselector;
TYPE
r_type = RECORD
f1: integer;
f2: char;
END;
VAR
a,b : integer;
ch : char;
r : r_type;
rec_array : ARRAY [1..10] OF r_type;
BEGIN
.
a:= r.f1 + b; { Adds the current value of integer field }
. { of r to b and assigns the result to a. }
.
rec_array[a].f2:= ch; { Assigns current value of ch to char }
. { field of the a'th component of rec_array. }
END.
Set Constructor
A
set constructor
designates one or more values as members of a set whose
type may or may not have been previously declared. A set constructor
consists of an optional set type identifier and one or more ordinal
expressions in square brackets. Two expressions may serve as the lower
and upper bound of a subrange.
If the set type identifier is specified, the values in the brackets must
be assignment compatible with the base type of the set. If no set type
identifier appears, the values must be type compatible with each other.
The symbols (. and .) may replace the left and right brackets,
respectively.
Set constructors may appear as operands in expressions in executable
statements. Set constructors with constant values are legal in the
constant declaration sections.
A set constructor of the form [i..j] where i and j are integral-type
variables, is defaulted to a set of integer (set of 0..255). If it
appears in an expression and the size of the other operand is larger than
zero to 255, [i..j] is assumed to be the size of the other operand.