pTAL Reference Manual (H06.08+)
Structures
HP pTAL Reference Manual—523746-006
9-50
Assigning Addresses to Pointers in Structures
Assigning Addresses to Pointers in Structures
You can assign to pointers the kinds of addresses listed in Table 9-4 on page 9-19 and
Table 9-5 on page 9-22. To assign an address to a pointer within a structure, specify
the fully qualified pointer identifier in an assignment statement. Prefix the structure
identifier with @. For example, the assignment statement to assign an address to
ptr_x declared in substruct_a in struct_b is:
@struct_b.substruct_a.ptr_x := arith_expression;
In the preceding example, @ applies to ptr_x, the most qualified item. On the left side
of the assignment operator, @ changes the address contained in the pointer, not the
value of the item to which the pointer points.
You can also prefix @ to a variable on the right side of the assignment operator. If the
variable is a pointer, @ returns the address contained in the pointer. If the variable is
not a pointer, @ returns the address of the variable itself.
Example 9-41 on page 9-51 assigns the address of a structure to structure pointers
declared in another structure.
Table 9-7. Addresses in Simple Pointers
Addressing
Mode Data Type Kind of Address
Standard STRING 16-bit byte address
Standard Any except STRING 16-bit word address
Extended STRING 32-bit byte address, normally in the automatic
extended data segment
Extended Any except STRING 32-bit even-byte address, normally in the
automatic extended data segment
(if you specify
an odd-byte address, results are undefined)
Example 9-40. Assigning Addresses to Pointers in Structures
INT .array[0:99];
STRUCT .st;
BEGIN
INT .std_ptr;
INT .EXT ext_ptr;
END;
PROC e MAIN;
BEGIN
@st.std_ptr := @array[0];
@st.ext_ptr := $XADR(array[0]);
END;










