pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
Parameters
Parameters of built-in routines are always passed by value.
Topics:
• Addresses as Parameters (page 275)
• Expressions as Parameters (page 275)
Addresses as Parameters
If a parameter of a built-in routine is an address, the address must have the correct address
type—whether the parameter is an input parameter, an output parameter, or both.
In Example 223 (page 275), the built-in routine $BUI<_IN_1 has one formal parameter whose data
type is BADDR. The corresponding actual parameter must be either a BADDR variable or the
address field of a STRING pointer.
Example 223 Built-In Routine With Address Parameter
BADDR b;
STRING .s;
$BUI<_IN_1(b); ! OK: data type of b is BADDR
$BUI<_IN_1(@s); ! OK: address type of @s is BADDR
$BUI<_IN_1(s); ! ERROR: data type of s is STRING
If an output parameter of a built-in routine is an address, the corresponding actual parameter must
not be an indirect array pointer or an indirect structure pointer.
In Example 224 (page 275), the built-in routine $BUI<_IN_2 has one formal output parameter whose
data type is BADDR.
Example 224 Built-In Routine With Address Output Parameter
STRING .s[0:99];
$BUI<_IN_2(@s); ! ERROR: s has no address container
! in which to store a new address
Expressions as Parameters
Many built-in routines accept expressions as parameters (see their individual syntax descriptions).
If a parameter of a built-in routine is an expression:
• The value of the expression can be any data type except STRING or UNSIGNED.
• Except in INT and INT(32) expressions, all operands must be of the same data type.
• An INT expression can include STRING, INT, and UNSIGNED(1-16) operands.
The system treats STRING and UNSIGNED(1-16) operands as if they were 16-bit values; that
is, the system:
◦ Places a STRING operand in the right byte of a word and sets the left byte to 0.
◦ Places an UNSIGNED(1-16) operand in the right bits of a word and sets the unused left
bits to 0.
Parameters 275