pTAL Guidelines for TAL Programmers
Differences Between TAL and pTAL
pTAL Guidelines for TAL Programmers—527256-002
3-12
Declaring Procedure Pointer Variables
Considerations:
•
You can declare a procedure pointer anywhere a data declaration is valid.
•
The address type of a procedure pointer is PROCADDR.
•
The object data type of a function procedure pointer is the data type returned by
the function.
•
You can initialize procedure pointers declared at the local and sublocal levels but
not at the global level. (Procedure pointers are data declarations and, therefore,
must appear before you declare any procedures.)
You can equivalence a procedure pointer only to another procedure pointer (the
address type of a procedure pointer is a PROCADDR) or to a PROCADDR variable.
Example 3-3. Procedure Pointer Declarations
PROCADDR pa;
PROC p(i, j) EXTENSIBLE, CALLABLE;
INT i, .EXT j;
FORWARD;
PROCPTR a(m, n) CALLABLE, EXTENSIBLE;
INT m, .EXT n;
END PROCPTR := @p; ! PROCPTR a points to PROC p
FIXED PROCPTR b(str:length); ! PROCPTR b is FIXED
STRING .str;
INT length;
END PROCPTR := pa;
Example 3-4. Equivalenced Procedure Pointers
PROCADDR r;
PROCPTR s(i);
INT i;
END PROCPTR = r; ! Equivalence s to r
PROCPTR t(x);
REAL x;
END PROCPTR;
PROCPTR u(i);
INT i;
END PROCPTR = t; ! Equivalence u to t