TAL Programmer's Guide

Using Structure Pointers
Using Pointers
096254 Tandem Computers Incorporated 9–15
Here is another way to access a STRING item in a structure. You can convert the word
address of the structure to a byte address when you initialize the STRING structure
pointer and then access the STRING item in a statement:
STRUCT .astruct[0:1];
BEGIN
STRING s1;
STRING s2;
STRING s3;
END;
STRING .ptr (astruct) := @astruct[1] '<<' 1;
!Declare STRING PTR; initialize
! it with converted byte
! address of ASTRUCT[1]
ptr.s2 := %4; !Access STRING structure item
Initializing Local or
Sublocal Structure Pointers
You can initialize a local or sublocal standard structure pointer with the address of a
standard indirect structure:
STRUCT .std_struct[0:2]; !Declare STD_STRUCT
BEGIN
INT array1[0:7];
END;
INT .std_ptr (std_struct) := @std_struct[0];
!Declare STD_PTR; initialize it
! with address of STD_STRUCT[0]
You can initialize a local or sublocal STRING structure pointer with the address of a
substructure:
STRUCT name_def(
*
);
BEGIN
STRING first[0:3];
STRING last[0:3];
END;
STRUCT .record;
BEGIN
STRUCT name (name_def); !Declare substructure
INT age;
END;
STRING .my_name (name_def) := @record.name;
!Declare STRING structure
! pointer; initialize it with
! address of substructure
my_name ':=' ["Don Good"];