TAL Programmer's Guide
Accessing Structure Items
Using Structures
8–38 096254 Tandem Computers Incorporated
The following example shows how you can access structure items by using structure
pointers declared in structures:
STRUCT template (
*
); !Declare template structure
 BEGIN
 STRING b[0:2];
 INT e;
 END;
STRUCT .link_list; !Declare definition structure
 BEGIN
 INT .fwd_ptr (link_list); !Declare structure pointer and
 ! redefine simple variable
 STRING .EXT ptr_to_ext_item(template);
 !Declare structure pointer
 INT(32) .b; !Declare simple pointer
 STRUCT item(template); !Declare referral substructure
 END;
INT .new_item := %100000; !Declare simple pointer to
 ! first list item
PROC m MAIN;
 BEGIN
 @link_list.fwd_ptr := @new_item;
 !Put address into first forward
 ! pointer
 @new_item := @new_item '+' ($LEN(link_list) + 1 ) / 2;
 @link_list.fwd_ptr.fwd_ptr := @new_item;
 !Put address into second forward
 END; ! pointer
In the preceding example:
@LINK_LIST.FWD_PTR refers to the content of the first forward standard simple
pointer.
@LINK_LIST.FWD_PTR.PTR_TO_EXT_ITEM refers to the content of the extended
simple pointer in the second LINK_LIST.
@LINK_LIST.FWD_PTR.PTR_TO_EXT_ITEM.B refers to the address of B in the
second instance of LINK_LIST in extended memory.










