pTAL Reference Manual (H06.08+)
Compiling and Linking pTAL Programs
HP pTAL Reference Manual—523746-006
16-14
Declaring Global Data
Declaring Private Data Blocks
A private data block is a global data block that is shareable only among the procedures
within a compilation unit. You can include only one private data block in a compilation
unit. The private data block inherits the identifier you specify in the NAME declaration;
therefore, the NAME declarations in all compilations that you use to assemble an
executable program must have unique names. To declare a private global data block,
specify the PRIVATE option of the BLOCK declaration.
Declaring Unblocked Data
Place all unblocked global declarations (those not contained in BLOCK declarations)
before the first BLOCK declaration. Unblocked declarations are relocatable and
shareable among all compilation units in a program. The linking name of the private
data block is derived from the NAME declaration.
The compiler places unblocked data declarations in implicit primary data blocks,
created as follows:
1. When you use named blocks, private blocks, or the BLOCKGLOBALS directive,
each data item becomes its own block. All the other unblocked data items are
grouped into a block named _GLOBAL and $_GLOBAL.
2. Each block so created is split into two blocks to separate “large” data from “small”
data. “Large” data means arrays or structures declared with “.” or “.EXT” notation.
“Small” data is everything else. When both blocks exist, the “large” data block has
a
$
in front of its name.
For example, if you have the following global data declarations:
INT x;
INT .y;
INT .z [0:113]
Variables x and y are placed in the block named _GLOBAL, and z is placed in the
block named $_GLOBAL.
Example 16-5. Declaring a Private Data Block
BLOCK PRIVATE; ! Declare private global data block
INT term_num; ! Declare global data
LITERAL msg_buf = 79;
END BLOCK;
Example 16-6. Declaring Unblocked Data
INT a;
INT .b[0:9];
INT .EXT c[0:14];
LITERAL limit = 32;










