TAL Programmer's Guide

Mixed-Language Features of TAL
Mixed-Language Programming
096254 Tandem Computers Incorporated 17–7
Passing Parameter Pairs
The calling routine can pass parameter pairs to the called routine in a CALL statement.
For example, the calling routine can declare and pass a parameter pair to
IN_PROCEDURE (declared in the preceding example) as follows:
PROC caller;
BEGIN
LITERAL length = 5;
STRING .EXT array[0:length - 1];
!Some code here
CALL in_procedure (array:length);
END;
Modifying the String Length
If the called routine modifies the length of the string parameter, the called routine
must also provide an INT reference parameter in which it returns the new length of
the string. This parameter can represent the length, in bytes, of the string parameter
before and after the routine modifies the length. In that case, it is an input and output
parameter. For example, you can declare the current-length parameter as follows:
PROC out_procedure (astring:max_length, current_length);
STRING .EXT astring; !Output or input/output parameter
INT max_length; !Input parameter
INT .current_length; !Output or input/output parameter
BEGIN
!Code to process ASTRING
END;
The formal current-length parameter is a reference parameter, either a standard or
extended INT simple pointer. It can be an input-output or output-only parameter:
Input-output parameter
Input The actual parameter is an INT simple variable that specifies the length
of the string parameter, in bytes, before the called routine processes the
string parameter. When you list the simple variable in the calling
sequence, the compiler passes the compiler-assigned address of the
simple variable.
Output The called routine can process the string parameter and return the new
length of the string parameter to the calling routine. The called routine
must ensure that the initial length and the new length are in the range 0
through the value of the maximum-length parameter. (The compiler
does no range checking.)
Output-only parameter—The compiler ignores any initial parameter value.