An order number must be assigned to each value, 0 through 255, in the order table. Once this has been done, as well as assigning all special cases, the array may be specified in a LEXICAL ORDER IS statement to make it take effect. All of the user-defined order rules explained above are compatible between HTBasic and HP BASIC. HTBasic extensions to LEXICAL ORDER IS that allow user-defined upper and lowercase conversions are explained in the following paragraphs.
But first, let’s complete our example:
5 REM USERDEF.BAS
10 INTEGER A(0:260)
20 A(65)=0
30 A(66)=256
40 A(67)=1
50 A(68)=576
60 A(69)=1411
65 A(70)=1280
75 A(71)=1536
80 A(72)=1984
90 A(73)=1985
100 A(256)=4
110 A(257)=2
120 A(258)=22532
130 A(259)=22787
140 A(260)=1573
150 FOR I=74 TO 255
160 A(I)=SHIFT(I-66,-8)
170 NEXT I
180 FOR I=0 TO 64
190 A(I)=SHIFT(I+190,-8)
200 NEXT I
210 LEXICAL ORDER IS A(*)
220 END
We have added lines 65, 75, and 150 to 200 to assign the characters that were not yet assigned. We have also sped up the program by pre-evaluating functions like NUM("A") and SHIFT(0,-8) wherever possible. Finally, line 210 causes all the changes to take effect.