1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
|
% om16bit.ch: Basic changes to TeX data structures allowing all
% 8-bit entities to become 32-bit entities, in particular
% characters and glyphs.
%
% This file is part of Omega,
% which is based on the web2c distribution of TeX,
%
% Copyright (c) 1994--2001 John Plaice and Yannis Haralambous
%
% Omega is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% Omega is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Omega; if not, write to the Free Software Foundation, Inc.,
% 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
%
@x limbo l.1 - Omega
% This program is copyright (C) 1982 by D. E. Knuth; all rights are reserved.
@y
% This program is copyright
% (C) 1994--2000 by John Plaice and Yannis Haralambous.
% It is designed to be a change file for D. E. Knuth's TeX version 3.141592.
%
% This program is copyright (C) 1982 by D. E. Knuth; all rights are reserved.
@z
%---------------------------------------
@x limbo l.80
\def\title{\TeX82}
@y
\def\title{$\Omega$ (OMEGA)}
@z
%---------------------------------------
@x [1] m.1 l.90 - Omega
This is \TeX, a document compiler intended to produce typesetting of high
quality.
The \PASCAL\ program that follows is the definition of \TeX82, a standard
@:PASCAL}{\PASCAL@>
@!@:TeX82}{\TeX82@>
@y
This is $\Omega$, a document compiler intended to simplify high-quality
typesetting for many of the world's languages. It is an extension
of D. E. Knuth's \TeX, which was designed essentially for the
typesetting of languages using the Latin alphabet.
The $\Omega$ system loosens many of the restrictions imposed by~\TeX:
register numbers are no longer limited to 8~bits; fonts may have more
than 256~characters; more than 256~fonts may be used; etc. In addition,
$\Omega$ allows much more complex ligature mechanisms between characters,
thereby simplifying the typesetting of alphabets that have preserved
their calligraphic traditions.
The \PASCAL\ program that follows is a modification of the definition of \TeX82,
a standard @:PASCAL}{\PASCAL@> @!@:TeX82}{\TeX82@>
@z
%---------------------------------------
@x [1] m.1 l.97 - Omega
will be obtainable on a great variety of computers.
@y
will be obtainable on a great variety of computers.
As little as possible is changed in this document. This means that
unless the contrary is explicitly stated, references to \TeX\ in the
documentation are equally applicable to~$\Omega$. References to `the
author' in the documentation are to D. E. Knuth.
@z
%---------------------------------------
@x [1] m.2 l.187 - Omega
@d banner=='This is TeX, Version 3.141592' {printed when \TeX\ starts}
@y
@d banner=='This is Omega, Version 3.141592-1.23.2.3' {printed when \TeX\ starts}
@z
%---------------------------------------
@x [1] m.4 l.243
program TEX; {all file names are defined dynamically}
@y
program OMEGA; {all file names are defined dynamically}
@z
%---------------------------------------
@x [1] m.11 l.392 - Omega
@!font_max=75; {maximum internal font number; must not exceed |max_quarterword|
and must be at most |font_base+256|}
@!font_mem_size=20000; {number of words of |font_info| for all fonts}
@y
@!font_max=65535; {maximum internal font number; must be at most |font_biggest|}
@z
%---------------------------------------
@x [1] m.11 l.412 - Omega
@!pool_name='TeXformats:TEX.POOL ';
@y
@!pool_name='TeXformats:OMEGA.POOL ';
@z
%---------------------------------------
@x [1] m.12 l.437 - Omega
@d hash_size=2100 {maximum number of control sequences; it should be at most
about |(mem_max-mem_min)/10|}
@d hash_prime=1777 {a prime number equal to about 85\pct! of |hash_size|}
@d hyph_size=307 {another prime; the number of \.{\\hyphenation} exceptions}
@y
@d hash_size=65536 {maximum number of control sequences; it should be at most
about |(mem_max-mem_min)/10|}
@d hash_prime=55711 {a prime number equal to about 85\pct! of |hash_size|}
@d hyph_size=307 {another prime; the number of \.{\\hyphenation} exceptions}
@d biggest_char=65535 {the largest allowed character number;
must be |<=max_quarterword|}
@d too_big_char=65536 {|biggest_char+1|}
@d special_char=65537 {|biggest_char+2|}
@d number_chars=65536 {|biggest_char+1|}
@d biggest_reg=65535 {the largest allowed register number;
must be |<=max_quarterword|}
@d number_regs=65536 {|biggest_reg+1|}
@d font_biggest=65535 {the real biggest font}
@d number_fonts=font_biggest-font_base+2
@d number_math_fonts=768
@d math_font_biggest=767
@d text_size=0 {size code for the largest size in a family}
@d script_size=256 {size code for the medium size in a family}
@d script_script_size=512 {size code for the smallest size in a family}
@d biggest_lang=255
@d too_big_lang=256
@z
%---------------------------------------
@x [8] m.110 l.2355 - Omega
In order to make efficient use of storage space, \TeX\ bases its major data
structures on a |memory_word|, which contains either a (signed) integer,
possibly scaled, or a (signed) |glue_ratio|, or a small number of
fields that are one half or one quarter of the size used for storing
integers.
@y
In order to make efficient use of storage space, \TeX\ bases its major data
structures on a |memory_word|, which contains either a (signed) integer,
possibly scaled, or a (signed) |glue_ratio|, or a small number of
fields that are one half or one quarter of the size used for storing
integers.
That is the description for \TeX. For $\Omega$, we are going to keep
the same terminology, except that |quarterword| is going to refer to
16~bits, and |halfword| is going to refer to 32~bits. So, in fact,
a |memory_word| will take 64 bits, and, on a 64-bit machine, will run
smaller than \TeX\ will!
@z
%---------------------------------------
@x [8] m.110 l.2378 - Omega
Since we are assuming 32-bit integers, a halfword must contain at least
16 bits, and a quarterword must contain at least 8 bits.
@^system dependencies@>
But it doesn't hurt to have more bits; for example, with enough 36-bit
words you might be able to have |mem_max| as large as 262142, which is
eight times as much memory as anybody had during the first four years of
\TeX's existence.
N.B.: Valuable memory space will be dreadfully wasted unless \TeX\ is compiled
by a \PASCAL\ that packs all of the |memory_word| variants into
the space of a single integer. This means, for example, that |glue_ratio|
words should be |short_real| instead of |real| on some computers. Some
\PASCAL\ compilers will pack an integer whose subrange is `|0..255|' into
an eight-bit field, but others insist on allocating space for an additional
sign bit; on such systems you can get 256 values into a quarterword only
if the subrange is `|-128..127|'.
@y
@z
%---------------------------------------
@x [8] m.110 l.2406 - Omega
@d max_quarterword=255 {largest allowable value in a |quarterword|}
@d min_halfword==0 {smallest allowable value in a |halfword|}
@d max_halfword==65535 {largest allowable value in a |halfword|}
@y
@d max_quarterword=@"FFFF {largest allowable value in a |quarterword|}
@d min_halfword=0 {smallest allowable value in a |halfword|}
@d max_halfword=@"3FFFFFFF {largest allowable value in a |halfword|}
@z
%---------------------------------------
@x [8] m.111 l.2416 - Omega
if (min_quarterword>0)or(max_quarterword<127) then bad:=11;
if (min_halfword>0)or(max_halfword<32767) then bad:=12;
@y
if (min_quarterword>0)or(max_quarterword<@"7FFF) then bad:=11;
if (min_halfword>0)or(max_halfword<@"3FFFFFFF) then bad:=12;
@z
%---------------------------------------
@x [8] m.111 l.2423 - Omega
if font_max>font_base+256 then bad:=16;
@y
if font_max>font_base+@"10000 then bad:=16;
@z
%---------------------------------------
@x [8] m.111 l.2426 - Omega
if max_quarterword-min_quarterword<255 then bad:=19;
@y
if max_quarterword-min_quarterword<@"FFFF then bad:=19;
@z
%---------------------------------------
@x [9] m.120 - Omega
@ The function |get_avail| returns a pointer to a new one-word node whose
|link| field is null. However, \TeX\ will halt if there is no more room left.
@^inner loop@>
If the available-space list is empty, i.e., if |avail=null|,
we try first to increase |mem_end|. If that cannot be done, i.e., if
|mem_end=mem_max|, we try to decrease |hi_mem_min|. If that cannot be
done, i.e., if |hi_mem_min=lo_mem_max+1|, we have to quit.
@p function get_avail : pointer; {single-word node allocation}
var p:pointer; {the new node being got}
begin p:=avail; {get top location in the |avail| stack}
if p<>null then avail:=link(avail) {and pop it off}
else if mem_end<mem_max then {or go into virgin territory}
begin incr(mem_end); p:=mem_end;
end
else begin decr(hi_mem_min); p:=hi_mem_min;
if hi_mem_min<=lo_mem_max then
begin runaway; {if memory is exhausted, display possible runaway text}
overflow("main memory size",mem_max+1-mem_min);
{quit; all one-word nodes are busy}
@:TeX capacity exceeded main memory size}{\quad main memory size@>
end;
end;
link(p):=null; {provide an oft-desired initialization of the new node}
@!stat incr(dyn_used);@+tats@;{maintain statistics}
get_avail:=p;
end;
@y
@ The function |get_avail| returns a pointer to a new one-word node whose
|link| field is null. However, \TeX\ will halt if there is no more room left.
@^inner loop@>
If the available-space list is empty, i.e., if |avail=null|,
we try first to increase |mem_end|. If that cannot be done, i.e., if
|mem_end=mem_max|, we try to decrease |hi_mem_min|. If that cannot be
done, i.e., if |hi_mem_min=lo_mem_max+1|, we have to quit.
For Omega, we actually return a pointer to the first word,
rather than the zeroth word.
@p function get_avail : pointer; {single-word node allocation}
var p:pointer; {the new node being got}
begin p:=avail; {get top location in the |avail| stack}
if p<>null then avail:=link(avail) {and pop it off}
else if (mem_end+1)<mem_max then {or go into virgin territory}
begin mem_end:=mem_end+2; p:=mem_end;
link(p):=null; info(p):=null; incr(p);
end
else begin hi_mem_min:=hi_mem_min-2; p:=hi_mem_min;
if hi_mem_min<=lo_mem_max then
begin runaway; {if memory is exhausted, display possible runaway text}
overflow("main memory size",mem_max+1-mem_min);
{quit; all one-word nodes are busy}
@:TeX capacity exceeded main memory size}{\quad main memory size@>
end;
end;
link(p):=null; {provide an oft-desired initialization of the new node}
@!stat incr(dyn_used);@+tats@;{maintain statistics}
get_avail:=p;
end;
@z
%---------------------------------------
@x [9] m.121 - Omega
@d free_avail(#)== {single-word node liberation}
begin link(#):=avail; avail:=#;
@!stat decr(dyn_used);@+tats@/
end
@y
@d free_avail(#)== {single-word node liberation}
begin link(#):=avail; avail:=#;
link(#-1):=null; info(#-1):=null;
@!stat decr(dyn_used);@+tats@/
end
@z
%---------------------------------------
@x [9] m.120 - Omega
@d fast_get_avail(#)==@t@>@;@/
begin #:=avail; {avoid |get_avail| if possible, to save time}
if #=null then #:=get_avail
else begin avail:=link(#); link(#):=null;
@!stat incr(dyn_used);@+tats@/
end;
end
@y
@d fast_get_avail(#)==@t@>@;@/
begin #:=avail; {avoid |get_avail| if possible, to save time}
if #=null then #:=get_avail
else begin avail:=link(#); link(#):=null;
link(#-1):=null; info(#-1):=null;
@!stat incr(dyn_used);@+tats@/
end;
end
@z
%---------------------------------------
@x [10] m.125
@ A call to |get_node| with argument |s| returns a pointer to a new node
of size~|s|, which must be 2~or more. The |link| field of the first word
of this new node is set to null. An overflow stop occurs if no suitable
space exists.
If |get_node| is called with $s=2^{30}$, it simply merges adjacent free
areas and returns the value |max_halfword|.
@p function get_node(@!s:integer):pointer; {variable-size node allocation}
label found,exit,restart;
var p:pointer; {the node currently under inspection}
@!q:pointer; {the node physically after node |p|}
@!r:integer; {the newly allocated node, or a candidate for this honor}
@!t:integer; {temporary register}
begin restart: p:=rover; {start at some free node in the ring}
repeat @<Try to allocate within node |p| and its physical successors,
and |goto found| if allocation was possible@>;
@^inner loop@>
p:=rlink(p); {move to the next node in the ring}
until p=rover; {repeat until the whole list has been traversed}
if s=@'10000000000 then
begin get_node:=max_halfword; return;
end;
if lo_mem_max+2<hi_mem_min then if lo_mem_max+2<=mem_bot+max_halfword then
@<Grow more variable-size memory and |goto restart|@>;
overflow("main memory size",mem_max+1-mem_min);
{sorry, nothing satisfactory is left}
@:TeX capacity exceeded main memory size}{\quad main memory size@>
found: link(r):=null; {this node is now nonempty}
@!stat var_used:=var_used+s; {maintain usage statistics}
tats@;@/
get_node:=r;
exit:end;
@y
@ A call to |get_node| with argument |s| returns a pointer to a new node
of size~|s|, which must be 2~or more. The |link| field of the first word
of this new node is set to null. An overflow stop occurs if no suitable
space exists.
If |get_node| is called with $s=2^{30}$, it simply merges adjacent free
areas and returns the value |max_halfword|.
@p function get_node(@!s:integer):pointer; {variable-size node allocation}
label found,exit,restart;
var p:pointer; {the node currently under inspection}
@!q:pointer; {the node physically after node |p|}
@!r:integer; {the newly allocated node, or a candidate for this honor}
@!t:integer; {temporary register}
begin
if s<>@'10000000000 then incr(s);
restart: p:=rover; {start at some free node in the ring}
repeat @<Try to allocate within node |p| and its physical successors,
and |goto found| if allocation was possible@>;
@^inner loop@>
p:=rlink(p); {move to the next node in the ring}
until p=rover; {repeat until the whole list has been traversed}
if s=@'10000000000 then
begin get_node:=max_halfword; return;
end;
if lo_mem_max+2<hi_mem_min then if lo_mem_max+2<=mem_bot+max_halfword then
@<Grow more variable-size memory and |goto restart|@>;
overflow("main memory size",mem_max+1-mem_min);
{sorry, nothing satisfactory is left}
@:TeX capacity exceeded main memory size}{\quad main memory size@>
found: incr(r); link(r):=null; {this node is now nonempty}
@!stat var_used:=var_used+s; {maintain usage statistics}
tats@;@/
link(r-1):=null; info(r-1):=null;
get_node:=r;
exit:end;
@z
%---------------------------------------
@x [10] m.130
@p procedure free_node(@!p:pointer; @!s:halfword); {variable-size node
liberation}
var q:pointer; {|llink(rover)|}
begin node_size(p):=s; link(p):=empty_flag;
q:=llink(rover); llink(p):=q; rlink(p):=rover; {set both links}
llink(rover):=p; rlink(q):=p; {insert |p| into the ring}
@!stat var_used:=var_used-s;@+tats@;{maintain statistics}
end;
@y
@p procedure free_node(@!p:pointer; @!s:halfword); {variable-size node
liberation}
var q:pointer; {|llink(rover)|}
begin
decr(p); incr(s);
link(p):=null; info(p):=null;
node_size(p):=s; link(p):=empty_flag;
q:=llink(rover); llink(p):=q; rlink(p):=rover; {set both links}
llink(rover):=p; rlink(q):=p; {insert |p| into the ring}
@!stat var_used:=var_used-s;@+tats@;{maintain statistics}
end;
@z
%---------------------------------------
@x [10] m.134 l.2832 - Omega
Note that the format of a |char_node| allows for up to 256 different
fonts and up to 256 characters per font; but most implementations will
probably limit the total number of fonts to fewer than 75 per job,
and most fonts will stick to characters whose codes are
less than 128 (since higher codes
are more difficult to access on most keyboards).
Extensions of \TeX\ intended for oriental languages will need even more
than $256\times256$ possible characters, when we consider different sizes
@^oriental characters@>@^Chinese characters@>@^Japanese characters@>
and styles of type. It is suggested that Chinese and Japanese fonts be
handled by representing such characters in two consecutive |char_node|
entries: The first of these has |font=font_base|, and its |link| points
to the second;
the second identifies the font and the character dimensions.
The saving feature about oriental characters is that most of them have
the same box dimensions. The |character| field of the first |char_node|
is a ``\\{charext}'' that distinguishes between graphic symbols whose
dimensions are identical for typesetting purposes. (See the \MF\ manual.)
Such an extension of \TeX\ would not be difficult; further details are
left to the reader.
@y
Note that the format of a |char_node| allows for up to 65536 different
fonts and up to 65536 characters per font.
@z
%---------------------------------------
@x [15] m.208 l.4127 - Omega
@d min_internal=68 {the smallest code that can follow \.{\\the}}
@d char_given=68 {character code defined by \.{\\chardef}}
@d math_given=69 {math code defined by \.{\\mathchardef}}
@d last_item=70 {most recent item ( \.{\\lastpenalty},
\.{\\lastkern}, \.{\\lastskip} )}
@d max_non_prefixed_command=70 {largest command code that can't be \.{\\global}}
@y
@d min_internal=end_cs_name+1 {the smallest code that can follow \.{\\the}}
@d char_given=min_internal {character code defined by \.{\\chardef}}
@d math_given=char_given+1 {math code defined by \.{\\mathchardef}}
@d omath_given=math_given+1 {math code defined by \.{\\omathchardef}}
@d last_item=omath_given+1 {most recent item ( \.{\\lastpenalty},
\.{\\lastkern}, \.{\\lastskip} )}
@d max_non_prefixed_command=last_item
{largest command code that can't be \.{\\global}}
@z
%---------------------------------------
@x [15] m.209 l.4138 - Omega
@d toks_register=71 {token list register ( \.{\\toks} )}
@d assign_toks=72 {special token list ( \.{\\output}, \.{\\everypar}, etc.~)}
@d assign_int=73 {user-defined integer ( \.{\\tolerance}, \.{\\day}, etc.~)}
@d assign_dimen=74 {user-defined length ( \.{\\hsize}, etc.~)}
@d assign_glue=75 {user-defined glue ( \.{\\baselineskip}, etc.~)}
@d assign_mu_glue=76 {user-defined muglue ( \.{\\thinmuskip}, etc.~)}
@d assign_font_dimen=77 {user-defined font dimension ( \.{\\fontdimen} )}
@d assign_font_int=78 {user-defined font integer ( \.{\\hyphenchar},
\.{\\skewchar} )}
@d set_aux=79 {specify state info ( \.{\\spacefactor}, \.{\\prevdepth} )}
@d set_prev_graf=80 {specify state info ( \.{\\prevgraf} )}
@d set_page_dimen=81 {specify state info ( \.{\\pagegoal}, etc.~)}
@d set_page_int=82 {specify state info ( \.{\\deadcycles},
\.{\\insertpenalties} )}
@d set_box_dimen=83 {change dimension of box ( \.{\\wd}, \.{\\ht}, \.{\\dp} )}
@d set_shape=84 {specify fancy paragraph shape ( \.{\\parshape} )}
@d def_code=85 {define a character code ( \.{\\catcode}, etc.~)}
@d def_family=86 {declare math fonts ( \.{\\textfont}, etc.~)}
@d set_font=87 {set current font ( font identifiers )}
@d def_font=88 {define a font file ( \.{\\font} )}
@d register=89 {internal register ( \.{\\count}, \.{\\dimen}, etc.~)}
@d max_internal=89 {the largest code that can follow \.{\\the}}
@d advance=90 {advance a register or parameter ( \.{\\advance} )}
@d multiply=91 {multiply a register or parameter ( \.{\\multiply} )}
@d divide=92 {divide a register or parameter ( \.{\\divide} )}
@d prefix=93 {qualify a definition ( \.{\\global}, \.{\\long}, \.{\\outer} )}
@d let=94 {assign a command code ( \.{\\let}, \.{\\futurelet} )}
@d shorthand_def=95 {code definition ( \.{\\chardef}, \.{\\countdef}, etc.~)}
@d read_to_cs=96 {read into a control sequence ( \.{\\read} )}
@d def=97 {macro definition ( \.{\\def}, \.{\\gdef}, \.{\\xdef}, \.{\\edef} )}
@d set_box=98 {set a box ( \.{\\setbox} )}
@d hyph_data=99 {hyphenation data ( \.{\\hyphenation}, \.{\\patterns} )}
@d set_interaction=100 {define level of interaction ( \.{\\batchmode}, etc.~)}
@d max_command=100 {the largest command code seen at |big_switch|}
@y
@d toks_register=max_non_prefixed_command+1
{token list register ( \.{\\toks} )}
@d assign_toks=toks_register+1
{special token list ( \.{\\output}, \.{\\everypar}, etc.~)}
@d assign_int=assign_toks+1
{user-defined integer ( \.{\\tolerance}, \.{\\day}, etc.~)}
@d assign_dimen=assign_int+1
{user-defined length ( \.{\\hsize}, etc.~)}
@d assign_glue=assign_dimen+1
{user-defined glue ( \.{\\baselineskip}, etc.~)}
@d assign_mu_glue=assign_glue+1
{user-defined muglue ( \.{\\thinmuskip}, etc.~)}
@d assign_font_dimen=assign_mu_glue+1
{user-defined font dimension ( \.{\\fontdimen} )}
@d assign_font_int=assign_font_dimen+1
{user-defined font integer ( \.{\\hyphenchar}, \.{\\skewchar} )}
@d set_aux=assign_font_int+1
{specify state info ( \.{\\spacefactor}, \.{\\prevdepth} )}
@d set_prev_graf=set_aux+1
{specify state info ( \.{\\prevgraf} )}
@d set_page_dimen=set_prev_graf+1
{specify state info ( \.{\\pagegoal}, etc.~)}
@d set_page_int=set_page_dimen+1
{specify state info ( \.{\\deadcycles},
\.{\\insertpenalties} )}
@d set_box_dimen=set_page_int+1
{change dimension of box ( \.{\\wd}, \.{\\ht}, \.{\\dp} )}
@d set_shape=set_box_dimen+1
{specify fancy paragraph shape ( \.{\\parshape} )}
@d def_code=set_shape+1
{define a character code ( \.{\\catcode}, etc.~)}
@d def_family=def_code+1
{declare math fonts ( \.{\\textfont}, etc.~)}
@d set_font=def_family+1
{set current font ( font identifiers )}
@d def_font=set_font+1
{define a font file ( \.{\\font} )}
@d register=def_font+1
{internal register ( \.{\\count}, \.{\\dimen}, etc.~)}
@d max_internal=register
{the largest code that can follow \.{\\the}}
@d advance=max_internal+1
{advance a register or parameter ( \.{\\advance} )}
@d multiply=advance+1
{multiply a register or parameter ( \.{\\multiply} )}
@d divide=multiply+1
{divide a register or parameter ( \.{\\divide} )}
@d prefix=divide+1
{qualify a definition ( \.{\\global}, \.{\\long}, \.{\\outer} )}
@d let=prefix+1
{assign a command code ( \.{\\let}, \.{\\futurelet} )}
@d shorthand_def=let+1
{code definition ( \.{\\chardef}, \.{\\countdef}, etc.~)}
@d read_to_cs=shorthand_def+1
{read into a control sequence ( \.{\\read} )}
@d def=read_to_cs+1
{macro definition ( \.{\\def}, \.{\\gdef}, \.{\\xdef}, \.{\\edef} )}
@d set_box=def+1
{set a box ( \.{\\setbox} )}
@d hyph_data=set_box+1
{hyphenation data ( \.{\\hyphenation}, \.{\\patterns} )}
@d set_interaction=hyph_data+1
{define level of interaction ( \.{\\batchmode}, etc.~)}
@d max_command=set_interaction
{the largest command code seen at |big_switch|}
@z
%---------------------------------------
@x [17] m.220 l.4486 - Omega
@d eq_level(#)==eq_level_field(eqtb[#]) {level of definition}
@d eq_type(#)==eq_type_field(eqtb[#]) {command code for equivalent}
@d equiv(#)==equiv_field(eqtb[#]) {equivalent value}
@y
@d eq_level(#)==new_eq_level(#) {level of definition}
@d eq_type(#)==new_eq_type(#) {command code for equivalent}
@d equiv(#)==new_equiv(#) {equivalent value}
@d equiv1(#)==new_equiv1(#) {equivalent value}
@z
%---------------------------------------
@x [17] m.222 l.4496 - Omega
In the first region we have 256 equivalents for ``active characters'' that
act as control sequences, followed by 256 equivalents for single-character
control sequences.
@y
In the first region we have |number_chars| equivalents for ``active characters''
that act as control sequences, followed by |number_chars| equivalents for
single-character control sequences.
@z
%---------------------------------------
@x [17] m.222 l.4507 - Omega
@d single_base=active_base+256 {equivalents of one-character control sequences}
@d null_cs=single_base+256 {equivalent of \.{\\csname\\endcsname}}
@y
@d single_base=active_base+number_chars
{equivalents of one-character control sequences}
@d null_cs=single_base+number_chars {equivalent of \.{\\csname\\endcsname}}
@z
%---------------------------------------
@x [17] m.222 l.4530 - Omega
eq_type(undefined_control_sequence):=undefined_cs;
equiv(undefined_control_sequence):=null;
eq_level(undefined_control_sequence):=level_zero;
for k:=active_base to undefined_control_sequence-1 do
eqtb[k]:=eqtb[undefined_control_sequence];
@y
set_eq_type(undefined_control_sequence,undefined_cs);
set_equiv(undefined_control_sequence,null);
set_eq_level(undefined_control_sequence,level_zero);
@z
%---------------------------------------
@x [17] m.224 l.4547 - Omega
@ Region 3 of |eqtb| contains the 256 \.{\\skip} registers, as well as the
glue parameters defined here. It is important that the ``muskip''
parameters have larger numbers than the others.
@y
@ Region 3 of |eqtb| contains the |number_regs| \.{\\skip} registers,
as well as the glue parameters defined here. It is important that the
``muskip'' parameters have larger numbers than the others.
@z
%---------------------------------------
@x [17] m.224 l.4572 - Omega
@d skip_base=glue_base+glue_pars {table of 256 ``skip'' registers}
@d mu_skip_base=skip_base+256 {table of 256 ``muskip'' registers}
@d local_base=mu_skip_base+256 {beginning of region 4}
@y
@d skip_base=glue_base+glue_pars {table of |number_regs| ``skip'' registers}
@d mu_skip_base=skip_base+number_regs
{table of |number_regs| ``muskip'' registers}
@d local_base=mu_skip_base+number_regs {beginning of region 4}
@z
%---------------------------------------
@x [17] m.228 l.4685 - Omega
equiv(glue_base):=zero_glue; eq_level(glue_base):=level_one;
eq_type(glue_base):=glue_ref;
for k:=glue_base+1 to local_base-1 do eqtb[k]:=eqtb[glue_base];
@y
set_equiv(glue_base,zero_glue); set_eq_level(glue_base,level_one);
set_eq_type(glue_base,glue_ref);
@z
%---------------------------------------
@x [17] m.230 l.4721 - Omega
@d toks_base=local_base+10 {table of 256 token list registers}
@d box_base=toks_base+256 {table of 256 box registers}
@d cur_font_loc=box_base+256 {internal font number outside math mode}
@d math_font_base=cur_font_loc+1 {table of 48 math font numbers}
@d cat_code_base=math_font_base+48
{table of 256 command codes (the ``catcodes'')}
@d lc_code_base=cat_code_base+256 {table of 256 lowercase mappings}
@d uc_code_base=lc_code_base+256 {table of 256 uppercase mappings}
@d sf_code_base=uc_code_base+256 {table of 256 spacefactor mappings}
@d math_code_base=sf_code_base+256 {table of 256 math mode mappings}
@d int_base=math_code_base+256 {beginning of region 5}
@y
@d toks_base=local_base+10 {table of |number_regs| token list registers}
@d box_base=toks_base+number_regs {table of |number_regs| box registers}
@d cur_font_loc=box_base+number_regs {internal font number outside math mode}
@d math_font_base=cur_font_loc+1
{table of |number_math_fonts| math font numbers}
@d cat_code_base=math_font_base+number_math_fonts
{table of |number_chars| command codes (the ``catcodes'')}
@d lc_code_base=cat_code_base+number_chars
{table of |number_chars| lowercase mappings}
@d uc_code_base=lc_code_base+number_chars
{table of |number_chars| uppercase mappings}
@d sf_code_base=uc_code_base+number_chars
{table of |number_chars| spacefactor mappings}
@d math_code_base=sf_code_base+number_chars
{table of |number_chars| math mode mappings}
@d int_base=math_code_base+number_chars {beginning of region 5}
@z
%---------------------------------------
@x [17] m.232 l.4802 - Omega
@d var_code==@'70000 {math code meaning ``use the current family''}
@<Initialize table entries...@>=
par_shape_ptr:=null; eq_type(par_shape_loc):=shape_ref;
eq_level(par_shape_loc):=level_one;@/
for k:=output_routine_loc to toks_base+255 do
eqtb[k]:=eqtb[undefined_control_sequence];
box(0):=null; eq_type(box_base):=box_ref; eq_level(box_base):=level_one;
for k:=box_base+1 to box_base+255 do eqtb[k]:=eqtb[box_base];
cur_font:=null_font; eq_type(cur_font_loc):=data;
eq_level(cur_font_loc):=level_one;@/
for k:=math_font_base to math_font_base+47 do eqtb[k]:=eqtb[cur_font_loc];
equiv(cat_code_base):=0; eq_type(cat_code_base):=data;
eq_level(cat_code_base):=level_one;@/
for k:=cat_code_base+1 to int_base-1 do eqtb[k]:=eqtb[cat_code_base];
for k:=0 to 255 do
begin cat_code(k):=other_char; math_code(k):=hi(k); sf_code(k):=1000;
end;
cat_code(carriage_return):=car_ret; cat_code(" "):=spacer;
cat_code("\"):=escape; cat_code("%"):=comment;
cat_code(invalid_code):=invalid_char; cat_code(null_code):=ignore;
for k:="0" to "9" do math_code(k):=hi(k+var_code);
for k:="A" to "Z" do
begin cat_code(k):=letter; cat_code(k+"a"-"A"):=letter;@/
math_code(k):=hi(k+var_code+@"100);
math_code(k+"a"-"A"):=hi(k+"a"-"A"+var_code+@"100);@/
lc_code(k):=k+"a"-"A"; lc_code(k+"a"-"A"):=k+"a"-"A";@/
uc_code(k):=k; uc_code(k+"a"-"A"):=k;@/
sf_code(k):=999;
end;
@y
@d var_code==@"7000000 {math code meaning ``use the current family''}
@<Initialize table entries...@>=
set_equiv(par_shape_loc,null); set_eq_type(par_shape_loc,shape_ref);
set_eq_level(par_shape_loc,level_one);@/
set_equiv(cat_code_base+carriage_return,car_ret);
set_equiv(cat_code_base+" ",spacer);
set_equiv(cat_code_base+"\",escape);
set_equiv(cat_code_base+"%",comment);
set_equiv(cat_code_base+invalid_code,invalid_char);
set_equiv(cat_code_base+null_code,ignore);
for k:="0" to "9" do set_equiv(math_code_base+k,hi(k+var_code));
for k:="A" to "Z" do
begin set_equiv(cat_code_base+k,letter);
set_equiv(cat_code_base+k+"a"-"A",letter);@/
set_equiv(math_code_base+k,hi(k+var_code+@"10000));
set_equiv(math_code_base+k+"a"-"A",hi(k+"a"-"A"+var_code+@"10000));@/
set_equiv(lc_code_base+k,k+"a"-"A");
set_equiv(lc_code_base+k+"a"-"A",k+"a"-"A");@/
set_equiv(uc_code_base+k,k);
set_equiv(uc_code_base+k+"a"-"A",k);@/
set_equiv(sf_code_base+k,999);
end;
@z
%---------------------------------------
@x [17] m.234 l.4857 - Omega
@ @<Show the font identifier in |eqtb[n]|@>=
begin if n=cur_font_loc then print("current font")
else if n<math_font_base+16 then
begin print_esc("textfont"); print_int(n-math_font_base);
end
else if n<math_font_base+32 then
begin print_esc("scriptfont"); print_int(n-math_font_base-16);
end
else begin print_esc("scriptscriptfont"); print_int(n-math_font_base-32);
end;
print_char("=");@/
print_esc(hash[font_id_base+equiv(n)].rh);
{that's |font_id_text(equiv(n))|}
@y
@ @<Show the font identifier in |eqtb[n]|@>=
begin if n=cur_font_loc then print("current font")
else if n<math_font_base+script_size then
begin print_esc("textfont"); print_int(n-math_font_base);
end
else if n<math_font_base+script_script_size then
begin print_esc("scriptfont"); print_int(n-math_font_base-script_size);
end
else begin print_esc("scriptscriptfont");
print_int(n-math_font_base-script_script_size);
end;
print_char("=");@/
print_esc(newtext(font_id_base+equiv(n)));
{that's |font_id_text(equiv(n))|}
@z
%---------------------------------------
@x [17] m.236 l.4955 - Omega
@d count_base=int_base+int_pars {256 user \.{\\count} registers}
@d del_code_base=count_base+256 {256 delimiter code mappings}
@d dimen_base=del_code_base+256 {beginning of region 6}
@#
@d del_code(#)==eqtb[del_code_base+#].int
@d count(#)==eqtb[count_base+#].int
@d int_par(#)==eqtb[int_base+#].int {an integer parameter}
@y
@d count_base=int_base+int_pars {|number_regs| user \.{\\count} registers}
@d del_code_base=count_base+number_regs {|number_chars| delimiter code mappings}
@d dimen_base=del_code_base+number_chars {beginning of region 6}
@#
@d del_code0(#)==new_equiv(del_code_base+#)
@d del_code1(#)==new_equiv1(del_code_base+#)
@d count(#)==new_eqtb_int(count_base+#)
@d int_par(#)==new_eqtb_int(int_base+#) {an integer parameter}
@z
%---------------------------------------
@x [17] m.240 l.5213 - Omega
for k:=int_base to del_code_base-1 do eqtb[k].int:=0;
mag:=1000; tolerance:=10000; hang_after:=1; max_dead_cycles:=25;
escape_char:="\"; end_line_char:=carriage_return;
for k:=0 to 255 do del_code(k):=-1;
del_code("."):=0; {this null delimiter is used in error recovery}
@y
set_new_eqtb_int(int_base+mag_code,1000);
set_new_eqtb_int(int_base+tolerance_code,10000);
set_new_eqtb_int(int_base+hang_after_code,1);
set_new_eqtb_int(int_base+max_dead_cycles_code,25);
set_new_eqtb_int(int_base+escape_char_code,"\");
set_new_eqtb_int(int_base+end_line_char_code,carriage_return);
set_equiv(del_code_base+".",0);
set_equiv1(del_code_base+".",0);
{this null delimiter is used in error recovery}
@ @<Set newline character to -1@>=
set_new_eqtb_int(int_base+new_line_char_code,-1)
@ @<Set newline character to nl@>=
set_new_eqtb_int(int_base+new_line_char_code,nl)
@z
%---------------------------------------
@x [17] m.242 l.5240 - Omega
print_char("="); print_int(eqtb[n].int);
@y
print_char("="); print_int(new_eqtb_int(n));
@z
%---------------------------------------
@x [17] m.247 l.5273 - Omega
here, and the 256 \.{\\dimen} registers.
@y
here, and the |number_regs| \.{\\dimen} registers.
@z
%---------------------------------------
@x [17] m.247 l.5298 - Omega
{table of 256 user-defined \.{\\dimen} registers}
@d eqtb_size=scaled_base+255 {largest subscript of |eqtb|}
@#
@d dimen(#)==eqtb[scaled_base+#].sc
@d dimen_par(#)==eqtb[dimen_base+#].sc {a scaled quantity}
@y
{table of |number_regs| user-defined \.{\\dimen} registers}
@d eqtb_size=scaled_base+biggest_reg {largest subscript of |eqtb|}
@#
@d dimen(#)==new_eqtb_sc(scaled_base+(#))
@d dimen_par(#)==new_eqtb_sc(dimen_base+(#)) {a scaled quantity}
@z
%---------------------------------------
@x [17] m.250 l.5405 - Omega
for k:=dimen_base to eqtb_size do eqtb[k].sc:=0;
@y
@ @p function init_eqtb_entry (p:pointer):memory_word;
var mw:memory_word;
begin
{ Regions 1 and 2 }
if (p>=active_base) and
(p<=undefined_control_sequence) then begin
equiv_field(mw):=null;
eq_type_field(mw):=undefined_cs;
eq_level_field(mw):=level_zero;
end
{ Region 3 }
else if (p>=glue_base) and
(p<=local_base+1) then begin
equiv_field(mw):=zero_glue;
eq_type_field(mw):=glue_ref;
eq_level_field(mw):=level_one;
end
{ Region 4 }
else if (p>=par_shape_loc) and
(p<=toks_base+biggest_reg) then begin
equiv_field(mw):=null;
eq_type_field(mw):=undefined_cs;
eq_level_field(mw):=level_zero;
end
else if (p>=box_base) and
(p<=box_base+biggest_reg) then begin
equiv_field(mw):=null;
eq_type_field(mw):=box_ref;
eq_level_field(mw):=level_one;
end
else if (p>=cur_font_loc) and
(p<=math_font_base+math_font_biggest) then begin
equiv_field(mw):=null_font;
eq_type_field(mw):=data;
eq_level_field(mw):=level_one;
end
else if (p>=cat_code_base) and
(p<=cat_code_base+biggest_char) then begin
equiv_field(mw):=other_char;
eq_type_field(mw):=data;
eq_level_field(mw):=level_one;
end
else if (p>=lc_code_base) and
(p<=uc_code_base+biggest_char) then begin
equiv_field(mw):=0;
eq_type_field(mw):=data;
eq_level_field(mw):=level_one;
end
else if (p>=sf_code_base) and
(p<=sf_code_base+biggest_char) then begin
equiv_field(mw):=1000;
eq_type_field(mw):=data;
eq_level_field(mw):=level_one;
end
else if (p>=math_code_base) and
(p<=math_code_base+biggest_char) then begin
equiv_field(mw):=hi(p-math_code_base);
eq_type_field(mw):=data;
eq_level_field(mw):=level_one;
end
{ Region 5 }
else if (p>=int_base) and (p<=del_code_base-1) then begin
setintzero(mw,0);
setintone(mw,0);
end
else if (p>=del_code_base) and (p<=del_code_base+biggest_char) then begin
setintzero(mw,-1);
setintone(mw,-1);
end
{ Region 6 }
else if (p>=dimen_base) and (p<=eqtb_size) then begin
setintzero(mw,0);
setintone(mw,0);
end
else begin
equiv_field(mw):=null;
eq_type_field(mw):=undefined_cs;
eq_level_field(mw):=level_zero;
end;
init_eqtb_entry:=mw;
end;
@z
%---------------------------------------
@x [17] m.251 l.5411 - Omega
print_char("="); print_scaled(eqtb[n].sc); print("pt");
@y
print_char("="); print_scaled(new_eqtb_sc(n)); print("pt");
@z
%---------------------------------------
@x [17] m.254 l.5435 - Omega
@ The last two regions of |eqtb| have fullword values instead of the
three fields |eq_level|, |eq_type|, and |equiv|. An |eq_type| is unnecessary,
but \TeX\ needs to store the |eq_level| information in another array
called |xeq_level|.
@<Glob...@>=
@!eqtb:array[active_base..eqtb_size] of memory_word;
@!xeq_level:array[int_base..eqtb_size] of quarterword;
@y
@ The last two regions of |eqtb| have fullword values instead of the
three fields |eq_level|, |eq_type|, and |equiv|. An |eq_type| is unnecessary,
but \TeX\ needs to store the |eq_level| information in another array
called |xeq_level|.
@d xeq_level(#) == new_xeq_level(eqtb_size+eqtb_size+#)
@d set_xeq_level(#) == set_new_eqtb_int(eqtb_size+eqtb_size+#)
@z
%---------------------------------------
@x [17] m.255 l.5439 - Omega
for k:=int_base to eqtb_size do xeq_level[k]:=level_one;
@y
@z
%---------------------------------------
@x [17] m.255 l.5446 - Omega
for q:=active_base to box_base+255 do
@y
for q:=active_base to box_base+biggest_reg do
@z
%---------------------------------------
@x [18] m.256 l.5477 - Omega
@d next(#) == hash[#].lh {link for coalesced lists}
@d text(#) == hash[#].rh {string number for control sequence name}
@d hash_is_full == (hash_used=hash_base) {test if all positions are occupied}
@d font_id_text(#) == text(font_id_base+#) {a frozen font identifier's name}
@<Glob...@>=
@!hash: array[hash_base..undefined_control_sequence-1] of two_halves;
{the hash table}
@y
@d hash_is_full == (hash_used=hash_base) {test if all positions are occupied}
@d font_id_text(#) == newtext(font_id_base+#) {a frozen font identifier's name}
@d newtext(#) == new_hash_text(eqtb_size+#)
@d newnext(#) == new_hash_next(eqtb_size+#)
@d settext(#) == set_hash_text(eqtb_size+#)
@d setnext(#) == set_hash_next(eqtb_size+#)
@<Glob...@>=
@z
%---------------------------------------
@x [18] m.257 l.5491 - Omega
next(hash_base):=0; text(hash_base):=0;
for k:=hash_base+1 to undefined_control_sequence-1 do hash[k]:=hash[hash_base];
@y
@z
%---------------------------------------
@x [18] m.258 l.5497 - Omega
hash_used:=frozen_control_sequence; {nothing is used}
cs_count:=0;
eq_type(frozen_dont_expand):=dont_expand;
text(frozen_dont_expand):="notexpanded:";
@y
hash_used:=frozen_control_sequence; {nothing is used}
cs_count:=0;
set_eq_type(frozen_dont_expand,dont_expand);
settext(frozen_dont_expand,"notexpanded:");
@z
%---------------------------------------
@x [18] m.259 l.5514 - Omega
@!k:pointer; {index in |buffer| array}
begin @<Compute the hash code |h|@>;
p:=h+hash_base; {we start searching here; note that |0<=h<hash_prime|}
loop@+begin if text(p)>0 then if length(text(p))=l then
if str_eq_buf(text(p),j) then goto found;
if next(p)=0 then
begin if no_new_control_sequence then
p:=undefined_control_sequence
else @<Insert a new control sequence after |p|, then make
|p| point to it@>;
goto found;
end;
p:=next(p);
end;
found: id_lookup:=p;
@y
@!k:pointer; {index in |buffer| array}
@!newstring:integer;
begin @<Compute the hash code |h|@>;
p:=h+hash_base; {we start searching here; note that |0<=h<hash_prime|}
loop@+begin if newtext(p)>0 then if length(newtext(p))=l then
if str_eq_buf(newtext(p),j) then goto found;
if newnext(p)=0 then
begin if no_new_control_sequence then
p:=undefined_control_sequence
else @<Insert a new control sequence after |p|, then make
|p| point to it@>;
goto found;
end;
p:=newnext(p);
end;
found: id_lookup:=p;
@z
%---------------------------------------
@x [18] m.260 l.5532 - Omega
begin if text(p)>0 then
begin repeat if hash_is_full then overflow("hash size",hash_size);
@:TeX capacity exceeded hash size}{\quad hash size@>
decr(hash_used);
until text(hash_used)=0; {search for an empty location in |hash|}
next(p):=hash_used; p:=hash_used;
end;
str_room(l); d:=cur_length;
while pool_ptr>str_start[str_ptr] do
begin decr(pool_ptr); str_pool[pool_ptr+l]:=str_pool[pool_ptr];
end; {move current string up to make room for another}
for k:=j to j+l-1 do append_char(buffer[k]);
text(p):=make_string; pool_ptr:=pool_ptr+d;
@y
begin if newtext(p)>0 then
begin repeat if hash_is_full then overflow("hash size",hash_size);
@:TeX capacity exceeded hash size}{\quad hash size@>
decr(hash_used);
until newtext(hash_used)=0; {search for an empty location in |hash|}
setnext(p,hash_used); p:=hash_used;
end;
str_room(l); d:=cur_length;
while pool_ptr>str_start[str_ptr] do
begin decr(pool_ptr); str_pool[pool_ptr+l]:=str_pool[pool_ptr];
end; {move current string up to make room for another}
for k:=j to j+l-1 do append_char(buffer[k]);
newstring:=make_string;
settext(p,newstring); pool_ptr:=pool_ptr+d;
@z
%---------------------------------------
@x [18] m.262 l.5584 - Omega
else if (text(p)<0)or(text(p)>=str_ptr) then print_esc("NONEXISTENT.")
@.NONEXISTENT@>
else begin print_esc(text(p));
@y
else if (newtext(p)<0)or(newtext(p)>=str_ptr) then print_esc("NONEXISTENT.")
@.NONEXISTENT@>
else begin print_esc(newtext(p));
@z
%---------------------------------------
@x [18] m.263 l.5601 - Omega
else print_esc(text(p));
@y
else print_esc(newtext(p));
@z
%---------------------------------------
@x [18] m.264 l.5610 - Omega
@p @!init procedure primitive(@!s:str_number;@!c:quarterword;@!o:halfword);
var k:pool_pointer; {index into |str_pool|}
@!j:small_number; {index into |buffer|}
@!l:small_number; {length of the string}
begin if s<256 then cur_val:=s+single_base
else begin k:=str_start[s]; l:=str_start[s+1]-k;
{we will move |s| into the (empty) |buffer|}
for j:=0 to l-1 do buffer[j]:=so(str_pool[k+j]);
cur_val:=id_lookup(0,l); {|no_new_control_sequence| is |false|}
flush_string; text(cur_val):=s; {we don't want to have the string twice}
end;
eq_level(cur_val):=level_one; eq_type(cur_val):=c; equiv(cur_val):=o;
@y
@p @!init procedure primitive(@!s:str_number;@!c:quarterword;@!o:halfword);
var k:pool_pointer; {index into |str_pool|}
@!j:small_number; {index into |buffer|}
@!l:small_number; {length of the string}
begin if s<=biggest_char then cur_val:=s+single_base
else begin k:=str_start[s]; l:=str_start[s+1]-k;
{we will move |s| into the (empty) |buffer|}
for j:=0 to l-1 do buffer[j]:=so(str_pool[k+j]);
cur_val:=id_lookup(0,l); {|no_new_control_sequence| is |false|}
flush_string; settext(cur_val,s); {we don't want to have the string twice}
end;
set_eq_level(cur_val,level_one); set_eq_type(cur_val,c);
set_equiv(cur_val,o);
@z
%---------------------------------------
@x [18] m.265 l.5648 - Omega
primitive("delimiter",delim_num,0);@/
@!@:delimiter_}{\.{\\delimiter} primitive@>
@y
primitive("delimiter",delim_num,0);@/
@!@:delimiter_}{\.{\\delimiter} primitive@>
primitive("odelimiter",delim_num,1);@/
@!@:delimiter_}{\.{\\odelimiter} primitive@>
@z
%---------------------------------------
@x [18] m.265 l.5656 - Omega
text(frozen_end_group):="endgroup"; eqtb[frozen_end_group]:=eqtb[cur_val];@/
@y
settext(frozen_end_group,"endgroup");
set_new_eqtb(frozen_end_group,new_eqtb(cur_val));@/
@z
%---------------------------------------
@x [18] m.265 l.5673 - Omega
primitive("mathaccent",math_accent,0);@/
@!@:math_accent_}{\.{\\mathaccent} primitive@>
primitive("mathchar",math_char_num,0);@/
@!@:math_char_}{\.{\\mathchar} primitive@>
@y
primitive("mathaccent",math_accent,0);@/
@!@:math_accent_}{\.{\\mathaccent} primitive@>
primitive("mathchar",math_char_num,0);@/
@!@:math_char_}{\.{\\mathchar} primitive@>
primitive("omathaccent",math_accent,1);@/
@!@:math_accent_}{\.{\\omathaccent} primitive@>
primitive("omathchar",math_char_num,1);@/
@!@:math_char_}{\.{\\omathchar} primitive@>
@z
%---------------------------------------
@x [18] m.265 l.5697 - Omega
primitive("radical",radical,0);@/
@!@:radical_}{\.{\\radical} primitive@>
@y
primitive("radical",radical,0);@/
@!@:radical_}{\.{\\radical} primitive@>
primitive("oradical",radical,1);@/
@!@:radical_}{\.{\\oradical} primitive@>
@z
%---------------------------------------
@x [18] m.265 l.5701 - Omega
primitive("relax",relax,256); {cf.\ |scan_file_name|}
@!@:relax_}{\.{\\relax} primitive@>
text(frozen_relax):="relax"; eqtb[frozen_relax]:=eqtb[cur_val];@/
@y
primitive("relax",relax,too_big_char); {cf.\ |scan_file_name|}
@!@:relax_}{\.{\\relax} primitive@>
settext(frozen_relax,"relax");
set_new_eqtb(frozen_relax,new_eqtb(cur_val));@/
@z
%---------------------------------------
@x [19] m.276 l.5951 - Omega
else begin save_stack[save_ptr]:=eqtb[p]; incr(save_ptr);
@y
else begin save_stack[save_ptr]:=new_eqtb(p); incr(save_ptr);
@z
%---------------------------------------
@x [19] m.277 l.5967 - Omega
begin if eq_level(p)=cur_level then eq_destroy(eqtb[p])
else if cur_level>level_one then eq_save(p,eq_level(p));
eq_level(p):=cur_level; eq_type(p):=t; equiv(p):=e;
@y
begin if eq_level(p)=cur_level then eq_destroy(new_eqtb(p))
else if cur_level>level_one then eq_save(p,eq_level(p));
set_eq_level(p,cur_level); set_eq_type(p,t); set_equiv(p,e);
@z
%---------------------------------------
@x [19] m.278 l.5980 - Omega
@p procedure eq_word_define(@!p:pointer;@!w:integer);
begin if xeq_level[p]<>cur_level then
begin eq_save(p,xeq_level[p]); xeq_level[p]:=cur_level;
end;
eqtb[p].int:=w;
end;
@y
@p procedure eq_word_define(@!p:pointer;@!w:integer);
begin if xeq_level(p)<>cur_level then
begin eq_save(p,xeq_level(p)); set_xeq_level(p,cur_level);
end;
set_new_eqtb_int(p,w);
end;
procedure del_eq_word_define(@!p:pointer;@!w,wone:integer);
begin if xeq_level(p)<>cur_level then
begin eq_save(p,xeq_level(p)); set_xeq_level(p,cur_level);
end;
set_equiv(p,w); set_equiv1(p,wone);
end;
@z
%---------------------------------------
@x [19] m.279 l.5990 - Omega
begin eq_destroy(eqtb[p]);
eq_level(p):=level_one; eq_type(p):=t; equiv(p):=e;
end;
@#
procedure geq_word_define(@!p:pointer;@!w:integer); {global |eq_word_define|}
begin eqtb[p].int:=w; xeq_level[p]:=level_one;
end;
@y
begin eq_destroy(new_eqtb(p));
set_eq_level(p,level_one); set_eq_type(p,t); set_equiv(p,e);
end;
@#
procedure geq_word_define(@!p:pointer;@!w:integer); {global |eq_word_define|}
begin set_new_eqtb_int(p,w); set_xeq_level(p,level_one);
end;
procedure del_geq_word_define(@!p:pointer;@!w,wone:integer);
{global |del_eq_word_define|}
begin set_equiv(p,w); set_equiv1(p,wone); set_xeq_level(p,level_one);
end;
@z
%---------------------------------------
@x [19] m.282 l.6036 - Omega
else save_stack[save_ptr]:=eqtb[undefined_control_sequence];
@y
else save_stack[save_ptr]:=new_eqtb(undefined_control_sequence);
@z
%---------------------------------------
@x [19] m.283 l.6056 - Omega
else begin eq_destroy(eqtb[p]); {destroy the current value}
eqtb[p]:=save_stack[save_ptr]; {restore the saved value}
@!stat if tracing_restores>0 then restore_trace(p,"restoring");@+tats@;@/
end
else if xeq_level[p]<>level_one then
begin eqtb[p]:=save_stack[save_ptr]; xeq_level[p]:=l;
@y
else begin eq_destroy(new_eqtb(p)); {destroy the current value}
set_new_eqtb(p,save_stack[save_ptr]); {restore the saved value}
@!stat if tracing_restores>0 then restore_trace(p,"restoring");@+tats@;@/
end
else if xeq_level(p)<>level_one then
begin set_new_eqtb(p,save_stack[save_ptr]); set_xeq_level(p,l);
@z
%---------------------------------------
@x [20] m.289 l.6129 - Omega
number $2^8m+c$; the command code is in the range |1<=m<=14|. (2)~A control
sequence whose |eqtb| address is |p| is represented as the number
|cs_token_flag+p|. Here |cs_token_flag=@t$2^{12}-1$@>| is larger than
@y
number $2^16m+c$; the command code is in the range |1<=m<=14|. (2)~A control
sequence whose |eqtb| address is |p| is represented as the number
|cs_token_flag+p|. Here |cs_token_flag=@t$2^{20}-1$@>| is larger than
@z
%---------------------------------------
@x [20] m.289 l.6142 - Omega
@d cs_token_flag==@'7777 {amount added to the |eqtb| location in a
token that stands for a control sequence; is a multiple of~256, less~1}
@d left_brace_token=@'0400 {$2^8\cdot|left_brace|$}
@d left_brace_limit=@'1000 {$2^8\cdot(|left_brace|+1)$}
@d right_brace_token=@'1000 {$2^8\cdot|right_brace|$}
@d right_brace_limit=@'1400 {$2^8\cdot(|right_brace|+1)$}
@d math_shift_token=@'1400 {$2^8\cdot|math_shift|$}
@d tab_token=@'2000 {$2^8\cdot|tab_mark|$}
@d out_param_token=@'2400 {$2^8\cdot|out_param|$}
@d space_token=@'5040 {$2^8\cdot|spacer|+|" "|$}
@d letter_token=@'5400 {$2^8\cdot|letter|$}
@d other_token=@'6000 {$2^8\cdot|other_char|$}
@d match_token=@'6400 {$2^8\cdot|match|$}
@d end_match_token=@'7000 {$2^8\cdot|end_match|$}
@y
@d cs_token_flag=@"FFFFF {amount added to the |eqtb| location in a
token that stands for a control sequence; is a multiple of~65536, less~1}
@d max_char_val=@"10000 {to separate char and command code}
@d left_brace_token=@"10000 {$2^16\cdot|left_brace|$}
@d left_brace_limit=@"20000 {$2^16\cdot(|left_brace|+1)$}
@d right_brace_token=@"20000 {$2^16\cdot|right_brace|$}
@d right_brace_limit=@"30000 {$2^16\cdot(|right_brace|+1)$}
@d math_shift_token=@"30000 {$2^16\cdot|math_shift|$}
@d tab_token=@"40000 {$2^16\cdot|tab_mark|$}
@d out_param_token=@"50000 {$2^16\cdot|out_param|$}
@d space_token=@"A0020 {$2^16\cdot|spacer|+|" "|$}
@d letter_token=@"B0000 {$2^16\cdot|letter|$}
@d other_token=@"C0000 {$2^16\cdot|other_char|$}
@d match_token=@"D0000 {$2^16\cdot|match|$}
@d end_match_token=@"E0000 {$2^16\cdot|end_match|$}
@z
%---------------------------------------
@x [20] m.293 l.6256 - Omega
else begin m:=info(p) div @'400; c:=info(p) mod @'400;
@y
else begin m:=info(p) div max_char_val; c:=info(p) mod max_char_val;
@z
%---------------------------------------
@x [21] m.298 l.6375 - Omega
procedure print_cmd_chr(@!cmd:quarterword;@!chr_code:halfword);
@y
procedure print_cmd_chr(@!cmd:quarterword;@!chr_code:halfword);
@z
%---------------------------------------
@x [24] m.334 l.7110 - Omega
primitive("par",par_end,256); {cf. |scan_file_name|}
@y
primitive("par",par_end,too_big_char); {cf. |scan_file_name|}
@z
%---------------------------------------
@x [24] m.357 l.7462 - Omega
else begin cur_cmd:=t div @'400; cur_chr:=t mod @'400;
@y
else begin cur_cmd:=t div max_char_val; cur_chr:=t mod max_char_val;
@z
%---------------------------------------
@x [24] m.358 l.7479 - Omega
@d no_expand_flag=257 {this characterizes a special variant of |relax|}
@y
@d no_expand_flag=special_char {this characterizes a special variant of |relax|}
@z
%---------------------------------------
@x [24] m.365 l.7606 - Omega
if cur_cs=0 then cur_tok:=(cur_cmd*@'400)+cur_chr
@y
if cur_cs=0 then cur_tok:=(cur_cmd*max_char_val)+cur_chr
@z
%---------------------------------------
@x [25] m.374 l.7728 - Omega
begin eq_define(cur_cs,relax,256); {N.B.: The |save_stack| might change}
@y
begin eq_define(cur_cs,relax,too_big_char);
{N.B.: The |save_stack| might change}
@z
%---------------------------------------
@x [25] m.374 l.7750 - Omega
buffer[j]:=info(p) mod @'400; incr(j); p:=link(p);
@y
buffer[j]:=info(p) mod max_char_val; incr(j); p:=link(p);
@z
%---------------------------------------
@x [25] m.380 l.7812 - Omega
done: if cur_cs=0 then cur_tok:=(cur_cmd*@'400)+cur_chr
@y
done: if cur_cs=0 then cur_tok:=(cur_cmd*max_char_val)+cur_chr
@z
%---------------------------------------
@x [25] m.381 l.7824 - Omega
if cur_cs=0 then cur_tok:=(cur_cmd*@'400)+cur_chr
@y
if cur_cs=0 then cur_tok:=(cur_cmd*max_char_val)+cur_chr
@z
%---------------------------------------
@x [25] m.391 l.7985 - Omega
if (info(r)>match_token+255)or(info(r)<match_token) then s:=null
@y
if (info(r)>=end_match_token)or(info(r)<match_token) then s:=null
@z
%---------------------------------------
@x [26] m.407 l.8161 - Omega
@ The |scan_left_brace| routine is called when a left brace is supposed to be
the next non-blank token. (The term ``left brace'' means, more precisely,
a character whose catcode is |left_brace|.) \TeX\ allows \.{\\relax} to
appear before the |left_brace|.
@p procedure scan_left_brace; {reads a mandatory |left_brace|}
begin @<Get the next non-blank non-relax non-call token@>;
if cur_cmd<>left_brace then
begin print_err("Missing { inserted");
@.Missing \{ inserted@>
help4("A left brace was mandatory here, so I've put one in.")@/
("You might want to delete and/or insert some corrections")@/
("so that I will find a matching right brace soon.")@/
("(If you're confused by all this, try typing `I}' now.)");
back_error; cur_tok:=left_brace_token+"{"; cur_cmd:=left_brace;
cur_chr:="{"; incr(align_state);
end;
end;
@y
@ The |scan_left_brace| routine is called when a left brace is supposed to be
the next non-blank token. (The term ``left brace'' means, more precisely,
a character whose catcode is |left_brace|.) \TeX\ allows \.{\\relax} to
appear before the |left_brace|.
@p procedure scan_left_brace; {reads a mandatory |left_brace|}
begin @<Get the next non-blank non-relax non-call token@>;
if cur_cmd<>left_brace then
begin print_err("Missing { inserted");
@.Missing \{ inserted@>
help4("A left brace was mandatory here, so I've put one in.")@/
("You might want to delete and/or insert some corrections")@/
("so that I will find a matching right brace soon.")@/
("(If you're confused by all this, try typing `I}' now.)");
back_error; cur_tok:=left_brace_token+"{"; cur_cmd:=left_brace;
cur_chr:="{"; incr(align_state);
end;
end;
@ The |scan_right_brace| routine is called when a right brace is supposed to be
the next non-blank token. (The term ``right brace'' means, more precisely,
a character whose catcode is |right_brace|.) \TeX\ allows \.{\\relax} to
appear before the |right_brace|.
@p procedure scan_right_brace; {reads a mandatory |right_brace|}
begin @<Get the next non-blank non-relax non-call token@>;
if cur_cmd<>right_brace then
begin print_err("Missing { inserted");
@.Missing \{ inserted@>
help4("A right brace was mandatory here, so I've put one in.")@/
("You might want to delete and/or insert some corrections")@/
("so that I will find a matching right brace soon.")@/
("(If you're confused by all this, try typing `I}' now.)");
back_error; cur_tok:=right_brace_token+"}"; cur_cmd:=right_brace;
cur_chr:="}"; incr(align_state);
end;
end;
@z
%---------------------------------------
@x [26] m.410 l.8293 - Omega
@!cur_val:integer; {value returned by numeric scanners}
@y
@!cur_val:integer; {value returned by numeric scanners}
@!cur_val1:integer; {delcodes are now 51 digits}
@!cur_val2:integer; {will be used in omxml.ch; this is cheating}
@z
%---------------------------------------
@x [26] m.413 l.8335 - Omega
assign_int: scanned_result(eqtb[m].int)(int_val);
assign_dimen: scanned_result(eqtb[m].sc)(dimen_val);
@y
assign_int: scanned_result(new_eqtb_int(m))(int_val);
assign_dimen: scanned_result(new_eqtb_sc(m))(dimen_val);
@z
%---------------------------------------
@x [26] m.413 l.8345 - Omega
char_given,math_given: scanned_result(cur_chr)(int_val);
@y
char_given,math_given,omath_given: scanned_result(cur_chr)(int_val);
@z
%---------------------------------------
@x [26] m.414 l.8356 - Omega
@ @<Fetch a character code from some table@>=
begin scan_char_num;
if m=math_code_base then scanned_result(ho(math_code(cur_val)))(int_val)
else if m<math_code_base then scanned_result(equiv(m+cur_val))(int_val)
else scanned_result(eqtb[m+cur_val].int)(int_val);
@y
@ @<Fetch a character code from some table@>=
begin scan_char_num;
if m=math_code_base then begin
cur_val1:=ho(math_code(cur_val));
if ((cur_val1 div @"1000000)>8) or
(((cur_val1 mod @"1000000) div @"10000)>15) or
((cur_val1 mod @"10000)>255) then
begin print_err("Extended mathchar used as mathchar");
@.Bad mathchar@>
help2("A mathchar number must be between 0 and ""7FFF.")@/
("I changed this one to zero."); int_error(cur_val1); cur_val1:=0;
end;
cur_val1:=((cur_val1 div @"1000000)*@"1000) +
(((cur_val1 mod @"1000000) div @"10000)*@"100) +
(cur_val1 mod @"10000);
scanned_result(cur_val1)(int_val)
end
else if m=(math_code_base+256) then
scanned_result(ho(math_code(cur_val)))(int_val)
else if m<math_code_base then scanned_result(equiv(m+cur_val))(int_val)
else scanned_result(new_eqtb_int(m+cur_val))(int_val);
@z
%---------------------------------------
@x [26] m.433 l.8593 - Omega
procedure scan_eight_bit_int;
begin scan_int;
if (cur_val<0)or(cur_val>255) then
begin print_err("Bad register code");
@.Bad register code@>
help2("A register number must be between 0 and 255.")@/
@y
procedure scan_eight_bit_int;
begin scan_int;
if (cur_val<0)or(cur_val>biggest_reg) then
begin print_err("Bad register code");
@.Bad register code@>
help2("A register number must be between 0 and 65535.")@/
@z
%---------------------------------------
@x [26] m.434 l.8604 - Omega
procedure scan_char_num;
begin scan_int;
if (cur_val<0)or(cur_val>255) then
begin print_err("Bad character code");
@.Bad character code@>
help2("A character number must be between 0 and 255.")@/
@y
procedure scan_char_num;
begin scan_int;
if (cur_val<0)or(cur_val>biggest_char) then
begin print_err("Bad character code");
@.Bad character code@>
help2("A character number must be between 0 and 65535.")@/
@z
%---------------------------------------
@x [26] m.435 l.8618 - Omega
procedure scan_four_bit_int;
begin scan_int;
if (cur_val<0)or(cur_val>15) then
begin print_err("Bad number");
@.Bad number@>
help2("Since I expected to read a number between 0 and 15,")@/
("I changed this one to zero."); int_error(cur_val); cur_val:=0;
end;
end;
@y
procedure scan_four_bit_int;
begin scan_int;
if (cur_val<0)or(cur_val>15) then
begin print_err("Bad number");
@.Bad number@>
help2("Since I expected to read a number between 0 and 15,")@/
("I changed this one to zero."); int_error(cur_val); cur_val:=0;
end;
end;
procedure scan_big_four_bit_int;
begin scan_int;
if (cur_val<0)or(cur_val>255) then
begin print_err("Bad number");
@.Bad number@>
help2("Since I expected to read a number between 0 and 255,")@/
("I changed this one to zero."); int_error(cur_val); cur_val:=0;
end;
end;
@z
%---------------------------------------
@x [26] m.436 l.8629 - Omega
procedure scan_fifteen_bit_int;
begin scan_int;
if (cur_val<0)or(cur_val>@'77777) then
begin print_err("Bad mathchar");
@.Bad mathchar@>
help2("A mathchar number must be between 0 and 32767.")@/
("I changed this one to zero."); int_error(cur_val); cur_val:=0;
end;
end;
@y
procedure scan_real_fifteen_bit_int;
begin scan_int;
if (cur_val<0)or(cur_val>@'77777) then
begin print_err("Bad mathchar");
@.Bad mathchar@>
help2("A mathchar number must be between 0 and 32767.")@/
("I changed this one to zero."); int_error(cur_val); cur_val:=0;
end;
end;
procedure scan_fifteen_bit_int;
begin scan_int;
if (cur_val<0)or(cur_val>@'77777) then
begin print_err("Bad mathchar");
@.Bad mathchar@>
help2("A mathchar number must be between 0 and 32767.")@/
("I changed this one to zero."); int_error(cur_val); cur_val:=0;
end;
cur_val := ((cur_val div @"1000) * @"1000000) +
(((cur_val mod @"1000) div @"100) * @"10000) +
(cur_val mod @"100);
end;
procedure scan_big_fifteen_bit_int;
begin scan_int;
if (cur_val<0)or(cur_val>@"7FFFFFF) then
begin print_err("Bad extended mathchar");
@.Bad mathchar@>
help2("An extended mathchar number must be between 0 and ""7FFFFFF.")@/
("I changed this one to zero."); int_error(cur_val); cur_val:=0;
end;
end;
@z
%---------------------------------------
@x [26] m.437 l.8640 - Omega
procedure scan_twenty_seven_bit_int;
begin scan_int;
if (cur_val<0)or(cur_val>@'777777777) then
begin print_err("Bad delimiter code");
@.Bad delimiter code@>
help2("A numeric delimiter code must be between 0 and 2^{27}-1.")@/
("I changed this one to zero."); int_error(cur_val); cur_val:=0;
end;
end;
@y
procedure scan_twenty_seven_bit_int;
begin scan_int;
if (cur_val<0)or(cur_val>@'777777777) then
begin print_err("Bad delimiter code");
@.Bad delimiter code@>
help2("A numeric delimiter code must be between 0 and 2^{27}-1.")@/
("I changed this one to zero."); int_error(cur_val); cur_val:=0;
end;
cur_val1 := (((cur_val mod @"1000) div @"100) * @"10000) +
(cur_val mod @"100);
cur_val := cur_val div @"1000;
cur_val := ((cur_val div @"1000) * @"1000000) +
(((cur_val mod @"1000) div @"100) * @"10000) +
(cur_val mod @"100);
end;
procedure scan_fifty_one_bit_int;
var iiii:integer;
begin scan_int;
if (cur_val<0)or(cur_val>@'777777777) then
begin print_err("Bad delimiter code");
@.Bad delimiter code@>
help2("A numeric delimiter (first part) must be between 0 and 2^{27}-1.")
("I changed this one to zero."); int_error(cur_val); cur_val:=0;
end;
iiii:=cur_val;
scan_int;
if (cur_val<0)or(cur_val>@"FFFFFF) then
begin print_err("Bad delimiter code");
@.Bad delimiter code@>
help2("A numeric delimiter (second part) must be between 0 and 2^{24}-1.")@/
("I changed this one to zero."); int_error(cur_val); cur_val:=0;
end;
cur_val1:=cur_val;
cur_val:=iiii;
end;
procedure scan_string_argument;
var s:integer;
begin
scan_left_brace;
get_x_token;
while (cur_cmd<>right_brace) do
begin
if (cur_cmd=letter) or (cur_cmd=other_char) then begin
str_room(1); append_char(cur_chr);
end
else if (cur_cmd=spacer) then begin
str_room(1); append_char(" ");
end
else begin
print_nl("Bad token appearing in string argument");
end;
get_x_token;
end;
s:=make_string;
if str_eq_str("mi",s) then s:="mi";
if str_eq_str("mo",s) then s:="mo";
if str_eq_str("mn",s) then s:="mn";
cur_val:=s;
end;
@z
%---------------------------------------
@x [26] m.442 l.8720 - Omega
if cur_val>255 then
begin print_err("Improper alphabetic constant");
@y
if cur_val>biggest_char then
begin print_err("Improper alphabetic constant");
@z
%---------------------------------------
@x [27] m.468 l.9200 - Omega
@d job_name_code=5 {command code for \.{\\jobname}}
@y
@d omega_code=5 {command code for \.{\\OmegaVersion}}
@d job_name_code=6 {command code for \.{\\jobname}}
@z
%---------------------------------------
@x [27] m.468 l.9200 - Omega
primitive("jobname",convert,job_name_code);@/
@!@:job_name_}{\.{\\jobname} primitive@>
@y
primitive("OmegaVersion",convert,omega_code);@/
@!@:omega_version_}{\.{\\OmegaVersion} primitive@>
primitive("jobname",convert,job_name_code);@/
@!@:job_name_}{\.{\\jobname} primitive@>
@z
%---------------------------------------
@x [27] m.469 l.9223 - Omega
othercases print_esc("jobname")
@y
omega_code: print_esc("OmegaVersion");
othercases print_esc("jobname")
@z
%---------------------------------------
@x [27] m.471 l.9248 - Omega
job_name_code: if job_name=0 then open_log_file;
@y
omega_code:;
job_name_code: if job_name=0 then open_log_file;
@z
%---------------------------------------
@x [27] m.472 l.9258 - Omega
job_name_code: print(job_name);
@y
omega_code: print("1.23.2.3");
job_name_code: print(job_name);
@z
%---------------------------------------
@x [28] m.491 l.9610 - Omega
text(frozen_fi):="fi"; eqtb[frozen_fi]:=eqtb[cur_val];
@y
settext(frozen_fi,"fi"); set_new_eqtb(frozen_fi,new_eqtb(cur_val));
@z
%---------------------------------------
@x [28] m.506 l.9802 - Omega
if (cur_cmd>active_char)or(cur_chr>255) then {not a character}
begin m:=relax; n:=256;
@y
if (cur_cmd>active_char)or(cur_chr>biggest_char) then {not a character}
begin m:=relax; n:=too_big_char;
@z
%---------------------------------------
@x [28] m.506 l.9808 - Omega
if (cur_cmd>active_char)or(cur_chr>255) then
begin cur_cmd:=relax; cur_chr:=256;
@y
if (cur_cmd>active_char)or(cur_chr>biggest_char) then
begin cur_cmd:=relax; cur_chr:=too_big_char;
@z
%---------------------------------------
@x [29] m.526 l.10178 - Omega
loop@+begin if (cur_cmd>other_char)or(cur_chr>255) then {not a character}
@y
loop@+begin if (cur_cmd>other_char)or(cur_chr>biggest_char) then
{not a character}
@z
%---------------------------------------
@x [37] m.780 l.15354 - Omega
@d span_code=256 {distinct from any character}
@d cr_code=257 {distinct from |span_code| and from any character}
@y
@d span_code=special_char {distinct from any character}
@d cr_code=span_code+1 {distinct from |span_code| and from any character}
@z
%---------------------------------------
@x [37] m.780 l.15364 - Omega
text(frozen_cr):="cr"; eqtb[frozen_cr]:=eqtb[cur_val];@/
primitive("crcr",car_ret,cr_cr_code);
@!@:cr_cr_}{\.{\\crcr} primitive@>
text(frozen_end_template):="endtemplate"; text(frozen_endv):="endtemplate";
eq_type(frozen_endv):=endv; equiv(frozen_endv):=null_list;
eq_level(frozen_endv):=level_one;@/
eqtb[frozen_end_template]:=eqtb[frozen_endv];
eq_type(frozen_end_template):=end_template;
@y
settext(frozen_cr,"cr");
set_new_eqtb(frozen_cr,new_eqtb(cur_val));@/
primitive("crcr",car_ret,cr_cr_code);
@!@:cr_cr_}{\.{\\crcr} primitive@>
settext(frozen_end_template,"endtemplate"); settext(frozen_endv,"endtemplate");
set_eq_type(frozen_endv,endv); set_equiv(frozen_endv,null_list);
set_eq_level(frozen_endv,level_one);@/
set_new_eqtb(frozen_end_template,new_eqtb(frozen_endv));
set_eq_type(frozen_end_template,end_template);
@z
%---------------------------------------
@x [37] m.798 l.15651 - Omega
if n>max_quarterword then confusion("256 spans"); {this can happen, but won't}
@^system dependencies@>
@:this can't happen 256 spans}{\quad 256 spans@>
@y
if n>max_quarterword then confusion("too many spans");
{this can happen, but won't}
@^system dependencies@>
@:this can't happen too many spans}{\quad too many spans@>
@z
%---------------------------------------
@x [37] m.804 l.15794 - Omega
overfull_rule:=0; {prevent rule from being packaged}
p:=hpack(preamble,saved(1),saved(0)); overfull_rule:=rule_save;
@y
set_new_eqtb_sc(dimen_base+overfull_rule_code,0);
{prevent rule from being packaged}
p:=hpack(preamble,saved(1),saved(0));
set_new_eqtb_sc(dimen_base+overfull_rule_code,rule_save);
@z
%---------------------------------------
@x [37] m.827 l.16255 - Omega
check_shrinkage(left_skip); check_shrinkage(right_skip);@/
@y
if (shrink_order(left_skip)<>normal)and(shrink(left_skip)<>0) then
begin set_equiv(glue_base+left_skip_code,finite_shrink(left_skip));
end;
if (shrink_order(right_skip)<>normal)and(shrink(right_skip)<>0) then
begin set_equiv(glue_base+right_skip_code,finite_shrink(right_skip));
end;
@z
%---------------------------------------
@x [40] m.891 l.17434 - Omega
$c_1$ will be treated as nonletters. The |hyphen_char| for that font
must be between 0 and 255, otherwise hyphenation will not be attempted.
@y
$c_1$ will be treated as nonletters. The |hyphen_char| for that font must
be between 0 and |biggest_char|, otherwise hyphenation will not be attempted.
@z
%---------------------------------------
@x [40] m.892 l.17469 - Omega
@!hc:array[0..65] of 0..256; {word to be hyphenated}
@!hn:small_number; {the number of positions occupied in |hc|}
@!ha,@!hb:pointer; {nodes |ha..hb| should be replaced by the hyphenated result}
@!hf:internal_font_number; {font number of the letters in |hc|}
@!hu:array[0..63] of 0..256; {like |hc|, before conversion to lowercase}
@!hyf_char:integer; {hyphen character of the relevant font}
@!cur_lang,@!init_cur_lang:ASCII_code; {current hyphenation table of interest}
@!l_hyf,@!r_hyf,@!init_l_hyf,@!init_r_hyf:integer; {limits on fragment sizes}
@!hyf_bchar:halfword; {boundary character after $c_n$}
@y
@!hc:array[0..65] of 0..too_big_char; {word to be hyphenated}
@!hn:small_number; {the number of positions occupied in |hc|}
@!ha,@!hb:pointer; {nodes |ha..hb| should be replaced by the hyphenated result}
@!hf:internal_font_number; {font number of the letters in |hc|}
@!hu:array[0..63] of 0..too_big_char;
{like |hc|, before conversion to lowercase}
@!hyf_char:integer; {hyphen character of the relevant font}
@!cur_lang,@!init_cur_lang:0..biggest_lang;
{current hyphenation table of interest}
@!l_hyf,@!r_hyf,@!init_l_hyf,@!init_r_hyf:integer; {limits on fragment sizes}
@!hyf_bchar:halfword; {boundary character after $c_n$}
@!max_hyph_char:integer;
@ @<Set initial values of key variables@>=
max_hyph_char:=too_big_lang;
@z
%---------------------------------------
@x [40] m.893 l.17483 - Omega
@!c:0..255; {character being considered for hyphenation}
@y
@!c:ASCII_code; {character being considered for hyphenation}
@z
%---------------------------------------
@x [40] m.896 l.17534 - Omega
if hyf_char>255 then goto done1;
@y
if hyf_char>biggest_char then goto done1;
@z
%---------------------------------------
@x [40] m.897 l.17546 - Omega
if lc_code(c)=0 then goto done3;
@y
if lc_code(c)=0 then goto done3;
if lc_code(c)>max_hyph_char then goto done3;
@z
%---------------------------------------
@x [40] m.898 l.17572 - Omega
if lc_code(c)=0 then goto done3;
@y
if lc_code(c)=0 then goto done3;
if lc_code(c)>max_hyph_char then goto done3;
@z
%---------------------------------------
@x [41] m.903 l.17648 - Omega
begin hu[0]:=256; init_lig:=false;
@y
begin hu[0]:=max_hyph_char; init_lig:=false;
@z
%---------------------------------------
@x [41] m.903 l.17660 - Omega
found2: s:=ha; j:=0; hu[0]:=256; init_lig:=false; init_list:=null;
@y
found2: s:=ha; j:=0; hu[0]:=max_hyph_char; init_lig:=false; init_list:=null;
@z
%---------------------------------------
@x [41] m.905 l.17707 - Omega
getting the input $x_j\ldots x_n$ from the |hu| array. If $x_j=256$,
we consider $x_j$ to be an implicit left boundary character; in this
case |j| must be strictly less than~|n|. There is a
parameter |bchar|, which is either 256 or an implicit right boundary character
@y
getting the input $x_j\ldots x_n$ from the |hu| array. If $x_j=|max_hyph_char|$,
we consider $x_j$ to be an implicit left boundary character; in this
case |j| must be strictly less than~|n|. There is a
parameter |bchar|, which is either |max_hyph_char|
or an implicit right boundary character
@z
%---------------------------------------
@x [41] m.916 l.17980 - Omega
begin decr(l); c:=hu[l]; c_loc:=l; hu[l]:=256;
@y
begin decr(l); c:=hu[l]; c_loc:=l; hu[l]:=max_hyph_char;
@z
%---------------------------------------
@x [42] m.921 l.18079 - Omega
@!op_start:array[ASCII_code] of 0..trie_op_size; {offset for current language}
@y
@!op_start:array[0..biggest_lang] of 0..trie_op_size;
{offset for current language}
@z
%---------------------------------------
@x [42] m.923 l.18086 - Omega
hyphenation algorithm is quite short. In the following code we set |hc[hn+2]|
to the impossible value 256, in order to guarantee that |hc[hn+3]| will
@y
hyphenation algorithm is quite short. In the following code we set |hc[hn+2]| to
the impossible value |max_hyph_char|, in order to guarantee that |hc[hn+3]| will
@z
%---------------------------------------
@x [42] m.923 l.18095 - Omega
hc[0]:=0; hc[hn+1]:=0; hc[hn+2]:=256; {insert delimiters}
@y
hc[0]:=0; hc[hn+1]:=0; hc[hn+2]:=max_hyph_char; {insert delimiters}
@z
%---------------------------------------
@x [42] m.934 l.18206 - Omega
@d set_cur_lang==if language<=0 then cur_lang:=0
else if language>255 then cur_lang:=0
@y
@d set_cur_lang==if language<=0 then cur_lang:=0
else if language>biggest_lang then cur_lang:=0
@z
%---------------------------------------
@x [43] m.943 l.18348 - Omega
@!trie_used:array[ASCII_code] of quarterword;
{largest opcode used so far for this language}
@!trie_op_lang:array[1..trie_op_size] of ASCII_code;
@y
@!trie_used:array[0..biggest_lang] of quarterword;
{largest opcode used so far for this language}
@!trie_op_lang:array[1..trie_op_size] of 0..biggest_lang;
@z
%---------------------------------------
@x [43] m.945 l.18400 - Omega
for j:=1 to 255 do op_start[j]:=op_start[j-1]+qo(trie_used[j-1]);
@y
for j:=1 to biggest_lang do op_start[j]:=op_start[j-1]+qo(trie_used[j-1]);
@z
%---------------------------------------
@x [43] m.946 l.18416 - Omega
for k:=0 to 255 do trie_used[k]:=min_quarterword;
@y
for k:=0 to biggest_lang do trie_used[k]:=min_quarterword;
@z
%---------------------------------------
@x [43] m.947 l.18438 - Omega
@!init @!trie_c:packed array[trie_pointer] of packed_ASCII_code;
@y
@!init @!trie_c:packed array[trie_pointer] of ASCII_code;
@z
%---------------------------------------
@x [43] m.952 l.18551 - Omega
for p:=0 to 255 do trie_min[p]:=p+1;
@y
for p:=0 to biggest_char do trie_min[p]:=p+1;
@z
%---------------------------------------
@x [43] m.953 l.18569 - Omega
@!ll:1..256; {upper limit of |trie_min| updating}
@y
@!ll:1..too_big_char; {upper limit of |trie_min| updating}
@z
%---------------------------------------
@x [43] m.953 l.18573 - Omega
@<Ensure that |trie_max>=h+256|@>;
@y
@<Ensure that |trie_max>=h+max_hyph_char|@>;
@z
%---------------------------------------
@x [43] m.954 l.18582 - Omega
@ By making sure that |trie_max| is at least |h+256|, we can be sure that
|trie_max>z|, since |h=z-c|. It follows that location |trie_max| will
never be occupied in |trie|, and we will have |trie_max>=trie_link(z)|.
@<Ensure that |trie_max>=h+256|@>=
if trie_max<h+256 then
begin if trie_size<=h+256 then overflow("pattern memory",trie_size);
@y
@ By making sure that |trie_max| is at least |h+max_hyph_char|,
we can be sure that
|trie_max>z|, since |h=z-c|. It follows that location |trie_max| will
never be occupied in |trie|, and we will have |trie_max>=trie_link(z)|.
@<Ensure that |trie_max>=h+max_hyph_char|@>=
if trie_max<h+max_hyph_char then
begin if trie_size<=h+max_hyph_char then overflow("pattern memory",trie_size);
@z
%---------------------------------------
@x [43] m.954 l.18592 - Omega
until trie_max=h+256;
@y
until trie_max=h+max_hyph_char;
@z
%---------------------------------------
@x [43] m.956 l.18607 - Omega
if l<256 then
begin if z<256 then ll:=z @+else ll:=256;
@y
if l<max_hyph_char then
begin if z<max_hyph_char then ll:=z @+else ll:=max_hyph_char;
@z
%---------------------------------------
@x [43] m.958 l.18637 - Omega
if trie_root=0 then {no patterns were given}
begin for r:=0 to 256 do trie[r]:=h;
trie_max:=256;
@y
if trie_root=0 then {no patterns were given}
begin for r:=0 to max_hyph_char do trie[r]:=h;
trie_max:=max_hyph_char;
@z
%---------------------------------------
@x [43] m.962 l.18714 - Omega
@ @<Append a new letter or a hyphen level@>=
if digit_sensed or(cur_chr<"0")or(cur_chr>"9") then
begin if cur_chr="." then cur_chr:=0 {edge-of-word delimiter}
else begin cur_chr:=lc_code(cur_chr);
if cur_chr=0 then
begin print_err("Nonletter");
@.Nonletter@>
help1("(See Appendix H.)"); error;
end;
end;
@y
@ @<Append a new letter or a hyphen level@>=
if digit_sensed or(cur_chr<"0")or(cur_chr>"9") then
begin if cur_chr="." then cur_chr:=0 {edge-of-word delimiter}
else begin cur_chr:=lc_code(cur_chr);
if cur_chr=0 then
begin print_err("Nonletter");
@.Nonletter@>
help1("(See Appendix H.)"); error;
end;
end;
if cur_chr>max_hyph_char then max_hyph_char:=cur_chr;
@z
%---------------------------------------
@x [43] m.966 l. - Omega
procedure init_trie;
var @!p:trie_pointer; {pointer for initialization}
@!j,@!k,@!t:integer; {all-purpose registers for initialization}
@!r,@!s:trie_pointer; {used to clean up the packed |trie|}
@!h:two_halves; {template used to zero out |trie|'s holes}
begin @<Get ready to compress the trie@>;
@y
procedure init_trie;
var @!p:trie_pointer; {pointer for initialization}
@!j,@!k,@!t:integer; {all-purpose registers for initialization}
@!r,@!s:trie_pointer; {used to clean up the packed |trie|}
@!h:two_halves; {template used to zero out |trie|'s holes}
begin
incr(max_hyph_char);
@<Get ready to compress the trie@>;
@z
%---------------------------------------
@x [44] m.977 l.19008 - Omega
if q=null then box(n):=null {the |eq_level| of the box stays the same}
else box(n):=vpack(q,natural);
@y
if q=null then set_equiv(box_base+n,null)
{the |eq_level| of the box stays the same}
else set_equiv(box_base+n,vpack(q,natural));
@z
%---------------------------------------
@x [45] m.992 l.24928 - Omega
flush_node_list(box(n)); box(n):=null;
@y
flush_node_list(box(n)); set_equiv(box_base+n,null);
@z
%---------------------------------------
@x [45] m.994 l.19364 - Omega
@!n:min_quarterword..255; {insertion box number}
@y
@!n:min_quarterword..biggest_reg; {insertion box number}
@z
%---------------------------------------
@x [45] m.1012 l.19655 - Omega
@!n:min_quarterword..255; {insertion box number}
@y
@!n:min_quarterword..biggest_reg; {insertion box number}
@z
%---------------------------------------
@x [45] m.1014 l.19710 - Omega
split_top_skip:=save_split_top_skip;
@y
set_equiv(glue_base+split_top_skip_code,save_split_top_skip);
@z
%---------------------------------------
@x [45] m.1017 l.19753 - Omega
save_vbadness:=vbadness; vbadness:=inf_bad;
save_vfuzz:=vfuzz; vfuzz:=max_dimen; {inhibit error messages}
box(255):=vpackage(link(page_head),best_size,exactly,page_max_depth);
vbadness:=save_vbadness; vfuzz:=save_vfuzz;
@y
save_vbadness:=vbadness;
set_new_eqtb_int(int_base+vbadness_code,inf_bad);
save_vfuzz:=vfuzz;
set_new_eqtb_sc(dimen_base+vfuzz_code,max_dimen);
{inhibit error messages}
set_equiv(box_base+255,
vpackage(link(page_head),best_size,exactly,page_max_depth));
set_new_eqtb_int(int_base+vbadness_code,save_vbadness);
set_new_eqtb_sc(dimen_base+vfuzz_code,save_vfuzz);
@z
%---------------------------------------
@x [45] m.1018 l.19774 - Omega
if box(n)=null then box(n):=new_null_box;
@y
if box(n)=null then set_equiv(box_base+n,new_null_box);
@z
%---------------------------------------
@x [45] m.1021 l.19817 - Omega
split_top_skip:=split_top_ptr(p);
ins_ptr(p):=prune_page_top(broken_ptr(r));
if ins_ptr(p)<>null then
begin temp_ptr:=vpack(ins_ptr(p),natural);
height(p):=height(temp_ptr)+depth(temp_ptr);
free_node(temp_ptr,box_node_size); wait:=true;
end;
end;
best_ins_ptr(r):=null;
n:=qo(subtype(r));
temp_ptr:=list_ptr(box(n));
free_node(box(n),box_node_size);
box(n):=vpack(temp_ptr,natural);
@y
set_equiv(glue_base+split_top_skip_code,split_top_ptr(p));
ins_ptr(p):=prune_page_top(broken_ptr(r));
if ins_ptr(p)<>null then
begin temp_ptr:=vpack(ins_ptr(p),natural);
height(p):=height(temp_ptr)+depth(temp_ptr);
free_node(temp_ptr,box_node_size); wait:=true;
end;
end;
best_ins_ptr(r):=null;
n:=qo(subtype(r));
temp_ptr:=list_ptr(box(n));
free_node(box(n),box_node_size);
set_equiv(box_base+n,vpack(temp_ptr,natural));
@z
%---------------------------------------
@x [45] m.1023 l.19854 - Omega
ship_out(box(255)); box(255):=null;
@y
ship_out(box(255)); set_equiv(box_base+255,null);
@z
%---------------------------------------
@x [46] m.1046 l.20339 - Omega
non_math(math_given), non_math(math_comp), non_math(delim_num),
@y
non_math(math_given), non_math(omath_given),
non_math(math_comp), non_math(delim_num),
@z
%---------------------------------------
@x [47] m.1071 l.20718 - Omega
|box_flag+255| represent `\.{\\setbox0}' through `\.{\\setbox255}';
codes |box_flag+256| through |box_flag+511| represent `\.{\\global\\setbox0}'
through `\.{\\global\\setbox255}';
code |box_flag+512| represents `\.{\\shipout}'; and codes |box_flag+513|
through |box_flag+515| represent `\.{\\leaders}', `\.{\\cleaders}',
@y
|box_flag+biggest_reg| represent `\.{\\setbox0}' through
`\.{\\setbox}|biggest_reg|'; codes |box_flag+biggest_reg+1| through
|box_flag+2*biggest_reg| represent `\.{\\global\\setbox0}'
through `\.{\\global\\setbox}|biggest_reg|'; code |box_flag+2*number_regs|
represents `\.{\\shipout}'; and codes |box_flag+2*number_regs+1|
through |box_flag+2*number_regs+3| represent `\.{\\leaders}', `\.{\\cleaders}',
@z
%---------------------------------------
@x [47] m.1071 l.20732 - Omega
@d ship_out_flag==box_flag+512 {context code for `\.{\\shipout}'}
@d leader_flag==box_flag+513 {context code for `\.{\\leaders}'}
@y
@d ship_out_flag==box_flag+(number_regs+number_regs)
{context code for `\.{\\shipout}'}
@d leader_flag==ship_out_flag+1 {context code for `\.{\\leaders}'}
@z
%---------------------------------------
@x [47] m.1077 l.20853 - Omega
if box_context<box_flag+256 then
eq_define(box_base-box_flag+box_context,box_ref,cur_box)
else geq_define(box_base-box_flag-256+box_context,box_ref,cur_box)
@y
if box_context<box_flag+number_regs then
eq_define(box_base-box_flag+box_context,box_ref,cur_box)
else geq_define(box_base-box_flag-number_regs+box_context,box_ref,cur_box)
@z
%---------------------------------------
@x [47] m.1079 l.20888 - Omega
box(cur_val):=null; {the box becomes void, at the same level}
@y
set_equiv(box_base+cur_val,null);
{the box becomes void, at the same level}
@z
%---------------------------------------
@x [47] m.1100 l.21156 - Omega
if saved(0)<255 then
@y
if saved(0)<>255 then
@z
%---------------------------------------
@x [47] m.1109 l.21265 - Omega
@ The |un_hbox| and |un_vbox| commands unwrap one of the 256 current boxes.
@y
@ The |un_hbox| and |un_vbox| commands unwrap one of the current boxes.
@z
%---------------------------------------
@x [47] m.1110 l.21287 - Omega
else begin link(tail):=list_ptr(p); box(cur_val):=null;
@y
else begin link(tail):=list_ptr(p);
set_equiv(box_base+cur_val,null);
@z
%---------------------------------------
@x [47] m.1117 l.21342 - Omega
if c>=0 then if c<256 then pre_break(tail):=new_character(cur_font,c);
@y
if c>=0 then if c<=biggest_char then
pre_break(tail):=new_character(cur_font,c);
@z
%---------------------------------------
@x [48] m.1151 l.21810 - Omega
@ Recall that the |nucleus|, |subscr|, and |supscr| fields in a noad are
broken down into subfields called |math_type| and either |info| or
|(fam,character)|. The job of |scan_math| is to figure out what to place
in one of these principal fields; it looks at the subformula that
comes next in the input, and places an encoding of that subformula
into a given word of |mem|.
@d fam_in_range==((cur_fam>=0)and(cur_fam<16))
@<Declare act...@>=
procedure scan_math(@!p:pointer);
label restart,reswitch,exit;
var c:integer; {math character code}
begin restart:@<Get the next non-blank non-relax...@>;
reswitch:case cur_cmd of
letter,other_char,char_given: begin c:=ho(math_code(cur_chr));
if c=@'100000 then
begin @<Treat |cur_chr| as an active character@>;
goto restart;
end;
end;
char_num: begin scan_char_num; cur_chr:=cur_val; cur_cmd:=char_given;
goto reswitch;
end;
math_char_num: begin scan_fifteen_bit_int; c:=cur_val;
end;
math_given: c:=cur_chr;
delim_num: begin scan_twenty_seven_bit_int; c:=cur_val div @'10000;
end;
othercases @<Scan a subformula enclosed in braces and |return|@>
endcases;@/
math_type(p):=math_char; character(p):=qi(c mod 256);
if (c>=var_code)and fam_in_range then fam(p):=cur_fam
else fam(p):=(c div 256) mod 16;
exit:end;
@y
@ Recall that the |nucleus|, |subscr|, and |supscr| fields in a noad are
broken down into subfields called |math_type| and either |info| or
|(fam,character)|. The job of |scan_math| is to figure out what to place
in one of these principal fields; it looks at the subformula that
comes next in the input, and places an encoding of that subformula
into a given word of |mem|.
@d fam_in_range==((cur_fam>=0)and(cur_fam<16))
@<Declare act...@>=
@t\4@>@<Declare the function called |fin_mlist|@>@t@>@;@/
procedure scan_math(@!p:pointer);
label restart,reswitch,exit;
var c:integer; {math character code}
begin restart:@<Get the next non-blank non-relax...@>;
reswitch:
case cur_cmd of
letter,other_char,char_given: begin
c:=ho(math_code(cur_chr));
if c=@"8000000 then
begin @<Treat |cur_chr| as an active character@>;
goto restart;
end;
end;
char_num: begin scan_char_num; cur_chr:=cur_val; cur_cmd:=char_given;
goto reswitch;
end;
math_char_num: begin
if cur_chr=0 then scan_fifteen_bit_int
else scan_big_fifteen_bit_int;
c:=cur_val;
end;
math_given: begin
c := ((cur_chr div @"1000) * @"1000000) +
(((cur_chr mod @"1000) div @"100) * @"10000) +
(cur_chr mod @"100);
end;
omath_given: begin c:=cur_chr;
end;
delim_num: begin
if cur_chr=0 then scan_twenty_seven_bit_int
else scan_fifty_one_bit_int;
c:=cur_val;
end;
othercases @<Scan a subformula enclosed in braces and |return|@>
endcases;@/
math_type(p):=math_char; character(p):=qi(c mod @"10000);
if (c>=var_code)and fam_in_range then fam(p):=cur_fam
else fam(p):=(c div @"10000) mod @"100;
exit:end;
@z
%---------------------------------------
@x [48] m.1154 l.21860 - Omega
mmode+letter,mmode+other_char,mmode+char_given:
set_math_char(ho(math_code(cur_chr)));
mmode+char_num: begin scan_char_num; cur_chr:=cur_val;
set_math_char(ho(math_code(cur_chr)));
end;
mmode+math_char_num: begin scan_fifteen_bit_int; set_math_char(cur_val);
end;
mmode+math_given: set_math_char(cur_chr);
mmode+delim_num: begin scan_twenty_seven_bit_int;
set_math_char(cur_val div @'10000);
@y
mmode+letter,mmode+other_char,mmode+char_given:
set_math_char(ho(math_code(cur_chr)));
mmode+char_num: begin scan_char_num; cur_chr:=cur_val;
set_math_char(ho(math_code(cur_chr)));
end;
mmode+math_char_num: begin
if cur_chr=0 then scan_fifteen_bit_int
else scan_big_fifteen_bit_int;
set_math_char(cur_val);
end;
mmode+math_given: begin
set_math_char(((cur_chr div @"1000) * @"1000000) +
(((cur_chr mod @"1000) div @"100) * @"10000) +
(cur_chr mod @"100));
end;
mmode+omath_given: begin
set_math_char(cur_chr);
end;
mmode+delim_num: begin
if cur_chr=0 then scan_twenty_seven_bit_int
else scan_fifty_one_bit_int;
set_math_char(cur_val);
@z
%---------------------------------------
@x [48] m.1155 l.21878 - Omega
procedure set_math_char(@!c:integer);
var p:pointer; {the new noad}
begin if c>=@'100000 then
@<Treat |cur_chr|...@>
else begin p:=new_noad; math_type(nucleus(p)):=math_char;
character(nucleus(p)):=qi(c mod 256);
fam(nucleus(p)):=(c div 256) mod 16;
if c>=var_code then
begin if fam_in_range then fam(nucleus(p)):=cur_fam;
type(p):=ord_noad;
end
else type(p):=ord_noad+(c div @'10000);
link(tail):=p; tail:=p;
end;
end;
@y
procedure set_math_char(@!c:integer);
var p,q,r:pointer; {the new noad}
begin if c>=@"8000000 then
@<Treat |cur_chr|...@>
else begin p:=new_noad; math_type(nucleus(p)):=math_char;
character(nucleus(p)):=qi(c mod @"10000);
fam(nucleus(p)):=(c div @"10000) mod @"100;
if c>=var_code then
begin if fam_in_range then fam(nucleus(p)):=cur_fam;
type(p):=ord_noad;
end
else type(p):=ord_noad+(c div @"1000000);
link(tail):=p; tail:=p;
end;
end;
@z
%---------------------------------------
@x [48] m.1160 l.21966 - Omega
procedure scan_delimiter(@!p:pointer;@!r:boolean);
begin if r then scan_twenty_seven_bit_int
else begin @<Get the next non-blank non-relax...@>;
case cur_cmd of
letter,other_char: cur_val:=del_code(cur_chr);
delim_num: scan_twenty_seven_bit_int;
othercases cur_val:=-1
endcases;
end;
if cur_val<0 then @<Report that an invalid delimiter code is being changed
to null; set~|cur_val:=0|@>;
small_fam(p):=(cur_val div @'4000000) mod 16;
small_char(p):=qi((cur_val div @'10000) mod 256);
large_fam(p):=(cur_val div 256) mod 16;
large_char(p):=qi(cur_val mod 256);
@y
procedure scan_delimiter(@!p:pointer;@!r:integer);
begin if r=1 then scan_twenty_seven_bit_int
else if r=2 then scan_fifty_one_bit_int
else begin @<Get the next non-blank non-relax...@>;
case cur_cmd of
letter,other_char: begin
cur_val:=del_code0(cur_chr); cur_val1:=del_code1(cur_chr);
end;
delim_num: if cur_chr=0 then scan_twenty_seven_bit_int
else scan_fifty_one_bit_int;
othercases begin cur_val:=-1; cur_val1:=-1; end;
endcases;
end;
if cur_val<0 then begin @<Report that an invalid delimiter code is being changed
to null; set~|cur_val:=0|@>;
cur_val1:=0;
end;
small_fam(p):=(cur_val div @"10000) mod @"100;
small_char(p):=qi(cur_val mod @"10000);
large_fam(p):=(cur_val1 div @"10000) mod @"100;
large_char(p):=qi(cur_val1 mod @"10000);
@z
%---------------------------------------
@x [48] m.1163 l.22005 - Omega
scan_delimiter(left_delimiter(tail),true); scan_math(nucleus(tail));
@y
scan_delimiter(left_delimiter(tail),cur_chr+1); scan_math(nucleus(tail));
@z
%---------------------------------------
@x [48] m.1165 l.22012 - Omega
procedure math_ac;
begin if cur_cmd=accent then
@<Complain that the user should have said \.{\\mathaccent}@>;
tail_append(get_node(accent_noad_size));
type(tail):=accent_noad; subtype(tail):=normal;
mem[nucleus(tail)].hh:=empty_field;
mem[subscr(tail)].hh:=empty_field;
mem[supscr(tail)].hh:=empty_field;
math_type(accent_chr(tail)):=math_char;
scan_fifteen_bit_int;
character(accent_chr(tail)):=qi(cur_val mod 256);
if (cur_val>=var_code)and fam_in_range then fam(accent_chr(tail)):=cur_fam
else fam(accent_chr(tail)):=(cur_val div 256) mod 16;
scan_math(nucleus(tail));
end;
@y
procedure math_ac;
begin if cur_cmd=accent then
@<Complain that the user should have said \.{\\mathaccent}@>;
tail_append(get_node(accent_noad_size));
type(tail):=accent_noad; subtype(tail):=normal;
mem[nucleus(tail)].hh:=empty_field;
mem[subscr(tail)].hh:=empty_field;
mem[supscr(tail)].hh:=empty_field;
math_type(accent_chr(tail)):=math_char;
if cur_chr=0 then scan_fifteen_bit_int
else scan_big_fifteen_bit_int;
character(accent_chr(tail)):=qi(cur_val mod @"10000);
if (cur_val>=var_code)and fam_in_range then fam(accent_chr(tail)):=cur_fam
else fam(accent_chr(tail)):=(cur_val div @"10000) mod @"100;
scan_math(nucleus(tail));
end;
@z
%---------------------------------------
@x [48] m.1174 l.22085 - Omega
@t\4@>@<Declare the function called |fin_mlist|@>@t@>@;@/
@y
@z
%---------------------------------------
@x [48] m.1188 l.22284 - Omega
text(frozen_right):="right"; eqtb[frozen_right]:=eqtb[cur_val];
@y
settext(frozen_right,"right");
set_new_eqtb(frozen_right,new_eqtb(cur_val));
@z
%---------------------------------------
@x [49] m.1214 l.22700 - Omega
@d word_define(#)==if global then geq_word_define(#)@+else eq_word_define(#)
@y
@d word_define(#)==if global then geq_word_define(#)@+else eq_word_define(#)
@d del_word_define(#)==if global
then del_geq_word_define(#)@+else del_eq_word_define(#)
@z
%---------------------------------------
@x [49] m.1216 l.22734 - Omega
text(frozen_protection):="inaccessible";
@y
settext(frozen_protection,"inaccessible");
@z
%---------------------------------------
@x [49] m.1222 l.22789 - Omega
@d char_def_code=0 {|shorthand_def| for \.{\\chardef}}
@d math_char_def_code=1 {|shorthand_def| for \.{\\mathchardef}}
@d count_def_code=2 {|shorthand_def| for \.{\\countdef}}
@d dimen_def_code=3 {|shorthand_def| for \.{\\dimendef}}
@d skip_def_code=4 {|shorthand_def| for \.{\\skipdef}}
@d mu_skip_def_code=5 {|shorthand_def| for \.{\\muskipdef}}
@d toks_def_code=6 {|shorthand_def| for \.{\\toksdef}}
@<Put each...@>=
primitive("chardef",shorthand_def,char_def_code);@/
@!@:char_def_}{\.{\\chardef} primitive@>
primitive("mathchardef",shorthand_def,math_char_def_code);@/
@!@:math_char_def_}{\.{\\mathchardef} primitive@>
@y
@d char_def_code=0 {|shorthand_def| for \.{\\chardef}}
@d math_char_def_code=1 {|shorthand_def| for \.{\\mathchardef}}
@d omath_char_def_code=2 {|shorthand_def| for \.{\\omathchardef}}
@d count_def_code=3 {|shorthand_def| for \.{\\countdef}}
@d dimen_def_code=4 {|shorthand_def| for \.{\\dimendef}}
@d skip_def_code=5 {|shorthand_def| for \.{\\skipdef}}
@d mu_skip_def_code=6 {|shorthand_def| for \.{\\muskipdef}}
@d toks_def_code=7 {|shorthand_def| for \.{\\toksdef}}
@<Put each...@>=
primitive("chardef",shorthand_def,char_def_code);@/
@!@:char_def_}{\.{\\chardef} primitive@>
primitive("mathchardef",shorthand_def,math_char_def_code);@/
@!@:math_char_def_}{\.{\\mathchardef} primitive@>
primitive("omathchardef",shorthand_def,omath_char_def_code);@/
@!@:math_char_def_}{\.{\\omathchardef} primitive@>
@z
%---------------------------------------
@x [49] m.1224 l.22833 - Omega
shorthand_def: begin n:=cur_chr; get_r_token; p:=cur_cs; define(p,relax,256);
scan_optional_equals;
case n of
char_def_code: begin scan_char_num; define(p,char_given,cur_val);
end;
math_char_def_code: begin scan_fifteen_bit_int; define(p,math_given,cur_val);
end;
@y
shorthand_def: begin n:=cur_chr; get_r_token; p:=cur_cs;
define(p,relax,too_big_char); scan_optional_equals;
case n of
char_def_code: begin scan_char_num; define(p,char_given,cur_val);
end;
math_char_def_code: begin scan_real_fifteen_bit_int;
define(p,math_given,cur_val);
end;
omath_char_def_code: begin scan_big_fifteen_bit_int;
define(p,omath_given,cur_val);
end;
@z
%---------------------------------------
@x [49] m.1230 l. - Omega
primitive("mathcode",def_code,math_code_base);
@!@:math_code_}{\.{\\mathcode} primitive@>
primitive("lccode",def_code,lc_code_base);
@!@:lc_code_}{\.{\\lccode} primitive@>
primitive("uccode",def_code,uc_code_base);
@!@:uc_code_}{\.{\\uccode} primitive@>
primitive("sfcode",def_code,sf_code_base);
@!@:sf_code_}{\.{\\sfcode} primitive@>
primitive("delcode",def_code,del_code_base);
@!@:del_code_}{\.{\\delcode} primitive@>
@y
primitive("mathcode",def_code,math_code_base);
@!@:math_code_}{\.{\\mathcode} primitive@>
primitive("omathcode",def_code,math_code_base+256);
@!@:math_code_}{\.{\\omathcode} primitive@>
primitive("lccode",def_code,lc_code_base);
@!@:lc_code_}{\.{\\lccode} primitive@>
primitive("uccode",def_code,uc_code_base);
@!@:uc_code_}{\.{\\uccode} primitive@>
primitive("sfcode",def_code,sf_code_base);
@!@:sf_code_}{\.{\\sfcode} primitive@>
primitive("delcode",def_code,del_code_base);
@!@:del_code_}{\.{\\delcode} primitive@>
primitive("odelcode",def_code,del_code_base+256);
@!@:del_code_}{\.{\\odelcode} primitive@>
@z
%---------------------------------------
@x [49] m.1232 l.22990 - Omega
def_code: begin @<Let |n| be the largest legal code value, based on |cur_chr|@>;
p:=cur_chr; scan_char_num; p:=p+cur_val; scan_optional_equals;
scan_int;
if ((cur_val<0)and(p<del_code_base))or(cur_val>n) then
begin print_err("Invalid code ("); print_int(cur_val);
@.Invalid code@>
if p<del_code_base then print("), should be in the range 0..")
else print("), should be at most ");
print_int(n);
help1("I'm going to use 0 instead of that illegal code value.");@/
error; cur_val:=0;
end;
if p<math_code_base then define(p,data,cur_val)
else if p<del_code_base then define(p,data,hi(cur_val))
else word_define(p,cur_val);
@y
def_code: begin
if cur_chr=(del_code_base+256) then begin
p:=cur_chr-256; scan_char_num; p:=p+cur_val; scan_optional_equals;
scan_int; cur_val1:=cur_val; scan_int; {backwards}
if (cur_val1>@"FFFFFF) or (cur_val>@"FFFFFF) then
begin print_err("Invalid code ("); print_int(cur_val1); print(" ");
print_int(cur_val);
print("), should be at most ""FFFFFF ""FFFFFF");
help1("I'm going to use 0 instead of that illegal code value.");@/
error; cur_val1:=0; cur_val:=0;
end;
del_word_define(p,cur_val1,cur_val);
end
else begin
@<Let |n| be the largest legal code value, based on |cur_chr|@>;
p:=cur_chr; scan_char_num; p:=p+cur_val; scan_optional_equals;
scan_int;
if ((cur_val<0)and(p<del_code_base))or(cur_val>n) then
begin print_err("Invalid code ("); print_int(cur_val);
@.Invalid code@>
if p<del_code_base then print("), should be in the range 0..")
else print("), should be at most ");
print_int(n);
help1("I'm going to use 0 instead of that illegal code value.");@/
error; cur_val:=0;
end;
if p<math_code_base then define(p,data,cur_val)
else if p<(math_code_base+256) then begin
if cur_val=@"8000 then cur_val:=@"8000000
else cur_val:=((cur_val div @"1000) * @"1000000) +
(((cur_val mod @"1000) div @"100) * @"10000) +
(cur_val mod @"100);
define(p,data,hi(cur_val));
end
else if p<del_code_base then define(p-256,data,hi(cur_val))
else begin
cur_val1:=cur_val div @"1000;
cur_val1:=(cur_val1 div @"100)*@"10000 + (cur_val1 mod @"100);
cur_val:=cur_val mod @"1000;
cur_val:=(cur_val div @"100)*@"10000 + (cur_val mod @"100);
del_word_define(p,cur_val1,cur_val);
end;
end;
@z
%---------------------------------------
@x [49] m.1233 l.22990 - Omega
if cur_chr=cat_code_base then n:=max_char_code
else if cur_chr=math_code_base then n:=@'100000
else if cur_chr=sf_code_base then n:=@'77777
else if cur_chr=del_code_base then n:=@'77777777
else n:=255
@y
if cur_chr=cat_code_base then n:=max_char_code
else if cur_chr=math_code_base then n:=@'100000
else if cur_chr=(math_code_base+256) then n:=@"8000000
else if cur_chr=sf_code_base then n:=@'77777
else if cur_chr=del_code_base then n:=@'77777777
else n:=biggest_char
@z
%---------------------------------------
@x [49] m.1234 l.22990 - Omega
def_family: begin p:=cur_chr; scan_four_bit_int; p:=p+cur_val;
@y
def_family: begin p:=cur_chr; scan_big_four_bit_int; p:=p+cur_val;
@z
%---------------------------------------
@x [49] m.1238 l.23059 - Omega
if q=advance then cur_val:=cur_val+eqtb[l].int;
@y
if q=advance then cur_val:=cur_val+new_eqtb_int(l);
@z
%---------------------------------------
@x [49] m.1240 l.23086 - Omega
if p=int_val then cur_val:=mult_integers(eqtb[l].int,cur_val)
else cur_val:=nx_plus_y(eqtb[l].int,cur_val,0)
else cur_val:=x_over_n(eqtb[l].int,cur_val)
@y
if p=int_val then cur_val:=mult_integers(new_eqtb_int(l),cur_val)
else cur_val:=nx_plus_y(new_eqtb_int(l),cur_val,0)
else cur_val:=x_over_n(new_eqtb_int(l),cur_val)
@z
%---------------------------------------
@x [49] m.1241 l.23109 - Omega
if global then n:=256+cur_val@+else n:=cur_val;
@y
if global then n:=number_regs+cur_val@+else n:=cur_val;
@z
%---------------------------------------
@x [49] m.1289 l.23546 - Omega
|cs_token_flag+active_base| is a multiple of~256.
@y
|cs_token_flag+active_base| is a multiple of~|max_char_val|.
@z
%---------------------------------------
@x [49] m.1289 l.23552 - Omega
begin c:=t mod 256;
@y
begin c:=t mod max_char_val;
@z
%---------------------------------------
@x [50] m.1313 l.23892 - Omega
@<Dump regions 1 to 4 of |eqtb|@>;
@<Dump regions 5 and 6 of |eqtb|@>;
@y
dump_eqtb_table;
@z
%---------------------------------------
@x [50] m.1314 l.23904 - Omega
@<Undump regions 1 to 6 of |eqtb|@>;
@y
undump_eqtb_table;
@z
%---------------------------------------
@x [50] m.1315 l.23904 - Omega
@ The table of equivalents usually contains repeated information, so we dump it
in compressed form: The sequence of $n+2$ values $(n,x_1,\ldots,x_n,m)$ in the
format file represents $n+m$ consecutive entries of |eqtb|, with |m| extra
copies of $x_n$, namely $(x_1,\ldots,x_n,x_n,\ldots,x_n)$.
@<Dump regions 1 to 4 of |eqtb|@>=
k:=active_base;
repeat j:=k;
while j<int_base-1 do
begin if (equiv(j)=equiv(j+1))and(eq_type(j)=eq_type(j+1))and@|
(eq_level(j)=eq_level(j+1)) then goto found1;
incr(j);
end;
l:=int_base; goto done1; {|j=int_base-1|}
found1: incr(j); l:=j;
while j<int_base-1 do
begin if (equiv(j)<>equiv(j+1))or(eq_type(j)<>eq_type(j+1))or@|
(eq_level(j)<>eq_level(j+1)) then goto done1;
incr(j);
end;
done1:dump_int(l-k);
while k<l do
begin dump_wd(eqtb[k]); incr(k);
end;
k:=j+1; dump_int(k-l);
until k=int_base
@ @<Dump regions 5 and 6 of |eqtb|@>=
repeat j:=k;
while j<eqtb_size do
begin if eqtb[j].int=eqtb[j+1].int then goto found2;
incr(j);
end;
l:=eqtb_size+1; goto done2; {|j=eqtb_size|}
found2: incr(j); l:=j;
while j<eqtb_size do
begin if eqtb[j].int<>eqtb[j+1].int then goto done2;
incr(j);
end;
done2:dump_int(l-k);
while k<l do
begin dump_wd(eqtb[k]); incr(k);
end;
k:=j+1; dump_int(k-l);
until k>eqtb_size
@ @<Undump regions 1 to 6 of |eqtb|@>=
k:=active_base;
repeat undump_int(x);
if (x<1)or(k+x>eqtb_size+1) then goto bad_fmt;
for j:=k to k+x-1 do undump_wd(eqtb[j]);
k:=k+x;
undump_int(x);
if (x<0)or(k+x>eqtb_size+1) then goto bad_fmt;
for j:=k to k+x-1 do eqtb[j]:=eqtb[k-1];
k:=k+x;
until k>eqtb_size
@y
@z
%---------------------------------------
@x [50] m.1318 l.23967 - Omega
@<Dump the hash table@>=
dump_int(hash_used); cs_count:=frozen_control_sequence-1-hash_used;
for p:=hash_base to hash_used do if text(p)<>0 then
begin dump_int(p); dump_hh(hash[p]); incr(cs_count);
end;
for p:=hash_used+1 to undefined_control_sequence-1 do dump_hh(hash[p]);
dump_int(cs_count);@/
print_ln; print_int(cs_count); print(" multiletter control sequences")
@y
@<Dump the hash table@>=
dump_int(hash_used);
@z
%---------------------------------------
@x [50] m.1319 l.23976 - Omega
undump(hash_base)(frozen_control_sequence)(hash_used); p:=hash_base-1;
repeat undump(p+1)(hash_used)(p); undump_hh(hash[p]);
until p=hash_used;
for p:=hash_used+1 to undefined_control_sequence-1 do undump_hh(hash[p]);
undump_int(cs_count)
@y
undump(hash_base)(frozen_control_sequence)(hash_used);
@z
%---------------------------------------
@x [50] m.1324 l.24066 - Omega
for k:=0 to trie_max do dump_hh(trie[k]);
@y
for k:=0 to trie_max do dump_hh(trie[k]);
dump_int(max_hyph_char);
@z
%---------------------------------------
@x [50] m.1324 l.24078 - Omega
for k:=255 downto 0 do if trie_used[k]>min_quarterword then
@y
for k:=biggest_lang downto 0 do if trie_used[k]>min_quarterword then
@z
%---------------------------------------
@x [50] m.1325 l.24094 - Omega
for k:=0 to j do undump_hh(trie[k]);
@y
for k:=0 to j do undump_hh(trie[k]);
undump_int(max_hyph_char);
@z
%---------------------------------------
@x [50] m.1325 l.24101 - Omega
init for k:=0 to 255 do trie_used[k]:=min_quarterword;@+tini@;@/
k:=256;
@y
init for k:=0 to biggest_lang do trie_used[k]:=min_quarterword;@+tini@;@/
k:=biggest_lang+1;
@z
%---------------------------------------
@x [50] m.1326 l.24100 - Omega
dump_int(interaction); dump_int(format_ident); dump_int(69069);
tracing_stats:=0
@y
dump_int(interaction); dump_int(format_ident); dump_int(69069);
set_new_eqtb_int(int_base+tracing_stats_code,0)
@z
%---------------------------------------
@x [53] m.1341 l.24506 - Omega
@d what_lang(#)==link(#+1) {language number, in the range |0..255|}
@y
@d what_lang(#)==link(#+1) {language number, in the range |0..biggest_lang|}
@z
%---------------------------------------
@x [53] m.1370
@!write_file:array[0..15] of alpha_file;
@y
@!outside_string_array: array[0..1000] of 0..255;
@!write_file:array[0..15] of alpha_file;
@z
%---------------------------------------
@x [53] m. l.24761 - Omega
text(end_write):="endwrite"; eq_level(end_write):=level_one;
eq_type(end_write):=outer_call; equiv(end_write):=null;
@y
settext(end_write,"endwrite"); set_eq_level(end_write,level_one);
set_eq_type(end_write,outer_call); set_equiv(end_write,null);
@z
%---------------------------------------
@x [53] m.1376 l.24878 - Omega
else if language>255 then l:=0
@y
else if language>biggest_lang then l:=0
@z
%---------------------------------------
@x [53] m.1377 l.24893 - Omega
else if cur_val>255 then clang:=0
@y
else if cur_val>biggest_lang then clang:=0
@z
%---------------------------------------
@x [54]
This section should be replaced, if necessary, by any special
modifications of the program
that are necessary to make \TeX\ work at a particular installation.
It is usually best to design your change file so that all changes to
previous sections preserve the section numbering; then everybody's version
will be consistent with the published program. More extensive changes,
which introduce new sections, can be inserted here; then only the index
itself will get a new section number.
@^system dependencies@>
@y
@* \[54] $\Omega$ changes.
@z
%---------------------------------------
|