TAL Programmer's Guide
Accessing Structure Items
Using Structures
096254 Tandem Computers Incorporated 8–27
For example, you can declare new standard and extended structure pointers to
redefine simple variables as follows:
STRUCT record;
BEGIN
FIXED(0) data;
INT std_link_addr;
INT .std_link(record) = std_link_addr; !Redefinition
INT ext_link_addr;
INT .EXT ext_link(record) = ext_link_addr; !Redefinition
END;
Accessing
Structure Items
You access an item in a definition or referral structure by using the item’s fully
qualified identifier in a statement. Structure items you can access are simple variables,
arrays, substructures, pointers, and redefinitions. For example, you can:
Assign a value to a structure item by using an assignment statement
Copy substructure values within a structure by using a move statement
Qualifying Identifiers To access a structure item, you must specify its fully qualified identifier and indexes if
any. A fully qualified identifier includes all levels of nesting. For example, the fully
qualified identifier for ARRAY_Z declared in SUBSTRUCT_Y in STRUCT_X is:
struct_x.substruct_y[0].array_z[0]
The following example shows how nesting affects qualified identifiers. The two
structures both contain three substructures. In both cases, SUB_3 contains ITEM_X:
STRUCT .struct_a; STRUCT .struct_b;
BEGIN BEGIN
STRUCT sub_1; STRUCT sub_1;
BEGIN BEGIN
INT a; STRUCT sub_2;
END; !End SUB_1 BEGIN
STRUCT sub_2; STRUCT sub_3;
BEGIN BEGIN
INT b; INT a;
END; !End SUB_2 INT b;
STRUCT sub_3; INT item_x;
BEGIN END; !End SUB_3
INT item_x; END; !End SUB_2
END; !End SUB_3 END; !End SUB_1
END; !End STRUCT_A END; !End STRUCT_A
For STRUCT_A, the fully qualified identifier for ITEM_X is:
struct_a.sub_3.item_x
For STRUCT_B, the fully qualified identifier for ITEM_X is:
struct_b.sub_1.sub_2.sub_3.item_x
You can use a DEFINE declaration to associate alternate names for structure items, as
described in Section 5, “LITERALs and DEFINEs,” in the TAL Reference Manual.