TAL Programmer's Guide

Using Structure Pointers
Using Pointers
096254 Tandem Computers Incorporated 9–17
Address of Structure Occurrence
To assign the address of a standard structure occurrence to a structure pointer, place
the structure identifier, prefixed with @, on the right of the assignment operator:
STRUCT struct_a[0:2]; !Declare STRUCT_A
BEGIN
INT array1[0:7];
END;
PROC any MAIN;
BEGIN
INT .struct_ptr (struct_a); !Declare STRUCT_PTR
@struct_ptr := @struct_a[2]; !Assign address of STRUCT_A[2]
END; ! to STRUCT_PTR
Converting Addresses
To convert a standard (16-bit) address to an extended (32-bit) address and assign it to
an extended structure pointer, use the $XADR standard function:
STRUCT struct_a[0:2]; !Declare STRUCT_A
BEGIN
INT array1[0:7];
END;
PROC any MAIN;
BEGIN
INT .EXT xstruct_ptr (struct_a);
!Declare XSTRUCT_PTR
@xstruct_ptr := $XADR(struct_a[2]);
!Assign address of STRUCT_A[2]
END; ! to XSTRUCT_PTR
Assigning the Content of a Structure Pointer
You can assign an address contained in a structure pointer to another structure pointer
by using the @ operator on the right side of the assignment operator:
PROC any;
BEGIN
STRUCT struct_a[0:2]; !Declare STRUCT_A
BEGIN
INT array1[0:7];
END;
INT .ptr_a (struct_a) := @struct_a[0];
!Declare PTR_A; initialize it
! with address of STRUCT_A[0]
INT .ptr_b (struct_a); !Declare PTR_B;
@ptr_b := @ptr_a; !Assign content of PTR_A
END; ! to PTR_B