TAL Programmer's Guide
Using Structure Pointers
Using Pointers
096254 Tandem Computers Incorporated 9–23
Whenever you increase the structure size or number of occurrences, you must repeat
the preceding sequence of steps.
To access a structure item whose offset is within the signed INT range, you can use an
INT index as follows:
!Default NOINHIBITXX in effect
STRUCT .EXT xstruct[0:9]; !Declare extended indirect
BEGIN ! structure; upper byte offset
STRING array[0:9]; ! is within INT range
END;
INT index; !Declare INT index
STRING var;
PROC my_proc MAIN;
BEGIN
INT .EXT xstruct_ptr (xstruct) := @xstruct[0];
!Code to initialize INDEX
var := xstruct_ptr[index].array[0];
END; !Generate correct offset
In the preceding example, NOINHIBITXX generates efficient addressing for extended
indirect declarations (by using XX instructions described in the System Description
Manual for your system).
Conversely, INHIBITXX suppresses efficient addressing of extended indirect
declarations located between G[0] and G[63] of the user data segment—except when
the extended indirect declarations are declared in a BLOCK declaration with the
AT (0) or BELOW (64) option. (The BLOCK declaration is described in Section 14,
“Compiling Programs.”)
To access a structure item whose offset is outside the signed INT range (–32678
through 32,767), you must use an INT(32) index. To convert an INT index to an
INT(32) index, you can use the $DBL function:
STRUCT .EXT xstruct[0:9999];
BEGIN
STRING array[0:9]; !Upper byte offset > 32,767;
END; ! INT(32) index required
INT index;
PROC my_proc MAIN;
BEGIN
INT .EXT xstruct_ptr (xstruct) := @xstruct[0];
!Some code here to initialize INDEX
xstruct_ptr[$DBL(index)].array[0] := 1;
!Generate correct offset
END; ! because INDEX is an INT(32)
! expression