TAL Programmer's Guide
Using Parameters
Using Procedures
096254 Tandem Computers Incorporated 11–31
The following example passes array bounds information:
LITERAL array_lb = 0;
LITERAL array_ub = 9;
INT .array[array_lb:array_ub];
PROC zero (a, lb, ub);
INT .a;
INT lb;
INT ub;
BEGIN
INT i;
FOR i := lb TO ub DO
a[i] := 0;
END;
PROC m MAIN;
BEGIN
CALL zero (array, array_lb, array_ub);
END; !Pass lower and upper array bounds
Structures as Reference Parameters
Either definition structures or referral structures can be formal reference parameters.
You can treat them as if they were structure pointers. For the address of the structure,
the compiler allocates one word for a standard indirect structure and two words for an
extended indirect structure.
Definition structures as parameters is described next, followed by referral structures as
parameters. For portability to future software platforms, declare referral structures
(rather than definition structures) as parameters where possible.
Definition Structures as Parameters. When you declare a definition structure as a formal
reference parameter, include an indirection symbol and a structure layout:
PROC proc_a (def_struct); !Declare PROC_A
STRUCT .EXT def_struct; !Declare definition
BEGIN ! structure as a
INT a; ! formal parameter
INT b;
END;
BEGIN
!Process the parameter
END;