HP Pascal/iX Programmer's Guide (31502-90023)

7- 6
different but structurally equivalent ways.
Example 2
VAR
var1 : ARRAY [3..5,1..10] OF integer;
var2 : ARRAY [3..5] OF ARRAY [1..10] OF integer;
PROCEDURE p (yes1 : ARRAY [lb1..ub1 : itype] OF
ARRAY [lb2..ub2 : itype] OF integer;
yes2 : ARRAY [lb3..lb3 : itype;
lb4..ub4 : itype] OF integer;
no1 : ARRAY [lb5..ub5 : itype] OF integer;
no2 : ARRAY [lb6..ub6 : itype;
lb7..ub7 : itype;
lb8..ub8 : itype] OF integer);
The declarations of the array variables var1 and var2 are structurally
equivalent, as are the schemas of conformant array parameters yes1 and
yes2. Both var1 and var2 conform to the schemas of yes1 and yes2.
Neither var1 nor var2 conforms to the schema of no1 or no2.
When a conformant array schema is a formal parameter, its bounds are also
formal parameters. They are read-only parameters. The actual parameter
for the formal conformant array schema is an array, and its bounds are
the actual parameters of the formal bounds parameters.
Example 3
TYPE
itype = 0..20;
VAR
v : ARRAY [0..10] OF integer;
PROCEDURE p (x : ARRAY [lb..ub : itype] OF integer);
BEGIN
p(v);
END;
The conformant array schema x is a formal parameter, so its
bounds, lb and ub are read-only formal parameters. The array v is
the actual parameter for x. The lower bound of v, zero, is the
actual parameter for lb. The upper bound of v (10) is the actual
parameter for ub.
When HP Pascal passes an actual parameter to a formal conformant array
parameter of more than one dimension, it also passes one hidden parameter
for each inner dimension that is itself a conformant array. See "Hidden
Parameters" for more information.
Routines as Parameters
A routine can be a parameter in two ways: it can be a routine parameter
(a procedure or function parameter, as defined by ANSI Pascal), or it can
be a routine that is passed as a parameter (as defined by the systems
programming extensions of HP Pascal).
Table 7-2 differentiates between routine parameters and parameters of
routine types.