pTAL Conversion Guide

pTAL Built-In Routines
pTAL Conversion Guide527302-002
18-7
Parameters to Built-In Routines
If a parameter to a built-in routine is an output parameter whose data type is one of the
address types (for example, BADDR or EXTADDR), pass the address of a pointer, not
the address of a simple variable:
STRING s; ! s is a variable
STRING .t; ! t is a pointer
$BUILT_IN(@s); ! ERROR: s has no container in which to store
! a new address
$BUILT_IN(@t); ! OK: t has a container in which to store
! a new address
If an output parameter to a built-in routine is an address, do not attempt to pass the
address of an indirect array pointer or indirect structure pointer such as:
STRING .s[ 0:99 ];
$BUILT_IN(@s); ! ERROR: s has no address container in
! which to store a new address
pTAL built-in routines are designed to maintain compatibility with the equivalent TAL
code by evaluating input-output parameters twice; therefore, each parameter is
evaluated:
When the parameter is passed into the built-in routine
When the result of the built-in routine is stored into the parameter
For example, the TAL code for the $ASCIITOFIXED built-in routine is:
STACK bufferaddr, maxdigits, qvaluein;
CODE( CAQV );
STORE qvalueout, remainingdigits, bufferaddr;
The parameter BUFFERADDR is evaluated in the STACK statement as well as in the
STORE statement.
The $ASCIITOFIXED built-in routine’s calling sequence is:
$ASCIITOFIXED( bufferaddr, maxdigits, remainingdigits, qvaluein, qvalueout);
The first parameter, BUFFERADDR, is an input-output parameter and, therefore, is
evaluated twice in order to maintain compatibility with the preceding TAL code
sequence.
The syntax descriptions in this section use these terms:
“sINT” and “uINT” are not pTAL data types. This section uses them only to specify how
built-in routines use INT parameters.
Term Definition
sINT Signed 16-bit integer. Range is -32,768 through 32,767.
uINT Unsigned 16-bit integer. Range is 0 through 65,535. Must be an INT variable, not
a STRING or UNSIGNED variable.
word 16-bit word unless otherwise specified