pTAL Conversion Guide

Procedures, Subprocedures, and Procedure
Pointers
pTAL Conversion Guide527302-002
16-5
Variable and Extensible Procedures
All of the syntactic elements in the procedure syntax are the same in pTAL as they are
in TAL except the following:
attribute can be empty.
attribute can be RETURNSCC, OVERFLOW_TRAPS, or
NOOVERFLOW_TRAPS.
type can be an address type in addition to the types recognized by TAL.
Example 16-1 on page 16-5 illustrates the changes to procedure declarations in pTAL,
which are:
p specifies three attributes, the first and third of which are empty.
The second attribute to p, RETURNSCC, is a valid procedure, subprocedure, or
function attribute, which, if present, requires that the code execute a RETURN
statement that specifies a value from which to determine the condition code to
return to the caller. See RETURN Statement on page 15-19 for more information
on using RETURNSCC.
The data type of the value returned by p is WADDR, namely, the address of the
global variable var. The RETURN statement sets the condition code to CCL, CCE,
or CCG, depending on whether the value of i+1 is less than, equal to, or greater
than 0.
See the TAL Reference Manual for information on all other procedure syntax and
semantics.
Variable and Extensible Procedures
In TAL and pTAL, you can declare subprocedures VARIABLE, but not EXTENSIBLE.
TAL
In TAL, variable and extensible procedures are implemented differently from one
another.
Example 16-1. Procedure Declaration (pTAL)
INT var; ! Global INT
WADDR PROC p(i) , RETURNSCC,; ! Attributes: empty, RETURNSCC,
INT .i; ! and empty
BEGIN
RETURN @var, i+1; ! Return an address and a
END; ! condition code value