TAL Programmer's Guide
Declaring Data in Procedures
Using Procedures
096254 Tandem Computers Incorporated 11–5
Allocating Local Variables When a procedure is activated, the compiler allocates storage for the procedure's
variables in the procedure's private local storage area, which consists of a primary and
a secondary storage area.
Local Primary Area
The primary area for each procedure can store up to 127 words of the following kinds
of local variables:
Directly addressed simple variables, arrays, and structures
Pointers you declare
Implicit pointers (those the compiler provides when you declare indirect arrays or
indirect structures)
When a procedure is activated, the compiler allocates storage at the current top of the
data stack for each direct local variable and each pointer. The addresses of the
variables are at an increasingly higher offset from L[1].
Local Secondary Area
The local secondary area begins immediately after the last pointer or direct variable of
the procedure’s local primary area. The local secondary area of a procedure has no
explicit size, but the total of all global and local primary and secondary areas cannot
exceed the lower 32K-word area of the user data segment.
For each standard indirect array or structure you declare in the procedure:
1. The compiler provides an implicit standard pointer and allocates a word of
storage for the pointer in the procedure’s local primary area.
2. The compiler allocates storage for the array or structure in the procedure’s
secondary area, which begins immediately following the procedure’s last direct
item.
If you declare indirect arrays or indirect structures within BLOCK declarations,
however, the compiler allocates such data blocks anywhere in the procedure’s
secondary data blocks, as described in Section 14, “Compiling Programs.”
3. The compiler initializes the implicit pointer (provided in step 1) with the address
of the array or structure in the procedure’s secondary area.
For a STRING array, the pointer contains the byte address of the array.
For any other array, the pointer contains the word address of the array.
For a structure, the pointer contains the word address of the structure.
Allocating Parameters
and Variables
Figure 11-1 shows how the compiler allocates storage for the called procedure’s
parameters and variables in the procedure’s local primary and secondary storage
areas.