TAL Programmer's Guide

Using Parameters
Using Procedures
11–32 096254 Tandem Computers Incorporated
Referral Structures as Parameters. When you declare a referral structure as a formal
parameter, include an indirection symbol and a referral (enclosed in parentheses) that
provides the structure layout. The referral can be the identifier of an existing structure
or structure pointer.
In the following example, STRUCT_A is the referral in the formal parameter
declaration for REF_STRUCT:
STRUCT .EXT struct_a[0:99]; !Declare STRUCT_A
BEGIN
INT a;
INT b;
END;
PROC proc_a (ref_struct); !Declare PROC_A;
STRUCT .EXT ref_struct (struct_a);
BEGIN
!Process the parameter
END;
PROC m MAIN;
BEGIN
CALL proc_a (struct_a);
END;
Passing the Number of Structure Occurrences. If the structure being passed has more than
one occurrence, you might need to pass the number of occurrences. (The formal
parameter declaration of the structure does not provide such information.)
PROC proc_b (ref_struct, ub);
INT .EXT ref_struct (struct_a);
INT ub;
BEGIN
INT i;
FOR i := 0 TO ub DO
ref_struct[i].a := ref_struct[i].b := 0;
END;
FIXED Reference Parameters
If the fpoint of an actual parameter does not match the fpoint of the formal parameter,
the compiler issues a warning. The system then applies the fpoint of the formal
parameter to the actual parameter.