HP Pascal/iX Reference Manual (31502-90022)

3- 21
date_info = PACKED RECORD { fixed part only }
mo: (jan, feb, mar, apr, may, jun,
jul, aug, sep, oct, nov, dec);
da: 1..31;
yr: 1900..2001;
END;
marital_status = (married, separated, divorced, single);
name_string = PACKED ARRAY [1..30] of CHAR;
person_info = RECORD { nested variant parts }
name: name_string;
born: date_info;
CASE status: marital_status of
married..divorced:
(when: date_info;
CASE has_kids: Boolean OF
true: (how_many: 1..50);
false: (); { Empty variant }
)
single: ();
END;
Set
A
set
is a user-defined, structured type that is the power set consisting
of the set of all subsets of a
base type
. A set type consists of the
reserved words SET OF and a
base type
. The
base type
may be any ordinal
type. The maximum number of elements is implementation defined, but must
be at least 256 elements. It is legal to declare a packed set. However,
whether this affects the storage is implementation dependent. HP Pascal
defines "SET OF integer" (or any other integral-type) as "SET OF 0..255".
Syntax
Set_type:
Permissible Operators
assignment :=
union +
intersection *
difference -
subset <=
superset >=
equality =, <>
inclusion IN
Example
TYPE
charset = SET OF char;
fruit = (apple, banana, cherry, peach, pear, pineapple);