pTAL Reference Manual (H06.08+)

Procedures, Subprocedures, and Procedure
Pointers
HP pTAL Reference Manual523746-006
14-32
Declaring PROCPTRs as Formal Parameters
Declaring PROCPTRs as Formal Parameters
The compiler:
Ensures that the procedure attributes and parameter data types of procedures
passed as actual parameters match those defined in the formal parameters of the
called procedure
Builds parameter masks for calls to VARIABLE procedures and EXTENSIBLE
procedures
You can declare a formal parameter to be a PROCPTR as in the following example:
PROC p(pp);
PROCPTR pp(i, j);
INT i, j;
END PROCPTR;
BEGIN
...
END;
An @ character in front of the actual parameter is:
Not allowed if the formal parameter is a PROC or a PROCPTR
Required if the formal parameter is a PROCADDR
Example 14-16. PROCPTRs as Formal Parameters
PROC a(i);
INT i;
EXTERNAL;
PROC b(p);
PROCPTR p(a);
INT a;
END PROCPTR;
EXTERNAL;
PROC c(pa);
PROCADDR pa;
BEGIN
END;
PROC d;
BEGIN
CALL b(a); ! OK
CALL b(@a); ! ERROR: @ character is not valid
CALL c(a); ! ERROR: @ character is required
CALL c(@a); ! OK: @ character is required
END;