pTAL Reference Manual (G06.24+, H06.09+, J06.03+)

A1 ':=' [1,2,3,4]; ! No alignment specification
! required
A1 ':=' FIELDALIGN(SHARED2) [1,2D,4]; ! Alignment specification required
! to specify 2-byte alignment for
! 2D
Examples of constant lists:
1. In each of the following pairs, the list on the left is equivalent to the list on the right:
[ "ABCD...Z" ][ "A", "BCD" , "...", "Z" ]
[0,0,0,0,0,0,0,0,0,0]10 * [0];
[1,1,0,0,1,1,0,0,1,1,0,0][3 * [2 * [1], 2 * [0]]]
[" "]10 * [" "]
2. The following is an example of the FIELDALIGN clause:
STRING i [0:3] := FIELDALIGN(SHARED2) [0,1,2,3];
3. The following example shows how you can break a constant string that is too long for one
line into smaller constant strings specified as a constant list. The system stores one character
to a byte:
STRING a[0:99] := ["These three constant strings will ",
"appear as if they were one constant ",
"string continued on multiple lines."];
4. The following example initializes a STRING array with a repetition constant list:
STRING b[0:79] := 80 * [" "];
5. The following example initializes an INT(32) array with a mixed constant list containing values
of the same data type. The diagram shows how the compiler allocates storage for the variable
and the constant list that initializes the variable:
Constants 65