TAL Programmer's Guide

Declaring Definition Structures
Using Structures
096254 Tandem Computers Incorporated 8–3
Declaring Definition
Structures
A definition structure describes a structure layout and allocates storage for it. To
declare a single occurrence of a definition structure, specify:
The keyword STRUCT
The structure identifier, usually preceded by an indirection symbol (. or .EXT)
A semicolon
The structure layout (enclosed in a BEGIN-END construct)
You can, for example, declare a definition structure named INVENTORY like this:
STRUCT .inventory; !Declare definition structure
BEGIN !Begin structure layout
INT item;
FIXED(2) price;
INT quantity;
END; !End structure layout
Specifying Structure
Occurrences
A definition structure that contains multiple occurrences is also known as an array of
structures. For multiple occurrences, specify the lower and upper bounds in the
structure declaration. These bounds represent the indexes of the first and last
structure occurrences you want allocated. The bounds must be INT constant
expressions in the range –32,768 through 32,767, separated by a colon and enclosed in
brackets. The default bounds are [0:0] (one structure occurrence).
For example, to declare an array of definition structures that consists of four
occurrences of the structure, specify structure bounds such as [0:3]:
STRUCT .inventory[0:3]; !Declare definition structure
BEGIN !Begin structure layout
INT item;
FIXED(2) price;
INT quantity;
END; !End structure layout
The size of one occurrence of a structure must not exceed 32,767 bytes. In the
preceding example, the size of each structure occurrence is 12 bytes. The size of the
entire structure, including all four occurrences, is 48 bytes.
Using Indirection You should use indirection for most global and local structures, because storage areas
for direct global and local variables are limited. You access indirect structures by
identifier as you do direct structures.
Do not use indirection for sublocal structures, because sublocal storage has no
secondary area.