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
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
|
\font\twelvept=cmbx12
\font\tentex=cmr10
\def\topofcontents{\null\vfill\eject
\def\titlepage{T}
\centerline{{\twelvept The \TeX 8600 Driver}}
\vskip15pt
\centerline{Version 2.2, June 1988}
\hbox{\vbox{\hsize\the\hsize This work is
protected as an unpublished work under U.S. copyright laws.
Copyright $\copyright$ 1986 by WSUCSC. All rights Reserved.}}
\vskip18pt
\hbox{\vbox{\hsize\the\hsize This software is furnished under a
license for
use only on a single computer system and may be copied only
with the inclusion of the above copyright notice.
This software, or any other copies
thereof, may not be provided or otherwise made available to any
other person except for use on such system and to one who agrees to
these license terms. Title to and ownership of the software shall
at all times remain in WSUCSC.}}
\vfill}
@* Introduction.
This program takes a \TeX\ DVI file and converts it into CG 8600
Universal Slave Mode commands. Five bytes have been added to each
record. These five bytes are stripped off by the Datum 5095 tape
drive as it passes the file onto the 8600.
The \TeX 8600 program is written in WEB. You will need the TANGLE
and WEAVE programs to make changes. The WEB code was written
originally for IBM Pascal/VS on VM/CMS.
If you have a CG font that is not one of the ones on the \TeX 8600
distribution tape, you need to modify the SAMPLE.FONTINFO file for
that font and process it through FONTTEX.
@ Following are a few macros and definitions used throughout program:
@d incr(#) == # := # + 1
@d decr(#) == # := # - 1
@d do_nothing == begin; end
@d ccat==@=||@>
@f static == var
@f value == var
@ The beginning of the program.
@p program tex8600(dumpout,sysprint,addrline,setfile,cgfonts,infofile);
const
@<Global Constants@>@/
type
@<Global Types@>@/
var
@<Global Variables@>@/
static@/
@!com_table :packed array[0..18] of string(7);@/
value@/
com_table[0] := 'HDR'; {Header Record}@/
com_table[1] := 'CHWIDTH';{Character Width}@/
com_table[2] := 'RT'; {Reverse Type}@/
com_table[3] := 'PS'; {Point Size}@/
com_table[4] := 'SS'; {Set Size}@/
com_table[5] := 'VMF'; {Vertical Move Forward}@/
com_table[6] := 'VMR'; {Vertical Move Reverse}@/
com_table[7] := 'RW'; {Rule Width}@/
com_table[8] := 'RD'; {Rule Depth}@/
com_table[9] := 'IR'; {Insert Rule}@/
com_table[10] := 'SL'; {Slant Mode}@/
com_table[11] := 'RTWT'; {Reverse Type Window Top}@/
com_table[12] := 'RTWB'; {Reverse Type Window Bottom}@/
com_table[13] := 'AU'; {Auxiliary Character Set}@/
com_table[14] := 'F'; {Change Fonts}@/
com_table[15] := 'HMR'; {Horizontal Move Right}@/
com_table[16] := 'HML'; {Horizontal Move Left}@/
com_table[17] := 'TTS'; {8600 character, in decimal}@/
com_table[18] := 'MAXCMD';@/
@<CMS Includes@>
@ This is a collection of arrays for converting ASCII to EBCDIC.
@<CMS Includes@>=
@{This is a very long comment. It is designed to force a break@}
%include pasclib(asciicvt);
@ This is a collection of arrays for converting ASCII to EBCDIC.
@<CMS Includes@>=
@{This is a very long comment. It is designed to force a break@}
%include cms;
@{This is a very long comment. It is designed to force a break@}
@* Beginning section.
This section includes some basic functions for reading the DVI file
as well as a couple of procedures, like error and allcaps. Nothing
tricky or noteworthy in these.
@<Global Variables@>=
@!count : integer;
@!fileend :boolean;
@ The function for reading a byte of information from the DVI file.
@p function getbyte:integer;
var c :integer;
byte :char;
begin
read(byte);
getbyte := ord(byte);
c := count mod pv_dvi_lrecl;
if (c=(pv_dvi_lrecl-1)) and not (eof(input))
then get(input)
else if (c=(pv_dvi_lrecl-1)) and eof(input)
then fileend:=true;
end;
@ This is necessary because tangle doesn't let us get away with
using RETCODE by itself in more than one spot.
@p procedure setretcode(rc:integer);
begin retcode(rc); end;
@ This converts the byte to an integer, for further evaluation by
the program.
@p function readinteger(length :integer):integer;
var
inx :integer;
int :integer;
begin
if (length<1) or (length>4)
then begin;
trace(output);
halt;
end;
int:=0;
for inx := 1 to length do begin
int := int * 256 + getbyte;
{check for cvt to negative...}
if (inx = 1) and (length > 1) and (int >= 128)
then int := int - 256;
incr(count);
end;
readinteger := int;
end; {readinteger}
@ This function receives an integer value and converts it to its
hex value and returns that value as a string.
@^system dependencies@>
@p function hex(int :integer) :string(2);
var
i :integer;
j :integer;
stri :string(2);
static
hexarray :array[0..15] of string(1);
value
hexarray[0] := '0';
hexarray[1] := '1';
hexarray[2] := '2';@/
hexarray[3] := '3';
hexarray[4] := '4';
hexarray[5] := '5';@/
hexarray[6] := '6';
hexarray[7] := '7';
hexarray[8] := '8';@/
hexarray[9] := '9';
hexarray[10] := 'A';
hexarray[11] := 'B';@/
hexarray[12] := 'C';
hexarray[13] := 'D';
hexarray[14] := 'E';
hexarray[15] := 'F';
begin
stri := '';
i := int;
if i >= 16
then begin
j := i div 16;
stri := hexarray[j];
i := i - (j * 16);
end
else stri := '0';
stri := stri ccat hexarray[i];@/
hex := stri;
end;
@
@<Global Variables@>=
@! savecount :integer;
@^system dependencies@>
@! filename :string(8);
@^system dependencies@>
@! errstr :string(256);
@ The error procedure. When a byte is read that does not jive with
what the program was expecting, it goes to this procedure with a
return code of some kind and an appropriate message is printed to user.
@p procedure error(number :integer;
critical:boolean;
intval :integer);
begin
case number of
1 :writeln('Error in file ',filename,', no header record');
2 :writeln('Error in file ',filename,', the highest 8600 ',
'command has a value of ',ord(MAXCMD):3,' but ',
intval,' was read instead');
3 :writeln('Expected a font command and got "',
com_table[intval],'" instead');
4 :writeln('Expected a character width definition and got "',
com_table[intval],'" instead in file ',filename);
5 :writeln('File ',filename,' is out of order for character ',
intval:3,' (',chrx[intval],')');
6 :writeln('Error in file ',filename,', the value of byte ',
intval,' is >= 218 and <= 255 at byte ',savecount);
7 :writeln('Expected a Slantmode command and got ',
com_table[intval],' instead');
10 :writeln('No address information given');
28 :writeln('Unidentified input option "',errstr,'"');
otherwise writeln('Unidentified error ',number);
end; {case}
if critical then begin
writeln('TeX8600 run aborted; See your consultant');
trace(output);
halt;
end;
writeln('Tape will not be sent to operator');
setretcode(32);
end; {error}
@ Finally, a function that will convert whatever is passed to it into
all capital letters. It translates lower case letters into upper case
letters. All other characters outside of the range
a$<$=character$<$=z are returned as their original value.
@^system dependencies@>
@p function allcaps(instring :string(40)) :string(40);
var
i :integer;
character :char;
buildit :string(40);
static@/
chtable :packed array['81'xc..'e9'xc] of char;@/
value@/
chtable['81'xc] := 'A';
chtable['82'xc] := 'B';
chtable['83'xc] := 'C';
chtable['84'xc] := 'D';@/
chtable['85'xc] := 'E';
chtable['86'xc] := 'F';
chtable['87'xc] := 'G';
chtable['88'xc] := 'H';@/
chtable['89'xc] := 'I';
chtable['91'xc] := 'J';
chtable['92'xc] := 'K';
chtable['93'xc] := 'L';@/
chtable['94'xc] := 'M';
chtable['95'xc] := 'N';
chtable['96'xc] := 'O';
chtable['97'xc] := 'P';@/
chtable['98'xc] := 'Q';
chtable['99'xc] := 'R';
chtable['a2'xc] := 'S';
chtable['a3'xc] := 'T';@/
chtable['a4'xc] := 'U';
chtable['a5'xc] := 'V';
chtable['a6'xc] := 'W';@/
chtable['a7'xc] := 'X';
chtable['a8'xc] := 'Y';
chtable['a9'xc] := 'Z';
begin
buildit := '';
for i := 1 to length(instring) do begin
readstr(substr(instring,i,1),character);
if character in ['a'..'z']
then buildit := buildit ccat str(chtable[character])
else buildit := buildit ccat str(character);
end;
allcaps := buildit;
end;
@* Font Related Procedures.
This first font procedure reads the font matrix information for the
current font from an outside file called cginfo defined as cgfonts.
@<Global Constants@>=
@! maxfunctions = 15;@/
@! maxChar=127;@/
@! fatal = true;@/
@! fontsperrun = 76;@/
@! maxFont=256;@/
@
@<Global Types@>=
@! oneoftwo = packed 1..2;
command = (HDR,CHWIDTH,RT,PS,SS,VMF,VMR,RW,RD,IR,SL,
RTWT,RTWB,AU,F,HMR,HML,TTS,MAXCMD);@/
@! storerec = packed record
comcode :packed -128..127;
case oneoftwo of
1 :(argument :integer);
2 :(real_argument :shortreal);
end;
@! charrec = packed record
num :-1..maxfunctions;
charwidth :shortreal;
comarray :packed array[0..maxfunctions] of storerec;
end;
@! driverrec = record
cmd :integer;
case oneoftwo of
1 :(param :shortreal);
2 :(code :integer);
end;
@! font_def = packed record
pointsize : 0..255;
designsize : 0..255;
fontindex : 0..255;
end;
@^system dependencies@>
@! fontrec = record
fontno8600 : 0..2550;
name : string(8);
a8600chars : packed array[0..maxChar] of charrec;
end;
@
@<Global Variables@>=
@!currfont : -1..maxFont;
@!a8600fontrec : packed array[1..fontsperrun] of fontrec;
@!fontcode : driverrec;
@^system dependencies@>
@!fontname : string(8);
@!dumpin : boolean;
@!fontenviron : packed array[-1..maxFont] of font_def;
@ A new font is being used so it must have its font metrics read; this
procedure does just that.
@p procedure readfontinfo(fontnum,a8600index:integer);
var
auxiliary :boolean;
cgfonts :file of driverrec;
changefont :boolean;
charmult :shortreal;
i,j,rc,
numcommands :integer;
begin
@<open cginfo file@>
@<read beginning info@>
@<read character info@>
@<close cginfo file@>
end;
@ First open the cginfo file
@<open cginfo file@>=
fontenviron[fontnum].fontindex := a8600index;
a8600fontrec[a8600index].name:= fontname;
cms('ESTATE 'ccat fontname ccat ' CGINFO *',rc);
if rc = 0
then reset(cgfonts,'NAME=' ccat fontname ccat '.CGINFO.*')
else begin
reset(cgfonts,'NAME=ETR.CGINFO.*');
writeln('Error!! Font ',fontname,' is not on the 8600');
writeln('You will not be able to continue');
setretcode(8);
end;
@ Now read the first few records that give overall font info.
@<read beginning info@>=
fontcode := cgfonts@@;{Read the first record of the file}
get(cgfonts);@/
with fontcode do begin
if cmd <> ord(HDR) then error(1,fatal,0);
if code <> ord(MAXCMD) then error(2,fatal,code);
end; {with..begin}
fontcode := cgfonts@@; {read the second record of the file}
get(cgfonts);@/
with fontcode do begin
if cmd <> ord(F) then error(3,fatal,cmd); {Must be font cmnd}
a8600fontrec[a8600index].fontno8600 := code;
end; {with..begin}
fontcode := cgfonts@@;
get(cgfonts);
with fontcode do begin
if cmd <> ord(CHWIDTH) then error(4,fatal,cmd); {charac mult}
charmult := param;
end; {with..begin}
{Each character (maxChar) has one header record (HDR)
and one character width record. The number of records
for each character that follows the width record is
contained as "code" in the header record. Each
character will have at least one record.}
fontcode := cgfonts@@; {slantmode option no longer used}
get(cgfonts);
with fontcode do begin
if cmd <> ord(SL) then error(7,fatal,cmd);
end;
if dumpin
then with a8600fontrec[fontenviron[fontnum].fontindex]
do begin
writeln(dumpout,
' The character width multiplier for ',
filename,' is ',charmult:5:2);
writeln(dumpout,
' The 8600 font number is ',fontno8600:3);
end;
@ The individual character heights, depths, widths and positions
come next.
@<read character info@>=
for i := 0 to maxChar do begin
with a8600fontrec[a8600index].a8600chars[i]
do begin
fontcode := cgfonts@@;
get(cgfonts);
with fontcode do begin
if cmd <> ord(HDR) then error(5,fatal,i);
numcommands := code; {number for this character}
end; {with..begin}
num := -1;
@<read character width@>
auxiliary := false;
changefont := false;
for j := 0 to numcommands do begin
@<read next command@>
end;
if auxiliary then begin
@<Auxiliary change@>
end;
if changefont then begin
@<Font change@>
end;
end;
end;
@ Font is all read and safely tucked into appropriate places to
be used later, so close the door and shut off the lights on the
way out.
@<close cginfo file@>=
close(cgfonts);
@
@<read character width@>=
fontcode := cgfonts@@; {read the character width}
get(cgfonts);
with fontcode do begin
if cmd <> ord(CHWIDTH) then error(5,fatal,i);
charwidth := param * charmult;
end; {with..begin}
@
@<read next command@>=
fontcode := cgfonts@@;
get(cgfonts);
num := num + 1; {increment number of commands}
with fontcode, comarray[num] do begin
if ((cmd >= 5) and (cmd <= 8)) or
(cmd = 11) or (cmd = 12) or (cmd = 16)
then real_argument := param
else argument := code;
case cmd of
2 :comcode := 3; {reverse type}
3 :comcode := 7; {Point Size Change}
4 :comcode := 8; {Set Size Change}
5 :comcode := 9; {Vertical Move Forward}
6 :comcode := 10; {Vertical Move Reverse}
7 :comcode := 12; {Rule Width}
8 :comcode := 13; {Rule Depth}
9 :comcode := 14; {Insert Rule}
10 :comcode := 15; {Slant Mode}
11 :comcode := 16; {Reverse Window Top}
12 :comcode := 17; {Reverse Window Bot}
13 :begin
@<Change to Auxiliary Characters@>
end;
14 :begin
@<Change Font@>
end;
15 :comcode := 27; {Horiz. Move Right}
16 :comcode := 28; {Horiz. Move Left}
17 :comcode := -1; {Decimal Char Code}
otherwise begin
@<Invalid Command Number@>
end;
end;
end;
@
@<Auxiliary change@>=
num := num + 1;
with comarray[num] do begin
comcode := 20;
argument := 1;
end;
@
@<Font change@>=
num := num + 1;
with comarray[num] do begin
comcode := 25;
argument := -1; {for quick ID in font changes}
end;
@
@<Change to Auxiliary Characters@>=
comcode := 20;
if auxiliary
then begin
argument := 1;
auxiliary := false;
end
else begin
argument := 2;
auxiliary := true;
end;
@
@<Change Font@>=
comcode := 25;
if code <> fontnum
then changefont := true;
argument := code * 10;
@
@<Invalid Command Number@>=
writeln('Invalid 8600 Command Number ', cmd);
error(5,fatal,cmd);
@ This procedure checks to see if the current font has been
previously defined. If it has, it returns to the main program,
if it hasn't, |readfontinfo| is called.
@p procedure checkfont;
var
i :integer;
static
in_count :integer;
value
in_count := 0;
begin
@<check fonts@>
readfontinfo(currfont,in_count);
end;
@ Each time a font is encountered in the DVI file, one is added to
the |in_count|. The following section checks to see if the |curr_font|
has ever been used before in this file. If it has, nothing is done and
it returns to main program. If it is a new file, it continues on in
procedure to read the new font metrics.
@<check fonts@>=
incr(in_count);
for i := 1 to in_count do begin
if a8600fontrec[i].name = fontname
then begin
fontenviron[currfont].fontindex := i;
return;
end;
end;
@ This procedure reads the DVI file to get all pertinent information
for the |MAIN| program.
@<Global Constants@>=
@! SPsPerPt = 65536;@/
@! pc_dvi_lrecl=1024;
@
@<Global Variables@>=
@!checksumtest : integer;
@!pv_dvi_lrecl :integer;
@
@p procedure fontinfo;
var
fnlength : integer;
temp : integer;
temp2 : integer;
inx : integer;
begin
with fontenviron[currfont] do begin
checksumtest := readinteger(4);{check sum}
temp := readinteger(4);{scale}
temp2:= readinteger(4);{design size}
pointsize := temp2 * (temp div temp2) div SPsPerPt;
designsize := temp2 div SPsPerPt;
end; {WITH..begin}
temp := readinteger(1);{font name area}
fnlength := readinteger(1);{file length}
fnlength := fnlength + temp;
fontname := '';
for inx := 1 to fnlength do begin
temp := readinteger(1);
fontname := fontname ccat allcaps(str(chrx[temp]));
end;
checkfont;
end;
@* Tape-writing functions and procedures.
These next few functions and procedures prepare or write information
to a tape file
@ This function converts an integer to a string or something like that
@^system dependencies@>
@p function strconv(intnum : integer): string(5);
var
hdrec :string(5);
j :integer;
k10 :integer;
temphdr :integer;
begin
hdrec := '';
k10 := 10000;
temphdr := intnum;
repeat
if temphdr >= k10 then begin
j := temphdr div k10;
hdrec := hdrec ccat str(chr(j + ord('0')));
temphdr := temphdr - (j * k10);
end;
k10 := k10 div 10;
until k10 = 1;
hdrec := hdrec ccat str(chr(temphdr + ord('0')));
if length(hdrec) < 5
then hdrec := substr('00000',1,5-length(hdrec)) ccat hdrec;
strconv := hdrec;
end;
@ This procedure is to add the 5 bytes at the beginning
of each record that will be read by the 5095 tape
drive. It should be noted that these 5 bytes are
discarded by the 5095 before it sends the rest of the record to the 8600.
@<Global Constants@>=
@! maxbuffer = 1029;@/
@
@<Global Variables@>=
@!doingpages : boolean;
@!setfile : text;
@!dumpout : text;
@!bufferlen : 0..maxbuffer;
@!headernum : integer;
@
@p procedure writeheader; {only needed when using Datum 5095}
var
hdrec :string(5);
begin
if doingpages = true
then begin
hdrec := strconv(headernum);
write(setfile,hdrec);
bufferlen := 5;
end; {then..begin}
end; {writeheader}
@
@<Global Constants@>=
@! allzeros = '00'xc;@/
@
@<Global Variables@>=
@!postam_found : boolean;
@ This procedure is used to write the tape file for the 5095
drive on the 8600
@p @^system dependencies@>
procedure write8600rec(codes :string(17));
var
i :integer;
codesize :integer;
begin
codesize := length(codes);
if doingpages=true
then begin
if bufferlen + codesize < maxbuffer
then begin
@<record length less than maximum@>
end {then..begin}
else if bufferlen + codesize = maxbuffer
then begin
@<record length equal to maximum@>
end {then..begin}
else begin
@<record length greater than maximum@>
end; {else..begin}
end; {then..begin}
end; {write8600rec}
@
@<record length less than maximum@>=
write(setfile,codes);
bufferlen := bufferlen + codesize;
if postam_found then begin
while bufferlen < maxbuffer do begin
write(setfile,allzeros);
codesize := length(allzeros);
bufferlen := bufferlen + codesize;
end; {while..begin}
end; {then..begin}
@
@<record length equal to maximum@>=
writeln(setfile,codes);
if not postam_found then writeheader;
@
@<record length greater than maximum@>=
i := maxbuffer - bufferlen;
writeln(setfile,substr(codes,1,i));
writeheader;
write(setfile,substr(codes,i+1,codesize-i));
bufferlen := bufferlen + codesize - i;
if postam_found then begin
while bufferlen < maxbuffer do begin
write(setfile,allzeros);
codesize := length(allzeros);
bufferlen := bufferlen + codesize;
end; {while..begin}
end; {then..begin}
@
@<Global Variables@>=
@!print_hmove : boolean;
@ This function,
given amount in scale points, converts it to floating-point
points and print it.
@p function getpts(amt :integer) :real;
var
temp :real;
begin
temp := float(amt) / SPsPerPt;
if dumpin and print_hmove then write(dumpout,temp:4:1,' pts.');
getpts := temp;
end;
@* Main tape-writing procedures.
These next few procedures are the main ones for writing information
to the tape file.
@
@<Global Constants@>=
@! high1 = '8000'@&x;@/
@! SPsPer8th = 8192;@/
@! SPsPer18th = 3640.8888;@/
@
@<Global Type...@>=
@! valrec = packed record case oneoftwo of
1 :(hexcode :char;
argument :packed -32768..32767);
2 :(byte1 :packed 0..255;
byte2 :packed 0..255;
byte3 :packed 0..255)
end;
@! stackrec = packed record
H :integer;
V :integer;
W :integer;
X :integer;
Y :integer;
Z :integer;
end;
@
@<Global Variables@>=
@!stack : packed array[1..50] of stackrec;
@!stacktop : integer;
@!outrec : valrec;
@!in_reverse_type : boolean;
@!in_slant_mode : boolean;
@ This procedure is called to format the output record
in a 1 or 3 byte word to be added to the 8600 output
record buffer. Each command used by the slave mode
is represented here by their appropriate code number
assigned by Compugraphics. The code "-1" was not
assigned by them. It was assigned to denote the use
of a character in the current font.
@p @^system dependencies@>
procedure writecommand(codenum :integer;
inargument :real);
var
temp :string(3);
realtemp :real;
begin
with outrec do begin
case codenum of
-2 :@<long character form@>@/
-1 :@<individual character code@>@/
0 :@<start of take@>@/
1 :@<end of take@>@/
2 :@<change reverse type@>@/
7 :@<change point size@>@/
8 :@<change set size@>@/
9 :@<forward vertical move@>@/
10 :@<reverse vertical move@>@/
11 :@<absolute horizontal positioning@>@/
12 :@<rule width@>@/
13 :@<rule depth@>@/
14 :@<insert rule@>@/
15 :@<slant mode@>@/
16 :@<reverse type window top@>@/
17 :@<reverse type window bottom@>@/
20 :@<change auxiliary character set@>@/
25 :@<change fonts@>@/
27 :@<right horizontal move@>@/
28 :@<left horizontal move@>@/
otherwise @<all other cases@>
end; {case}
byte2 := byte2 + '10000000'B;
temp := str(chr(byte1)) ccat
str(chr(byte2)) ccat str(chr(byte3));
write8600rec(temp);
end; {with..begin}
end; {writecommand}
@
@<long character...@>=
begin
hexcode := chr(trunc(inargument)+high1);
argument := round(getpts(stack[stacktop].H) * 18);
temp := str(chr(byte1)) ccat str(chr(byte2));
temp := temp ccat str(chr(byte3));
write8600rec(temp);
return;
end;
@
@<individual character code@>=
begin
{change inargument into a one character
string (hex) value}
argument := trunc(inargument);
write8600rec(str(chr(byte3)));
return;
end;
@
@<start of take@>=
begin
hexcode := '80'xc;
argument := trunc(inargument);
end;
@
@<end of take@>=
begin
hexcode := '81'xc;
argument := trunc(inargument);
end;
@
@<change reverse type@>=
begin
if not in_reverse_type and (inargument = 0)
then return; {8600 warning if you try to
turn it off when its already off}
if inargument = 0
then in_reverse_type := false
else in_reverse_type := true;
if in_reverse_type then begin
realtemp := {76\% of the current leading}
(fontenviron[currfont].pointsize + 2)*0.76;
writecommand(16,realtemp); {window top}
realtemp := {30\% of the current leading}
(fontenviron[currfont].pointsize + 2)*0.30;
writecommand(17,realtemp); {window bottom}
end; {then..begin}
hexcode := '83'xc;
argument := trunc(inargument);
end;
@
@<change point size@>=
begin
hexcode := '87'xc;
argument := round(inargument*2) * 4; {in eighths}
end;
@
@<change set size@>=
begin
hexcode := '88'xc;
argument := round((fontenviron[currfont].pointsize*
(inargument/100.0)) * 2) * 4; {in eighths}
end;
@
@<forward vertical move@>=
begin
if inargument = 0 then return; {0 invalid on 8600}
hexcode := '89'xc;
{in sixteenths}
argument := round(inargument / SPsPer8th) * 2;
end;
@
@<reverse vertical move@>=
begin
if inargument = 0 then return; {0 invalid on 8600}
hexcode := '8a'xc;
{in sixteenths}
argument := round(inargument / SPsPer8th) * 2;
end;
@
@<absolute horizontal positioning@>=
begin
hexcode := '8b'xc;
{eighteenths}
if inargument < -72.27 then begin
if dumpin then writeln(dumpout,
' HP less than zero');
inargument := 0;
end;
argument := round(inargument / SPsPer18th);
end;
@
@<rule width@>=
begin
if inargument = 0 then return; {0 invalid on 8600}
hexcode := '8c'xc;
argument := round(inargument * 18);
end;
@
@<rule depth@>=
begin
if inargument = 0 then return; {0 invalid on 8600}
hexcode := '8d'xc;
argument := round(inargument * 8) * 2;
end;
@
@<insert rule@>=
begin
hexcode := '8e'xc;
if inargument < 0 then begin
if dumpin then writeln(dumpout,
' IR less than zero');
inargument := 0;
end;
argument := round(inargument / SPsPer18th);
end;
@
@<slant mode@>=
begin
hexcode := '8f'xc;
argument := trunc(inargument);
if argument = 0
then in_slant_mode := false
else in_slant_mode := true;
end;
@
@<reverse type window top@>=
begin
hexcode := '90'xc;
argument := round(inargument*8) * 2; {in sixteenths}
end;
@
@<reverse type window bottom@>=
begin
hexcode := '91'xc;
argument := round(inargument*8) * 2; {in sixteenths}
end;
@
@<change auxiliary character set@>=
begin
hexcode := '94'xc;
argument := trunc(inargument);
end;
@
@<change fonts@>=
begin
hexcode := '99'xc;
argument := trunc(inargument);
end;
@
@<right horizontal move@>=
begin
if inargument = 0 then return; {if no move}
hexcode := '9b'xc;
{eighteenths}
argument := round(inargument / SPsPer18th);
end;
@
@<left horizontal move@>=
begin
if inargument = 0 then return; {if no move}
hexcode := '9c'xc;
{eighteenths}
argument := round(inargument / SPsPer18th);
end;
@
@<all other cases@>=
begin
writeln('Invalid 8600 command code = ',codenum);
error(5,fatal,codenum);
end; {otherwise}
@* Billing and identification information procedures.
@ The first procedure is the one that writes out all the resource-type
information. It first checks to see if the character it is about to
write out is one of several special characters, if it is the hex code
is changed.
@^system dependencies@>
@p procedure writeinfo(info:string(30));
var
inx : integer;
begin
for inx := 1 to length(info)
do begin
if info[inx] = ' '
then write8600rec('1F'xc)
else if info[inx] = '('
then write8600rec('3A'xc)
else if info[inx] = ')'
then write8600rec('3B'xc)
else if info[inx] = '*'
then write8600rec('5C'xc)
else if info[inx] = '_'
then begin
writecommand(20,2); {aux. char. set}
write8600rec('50'xc);
writecommand(20,1); {back to primary}
end {then..begin}
else write8600rec(str(chr(ordx[info[inx]])));
end; {do..begin}
end; {writeinfo}
@
@<Global Variables@>=
@^system dependencies@>
@!job_len_conv : string(5);
@!job_length : integer;
@^system dependencies@>
@!parmvalue : string(80);
@^system dependencies@>
@!pages_conv : string(5);
@!pages_set : integer;
@!galley_length : real;
@^system dependencies@>
@!real_filename : string(8);
@ The following procedure writes the information within the accounting
box at the end of each job.
@p @^system dependencies@>
procedure setaccountbox (infoname :string(30);
infophone :string(14);
infodelivery :string(8);
infozip :string(10);
infobin :string(8);
infoid :string(22));
var
inx :integer;
begin
@<set constant values@>@/
@<draw accounting box@>@/
@<write name in box@>@/
@<write phone number in box@>@/
@<write delivery method in box@>@/
@<write zipcode in box@>@/
@<write center bin in box@>@/
@<write user id in box@>@/
@<write job length in box@>@/
@<write file name in box@>@/
@<write number of pages set, in box@>@/
@<write tape number in box@>@/
galley_length := galley_length + 140;
end; {setaccountbox}
@
@<set constant...@>=
different_setsize := false;
in_slant_mode := false;
in_reverse_type := false;
@
@<draw account...@>=
writecommand(12,410); {rule width in points}
writecommand(13,8); {rule depth in points}
writecommand(14,0); {set top rule}
writecommand(12,8); {rule width in points}
writecommand(13,84); {rule depth in points}
writecommand(14,402*SPsPerPt); {set left rule}
writecommand(14,0); {set right rule}
writecommand(9,83.8*SPsPerPt); {VMF to bottom in pts}
writecommand(12,410); {rule width in points}
writecommand(13,8); {rule depth in points}
writecommand(14,0); {set bottom rule}
writecommand(11,32*SPsPerPt); {32pt indent}
writecommand(10,56*SPsPerPt); {Move back up}
writecommand(25,320); {define bold font}
writecommand(7,11); {11pt size}
@
@<write name...@>=
write8600rec('4e616d65231e'xc); {'Name: '}
writecommand(25,330); {change to Bold Ital}
writeinfo(infoname);
writecommand(11,265*SPsPerPt); {265pt Indent}
writecommand(25,320); {Bold}
@
@<write phone...@>=
write8600rec('50686f6e65231e'xc); {'Phone: '}
writecommand(25,330); {Bold Italic}
writeinfo(infophone);
@
@<write delivery meth...@>=
writecommand(11,50*SPsPerPt); {50pt indent}
writecommand(9,16*SPsPerPt); {VMF 16pt}
writecommand(25,320); {Bold}
write8600rec('44656c6976657279231e'xc); {'Delivery: '}
writecommand(25,330); {Bold Italic}
writeinfo(infodelivery);
@
@<write zipcode...@>=
if infozip <> 'NA'
then begin
writecommand(11,190*SPsPerPt); {190pt indent}
writecommand(25,320); {Bold}
write8600rec('5a6970636f6465231e'xc); {'Zipcode: '}
writecommand(25,330); {Bold Italic}
writeinfo(infozip);
end;
@
@<write center...@>=
if infobin <> 'NA'
then begin
writecommand(11,284*SPsPerPt); {284pt indent}
writecommand(25,320); {Bold}
write8600rec('42696e231e'xc); {'Bin: '}
writecommand(25,330); {Bold Italic}
writeinfo(infobin);
end; {then..begin}
@
@<write user id...@>=
writecommand(9,14*SPsPerPt); {VMF 14pt}
if infoid <> 'NA'
then begin
writecommand(11,30*SPsPerPt); {30pt indent}
writecommand(25,320); {Bold}
write8600rec('4944231e'xc); {'ID: '}
writecommand(25,330); {Bold Italic}
writeinfo(infoid);
end; {then..begin}
@
@<write job length...@>=
writecommand(11,250*SPsPerPt); {indent for job length}
writecommand(25,320); {BOLD}
write8600rec('4a6f621e'xc); {'Job '}
write8600rec('4c656e677468231e'xc); {'Length: '}
writecommand(25,330); {Bold Italic}
job_len_conv := strconv(job_length);
for inx := 1 to 5
do write8600rec(str(chr
(ordx[job_len_conv[inx]])));
write8600rec('1e696e63686573'xc); {' inches'}
writecommand(11,20*SPsPerPt); {get ready for DSN}
@
@<write file name...@>=
writecommand(9,16*SPsPerPt); {VMF 16pt}
writecommand(25,320); {Bold}
write8600rec('46696c656e616d65231f'xc); {'Filename: '}
writecommand(25,330); {Bold Italic}
parmvalue := real_filename;
writeinfo(parmvalue);
@
@<write number of...@>=
writecommand(11,155*SPsPerPt); {155pt indent}
writecommand(25,320); {Bold}
write8600rec('50616765731e'xc); {'Pages '}
write8600rec('536574231e1e'xc); {'Set: '}
writecommand(25,330); {Bold Italic}
pages_conv := strconv(pages_set);
for inx := 1 to 5
do write8600rec(str(chr(ordx
[pages_conv[inx]])));
writecommand(11,265*SPsPerPt); {get ready for Tape \#}
@
@<write tape numb...@>=
writecommand(25,320); {Bold}
write8600rec('546170651e'xc); {'Tape '}
writecommand(20,2); {aux. char. set}
write8600rec('72'xc); {'\#'}
writecommand(20,1); {pri. char. set}
write8600rec('231e1e1e1e'xc); {': '}
postam_found := true;
writecommand(25,330); {bold italic}
@ The information procedure reads the billing information from an outside
file called the |addrfile|, and sends that information to the
|setaccountbox| procedure. It also writes the information to another file
called the |infofile|.
@<Global Constants@>=
@! notfatal = false;@/
@
@<Global Variables@>=
@!addrline : text;
@!infofile : text;
@^system dependencies@>
@!resource_info : string(256);
@^system dependencies@>
@!str1 : string(256);
@^system dependencies@>
@!str2 : string(256);
@!minimum_width : integer;@/
@
@p @^system dependencies@>
procedure information;
var
int :integer;
inx :integer;
infoname :string(30);
infophone :string(14);
infodelivery :string(10);
infozip :string(10);
infobin :string(8);
infoid :string(22);
infoprocedure :string(4);
infobudget :string(20);
tempbool :boolean;
begin
@<set initial values for strings@>
@<open address file and read and close@>@/
@<parse info from address file@>
@<send info to accounting procedure and write infofile@>
end; {information}
@
@<set initial values...@>=
infozip := 'NA';
infoid := 'NA';
infobin := 'NA';
infoprocedure := 'NA';
infobudget := 'NA';
@
@<open address...@>=
termin(addrline);
readln(addrline,resource_info);
close(addrline);
@
@<parse info...@>=
rewrite(infofile,'NAME=' ccat filename ccat '.INFOFILE.*');
while length(resource_info) > 0 do begin
inx := index(resource_info,':');
if inx < 1
then begin
errstr := resource_info;
error(28,notfatal,0);
end
else begin
str1 := substr(resource_info,1,inx-1);
resource_info := ltrim(substr(resource_info,inx+1));
inx := index(resource_info,':');
if inx = 0
then begin
str2 := resource_info;
resource_info := '';
end
else begin
int := inx - 1; {no sense starting at a colon:}
tempbool := false;
repeat
if substr(resource_info,int,1) = ' '
then tempbool := true
else int := int - 1;
until tempbool; {which means we found a blank}
str2 := trim(substr(resource_info,1,int-1));
resource_info := substr(resource_info,int+1);
end;
str1 := allcaps(ltrim(trim(str1)));
str2 := allcaps(ltrim(trim(str2)));
if str1 = 'NAME' then
infoname := str2
else if str1 = 'PHONE' then
infophone := str2
else if str1 = 'PROCEDURE_NUMBER'
then infoprocedure := str2
else if str1 = 'BUDGET_PROJECT'
then infobudget := str2
else if str1 = 'PICKUP' then
infodelivery := str2
else if str1 = 'CAMPUS_ZIP' then
infozip := str2
else if str1 = 'BIN' then
infobin := str2
else if str1 = 'ID' then
infoid := str2
else begin
errstr := resource_info;
error(28,notfatal,0);
end
end;
end;
@
@<send info...@>=
setaccountbox(infoname,infophone,infodelivery,infozip,
infobin,infoid);
writeln(infofile,infoname);
writeln(infofile,infophone);
writeln(infofile,infoprocedure);
writeln(infofile,infobudget);
writeln(infofile,infodelivery);
writeln(infofile,infozip);
writeln(infofile,infoid);
writeln(infofile,infobin);
writeln(infofile,job_length);
writeln(infofile,pages_set);
writeln(infofile,minimum_width);
writeln(infofile,real_filename);
@* End of File procedures.
At the end of the \TeX DVI file is a postamble command, when that
command is encountered |readpostamble| and |post_amble| are called.
@ The second procedure called but first listed is the |post_amble|
procedure, it calls the |information| procedure and writes the job
length and number of pages to the terminal.
@<Global Variables@>=
@!num_of_pages : integer;
@^system dependencies@>
@!job_type : string(6);
@
@p procedure post_amble;
begin
@<prepare and write information info@>
@<give job length to user on terminal@>@/
@<set final values for galleylength, etc.@>
end; {Postamble}
@
@<prepare and write...@>=
if dumpin then writeln(dumpout,
'PST -- post-amble: End of Run');
doingpages := true;
writecommand(11,0); {Move to left col.}
writecommand(9,30.0*SPsPerPt); {VMF 30 pts}
information;
@
@<give job length...@>=
writeln;
writeln('Total length of run = ',
galley_length:9:1,' pts.');
writeln(' = ',
galley_length/72.0:9:1,' inches.');
writeln(' = ',
num_of_pages:9,' pages.');
@
@<set final...@>=
job_length := round(galley_length/72.0);
pages_set := num_of_pages;
job_type := 'TeX';
@ This second procedure is called first and reads the final job
information for the file. Things like job length, widest page,
tallest page are set and the information sent to |post_amble|.
@<Global Variables@>=
@!byte : integer;@/
@!width : real;@/
@!even_page_margin : real;@/
@!odd_page_margin : real;@/
@!totalpg : integer;@/
@
@p procedure readpostamble;
var
int :integer;@/
inx :integer;@/
begin
job_length := round(galley_length / 72.0);@/
pages_set := num_of_pages;@/
for inx := 1 to 3 do byte := readinteger(4);
byte := readinteger(4); {Get magnification}@/
if dumpin
then writeln(dumpout,
'** Font magnification = ',byte/1000.0:3:1);
writeln;
writeln('Tallest page is ',readinteger(4)/SPsPerPt/72.0:2:1,
' inches.');
width := readinteger(4) / SPsPerPt / 72.27;
width := max(width,put_width,even_page_margin/72.27,
odd_page_margin/72.27);
writeln('Widest page is ',width:2:1,' inches.');@/
width := width + 0.31; {5/16" on the left that cannot be used.}
if width < 8.0 then int := 8
else int := 12;
minimum_width := int;
writeln('The smallest paper you can use is ',int:2,'"');
totalpg := 9999;
post_amble;
if galley_length = 0 then begin
writeln('Error!! No pages set. ');
setretcode(12);
end;
end; {readpostamble}
@* Conversion Functions.
The following two functions will convert strings to integers
(|whole_value|) or to real numbers (|decimal_value|).
@^system dependencies@>
@p function whole_value(str1 :string(10)) :integer;
var
inx, inz : integer;@/
divisor : real;@/
number : real;@/
begin
number := 0;
inx := index(str1,'-');
if inx > 0
then begin
divisor := (-1 * 0.1);
str1 := substr(str1,2);
end {then..begin}
else divisor := 0.1;
for inz := 0 to (length(str1)-1) do begin
divisor := divisor * 10.0;
number := number + ((ordx[str1[length(str1) - inz]] -
ordx['0']) * divisor);
end;
whole_value := round(number);
end; {|whole_value|}
@
@^system dependencies@>
@p function decimal_value(str2 :string(40)): real;
var
inx, inz : integer;
divisor : real;
str3 : string(30);
number : real;
begin
number := 0.0;
inx := index(str2, '.');@/
@<value with decimal, but nothing to right@>
@<value with decimal, and something to right@>@/
@<value without decimal@>
decimal_value := number;
end; {|decimal_value|}
@
@<value with decimal, but...@>=
if inx = length(str2) then begin {read left side of decimal}
str2 := substr(str2,1,inx-1);
end
@
@<value with decimal, and...@>=
else begin
if inx > 0 then begin
str3 := substr(str2,inx+1);
divisor := 1.0;
for inz := inx+1 to length(str3) do begin
divisor := divisor * 0.1;
number := number +
(ordx[str3[inz]] - ordx['0'] * divisor);
end;
if inx = 1 then return;
str2 := substr(str2,1,inx-1);
end;
end;
@
@<value without...@>=
divisor := 0.1;
for inz := 0 to (length(str2)-1) do begin
divisor := divisor * 10.0;
number := number + ((ordx[str2[length(str2) - inz]] -
ordx['0']) * divisor);
end;
@* Parm-reading procedure.
This procedure reads and parses the parameters entered with the
call to this program; it is expecting the following form of some
sort:
\centerline{\tt tex8600 fn ft (1stpg \#ofpgs) realfn lrecl}
@<Global Variables@>=
@^system dependencies@>
@!filetype : string(8);
@!firstpg : integer;
@
@p @^system dependencies@>
procedure readparms;
var
namepage : string(256);
temp : integer;
temp2 : integer;
temp3 : integer;
str1 : string(10);
lrecl : string(8);
begin
namepage := ltrim(trim(parms));
@<file name and real filename@>
@<file type not supplied@>
@<file type supplied@>
end; {readparms}
@
@<file name and real filename@>=
temp := index(namepage,' ');
temp2 := index(namepage,')');
if temp2 > 0
then @<parse real name and lrecl@>
else error(10,fatal,0);
filename := substr(namepage,1,temp-1);
@
@<parse real name and lrecl@>=
begin
temp3 := index(substr(namepage,temp2+2),' ');
if temp3 = 0
then begin
real_filename := substr(namepage,temp2 + 2);
lrecl := '';
end
else begin
real_filename := substr(namepage,temp2 + 2,temp3-1);
lrecl := substr(namepage,temp2+2+temp3);
end;
if lrecl = ''
then pv_dvi_lrecl := pc_dvi_lrecl
else readstr(lrecl,pv_dvi_lrecl);
end
@
@<file type not...@>=
namepage := substr(namepage,temp+1,(temp2-temp));
temp := index(namepage,'(');
if temp = 1
then begin
filetype := 'DVI';
if length(namepage) > 1
then begin
namepage := substr(namepage,temp+2);
temp := index(namepage,' ');
if temp > 0
then begin
str1 := substr(namepage,1,temp-1);
firstpg := whole_value(str1);
str1 := substr(namepage,temp+1);
if length(str1) > 0 then
totalpg := whole_value(str1);
end {then..begin}
else begin
str1 := substr(namepage,1);
firstpg := whole_value(str1);
end {ELSE..begin}
end {then..begin}
end {then..begin}
@
@<file type supplied...@>=
else begin
filetype := substr(namepage,1,temp-2);
namepage := ltrim(substr(namepage,temp+1));
temp := index(namepage,')');
if temp > 1
then begin
temp2 := index(namepage,' ');
str1 := substr(namepage,1,temp2-1);
if str1='*'
then firstpg := -99999
else firstpg := whole_value(str1);
str1 := substr(namepage,temp2+1,(temp-temp2)-2);
if str1='*'
then totalpg := 99999
else totalpg := whole_value(str1);
end; {then..begin}
end; {ELSE..begin}
@* Print Position Procedures.
The next three procedures are called whenever there is to be a
vertical or horizontal move of any kind.
@
@<Global Type...@>=
@!movetype = (horiz,vert);
@ This procedure will print the horizontal or vertical
distance that the 8600 is to move the paper.
@p procedure figuredir(typ :movetype;
amt :integer);
var
temp :real;
begin
if dumpin and print_hmove then begin
writeln(dumpout);
write(dumpout,' *** move ');
end;
@<horizontal move@>
@<move right@>
@<move left@>
@<vertical move@>
@<move down@>
@<move up@>
if dumpin and print_hmove
then temp := getpts(abs(amt));
end; {FigureDir}
@
@<horizontal move@>=
if typ = horiz
then if amt >= 0
@
@<move right@>=
then begin
if dumpin and print_hmove then write(dumpout,'right ');
writecommand(11,stack[stacktop].H);
end
@
@<move left@>=
else begin
if dumpin and print_hmove then write(dumpout,'left ');
writecommand(11,stack[stacktop].H);
end
@
@<vertical move@>=
else if amt >= 0
@
@<move down@>=
then begin
if dumpin then write(dumpout,'down ');
writecommand(9,amt);
end
@
@<move up@>=
else begin
if dumpin then write(dumpout,'up ');
writecommand(10,abs(amt));
end;
@
@<Global Variables@>=
@!hmove_pending : boolean;
@!hmove_amt : integer;
@!vmove_pending : boolean;
@!vmove_amt : integer;
@!length_of_take : real;
@ This procedure is invoked in the main program each
time something is actually to be set (such as a
character). If there is a vertical or horizontal
move pending, they will be set here, before continuing
on to the next set command (such as set character).
@p procedure checkmoves;
var
tempbool :boolean;
begin
if hmove_pending then begin
figuredir(horiz,hmove_amt);
hmove_amt := 0;
hmove_pending := false;
print_hmove := true;
end; {then..begin}
if vmove_pending then begin
figuredir(vert,vmove_amt);
tempbool := dumpin;
dumpin := false;
if doingpages=true
then begin
galley_length := galley_length + getpts(vmove_amt);
length_of_take := length_of_take + getpts(vmove_amt);
end;
dumpin := tempbool;
vmove_amt := 0;
vmove_pending := false;
end; {then..begin}
end; {checkmoves}
@
@<Global Variables@>=
@!font8600 : 0..2550;
@!ptsize : 0..255;
@!different_setsize : boolean;
@!setsize : 0..255;
@ This procedure sets the page environment to be that of ``font"
@p procedure establish_font_parameters(font :integer);
begin
@<new font name@>
@<new font size@>
@<new set size@>
end; {|establish_font_parameters|}
@
@<new font name@>=
with a8600fontrec[fontenviron[font].fontindex]
do begin
if (fontno8600 <> font8600) and (fontno8600 <> 0)
then begin
writecommand(25,float(fontno8600));
font8600 := fontno8600;
end; {then..begin}
end; {WITH..begin}
@
@<new font size@>=
if fontenviron[font].pointsize <> ptsize
then begin
ptsize := fontenviron[font].pointsize;
writecommand(7,float(ptsize));
end; {then..begin}
@
@<new set size@>=
if different_setsize
then writecommand(8,float(setsize));
@* ``Special'' Procedures.
The next few procedures enable the 8600 to do ``special'' things
like setting line footnotes, or slant type, or expanded type, etc.
@
@<Global Constants@>=
@! maxNote = 100;@/
@ This procedure establishes the line number reference in
|footnote_line_array| with the line number in which a line note was
called.
@<Global Variables@>=
@!foot_area_ref : 0..255;
@!footnote_line_array : packed array[0..maxNote] of 0..255;
@!foot_line_ref : 0..255;
@!line_note_pending : boolean;
@!line_ref_pend_seq : 0..255;
@!counting_lines : boolean;
@!number_of_lines : integer;
@
@p procedure line_footnote_reference;
begin
if not counting_lines then begin
incr(foot_area_ref);
line_note_pending := true;
line_ref_pend_seq := 1;
end
else begin
incr(foot_line_ref);
footnote_line_array[foot_line_ref] := number_of_lines + 1;
end;
end; {|line_footnote_reference|}
@
@<Global Constants@>=
@! linefont = 256;@/
@! linenumfont = 76;@/
@
@<Global Variables@>=
@^system dependencies@>
@!special : string(40);
@!line_interval : 0..255;
@!margin_note : boolean;
@!numbering_lines : boolean;
@!printing_numbers : boolean;
@!pop_level : integer;
@ This procedure reads and interprets all the \\special commands
entered in the \TeX\ file. Its primary purpose is for reading the
the instructions pertaining to linenotes.
@p @^system dependencies@>
procedure readspecials;
var
int : integer;
inx : integer;
temp : string(40);
temp2 : string(40);
temp3 : string(40);
temp4 : string(40);
begin
@<read special command@>
if temp = 'EVEN_PAGE_MARGIN'
then begin
temp := (substr(temp2, 1, length(temp2)-2));
even_page_margin := decimal_value(temp);
end
else if temp = 'ODD_PAGE_MARGIN'
then begin
temp := (substr(temp2, 1, length(temp2)-2));
odd_page_margin := decimal_value(temp);
end
else if temp = 'LINE_NUMBER_FONT'
@<linenumber font@>
else if temp = 'POP_LEVEL'
then pop_level := whole_value(temp2)
else if temp = 'LINE_INTERVAL'
then line_interval := whole_value(temp2)
else if temp = 'NUMBERING_LINES'
then begin
@<boolean value@>
then numbering_lines := true
else numbering_lines := false;
end {then..begin}
else if temp = 'COUNTING_LINES'
then begin
@<boolean value@>
then counting_lines := true
else counting_lines := false;
end {then..begin}
else if (temp = 'MARGINNOTE')
then margin_note := true
else if temp = 'PRINTING_NUMBERS'
then begin
@<boolean value@>
then printing_numbers := true
else printing_numbers := false;
end {then..begin}
else if temp = 'LINE_FOOTNOTE_REFERENCE'
then line_footnote_reference;
end; {then..begin}
end; {ReadSpecials}
@ This gives default values for even and odd page margins that
will be reset if the user specified them in his file. It also reads
the special command.
@<read special command@>=
int := index(special, '=');
if int > 0
then begin
temp := trim(ltrim(substr(special, 1, int-1)));
temp2 := substr(special, int+1);
@ If the special command is a Line Number Font, the command must
be further broken down to find the point size, as well as the name.
@<linenumber font@>=
then begin
int := index(temp2, ' ');
if int > 0
then begin
@<point size given@>
end
else begin
@<no point size given@>
end;
fontname := allcaps(temp3);
readfontinfo(linefont,linenumfont);
end
@ A point size is given and that size must be sent along with the
name to the |readfontinfo| procedure.
@<point size given...@>=
temp3 := trim(ltrim(substr(temp2, 1, int-1)));
temp4 := substr(temp2, int+1);
with fontenviron[linefont] do begin
inx := whole_value(temp4);
pointsize := inx;
designsize := inx;
end;
@ No point size is given, so the default point size will be used
(ten-point).
@<no point size...@>=
temp3 := trim(ltrim(substr(temp2, 1, int-1)));
inx := 10;
with fontenviron[linefont] do begin
pointsize := inx;
designsize := inx;
end;
@ The boolean value module is used when the response to the
special command is true or false.
@<boolean value@>=
temp2 := allcaps(ltrim(trim(temp2)));
if temp2 = 'TRUE'
@ This procedure is used in conjunction with the 0 font and
handles the special functions codes like slant,
reverse type, set size, etc.
@p procedure call_specials_routine(funcname :integer);
var
inx :integer;
num :integer;
begin
if dumpin then writeln(dumpout,'Function [',funcname:3,'] ');
if funcname = 10
then counting_lines := true
else if funcname = 11
then counting_lines := false
else if funcname = 12
then printing_numbers := true
else if funcname = 13
then printing_numbers := false
else if funcname = 14
then line_footnote_reference;
if (funcname=14) or (funcname=13) or (funcname=12) or
(funcname=11) or (funcname=10) then return;
with stack[stacktop],
a8600fontrec[fontenviron[currfont].fontindex],
fontenviron[currfont] do begin
with a8600chars[funcname] do begin
for inx := 0 to num
do with comarray[inx]
do writecommand(comcode,float(argument));
end; {DO..begin}
end; {DO..begin}
end; {|call_specials_routine|}
@* Set the characters procedures.
The first procedure is called from the second one if a line
number is to be printed.
The second procedure actually sets an individual character.
First it checks
to make sure the character is a real one and not from the zero or
specials' font, then
it checks to see if a move needs to be made before the character is
printed. It makes the move and then
checks to see if a line number is to be printed; if it does, it prints
the line number, if it doesn't it sets the character.
@<Global Variables@>=
@!points : real;
@!we_add_the_character_width : boolean;
@ When \TeX\ formats the footnotes entered with a linenote reference
command, it simply inserts two zeros for the linenumber. This procedure
replaces those two zeros with the line number in which the linenote
reference was called.
@p procedure setline_footnote_ref(font :integer);
var
temp :integer;
inx :integer;
tempreal :real;
return_ps :boolean;
return_ss :boolean;
begin
@<determine correct line number@>
@<print line number@>
@<reset line number values@>
end; {|setline_footnote_ref|}
@
@<determine correct line number@>=
if line_ref_pend_seq = 1
then temp := footnote_line_array[foot_area_ref] div 10
else temp := footnote_line_array[foot_area_ref] mod 10;
with fontenviron[font], stack[stacktop] do
H := H + round(pointsize *
a8600fontrec[fontindex].a8600chars[48].charwidth
* SPsPerPt);
if (line_ref_pend_seq = 1) and (temp = 0) then begin
hmove_pending := true;
line_ref_pend_seq := 2;
return;
end;
@
@<print line number@>=
with stack[stacktop], a8600fontrec[fontenviron[font].fontindex],
fontenviron[font] do begin
with a8600chars[48 + temp] do begin
@<set character commands@>
end; {WITH..begin}
end; {WITH..begin}
@
@<reset line number values@>=
if line_ref_pend_seq = 1 then begin
line_ref_pend_seq := 2;
return; end
else begin
line_ref_pend_seq := 0;
line_note_pending := false;
return; end;
if line_note_pending
then begin
line_note_pending := false;
return;
end;
@ The |setcharacter| procedure is the main procedure for setting
any and all characters, except the |line_footnote| references.
@p procedure setcharacter(character :integer;
font :integer);
var
inx :integer;
tempreal :real;
temppt :integer;
tempbool :boolean;
return_ps :boolean;
return_ss :boolean;
begin
@<specials font or dumpin@>
checkmoves;
@<linenote-footnote@>
@<debug info@>
@<begin character@>
end; {setcharacter}
@
@<specials font or dumpin@>=
if font8600 = 0 then begin
call_specials_routine(character);
return;
end; {then..begin}
if dumpin and (hmove_pending or vmove_pending)
then tempbool := true
else tempbool := false;
@
@<linenote-footnote@>=
if line_note_pending and (character = 48)
then begin
setline_footnote_ref(font);
return;
end;
@
@<debug info@>=
if dumpin and tempbool then writeln(dumpout);
if dumpin
then if (character >= 32) and (character < 127)
then write(dumpout,chrx[character])
else write(dumpout,'?<',character:3,'>');
@
@<begin character@>=
return_ps := false;
return_ss := false;
with stack[stacktop], a8600fontrec[fontenviron[font].fontindex],
fontenviron[font] do begin
with a8600chars[character] do begin
if different_setsize
then temppt := trunc(float(setsize) /
100.0 * pointsize)
else temppt := pointsize;
if we_add_the_character_width
then H := H + round(temppt * charwidth * SPsPerPt);
@<set character commands@>
end; {WITH..begin}
end; {WITH..begin}
@
@<set character commands@>=
for inx := 0 to num do
with comarray[inx] do
if (comcode = 25) and (argument = -1)
then writecommand(25,fontno8600)
{Some commands need to be scaled by
the set size factor}
else if (comcode=9) or (comcode=10) or
(comcode = 27) or (comcode = 28)
then begin
points := float(pointsize) *
SPsPerPt * real_argument;
writecommand(comcode,points);
end {then..begin}
else if (comcode = 12) or (comcode = 13)
then begin
points :=float(pointsize) * real_argument;
writecommand(comcode,points);
end {then..begin}
else if comcode = 14
then begin
tempreal := SPsPerPt * (getpts(H) +
(real_argument * pointsize));
if we_add_the_character_width
then tempreal := tempreal -
round(pointsize*charwidth*SPsPerPt);
writecommand(14,tempreal);
end
else if comcode = 7
then begin
writecommand(7,pointsize+float(argument));
return_ps := true;
end
else if comcode = 8
then begin
writecommand(8,designsize+float(argument));
return_ss := true;
end
else writecommand(comcode,float(argument));
if return_ss then writecommand(8,designsize);
if return_ps then writecommand(7,pointsize);
@
@<Global Variables@>=
@!size : integer;
@ This next procedure sets the line number if that option is used.
It will print the line number according to
|odd_page_margin| or |even_page_margin|. The number will
be set in the |line_number_font|. The line numbers
will print every five lines by default or according to
|line_interval|, and begin at 1 on each page.
@p procedure print_line_number;
var
j :integer;
begin
incr(number_of_lines);
if not printing_numbers then return;
if (number_of_lines <> ((number_of_lines div
line_interval) * line_interval))
then return; {If this is not a line number divisible by
|line_interval|}
size := headernum div 2;
size := size * 2;
if even_page_margin = 0 then
even_page_margin := 50.8;
if odd_page_margin = 0 then
odd_page_margin := 407.7;
if size = headernum
then writecommand(11,even_page_margin*SPsPerPt) {H position}
else writecommand(11,odd_page_margin*SPsPerPt); {H position}
establish_font_parameters(linefont);
size := number_of_lines;
if dumpin then begin
writeln;
write(dumpout,'*** set line number ');
end;
we_add_the_character_width := false;
if size >= 10
then begin
j := size div 10;
setcharacter(j+48,linefont); {set 1st digit}
size := size -(j * 10);
end
else with
a8600fontrec[fontenviron[linefont].fontindex].a8600chars[48]
do {set nothing, but move the width of a "0"}
writecommand(27, fontenviron[linefont].pointsize *
charwidth * SPsPerPt);
setcharacter(size+48,linefont); {+48 for ASCII code}
we_add_the_character_width := true;
if dumpin then writeln(dumpout);
establish_font_parameters(currfont); {return to active font}
end; {|print_line_number|}
@* Initialization procedures.
These next few procedures, get the whole thing started by assigning
values to all necessary items.
@<Global Constants@>=
@! version = 2;@/
@! level = 7;@/
@
@<Global Variables@>=
@!takenum : integer;
@!currpage : integer;
@!prevpage : integer;
@
@p @^system dependencies@>
procedure initialize8600;
begin
@<page-setting values@>
@<setting output/input values@>
@<line-numbering font values@>@/
@<page and font values@>
@<line numbering values@>
@<miscellaneous values@>
end; {initialize8600}
@
@<page-setting values@>=
firstpg := -99999;
totalpg := 99999;
doingpages := false;
@
@<setting output/input values@>=
termout(output);
readparms;
reset(input,'NAME=' ccat filename ccat '.' ccat filetype ccat '.*');
writeln('******* tex8600 Version ',version:2,' Level ',
level:3,' *******');
rewrite(setfile,'LRECL=1029,RECFM=F,NAME=' ccat filename ccat
'.TAPEFILE.*');
@
@<line-numbering font values@>=
with fontenviron[-1] do begin
pointsize := 10;
designsize := 1;
fontindex := 0;
end; {WITH..begin}
@
@<page and font values@>=
currfont := -1;
currpage := 0;
prevpage := -99999;
ptsize := 0;
setsize := 100;
@
@<line numbering values@>=
counting_lines := false;
margin_note := false;
numbering_lines := false;
printing_numbers := false;
line_note_pending := false;
line_ref_pend_seq := 0;
even_page_margin := 0.0;
odd_page_margin := 0.0;
line_interval := 5;
pop_level := 3;
bufferlen := 0;
@
@<miscellaneous values@>=
takenum := -1;
num_of_pages := 0;
length_of_take := 0;
dumpin := false;
@ This procedure initializes values that pertain to the overall run.
@<Global Variables@>=
@!last_command : 0..255;
@!outputpending : boolean;
@!page_counter : integer;
@!second_to_last_cmnd : 0..255;
@
@p procedure init_run;
begin
initialize8600;
@<debugging statements@>
count := 0;
fileend := false;
galley_length := 0;
hmove_amt := 0;
hmove_pending := false;
last_command := 0;
outputpending := false;
page_counter := 0;
postam_found := false;
put_width := 0.0;
print_hmove := true;
second_to_last_cmnd := 0;
stacktop := 1; {initialize stack}
vmove_amt := 0;
vmove_pending := false;
we_add_the_character_width := true;
@<initialize job's main record--stack@>
end; {|init_run|}
@
@<debugging statements@>=
if dumpin then begin
writeln(dumpout);
writeln(dumpout);
writeln(dumpout,'********************************************');
writeln(dumpout,'byte:code meaning');
writeln(dumpout);
end;
@
@<initialize job's main record--stack@>=
with stack[stacktop] do begin
H := 0;
V := 0;
W := 0;
X := 0;
Y := 0;
Z := 0;
end; {WITH loop}
@* Rule-setting Procedures.
The |setrule| procedure is called when the horizontal position
is to be advanced. |putrule| is called when the horizontal position
is not to be advanced.
@ This procedure sets a rule.
@<Global Variables@>=
@!ruleht : integer;
@!rulewidth : integer;
@!height : real;
@!fudge : real;
@
@p procedure drawrule;
begin
checkmoves;
points := getpts(ruleht);
height := points * SPsPerPt;
if points <> 0 then begin
writecommand(13,points);
points := getpts(rulewidth);
writecommand(12,points);
if points <> 0 then begin
writecommand(10,height); {Move back the rule height}
writecommand(14,stack[stacktop].H); {set it}
writecommand(9,height); {move down after setting}
writecommand(11,stack[stacktop].H); {set it}
end; {then...begin}
end;{then..begin}
end;
@ Rule and increase the value of H (horizontal position).
@p procedure setrule;
begin
drawrule;
hmove_amt := rulewidth;
hmove_pending := true;
stack[stacktop].H := stack[stacktop].H + rulewidth;
end; {setrule}
@ Rule and do not increase the value of H (horizontal position).
@p procedure putrule;
begin
drawrule;
end; {putrule}
@* Page procedures.
The |doendofpage| procedure is called at the end of each page and the
|dobeginningofpage| procedure at the beginning of each page.
@ This procedure is entirely for the user's information. It prints
out to the terminal the number of pages set in the job. If there are
are more than 8 page numbers a carriage return is thrown.
@p procedure doendofpage;
begin
incr(page_counter);
if page_counter >= 8 then begin
writeln;
page_counter := 0;
end;
if doingpages=true
then begin
decr(totalpg);
if totalpg = 0
then begin
writeln('<',currpage:1,'> ');
return;
end {then..begin}
else write('<',currpage:1,'> ');
end;
end;
@ This procedure does all of the 8600 initialization
for the start of each new page.
@<Global Constants@>=
@! indent=' ';@/
@! nullstring = '00000000000000000000'xc;@/
@
@<Global Variables@>=
@!int : integer;
@!newtake : boolean;
@
@p procedure dobeginningofpage;
var
inx :integer;
begin
@<general initializations@>
@<read first page number@>
@<determine if current page is to be set@>
@<read counters@>
if doingpages=true
then begin
if (currpage = firstpg) or (int = -1)
or (length_of_take >= 5184)
then begin
@<first page or 6 feet in film canister@>
end {then..begin}
else begin
@<any other page@>
end; {ELSE..begin}
with fontenviron[currfont] do begin
if int = -1 then begin
@<first page font environment@>
end
else begin
@<all other pages font environment@>
@<print end of page rule@>
end; {ELSE..begin}
end;{WITH..begin}
incr(num_of_pages);
end; {then..begin}
end; {DoBeginningOfPage}
@
@<general initializations@>=
foot_line_ref := 0;
foot_area_ref := 0;
number_of_lines := 0;
newtake := false;
with stack[stacktop] do begin
H := 4718592;
V := 0; {start 1" over and 1" down}
vmove_amt := 4718592;
vmove_pending := true;
hmove_pending := true;
end; {WITH ... do begin}
@
@<read first page number@>=
int := readinteger(4);
if dumpin then writeln(dumpout,'BOP -- Beginning Of Page ',int);
headernum := int;
prevpage := currpage;
currpage := int;
@
@<determine if current...@>=
if (firstpg = -99999)
then
doingpages := true;
if not doingpages
then
if ((firstpg >= 0) and (firstpg <= currpage))
or ((firstpg < 0) and (firstpg >= currpage))
then
doingpages := true;
if (totalpg < 1)
then
doingpages := false;
@
@<read counters@>=
for inx := 1 to 9 do begin
int := readinteger(4);
if dumpin then writeln(dumpout,'Counter ',inx:1,' = ',int);
end; {FOR ... do begin}
int := readinteger(4);
if dumpin
then writeln(dumpout,indent,'previous page pointer = ',int);
@
@<first page or 6 feet in film canister@>=
incr(takenum);
length_of_take := 0;
if (int = -1) or (currpage = firstpg) {On first page}
then writeheader
else begin
inx := headernum;
headernum := 88888;
repeat {pad end of record with hex FF}
write8600rec(allzeros);
until bufferlen <= 5;
headernum := inx;
writecommand(1,0.0); {End of Take}
repeat {pad record with '00'xc}
write8600rec(allzeros);
until bufferlen <= 5;
end;
write8600rec(nullstring); {10 hex zeros}
writecommand(0,takenum); {Start of Take}
newtake := true;
@
@<any other page@>=
repeat {pad end of record with hex FF}
write8600rec(allzeros);
until bufferlen <= 5;
@
@<first page font environment@>=
different_setsize := false;
in_slant_mode := false;
in_reverse_type := false;
@
@<all other pages font environment@>=
writecommand(25,font8600);
writecommand(7,pointsize);
if different_setsize
then writecommand(8,float(setsize));
if in_slant_mode
then writecommand(15,48);
if in_reverse_type
then writecommand(3,1);
@
@<print end of page rule@>=
writecommand(11,0); {Move to left col.}
writecommand(9,12.0*SPsPerPt); {VMF 12 pts}
writecommand(12,30.0); {set width of rule}
writecommand(13,1.5); {set depth of rule}
writecommand(14,0); {page separator}
writecommand(11,0); {quad left}
writecommand(9,12.0*SPsPerPt); {VMF 12 pts}
galley_length := galley_length + 24;
@* MAIN PROGRAM.
@<Global Variables@>=
@!tempstack : stackrec;
@!inx : integer;
@!temp : integer;
@!temp2 : integer;
@!put_width : real;
@!realtemp : real;
@
@p begin {MAIN}
{=== Initialize ===}
init_run;
while not postam_found do begin
savecount := count; {don't change it in readinteger}
byte := readinteger(1); {1-byte code}
if printing_numbers
then if ((byte > 128) and (byte < 218)) then begin
second_to_last_cmnd := last_command;
last_command := byte;
end; {then..begin}
if byte < 128 then begin {This is a character}
outputpending := true;
setcharacter(byte,currfont);
end {then..begin}
else if (byte>=250) and (byte<=255)
then error(6,fatal,byte)
else case byte of
128: @<set horizontal character1@>@/
129: @<set horizontal character2@>@/
130: @<set horizontal character3@>@/
131: @<set horizontal character4@>@/
132: @<set a rule@>@/
133: @<put horizontal character1@>@/
134: @<put horizontal character2@>@/
135: @<put horizontal character3@>@/
136: @<put horizontal character4@>@/
137: @<put a rule@>@/
138: do_nothing; {NOP}
139: dobeginningofpage;{BOP}
140: doendofpage; {EOP}
141: @<push@>@/
142: @<pop@>@/
143: @<right1 move@>@/
144: @<right2 move@>@/
145: @<right3 move@>@/
146: @<right4 move@>@/
147: @<``W'' horizontal move@>@/
148..151: @<``W''1-4 horizontal move@>@/
152: @<``X'' horizontal move@>@/
153..156: @<``X''1-4 horizontal move@>@/
157..160: @<down1@>@/
161: @<``Y'' vertical move@>@/
162..165:@<``Y''1-4 vertical move@>@/
166: @<``Z'' vertical move@>@/
167..170: @<``Z''1-4 vertical move@>@/
171..234: @<set font@>@/
235: @<font1 set@>@/
236: @<font2 set@>@/
237: @<font3 set@>@/
238: @<font4 set@>@/
239: @<nop1@>@/
240: @<nop2@>@/
241: @<nop3@>@/
242: @<nop4@>@/
243: @<font1 def $0<k<64$@>@/
244: @<font2 def $0<k<65536$@>@/
245: @<font3 def $0<k<2^{24}$@>@/
246: @<font4 def $-2^{31}<k<2{30}$@>@/
247: @<preamble@>@/
248: readpostamble; {Post-amble}@/
249: do_nothing; {Post-post-amble}
otherwise writeln('oops...forgot about ',byte:12);
end;{CASE}
end;{while}
end.
@
@<set horizontal character1@>=
begin
int := readinteger(1);
we_add_the_character_width := true;
hmove_pending := true;
setcharacter(int,currfont);
end;
@
@<set horizontal character2@>=
begin
int := readinteger(2);
we_add_the_character_width := true;
hmove_pending := true;
setcharacter(int,currfont);
end;
@
@<set horizontal character3@>=
begin
int := readinteger(3);
we_add_the_character_width := true;
hmove_pending := true;
setcharacter(int,currfont);
end;
@
@<set horizontal character4@>=
begin
int := readinteger(4);
we_add_the_character_width := true;
hmove_pending := true;
setcharacter(int,currfont);
end;
@
@<set a rule@>=
begin
ruleht := readinteger(4);
rulewidth := readinteger(4);
setrule;
end;
@
@<put horizontal character1@>=
begin
int := readinteger(1);
we_add_the_character_width := false;
hmove_pending := true;
setcharacter(int,currfont);
we_add_the_character_width := true;
end;
@
@<put horizontal character2@>=
begin
int := readinteger(2);
we_add_the_character_width := false;
hmove_pending := true;
setcharacter(int,currfont);
we_add_the_character_width := true;
end;
@
@<put horizontal character3@>=
begin
int := readinteger(3);
we_add_the_character_width := false;
hmove_pending := true;
setcharacter(int,currfont);
we_add_the_character_width := true;
end;
@
@<put horizontal character4@>=
begin {Put Horizontal Character}
int := readinteger(4);
we_add_the_character_width := false;
hmove_pending := true;
setcharacter(int,currfont);
we_add_the_character_width := true;
end;
@
@<put a rule@>=
begin
ruleht := readinteger(4);
rulewidth := readinteger(4);
realtemp := rulewidth / SPsPerPt / 72.27;
putrule;
end;
@
@<push@>=
begin
tempstack := stack[stacktop];
stacktop := stacktop + 1;
stack[stacktop] := tempstack;
with stack[stacktop] do begin
end; {WITH..begin}
end;
@
@<pop@>=
begin
tempstack := stack[stacktop];
inx := stacktop;
stacktop := stacktop - 1;
with stack[stacktop] do begin
hmove_pending := false;
hmove_amt := 0;
print_hmove := true;
vmove_amt := vmove_amt + V - tempstack.V;
vmove_pending := true;
if margin_note and counting_lines
then margin_note := false
else if numbering_lines and counting_lines
and (inx = pop_level)
then print_line_number;
writecommand(11,H); {HPOS to left margin}
end; {WITH .. do begin}
with tempstack do begin
if put_width = 12.0 then
else if H / SPsPerPt > 554 then
put_width := 12.0;
end;
end; {POP}
@
@<right1 move@>=
begin
int := readinteger(1);
with stack[stacktop] do begin
hmove_amt := hmove_amt + int;
hmove_pending := true;
h := h + int;
end; {DO..begin}
end;
@
@<right2 move@>=
begin
int := readinteger(2);
with stack[stacktop] do begin
hmove_amt := hmove_amt + int;
hmove_pending := true;
h := h + int;
end; {DO..begin}
end;
@
@<right3 move@>=
begin
int := readinteger(3);
with stack[stacktop] do begin
hmove_amt := hmove_amt + int;
hmove_pending := true;
h := h + int;
end; {DO..begin}
end;
@
@<right4 move@>=
begin
int := readinteger(4);
with stack[stacktop] do begin
hmove_amt := hmove_amt + int;
hmove_pending := true;
h := h + int;
end; {DO..begin}
end;
@
@<``W'' horizontal move@>=
begin
with stack[stacktop] do begin
hmove_amt := hmove_amt + W;
hmove_pending := true;
H := H + W;
end; {WITH..begin}
end; {"W" amount change}
@
@<``W''1-4 horizontal move@>=
begin
size := 4 + (byte - 151);
int := readinteger(size);
points := getpts(int);
hmove_amt := hmove_amt + int;
hmove_pending := true;
with stack[stacktop] do begin
W := int; {int is in scalepts}
H := H + W;
end; {WITH..begin}
end; {"W" change}
@
@<``X'' horizontal move@>=
begin
with stack[stacktop] do begin
hmove_amt := hmove_amt + X;
hmove_pending := true;
H := H + X;
end; {WITH..begin}
end; {"X" amount move}
@
@<``X''1-4 horizontal move@>=
begin
size := 4 + (byte - 156);
int := readinteger(size);
points := getpts(int);
hmove_amt := hmove_amt + int;
hmove_pending := true;
with stack[stacktop] do begin
X := int; ; {saveamt.}
H := H + X; {record the move}
end; {WITH..begin}
end; {"X" amount change}
@
@<down1@>=
begin
size := 4 + (byte - 160);
int := readinteger(size);
points := getpts(int);
with stack[stacktop] do begin
vmove_amt := vmove_amt + int;
vmove_pending := true;
V := V + int;
end; {WITH..begin}
end; {"Down" amount move}
@
@<``Y'' vertical move@>=
begin
with stack[stacktop] do begin
vmove_amt := vmove_amt + Y;
vmove_pending := true;
V := V + Y;
end; {WITH..begin}
end; {"Y" amount move}
@
@<``Y''1-4 vertical move@>=
begin
size := 4 + (byte - 165);
int := readinteger(size);
points := getpts(int);
vmove_amt := vmove_amt + int;
vmove_pending := true;
with stack[stacktop] do begin
Y := int; {save amt.}
V := V + Y;
end; {WITH..DO begin}
end; {"Y" amount move}
@
@<``Z'' vertical move@>=
begin
with stack[stacktop] do begin
vmove_amt := vmove_amt + Z;
vmove_pending := true;
V := V + Z;
end; {WITH..begin}
end; {"Z" amount move}
@
@<``Z''1-4 vertical move@>=
begin
size := 4 + (byte - 170);
int := readinteger(size);
points := getpts(int);
vmove_amt := vmove_amt + int;
vmove_pending := true;
with stack[stacktop] do begin
Z := int; {save amt.}
V := V + Z;
end; {WITH..begin}
end; {"Z" amount move}
@
@<set font@>=
begin
currfont := byte - 171;
establish_font_parameters(currfont);
end;
@
@<font1 set@>=
begin
currfont := readinteger(1);
establish_font_parameters(currfont);
end;
@
@<font2 set@>=
begin
currfont := readinteger(2);
establish_font_parameters(currfont);
end;
@
@<font3 set@>=
begin
currfont := readinteger(3);
{ |establish_font_parameters(currfont);|}
end;
@
@<font4 set@>=
begin
currfont := readinteger(4);
{ |establish_font_parameters(currfont);|}
end;
@
@<nop1@>=
begin
int := readinteger(1);
special := '';
for inx := 1 to int do begin
temp := readinteger(1);
special := special ccat allcaps(str(chrx[temp]));
end; {DO..begin}
readspecials;
end;
@
@<nop2@>=
begin
int := readinteger(2);
special := '';
for inx := 1 to int do begin
temp := readinteger(1);
special := special ccat allcaps(str(chrx[temp]));
end; {DO..begin}
readspecials;
end;
@
@<nop3@>=
begin
int := readinteger(3);
special := '';
for inx := 1 to int do begin
temp := readinteger(1);
special := special ccat allcaps(str(chrx[temp]));
end; {DO..begin}
readspecials;
end;
@
@<nop4@>=
begin
int := readinteger(4);
special := '';
for inx := 1 to int do begin
temp := readinteger(1);
special := special ccat allcaps(str(chrx[temp]));
end; {DO..begin}
readspecials;
end;
@
@<font1 def...@>=
begin
currfont := readinteger(1);
fontinfo;
end;
@
@<font2 def...@>=
begin
currfont := readinteger(2);
fontinfo;
end;
@
@<font3 def...@>=
begin
currfont := readinteger(3);
fontinfo;
end;
@
@<font4 def...@>=
begin
currfont := readinteger(4);
fontinfo;
end;
@
@<preamble@>=
begin
int := readinteger(1);
int := readinteger(4);
temp := readinteger(4);
temp2 := readinteger(4);
temp := readinteger(1);
for int := 1 to temp do
inx := readinteger(1);
end;
@* INDEX.
|