HP Pascal/iX Reference Manual (31502-90022)

3- 22
somefruit = SET OF apple..cherry;
poets = SET OF (Blake, Frost, Brecht);
some_set = SET OF 1..200;
PACKED
This reserved word indicates that the compiler should minimize data
storage even if the access time may be increased. The reserved word
PACKED may appear with an ARRAY, RECORD, SET, or FILE. By declaring a
PACKED structured data type, the amount of memory needed to store an item
is generally reduced. The decision to
pack
a particular data type
depends on many factors including available memory size, processor speed,
required response time, and volume of data. Therefore, a choice that is
valid for one environment may be quite inappropriate for another. It is
illegal to pass a component of a packed structure by reference.
Syntax
Packing:
Example
CONST
wordsize = 20;
VAR
buffer: ARRAY [1..wordsize] OF char;
word: PACKED ARRAY [1..wordsize] OF char;
String
In HP Pascal a
string
type consists of the standard identifier
string
and
an integer constant expression in square brackets that specifies the
maximum length.
Integer constant expressions
are constant expressions
that return an integer value, an unsigned integer being the simple case.
The limit for the maximum length is implementation defined, but must be
at least 255. The symbols (. and .) may replace the left and right
brackets, respectively.
Characters enclosed in single quotes are
string literals
. The compiler
interprets a string literal as type
PAC, string,
or
char,
depending on
the context.
When a formal reference parameter is type
string
, the maximum length need
not be specified. This allows actual string parameters to have various
maximum lengths.
A single component of a string can be accessed by using an integer
expression in square brackets as a selector. The numbering of the
characters in the string begins at one. Strings are initialized by
performing an operation that sets the current length, making an
assignment to the entire string or by calling
setstrlen
.
Syntax
String_type: