pTAL Guidelines for TAL Programmers

Differences Between TAL and pTAL
pTAL Guidelines for TAL Programmers527256-002
3-6
Procedure Pointers
Without SYNTAX, DO_PTAL has the preceding effects and also:
Function procedures and function subprocedures must return to their callers by
executing a RETURN statement. Your program aborts if it reaches the end of a
function’s code. (If you specify DO_PTAL SYNTAX or you do not specify a
DO_PTAL directive, a function that reaches the end of its code returns a value of 0
to its caller as in pre-D20 TAL releases.)
Signed (arithmetic) left-shift operators (<<) perform an unsigned (logical) left shift
operation instead of a signed left shift operation.
If the argument to the $XADR routine is an address in system globals, $XADR
converts the address to an absolute extended address in absolute segment 1.
In D20 and later releases of TAL, the argument to $XADR need not be a variable.
In pTAL, the argument must be a variable.
Procedure Pointers
A procedure pointer (PROCPTR) is a variable, a structure field, or a procedure
parameter in which you store the address of a procedure. After you store a procedure’s
address in the procedure pointer, you can call the procedure by specifying the
procedure pointer name in a CALL statement or routine invocation.
Procedure pointers enable you to:
Pass the names of variable and extensible procedures as actual parameters and,
from the called procedure, call the procedure whose name you passed, without
manually building a parameter mask
Select dynamically a procedure to call
The syntax of procedure pointers is similar to the syntax of forward procedures;
however, instead of using the keyword PROC, you declare a procedure pointer using
the keyword PROCPTR. Like a forward procedure, a procedure pointer fully specifies
procedure attributes and formal parameters but has no executable statements—that is,
no executable statements. You end a procedure pointer declaration by specifying END
PROCPTR.
Topics:
Declaring Procedure Pointers on page 3-7
Declaring Procedure Pointer Variables on page 3-11
Using Procedure Pointer Variables on page 3-13
Declaring Procedure Pointer Structure Fields on page 3-14
Declaring PROC Formal Parameters on page 3-16
Declaring Procedure Pointer Formal Parameters on page 3-17