pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
The object data type of a reference to a function procedure pointer is the data type returned by
the procedure pointer.
You can equivalence a procedure pointer (PROCPTR, PROC32PTR, or PROC64PTR) to any previously
declared variable, if the width of the previous variable is greater than or equal to the width of the
procedure pointer.
You can assign and pass procedure pointers of smaller or equal size to other procedure pointers,
provided that the parameters and attributes match.
Example 212 Procedure Pointers as Variables and Formal Parameters
INT i;
INT .EXT j;
REAL k;
PROCADDR pa;
PROC32ADDR p32a;
PROC64addr p64a;
PROC p (i, j) EXTENSIBLE, CALLABLE; ! Declare PROC p in a
INT i, .EXT j; ! FORWARD declaration
FORWARD;
PROCPTR pp (i, j) EXTENSIBLE,CALLABLE; ! Declare PROCPTR a and
INT i, .EXT j; ! initialize it to point
END PROCPTR := @p; ! to PROC p
PROC64PTR p64pa (i, j) EXTENSIBLE,CALLABLE;! Declare PROC64PTR p64pa
INT i, .EXT j; ! and initialize it to point
END PROCPTR := @p; ! to PROC p
PROC64PTR p64pb (i, j) EXTENSIBLE,CALLABLE;! Declare PROC64PTR p64pb
INT i, .EXT j; ! and initialize it to point
END PROCPTR := @pp; ! to PROC p too
FIXED PROCPTR b (str : length); ! Declare FIXED PROCPTR b
STRING .str; INT length; ! with a parameter pair
END PROCPTR;
PROCPTR c (p); ! Declare PROCPTR c with one
REAL PROC32PTR p(x); REAL x; END PROCPTR;! one parameter, p, which is
END PROCPTR; ! a PROC32PTR
REAL PROCPTR d (x); REAL x; END PROCPTR; ! Declare REAL PROCPTR d
END PROCPTR; ! with one REAL parameter
PROCPTR e(i); ! Declare PROCPTR e
INT i; ! Equivalence e to d
END PROCPTR = d;
Declaring Procedure Pointers in Structures
You can declare PROCPTR fields within structure declarations.
procptr
is a procedure pointer identifier.
previous-identifier
The identifier of a field at the same level as procptr in the same structure.
Example 213 (page 268) declares a REAL PROCPTR as a field in a structure array of 10 elements.
Use an index to reference elements of array s1:
CALL s1[3].f(3.0e1);
Procedure Pointers 267