TAL Programmer's Guide
Declaring Redefinitions
Using Structures
8–22 096254 Tandem Computers Incorporated
You can declare DW_ADDR to redefine DW_MEM as follows:
STRUCT dw_template (
*
);
BEGIN
INT(32) .dw_mem;
INT dw_addr = dw_mem; !Redefinition
END;
Even if the lower bound of the new array is not zero, the new specified lower bound is
always associated with the zeroth element of the previous array. In the following
example, new INT(32) array B[1:2] redefines previous INT array A[0:3]:
392
A[-2]
.
.
.
A[-1]
A[0]
A[1]
A[2]
A[3]
B[1]
B[2]
STRUCT .array_redefinition;
BEGIN
INT a[-2:3];
INT(32) b[1:2] = a;
END;
Data Type Restrictions
The new item can be any data type except UNSIGNED.
You can redefine the data type of a STRING array only if the array is aligned on a
word boundary. For example, you can redefine the data type of STRING array A,
because A is aligned on a word boundary. You cannot redefine the data type of
STRING array B because B is aligned on a byte boundary, but you can declare another
STRING item (such as D) to redefine B:
393
A[2]
A[4]
B[1]
B[3]
A[3]
B[0]
B[2]
/ / /
C[1]
D
A[0] A[1]
C[0]
STRUCT array_redefinition;
BEGIN
STRING a[0:4];
STRING b[0:3];
INT c[0:1] = a;
STRING d = b;
END;
Byte and Word Addressing
In a redefinition, the new variable and the previous (nonpointer) variable both must
have a byte address or both must have a word address. If the previous variable is a
pointer, the data it points to must be word or byte addressed to match the new
variable.