HP Pascal/iX Programmer's Guide (31502-90023)
7- 7
Table 7-2. Routine Parameters versus Parameters of Routine Type
----------------------------------------------------------------------------------------------
| | | |
| | Routine Parameter | Parameter of Routine Type |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Availability | ANSI Pascal | System programming extensions. |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Where Defined | Formal parameter list of | Parameter is defined in formal |
| | routine. | parameter list of routine, but its |
| | | type is defined first in a type |
| | | declaration section. |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Corresponding Actual | User-defined routine. |
addr
applied to user-defined routine, |
| Parameter | | or variable of a routine type. |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Referenced By | Name |
Fcall
or
call
routine. |
| | | |
----------------------------------------------------------------------------------------------
Routine Parameters
Routine parameters
(procedure or functions parameters) are parameters
that are routines (procedures or functions, respectively). They are
completely defined in the formal parameter lists of other routines, which
reference them by name.
A formal function parameter is a function definition. Its actual
parameter is the name of a user-defined function with a congruent
parameter list and the same result type.
A formal procedure parameter is a procedure definition. Its actual
parameter is the name of a user-defined procedure with a congruent
parameter list.
Predefined routines cannot be passed to routine parameters.
Example
PROGRAM prog;
VAR
s : char;
PROCEDURE p (PROCEDURE procparm1 (a,b : integer);
{formal procedure parameter}
FUNCTION funcparm1 (c : integer) : char);
VAR
ch : char;
BEGIN
procparm1(1,2);
ch := funcparm1(3);
END;
FUNCTION f (PROCEDURE procparm2; {formal procedure parameter}
FUNCTION funcparm2 : integer); {formal function parameter}
VAR
i : integer;
BEGIN
procparm2;
i := funcparm2;
END;
PROCEDURE actual_procparm1 (x,y : integer); {user-defined procedure}
BEGIN
.
.