HP Pascal/iX Reference Manual (31502-90022)

8- 5
Example
TYPE
inxtype = 0..20;
...
PROCEDURE Proc1 (
P1: ARRAY[L1..H1:inxtype] OF ARRAY[L2..H2:inxtype] OF integer;
P2: PACKED ARRAY[L3..H3:inxtype] OF integer;
P3: ARRAY[L4..H4:inxtype] OF integer;
P4: ARRAY[L5..H5:inxtype;L6..U6:inxtype] OF integer);
...
VAR
V1: PACKED ARRAY[0..10] of integer;
V2: ARRAY [3..5,1..10] OF integer;
V3: ARRAY[1..50] OF integer;
V1 is conformable with P2, but not with P1, P3, and P4. V2 is
conformable with P1 and P4, but not with P2 or P3. V3 is comformable
with P3, but not with P1, P2, or P4.
Directives
A
directive
may replace a block in a procedure or function declaration.
In HP Standard Pascal, the only directive is FORWARD. This directive
makes it possible to postpone full declaration of a procedure or
function. Additional directives may be provided by particular
implementations. See the
HP Pascal/iX Programmer's Guide
or the
HP
Pascal/HP-UX Programmer's Guide
, depending on your implementation, for
information about those directives. Note that the term FORWARD may
appear as an identifier in source code and, at the same time, as a
directive.
FORWARD Directive
The FORWARD directive permits the full declaration of a procedure or
function to appear after a call to the procedure or function. For
example, if procedures A and B are declared on the same level, you must
use the FORWARD directive if A and B will call each other.
Example
PROCEDURE A; FORWARD;
PROCEDURE B;
BEGIN
.
A; { calls A }
.
END;
PROCEDURE A; { full declaration of A }
BEGIN
.
B; { calls B }
.
END;
The body of the function or procedure must be fully declared elsewhere in
the same block. Formal parameters, if any, and the function result type
must appear with the FORWARD declaration. These formal parameters and
the result type may be omitted when making the subsequent full
declaration. However, if repeated, they all must be present and
identical with the original formal parameters or result type.
The FORWARD directive may appear with a procedure or function at any
level.
Example
FUNCTION exclusive_or (x,y: Boolean): Boolean;