pTAL Reference Manual (H06.03+)

Data Representation
HP pTAL Reference Manual523746-005
3-23
Constant List Alignment Specification
Examples of constant lists:
1. In each of the following pairs, the list on the left is equivalent to the list on the right:
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:
[ "A", "BCD" , "...", "Z" ] [ "ABCD...Z" ]
10 * [0]; [0,0,0,0,0,0,0,0,0,0]
[3 * [2 * [1], 2 * [0]]] [1,1,0,0,1,1,0,0,1,1,0,0]
10 * [" "] [" "]
INT(32) c[0:4];
["abcd", 1D, 3D, "XYZ",
%20D];
!Mixed constant list
"a" "b"
"c" "d"
c[0]
1Dc[1]
3Dc[2]
"X" "Y"
"Z" 0
c[3]
%20Dc[4]
VST331.vsd