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

7- 14
v1 : ^integer;
FUNCTION f (a,b : integer) : integer;
BEGIN
f := (a+b)*(a-b);
END;
BEGIN
new(v1);
funcvar := addr(f);
v1^ := fcall(funcvar,27,94);
v1^ := f(27,94);
END.
The calls to the functions
fcall
and f are semantically
equivalent.
The first parameter to
fcall
(the function variable) cannot have the
value
nil
or be undefined.
Congruent Parameter Lists
Two parameter lists are
congruent
if they have the same number of
parameters, and if parameters in the same positions are equivalent.
Two parameters are
equivalent
if any one of the following is true:
* They are value parameters of identical type.
* They are VAR parameters of identical type.
* They are parameters of procedure type with congruent parameter
lists.
* They are parameters of function type with congruent parameter
lists and identical result types.
* They are value conformant array parameters with equivalent
schemas.
* They are VAR conformant array parameters with equivalent schemas.
Two conformant array schemas are
equivalent
if all of the following are
true:
* Both are PACKED, or neither is PACKED.
* Corresponding index type specifications specify the same type.
* They have the same element type. If they have schemas for element
types, then those schemas are equivalent.
Example 1
This program uses procedure parameters whose own parameter lists do not
include conformant array parameters, function parameters, or other
procedure parameters.
PROGRAM prog;
VAR
r : real;
PROCEDURE proc (PROCEDURE procvar (x : integer; VAR y : char));
BEGIN
.