pTAL Conversion Guide

Structures
pTAL Conversion Guide527302-002
11-12
Definition Structure Syntax
The byte offset of a four-byte field (INT(32), REAL, UNSIGNED(17-31))
must be an integral multiple of four, except that contiguous UNSIGNED
fields can be packed.
The byte offset of an eight-byte field (FIXED or REAL(64)) must be an
integral multiple of eight.
The byte offset of a substructure field must be an integral multiple of the
widest field in the substructure.
The byte offset of an array must be an integral multiple of an element of
the array—that is, one of the previous items in this list.
In a SHARED8 structure or substructure, you must explicitly declare filler items
as needed to ensure that fields are aligned according to the preceding rules.
Table 5-1 on page 5-2 shows the alignment of pTAL variables.
AUTO
specifies that the structure and the fields of the structure be aligned according
to the optimal alignment for the architecture on which the program will run.
(This AUTO attribute is not necessarily the same as the AUTO attribute in the
native mode HP C compiler.)
PLATFORM
specifies that the structure and the fields of the structure must begin at
addresses that are consistent across all languages on the same architecture.
pTAL allocates such structures according to the rules used by the native mode
HP C compiler for AUTO layouts.
structure-layout
is the identifier of a previously declared structure or structure pointer that provides
the structure layout for this structure.
In TAL, structures declared in subprocedures must be directly addressed. For most
other structures, use indirection, because storage areas for direct global and local
variables are limited. You access indirect structures by identifier as you do direct
structures.
For very large structures, use the .EXT symbol to declare extended indirect structures.
When you declare one or more extended indirect structures (or arrays), the compiler
allocates the automatic extended data segment. Structures always start on a word
boundary.