pTAL Conversion Guide

Procedures, Subprocedures, and Procedure
Pointers
pTAL Conversion Guide527302-002
16-13
Procedures as Formal Parameters
Procedures as Formal Parameters
TAL
In TAL, you can declare a formal parameter of type PROC.
In the Example 16-6, the compiler cannot check that the procedure p1 has the same
procedure attributes and parameter definitions as the procedure that procedure p2
calls; therefore, you must ensure that the procedure that p2 calls has the correct
attributes and parameters.
In TAL, the actual parameter passed to the formal parameter, pp, to procedure p can,
optionally, be prefixed with an @ character when p is called.
pTAL
In pTAL, 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 16-6. PROC Parameters (TAL)
PROC p1(i);
INT i;
BEGIN
...
END;
PROC p2(a_proc); ! Parameter of procedure p2 is a procedure,
PROC a_proc; ! a_proc
BEGIN
CALL a_proc(3); ! Call the procedure that was passed to p2
END; ! (actual parameter for a_proc)
CALL p2(p1); ! Call p2 with procedure p1
Example 16-7. @ Before Actual Procedure Parameters (pTAL) (page 1 of 2)
PROC a(i);
INT i;
EXTERNAL;
PROC b(p);
PROCPTR p(a);
INT a;
END PROCPTR;
EXTERNAL;