pTAL Reference Manual (H06.08+)
Compiling and Linking pTAL Programs
HP pTAL Reference Manual—523746-006
16-15
Allocating Global Data Blocks
Named data blocks are split the same way. For example:
BLOCK blk;
INT x;
INT .y;
INT .ext z [0:99];
END BLOCK;
Two data blocks are created. Variables x and y are placed in the block named BLK
and z is placed in the block named $BLK.
You can link object files compiled with and without template blocks with no loss of
information.
A referral structure and the structure layout to which it refers can appear in different
data blocks. The structure layout must appear first.
In all other cases, a data declaration and any data to which it refers must appear in the
same data block. The following declarations, for example, must appear in the same
data block:
INT var; ! Declare var
INT .ptr := @var; ! Declare ptr by referring to var
If the reference is not in the same block, the compiler issues an error message.
Allocating Global Data Blocks
When you compile a program, the compiler constructs relocatable blocks of code and
data that are linked into the object file. The compiler:
•
Allocates each read-only array in its own data block in the code segment of the
object file
•
Allocates all other variables in relocatable global data blocks in the data segment
(except LITERALs and DEFINEs, which require no storage space)
Data is divided between “large” and “small” data sections.
The compiler associates the symbol information for the allocated variables with that
data block. The compiler also associates the symbol information for any LITERALs,
DEFINEs, or read-only arrays declared in that data block, but allocates 0 words of
storage for such declarations.
Address Assignments
The compiler assigns each direct variable and each pointer an offset from the
beginning of the encompassing global data block. Within the data block, it allocates
storage for each data declaration according to its data type and size.










