HP Pascal/iX Reference Manual (31502-90022)

11- 40
...
IF (haveoptvarparm( parm2 )) THEN { ok to use parm2 }
...
IF (haveoptvarparm( parm3 )) THEN { ok to use parm3 }
...
END;
The procedure proc_with_opt_parms in the previous example has three VAR
parameters, two of which are optional. Before using one of the two
parameters within proc_with_opt_parms, a check is made to ensure that the
parameters were supplied by the user. This check is accomplished by
calling haveoptvarparm with the name of the parameter in question as its
argument.
Routine Mechanisms
Call.
The predefined procedure call invokes a procedure.
Usage
call
(procedure_expression)
call
(procedure_expression,parameter ...)
Parameters
procedure_expression
An expression whose value is a reference to a
procedure whose formal parameter list is congruent
with the parameters specified in the call.
parameter
An actual parameter that is compatible with the
corresponding formal parameter of the PROCEDURE
type of procedure_expression, that is passed to
the invoked procedure.
Description
The predefined procedure call causes the indicated procedure to be called
with the indicated parameters.
If, during the execution of the procedure, call accesses any non-local
variables, the variables accessed are the variables that were accessible
at the time the reference to the procedure was made, when it was passed
as an argument to the predefined function, addr. It is an error if the
procedure expression has the value NIL or is undefined. It may not be
possible to detect an undefined procedure reference.
Example
TYPE
procedure_type = PROCEDURE( i : integer );
VAR
int : integer;
proc_var : procedure_type;
PROCEDURE proc( int : integer );
BEGIN
...
END;
BEGIN
proc( int );
proc_var := addr( proc );
call( proc_var, int );