Commit fbd838552ddd282768775970d9bedc4afab148fa

Stefan Reinauer 2006-08-18T12:47:12

initial merge of David Paktor's fine work. I redid all of the Makefiles and fixed some minor issues with the code. git-svn-id: svn://coreboot.org/openbios/fcode-utils@76 f158a5a8-5612-0410-a976-696ce0be7e32

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
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
16449
16450
16451
16452
16453
16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
16464
16465
16466
16467
16468
16469
16470
16471
16472
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
16492
16493
16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508
16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
16562
16563
16564
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591
16592
16593
16594
16595
16596
16597
16598
16599
16600
16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
16611
16612
16613
16614
16615
16616
16617
16618
16619
16620
16621
16622
16623
16624
16625
16626
16627
16628
16629
16630
16631
16632
16633
16634
16635
16636
16637
16638
16639
16640
16641
16642
16643
16644
16645
16646
16647
16648
16649
16650
16651
16652
16653
16654
16655
16656
16657
16658
16659
16660
16661
16662
16663
16664
16665
16666
16667
16668
16669
16670
16671
16672
16673
16674
16675
16676
16677
16678
16679
16680
16681
16682
16683
16684
16685
16686
16687
16688
16689
16690
16691
16692
16693
16694
16695
16696
16697
16698
16699
16700
16701
16702
16703
16704
16705
16706
16707
16708
16709
16710
16711
16712
16713
16714
16715
16716
16717
16718
16719
16720
16721
16722
16723
16724
16725
16726
16727
16728
16729
16730
16731
16732
16733
16734
16735
16736
16737
16738
16739
16740
16741
16742
16743
16744
16745
16746
16747
16748
16749
16750
16751
16752
16753
16754
16755
16756
16757
16758
16759
16760
16761
16762
16763
16764
16765
16766
16767
16768
16769
16770
16771
16772
16773
16774
16775
16776
16777
16778
16779
16780
16781
16782
16783
16784
16785
16786
16787
16788
16789
16790
16791
16792
16793
16794
16795
16796
16797
16798
16799
16800
16801
16802
16803
16804
16805
16806
16807
16808
16809
16810
16811
16812
16813
16814
16815
16816
16817
16818
16819
16820
16821
16822
16823
16824
16825
16826
16827
16828
16829
16830
16831
16832
16833
16834
16835
16836
16837
16838
16839
16840
16841
16842
16843
16844
16845
16846
16847
16848
16849
16850
16851
16852
16853
16854
16855
16856
16857
16858
16859
16860
16861
16862
16863
16864
16865
16866
16867
16868
16869
16870
16871
16872
16873
16874
16875
16876
16877
16878
16879
16880
16881
16882
16883
16884
16885
16886
16887
16888
16889
16890
16891
16892
16893
16894
16895
16896
16897
16898
16899
16900
16901
16902
16903
16904
16905
16906
16907
16908
16909
16910
16911
16912
16913
16914
16915
16916
16917
16918
16919
16920
16921
16922
16923
16924
16925
16926
16927
16928
16929
16930
16931
16932
16933
16934
16935
16936
16937
16938
16939
16940
16941
16942
16943
16944
16945
16946
16947
16948
16949
16950
16951
16952
16953
16954
16955
16956
16957
16958
16959
16960
16961
16962
16963
16964
16965
16966
16967
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977
16978
16979
16980
16981
16982
16983
16984
16985
16986
16987
16988
16989
16990
16991
16992
16993
16994
16995
16996
16997
16998
16999
17000
17001
17002
17003
17004
17005
17006
17007
17008
17009
17010
17011
17012
17013
17014
17015
17016
17017
17018
17019
17020
17021
17022
17023
17024
17025
17026
17027
17028
17029
17030
17031
17032
17033
17034
17035
17036
17037
17038
17039
17040
17041
17042
17043
17044
17045
17046
17047
17048
17049
17050
17051
17052
17053
17054
17055
17056
17057
17058
17059
17060
17061
17062
17063
17064
17065
17066
17067
17068
17069
17070
17071
17072
17073
17074
17075
17076
17077
17078
17079
17080
17081
17082
17083
17084
17085
17086
17087
17088
17089
17090
17091
17092
17093
17094
17095
17096
17097
17098
17099
17100
17101
17102
17103
17104
17105
17106
17107
17108
17109
17110
17111
17112
17113
17114
17115
17116
17117
17118
17119
17120
17121
17122
17123
17124
17125
17126
17127
17128
17129
17130
17131
17132
17133
17134
17135
17136
17137
17138
17139
17140
17141
17142
17143
17144
17145
17146
17147
17148
17149
17150
17151
17152
17153
17154
17155
17156
17157
17158
17159
17160
17161
17162
17163
17164
17165
17166
17167
17168
17169
17170
17171
17172
17173
17174
17175
17176
17177
17178
17179
17180
17181
17182
17183
17184
17185
17186
17187
17188
17189
17190
17191
17192
17193
17194
17195
17196
17197
17198
17199
17200
17201
17202
17203
17204
17205
17206
17207
17208
17209
17210
17211
17212
17213
17214
17215
17216
17217
17218
17219
17220
17221
17222
17223
17224
17225
17226
17227
17228
17229
17230
17231
17232
17233
17234
17235
17236
17237
17238
17239
17240
17241
17242
17243
17244
17245
17246
17247
17248
17249
17250
17251
17252
17253
17254
17255
17256
17257
17258
17259
17260
17261
17262
17263
17264
17265
17266
17267
17268
17269
17270
17271
17272
17273
17274
17275
17276
17277
17278
17279
17280
17281
17282
17283
17284
17285
17286
17287
17288
17289
17290
17291
17292
17293
17294
17295
17296
17297
17298
17299
17300
17301
17302
17303
17304
17305
17306
17307
17308
17309
17310
17311
17312
17313
17314
17315
17316
17317
17318
17319
17320
17321
17322
17323
17324
17325
17326
17327
17328
17329
17330
17331
17332
17333
17334
17335
17336
17337
17338
17339
17340
17341
17342
17343
17344
17345
17346
17347
17348
17349
17350
17351
17352
17353
17354
17355
17356
17357
17358
17359
17360
17361
17362
17363
17364
17365
17366
17367
17368
17369
17370
17371
17372
17373
17374
17375
17376
17377
17378
17379
17380
17381
17382
17383
17384
17385
17386
17387
17388
17389
17390
17391
17392
17393
17394
17395
17396
17397
17398
17399
17400
17401
17402
17403
17404
17405
17406
17407
17408
17409
17410
17411
17412
17413
17414
17415
17416
17417
17418
17419
17420
17421
17422
17423
17424
17425
17426
17427
17428
17429
17430
17431
17432
17433
17434
17435
17436
17437
17438
17439
17440
17441
17442
17443
17444
17445
17446
17447
17448
17449
17450
17451
17452
17453
17454
17455
17456
17457
17458
17459
17460
17461
17462
17463
17464
17465
17466
17467
17468
17469
17470
17471
17472
17473
17474
17475
17476
17477
17478
17479
17480
17481
17482
17483
17484
17485
17486
17487
17488
17489
17490
17491
17492
17493
17494
17495
17496
17497
17498
17499
17500
17501
17502
17503
17504
17505
17506
17507
17508
17509
17510
17511
17512
17513
17514
17515
17516
17517
17518
17519
17520
17521
17522
17523
17524
17525
17526
17527
17528
17529
17530
17531
17532
17533
17534
17535
17536
17537
17538
17539
17540
17541
17542
17543
17544
17545
17546
17547
17548
17549
17550
17551
17552
17553
17554
17555
17556
17557
17558
17559
17560
17561
17562
17563
17564
17565
17566
17567
17568
17569
17570
17571
17572
17573
17574
17575
17576
17577
17578
17579
17580
17581
17582
17583
17584
17585
17586
17587
17588
17589
17590
17591
17592
17593
17594
17595
17596
17597
17598
17599
17600
17601
17602
17603
17604
17605
17606
17607
17608
17609
17610
17611
17612
17613
17614
17615
17616
17617
17618
17619
17620
17621
17622
17623
17624
17625
17626
17627
17628
17629
17630
17631
17632
17633
17634
17635
17636
17637
17638
17639
17640
17641
17642
17643
17644
17645
17646
17647
17648
17649
17650
17651
17652
17653
17654
17655
17656
17657
17658
17659
17660
17661
17662
17663
17664
17665
17666
17667
17668
17669
17670
17671
17672
17673
17674
17675
17676
17677
17678
17679
17680
17681
17682
17683
17684
17685
17686
17687
17688
17689
17690
17691
17692
17693
17694
17695
17696
17697
17698
17699
17700
17701
17702
17703
17704
17705
17706
17707
17708
17709
17710
17711
17712
17713
17714
17715
17716
17717
17718
17719
17720
17721
17722
17723
17724
17725
17726
17727
17728
17729
17730
17731
17732
17733
17734
17735
17736
17737
17738
17739
17740
17741
17742
17743
17744
17745
17746
17747
17748
17749
17750
17751
17752
17753
17754
17755
17756
17757
17758
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
17771
17772
17773
17774
17775
17776
17777
17778
17779
17780
17781
17782
17783
17784
17785
17786
17787
17788
17789
17790
17791
17792
17793
17794
17795
17796
17797
17798
17799
17800
17801
17802
17803
17804
17805
17806
17807
17808
17809
17810
17811
17812
17813
17814
17815
17816
17817
17818
17819
17820
17821
17822
17823
17824
17825
17826
17827
17828
17829
17830
17831
17832
17833
17834
17835
17836
17837
17838
17839
17840
17841
17842
17843
17844
17845
17846
17847
17848
17849
17850
17851
17852
17853
17854
17855
17856
17857
17858
17859
17860
17861
17862
17863
17864
17865
17866
17867
17868
17869
17870
17871
17872
17873
17874
17875
17876
17877
17878
17879
17880
17881
17882
17883
17884
17885
17886
17887
17888
17889
17890
17891
17892
17893
17894
17895
17896
17897
17898
17899
17900
17901
17902
17903
17904
17905
17906
17907
17908
17909
17910
17911
17912
17913
17914
17915
17916
17917
17918
17919
17920
17921
17922
17923
17924
17925
17926
17927
17928
17929
17930
17931
17932
17933
17934
17935
17936
17937
17938
17939
17940
17941
17942
17943
17944
17945
17946
17947
17948
17949
17950
17951
17952
17953
17954
17955
17956
17957
17958
17959
17960
17961
17962
17963
17964
17965
17966
17967
17968
17969
17970
17971
17972
17973
17974
17975
17976
17977
17978
17979
17980
17981
17982
17983
17984
17985
17986
17987
17988
17989
17990
17991
17992
17993
17994
17995
17996
17997
17998
17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019
18020
18021
18022
18023
18024
18025
18026
18027
18028
18029
18030
18031
18032
18033
18034
18035
18036
18037
18038
18039
18040
18041
18042
18043
18044
18045
18046
18047
18048
18049
18050
18051
18052
18053
18054
18055
18056
18057
18058
18059
18060
18061
18062
18063
18064
18065
18066
18067
18068
18069
18070
18071
18072
18073
18074
18075
18076
18077
18078
18079
18080
18081
18082
18083
18084
18085
18086
18087
18088
18089
18090
18091
18092
18093
18094
18095
18096
18097
18098
18099
18100
18101
18102
18103
18104
18105
18106
18107
18108
18109
18110
18111
18112
18113
18114
18115
18116
18117
18118
18119
18120
18121
18122
18123
18124
18125
18126
18127
18128
18129
18130
18131
18132
18133
18134
18135
18136
18137
18138
18139
18140
18141
18142
18143
18144
18145
18146
18147
18148
18149
18150
18151
18152
18153
18154
18155
18156
18157
18158
18159
18160
18161
18162
18163
18164
18165
18166
18167
18168
18169
18170
18171
18172
18173
18174
18175
18176
18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
18209
18210
18211
18212
18213
18214
18215
18216
18217
18218
18219
18220
18221
18222
18223
18224
18225
18226
18227
18228
18229
18230
18231
18232
18233
18234
18235
18236
18237
18238
18239
18240
18241
18242
18243
18244
18245
18246
18247
18248
18249
18250
18251
18252
18253
18254
18255
18256
18257
18258
18259
18260
18261
18262
18263
18264
18265
18266
18267
18268
18269
18270
18271
18272
18273
18274
18275
18276
18277
18278
18279
18280
18281
18282
18283
18284
18285
18286
18287
18288
18289
18290
18291
18292
18293
18294
18295
18296
18297
18298
18299
18300
18301
18302
18303
18304
18305
18306
18307
18308
18309
18310
18311
18312
18313
18314
18315
18316
18317
18318
18319
18320
18321
18322
18323
18324
18325
18326
18327
18328
18329
18330
18331
18332
18333
18334
18335
18336
18337
18338
18339
18340
18341
18342
18343
18344
18345
18346
18347
18348
18349
18350
18351
18352
18353
18354
18355
18356
18357
18358
18359
18360
18361
18362
18363
18364
18365
18366
18367
18368
18369
18370
18371
18372
18373
18374
18375
18376
18377
18378
18379
18380
18381
18382
18383
18384
18385
18386
18387
18388
18389
18390
18391
18392
18393
18394
18395
18396
18397
18398
18399
18400
18401
18402
18403
18404
18405
18406
18407
18408
18409
18410
18411
18412
18413
18414
18415
18416
18417
18418
18419
18420
18421
18422
18423
18424
18425
18426
18427
18428
18429
18430
18431
18432
18433
18434
18435
18436
18437
18438
18439
18440
18441
18442
18443
18444
18445
18446
18447
18448
18449
18450
18451
18452
18453
18454
18455
18456
18457
18458
18459
18460
18461
18462
18463
18464
18465
18466
18467
18468
18469
18470
18471
18472
18473
18474
18475
18476
18477
18478
18479
18480
18481
18482
18483
18484
18485
18486
18487
18488
18489
18490
18491
18492
18493
18494
18495
18496
18497
18498
18499
18500
18501
18502
18503
18504
18505
18506
18507
18508
18509
18510
18511
18512
18513
18514
18515
18516
18517
18518
18519
18520
18521
18522
18523
18524
18525
18526
18527
18528
18529
18530
18531
18532
18533
18534
18535
18536
18537
18538
18539
18540
18541
18542
18543
18544
18545
18546
18547
18548
18549
18550
18551
18552
18553
18554
18555
18556
18557
18558
18559
18560
18561
18562
18563
18564
18565
18566
18567
18568
18569
18570
18571
18572
18573
18574
18575
18576
18577
18578
18579
18580
18581
18582
18583
18584
18585
18586
18587
18588
18589
18590
18591
18592
18593
18594
18595
18596
18597
18598
18599
18600
18601
18602
18603
18604
18605
18606
18607
18608
18609
18610
18611
18612
18613
18614
18615
18616
18617
18618
18619
18620
18621
18622
18623
18624
18625
18626
18627
18628
18629
18630
18631
18632
18633
18634
18635
18636
18637
18638
18639
18640
18641
18642
18643
18644
18645
18646
18647
18648
18649
18650
18651
18652
18653
18654
18655
18656
18657
18658
18659
18660
18661
18662
18663
18664
18665
18666
18667
18668
18669
18670
18671
18672
18673
18674
18675
18676
18677
18678
18679
18680
18681
18682
18683
18684
18685
18686
18687
18688
18689
18690
18691
18692
18693
18694
18695
18696
18697
18698
18699
18700
18701
18702
18703
18704
18705
18706
18707
18708
18709
18710
18711
18712
18713
18714
18715
18716
18717
18718
18719
18720
18721
18722
18723
18724
18725
18726
18727
18728
18729
18730
18731
18732
18733
18734
18735
18736
18737
18738
18739
18740
18741
18742
18743
18744
18745
18746
18747
18748
18749
18750
18751
18752
18753
18754
18755
18756
18757
18758
18759
18760
18761
18762
18763
18764
18765
18766
18767
18768
18769
18770
18771
18772
18773
18774
18775
18776
18777
18778
18779
18780
18781
18782
18783
18784
18785
18786
18787
18788
18789
18790
18791
18792
18793
18794
18795
18796
18797
18798
18799
18800
18801
18802
18803
18804
18805
18806
18807
18808
18809
18810
18811
18812
18813
18814
18815
18816
18817
18818
18819
18820
18821
18822
18823
18824
18825
18826
18827
18828
18829
18830
18831
18832
18833
18834
18835
18836
18837
18838
18839
18840
18841
18842
18843
18844
18845
18846
18847
18848
18849
18850
18851
18852
18853
18854
18855
18856
18857
18858
18859
18860
18861
18862
18863
18864
18865
18866
18867
18868
18869
18870
18871
18872
18873
18874
18875
18876
18877
18878
18879
18880
18881
18882
18883
18884
18885
18886
18887
18888
18889
18890
18891
18892
18893
18894
18895
18896
18897
18898
18899
18900
18901
18902
18903
18904
18905
18906
18907
18908
18909
18910
18911
18912
18913
18914
18915
18916
18917
18918
18919
18920
18921
18922
18923
18924
18925
18926
18927
18928
18929
18930
18931
18932
18933
18934
18935
18936
18937
18938
18939
18940
18941
18942
18943
18944
18945
18946
18947
18948
18949
18950
18951
18952
18953
18954
18955
18956
18957
18958
18959
18960
18961
18962
18963
18964
18965
18966
18967
18968
18969
18970
18971
18972
18973
18974
18975
18976
18977
18978
18979
18980
18981
18982
18983
18984
18985
18986
18987
18988
18989
18990
18991
18992
18993
18994
18995
18996
18997
18998
18999
19000
19001
19002
19003
19004
19005
19006
19007
19008
19009
19010
19011
19012
19013
19014
19015
19016
19017
19018
19019
19020
19021
19022
19023
19024
19025
19026
19027
19028
19029
19030
19031
19032
19033
19034
19035
19036
19037
19038
19039
19040
19041
19042
19043
19044
19045
19046
19047
19048
19049
19050
19051
19052
19053
19054
19055
19056
19057
19058
19059
19060
19061
19062
19063
19064
19065
19066
19067
19068
19069
19070
19071
19072
19073
19074
19075
19076
19077
19078
19079
19080
19081
19082
19083
19084
19085
19086
19087
19088
19089
19090
19091
19092
19093
19094
19095
19096
19097
19098
19099
19100
19101
19102
19103
19104
19105
19106
19107
19108
19109
19110
19111
19112
19113
19114
19115
19116
19117
19118
19119
19120
19121
19122
19123
19124
19125
19126
19127
19128
19129
19130
19131
19132
19133
19134
19135
19136
19137
19138
19139
19140
19141
19142
19143
19144
19145
19146
19147
19148
19149
19150
19151
19152
19153
19154
19155
19156
19157
19158
19159
19160
19161
19162
19163
19164
19165
19166
19167
19168
19169
19170
19171
19172
19173
19174
19175
19176
19177
19178
19179
19180
19181
19182
19183
19184
19185
19186
19187
19188
19189
19190
19191
19192
19193
19194
19195
19196
19197
19198
19199
19200
19201
19202
19203
19204
19205
19206
19207
19208
19209
19210
19211
19212
19213
19214
19215
19216
19217
19218
19219
19220
19221
19222
19223
19224
19225
19226
19227
19228
19229
19230
19231
19232
19233
19234
19235
19236
19237
19238
19239
19240
19241
19242
19243
19244
19245
19246
19247
19248
19249
19250
19251
19252
19253
19254
19255
19256
19257
19258
19259
19260
19261
19262
19263
19264
19265
19266
19267
19268
19269
19270
19271
19272
19273
19274
19275
19276
19277
19278
19279
19280
19281
19282
19283
19284
19285
19286
19287
19288
19289
19290
19291
19292
19293
19294
19295
19296
19297
19298
19299
19300
19301
19302
19303
19304
19305
19306
19307
19308
19309
19310
19311
19312
19313
19314
19315
19316
19317
19318
19319
19320
19321
19322
19323
19324
19325
19326
19327
19328
19329
19330
19331
19332
19333
19334
19335
19336
19337
19338
19339
19340
19341
19342
19343
19344
19345
19346
19347
19348
19349
19350
19351
19352
19353
19354
19355
19356
19357
19358
19359
19360
19361
19362
19363
19364
19365
19366
19367
19368
19369
19370
19371
19372
19373
19374
19375
19376
19377
19378
19379
19380
19381
19382
19383
19384
19385
19386
19387
19388
19389
19390
19391
19392
19393
19394
19395
19396
19397
19398
19399
19400
19401
19402
19403
19404
19405
19406
19407
19408
19409
19410
19411
19412
19413
19414
19415
19416
19417
19418
19419
19420
19421
19422
19423
19424
19425
19426
19427
19428
19429
19430
19431
19432
19433
19434
19435
19436
19437
19438
19439
19440
19441
19442
19443
19444
19445
19446
19447
19448
19449
19450
19451
19452
19453
19454
19455
19456
19457
19458
19459
19460
19461
19462
19463
19464
19465
19466
19467
19468
19469
19470
19471
19472
19473
19474
19475
19476
19477
19478
19479
19480
19481
19482
19483
19484
19485
19486
19487
19488
19489
19490
19491
19492
19493
19494
19495
19496
19497
19498
19499
19500
19501
19502
19503
19504
19505
19506
19507
19508
19509
19510
19511
19512
19513
19514
19515
19516
19517
19518
19519
19520
19521
19522
19523
19524
19525
19526
19527
19528
19529
19530
19531
19532
19533
19534
19535
19536
19537
19538
19539
19540
19541
19542
19543
19544
19545
19546
19547
19548
19549
19550
19551
19552
19553
19554
19555
19556
19557
19558
19559
19560
19561
19562
19563
19564
19565
19566
19567
19568
19569
19570
19571
19572
19573
19574
19575
19576
19577
19578
19579
19580
19581
19582
19583
19584
19585
19586
19587
19588
19589
19590
19591
19592
19593
19594
19595
19596
19597
19598
19599
19600
19601
19602
19603
19604
19605
19606
19607
19608
19609
19610
19611
19612
19613
19614
19615
19616
19617
19618
19619
19620
19621
19622
19623
19624
19625
19626
19627
19628
19629
19630
19631
19632
19633
19634
19635
19636
19637
19638
19639
19640
19641
19642
19643
19644
19645
19646
19647
19648
19649
19650
19651
19652
19653
19654
19655
19656
19657
19658
19659
19660
19661
19662
19663
19664
19665
19666
19667
19668
19669
19670
19671
19672
19673
19674
19675
19676
19677
19678
19679
19680
19681
19682
19683
19684
19685
19686
19687
19688
19689
19690
19691
19692
19693
19694
19695
19696
19697
19698
19699
19700
19701
19702
19703
19704
19705
19706
19707
19708
19709
19710
19711
19712
19713
19714
19715
19716
19717
19718
19719
19720
19721
19722
19723
19724
19725
19726
19727
19728
19729
19730
19731
19732
19733
19734
19735
19736
19737
19738
19739
19740
19741
19742
19743
19744
19745
19746
19747
19748
19749
19750
19751
19752
19753
19754
19755
19756
19757
19758
19759
19760
19761
19762
19763
19764
19765
19766
19767
19768
19769
19770
19771
19772
19773
19774
19775
19776
19777
19778
19779
19780
19781
19782
19783
19784
19785
19786
19787
19788
19789
19790
19791
19792
19793
19794
19795
19796
19797
19798
19799
19800
19801
19802
19803
19804
19805
19806
19807
19808
19809
19810
19811
19812
19813
19814
19815
19816
19817
19818
19819
19820
19821
19822
19823
19824
19825
19826
19827
19828
19829
19830
19831
19832
19833
19834
19835
19836
19837
19838
19839
19840
19841
19842
19843
19844
19845
19846
19847
19848
19849
19850
19851
19852
19853
19854
19855
19856
19857
19858
19859
19860
19861
19862
19863
19864
19865
19866
19867
19868
19869
19870
19871
19872
19873
19874
19875
19876
19877
19878
19879
19880
19881
19882
19883
19884
19885
19886
19887
19888
19889
19890
19891
19892
19893
19894
19895
19896
19897
19898
19899
19900
19901
19902
19903
19904
19905
19906
19907
19908
19909
19910
19911
19912
19913
19914
19915
19916
19917
19918
19919
19920
19921
19922
19923
19924
19925
19926
19927
19928
19929
19930
19931
19932
19933
19934
19935
19936
19937
19938
19939
19940
19941
19942
19943
19944
19945
19946
19947
19948
19949
19950
19951
19952
19953
19954
19955
19956
19957
19958
19959
19960
19961
19962
19963
19964
19965
19966
19967
19968
19969
19970
19971
19972
19973
19974
19975
19976
19977
19978
19979
19980
19981
19982
19983
19984
19985
19986
19987
19988
19989
19990
19991
19992
19993
19994
19995
19996
19997
19998
19999
20000
20001
20002
20003
20004
20005
20006
20007
20008
20009
20010
20011
20012
20013
20014
20015
20016
20017
20018
20019
20020
20021
20022
20023
20024
20025
20026
20027
20028
20029
20030
20031
20032
20033
20034
20035
20036
20037
20038
20039
20040
20041
20042
20043
20044
20045
20046
20047
20048
20049
20050
20051
20052
20053
20054
20055
20056
20057
20058
20059
20060
20061
20062
20063
20064
20065
20066
20067
20068
20069
20070
20071
20072
20073
20074
20075
20076
20077
20078
20079
20080
20081
20082
20083
20084
20085
20086
20087
20088
20089
20090
20091
20092
20093
20094
20095
20096
20097
20098
20099
20100
20101
20102
20103
20104
20105
20106
20107
20108
20109
20110
20111
20112
20113
20114
20115
20116
20117
20118
20119
20120
20121
20122
20123
20124
20125
20126
20127
20128
20129
20130
20131
20132
20133
20134
20135
20136
20137
20138
20139
20140
20141
20142
20143
20144
20145
20146
20147
20148
20149
20150
20151
20152
20153
20154
20155
20156
20157
20158
20159
20160
20161
20162
20163
20164
20165
20166
20167
20168
20169
20170
20171
20172
20173
20174
20175
20176
20177
20178
20179
20180
20181
20182
20183
20184
20185
20186
20187
20188
20189
20190
20191
20192
20193
20194
20195
20196
20197
20198
20199
20200
20201
20202
20203
20204
20205
20206
20207
20208
20209
20210
20211
20212
20213
20214
20215
20216
20217
20218
20219
20220
20221
20222
20223
20224
20225
20226
20227
20228
20229
20230
20231
20232
20233
20234
20235
20236
20237
20238
20239
20240
20241
20242
20243
20244
20245
20246
20247
20248
20249
20250
20251
20252
20253
20254
20255
20256
20257
20258
20259
20260
20261
20262
20263
20264
20265
20266
20267
20268
20269
20270
20271
20272
20273
20274
20275
20276
20277
20278
20279
20280
20281
20282
20283
20284
20285
20286
20287
20288
20289
20290
20291
20292
20293
20294
20295
20296
20297
20298
20299
20300
20301
20302
20303
20304
20305
20306
20307
20308
20309
20310
20311
20312
20313
20314
20315
20316
20317
20318
20319
20320
20321
20322
20323
20324
20325
20326
20327
20328
20329
20330
20331
20332
20333
20334
20335
20336
20337
20338
20339
20340
20341
20342
20343
20344
20345
20346
20347
20348
20349
20350
20351
20352
20353
20354
20355
20356
20357
20358
20359
20360
20361
20362
20363
20364
20365
20366
20367
20368
20369
20370
20371
20372
20373
20374
20375
20376
20377
20378
20379
20380
20381
20382
20383
20384
20385
20386
20387
20388
20389
20390
20391
20392
20393
20394
20395
20396
20397
20398
20399
20400
20401
20402
20403
20404
20405
20406
20407
20408
20409
20410
20411
20412
20413
20414
20415
20416
20417
20418
20419
20420
20421
20422
20423
20424
20425
20426
20427
20428
20429
20430
20431
20432
20433
20434
20435
20436
20437
20438
20439
20440
20441
20442
20443
20444
20445
20446
20447
20448
20449
20450
20451
20452
20453
20454
20455
20456
20457
20458
20459
20460
20461
20462
20463
20464
20465
20466
20467
20468
20469
20470
20471
20472
20473
20474
20475
20476
20477
20478
20479
20480
20481
20482
20483
20484
20485
20486
20487
20488
20489
20490
20491
20492
20493
20494
20495
20496
20497
20498
20499
20500
20501
20502
20503
20504
20505
20506
20507
20508
20509
20510
20511
20512
20513
20514
20515
20516
20517
20518
20519
20520
20521
20522
20523
20524
20525
20526
20527
20528
20529
20530
20531
20532
20533
20534
20535
20536
20537
20538
20539
20540
20541
20542
20543
20544
20545
20546
20547
20548
20549
20550
20551
20552
20553
20554
20555
20556
20557
20558
20559
20560
20561
20562
20563
20564
20565
20566
20567
20568
20569
20570
20571
20572
20573
20574
20575
20576
20577
20578
20579
20580
20581
20582
20583
20584
20585
20586
20587
20588
20589
20590
20591
20592
20593
20594
20595
20596
20597
20598
20599
20600
20601
20602
20603
20604
20605
20606
20607
20608
20609
20610
20611
20612
20613
20614
20615
20616
20617
20618
20619
20620
20621
20622
20623
20624
20625
20626
20627
20628
20629
20630
20631
20632
20633
20634
20635
20636
20637
20638
20639
20640
20641
20642
20643
20644
20645
20646
20647
20648
20649
20650
20651
20652
20653
20654
20655
20656
20657
20658
20659
20660
20661
20662
20663
20664
20665
20666
20667
20668
20669
20670
20671
20672
20673
20674
20675
20676
20677
20678
20679
20680
20681
20682
20683
20684
20685
20686
20687
20688
20689
20690
20691
20692
20693
20694
20695
20696
20697
20698
20699
20700
20701
20702
20703
20704
20705
20706
20707
20708
20709
20710
20711
20712
20713
20714
20715
20716
20717
20718
20719
20720
20721
20722
20723
20724
20725
20726
20727
20728
20729
20730
20731
20732
20733
20734
20735
20736
20737
20738
20739
20740
20741
20742
20743
20744
20745
20746
20747
20748
20749
20750
20751
20752
20753
20754
20755
20756
20757
20758
20759
20760
20761
20762
20763
20764
20765
20766
20767
20768
20769
20770
20771
20772
20773
20774
20775
20776
20777
20778
20779
20780
20781
20782
20783
20784
20785
20786
20787
20788
20789
20790
20791
20792
20793
20794
20795
20796
20797
20798
20799
20800
20801
20802
20803
20804
20805
20806
20807
20808
20809
20810
20811
20812
20813
20814
20815
20816
20817
20818
20819
20820
20821
20822
20823
20824
20825
20826
20827
20828
20829
20830
20831
20832
20833
20834
20835
20836
20837
20838
20839
20840
20841
20842
20843
20844
20845
20846
20847
20848
20849
20850
20851
20852
20853
20854
20855
20856
20857
20858
20859
20860
20861
20862
20863
20864
20865
20866
20867
20868
20869
20870
20871
20872
20873
20874
20875
20876
20877
20878
20879
20880
20881
20882
20883
20884
20885
20886
20887
20888
20889
20890
20891
20892
20893
20894
20895
20896
20897
20898
20899
20900
20901
20902
20903
20904
20905
20906
20907
20908
20909
20910
20911
20912
20913
20914
20915
20916
20917
20918
20919
20920
20921
20922
20923
20924
20925
20926
20927
20928
20929
20930
20931
20932
20933
20934
20935
20936
20937
20938
20939
20940
20941
20942
20943
20944
20945
20946
20947
20948
20949
20950
20951
20952
20953
20954
20955
20956
20957
20958
20959
20960
20961
20962
20963
20964
20965
20966
20967
20968
20969
20970
20971
20972
20973
20974
20975
20976
20977
20978
20979
20980
20981
20982
20983
20984
20985
20986
20987
20988
20989
20990
20991
20992
20993
20994
20995
20996
20997
20998
20999
21000
21001
21002
21003
21004
21005
21006
21007
21008
21009
21010
21011
21012
21013
21014
21015
21016
21017
21018
21019
21020
21021
21022
21023
21024
21025
21026
21027
21028
21029
21030
21031
21032
21033
21034
21035
21036
21037
21038
21039
21040
21041
21042
21043
21044
21045
21046
21047
21048
21049
21050
21051
21052
21053
21054
21055
21056
21057
21058
21059
21060
21061
21062
21063
21064
21065
21066
21067
21068
21069
21070
21071
21072
21073
21074
21075
21076
21077
21078
21079
21080
21081
21082
21083
21084
21085
21086
21087
21088
21089
21090
21091
21092
21093
21094
21095
21096
21097
21098
21099
21100
21101
21102
21103
21104
21105
21106
21107
21108
21109
21110
21111
21112
21113
21114
21115
21116
21117
21118
21119
21120
21121
21122
21123
21124
21125
21126
21127
21128
21129
21130
21131
21132
21133
21134
21135
21136
21137
21138
21139
21140
21141
21142
21143
21144
21145
21146
21147
21148
21149
21150
21151
21152
21153
21154
21155
21156
21157
21158
21159
21160
21161
21162
21163
21164
21165
21166
21167
21168
21169
21170
21171
21172
21173
21174
21175
21176
21177
21178
21179
21180
21181
21182
21183
21184
21185
21186
21187
21188
21189
21190
21191
21192
21193
21194
21195
21196
21197
21198
21199
21200
21201
21202
21203
21204
21205
21206
21207
21208
21209
21210
21211
21212
21213
21214
21215
21216
21217
21218
21219
21220
21221
21222
21223
21224
21225
21226
21227
21228
21229
21230
21231
21232
21233
21234
21235
21236
21237
21238
21239
21240
21241
21242
21243
21244
21245
21246
21247
21248
21249
21250
21251
21252
21253
21254
21255
21256
21257
21258
21259
21260
21261
21262
21263
21264
21265
21266
21267
21268
21269
21270
21271
21272
21273
21274
21275
21276
21277
21278
21279
21280
21281
21282
21283
21284
21285
21286
21287
21288
21289
21290
21291
21292
21293
21294
21295
21296
21297
21298
21299
21300
21301
21302
21303
21304
21305
21306
21307
21308
21309
21310
21311
21312
21313
21314
21315
21316
21317
21318
21319
21320
21321
21322
21323
21324
21325
21326
21327
21328
21329
21330
21331
21332
21333
21334
21335
21336
21337
21338
21339
21340
21341
21342
21343
21344
21345
21346
21347
21348
21349
21350
21351
21352
21353
21354
21355
21356
21357
21358
21359
21360
21361
21362
21363
21364
21365
21366
21367
21368
21369
21370
21371
21372
21373
21374
21375
21376
21377
21378
21379
21380
21381
21382
21383
21384
21385
21386
21387
21388
21389
21390
21391
21392
21393
21394
21395
21396
21397
21398
21399
21400
21401
21402
21403
21404
21405
21406
21407
21408
21409
21410
21411
21412
21413
21414
21415
21416
21417
21418
21419
21420
21421
21422
21423
21424
21425
21426
21427
21428
21429
21430
21431
21432
21433
21434
21435
21436
21437
21438
21439
21440
21441
21442
21443
21444
21445
21446
21447
21448
21449
21450
21451
21452
21453
21454
21455
21456
21457
21458
21459
21460
21461
21462
21463
21464
21465
21466
21467
21468
21469
21470
21471
21472
21473
21474
21475
21476
21477
21478
21479
21480
21481
21482
21483
21484
21485
21486
21487
21488
21489
21490
21491
21492
21493
21494
21495
21496
21497
21498
21499
21500
21501
21502
21503
21504
21505
21506
21507
21508
21509
21510
21511
21512
21513
21514
21515
21516
21517
21518
21519
21520
21521
21522
21523
21524
21525
21526
21527
21528
21529
21530
21531
21532
21533
21534
21535
21536
21537
21538
21539
21540
21541
21542
21543
21544
21545
21546
21547
21548
21549
21550
21551
21552
21553
21554
21555
21556
21557
21558
21559
21560
21561
21562
21563
21564
21565
21566
21567
21568
21569
21570
21571
21572
21573
21574
21575
21576
21577
21578
21579
21580
21581
21582
21583
21584
21585
21586
21587
21588
21589
21590
21591
21592
21593
21594
21595
21596
21597
21598
21599
21600
21601
21602
21603
21604
21605
21606
21607
21608
21609
21610
21611
21612
21613
21614
21615
21616
21617
21618
21619
21620
21621
21622
21623
21624
21625
21626
21627
21628
21629
21630
21631
21632
21633
21634
21635
21636
21637
21638
21639
21640
21641
21642
21643
21644
21645
21646
21647
21648
21649
21650
21651
21652
21653
21654
21655
21656
21657
21658
21659
21660
21661
21662
21663
21664
21665
21666
21667
21668
21669
21670
21671
21672
21673
21674
21675
21676
21677
21678
21679
21680
21681
21682
21683
21684
21685
21686
21687
21688
21689
21690
21691
21692
21693
21694
21695
21696
21697
21698
21699
21700
21701
21702
21703
21704
21705
21706
21707
21708
21709
21710
21711
21712
21713
21714
21715
21716
21717
21718
21719
21720
21721
21722
21723
21724
21725
21726
21727
21728
21729
21730
21731
21732
21733
21734
21735
21736
21737
21738
21739
21740
21741
21742
21743
21744
21745
21746
21747
21748
21749
21750
21751
21752
21753
21754
21755
21756
21757
21758
21759
21760
21761
21762
21763
21764
21765
21766
21767
21768
21769
21770
21771
21772
21773
21774
21775
21776
21777
21778
21779
21780
21781
21782
21783
21784
21785
21786
21787
21788
21789
21790
21791
21792
21793
21794
21795
21796
21797
21798
21799
21800
21801
21802
21803
21804
21805
21806
21807
21808
21809
21810
21811
21812
21813
21814
21815
21816
21817
21818
21819
21820
21821
21822
21823
21824
21825
21826
21827
21828
21829
21830
21831
21832
21833
21834
21835
21836
21837
21838
21839
21840
21841
21842
21843
21844
21845
21846
21847
21848
21849
21850
21851
21852
21853
21854
21855
21856
21857
21858
21859
21860
21861
21862
21863
21864
21865
21866
21867
21868
21869
21870
21871
21872
21873
21874
21875
21876
21877
21878
21879
21880
21881
21882
21883
21884
21885
21886
21887
21888
21889
21890
21891
21892
21893
21894
21895
21896
21897
21898
21899
21900
21901
21902
21903
21904
21905
21906
21907
21908
21909
21910
21911
21912
21913
21914
21915
21916
21917
21918
21919
21920
21921
21922
21923
21924
21925
21926
21927
21928
21929
21930
21931
21932
21933
21934
21935
21936
21937
21938
21939
21940
21941
21942
21943
21944
21945
21946
21947
21948
21949
21950
21951
21952
21953
21954
21955
21956
21957
21958
21959
21960
21961
21962
21963
21964
21965
21966
21967
21968
21969
21970
21971
21972
21973
21974
21975
21976
21977
21978
21979
21980
21981
21982
21983
21984
21985
21986
21987
21988
21989
21990
21991
21992
21993
21994
21995
21996
21997
21998
21999
22000
22001
22002
22003
22004
22005
22006
22007
22008
22009
22010
22011
22012
22013
22014
22015
22016
22017
22018
22019
22020
22021
22022
22023
22024
22025
22026
22027
22028
22029
22030
22031
22032
22033
22034
22035
22036
22037
22038
22039
22040
22041
22042
22043
22044
22045
22046
22047
22048
22049
22050
22051
22052
22053
22054
22055
22056
22057
22058
22059
22060
22061
22062
22063
22064
22065
22066
22067
22068
22069
22070
22071
22072
22073
22074
22075
22076
22077
22078
22079
22080
22081
22082
22083
22084
22085
22086
22087
22088
22089
22090
22091
22092
22093
22094
22095
22096
22097
22098
22099
22100
22101
22102
22103
22104
22105
22106
22107
22108
22109
22110
22111
22112
22113
22114
22115
22116
22117
22118
22119
22120
22121
22122
22123
22124
22125
22126
22127
22128
22129
22130
22131
22132
22133
22134
22135
22136
22137
22138
22139
22140
22141
22142
22143
22144
22145
22146
22147
22148
22149
22150
22151
22152
22153
22154
22155
22156
22157
22158
22159
22160
22161
22162
22163
22164
22165
22166
22167
22168
22169
22170
22171
22172
22173
22174
22175
22176
22177
22178
22179
22180
22181
22182
22183
22184
22185
22186
22187
22188
22189
22190
22191
22192
22193
22194
22195
22196
22197
22198
22199
22200
22201
22202
22203
22204
22205
22206
22207
22208
22209
22210
22211
22212
22213
22214
22215
22216
22217
22218
22219
22220
22221
22222
22223
22224
22225
22226
22227
22228
22229
22230
22231
22232
22233
22234
22235
22236
22237
22238
22239
22240
22241
22242
22243
22244
22245
22246
22247
22248
22249
22250
22251
22252
22253
22254
22255
22256
22257
22258
22259
22260
22261
22262
22263
22264
22265
22266
22267
22268
22269
22270
22271
22272
22273
22274
22275
22276
22277
22278
22279
22280
22281
22282
22283
22284
22285
22286
22287
22288
22289
22290
22291
22292
22293
22294
22295
22296
22297
22298
22299
22300
22301
22302
22303
22304
22305
22306
22307
22308
22309
22310
22311
22312
22313
22314
22315
22316
22317
22318
22319
22320
22321
22322
22323
22324
22325
22326
22327
22328
22329
22330
22331
22332
22333
22334
22335
22336
22337
22338
22339
22340
22341
22342
22343
22344
22345
22346
22347
22348
22349
22350
22351
22352
22353
22354
22355
22356
22357
22358
22359
22360
22361
22362
22363
22364
22365
22366
22367
22368
22369
22370
22371
22372
22373
22374
22375
22376
22377
22378
22379
22380
22381
22382
22383
22384
22385
22386
22387
22388
22389
22390
22391
22392
22393
22394
22395
22396
22397
22398
22399
22400
22401
22402
22403
22404
22405
22406
22407
22408
22409
22410
22411
22412
22413
22414
22415
22416
22417
22418
22419
22420
22421
22422
22423
22424
22425
22426
22427
22428
22429
22430
22431
22432
22433
22434
22435
22436
22437
22438
22439
22440
22441
22442
22443
22444
22445
22446
22447
22448
22449
22450
22451
22452
22453
22454
22455
22456
22457
22458
22459
22460
22461
22462
22463
22464
22465
22466
22467
22468
22469
22470
22471
22472
22473
22474
22475
22476
22477
22478
22479
22480
22481
22482
22483
22484
22485
22486
22487
22488
22489
22490
22491
22492
22493
22494
22495
22496
22497
22498
22499
22500
22501
22502
22503
22504
22505
22506
22507
22508
22509
22510
22511
22512
22513
22514
22515
22516
22517
22518
22519
22520
22521
22522
22523
22524
22525
22526
22527
22528
22529
22530
22531
22532
22533
22534
22535
22536
22537
22538
22539
22540
22541
22542
22543
22544
22545
22546
22547
22548
22549
22550
22551
22552
22553
22554
22555
22556
22557
22558
22559
22560
22561
22562
22563
22564
22565
22566
22567
22568
22569
22570
22571
22572
22573
22574
22575
22576
22577
22578
22579
22580
22581
22582
22583
22584
22585
22586
22587
22588
22589
22590
22591
22592
22593
22594
22595
22596
22597
22598
22599
22600
22601
22602
22603
22604
22605
22606
22607
22608
22609
22610
22611
22612
22613
22614
22615
22616
22617
22618
22619
22620
22621
22622
22623
22624
22625
22626
22627
22628
22629
22630
22631
22632
22633
22634
22635
22636
22637
22638
22639
22640
22641
22642
22643
22644
22645
22646
22647
22648
22649
22650
22651
22652
22653
22654
22655
22656
22657
22658
22659
22660
22661
22662
22663
22664
22665
22666
22667
22668
22669
22670
22671
22672
22673
22674
22675
22676
22677
22678
22679
22680
22681
22682
22683
22684
22685
22686
22687
22688
22689
22690
22691
22692
22693
22694
22695
22696
22697
22698
22699
22700
22701
22702
22703
22704
22705
22706
22707
22708
22709
22710
22711
22712
22713
22714
22715
22716
22717
22718
22719
22720
22721
22722
22723
22724
22725
22726
22727
22728
22729
22730
22731
22732
22733
22734
22735
22736
22737
22738
22739
22740
22741
22742
22743
22744
22745
22746
22747
22748
22749
22750
22751
22752
22753
22754
22755
22756
22757
22758
22759
22760
22761
22762
22763
22764
22765
22766
22767
22768
22769
22770
22771
22772
22773
22774
22775
22776
22777
22778
22779
22780
22781
22782
22783
22784
22785
22786
22787
22788
22789
22790
22791
22792
22793
22794
22795
22796
22797
22798
22799
22800
22801
22802
22803
22804
22805
22806
22807
22808
22809
22810
22811
22812
22813
22814
22815
22816
22817
22818
22819
22820
22821
22822
22823
22824
22825
22826
22827
22828
22829
22830
22831
22832
22833
22834
22835
22836
22837
22838
22839
22840
22841
22842
22843
22844
22845
22846
22847
22848
22849
22850
22851
22852
22853
22854
22855
22856
22857
22858
22859
22860
22861
22862
22863
22864
22865
22866
22867
22868
22869
22870
22871
22872
22873
22874
22875
22876
22877
22878
22879
22880
22881
22882
22883
22884
22885
22886
22887
22888
22889
22890
22891
22892
22893
22894
22895
22896
22897
22898
22899
22900
22901
22902
22903
22904
22905
22906
22907
22908
22909
22910
22911
22912
22913
22914
22915
22916
22917
22918
22919
22920
22921
22922
22923
22924
22925
22926
22927
22928
22929
22930
22931
22932
22933
22934
22935
22936
22937
22938
22939
22940
22941
22942
22943
22944
22945
22946
22947
22948
22949
22950
22951
22952
22953
22954
22955
22956
22957
22958
22959
22960
22961
22962
22963
22964
22965
22966
22967
22968
22969
22970
22971
22972
22973
22974
22975
22976
22977
22978
22979
22980
22981
22982
22983
22984
22985
22986
22987
22988
22989
22990
22991
22992
22993
22994
22995
22996
22997
22998
22999
23000
23001
23002
23003
23004
23005
23006
23007
23008
23009
23010
23011
23012
23013
23014
23015
23016
23017
23018
23019
23020
23021
23022
23023
23024
23025
23026
23027
23028
23029
23030
23031
23032
23033
23034
23035
23036
23037
23038
23039
23040
23041
23042
23043
23044
23045
23046
23047
23048
23049
23050
23051
23052
23053
23054
23055
23056
23057
23058
23059
23060
23061
23062
23063
23064
23065
23066
23067
23068
23069
23070
23071
23072
23073
23074
23075
23076
23077
23078
23079
23080
23081
23082
23083
23084
23085
23086
23087
23088
23089
23090
23091
23092
23093
23094
23095
23096
23097
23098
23099
23100
23101
23102
23103
23104
23105
23106
23107
23108
23109
23110
23111
23112
23113
23114
23115
23116
23117
23118
23119
23120
23121
23122
23123
23124
23125
23126
23127
23128
23129
23130
23131
23132
23133
23134
23135
23136
23137
23138
23139
23140
23141
23142
23143
23144
23145
23146
23147
23148
23149
23150
23151
23152
23153
23154
23155
23156
23157
23158
23159
23160
23161
23162
23163
23164
23165
23166
23167
23168
23169
23170
23171
23172
23173
23174
23175
23176
23177
23178
23179
23180
23181
23182
23183
23184
23185
23186
23187
23188
23189
23190
23191
23192
23193
23194
23195
23196
23197
23198
23199
23200
23201
23202
23203
23204
23205
23206
23207
23208
23209
23210
23211
23212
23213
23214
23215
23216
23217
23218
23219
23220
23221
23222
23223
23224
23225
23226
23227
23228
23229
23230
23231
23232
23233
23234
23235
23236
23237
23238
23239
23240
23241
23242
23243
23244
23245
23246
23247
23248
23249
23250
23251
23252
23253
23254
23255
23256
23257
23258
23259
23260
23261
23262
23263
23264
23265
23266
23267
23268
23269
23270
23271
23272
23273
23274
23275
23276
23277
23278
23279
23280
23281
23282
23283
23284
23285
23286
23287
23288
23289
23290
23291
23292
23293
23294
23295
23296
23297
23298
23299
23300
23301
23302
23303
23304
23305
23306
23307
23308
23309
23310
23311
23312
23313
23314
23315
23316
23317
23318
23319
23320
23321
23322
23323
23324
23325
23326
23327
23328
23329
23330
23331
23332
23333
23334
23335
23336
23337
23338
23339
23340
23341
23342
23343
23344
23345
23346
23347
23348
23349
23350
23351
23352
23353
23354
23355
23356
23357
23358
23359
23360
23361
23362
23363
23364
23365
23366
23367
23368
23369
23370
23371
23372
23373
23374
23375
23376
23377
23378
23379
23380
23381
23382
23383
23384
23385
23386
23387
23388
23389
23390
23391
23392
23393
23394
23395
23396
23397
23398
23399
23400
23401
23402
23403
23404
23405
23406
23407
23408
23409
23410
23411
23412
23413
23414
23415
23416
23417
23418
23419
23420
23421
23422
23423
23424
23425
23426
23427
23428
23429
23430
23431
23432
23433
23434
23435
23436
23437
23438
23439
23440
23441
23442
23443
23444
23445
23446
23447
23448
23449
23450
23451
23452
23453
23454
23455
23456
23457
23458
23459
23460
23461
23462
23463
23464
23465
23466
23467
23468
23469
23470
23471
23472
23473
23474
23475
23476
23477
23478
23479
23480
23481
23482
23483
23484
23485
23486
23487
23488
23489
23490
23491
23492
23493
23494
23495
23496
23497
23498
23499
23500
23501
23502
23503
23504
23505
23506
23507
23508
23509
23510
23511
23512
23513
23514
23515
23516
23517
23518
23519
23520
23521
23522
23523
23524
23525
23526
23527
23528
23529
23530
23531
23532
23533
23534
23535
23536
23537
23538
23539
23540
23541
23542
23543
23544
23545
23546
23547
23548
23549
23550
23551
23552
23553
23554
23555
23556
23557
23558
23559
23560
23561
23562
23563
23564
23565
23566
23567
23568
23569
23570
23571
23572
23573
23574
23575
23576
23577
23578
23579
23580
23581
23582
23583
23584
23585
23586
23587
23588
23589
23590
23591
23592
23593
23594
23595
23596
23597
23598
23599
23600
23601
23602
23603
23604
23605
23606
23607
23608
23609
23610
23611
23612
23613
23614
23615
23616
23617
23618
23619
23620
23621
23622
23623
23624
23625
23626
23627
23628
23629
23630
23631
23632
23633
23634
23635
23636
23637
23638
23639
23640
23641
23642
23643
23644
23645
23646
23647
23648
23649
23650
23651
23652
23653
23654
23655
23656
23657
23658
23659
23660
23661
23662
23663
23664
23665
23666
23667
23668
23669
23670
23671
23672
23673
23674
23675
23676
23677
23678
23679
23680
23681
23682
23683
23684
23685
23686
23687
23688
23689
23690
23691
23692
23693
23694
23695
23696
23697
23698
23699
23700
23701
23702
23703
23704
23705
23706
23707
23708
23709
23710
23711
23712
23713
23714
23715
23716
23717
23718
23719
23720
23721
23722
23723
23724
23725
23726
23727
23728
23729
23730
23731
23732
23733
23734
23735
23736
23737
23738
23739
23740
23741
23742
23743
23744
23745
23746
23747
23748
23749
23750
23751
23752
23753
23754
23755
23756
23757
23758
23759
23760
23761
23762
23763
23764
23765
23766
23767
23768
23769
23770
23771
23772
23773
23774
23775
23776
23777
23778
23779
23780
23781
23782
23783
23784
23785
23786
23787
23788
23789
23790
23791
23792
23793
23794
23795
23796
23797
23798
23799
23800
23801
23802
23803
23804
23805
23806
23807
23808
23809
23810
23811
23812
23813
23814
23815
23816
23817
23818
23819
23820
23821
23822
23823
23824
23825
23826
23827
23828
23829
23830
23831
23832
23833
23834
23835
23836
23837
23838
23839
23840
23841
23842
23843
23844
23845
23846
23847
23848
23849
23850
23851
23852
23853
23854
23855
23856
23857
23858
23859
23860
23861
23862
23863
23864
23865
23866
23867
23868
23869
23870
23871
23872
23873
23874
23875
23876
23877
23878
23879
23880
23881
23882
23883
23884
23885
23886
23887
23888
23889
23890
23891
23892
23893
23894
23895
23896
23897
23898
23899
23900
23901
23902
23903
23904
23905
23906
23907
23908
23909
23910
23911
23912
23913
23914
23915
23916
23917
23918
23919
23920
23921
23922
23923
23924
23925
23926
23927
23928
23929
23930
23931
23932
23933
23934
23935
23936
23937
23938
23939
23940
23941
23942
23943
23944
23945
23946
23947
23948
23949
23950
23951
23952
23953
23954
23955
23956
23957
23958
23959
23960
23961
23962
23963
23964
23965
23966
23967
23968
23969
23970
23971
23972
23973
23974
23975
23976
23977
23978
23979
23980
23981
23982
23983
23984
23985
23986
23987
23988
23989
23990
23991
23992
23993
23994
23995
23996
23997
23998
23999
24000
24001
24002
24003
24004
24005
24006
24007
24008
24009
24010
24011
24012
24013
24014
24015
24016
24017
24018
24019
24020
24021
24022
24023
24024
24025
24026
24027
24028
24029
24030
24031
24032
24033
24034
24035
24036
24037
24038
24039
24040
24041
24042
24043
24044
24045
24046
24047
24048
24049
24050
24051
24052
24053
24054
24055
24056
24057
24058
24059
24060
24061
24062
24063
24064
24065
24066
24067
24068
24069
24070
24071
24072
24073
24074
24075
24076
24077
24078
24079
24080
24081
24082
24083
24084
24085
24086
24087
24088
24089
24090
24091
24092
24093
24094
24095
24096
24097
24098
24099
24100
24101
24102
24103
24104
24105
24106
24107
24108
24109
24110
24111
24112
24113
24114
24115
24116
24117
24118
24119
24120
24121
24122
24123
24124
24125
24126
24127
24128
24129
24130
24131
24132
24133
24134
24135
24136
24137
24138
24139
24140
24141
24142
24143
24144
24145
24146
24147
24148
24149
24150
24151
24152
24153
24154
24155
24156
24157
24158
24159
24160
24161
24162
24163
24164
24165
24166
24167
24168
24169
24170
24171
24172
24173
24174
24175
24176
24177
24178
24179
24180
24181
24182
24183
24184
24185
24186
24187
24188
24189
24190
24191
24192
24193
24194
24195
24196
24197
24198
24199
24200
24201
24202
24203
24204
24205
24206
24207
24208
24209
24210
24211
24212
24213
24214
24215
24216
24217
24218
24219
24220
24221
24222
24223
24224
24225
24226
24227
24228
24229
24230
24231
24232
24233
24234
24235
24236
24237
24238
24239
24240
24241
24242
24243
24244
24245
24246
24247
24248
24249
24250
24251
24252
24253
24254
24255
24256
24257
24258
24259
24260
24261
24262
24263
24264
24265
24266
24267
24268
24269
24270
24271
24272
24273
24274
24275
24276
24277
24278
24279
24280
24281
24282
24283
24284
24285
24286
24287
24288
24289
24290
24291
24292
24293
24294
24295
24296
24297
24298
24299
24300
24301
24302
24303
24304
24305
24306
24307
24308
24309
24310
24311
24312
24313
24314
24315
24316
24317
24318
24319
24320
24321
24322
24323
24324
24325
24326
24327
24328
24329
24330
24331
24332
24333
24334
24335
24336
24337
24338
24339
24340
24341
24342
24343
24344
24345
24346
24347
24348
24349
24350
24351
24352
24353
24354
24355
24356
24357
24358
24359
24360
24361
24362
24363
24364
24365
24366
24367
24368
24369
24370
24371
24372
24373
24374
24375
24376
24377
24378
24379
24380
24381
24382
24383
24384
24385
24386
24387
24388
24389
24390
24391
24392
24393
24394
24395
24396
24397
24398
24399
24400
24401
24402
24403
24404
24405
24406
24407
24408
24409
24410
24411
24412
24413
24414
24415
24416
24417
24418
24419
24420
24421
24422
24423
24424
24425
24426
24427
24428
24429
24430
24431
24432
24433
24434
24435
24436
24437
24438
24439
24440
24441
24442
24443
24444
24445
24446
24447
24448
24449
24450
24451
24452
24453
24454
24455
24456
24457
24458
24459
24460
24461
24462
24463
24464
24465
24466
24467
24468
24469
24470
24471
24472
24473
24474
24475
24476
24477
24478
24479
24480
24481
24482
24483
24484
24485
24486
24487
24488
24489
24490
24491
24492
24493
24494
24495
24496
24497
24498
24499
24500
24501
24502
24503
24504
24505
24506
24507
24508
24509
24510
24511
24512
24513
24514
24515
24516
24517
24518
24519
24520
24521
24522
24523
24524
24525
24526
24527
24528
24529
24530
24531
24532
24533
24534
24535
24536
24537
24538
24539
24540
24541
24542
24543
24544
24545
24546
24547
24548
24549
24550
24551
24552
24553
24554
24555
24556
24557
24558
24559
24560
24561
24562
24563
24564
24565
24566
24567
24568
24569
24570
24571
24572
24573
24574
24575
24576
24577
24578
24579
24580
24581
24582
24583
24584
24585
24586
24587
24588
24589
24590
24591
24592
24593
24594
24595
24596
24597
24598
24599
24600
24601
24602
24603
24604
24605
24606
24607
24608
24609
24610
24611
24612
24613
24614
24615
24616
24617
24618
24619
24620
24621
24622
24623
24624
24625
24626
24627
24628
24629
24630
24631
24632
24633
24634
24635
24636
24637
24638
24639
24640
24641
24642
24643
24644
24645
24646
24647
24648
24649
24650
24651
24652
24653
24654
24655
24656
24657
24658
24659
24660
24661
24662
24663
24664
24665
24666
24667
24668
24669
24670
24671
24672
24673
24674
24675
24676
24677
24678
24679
24680
24681
24682
24683
24684
24685
24686
24687
24688
24689
24690
24691
24692
24693
24694
24695
24696
24697
24698
24699
24700
24701
24702
24703
24704
24705
24706
24707
24708
24709
24710
24711
24712
24713
24714
24715
24716
24717
24718
24719
24720
24721
24722
24723
24724
24725
24726
24727
24728
24729
24730
24731
24732
24733
24734
24735
24736
24737
24738
24739
24740
24741
24742
24743
24744
24745
24746
24747
24748
24749
24750
24751
24752
24753
24754
24755
24756
24757
24758
24759
24760
24761
24762
24763
24764
24765
24766
24767
24768
24769
24770
24771
24772
24773
24774
24775
24776
24777
24778
24779
24780
24781
24782
24783
24784
24785
24786
24787
24788
24789
24790
24791
24792
24793
24794
24795
24796
24797
24798
24799
24800
24801
24802
24803
24804
24805
24806
24807
24808
24809
24810
24811
24812
24813
24814
24815
24816
24817
24818
24819
24820
24821
24822
24823
24824
24825
24826
24827
24828
24829
24830
24831
24832
24833
24834
24835
24836
24837
24838
24839
24840
24841
24842
24843
24844
24845
24846
24847
24848
24849
24850
24851
24852
24853
24854
24855
24856
24857
24858
24859
24860
24861
24862
24863
24864
24865
24866
24867
24868
24869
24870
24871
24872
24873
24874
24875
24876
24877
24878
24879
24880
24881
24882
24883
24884
24885
24886
24887
24888
24889
24890
24891
24892
24893
24894
24895
24896
24897
24898
24899
24900
24901
24902
24903
24904
24905
24906
24907
24908
24909
24910
24911
24912
24913
24914
24915
24916
24917
24918
24919
24920
24921
24922
24923
24924
24925
24926
24927
24928
24929
24930
24931
24932
24933
24934
24935
24936
24937
24938
24939
24940
24941
24942
24943
24944
24945
24946
24947
24948
24949
24950
24951
24952
24953
24954
24955
24956
24957
24958
24959
24960
24961
24962
24963
24964
24965
24966
24967
24968
24969
24970
24971
24972
24973
24974
24975
24976
24977
24978
24979
24980
24981
24982
24983
24984
24985
24986
24987
24988
24989
24990
24991
24992
24993
24994
24995
24996
24997
24998
24999
25000
25001
25002
25003
25004
25005
25006
25007
25008
25009
25010
25011
25012
25013
25014
25015
25016
25017
25018
25019
25020
25021
25022
25023
25024
25025
25026
25027
25028
25029
25030
25031
25032
25033
25034
25035
25036
25037
25038
25039
25040
25041
25042
25043
25044
25045
25046
25047
25048
25049
25050
25051
25052
25053
25054
25055
25056
25057
25058
25059
25060
25061
25062
25063
25064
25065
25066
25067
25068
25069
25070
25071
25072
25073
25074
25075
25076
25077
25078
25079
25080
25081
25082
25083
25084
25085
25086
25087
25088
25089
25090
25091
25092
25093
25094
25095
25096
25097
25098
25099
25100
25101
25102
25103
25104
25105
25106
25107
25108
25109
25110
25111
25112
25113
25114
25115
25116
25117
25118
25119
25120
25121
25122
25123
25124
25125
25126
25127
25128
25129
25130
25131
25132
25133
25134
25135
25136
25137
25138
25139
25140
25141
25142
25143
25144
25145
25146
25147
25148
25149
25150
25151
25152
25153
25154
25155
25156
25157
25158
25159
25160
25161
25162
25163
25164
25165
25166
25167
25168
25169
25170
25171
25172
25173
25174
25175
25176
25177
25178
25179
25180
25181
25182
25183
25184
25185
25186
25187
25188
25189
25190
25191
25192
25193
25194
25195
25196
25197
25198
25199
25200
25201
25202
25203
25204
25205
25206
25207
25208
25209
25210
25211
25212
25213
25214
25215
25216
25217
25218
25219
25220
25221
25222
25223
25224
25225
25226
25227
25228
25229
25230
25231
25232
25233
25234
25235
25236
25237
25238
25239
25240
25241
25242
25243
25244
25245
25246
25247
25248
25249
25250
25251
25252
25253
25254
25255
25256
25257
25258
25259
25260
25261
25262
25263
25264
25265
25266
25267
25268
25269
25270
25271
25272
25273
25274
25275
25276
25277
25278
25279
25280
25281
25282
25283
25284
25285
25286
25287
25288
25289
25290
25291
25292
25293
25294
25295
25296
25297
25298
25299
25300
25301
25302
25303
25304
25305
25306
25307
25308
25309
25310
25311
25312
25313
25314
25315
25316
25317
25318
25319
25320
25321
25322
25323
25324
25325
25326
25327
25328
25329
25330
25331
25332
25333
25334
25335
25336
25337
25338
25339
25340
25341
25342
25343
25344
25345
25346
25347
25348
25349
25350
25351
25352
25353
25354
25355
25356
25357
25358
25359
25360
25361
25362
25363
25364
25365
25366
25367
25368
25369
25370
25371
25372
25373
25374
25375
25376
25377
25378
25379
25380
25381
25382
25383
25384
25385
25386
25387
25388
25389
25390
25391
25392
25393
25394
25395
25396
25397
25398
25399
25400
25401
25402
25403
25404
25405
25406
25407
25408
25409
25410
25411
25412
25413
25414
25415
25416
25417
25418
25419
25420
25421
25422
25423
25424
25425
25426
25427
25428
25429
25430
25431
25432
25433
25434
25435
25436
25437
25438
25439
25440
25441
25442
25443
25444
25445
25446
25447
25448
25449
25450
25451
25452
25453
25454
25455
25456
25457
25458
25459
25460
25461
25462
25463
25464
25465
25466
25467
25468
25469
25470
25471
25472
25473
25474
25475
25476
25477
25478
25479
25480
25481
25482
25483
25484
25485
25486
25487
25488
25489
25490
25491
25492
25493
25494
25495
25496
25497
25498
25499
25500
25501
25502
25503
25504
25505
25506
25507
25508
25509
25510
25511
25512
25513
25514
25515
25516
25517
25518
25519
25520
25521
25522
25523
25524
25525
25526
25527
25528
25529
25530
25531
25532
25533
25534
25535
25536
25537
25538
25539
25540
25541
25542
25543
25544
25545
25546
25547
25548
25549
25550
25551
25552
25553
25554
25555
25556
25557
25558
25559
25560
25561
25562
25563
25564
25565
25566
25567
25568
25569
25570
25571
25572
25573
25574
25575
25576
25577
25578
25579
25580
25581
25582
25583
25584
25585
25586
25587
25588
25589
25590
25591
25592
25593
25594
25595
25596
25597
25598
25599
25600
25601
25602
25603
25604
25605
25606
25607
25608
25609
25610
25611
25612
25613
25614
25615
25616
25617
25618
25619
25620
25621
25622
25623
25624
25625
25626
25627
25628
25629
25630
25631
25632
25633
25634
25635
25636
25637
25638
25639
25640
25641
25642
25643
25644
25645
25646
25647
25648
25649
25650
25651
25652
25653
25654
25655
25656
25657
25658
25659
25660
25661
25662
25663
25664
25665
25666
25667
25668
25669
25670
25671
25672
25673
25674
25675
25676
25677
25678
25679
25680
25681
25682
25683
25684
25685
25686
25687
25688
25689
25690
25691
25692
25693
25694
25695
25696
25697
25698
25699
25700
25701
25702
25703
25704
25705
25706
25707
25708
25709
25710
25711
25712
25713
25714
25715
25716
25717
25718
25719
25720
25721
25722
25723
25724
25725
25726
25727
25728
25729
25730
25731
25732
25733
25734
25735
25736
25737
25738
25739
25740
25741
25742
25743
25744
25745
25746
25747
25748
25749
25750
25751
25752
25753
25754
25755
25756
25757
25758
25759
25760
25761
25762
25763
25764
25765
25766
25767
25768
25769
25770
25771
25772
25773
25774
25775
25776
25777
25778
25779
25780
25781
25782
25783
25784
25785
25786
25787
25788
25789
25790
25791
25792
25793
25794
25795
25796
25797
25798
25799
25800
25801
25802
25803
25804
25805
25806
25807
25808
25809
25810
25811
25812
25813
25814
25815
25816
25817
25818
25819
25820
25821
25822
25823
25824
25825
25826
25827
25828
25829
25830
25831
25832
25833
25834
25835
25836
25837
25838
25839
25840
25841
25842
25843
25844
25845
25846
25847
25848
25849
25850
25851
25852
25853
25854
25855
25856
25857
25858
25859
25860
25861
25862
25863
25864
25865
25866
25867
25868
25869
25870
25871
25872
25873
25874
25875
25876
25877
25878
25879
25880
25881
25882
25883
25884
25885
25886
25887
25888
25889
25890
25891
25892
25893
25894
25895
25896
25897
25898
25899
25900
25901
25902
25903
25904
25905
25906
25907
25908
25909
25910
25911
25912
25913
25914
25915
25916
25917
25918
25919
25920
25921
25922
25923
25924
25925
25926
25927
25928
25929
25930
25931
25932
25933
25934
25935
25936
25937
25938
25939
25940
25941
25942
25943
25944
25945
25946
25947
25948
25949
25950
25951
25952
25953
25954
25955
25956
25957
25958
25959
25960
25961
25962
25963
25964
25965
25966
25967
25968
25969
25970
25971
25972
25973
25974
25975
25976
25977
25978
25979
25980
25981
25982
25983
25984
25985
25986
25987
25988
25989
25990
25991
25992
25993
25994
25995
25996
25997
25998
25999
26000
26001
26002
26003
26004
26005
26006
26007
26008
26009
26010
26011
26012
26013
26014
26015
26016
26017
26018
26019
26020
26021
26022
26023
26024
26025
26026
26027
26028
26029
26030
26031
26032
26033
26034
26035
26036
26037
26038
26039
26040
26041
26042
26043
26044
26045
26046
26047
26048
26049
26050
26051
26052
26053
26054
26055
26056
26057
26058
26059
26060
26061
26062
26063
26064
26065
26066
26067
26068
26069
26070
26071
26072
26073
26074
26075
26076
26077
26078
26079
26080
26081
26082
26083
26084
26085
26086
26087
26088
26089
26090
26091
26092
26093
26094
26095
26096
26097
26098
26099
26100
26101
26102
26103
26104
26105
26106
26107
26108
26109
26110
26111
26112
26113
26114
26115
26116
26117
26118
26119
26120
26121
26122
26123
26124
26125
26126
26127
26128
26129
26130
26131
26132
26133
26134
26135
26136
26137
26138
26139
26140
26141
26142
26143
26144
26145
26146
26147
26148
26149
26150
26151
26152
26153
26154
26155
26156
26157
26158
26159
26160
26161
26162
26163
26164
26165
26166
26167
26168
26169
26170
26171
26172
26173
26174
26175
26176
26177
26178
26179
26180
26181
26182
26183
26184
26185
26186
26187
26188
26189
26190
26191
26192
26193
26194
26195
26196
26197
26198
26199
26200
26201
26202
26203
26204
26205
26206
26207
26208
26209
26210
26211
26212
26213
26214
26215
26216
26217
26218
26219
26220
26221
26222
26223
26224
26225
26226
26227
26228
26229
26230
26231
26232
26233
26234
26235
26236
26237
26238
26239
26240
26241
26242
26243
26244
26245
26246
26247
26248
26249
26250
26251
26252
26253
26254
26255
26256
26257
26258
26259
26260
26261
26262
26263
26264
26265
26266
26267
26268
26269
26270
26271
26272
26273
26274
26275
26276
26277
26278
26279
26280
26281
26282
26283
26284
26285
26286
26287
26288
26289
26290
26291
26292
26293
26294
26295
26296
26297
26298
26299
26300
26301
26302
26303
26304
26305
26306
26307
26308
26309
26310
26311
26312
26313
26314
26315
26316
26317
26318
26319
26320
26321
26322
26323
26324
26325
26326
26327
26328
26329
26330
26331
26332
26333
26334
26335
26336
26337
26338
26339
26340
26341
26342
26343
26344
26345
26346
26347
26348
26349
26350
26351
26352
26353
26354
26355
26356
26357
26358
26359
26360
26361
26362
26363
26364
26365
26366
26367
26368
26369
26370
26371
26372
26373
26374
26375
26376
26377
26378
26379
26380
26381
26382
26383
26384
26385
26386
26387
26388
26389
26390
26391
26392
26393
26394
26395
26396
26397
26398
26399
26400
26401
26402
26403
26404
26405
26406
26407
26408
26409
26410
26411
26412
26413
26414
26415
26416
26417
26418
26419
26420
26421
26422
26423
26424
26425
26426
26427
26428
26429
26430
26431
26432
26433
26434
26435
26436
26437
26438
26439
26440
26441
26442
26443
26444
26445
26446
26447
26448
26449
26450
26451
26452
26453
26454
26455
26456
26457
26458
26459
26460
26461
26462
26463
26464
26465
26466
26467
26468
26469
26470
26471
26472
26473
26474
26475
26476
26477
26478
26479
26480
26481
26482
26483
26484
26485
26486
26487
26488
26489
26490
26491
26492
26493
26494
26495
26496
26497
26498
26499
26500
26501
26502
26503
26504
26505
26506
26507
26508
26509
26510
26511
26512
26513
26514
26515
26516
26517
26518
26519
26520
26521
26522
26523
26524
26525
26526
26527
26528
26529
26530
26531
26532
26533
26534
26535
26536
26537
26538
26539
26540
26541
26542
26543
26544
26545
26546
26547
26548
26549
26550
26551
26552
26553
26554
26555
26556
26557
26558
26559
26560
26561
26562
26563
26564
26565
26566
26567
26568
26569
26570
26571
26572
26573
26574
26575
26576
26577
26578
26579
26580
26581
26582
26583
26584
26585
26586
26587
26588
26589
26590
26591
26592
26593
26594
26595
26596
26597
26598
26599
26600
26601
26602
26603
26604
26605
26606
26607
26608
26609
26610
26611
26612
26613
26614
26615
26616
26617
26618
26619
26620
26621
26622
26623
26624
26625
26626
26627
26628
26629
26630
26631
26632
26633
26634
26635
26636
26637
26638
26639
26640
26641
26642
26643
26644
26645
26646
26647
26648
26649
26650
26651
26652
26653
26654
26655
26656
26657
26658
26659
26660
26661
26662
26663
26664
26665
26666
26667
26668
26669
26670
26671
26672
26673
26674
26675
26676
26677
26678
26679
26680
26681
26682
26683
26684
26685
26686
26687
26688
26689
26690
26691
26692
26693
26694
26695
26696
26697
26698
26699
26700
26701
26702
26703
26704
26705
26706
26707
26708
26709
26710
26711
26712
26713
26714
26715
26716
26717
26718
26719
26720
26721
26722
26723
26724
26725
26726
26727
26728
26729
26730
26731
26732
26733
26734
26735
26736
26737
26738
26739
26740
26741
26742
26743
26744
26745
26746
26747
26748
26749
26750
26751
26752
26753
26754
26755
26756
26757
26758
26759
26760
26761
26762
26763
26764
26765
26766
26767
26768
26769
26770
26771
26772
26773
26774
26775
26776
26777
26778
26779
26780
26781
26782
26783
26784
26785
26786
26787
26788
26789
26790
26791
26792
26793
26794
26795
26796
26797
26798
26799
26800
26801
26802
26803
26804
26805
26806
26807
26808
26809
26810
26811
26812
26813
26814
26815
26816
26817
26818
26819
26820
26821
26822
26823
26824
26825
26826
26827
26828
26829
26830
26831
26832
26833
26834
26835
26836
26837
26838
26839
26840
26841
26842
26843
26844
26845
26846
26847
26848
26849
26850
26851
26852
26853
26854
26855
26856
26857
26858
26859
26860
26861
26862
26863
26864
26865
26866
26867
26868
26869
26870
26871
26872
26873
26874
26875
26876
26877
26878
26879
26880
26881
26882
26883
26884
26885
26886
26887
26888
26889
26890
26891
26892
26893
26894
26895
26896
26897
26898
26899
26900
26901
26902
26903
26904
26905
26906
26907
26908
26909
26910
26911
26912
26913
26914
26915
26916
26917
26918
26919
26920
26921
26922
26923
26924
26925
26926
26927
26928
26929
26930
26931
26932
26933
26934
26935
26936
26937
26938
26939
26940
26941
26942
26943
26944
26945
26946
26947
26948
26949
26950
26951
26952
26953
26954
26955
26956
26957
26958
26959
26960
26961
26962
26963
26964
26965
26966
26967
26968
26969
26970
26971
26972
26973
26974
26975
26976
26977
26978
26979
26980
26981
26982
26983
26984
26985
26986
26987
26988
26989
26990
26991
26992
26993
26994
26995
26996
26997
26998
26999
27000
27001
27002
27003
27004
27005
27006
27007
27008
27009
27010
27011
27012
27013
27014
27015
27016
27017
27018
27019
27020
27021
27022
27023
27024
27025
27026
27027
27028
27029
27030
27031
27032
27033
27034
27035
27036
27037
27038
27039
27040
27041
27042
27043
27044
27045
27046
27047
27048
27049
27050
27051
27052
27053
27054
27055
27056
27057
27058
27059
27060
27061
27062
27063
27064
27065
27066
27067
27068
27069
27070
27071
27072
27073
27074
27075
27076
27077
27078
27079
27080
27081
27082
27083
27084
27085
27086
27087
27088
27089
27090
27091
27092
27093
27094
27095
27096
27097
27098
27099
27100
27101
27102
27103
27104
27105
27106
27107
27108
27109
27110
27111
27112
27113
27114
27115
27116
27117
27118
27119
27120
27121
27122
27123
27124
27125
27126
27127
27128
27129
27130
27131
27132
27133
27134
27135
27136
27137
27138
27139
27140
27141
27142
27143
27144
27145
27146
27147
27148
27149
27150
27151
27152
27153
27154
27155
27156
27157
27158
27159
27160
27161
27162
27163
27164
27165
27166
27167
27168
27169
27170
27171
27172
27173
27174
27175
27176
27177
27178
27179
27180
27181
27182
27183
27184
27185
27186
27187
27188
27189
27190
27191
27192
27193
27194
27195
27196
27197
27198
27199
27200
27201
27202
27203
27204
27205
27206
27207
27208
27209
27210
27211
27212
27213
27214
27215
27216
27217
27218
27219
27220
27221
27222
27223
27224
27225
27226
27227
27228
27229
27230
27231
27232
27233
27234
27235
27236
27237
27238
27239
27240
27241
27242
27243
27244
27245
27246
27247
27248
27249
27250
27251
27252
27253
27254
27255
27256
27257
27258
27259
27260
27261
27262
27263
27264
27265
27266
27267
27268
27269
27270
27271
27272
27273
27274
27275
27276
27277
27278
27279
27280
27281
27282
27283
27284
27285
27286
27287
27288
27289
27290
27291
27292
27293
27294
27295
27296
27297
27298
27299
27300
27301
27302
27303
27304
27305
27306
27307
27308
27309
27310
27311
27312
27313
27314
27315
27316
27317
27318
27319
27320
27321
27322
27323
27324
27325
27326
27327
27328
27329
27330
27331
27332
27333
27334
27335
27336
27337
27338
27339
27340
27341
27342
27343
27344
27345
27346
27347
27348
27349
27350
27351
27352
27353
27354
27355
27356
27357
27358
27359
27360
27361
27362
27363
27364
27365
27366
27367
27368
27369
27370
27371
27372
27373
27374
27375
27376
27377
27378
27379
27380
27381
27382
27383
27384
27385
27386
27387
27388
27389
27390
27391
27392
27393
27394
27395
27396
27397
27398
27399
27400
27401
27402
27403
27404
27405
27406
27407
27408
27409
27410
27411
27412
27413
27414
27415
27416
27417
27418
27419
27420
27421
27422
27423
27424
27425
27426
27427
27428
27429
27430
27431
27432
27433
27434
27435
27436
27437
27438
27439
27440
27441
27442
27443
27444
27445
27446
27447
27448
27449
27450
27451
27452
27453
27454
27455
27456
27457
27458
27459
27460
27461
27462
27463
27464
27465
27466
27467
27468
27469
27470
27471
27472
27473
27474
27475
27476
27477
27478
27479
27480
27481
27482
27483
27484
27485
27486
27487
27488
27489
27490
27491
27492
27493
27494
27495
27496
27497
27498
27499
27500
27501
27502
27503
27504
27505
27506
27507
27508
27509
27510
27511
27512
27513
27514
27515
27516
27517
27518
27519
27520
27521
27522
27523
27524
27525
27526
27527
27528
27529
27530
27531
27532
27533
27534
27535
27536
27537
27538
27539
27540
27541
27542
27543
27544
27545
27546
27547
27548
27549
27550
27551
27552
27553
27554
27555
27556
27557
27558
27559
27560
27561
27562
27563
27564
27565
27566
27567
27568
27569
27570
27571
27572
27573
27574
27575
27576
27577
27578
27579
27580
27581
27582
27583
27584
27585
27586
27587
27588
27589
27590
27591
27592
27593
27594
27595
27596
27597
27598
27599
27600
27601
27602
27603
27604
27605
27606
27607
27608
27609
27610
27611
27612
27613
27614
27615
27616
27617
27618
27619
27620
27621
27622
27623
27624
27625
27626
27627
27628
27629
27630
27631
27632
27633
27634
27635
27636
27637
27638
27639
27640
27641
27642
27643
27644
27645
27646
27647
27648
27649
27650
27651
27652
27653
27654
27655
27656
27657
27658
27659
27660
27661
27662
27663
27664
27665
27666
27667
27668
27669
27670
27671
27672
27673
27674
27675
27676
27677
27678
27679
27680
27681
27682
27683
27684
27685
27686
27687
27688
27689
27690
27691
27692
27693
27694
27695
27696
27697
27698
27699
27700
27701
27702
27703
27704
27705
27706
27707
27708
27709
27710
27711
27712
27713
27714
27715
27716
27717
27718
27719
27720
27721
27722
27723
27724
27725
27726
27727
27728
27729
27730
27731
27732
27733
27734
27735
27736
27737
27738
27739
27740
27741
27742
27743
27744
27745
27746
27747
27748
27749
27750
27751
27752
27753
27754
27755
27756
27757
27758
27759
27760
27761
27762
27763
27764
27765
27766
27767
27768
27769
27770
27771
27772
27773
27774
27775
27776
27777
27778
27779
27780
27781
27782
27783
27784
27785
27786
27787
27788
27789
27790
27791
27792
27793
27794
27795
27796
27797
diff --git a/detok/Makefile b/detok/Makefile
index a63ced9..3d7b1c7 100644
--- a/detok/Makefile
+++ b/detok/Makefile
@@ -1,11 +1,12 @@
 #
-#                     OpenBIOS - free your system! 
-#                            ( detokenizer )
-#                          
-#  This program is part of a free implementation of the IEEE 1275-1994 
+#                     OpenBIOS - free your system!
+#                             ( Utilities )
+#
+#  This program is part of a free implementation of the IEEE 1275-1994
 #  Standard for Boot (Initialization Configuration) Firmware.
 #
-#  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+#  Copyright (C) 2001-2006  Stefan Reinauer <stepan@openbios.org>
+#  Copyright (C) 2006 coresystems GmbH <info@coresystems.de>
 #
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -21,48 +22,37 @@
 #  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
 #
 
-ARCH     := $(shell uname -m | sed -e s/i.86/x86/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ -e "s/Power Macintosh/ppc/")
-TOPDIR   := $(shell /bin/pwd)
-BUILDDIR ?= $(TOPDIR)/obj-$(ARCH)
+PROGRAM = detok
 
-VPATH    := $(BUILDDIR)
+CC      = gcc
+STRIP	= strip
+INCLUDES = -I../shared
+#CFLAGS  = -O2 -g -Wall 
+CFLAGS  = -Os -Wall -Wno-pointer-sign 
+LDFLAGS = 
 
+OBJS  = addfcodes.o decode.o detok.o dictionary.o pcihdr.o printformats.o \
+        stream.o ../shared/classcodes.o
 
-include $(TOPDIR)/Rules.make
+all: .dependencies $(PROGRAM)
 
+$(PROGRAM): $(OBJS)
+	$(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
+	$(STRIP) -s $(PROGRAM)
 
-CC	  =  gcc
-CFLAGS	  =  -O2 -Wall -ansi
+clean:
+	rm -f $(OBJS) *~
 
-# For debugging the indentation code of detok, define DEBUG_INDENT
-#CFLAGS	 :=  $(CFLAGS) -DDEBUG_INDENT
+distclean: clean
+	rm -f $(PROGRAM) .dependencies
+	
+.dependencies: *.c 
+	@$(CC) $(CFLAGS) $(INCLUDES) -MM *.c > .dependencies
 
-all: main detok
-	@echo -e "\nOpenBIOS detokenizer detok build finished\n"
+.PHONY: all clean distclean 
 
-main:
-	@echo -e "\nWelcome to the OpenBIOS detokenizer.."
-	@test -r $(BUILDDIR) || ( mkdir -p $(BUILDDIR); \
-	  echo -e "\nCreating build directory $(BUILDDIR)" )
-		
-detok: detok.o dictionary.o decode.o stream.o 
-	@echo -en "\nLinking fcode detokenizer detok..."
-	@cd $(BUILDDIR) && ( $(CC) $(CFLAGS) $^ -o $@; strip detok )
-	@echo -e "\tok"
-	
-clean:
-	@test ! -d $(BUILDDIR) && \
-		echo "Architecture $(ARCH) is already clean." || \
-		( 						 \
-			echo "Cleaning up architecture $(ARCH)"; \
-			rm -rf $(BUILDDIR)			 \
-			rm forth.dict.core			 \
-		)
+-include .dependencies
 
-distclean: clean
-	rm -f detok
+.c.o:
+	$(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@ 
 
-detok.o:      detok.h stream.h detok.c
-stream.o:     detok.h stream.c
-decode.o:     detok.h stream.h decode.c Makefile
-dictionary.o: detok.h dictionary.c
diff --git a/detok/Rules.make b/detok/Rules.make
deleted file mode 100644
index db82ed6..0000000
--- a/detok/Rules.make
+++ /dev/null
@@ -1,17 +0,0 @@
-# tag: Makefile rules
-
-VPATH    := $(VPATH):.
-
-.S.o:
-	echo -n "  assembling $<... "
-	$(CC) -c -nostdlib $(INCLUDES) $(CFLAGS) $< -o $(BUILDDIR)/$@ && \
-		echo -e "    \t\tok" || \
-		echo -e "    \t\tfailed"
-
-.c.o:
-	@echo -n "  compiling $<... "
-	@$(CC) -c $(CFLAGS) $(INCLUDES) $< -o $(BUILDDIR)/$@ && \
-		echo -e "   \t\tok" || \
-		echo -e "   \t\failed"
-		
-
diff --git a/detok/addfcodes.c b/detok/addfcodes.c
new file mode 100644
index 0000000..f10f009
--- /dev/null
+++ b/detok/addfcodes.c
@@ -0,0 +1,343 @@
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Function(s) for entering Vendor-Specific FCodes to detokenizer.
+ *
+ *      (C) Copyright 2006 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Functions Exported:
+ *          add_fcodes_from_list           Add Vendor-Specific FCodes from
+ *                                             the file whose name is supplied.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Revision History:
+ *          Tue, 25 Apr 2006 by David L. Paktor
+ *              Identified this need when working with in-house code,
+ *                  which uses some custom functions.  This solution
+ *                  is (hoped to be) general enough to cover all cases.
+ *
+ **************************************************************************** */
+
+
+/* **************************************************************************
+ *
+ *          Global Variables Imported
+ *              indata                Buffer into which the file will be read
+ *              stream_max            Size of the file buffer.
+ *
+ **************************************************************************** */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "detok.h"
+#include "stream.h"
+#include "addfcodes.h"
+
+/* **************************************************************************
+ *
+ *          Internal Static Variables
+ *     current_vfc_line       Line to be scanned in Vendor-FCodes buffer
+ *     vfc_remainder          Remainder of Vendor-FCodes buffer to be scanned
+ *     vfc_line_no            Number of current line in Vendor-FCodes buffer
+ *     vfc_buf_end            Pointer to end of Vendor-FCodes buffer
+ *
+ **************************************************************************** */
+
+static char *current_vfc_line;
+static char *vfc_remainder;
+static int vfc_line_no = 0;
+static char *vfc_buf_end;
+
+/* **************************************************************************
+ *
+ *      Function name:  skip_whitespace
+ *      Synopsis:       Advance the given string-pointer past blanks and tabs.
+ *                          (String is presumed to end before new-line)
+ *
+ *      Inputs:
+ *         Parameters:
+ *             string_line_ptr        Address of pointer to string
+ *
+ *      Outputs:
+ *         Returned Value:            None
+ *             *string_line_ptr       Advanced past blanks and tabs
+ *
+ **************************************************************************** */
+
+static void skip_whitespace( char **string_line_ptr)
+{
+    char *cur_char_ptr = *string_line_ptr;
+    for ( ; *cur_char_ptr != 0 ; cur_char_ptr++ )
+    {
+	if ( (*cur_char_ptr != '\t') && (*cur_char_ptr != ' ') )
+	{
+	    *string_line_ptr = cur_char_ptr;
+	    break;
+	}
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  get_next_vfc_line
+ *      Synopsis:       Advance to the next  vfc_line  to be processed.
+ *                      Skip blanks and comments.  Indicate when end reached.
+ *
+ *      Inputs:
+ *         Parameters:                    None
+ *         Local Static Variables:
+ *             vfc_remainder
+ *             vfc_buf_end
+ *
+ *      Outputs:
+ *         Returned Value:               FALSE if reached end of buffer
+ *         Local Static Variables:
+ *             current_vfc_line          Advanced to next line to be scanned
+ *             vfc_line_no               Kept in sync with line number in file
+ *
+ *      Process Explanation:
+ *          Comments begin with a pound-sign  ('#') or a backslash  ('\')
+ *          Comment-lines or blank or empty lines will be skipped. 
+ *
+ **************************************************************************** */
+
+static bool get_next_vfc_line( void )
+{
+    bool retval = FALSE;   /*  TRUE = not at end yet  */
+    while ( vfc_remainder < vfc_buf_end )
+    {
+	current_vfc_line = vfc_remainder;
+	vfc_remainder = strchr( current_vfc_line, '\n');
+	*vfc_remainder = 0;
+	vfc_remainder++;
+	vfc_line_no++;
+	skip_whitespace( &current_vfc_line);
+	if ( *current_vfc_line == 0 )  continue;  /*  Blank line */
+	if ( *current_vfc_line == '#' )  continue;  /*  Comment  */
+	if ( *current_vfc_line == '\\' )  continue;  /*  Comment  */
+	retval = TRUE;
+	break;  /*  Found something  */
+    }
+    return( retval);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  vfc_splash
+ *      Synopsis:       Print a "splash" message to show that we
+ *                          are processing Vendor-Specific FCodes,
+ *                          but only once.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             vf_file_name            Vendor-Specific FCodes file name
+ *         Local Static Variables:
+ *             did_not_splash          Control printing; once only.
+ *
+ *      Outputs:
+ *         Returned Value:             None
+ *         Local Static Variables:
+ *             did_not_splash          FALSE after first call.
+ *         Printout:
+ *             "Splash" message...
+ *
+ **************************************************************************** */
+static bool did_not_splash = TRUE;
+static void vfc_splash( char *vf_file_name)
+{
+    if ( did_not_splash )
+    {
+	/*  Temporary substring buffer                */
+	/*  Guarantee that the malloc will be big enough.  */
+	char *strbfr = malloc( strlen( vf_file_name) +65 ) ;
+	sprintf( strbfr,
+	    "Reading additional FCodes from file:  %s\n",
+		vf_file_name);
+	printremark( strbfr);
+	free( strbfr);
+	did_not_splash = FALSE;
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  add_fcodes_from_list
+ *      Synopsis:       Add Vendor-Specific FCodes from the named file
+ *                          to the permanent resident dictionary.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             vf_file_name            Vendor-Specific FCodes file name
+ *         Global Variables:
+ *             verbose                 "Verbose" flag.
+ *             indata                  Start of file buffer
+ *             stream_max              Size of the file buffer.
+ *
+ *      Outputs:
+ *         Returned Value:             TRUE if FCodes have actually been added
+ *         Global Variables:
+ *             check_tok_seq           Cleared to FALSE, then restored to TRUE
+ *         Local Static Variables:
+ *             vfc_remainder           Initted to start of file buffer
+ *             vfc_buf_end             Initted to end of file buffer
+ *         Memory Allocated
+ *             Permanent copy of FCode Name
+ *         When Freed?
+ *             Never.  Rmeains until program termination.
+ *         Printout:
+ *             If verbose, "Splash" line and count of added entries.
+ *
+ *      Error Detection:
+ *          Fail to open or read Vendor-FCodes file -- Exit program
+ *          Improperly formatted input line -- print message and ignore
+ *          FCode value out of valid range -- print message and ignore
+ *          FCode value already in use -- print message and ignore
+ *
+ *      Process Explanation:
+ *          Valid lines are formatted with the FCode number first
+ *              and the name after, one entry per line.  Extra text
+ *              after the name will be ignored, so an extra "comment"
+ *              is permitted.  The FCode number must be in hex, with
+ *              an optional leading  0x  or  0X   For example:  0X407
+ *          The valid range is 0x010 to 0x7ff.  Numbers above 0x800
+ *              infringe upon the are reserved for FCodes generated
+ *              by the tokenization process.
+ *          Numbers already in use will be ignored.  A Message will be
+ *              printed even if the name matches the one on the line.
+ *
+ **************************************************************************** */
+
+bool add_fcodes_from_list( char *vf_file_name)
+{
+    bool retval = FALSE;
+    int added_fc_count = 0;
+    check_tok_seq = FALSE;
+
+    if ( verbose )  vfc_splash( vf_file_name);
+
+    if ( init_stream( vf_file_name) != 0 )
+    {
+	char *strbfr = malloc( strlen( vf_file_name) +65 );
+	sprintf( strbfr,
+	    "Could not open Additional FCodes file:  %s\n",
+		vf_file_name);
+	printremark( strbfr);
+	free( strbfr);
+	exit(1);
+    }
+    vfc_remainder = indata;
+    vfc_buf_end = indata + stream_max -1;
+
+    while (  get_next_vfc_line() )
+    {
+	char vs_fc_name[36];
+	int  vs_fc_number;
+	int  scan_result;
+	char *lookup_result;
+	char *fc_name_cpy;
+
+	scan_result = sscanf( current_vfc_line, "0x%x %32s",
+	     &vs_fc_number, vs_fc_name);
+
+	if ( scan_result != 2 )   /*  Allow a capital  0X   */
+	{
+	    scan_result = sscanf( current_vfc_line, "0X%x %32s",
+		&vs_fc_number, vs_fc_name);
+	}
+	if ( scan_result != 2 )   /*  Try it without the  0x   */
+	{
+	    scan_result = sscanf( current_vfc_line, "%x %32s",
+		&vs_fc_number, vs_fc_name);
+	}
+
+	if ( scan_result != 2 )   /*  That's it... */
+	{
+	    char *strbfr = malloc( strlen( current_vfc_line) +65 );
+	    vfc_splash( vf_file_name);
+	    sprintf( strbfr,
+		"Line #%d, invalid format.  Ignoring:  %s\n",
+		    vfc_line_no, current_vfc_line);
+	    printremark( strbfr);
+	    free( strbfr);
+	    continue;
+	}
+
+	if ( ( vs_fc_number < 0x10 ) || ( vs_fc_number > 0x7ff ) )
+	{
+	    char *strbfr = malloc( 85 );
+	    vfc_splash( vf_file_name);
+	    sprintf( strbfr,
+		"Line #%d, FCode number out of range:  0x%x  Ignoring.\n",
+		    vfc_line_no, vs_fc_number);
+	    printremark( strbfr);
+	    free( strbfr);
+	    continue;
+	}
+
+	lookup_result = lookup_token( (u16)vs_fc_number);
+	if ( strcmp( lookup_result, "ferror") != 0 )
+	{
+	    char *strbfr = malloc( strlen( lookup_result) + 85 );
+	    vfc_splash( vf_file_name);
+	    sprintf( strbfr,
+		"Line #%d.  FCode number 0x%x is already "
+		    "defined as %s  Ignoring.\n",
+			vfc_line_no, vs_fc_number, lookup_result);
+	    printremark( strbfr);
+	    free( strbfr);
+	    continue;
+	}
+
+	/*  We've passed all the tests!  */
+	fc_name_cpy = strdup( vs_fc_name);
+	add_token( (u16)vs_fc_number, fc_name_cpy);
+	added_fc_count++;
+	retval = TRUE;
+    }
+
+    if ( verbose )
+    {
+	char *strbfr = malloc( 85 );
+        sprintf( strbfr,
+	    "Added %d FCode numbers\n", added_fc_count);
+	printremark( strbfr);
+	free( strbfr);
+    }
+
+    close_stream();
+    check_tok_seq = TRUE;
+    return( retval);
+}
diff --git a/detok/addfcodes.h b/detok/addfcodes.h
new file mode 100644
index 0000000..2183c86
--- /dev/null
+++ b/detok/addfcodes.h
@@ -0,0 +1,48 @@
+#ifndef _DETOK_VSFCODES_H
+#define _DETOK_VSFCODES_H
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Header for function for entering Vendor-Specific FCodes
+ *          to detokenizer.
+ *
+ *      (C) Copyright 2006 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+#include "types.h"
+
+/* ************************************************************************** *
+ *
+ *      Function Prototypes / Functions Exported:
+ *
+ **************************************************************************** */
+
+bool add_fcodes_from_list( char *vf_file_name);
+
+#endif   /*  _DETOK_VSFCODES_H    */
diff --git a/detok/decode.c b/detok/decode.c
index 1fee2b3..000e740 100644
--- a/detok/decode.c
+++ b/detok/decode.c
@@ -24,96 +24,322 @@
  *
  */
 
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <ctype.h>
+#include <setjmp.h>
 
 #include "detok.h"
 #include "stream.h"
 
-/* Dictionary function prototypes */
-char *lookup_token(u16 number);
-int  add_token(u16 number, char *name);
+static int indent;    /*  Current level of indentation   */
+
+/* **************************************************************************
+ *
+ *      Still to be done:
+ *          Handling of indent-level is not correct.  Branches should
+ *              balance with their resolvers; constructs like do..loop
+ *              case/of/endof/endcase are a few major examples.
+ *          This will be tricky; the rules need to be carefully thought
+ *              out, and the implementation might be more complex than
+ *              at first meets the eye...
+ *
+ **************************************************************************** */
 
-extern u16 fcode;
+static bool ended_okay = TRUE;    /*  FALSE if finished prematurely  */
 
 bool offs16=TRUE;
-int indent, verbose=0, decode_all=0, linenumbers=0, linenum;
-u32 fclen;
+unsigned int linenum;
+bool end_found=FALSE;
+unsigned int token_streampos;   /*  Streampos() of currently-gotten token  */
+u16 last_defined_token = 0;
+
+jmp_buf eof_exception;
 
-static u8 *unnamed=(u8 *)"(unnamed-fcode)";
+static int fclen;
+static const char *unnamed = "(unnamed-fcode)" ;
 
-void pretty_string(u8 *string)
+static void decode_indent(void) 
 {
-	u8 c;
-	unsigned int i;
-	bool qopen=TRUE;
+	int i;
+	if (indent<0) {
+#ifdef DEBUG_INDENT
+		printf("detok: error in indentation code.\n");
+#endif
+		indent=0;
+	}
+	for (i=0; i<indent; i++)
+		printf ("    ");
+}
 	
+/*  Print forth string ( [len] char[0] ... char[len] ) */
+static void pretty_print_string(void)
+{
+    u8 len;
+    u8 *strptr;
+    int indx;
+    bool in_parens = FALSE ;  /*  Are we already inside parentheses?  */
+
+    strptr = get_string( &len );
+
+    printf("( len=%s%x", len >= 10 ? "0x":"", len);
+    if ( len >= 10 )   printf(" [%d bytes]", len);
+    printf(" )\n");
+    if (show_linenumbers)  printf("        ");
+    decode_indent();
 	printf("\" ");
 
-	for (i=1; i<1+(unsigned int)string[0]; i++) {
-		c=string[i];
+    for ( indx = 0; indx < len; indx++ )
+    {
+	u8 c = *strptr++;
 		if (isprint(c)) {
-			if (!qopen) {
+	    if ( in_parens )
+	    {
 				printf(" )");
-				qopen=TRUE;
+		in_parens = FALSE;
 			}
 			printf("%c",c);
+	    /*  Quote-mark must escape itself  */
+	    if ( c == '"' ) printf("%c",c);
 		} else {
-			if (qopen) {
+	    if ( !in_parens )
+	    {
 				printf("\"(");
-				qopen=FALSE;
+		in_parens = TRUE;
 			}
 			printf(" %02x",c);
 		}
 	}
-	if (!qopen)
+    if ( in_parens )
 		printf(" )");
 	printf("\"");
 }
 
-static void decode_indent(void) 
+static void decode_lines(void)
 {
-	int i;
-#ifdef DEBUG_INDENT
-	if (indent<0) {
-		printf("detok: error in indentation code.\n");
-		indent=0;
+	if (show_linenumbers) {
+		printf("%6d: ",show_offsets ? token_streampos : linenum++);
 	}
-#endif
-	for (i=0; i<indent; i++)
-		printf ("    ");
 }
 
-static void decode_lines(void)
+/* **************************************************************************
+ *
+ *      Function name:  output_token_name
+ *      Synopsis:       Print the name of the token just retrieved
+ *                          along with any interesting related information...
+ *
+ *      Inputs:
+ *         Global/Static Variables:
+ *             fcode                  The token # just retrieved
+ *             last_defined_token     Used to screen invalid tokens.
+ *             token_streampos        Location of token just retrieved
+ *         Global/Static Constants:
+ *             unnamed                Namefield of headerless token 
+ *
+ *      Outputs:
+ *         Printout:
+ *             Print the function name (if known) and the FCode number,
+ *                  if interesting.
+ *             The fcode number is interesting if either
+ *                 a) the token has no name
+ *                           or
+ *                 b) verbose mode is in effect.
+ *             If the token is named, show its FCode number in
+ *                 the syntax of a FORTH Comment, otherwise, its
+ *                 FCode number -- in [brackets] -- acts as its name.
+ *
+ *      Error Detection:
+ *          If the token # is larger than the last defined token, it is
+ *              probably an artifact of an error that was allowed in the
+ *              tokenization; if it were treated normally, it would lead
+ *              to a cascade of failures.  Print a message, skip the first
+ *              byte, and return.
+ *
+ *      Revision History:
+ *          Refactored.  The line number or offset (if selected) and the
+ *              indent are printed in the  output_token()  routine, which
+ *              calls this one.
+ *          Add Error Detection
+ *          
+ *
+ **************************************************************************** */
+
+static void output_token_name(void)
 {
-	if (linenumbers) {
-		printf("%6d: ",linenumbers==1?linenum:get_streampos());
-		linenum++;
+	char *tname;
+
+	/*  Run error detection only if last_defined_token was assigned  */
+	if ( (fcode > last_defined_token) && (last_defined_token > 0) )
+	{
+	    char temp_buf[80];
+	    int buf_pos;
+	    u8 top_byte = fcode >> 8;
+	    printf ("Invalid token:  [0x%03x]\n", fcode);
+	    sprintf(temp_buf, "Backing up over first byte, which is ");
+	    buf_pos = strlen(temp_buf);
+	    if ( top_byte < 10 )
+	    {
+	        sprintf(&temp_buf[buf_pos], " %02x", top_byte);
+	    }else{
+	        sprintf( &temp_buf[buf_pos], "0x%02x ( =dec %d)",
+		    top_byte, top_byte);
 	}
+	    printremark(temp_buf);
+	    set_streampos(token_streampos+1);
+	    return;
 }
 
-static void output_token(void)
-{
-	u8 *tname=lookup_token(fcode);
 	
+	tname = lookup_token(fcode);
 	printf ("%s ", tname);
 
-	/* The fcode number is interesting if
-	 *  a) detok is in verbose mode
-	 *  b) the token has no name.
+	/* The fcode number is interesting
+	 *  if either
+	 *  a) the token has no name
+	 *            or
+	 *  b) detok is in verbose mode.
 	 */
-	if (verbose || tname == unnamed)
+       if ( tname == unnamed )
+       {
 		printf("[0x%03x] ", fcode);
+       } else {
+	    if ( verbose )
+	    {
+		/*  If the token is named,
+		 *  show its fcode number in
+		 *  the syntax of a FORTH Comment
+		 */
+		printf("( 0x%03x ) ", fcode);
+	    }
+	}
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  output_token
+ *      Synopsis:       Print the full line for the token just retrieved:
+ *                          line number, indentation and name.
+ *
+ *      Revision History:
+ *          Updated Mon, 11 Jul 2005 by David L. Paktor
+ *          Separate out  output_token_name()  for specific uses.
+ *          Incorporate calls to  decode_lines()  and   decode_indent()
+ *              to allow better control of indentation.
+ *
+ **************************************************************************** */
+
+static void output_token(void)
+{
+	decode_lines();
+	decode_indent();
+	output_token_name();
 }
 
+
+/* **************************************************************************
+ *
+ *      Function name:  decode_offset
+ *      Synopsis:       Gather and display an FCode-offset associated with
+ *                          a branch or suchlike function.
+ *
+ *      Inputs:
+ *         Parameters:                 NONE
+ *         Global/Static Variables:
+ *             show_offsets            Whether to show offsets in full detail
+ *             offs16                  Whether 16- (or 8-) -bit offsets
+ *             stream_max              Maximum valid destimation      
+ *         Local Static Variables:
+ *
+ *      Outputs:
+ *         Returned Value:             The offset, converted to signed 16-bit #
+ *         Global/Static Variables:
+ *             stream-position         Reset if invalid destination; otherwise,
+ *                                         advanced in the normal manner.
+ *         Printout:
+ *             The offset and destination, if display of offsets was specified
+ *                 or if the destination is invalid
+ *
+ *      Error Detection:
+ *          Crude and rudimentary:
+ *          If the target-destination is outside the theoretical limits,
+ *              it's obviously wrong.
+ *          Notification remark is printed and the stream-position reset
+ *              to the location of the offset, to allow it to be processed
+ *              in the manner of normal tokens.
+ *          If the offset is zero, that's obviously wrong, but don't reset
+ *              the stream-position:  zero gets processed as  end0  and that
+ *              is also wrong...
+ *
+ *      Still to be done:
+ *          More sophisticated error-checking for invalid offsets.  Look
+ *              at the type of branch, and what should be expected in the
+ *              vicinity of the destination.  (This might be best served
+ *              by a separate routine).
+ *         This might also help with handling the indent-level correctly...
+ *              Also, if indentation were to be handled in this routine,
+ *              there would be no need to return the value of the offset.
+ *
+ **************************************************************************** */
+
 static s16 decode_offset(void)
 {
         s16 offs;
+	int dest;
+	bool invalid_dest;
+	int streampos = get_streampos();
 
-        offs=get_offset();
 	output_token();
-	printf("0x%x\n",offs);
+        offs=get_offset();
+
+	/*  The target-destination is the source-byte offset
+	 *      at which the FCode-offset is found, plus
+	 *      the FCode-offset.
+	 */
+	dest = streampos + offs;
+
+	/*  A destination of zero is invalid because there must be a
+	 *      token -- such as  b(<mark)  or   b(do)  -- preceding
+	 *      the target of a backward branch.
+	 *  A destination at the end of the stream is unlikely but
+	 *      theoretically possible, so we'll treat it as valid.
+	 *  An offset of zero is also, of course, invalid.
+	 */
+	invalid_dest = BOOLVAL ( (dest <= 0)
+	                      || (dest > stream_max)
+	                      || (offs == 0) );
+
+	/*  Show the offset in hex and again as a signed decimal number.   */
+	if ( offs16 )
+	{
+	    printf("0x%04x (", (u16)(offs & 0xffff) );
+	}else{
+	    printf("0x%02x (",  (u8)(offs & 0x00ff) );
+	}
+	if ( (offs < 0) || (offs > 9) )  printf(" =dec %d", offs);
+	/*  If we're showing source-byte offsets, show targets of offsets  */
+	if ( show_offsets || invalid_dest )
+	{
+	    printf("  dest = %d ",dest);
+	}
+	printf(")\n");
+
+	if ( invalid_dest )
+	{
+	    if (offs == 0) 
+	    {
+	      printremark("Error:  Unresolved offset.");
+	    }else{
+	      printremark("Error:  Invalid offset.  Ignoring...");
+	      set_streampos( streampos);
+	    }
+	}
 	return offs;
 }
 
@@ -127,59 +353,39 @@ static void new_token(void)
 {
 	u16 token;
 	output_token();
-	token=get_token();
+	token = next_token();
 	printf("0x%03x\n",token);
-	add_token(token, unnamed);
+	add_token(token, (char *)unnamed);
 }
 
 static void named_token(void)
 {
 	u16 token;
+	u8 len;
 	u8* string;
 
 	output_token();
 	/* get forth string ( [len] [char0] ... [charn] ) */
-	string=get_string();
-	token=get_token();
-
-	printf("%s 0x%03x\n", string+1, token);
-	
-	add_token(token,string+1);
-}
-
-static void external_token(void)
-{
-	u16 token;
-	u8* string;
-
-	output_token();
-	/* get forth string ( [len] [char0] ... [charn] ) */
-	string=get_string();
-	token=get_token();
-
-	printf("%s 0x%03x\n", string+1, token);
-
-	add_token(token,string+1);
+	string=get_name(&len);
+	token = next_token();
+	printf("%s 0x%03x\n", string, token);
+	add_token(token,string);
 }
 
 static void bquote(void)
 {
-	u8 *string;
-
-	/* get forth string ( [len] [char0] ... [charn] ) */
-	string=get_string();
 	output_token();
-	pretty_string(string);
+	/* get forth string ( [len] [char0] ... [charn] ) */
+	pretty_print_string();
 	printf("\n");
-	free(string);
 }
 
 static void blit(void)
 {
 	u32 lit;
 
-	lit=get_num32();
 	output_token();
+	lit=get_num32();
 	printf("0x%x\n",lit);
 }
 
@@ -204,56 +410,81 @@ static void decode_two(void)
 	u16 token;
 
 	output_token();
-	token=get_token();
-	decode_default();
+	token = next_token();
+	output_token_name();
+	printf ("\n");
 }
 
+/* **************************************************************************
+ *
+ *      Function name:  decode_start
+ *      Synopsis:       Display the (known valid) FCode block Header
+ *
+ *      Outputs:
+ *         Global/Static Variables:    
+ *             fclen         Length of the FCode block as shown in its Header
+ *
+ **************************************************************************** */
+
 static void decode_start(void)
 {
 	u8  fcformat;
 	u16 fcchecksum, checksum=0;
-	long pos;
-	u32 i;
 
-	decode_default();
+	output_token();
+	printf("  ( %d-bit offsets)\n", offs16 ? 16 : 8 );
 	
+        token_streampos = get_streampos();
 	decode_lines();
         fcformat=get_num8();
 	printf("  format:    0x%02x\n", fcformat);
  
-	decode_lines();
-        fcchecksum=get_num16();
-        /* missing: check for checksum correctness. */
- 
-        fclen=get_num32(); /* skip len */
-	pos=get_streampos();
 	
-	for (i=0; i<fclen-pos; i++)
-		checksum+=get_num8();
+        /* Check for checksum correctness. */
 	
-	set_streampos(pos-4);
+        token_streampos = get_streampos();
+	decode_lines();
+        fcchecksum=get_num16();        /*  Read the stored checksum  */
+	checksum = calc_checksum();    /*  Calculate the actual checksum  */
 	
-	printf("  checksum:  0x%04x (%sOk)\n", fcchecksum,
-			fcchecksum==checksum?"":"not ");
+	if ( fcchecksum==checksum )
+	{
+		printf("  checksum:  0x%04x (Ok)\n", fcchecksum);
+	} else {
+		printf("  checksum should be:  0x%04x, but is 0x%04x\n",
+			checksum,fcchecksum);
+	}
 
+        token_streampos = get_streampos();
 	decode_lines();
 	fclen=get_num32();
-        printf("  len:       0x%x (%d bytes)\n", fclen, fclen);
+        printf("  len:       0x%04x ( %d bytes)\n", fclen, fclen);
 }
 
 
-void decode_token(u16 token)
+/* **************************************************************************
+ *
+ *      Function name: decode_token
+ *      Synopsis:      Display detokenization for one token.
+ *                     Handle complicated cases and dispatch simple ones.
+ *
+ *      Revision History:
+ *          Detect FCode-Starters in the middle of an FCode block.
+ *          Some tuning of adjustment of indent, particularly wrt branches...
+ *
+ **************************************************************************** */
+
+static void decode_token(u16 token)
 {
+    bool handy_flag = TRUE;
 	switch (token) {
 	case 0x0b5:
 		new_token();
 		break;
-	case 0x0b6:
+	case 0x0b6:    /*   Named Token  */
+	case 0x0ca:    /*   External Token  */
 		named_token();
 		break;
-	case 0x0ca:
-		external_token();
-		break;
 	case 0x012:
 		bquote();
 		break;
@@ -276,14 +507,14 @@ void decode_token(u16 token)
 	case 0x0c2: /* b(;) */
 	case 0x0b2: /* b(>resolve) */
 	case 0x0c5: /* b(endcase) */
-		decode_default();
 		indent--;
+		decode_default();
 		break;
 	case 0x015: /* b(loop) */
 	case 0x016: /* b(+loop) */
 	case 0x0c6: /* b(endof) */
-		decode_offset();
 		indent--;
+		decode_offset();
 		break;
 	case 0x017: /* b(do) */
 	case 0x018: /* b/?do) */
@@ -295,38 +526,274 @@ void decode_token(u16 token)
 	case 0x0c3: /* b(to) */
 		decode_two();
 		break;
+	case 0x0fd: /* version1 */
+		handy_flag = FALSE;
 	case 0x0f0: /* start0 */
 	case 0x0f1: /* start1 */
 	case 0x0f2: /* start2 */
 	case 0x0f3: /* start4 */
+		offs16 = handy_flag;
+		printremark("Unexpected FCode-Block Starter.");
 		decode_start();
+		printremark("  Ignoring length field.");
 		break;
+	case    0:  /* end0  */
+	case 0xff:  /* end1  */
+		end_found=TRUE;
+		decode_default();
+		break;
+	default:
+		decode_default();
+	}
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  decode_fcode_header
+ *      Synopsis:       Detokenize the FCode Header.
+ *                          Check for file corruption
+ *
+ *      Inputs:
+ *         Parameters:          NONE
+ *         Global/Static Variables:        
+ *             stream_max       Length of input stream
+ *
+ *      Outputs:
+ *         Returned Value:      NONE
+ *         Global/Static Variables:
+ *             offs16           FALSE if Starter was version1, else TRUE
+ *             fclen            On error, gets set to reach end of input stream
+ *                                  Otherwise, gets set by  decode_start() 
+ *         Printout:
+ *
+ *      Error Detection:
+ *          First byte not a valid FCode Start:  Print message, restore
+ *              input pointer to initial value, set fclen to [(end of
+ *              input stream) - (input pointer)], return FALSE.
+ *
+ *      Process Explanation:
+ *          This routine error-checks and dispatches to the routine that
+ *              does the actual printing.
+ *          Refrain from showing offset until correctness of starter-byte
+ *              has been confirmed.
+ *
+ **************************************************************************** */
+
+static void decode_fcode_header(void)
+{
+    long err_pos;
+    u16 token;
+
+    err_pos = get_streampos();
+    indent = 0;
+    token = next_token();
+    offs16=TRUE;
+    switch (token)
+    {
 	case 0x0fd: /* version1 */
-		decode_start();
 		offs16=FALSE;
+	case 0x0f0: /* start0 */
+	case 0x0f1: /* start1 */
+	case 0x0f2: /* start2 */
+	case 0x0f3: /* start4 */
+	    decode_start();
 		break;
 	default:
-		decode_default();
+	    {
+		char temp_bufr[128] = 
+			"Invalid FCode Start Byte.  Ignoring FCode header." ;
+		set_streampos( err_pos );
+		fclen = max - pc;
+		printf("\n");
+		if (show_linenumbers)
+		{
+		    sprintf( &(temp_bufr[strlen(temp_bufr)]),
+		    "  Remaining len = 0x%04x ( %d bytes)", fclen, fclen); 
+		}
+		printremark( temp_bufr );
 	}
 }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  decode_fcode_block
+ *      Synopsis:       Detokenize one FCode block.
+ *
+ *      Inputs:
+ *         Parameters:                     NONE
+ *         Global/Static Variables:
+ *             fclen         Length of the FCode block as shown in its Header
+ *             end_found     Whether the END0 code was seen
+ *             decode_all    TRUE = continue even after END0
+ *
+ *      Outputs:
+ *         Returned Value:                 NONE
+ *         Global/Static Variables:
+ *             end_found     Whether the END0 code was seen
+ *         Printout:
+ *             A summary message at the end of FCode detokenization
+ *
+ *      Error Detection:
+ *          If the end of the FCode block, as calculated by its FCode length,
+ *              was reached without encountering END0, print a message.
+ *          Detect END0 that occurs before end of FCode block,
+ *              even if  decode_all  is in effect.
+ *
+ *      Process Explanation:
+ *          This routine dispatches to the routines that do the actual
+ *              printing of the detokenization.
+ *          The  end_found  flag is not a direct input, but more of an
+ *              intermediate input, so to speak...  Clear it at the start.
+ *          Detection of FCode-Starters in the middle of an FCode block
+ *              is handled by  decode_token()  routine.
+ *
+ **************************************************************************** */
 
-int detokenize(void)
+static void decode_fcode_block(void)
 {
 	u16 token;
+    unsigned int fc_block_start;
+    unsigned int fc_block_end;
 	
-	if (linenumbers)
-		linenum=1;
+    end_found = FALSE;
+    fc_block_start = get_streampos();
 	
-	do {
-		decode_lines();
-		decode_indent();
-		token=get_token();
+    decode_fcode_header();
+
+    fc_block_end = fc_block_start + fclen;
+    
+    while ( ( !end_found || decode_all )
+         && ( get_streampos() < fc_block_end  ) )
+    {
+	token = next_token();
 		decode_token(token);
-	} while ((token||decode_all) && ((get_streampos()-1)<=fclen));
+    }
+    if ( !end_found )
+    {
+	printremark("FCode-ender not found");
+    }
+    {
+	char temp_bufr[80];
+	/*  Don't use  fclen  here, in case it got corrupted
+	 *      by an "Unexpected FCode-Block Starter"
+	 */
+	if ( get_streampos() == fc_block_end  )
+	{
+	    sprintf( temp_bufr,
+		"Detokenization finished normally after %d bytes.",
+		     fc_block_end - fc_block_start );
+	}else{
+	    sprintf( temp_bufr,
+		"Detokenization finished prematurely after %d of %d bytes.",
+		     get_streampos() - fc_block_start,
+			 fc_block_end - fc_block_start );
+	    ended_okay = FALSE;
+	}
+	printremark( temp_bufr );
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  another_fcode_block
+ *      Synopsis:       Indicate whether there is a follow-on FCode block
+ *                      within the current PCI image.
+ *
+ *      Inputs:
+ *         Parameters:                     NONE
+ *         Global/Static Variables:
+ *             token_streampos             Streampos() of token just gotten
+ *             Next token in Input Stream
+ *
+ *      Outputs:
+ *         Returned Value:                  TRUE if next token shows the start
+ *                                              of a valid FCode-block
+ *         Printout:
+ *             Message if there is a follow-on FCode block
+ *
+ *      Error Detection:
+ *          If next token is neither a valid FCode-block starter nor the
+ *              start of a zero-fill field, print a message.
+ *
+ *      Process Explanation:
+ *          Extract the next token from the Input Stream but do not
+ *              consume it.  Then examine the token.
+ *
+ **************************************************************************** */
+
+static bool another_fcode_block(void)
+{
+    bool retval = FALSE;
+    u16 token;
+
+    token = next_token();
+    set_streampos( token_streampos );
+
+    switch (token)
+    {
+	case 0x0fd: /* version1 */
+	case 0x0f0: /* start0 */
+	case 0x0f1: /* start1 */
+	case 0x0f2: /* start2 */
+	case 0x0f3: /* start4 */
+	    retval = TRUE;
+	    printremark("Subsequent FCode Block detected.  Detokenizing.");
+	    break;
+	case 0:    /* Start of a zero-fill field  */
+	    /* retval already = FALSE .  Nothing else to be done.  */
+	    break;
+	default:
+	    {
+		char temp_bufr[80];
+		sprintf( temp_bufr,
+		    "Unexpected token, 0x%02x, after end of FCode block.",
+		    token);
+		printremark( temp_bufr);
+	    }
+    }
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  detokenize
+ *      Synopsis:       Detokenize one input file 
+ *                      
+ *
+ *
+ **************************************************************************** */
+
+void detokenize(void)
+{
+    fclen = stream_max;
+
+    if ( setjmp(eof_exception) == 0 )
+    {
+	while ( more_to_go() )
+	{
+	    if ( ended_okay )
+	    {
+		init_fcode_block();
+	    }
+	    ended_okay = TRUE;
+
+	    adjust_for_pci_header();
+
+	    /*   Allow for multiple FCode Blocks within the PCI image.
+	     *   The first one had better be a valid block, but the
+	     *   next may or may not be...
+	     */
+	    do
+	    {
+		decode_fcode_block();
+	    }  while  ( another_fcode_block() );
+
+	    adjust_for_pci_filler();
+
+	}
+    }
 
-	decode_lines();
-	printf ("\\ detokenizing finished after %d of %d bytes.\n",
-			get_streampos(), fclen );
 
-	return 0;
 }
diff --git a/detok/detok.c b/detok/detok.c
index 1507a38..a69441e 100644
--- a/detok/detok.c
+++ b/detok/detok.c
@@ -24,58 +24,76 @@
  *
  */
 
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+
 #ifdef __GLIBC__
 #define _GNU_SOURCE
 #include <getopt.h>
-#else
-/* Some systems seem to have an incomplete unistd.h.
- * We need to define getopt() and optind for them.
- */
-extern int optind;
-int getopt(int argc, char * const argv[], const char *optstring);
 #endif
 
 #include "detok.h"
 #include "stream.h"
+#include "addfcodes.h"
 
 #define DETOK_VERSION "0.6.1"
 
-/* prototypes for dictionary handling */
-void init_dictionary(void);
-void decode_token(u16 token);
-/* prototype for detokenizer function */
-int  detokenize(void);
+#define IBM_COPYR    "(C) Copyright 2005 IBM Corporation.  All Rights Reserved."
 
-extern unsigned int decode_all, verbose, linenumbers;
+bool verbose = FALSE ;
+bool decode_all = FALSE ;
+bool show_linenumbers = FALSE ;
+bool show_offsets = FALSE ;
 
-void print_copyright(void)
+/*   Param is FALSE when beginning to detokenize,
+ *       TRUE preceding error-exit   */
+static void print_copyright(bool is_error)
 {
-        printf( "Welcome to the OpenBIOS detokenizer v%s\ndetok Copyright"
+	typedef void (*vfunct)();  /*  Pointer to function returning void  */
+	vfunct pfunct ;
+	char buffr[512];
+
+	sprintf( buffr,
+		"Welcome to the OpenBIOS detokenizer v%s\ndetok Copyright"
 		"(c) 2001-2005 by Stefan Reinauer.\nWritten by Stefan "
 		"Reinauer, <stepan@openbios.org>\n" "This program is "
 		"free software; you may redistribute it under the terms of\n"
 		"the GNU General Public License.  This program has absolutely"
 					" no warranty.\n\n" ,DETOK_VERSION);
+
+	pfunct = ( is_error ? (vfunct)printf : printremark );
+
+        (*pfunct) ( buffr );
+
+        (*pfunct) ( IBM_COPYR "\n" );
 }
 
-void usage(char *name)
+static void usage(char *name)
 {
 	printf( "usage: %s [OPTION]... [FCODE-FILE]...\n\n"
 		"         -v, --verbose     print fcode numbers\n"
 		"         -a, --all         don't stop at end0\n"
 		"         -n, --linenumbers print line numbers\n"
 		"         -o, --offsets     print byte offsets\n"
+		"         -f, --fcodes      add FCodes from list-file\n"
 		"         -h, --help        print this help text\n\n", name);
 }
 
 int main(int argc, char **argv)
 {
 	int c;
-	const char *optstring="vhano?";
+	const char *optstring="vhanof:?";
+	int linenumbers = 0;
+	bool add_vfcodes = FALSE;
+	char *vfc_filnam = NULL;
 
 	while (1) {
 #ifdef __GLIBC__
@@ -86,6 +104,7 @@ int main(int argc, char **argv)
 			{ "all", 0, 0, 'a' },
 			{ "linenumbers", 0, 0, 'n' },
 			{ "offsets", 0, 0, 'o' },
+			{ "fcodes", 1, 0, 'f' },
 			{ 0, 0, 0, 0 }
 		};
 
@@ -99,24 +118,31 @@ int main(int argc, char **argv)
 
 		switch (c) {
 		case 'v':
-			verbose=1;
+			verbose=TRUE;
 			break;
 		case 'a':
-			decode_all=1;
+			decode_all=TRUE;
 			break;
 		case 'n':
 			linenumbers|=1;
+			show_linenumbers = TRUE;
 			break;
 		case 'o':
 			linenumbers|=2;
+			show_linenumbers = TRUE;
+			show_offsets = TRUE;
+			break;
+		case 'f':
+			add_vfcodes = TRUE;
+			vfc_filnam = optarg;
 			break;
 		case 'h':
 		case '?':
-			print_copyright();
+			print_copyright(TRUE);
 			usage(argv[0]);
 			return 0;		
 		default:
-			print_copyright();
+			print_copyright(TRUE);
 			printf ("%s: unknown option.\n",argv[0]);
 			usage(argv[0]);
 			return 1;
@@ -124,13 +150,14 @@ int main(int argc, char **argv)
 	}
 
 	if (verbose)
-		print_copyright();
+		print_copyright(FALSE);
 	
 	if (linenumbers>2)
-		printf("Line numbers will be disabled in favour of offsets.\n");
+		printremark(
+		    "Line numbers will be disabled in favour of offsets.\n");
 	
 	if (optind >= argc) {
-		print_copyright();
+		print_copyright(TRUE);
 		printf ("%s: filename missing.\n",argv[0]);
 		usage(argv[0]);
 		return 1;
@@ -138,6 +165,14 @@ int main(int argc, char **argv)
 	
 	init_dictionary();
 	
+	if ( add_vfcodes )
+	{
+	    if ( add_fcodes_from_list( vfc_filnam) )
+	    {
+	        freeze_dictionary();
+	    }
+	}
+
 	while (optind < argc) {
 		
 		if (init_stream(argv[optind])) {
diff --git a/detok/detok.h b/detok/detok.h
index 17c2b16..9e683cc 100644
--- a/detok/detok.h
+++ b/detok/detok.h
@@ -1,3 +1,6 @@
+#ifndef _UTILS_DETOK_DETOK_H
+#define _UTILS_DETOK_DETOK_H
+
 /*
  *                     OpenBIOS - free your system! 
  *                            ( detokenizer )
@@ -24,10 +27,49 @@
  *
  */
 
-#define u8 unsigned char
-#define u16 unsigned short
-#define u32 unsigned int
-#define s16 short
-#define bool int
-#define TRUE (-1)
-#define FALSE (0)
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+
+#include "types.h"
+
+/*  Prototypes for functions exported from
+ *   detok.c  decode.c  printformats.c  pcihdr.c  and  dictionary.c
+ */
+
+void add_token(u16 number, char *name);
+void init_dictionary(void);
+void reset_dictionary(void);
+void freeze_dictionary(void);
+char *lookup_token(u16 number);
+
+void detokenize(void);
+
+void printremark(char *str);
+
+int handle_pci_header ( u8  *data_ptr );
+void handle_pci_filler(u8 *filler_ptr);
+
+
+/*  External declarations for variables defined in or used by
+ *   detok.c  decode.c  printformats.c  pcihdr.c  and  dictionary.c
+ */
+extern bool verbose;
+extern bool decode_all;
+extern bool show_linenumbers;
+extern bool show_offsets;
+
+extern bool check_tok_seq;
+
+extern u16 fcode;
+extern bool offs16;
+extern bool end_found;
+extern unsigned int linenum;
+
+extern u8 *pci_image_end;
+extern unsigned int token_streampos;
+extern u16 last_defined_token;
+
+#endif   /*  _UTILS_DETOK_DETOK_H    */
diff --git a/detok/dictionary.c b/detok/dictionary.c
index 46eff92..fe2ef33 100644
--- a/detok/dictionary.c
+++ b/detok/dictionary.c
@@ -24,20 +24,29 @@
  *
  */
 
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
 
 #include "detok.h"
 
+bool check_tok_seq = TRUE;
+
 typedef struct token {
-	u8  *name;
+	char *name;
 	u16 fcode;
 	struct token *next;
 } token_t;
+#define TOKEN_ENTRY(num, name)   { name, (u16)num, (token_t *)NULL }
+static token_t *dictionary;   /*  Initialize dynamically to accommodate AIX  */
 
 static char *fcerror="ferror";
-token_t *dictionary=NULL;
 
 char *lookup_token(u16 number)
 {
@@ -53,7 +62,51 @@ char *lookup_token(u16 number)
 	return fcerror;
 }
 
-int add_token(u16 number, char *name)
+/* **************************************************************************
+ *
+ *      Function name:  add_token
+ *      Synopsis:       Add an entry to the FCode-Tokens vocabulary.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             number                      Numeric value of the FCode token
+ *             name                        Name of the function to display
+ *         Global/Static Variables:
+ *             dictionary                  Pointer to the "tail" of the
+ *                                             FCode-Tokens vocabulary.
+ *             check_tok_seq               TRUE = "Check Token Sequence"
+ *                                             A retro-fit to accommodate
+ *                                             adding Vendor FCodes
+ *
+ *      Outputs:
+ *         Returned Value:                 NONE
+ *         Global/Static Variables:
+ *             dictionary                  Updated to point to the new entry.
+ *             last_defined_token          Updated to the given FCode token
+ *         Memory Allocated
+ *             For the new entry.
+ *         When Freed?
+ *             Never.  Retained for duration of the program.
+ *
+ *      Error Detection:
+ *          Failure to allocate memory is a fatal error.
+ *          If the given FCode token is not exactly one larger than the
+ *              previous  last_defined_token , then there's something
+ *              odd going on; print a remark to alert the user.  The
+ *              value of  last_defined_token  will be used elsewhere
+ *              for additional error-checking.
+ *
+ *      Process Explanation:
+ *          The name field pointer is presumed to already point to a stable
+ *              memory-space.
+ *          Memory will be allocated for the entry itself; its fields will
+ *              be entered and the pointer-to-the-tail-of-the-vocabulary
+ *              will be updated to point to the new entry.
+ *          Error-check and update  last_defined_token  
+ *
+ **************************************************************************** */
+
+void add_token(u16 number, char *name)
 {
 	token_t *curr;
 
@@ -68,393 +121,451 @@ int add_token(u16 number, char *name)
 	curr->name=name;
 
 	dictionary=curr;
-	return 0;
+
+	if ( check_tok_seq )
+	{
+	    /*  Error-check, but not for first time.  */
+	    if ( (number == last_defined_token + 1)
+		   || (last_defined_token == 0) )
+	    {
+		last_defined_token = number;
+	    }else{
+		if ( number <= last_defined_token )
+		{
+		    printremark("Warning:  New token # might overlap "
+			"previously assigned token #(s).");
+		}else{
+		    printremark("Warning:  New token # out of sequence with "
+			"previously assigned token #(s).");
+		    /*  It's increasing; update it.  */
+		    last_defined_token = number;
+		}
 }
+	}
+
+}
+
+token_t detok_table[]  = {
+
+	TOKEN_ENTRY( 0x000, "end0" ),
+	TOKEN_ENTRY( 0x010, "b(lit)" ),
+	TOKEN_ENTRY( 0x011, "b(')" ),
+	TOKEN_ENTRY( 0x012, "b(\")" ),
+	TOKEN_ENTRY( 0x013, "bbranch" ),
+	TOKEN_ENTRY( 0x014, "b?branch" ),
+	TOKEN_ENTRY( 0x015, "b(loop)" ),
+	TOKEN_ENTRY( 0x016, "b(+loop)" ),
+	TOKEN_ENTRY( 0x017, "b(do)" ),
+	TOKEN_ENTRY( 0x018, "b(?do)" ),
+	TOKEN_ENTRY( 0x019, "i" ),
+	TOKEN_ENTRY( 0x01a, "j" ),
+	TOKEN_ENTRY( 0x01b, "b(leave)" ),
+	TOKEN_ENTRY( 0x01c, "b(of)" ),
+	TOKEN_ENTRY( 0x01d, "execute" ),
+	TOKEN_ENTRY( 0x01e, "+" ),
+	TOKEN_ENTRY( 0x01f, "-" ),
+	TOKEN_ENTRY( 0x020, "*" ),
+	TOKEN_ENTRY( 0x021, "/" ),
+	TOKEN_ENTRY( 0x022, "mod" ),
+	TOKEN_ENTRY( 0x023, "and" ),
+	TOKEN_ENTRY( 0x024, "or" ),
+	TOKEN_ENTRY( 0x025, "xor" ),
+	TOKEN_ENTRY( 0x026, "invert" ),
+	TOKEN_ENTRY( 0x027, "lshift" ),
+	TOKEN_ENTRY( 0x028, "rshift" ),
+	TOKEN_ENTRY( 0x029, ">>a" ),
+	TOKEN_ENTRY( 0x02a, "/mod" ),
+	TOKEN_ENTRY( 0x02b, "u/mod" ),
+	TOKEN_ENTRY( 0x02c, "negate" ),
+	TOKEN_ENTRY( 0x02d, "abs" ),
+	TOKEN_ENTRY( 0x02e, "min" ),
+	TOKEN_ENTRY( 0x02f, "max" ),
+	TOKEN_ENTRY( 0x030, ">r" ),
+	TOKEN_ENTRY( 0x031, "r>" ),
+	TOKEN_ENTRY( 0x032, "r@" ),
+	TOKEN_ENTRY( 0x033, "exit" ),
+	TOKEN_ENTRY( 0x034, "0=" ),
+	TOKEN_ENTRY( 0x035, "0<>" ),
+	TOKEN_ENTRY( 0x036, "0<" ),
+	TOKEN_ENTRY( 0x037, "0<=" ),
+	TOKEN_ENTRY( 0x038, "0>" ),
+	TOKEN_ENTRY( 0x039, "0>=" ),
+	TOKEN_ENTRY( 0x03a, "<" ),
+	TOKEN_ENTRY( 0x03b, ">" ),
+	TOKEN_ENTRY( 0x03c, "=" ),
+	TOKEN_ENTRY( 0x03d, "<>" ),
+	TOKEN_ENTRY( 0x03e, "u>" ),
+	TOKEN_ENTRY( 0x03f, "u<=" ),
+	TOKEN_ENTRY( 0x040, "u<" ),
+	TOKEN_ENTRY( 0x041, "u>=" ),
+	TOKEN_ENTRY( 0x042, ">=" ),
+	TOKEN_ENTRY( 0x043, "<=" ),
+	TOKEN_ENTRY( 0x044, "between" ),
+	TOKEN_ENTRY( 0x045, "within" ),
+	TOKEN_ENTRY( 0x046, "drop" ),
+	TOKEN_ENTRY( 0x047, "dup" ),
+	TOKEN_ENTRY( 0x048, "over" ),
+	TOKEN_ENTRY( 0x049, "swap" ),
+	TOKEN_ENTRY( 0x04A, "rot" ),
+	TOKEN_ENTRY( 0x04b, "-rot" ),
+	TOKEN_ENTRY( 0x04c, "tuck" ),
+	TOKEN_ENTRY( 0x04d, "nip" ),
+	TOKEN_ENTRY( 0x04e, "pick" ),
+	TOKEN_ENTRY( 0x04f, "roll" ),
+	TOKEN_ENTRY( 0x050, "?dup" ),
+	TOKEN_ENTRY( 0x051, "depth" ),
+	TOKEN_ENTRY( 0x052, "2drop" ),
+	TOKEN_ENTRY( 0x053, "2dup" ),
+	TOKEN_ENTRY( 0x054, "2over" ),
+	TOKEN_ENTRY( 0x055, "2swap" ),
+	TOKEN_ENTRY( 0x056, "2rot" ),
+	TOKEN_ENTRY( 0x057, "2/" ),
+	TOKEN_ENTRY( 0x058, "u2/" ),
+	TOKEN_ENTRY( 0x059, "2*" ),
+	TOKEN_ENTRY( 0x05a, "/c" ),
+	TOKEN_ENTRY( 0x05b, "/w" ),
+	TOKEN_ENTRY( 0x05c, "/l" ),
+	TOKEN_ENTRY( 0x05d, "/n" ),
+	TOKEN_ENTRY( 0x05e, "ca+" ),
+	TOKEN_ENTRY( 0x05f, "wa+" ),
+	TOKEN_ENTRY( 0x060, "la+" ),
+	TOKEN_ENTRY( 0x061, "na+" ),
+	TOKEN_ENTRY( 0x062, "char+" ),
+	TOKEN_ENTRY( 0x063, "wa1+" ),
+	TOKEN_ENTRY( 0x064, "la1+" ),
+	TOKEN_ENTRY( 0x065, "cell+" ),
+	TOKEN_ENTRY( 0x066, "chars" ),
+	TOKEN_ENTRY( 0x067, "/w*" ),
+	TOKEN_ENTRY( 0x068, "/l*" ),
+	TOKEN_ENTRY( 0x069, "cells" ),
+	TOKEN_ENTRY( 0x06a, "on" ),
+	TOKEN_ENTRY( 0x06b, "off" ),
+	TOKEN_ENTRY( 0x06c, "+!" ),
+	TOKEN_ENTRY( 0x06d, "@" ),
+	TOKEN_ENTRY( 0x06e, "l@" ),
+	TOKEN_ENTRY( 0x06f, "w@" ),
+	TOKEN_ENTRY( 0x070, "<w@" ),
+	TOKEN_ENTRY( 0x071, "c@" ),
+	TOKEN_ENTRY( 0x072, "!" ),
+	TOKEN_ENTRY( 0x073, "l!" ),
+	TOKEN_ENTRY( 0x074, "w!" ),
+	TOKEN_ENTRY( 0x075, "c!" ),
+	TOKEN_ENTRY( 0x076, "2@" ),
+	TOKEN_ENTRY( 0x077, "2!" ),
+	TOKEN_ENTRY( 0x078, "move" ),
+	TOKEN_ENTRY( 0x079, "fill" ),
+	TOKEN_ENTRY( 0x07a, "comp" ),
+	TOKEN_ENTRY( 0x07b, "noop" ),
+	TOKEN_ENTRY( 0x07c, "lwsplit" ),
+	TOKEN_ENTRY( 0x07d, "wljoin" ),
+	TOKEN_ENTRY( 0x07e, "lbsplit" ),
+	TOKEN_ENTRY( 0x07f, "bljoin" ),
+	TOKEN_ENTRY( 0x080, "wbflip" ),
+	TOKEN_ENTRY( 0x081, "upc" ),
+	TOKEN_ENTRY( 0x082, "lcc" ),
+	TOKEN_ENTRY( 0x083, "pack" ),
+	TOKEN_ENTRY( 0x084, "count" ),
+	TOKEN_ENTRY( 0x085, "body>" ),
+	TOKEN_ENTRY( 0x086, ">body" ),
+	TOKEN_ENTRY( 0x087, "fcode-revision" ),
+	TOKEN_ENTRY( 0x088, "span" ),
+	TOKEN_ENTRY( 0x089, "unloop" ),
+	TOKEN_ENTRY( 0x08a, "expect" ),
+	TOKEN_ENTRY( 0x08b, "alloc-mem" ),
+	TOKEN_ENTRY( 0x08c, "free-mem" ),
+	TOKEN_ENTRY( 0x08d, "key?" ),
+	TOKEN_ENTRY( 0x08e, "key" ),
+	TOKEN_ENTRY( 0x08f, "emit" ),
+	TOKEN_ENTRY( 0x090, "type" ),
+	TOKEN_ENTRY( 0x091, "(cr" ),
+	TOKEN_ENTRY( 0x092, "cr" ),
+	TOKEN_ENTRY( 0x093, "#out" ),
+	TOKEN_ENTRY( 0x094, "#line" ),
+	TOKEN_ENTRY( 0x095, "hold" ),
+	TOKEN_ENTRY( 0x096, "<#" ),
+	TOKEN_ENTRY( 0x097, "u#>" ),
+	TOKEN_ENTRY( 0x098, "sign" ),
+	TOKEN_ENTRY( 0x099, "u#" ),
+	TOKEN_ENTRY( 0x09a, "u#s" ),
+	TOKEN_ENTRY( 0x09b, "u." ),
+	TOKEN_ENTRY( 0x09c, "u.r" ),
+	TOKEN_ENTRY( 0x09d, "." ),
+	TOKEN_ENTRY( 0x09e, ".r" ),
+	TOKEN_ENTRY( 0x09f, ".s" ),
+	TOKEN_ENTRY( 0x0a0, "base" ),
+	TOKEN_ENTRY( 0x0a1, "convert" ),
+	TOKEN_ENTRY( 0x0a2, "$number" ),
+	TOKEN_ENTRY( 0x0a3, "digit" ),
+	TOKEN_ENTRY( 0x0a4, "-1" ),
+	TOKEN_ENTRY( 0x0a5, "0" ),
+	TOKEN_ENTRY( 0x0a6, "1" ),
+	TOKEN_ENTRY( 0x0a7, "2" ),
+	TOKEN_ENTRY( 0x0a8, "3" ),
+	TOKEN_ENTRY( 0x0a9, "bl" ),
+	TOKEN_ENTRY( 0x0aa, "bs" ),
+	TOKEN_ENTRY( 0x0ab, "bell" ),
+	TOKEN_ENTRY( 0x0ac, "bounds" ),
+	TOKEN_ENTRY( 0x0ad, "here" ),
+	TOKEN_ENTRY( 0x0ae, "aligned" ),
+	TOKEN_ENTRY( 0x0af, "wbsplit" ),
+	TOKEN_ENTRY( 0x0b0, "bwjoin" ),
+	TOKEN_ENTRY( 0x0b1, "b(<mark)" ),
+	TOKEN_ENTRY( 0x0b2, "b(>resolve)" ),
+	TOKEN_ENTRY( 0x0b3, "set-token-table" ),
+	TOKEN_ENTRY( 0x0b4, "set-table" ),
+	TOKEN_ENTRY( 0x0b5, "new-token" ),
+	TOKEN_ENTRY( 0x0b6, "named-token" ),
+	TOKEN_ENTRY( 0x0b7, "b(:)" ),
+	TOKEN_ENTRY( 0x0b8, "b(value)" ),
+	TOKEN_ENTRY( 0x0b9, "b(variable)" ),
+	TOKEN_ENTRY( 0x0ba, "b(constant)" ),
+	TOKEN_ENTRY( 0x0bb, "b(create)" ),
+	TOKEN_ENTRY( 0x0bc, "b(defer)" ),
+	TOKEN_ENTRY( 0x0bd, "b(buffer:)" ),
+	TOKEN_ENTRY( 0x0be, "b(field)" ),
+	TOKEN_ENTRY( 0x0bf, "b(code)" ),
+	TOKEN_ENTRY( 0x0c0, "instance" ),
+	TOKEN_ENTRY( 0x0c2, "b(;)" ),
+	TOKEN_ENTRY( 0x0c3, "b(to)" ),
+	TOKEN_ENTRY( 0x0c4, "b(case)" ),
+	TOKEN_ENTRY( 0x0c5, "b(endcase)" ),
+	TOKEN_ENTRY( 0x0c6, "b(endof)" ),
+	TOKEN_ENTRY( 0x0c7, "#" ),
+	TOKEN_ENTRY( 0x0c8, "#s" ),
+	TOKEN_ENTRY( 0x0c9, "#>" ),
+	TOKEN_ENTRY( 0x0ca, "external-token" ),
+	TOKEN_ENTRY( 0x0cb, "$find" ),
+	TOKEN_ENTRY( 0x0cc, "offset16" ),
+	TOKEN_ENTRY( 0x0cd, "evaluate" ),
+	TOKEN_ENTRY( 0x0d0, "c," ),
+	TOKEN_ENTRY( 0x0d1, "w," ),
+	TOKEN_ENTRY( 0x0d2, "l," ),
+	TOKEN_ENTRY( 0x0d3, "," ),
+	TOKEN_ENTRY( 0x0d4, "um*" ),
+	TOKEN_ENTRY( 0x0d5, "um/mod" ),
+	TOKEN_ENTRY( 0x0d8, "d+" ),
+	TOKEN_ENTRY( 0x0d9, "d-" ),
+	TOKEN_ENTRY( 0x0da, "get-token" ),
+	TOKEN_ENTRY( 0x0db, "set-token" ),
+	TOKEN_ENTRY( 0x0dc, "state" ),
+	TOKEN_ENTRY( 0x0dd, "compile" ),
+	TOKEN_ENTRY( 0x0de, "behavior" ),
+	TOKEN_ENTRY( 0x0f0, "start0" ),
+	TOKEN_ENTRY( 0x0f1, "start1" ),
+	TOKEN_ENTRY( 0x0f2, "start2" ),
+	TOKEN_ENTRY( 0x0f3, "start4" ),
+	TOKEN_ENTRY( 0x0fc, "ferror" ),
+	TOKEN_ENTRY( 0x0fd, "version1" ),
+	TOKEN_ENTRY( 0x0fe, "4-byte-id" ),
+	TOKEN_ENTRY( 0x0ff, "end1" ),
+	TOKEN_ENTRY( 0x101, "dma-alloc" ),
+	TOKEN_ENTRY( 0x102, "my-address" ),
+	TOKEN_ENTRY( 0x103, "my-space" ),
+	TOKEN_ENTRY( 0x104, "memmap" ),
+	TOKEN_ENTRY( 0x105, "free-virtual" ),
+	TOKEN_ENTRY( 0x106, ">physical" ),
+	TOKEN_ENTRY( 0x10f, "my-params" ),
+	TOKEN_ENTRY( 0x110, "property" ),
+	TOKEN_ENTRY( 0x111, "encode-int" ),
+	TOKEN_ENTRY( 0x112, "encode+" ),
+	TOKEN_ENTRY( 0x113, "encode-phys" ),
+	TOKEN_ENTRY( 0x114, "encode-string" ),
+	TOKEN_ENTRY( 0x115, "encode-bytes" ),
+	TOKEN_ENTRY( 0x116, "reg" ),
+	TOKEN_ENTRY( 0x117, "intr" ),
+	TOKEN_ENTRY( 0x118, "driver" ),
+	TOKEN_ENTRY( 0x119, "model" ),
+	TOKEN_ENTRY( 0x11a, "device-type" ),
+	TOKEN_ENTRY( 0x11b, "parse-2int" ),
+	TOKEN_ENTRY( 0x11c, "is-install" ),
+	TOKEN_ENTRY( 0x11d, "is-remove" ),
+	TOKEN_ENTRY( 0x11e, "is-selftest" ),
+	TOKEN_ENTRY( 0x11f, "new-device" ),
+	TOKEN_ENTRY( 0x120, "diagnostic-mode?" ),
+	TOKEN_ENTRY( 0x121, "display-status" ),
+	TOKEN_ENTRY( 0x122, "memory-test-issue" ),
+	TOKEN_ENTRY( 0x123, "group-code" ),
+	TOKEN_ENTRY( 0x124, "mask" ),
+	TOKEN_ENTRY( 0x125, "get-msecs" ),
+	TOKEN_ENTRY( 0x126, "ms" ),
+	TOKEN_ENTRY( 0x127, "finish-device" ),
+	TOKEN_ENTRY( 0x128, "decode-phys" ),
+	TOKEN_ENTRY( 0x12b, "interpose" ),
+	TOKEN_ENTRY( 0x130, "map-low" ),
+	TOKEN_ENTRY( 0x131, "sbus-intr>cpu" ),
+	TOKEN_ENTRY( 0x150, "#lines" ),
+	TOKEN_ENTRY( 0x151, "#columns" ),
+	TOKEN_ENTRY( 0x152, "line#" ),
+	TOKEN_ENTRY( 0x153, "column#" ),
+	TOKEN_ENTRY( 0x154, "inverse?" ),
+	TOKEN_ENTRY( 0x155, "inverse-screen?" ),
+	TOKEN_ENTRY( 0x156, "frame-buffer-busy?" ),
+	TOKEN_ENTRY( 0x157, "draw-character" ),
+	TOKEN_ENTRY( 0x158, "reset-screen" ),
+	TOKEN_ENTRY( 0x159, "toggle-cursor" ),
+	TOKEN_ENTRY( 0x15a, "erase-screen" ),
+	TOKEN_ENTRY( 0x15b, "blink-screen" ),
+	TOKEN_ENTRY( 0x15c, "invert-screen" ),
+	TOKEN_ENTRY( 0x15d, "insert-characters" ),
+	TOKEN_ENTRY( 0x15e, "delete-characters" ),
+	TOKEN_ENTRY( 0x15f, "insert-lines" ),
+	TOKEN_ENTRY( 0x160, "delete-lines" ),
+	TOKEN_ENTRY( 0x161, "draw-logo" ),
+	TOKEN_ENTRY( 0x162, "frame-buffer-adr" ),
+	TOKEN_ENTRY( 0x163, "screen-height" ),
+	TOKEN_ENTRY( 0x164, "screen-width" ),
+	TOKEN_ENTRY( 0x165, "window-top" ),
+	TOKEN_ENTRY( 0x166, "window-left" ),
+	TOKEN_ENTRY( 0x16a, "default-font" ),
+	TOKEN_ENTRY( 0x16b, "set-font" ),
+	TOKEN_ENTRY( 0x16c, "char-height" ),
+	TOKEN_ENTRY( 0x16d, "char-width" ),
+	TOKEN_ENTRY( 0x16e, ">font" ),
+	TOKEN_ENTRY( 0x16f, "fontbytes" ),
+	TOKEN_ENTRY( 0x170, "fb1-draw-character" ),
+	TOKEN_ENTRY( 0x171, "fb1-reset-screen" ),
+	TOKEN_ENTRY( 0x172, "fb1-toggle-cursor" ),
+	TOKEN_ENTRY( 0x173, "fb1-erase-screen" ),
+	TOKEN_ENTRY( 0x174, "fb1-blink-screen" ),
+	TOKEN_ENTRY( 0x175, "fb1-invert-screen" ),
+	TOKEN_ENTRY( 0x176, "fb1-insert-characters" ),
+	TOKEN_ENTRY( 0x177, "fb1-delete-characters" ),
+	TOKEN_ENTRY( 0x178, "fb1-insert-lines" ),
+	TOKEN_ENTRY( 0x179, "fb1-delete-lines" ),
+	TOKEN_ENTRY( 0x17a, "fb1-draw-logo" ),
+	TOKEN_ENTRY( 0x17b, "fb1-install" ),
+	TOKEN_ENTRY( 0x17c, "fb1-slide-up" ),
+	TOKEN_ENTRY( 0x180, "fb8-draw-character" ),
+	TOKEN_ENTRY( 0x181, "fb8-reset-screen" ),
+	TOKEN_ENTRY( 0x182, "fb8-toggle-cursor" ),
+	TOKEN_ENTRY( 0x183, "fb8-erase-screen" ),
+	TOKEN_ENTRY( 0x184, "fb8-blink-screen" ),
+	TOKEN_ENTRY( 0x185, "fb8-invert-screen" ),
+	TOKEN_ENTRY( 0x186, "fb8-insert-characters" ),
+	TOKEN_ENTRY( 0x187, "fb8-delete-characters" ),
+	TOKEN_ENTRY( 0x188, "fb8-insert-lines" ),
+	TOKEN_ENTRY( 0x189, "fb8-delete-lines" ),
+	TOKEN_ENTRY( 0x18a, "fb8-draw-logo" ),
+	TOKEN_ENTRY( 0x18b, "fb8-install" ),
+	TOKEN_ENTRY( 0x1a0, "return-buffer" ),
+	TOKEN_ENTRY( 0x1a1, "xmit-packet" ),
+	TOKEN_ENTRY( 0x1a2, "poll-packet" ),
+	TOKEN_ENTRY( 0x1a4, "mac-address" ),
+	TOKEN_ENTRY( 0x201, "device-name" ),
+	TOKEN_ENTRY( 0x202, "my-args" ),
+	TOKEN_ENTRY( 0x203, "my-self" ),
+	TOKEN_ENTRY( 0x204, "find-package" ),
+	TOKEN_ENTRY( 0x205, "open-package" ),
+	TOKEN_ENTRY( 0x206, "close-package" ),
+	TOKEN_ENTRY( 0x207, "find-method" ),
+	TOKEN_ENTRY( 0x208, "call-package" ),
+	TOKEN_ENTRY( 0x209, "$call-parent" ),
+	TOKEN_ENTRY( 0x20a, "my-parent" ),
+	TOKEN_ENTRY( 0x20b, "ihandle>phandle" ),
+	TOKEN_ENTRY( 0x20d, "my-unit" ),
+	TOKEN_ENTRY( 0x20e, "$call-method" ),
+	TOKEN_ENTRY( 0x20f, "$open-package" ),
+	TOKEN_ENTRY( 0x210, "processor-type" ),
+	TOKEN_ENTRY( 0x211, "firmware-version" ),
+	TOKEN_ENTRY( 0x212, "fcode-version" ),
+	TOKEN_ENTRY( 0x213, "alarm" ),
+	TOKEN_ENTRY( 0x214, "(is-user-word)" ),
+	TOKEN_ENTRY( 0x215, "suspend-fcode" ),
+	TOKEN_ENTRY( 0x216, "abort" ),
+	TOKEN_ENTRY( 0x217, "catch" ),
+	TOKEN_ENTRY( 0x218, "throw" ),
+	TOKEN_ENTRY( 0x219, "user-abort" ),
+	TOKEN_ENTRY( 0x21a, "get-my-property" ),
+	TOKEN_ENTRY( 0x21b, "decode-int" ),
+	TOKEN_ENTRY( 0x21c, "decode-string" ),
+	TOKEN_ENTRY( 0x21d, "get-inherited-property" ),
+	TOKEN_ENTRY( 0x21e, "delete-property" ),
+	TOKEN_ENTRY( 0x21f, "get-package-property" ),
+	TOKEN_ENTRY( 0x220, "cpeek" ),
+	TOKEN_ENTRY( 0x221, "wpeek" ),
+	TOKEN_ENTRY( 0x222, "lpeek" ),
+	TOKEN_ENTRY( 0x223, "cpoke" ),
+	TOKEN_ENTRY( 0x224, "wpoke" ),
+	TOKEN_ENTRY( 0x225, "lpoke" ),
+	TOKEN_ENTRY( 0x226, "lwflip" ),
+	TOKEN_ENTRY( 0x227, "lbflip" ),
+	TOKEN_ENTRY( 0x228, "lbflips" ),
+	TOKEN_ENTRY( 0x229, "adr-mask" ),
+	TOKEN_ENTRY( 0x230, "rb@" ),
+	TOKEN_ENTRY( 0x231, "rb!" ),
+	TOKEN_ENTRY( 0x232, "rw@" ),
+	TOKEN_ENTRY( 0x233, "rw!" ),
+	TOKEN_ENTRY( 0x234, "rl@" ),
+	TOKEN_ENTRY( 0x235, "rl!" ),
+	TOKEN_ENTRY( 0x236, "wbflips" ),
+	TOKEN_ENTRY( 0x237, "lwflips" ),
+	TOKEN_ENTRY( 0x238, "probe" ),
+	TOKEN_ENTRY( 0x239, "probe-virtual" ),
+	TOKEN_ENTRY( 0x23b, "child" ),
+	TOKEN_ENTRY( 0x23c, "peer" ),
+	TOKEN_ENTRY( 0x23d, "next-property" ),
+	TOKEN_ENTRY( 0x23e, "byte-load" ),
+	TOKEN_ENTRY( 0x23f, "set-args" ),
+	TOKEN_ENTRY( 0x240, "left-parse-string" ),
+
+	/* FCodes from 64bit extension addendum */
+	TOKEN_ENTRY( 0x22e, "rx@" ),
+	TOKEN_ENTRY( 0x22f, "rx!" ),
+	TOKEN_ENTRY( 0x241, "bxjoin" ),
+	TOKEN_ENTRY( 0x242, "<l@" ),
+	TOKEN_ENTRY( 0x243, "lxjoin" ),
+	TOKEN_ENTRY( 0x244, "wxjoin" ),
+	TOKEN_ENTRY( 0x245, "x," ),
+	TOKEN_ENTRY( 0x246, "x@" ),
+	TOKEN_ENTRY( 0x247, "x!" ),
+	TOKEN_ENTRY( 0x248, "/x" ),
+	TOKEN_ENTRY( 0x249, "/x*" ),
+	TOKEN_ENTRY( 0x24a, "xa+" ),
+	TOKEN_ENTRY( 0x24b, "xa1+" ),
+	TOKEN_ENTRY( 0x24c, "xbflip" ),
+	TOKEN_ENTRY( 0x24d, "xbflips" ),
+	TOKEN_ENTRY( 0x24e, "xbsplit" ),
+	TOKEN_ENTRY( 0x24f, "xlflip" ),
+	TOKEN_ENTRY( 0x250, "xlflips" ),
+	TOKEN_ENTRY( 0x251, "xlsplit" ),
+	TOKEN_ENTRY( 0x252, "xwflip" ),
+	TOKEN_ENTRY( 0x253, "xwflips" ),
+	TOKEN_ENTRY( 0x254, "xwsplit" ),
+};
+
+static const int dictionary_indx_max = (sizeof(detok_table)/sizeof(token_t)) ;
+
+static token_t *dictionary_reset_position;
 
 void init_dictionary(void) 
 {
-	add_token( 0x000, "end0" );
-	add_token( 0x010, "b(lit)" );
-	add_token( 0x011, "b(')" );
-	add_token( 0x012, "b(\")" );
-	add_token( 0x013, "bbranch" );
-	add_token( 0x014, "b?branch" );
-	add_token( 0x015, "b(loop)" );
-	add_token( 0x016, "b(+loop)" );
-	add_token( 0x017, "b(do)" );
-	add_token( 0x018, "b(?do)" );
-	add_token( 0x019, "i" );
-	add_token( 0x01a, "j" );
-	add_token( 0x01b, "b(leave)" );
-	add_token( 0x01c, "b(of)" );
-	add_token( 0x01d, "execute" );
-	add_token( 0x01e, "+" );
-	add_token( 0x01f, "-" );
-	add_token( 0x020, "*" );
-	add_token( 0x021, "/" );
-	add_token( 0x022, "mod" );
-	add_token( 0x023, "and" );
-	add_token( 0x024, "or" );
-	add_token( 0x025, "xor" );
-	add_token( 0x026, "invert" );
-	add_token( 0x027, "lshift" );
-	add_token( 0x028, "rshift" );
-	add_token( 0x029, ">>a" );
-	add_token( 0x02a, "/mod" );
-	add_token( 0x02b, "u/mod" );
-	add_token( 0x02c, "negate" );
-	add_token( 0x02d, "abs" );
-	add_token( 0x02e, "min" );
-	add_token( 0x02f, "max" );
-	add_token( 0x030, ">r" );
-	add_token( 0x031, "r>" );
-	add_token( 0x032, "r@" );
-	add_token( 0x033, "exit" );
-	add_token( 0x034, "0=" );
-	add_token( 0x035, "0<>" );
-	add_token( 0x036, "0<" );
-	add_token( 0x037, "0<=" );
-	add_token( 0x038, "0>" );
-	add_token( 0x039, "0>=" );
-	add_token( 0x03a, "<" );
-	add_token( 0x03b, ">" );
-	add_token( 0x03c, "=" );
-	add_token( 0x03d, "<>" );
-	add_token( 0x03e, "u>" );
-	add_token( 0x03f, "u<=" );
-	add_token( 0x040, "u<" );
-	add_token( 0x041, "u>=" );
-	add_token( 0x042, ">=" );
-	add_token( 0x043, "<=" );
-	add_token( 0x044, "between" );
-	add_token( 0x045, "within" );
-	add_token( 0x046, "drop" );
-	add_token( 0x047, "dup" );
-	add_token( 0x048, "over" );
-	add_token( 0x049, "swap" );
-	add_token( 0x04A, "rot" );
-	add_token( 0x04b, "-rot" );
-	add_token( 0x04c, "tuck" );
-	add_token( 0x04d, "nip" );
-	add_token( 0x04e, "pick" );
-	add_token( 0x04f, "roll" );
-	add_token( 0x050, "?dup" );
-	add_token( 0x051, "depth" );
-	add_token( 0x052, "2drop" );
-	add_token( 0x053, "2dup" );
-	add_token( 0x054, "2over" );
-	add_token( 0x055, "2swap" );
-	add_token( 0x056, "2rot" );
-	add_token( 0x057, "2/" );
-	add_token( 0x058, "u2/" );
-	add_token( 0x059, "2*" );
-	add_token( 0x05a, "/c" );
-	add_token( 0x05b, "/w" );
-	add_token( 0x05c, "/l" );
-	add_token( 0x05d, "/n" );
-	add_token( 0x05e, "ca+" );
-	add_token( 0x05f, "wa+" );
-	add_token( 0x060, "la+" );
-	add_token( 0x061, "na+" );
-	add_token( 0x062, "char+" );
-	add_token( 0x063, "wa1+" );
-	add_token( 0x064, "la1+" );
-	add_token( 0x065, "cell+" );
-	add_token( 0x066, "chars" );
-	add_token( 0x067, "/w*" );
-	add_token( 0x068, "/l*" );
-	add_token( 0x069, "cells" );
-	add_token( 0x06a, "on" );
-	add_token( 0x06b, "off" );
-	add_token( 0x06c, "+!" );
-	add_token( 0x06d, "@" );
-	add_token( 0x06e, "l@" );
-	add_token( 0x06f, "w@" );
-	add_token( 0x070, "<w@" );
-	add_token( 0x071, "c@" );
-	add_token( 0x072, "!" );
-	add_token( 0x073, "l!" );
-	add_token( 0x074, "w!" );
-	add_token( 0x075, "c!" );
-	add_token( 0x076, "2@" );
-	add_token( 0x077, "2!" );
-	add_token( 0x078, "move" );
-	add_token( 0x079, "fill" );
-	add_token( 0x07a, "comp" );
-	add_token( 0x07b, "noop" );
-	add_token( 0x07c, "lwsplit" );
-	add_token( 0x07d, "wljoin" );
-	add_token( 0x07e, "lbsplit" );
-	add_token( 0x07f, "bljoin" );
-	add_token( 0x080, "wbflip" );
-	add_token( 0x081, "upc" );
-	add_token( 0x082, "lcc" );
-	add_token( 0x083, "pack" );
-	add_token( 0x084, "count" );
-	add_token( 0x085, "body>" );
-	add_token( 0x086, ">body" );
-	add_token( 0x087, "fcode-revision" );
-	add_token( 0x088, "span" );
-	add_token( 0x089, "unloop" );
-	add_token( 0x08a, "expect" );
-	add_token( 0x08b, "alloc-mem" );
-	add_token( 0x08c, "free-mem" );
-	add_token( 0x08d, "key?" );
-	add_token( 0x08e, "key" );
-	add_token( 0x08f, "emit" );
-	add_token( 0x090, "type" );
-	add_token( 0x091, "(cr" );
-	add_token( 0x092, "cr" );
-	add_token( 0x093, "#out" );
-	add_token( 0x094, "#line" );
-	add_token( 0x095, "hold" );
-	add_token( 0x096, "<#" );
-	add_token( 0x097, "u#>" );
-	add_token( 0x098, "sign" );
-	add_token( 0x099, "u#" );
-	add_token( 0x09a, "u#s" );
-	add_token( 0x09b, "u." );
-	add_token( 0x09c, "u.r" );
-	add_token( 0x09d, "." );
-	add_token( 0x09e, ".r" );
-	add_token( 0x09f, ".s" );
-	add_token( 0x0a0, "base" );
-	add_token( 0x0a1, "convert" );
-	add_token( 0x0a2, "$number" );
-	add_token( 0x0a3, "digit" );
-	add_token( 0x0a4, "-1" );
-	add_token( 0x0a5, "0" );
-	add_token( 0x0a6, "1" );
-	add_token( 0x0a7, "2" );
-	add_token( 0x0a8, "3" );
-	add_token( 0x0a9, "bl" );
-	add_token( 0x0aa, "bs" );
-	add_token( 0x0ab, "bell" );
-	add_token( 0x0ac, "bounds" );
-	add_token( 0x0ad, "here" );
-	add_token( 0x0ae, "aligned" );
-	add_token( 0x0af, "wbsplit" );
-	add_token( 0x0b0, "bwjoin" );
-	add_token( 0x0b1, "b(<mark)" );
-	add_token( 0x0b2, "b(>resolve)" );
-	add_token( 0x0b3, "set-token-table" );
-	add_token( 0x0b4, "set-table" );
-	add_token( 0x0b5, "new-token" );
-	add_token( 0x0b6, "named-token" );
-	add_token( 0x0b7, "b(:)" );
-	add_token( 0x0b8, "b(value)" );
-	add_token( 0x0b9, "b(variable)" );
-	add_token( 0x0ba, "b(constant)" );
-	add_token( 0x0bb, "b(create)" );
-	add_token( 0x0bc, "b(defer)" );
-	add_token( 0x0bd, "b(buffer:)" );
-	add_token( 0x0be, "b(field)" );
-	add_token( 0x0bf, "b(code)" );
-	add_token( 0x0c0, "instance" );
-	add_token( 0x0c2, "b(;)" );
-	add_token( 0x0c3, "b(to)" );
-	add_token( 0x0c4, "b(case)" );
-	add_token( 0x0c5, "b(endcase)" );
-	add_token( 0x0c6, "b(endof)" );
-	add_token( 0x0c7, "#" );
-	add_token( 0x0c8, "#s" );
-	add_token( 0x0c9, "#>" );
-	add_token( 0x0ca, "external-token" );
-	add_token( 0x0cb, "$find" );
-	add_token( 0x0cc, "offset16" );
-	add_token( 0x0cd, "evaluate" );
-	add_token( 0x0d0, "c," );
-	add_token( 0x0d1, "w," );
-	add_token( 0x0d2, "l," );
-	add_token( 0x0d3, "," );
-	add_token( 0x0d4, "um*" );
-	add_token( 0x0d5, "um/mod" );
-	add_token( 0x0d8, "d+" );
-	add_token( 0x0d9, "d-" );
-	add_token( 0x0da, "get-token" );
-	add_token( 0x0db, "set-token" );
-	add_token( 0x0dc, "state" );
-	add_token( 0x0dd, "compile" );
-	add_token( 0x0de, "behavior" );
-	add_token( 0x0f0, "start0" );
-	add_token( 0x0f1, "start1" );
-	add_token( 0x0f2, "start2" );
-	add_token( 0x0f3, "start4" );
-	add_token( 0x0fc, "ferror" );
-	add_token( 0x0fd, "version1" );
-	add_token( 0x0fe, "4-byte-id" );
-	add_token( 0x0ff, "end1" );
-	add_token( 0x101, "dma-alloc" );
-	add_token( 0x102, "my-address" );
-	add_token( 0x103, "my-space" );
-	add_token( 0x104, "memmap" );
-	add_token( 0x105, "free-virtual" );
-	add_token( 0x106, ">physical" );
-	add_token( 0x10f, "my-params" );
-	add_token( 0x110, "property" );
-	add_token( 0x111, "encode-int" );
-	add_token( 0x112, "encode+" );
-	add_token( 0x113, "encode-phys" );
-	add_token( 0x114, "encode-string" );
-	add_token( 0x115, "encode-bytes" );
-	add_token( 0x116, "reg" );
-	add_token( 0x117, "intr" );
-	add_token( 0x118, "driver" );
-	add_token( 0x119, "model" );
-	add_token( 0x11a, "device-type" );
-	add_token( 0x11b, "parse-2int" );
-	add_token( 0x11c, "is-install" );
-	add_token( 0x11d, "is-remove" );
-	add_token( 0x11e, "is-selftest" );
-	add_token( 0x11f, "new-device" );
-	add_token( 0x120, "diagnostic-mode?" );
-	add_token( 0x121, "display-status" );
-	add_token( 0x122, "memory-test-issue" );
-	add_token( 0x123, "group-code" );
-	add_token( 0x124, "mask" );
-	add_token( 0x125, "get-msecs" );
-	add_token( 0x126, "ms" );
-	add_token( 0x127, "finish-device" );
-	add_token( 0x128, "decode-phys" );
-	add_token( 0x12b, "interpose" );
-	add_token( 0x130, "map-low" );
-	add_token( 0x131, "sbus-intr>cpu" );
-	add_token( 0x150, "#lines" );
-	add_token( 0x151, "#columns" );
-	add_token( 0x152, "line#" );
-	add_token( 0x153, "column#" );
-	add_token( 0x154, "inverse?" );
-	add_token( 0x155, "inverse-screen?" );
-	add_token( 0x156, "frame-buffer-busy?" );
-	add_token( 0x157, "draw-character" );
-	add_token( 0x158, "reset-screen" );
-	add_token( 0x159, "toggle-cursor" );
-	add_token( 0x15a, "erase-screen" );
-	add_token( 0x15b, "blink-screen" );
-	add_token( 0x15c, "invert-screen" );
-	add_token( 0x15d, "insert-characters" );
-	add_token( 0x15e, "delete-characters" );
-	add_token( 0x15f, "insert-lines" );
-	add_token( 0x160, "delete-lines" );
-	add_token( 0x161, "draw-logo" );
-	add_token( 0x162, "frame-buffer-adr" );
-	add_token( 0x163, "screen-height" );
-	add_token( 0x164, "screen-width" );
-	add_token( 0x165, "window-top" );
-	add_token( 0x166, "window-left" );
-	add_token( 0x16a, "default-font" );
-	add_token( 0x16b, "set-font" );
-	add_token( 0x16c, "char-height" );
-	add_token( 0x16d, "char-width" );
-	add_token( 0x16e, ">font" );
-	add_token( 0x16f, "fontbytes" );
-	add_token( 0x170, "fb1-draw-character" );
-	add_token( 0x171, "fb1-reset-screen" );
-	add_token( 0x172, "fb1-toggle-cursor" );
-	add_token( 0x173, "fb1-erase-screen" );
-	add_token( 0x174, "fb1-blink-screen" );
-	add_token( 0x175, "fb1-invert-screen" );
-	add_token( 0x176, "fb1-insert-characters" );
-	add_token( 0x177, "fb1-delete-characters" );
-	add_token( 0x178, "fb1-insert-lines" );
-	add_token( 0x179, "fb1-delete-lines" );
-	add_token( 0x17a, "fb1-draw-logo" );
-	add_token( 0x17b, "fb1-install" );
-	add_token( 0x17c, "fb1-slide-up" );
-	add_token( 0x180, "fb8-draw-character" );
-	add_token( 0x181, "fb8-reset-screen" );
-	add_token( 0x182, "fb8-toggle-cursor" );
-	add_token( 0x183, "fb8-erase-screen" );
-	add_token( 0x184, "fb8-blink-screen" );
-	add_token( 0x185, "fb8-invert-screen" );
-	add_token( 0x186, "fb8-insert-characters" );
-	add_token( 0x187, "fb8-delete-characters" );
-	add_token( 0x188, "fb8-insert-lines" );
-	add_token( 0x189, "fb8-delete-lines" );
-	add_token( 0x18a, "fb8-draw-logo" );
-	add_token( 0x18b, "fb8-install" );
-	add_token( 0x1a0, "return-buffer" );
-	add_token( 0x1a1, "xmit-packet" );
-	add_token( 0x1a2, "poll-packet" );
-	add_token( 0x1a4, "mac-address" );
-	add_token( 0x201, "device-name" );
-	add_token( 0x202, "my-args" );
-	add_token( 0x203, "my-self" );
-	add_token( 0x204, "find-package" );
-	add_token( 0x205, "open-package" );
-	add_token( 0x206, "close-package" );
-	add_token( 0x207, "find-method" );
-	add_token( 0x208, "call-package" );
-	add_token( 0x209, "$call-parent" );
-	add_token( 0x20a, "my-package" );
-	add_token( 0x20b, "ihandle>phandle" );
-	add_token( 0x20d, "my-unit" );
-	add_token( 0x20e, "$call-method" );
-	add_token( 0x20f, "$open-package" );
-	add_token( 0x210, "processor-type" );
-	add_token( 0x211, "firmware-version" );
-	add_token( 0x212, "fcode-version" );
-	add_token( 0x213, "alarm" );
-	add_token( 0x214, "(is-user-word)" );
-	add_token( 0x215, "suspend-fcode" );
-	add_token( 0x216, "abort" );
-	add_token( 0x217, "catch" );
-	add_token( 0x218, "throw" );
-	add_token( 0x219, "user-abort" );
-	add_token( 0x21a, "get-my-property" );
-	add_token( 0x21b, "decode-int" );
-	add_token( 0x21c, "decode-string" );
-	add_token( 0x21d, "get-inherited-property" );
-	add_token( 0x21e, "delete-property" );
-	add_token( 0x21f, "get-package-property" );
-	add_token( 0x220, "cpeek" );
-	add_token( 0x221, "wpeek" );
-	add_token( 0x222, "lpeek" );
-	add_token( 0x223, "cpoke" );
-	add_token( 0x224, "wpoke" );
-	add_token( 0x225, "lpoke" );
-	add_token( 0x226, "lwflip" );
-	add_token( 0x227, "lbflip" );
-	add_token( 0x228, "lbflips" );
-	add_token( 0x229, "adr-mask" );
-	add_token( 0x230, "rb@" );
-	add_token( 0x231, "rb!" );
-	add_token( 0x232, "rw@" );
-	add_token( 0x233, "rw!" );
-	add_token( 0x234, "rl@" );
-	add_token( 0x235, "rl!" );
-	add_token( 0x236, "wbflips" );
-	add_token( 0x237, "lwflips" );
-	add_token( 0x238, "probe" );
-	add_token( 0x239, "probe-virtual" );
-	add_token( 0x23b, "child" );
-	add_token( 0x23c, "peer" );
-	add_token( 0x23d, "next-property" );
-	add_token( 0x23e, "byte-load" );
-	add_token( 0x23f, "set-args" );
-	add_token( 0x240, "left-parse-string" );
+   int  indx;
 
-	/* FCodes from 64bit extension addendum */
-	add_token( 0x22e, "rx@" );
-	add_token( 0x22f, "rx!" );
-	add_token( 0x241, "bxjoin" );
-	add_token( 0x242, "<l@" );
-	add_token( 0x243, "lxjoin" );
-	add_token( 0x244, "wxjoin" );
-	add_token( 0x245, "x," );
-	add_token( 0x246, "x@" );
-	add_token( 0x247, "x!" );
-	add_token( 0x248, "/x" );
-	add_token( 0x249, "/x*" );
-	add_token( 0x24a, "xa+" );
-	add_token( 0x24b, "xa1+" );
-	add_token( 0x24c, "xbflip" );
-	add_token( 0x24d, "xbflips" );
-	add_token( 0x24e, "xbsplit" );
-	add_token( 0x24f, "xlflip" );
-	add_token( 0x250, "xlflips" );
-	add_token( 0x251, "xlsplit" );
-	add_token( 0x252, "xwflip" );
-	add_token( 0x253, "xwflips" );
-	add_token( 0x254, "xwsplit" );
+   dictionary = &detok_table[dictionary_indx_max-1];
+   dictionary_reset_position = dictionary;
+
+   for (indx = 1; indx < dictionary_indx_max ; indx++ )
+   {
+       detok_table[indx].next = &detok_table[indx-1];
+   }
+}
+
+void reset_dictionary(void) 
+{
+    token_t *next_t;
+
+    next_t = dictionary;
+    while ( next_t != dictionary_reset_position )
+    {
+        next_t = dictionary->next ;
+	free( dictionary->name );
+	free( dictionary );
+	dictionary = next_t ;
+    }
+}
+
+/*  If FCodes have been added by User, we need to update reset-position  */
+void freeze_dictionary(void)
+{
+   dictionary_reset_position = dictionary;
 }
diff --git a/detok/pcihdr.c b/detok/pcihdr.c
new file mode 100644
index 0000000..b4155db
--- /dev/null
+++ b/detok/pcihdr.c
@@ -0,0 +1,478 @@
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Support function for de-tokenizer.
+ *
+ *      Identify and process PCI header at beginning of FCode binary file.
+ *      "Processing" consists of recognizing the PCI Header and Data Structure,
+ *      optionally printing a description thereof, and (mainly) allowing
+ *      the given pointer to be bumped to the start of the actual FCode.
+ *
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ *      Revision History:
+ *
+ *      Updated Mon, 23 May 2005 by David L. Paktor
+ *          Identify "Not Last" header.
+ *      Updated Thu, 24 Feb 2005 by David L. Paktor
+ *          Per notes after Code Review.
+ *      Updated Fri, 04 Feb 2005 by David L. Paktor
+ *      Updated Wed, 08 Jun 2005 by David L. Paktor
+ *         Added support for multiple-PCI-image files.
+ *
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Functions Eported:
+ *          handle_pci_header
+ *              Handle all activities connected with presence of
+ *              PCI Header/Data at beginning of FCode file, and
+ *              facilitate "skipping" over to actual FCode data.
+ *
+ *          handle_pci_filler
+ *          Skip past "filler" between blocks in multi-PCI-image files.
+ *              
+ *
+ **************************************************************************** */
+
+
+/* **************************************************************************
+ *
+ *      Still to be done:
+ *          Print (as remarks) full descriptions of headers' fields
+ *          Error check for wrong "Format"
+ *          Skip past non-FCode blocks, thru multiple data-blocks
+ *          Recognize PCI header in unexpected place or out-of-place
+ *
+ **************************************************************************** */
+
+#include "pcihdr.h"
+#include <stdio.h>
+
+#include "detok.h"
+
+
+/* **************************************************************************
+ *
+ *          Global Variables Exported
+ *      pci_image_end           Pointer to just after end of current PCI image
+ *
+ **************************************************************************** */
+
+u8 *pci_image_end = NULL;
+
+/* **************************************************************************
+ *
+ *          Internal Static Variables
+ *      pci_image_len           Length (in bytes) of current PCI image
+ *
+ **************************************************************************** */
+
+static int pci_image_len = 0;
+
+
+/* **************************************************************************
+ *
+ *      Function name:  is_pci_header ( rom_header_t *pci_rom_hdr )
+ *      Synopsis:   Indicate whether given pointer is pointing to
+ *                  something that might be a valid PCI header
+ *      
+ *      Inputs:
+ *          Parameters:     
+ *              pci_rom_hdr    pointer to start of data-stream to examine.
+ *                          Treat as pointer to rom_header_t
+ *
+ *      Outputs:
+ *          Returned Value: An integer.
+ *               0                  Definitely *NOT* a PCI header
+ *              Positive Number     Appears to be a valid PCI header;
+ *                                      value is offset to PCI Data Structure.
+ *              Negative Number     Appears to be a PCI header, but
+ *                                      with errors. (Not Implemented Yet.
+ *                                      See under "Still to be done".)
+ *
+ *      Error Detection:
+ *              (See under "Still to be done".)
+ *
+ *      Process Explanation:
+ *          Examine "signature" location for known value  0x55aa
+ *          If a match, return value of "dptr" (Data-pointer offset) field.
+ *
+ *      Revision History:
+ *          Created Tue, 01 Feb 2005 by David L. Paktor
+ *
+ *      Still to be done:
+ *          Error-check; look for inconsistencies:
+ *              Return a Negative Number if data-stream appears to be a PCI
+ *              header, but has erroneous or inconsistent sub-field contents.
+ *              Value and meaning of the Negative Number yet to be defined.
+ *
+ **************************************************************************** */
+
+static int is_pci_header ( rom_header_t *pci_rom_hdr )
+{
+    const u16 pci_header_signature = 0x55aa;
+    int retval ;
+
+    retval = 0;
+
+    if ( BIG_ENDIAN_WORD_FETCH(pci_rom_hdr->signature) == pci_header_signature )
+    {
+        retval = LITTLE_ENDIAN_WORD_FETCH(pci_rom_hdr->data_ptr);
+    }
+    return(retval);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  is_pci_data_struct ( pci_data_t *pci_data_ptr )
+ *      Synopsis:       Indicate whether given pointer is pointing to
+ *                      a valid PCI Data Structure
+ *      
+ *      Inputs:
+ *          Parameters:     
+ *              pci_data_ptr    pointer to start of data-stream to examine.
+ *                          Treat as pointer to pci_data_t 
+ *
+ *      Outputs:
+ *          Returned Value: An integer.
+ *                   0                  Definitely *NOT* a PCI Data Structure
+ *              Positive Number         Appears to be valid PCI Data Structure;
+ *                                      value is length of PCI Data Structure,
+ *                                      (presumably, offset to start of FCode).
+ *              Negative Number         Appears to be a PCI Data Structure,
+ *                                      but with errors. (Not Implemented Yet.
+ *                                      See under "Still to be done".)
+ *
+ *          Global/Static Variables:
+ *              Does not alter the poiner passed-in;
+ *              does not alter any Global/Static Variables
+ *          Printout:       NONE
+ *
+ *      Error Detection:        (Condition)     (Action)
+ *              (See under "Still to be done".)
+ *
+ *      Process Explanation:
+ *          Examine "signature" location for known value "PCIR"
+ *          If a match, return value of "dlen" (Data Structure Length) field.
+ *      
+ *      Revision History:
+ *          Created Tue, 01 Feb 2005 by David L. Paktor
+ *
+ *      Still to be done:
+ *          Error-check; look for wrong "Code Type" or other inconsistencies:
+ *              Return a Negative Number if data-stream appears to be a
+ *              valid PCI Data Structure, but has erroneous or inconsistent
+ *              sub-field contents.
+ *              Value and meaning of the Negative Number yet to be defined.
+ *          Skip past non-FCode data-blocks, even multiple blocks
+ *
+ **************************************************************************** */
+
+static int is_pci_data_struct ( pci_data_t *pci_data_ptr )
+{
+    int retval ;
+
+    retval = 0;
+
+    if (BIG_ENDIAN_LONG_FETCH(pci_data_ptr->signature) == PCI_DATA_HDR)
+    {
+        retval = LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->dlen);
+    }
+    return(retval);
+}
+ 
+
+/* **************************************************************************
+ *
+ *      Function name:  announce_pci_hdr ( rom_header_t *pci_rom_hdr )
+ *      Synopsis:       Print indication that the PCI header was found,
+ *                      and other details, formatted as FORTH remarks.
+ *      
+ *      Inputs:
+ *              Parameters:
+ *                      pci_rom_hdr        Pointer to start of PCI header.
+ *
+ *      Outputs:
+ *              Returned Value: NONE
+ *              Printout:       Announcement.  Size of  data_ptr  field.
+ *
+ **************************************************************************** */
+
+static void announce_pci_hdr ( rom_header_t *pci_rom_hdr )
+{
+    char temp_buf[80];
+    u32  temp;
+
+    printremark ( "PCI Header identified");
+    temp=(u32)LITTLE_ENDIAN_WORD_FETCH(pci_rom_hdr->data_ptr);
+    sprintf(temp_buf, "  Offset to Data Structure = 0x%04x (%d)\n",
+        temp, temp);
+    printremark ( temp_buf );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  announce_pci_data_struct ( pci_data_t *pci_data_ptr )
+ *      Synopsis:       Print indication that the PCI Data Structure
+ *                      was found, and some additional details.
+ *                      Format as FORTH remarks.
+ *      
+ *      Inputs:
+ *          Parameters:
+ *              pci_data_ptr        Pointer to start of PCI Data Structure.
+ *
+ *      Outputs:
+ *          Returned Value: NONE    
+ *          Global/Static Variables:    
+ *              pci_image_len      Updated to byte-length of current PCI image
+ *          Printout:       (See Synopsis)
+ *      
+ *      Process Explanation:
+ *          Extract some details, format and print them,
+ *              using the syntax of FORTH remarks.
+ *
+ *      Revision History:
+ *          Created Tue, 01 Feb 2005 by David L. Paktor
+ *          Updated Wed, 25 May 2005 by David L. Paktor
+ *               Added printout of several fields...
+ *
+ **************************************************************************** */
+
+static void announce_pci_data_struct ( pci_data_t *pci_data_ptr )
+{
+    char temp_buf[80];
+    u32  temp;
+
+    printremark ( "PCI Data Structure identified");
+
+    temp=(u32)LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->dlen);
+    sprintf(temp_buf, "  Data Structure Length = 0x%04x (%d)\n", temp, temp);
+    printremark ( temp_buf );
+
+    sprintf(temp_buf, "  Vendor ID: 0x%04x\n",
+            LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->vendor));
+    printremark ( temp_buf );
+
+    sprintf(temp_buf, "  Device ID: 0x%04x\n",
+            LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->device));
+    printremark ( temp_buf );
+
+    temp=(u32)CLASS_CODE_FETCH(pci_data_ptr->class_code);
+    sprintf(temp_buf, "  Class Code: 0x%06x  (%s)",
+            temp,  pci_device_class_name(temp));
+    printremark ( temp_buf );
+
+    temp=(u32)LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->vpd);
+    if ( temp != 0 )
+    {
+	sprintf(temp_buf, "  Vital Prod Data: 0x%02x\n", temp);
+	printremark ( temp_buf );
+    }
+
+    temp=(u32)LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->irevision);
+    if ( temp != 0 )
+    {
+	sprintf(temp_buf, "  Image Revision: 0x%02x\n", temp);
+	printremark ( temp_buf );
+    }
+
+    sprintf(temp_buf, "  Code Type: 0x%02x (%s)\n", pci_data_ptr->code_type,
+             pci_code_type_name(pci_data_ptr->code_type) );
+    printremark ( temp_buf );
+
+    temp=(u32)LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->ilen);
+    pci_image_len = temp*512;
+    sprintf(temp_buf, "  Image Length: 0x%04x blocks (%d bytes)\n",
+                    temp, pci_image_len);
+    printremark ( temp_buf );
+
+    sprintf(temp_buf, "  %sast PCI Image.\n",
+        pci_data_ptr->last_image_flag&&0x80 != 0 ? "L" : "Not l");
+    printremark ( temp_buf );
+
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  handle_pci_header
+ *      Synopsis:       Handle PCI Header/Data at beginning of FCode file;
+ *                      facilitate "skipping" over to actual FCode data.
+ *      
+ *      Inputs:
+ *          Parameters:     
+ *              data_ptr           Pointer to start of data-stream to examine.
+ *          Global/Static Variables:        
+ *              pci_image_len      Length (in bytes) of current PCI image
+ *
+ *      Outputs:
+ *          Returned Value:
+ *              Positive Number.        Offset to start of FCode.
+ *              Zero                    If no PCI header; may be treated as
+ *                                          a valid offset.
+ *              Negative Number         PCI header or PCI Data Structure test
+ *                                          returned error indication.
+ *                                         (Not Implemented Yet.  See
+ *                                          under "Still to be done".)
+ *          Global/Static Variables:        
+ *              pci_image_end           Pointer to just after the end of
+ *                                          the current PCI image
+ *          Printout:       As FORTH remarks, print indications that the
+ *                          PCI header was found, and maybe later more data.
+ *
+ *      Error Detection:        (Condition)     (Action)
+ *              (See under "Still to be done".)
+ *      
+ *      Process Explanation:
+ *          Use the various support routines defined below.
+ *      
+ *      
+ *      Revision History:
+ *
+ *      Updated Wed, 09 Feb 2005 by David L. Paktor
+ *          Extracted assignments from within  if( )  statements.
+ *
+ *      Created Tue, 01 Feb 2005 by David L. Paktor
+ *
+ *      Still to be done:
+ *          Handle error cases.  At present, neither  is_pci_header()
+ *              nor  is_pci_data_struct()  returns a negative number,
+ *              but when they are modified to do so, we must handle it.
+ *
+ **************************************************************************** */
+
+int handle_pci_header ( u8  *data_ptr )
+{
+    int hdrlen;
+    int data_struc_len;
+    /*  int retval;  */  /*  Not needed until we handle error cases...  */
+
+    data_struc_len = 0;
+
+    hdrlen = is_pci_header( (rom_header_t *)data_ptr );
+    /*  retval = hdrlen;  */  /*  Not needed yet...  */
+    if ( hdrlen < 0 )
+    {
+        /*  Handle error case...  */
+        /*  Leave null for now...  */
+        /*  It might need to do a premature EXIT here...  */
+    } else {
+        /* if hdrlen == 0 then we don't need to check a Data Structure  */
+        if ( hdrlen > 0 )
+        {
+            announce_pci_hdr ( (rom_header_t *)data_ptr );
+            data_struc_len = is_pci_data_struct(
+                        (pci_data_t *) &data_ptr[hdrlen] );
+            /*
+             *  A Data Structure Length of Zero would be an error
+             *  that could be detected by  is_pci_data_struct()
+             */ 
+            if ( data_struc_len <= 0 )
+            {
+                /*  Handle error case...  */
+                /*  Leave null for now...  */
+                /*  It might need to do a premature EXIT here...  */
+                /*  retval = -1;   */  /*  Not needed yet...  */
+            } else {
+                announce_pci_data_struct ( (pci_data_t *) &data_ptr[hdrlen] );
+		pci_image_end = data_ptr + pci_image_len;
+                /* retval = hdrlen+data_struc_len; */ /*  Not needed yet... */
+            }
+        }
+    }
+    return (hdrlen+data_struc_len);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  handle_pci_filler
+ *      Synopsis:       Examine and report on the "filler" padding after the
+ *                      end of an FCode-block but still within a PCI-image
+ *
+ *      Inputs:
+ *         Parameters:
+ *             filler_ptr         Pointer to start of PCI-filler in data-stream
+ *         Global/Static Variables:    
+ *             pci_image_end      Pointer to just after the end of
+ *                                          the current PCI image
+ *
+ *      Outputs:
+ *         Returned Value:        NONE
+ *         Printout:
+ *             Descriptive message.
+ *
+ *      Error Detection:
+ *          Non-zero filler field.  Different message.
+ *
+ *      Process Explanation:
+ *          The calling routine has checked that there was, indeed, a PCI
+ *              header present, so we know that pci_image_end is valid.
+ *          If the entire filler is zero-bytes, print a simple message and
+ *              we're out'a here!
+ *          If there are non-zero bytes, identify loc'n of first non-zero.
+ *
+ *      Still to be done:
+ *          Come up with something more elegant for non-zero filler.
+ *
+ **************************************************************************** */
+
+void handle_pci_filler(u8 *filler_ptr)
+{
+    u8 *scan_ptr;
+    int filler_len;
+    char temp_buf[80];
+    bool all_zero = TRUE;
+    u8 filler_byte = *filler_ptr;
+
+    filler_len = pci_image_end - filler_ptr;
+
+    for ( scan_ptr = filler_ptr;
+        scan_ptr < pci_image_end;
+	    filler_byte = *(++scan_ptr) )
+    {
+	if ( filler_byte != 0 )
+	{
+	    all_zero = FALSE;
+	    break;
+	}    
+    }
+    
+    if ( all_zero )
+    {
+	sprintf(temp_buf, "PCI Image padded with %d bytes of zero", filler_len);
+    }else{
+	sprintf(temp_buf, "PCI Image padding-field of %d bytes "
+	    "had first non-zero byte at offset %ld",
+		 filler_len, scan_ptr - filler_ptr );
+    }
+    printremark ( temp_buf );
+}
diff --git a/detok/printformats.c b/detok/printformats.c
new file mode 100644
index 0000000..baa64dd
--- /dev/null
+++ b/detok/printformats.c
@@ -0,0 +1,140 @@
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Print, in various controlled formats, for the detokenizer.
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Ultimately, our goal is to produce output that can be run back
+ *      through the tokenizer and produce the same binary.  So, any
+ *      extra text will have to be in a form that the tokenizer will
+ *      treat as comments.
+ *
+ **************************************************************************** */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "detok.h"
+
+
+/* **************************************************************************
+ *
+ *      Function name:  printremark ( string )
+ *      Synopsis:       Print the given string as a series of "Remark" lines,
+ *                      (i.e., preceded by backslash-space)
+ *      
+ *      Inputs:
+ *          Parameters:     
+ *              str     Pointer to the start of the string,
+ *                      however long it may be.  The string
+ *                      may have any number of embedded new-lines.
+ *
+ *      Outputs:
+ *          Returned Value: *** NONE***
+ *          Printout:    Each line of the string will be preceded by
+ *                       a backslash and two spaces.  Backslash-space
+ *                       is the standard delimiter for a "remark", i.e.
+ *                       the entire line is ignored as a comment.  The
+ *                       second space is "just" for aesthetics.
+ *      
+ *      Process Explanation:
+ *          Parse the input string for new-lines.  Print each separately.
+ *          Do not alter the input string.
+ *      
+ *
+ *      Still to be done:
+ *          Define a routine, call it  PrintComment , to print the given
+ *              string surrounded by open-paren-space ... space-close-paren
+ *          Define a single central routine, call it  safe_malloc ,
+ *              to do the test for null and print "No Memory" and exit.
+ *          Define a single central routine, call it  PrintError , to:
+ *              Print the given error message
+ *              Show the input file and line number
+ *              Collect error-flags for failure-exit at end of operation.
+ *
+ **************************************************************************** */
+
+void printremark ( char *str)
+{
+    char *strtmp ;          /*  Temporary pointer to current substring    */
+    int substrlen ;         /*  Length of current substring               */
+    char *substrend ;       /*  Pointer to end of current substring       */
+    char *strend ;          /*  Pointer to end of given string            */
+
+    char *strbfr ;          /*  Temporary substring buffer                */
+
+    /*  Guarantee that the malloc will be big enough.  */
+    strbfr = (char *)malloc(strlen((char *)str)+1);
+    if ( !strbfr )
+    {
+        printf ("No memory.\n");
+        exit(-1);
+    }
+
+
+    strtmp = str;
+    strend = &str[strlen(str)];
+
+    /* ******************************************************************
+     *
+     *      Isolate the current substring; allow that the given
+     *      string might not be terminated with a new-line. 
+     *
+     *      The  strend  pointer provides a convenient means to
+     *      test for when we've reached the end.
+     *
+     ******************************************************************** */
+
+   while ( strtmp < strend  )
+    {
+        substrend = strchr(strtmp , '\n');
+        substrlen = ( substrend ? (substrend-strtmp) : strlen(strtmp) );
+
+        strncpy (strbfr, strtmp, substrlen);
+        /* **********************************************************
+         * 
+         *  strncpy() does not append a terminating null character,
+         *  so we have to.
+         *
+         ************************************************************ */
+        strbfr[substrlen] = (char)0;
+
+        printf("\\  %s\n",strbfr);
+
+        strtmp = &strtmp[ substrlen + ( substrend ? 1 : 0 ) ] ;
+
+    }
+
+    free(strbfr) ;
+}
+
diff --git a/detok/stream.c b/detok/stream.c
index cbdc595..401d1a4 100644
--- a/detok/stream.c
+++ b/detok/stream.c
@@ -24,19 +24,59 @@
  *
  */
 
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/stat.h>
+#include <setjmp.h>
 
+#include "stream.h"
 #include "detok.h"
+#include "pcihdr.h"
+
+extern jmp_buf eof_exception;
 
-extern bool offs16;
-extern u32  fcpos;
+/* **************************************************************************
+ *
+ *      Global Variables Exported:
+ *        Name            Value
+ *      fcode          The FCode-token last read.  Not necessarily the byte
+ *                          last read, if its function has in-line parameters
+ *      stream_max     The maximum position -- length -- of the input stream
+ *      pc             Pointer to "Current byte" in the input-data image.
+ *      max            Just after the end of the input-data image.
+ *                         This is *NOT* a byte-count.
+ *
+ **************************************************************************** */
 
 u16 fcode;
-u8  inbyte;
+unsigned int stream_max;
+u8 *pc;
+u8 *max;
+
+/* **************************************************************************
+ *
+ *      Local/Static Variables:
+ *        Name            Pointer to:
+ *      indata          Start of input-data image taken from input file.
+ *                          This memory was "malloc"ed; keep it around
+ *                          for when we "free" that memory.
+ *      fc_start        Start of the FCode.  This might not be the same
+ *                          as the start of the input file data, especially
+ *                          if the input file data starts with a PCI header.
+ *      pci_image_found     TRUE iff a valid PCI header was found
+ *
+ **************************************************************************** */
+u8 *indata;
+static u8 *fc_start;
+static bool pci_image_found = FALSE;
 
-static u8 *indata, *pc, *max;
 
 int init_stream(char *name)
 {
@@ -62,119 +102,455 @@ int init_stream(char *name)
 	fclose(infile);
        
 	pc=indata; 
+	fc_start = indata;
 	max=pc+finfo.st_size;
 	
+	stream_max = finfo.st_size;
+	
 	return 0;
 }
 
-int close_stream(void)
+/* **************************************************************************
+ *
+ *      Function name:  init_fcode_block
+ *      Synopsis:       Initialize all pointers and variables, etcetera,
+ *                          for an FCode-block.
+ *
+ **************************************************************************** */
+
+void init_fcode_block(void)
+{
+	fc_start = pc;
+	linenum = 1 ;
+}
+
+
+void close_stream(void)
 {
 	free(indata);
-	return 0;	
+	stream_max = 0;
 }
 
 int get_streampos(void)
 {
-	return (int)((long)pc-(long)indata);
+	return (int)( pc - fc_start );
 }
 
-void set_streampos(long pos)
+void set_streampos(int pos)
 {
-	pc=indata+pos;
+	pc = fc_start + pos;
 }
 
-static int get_byte(void)
+
+/* **************************************************************************
+ *
+ *      Function name:  throw_eof
+ *      Synopsis:       Analyze and print the cause of the end-of-file
+ *                      and throw an exception.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             premature              TRUE iff end-of-file was out-of-sync 
+ *         Global/Static Variables:        
+ *                  end_found         Indicates if normal end of fcode was read.
+ *                  eof_exception     Long-Jump environment to which to jump.
+ *
+ *      Outputs:                      Does a Long-Jump
+ *         Returned Value:            NONE
+ *         Printout:
+ *             "End-of-file" message, along with a descriptor, if applicable:
+ *                 Premature, Unexpected.
+ *          The calling routine notifies us if the number of bytes requested
+ *              overflowed the input buffer, by passing us a TRUE for the
+ *              input parameter.  That is a "Premature" end-of-file.
+ *          If  end_found  is FALSE, it means the normal end of FCode
+ *               wasn't seen.  That is an "Unexpected" end-of-file.
+ *
+ **************************************************************************** */
+
+static void throw_eof(bool premature)
 {
-	inbyte=*pc;
-	pc++;
+    char yoo = 'U';
+    char eee = 'E';
+    if ( premature)
+    {
+        printf("Premature ");
+	yoo = 'u';
+	eee = 'e';
+    }
+    if ( ! end_found )
+    {
+        printf("%cnexpected ",yoo);
+	eee = 'e';
+    }
+    printf("%cnd of file.\n",eee);
+    longjmp(eof_exception, -1);
+}
 	
-        if (pc>max) {
-                printf ("\nUnexpected end of file.\n");
-                return 0;
+/* **************************************************************************
+ *
+ *      Function name:  get_bytes
+ *      Synopsis:       Return the next string of bytes, as requested, from
+ *                      the FCode input-stream.  Detect end-of-file
+ *
+ *      Inputs:
+ *         Parameters:
+ *             nbytes            The number of bytes requested
+ *         Global/Static Variables:
+ *             pc                Pointer to "where we are" in the FCode
+ *             max               Pointer to just after end of input file data.
+ *
+ *      Outputs:
+ *         Returned Value:
+ *             Pointer to the requested bytes in the FCode input-stream.
+ *         Global/Static Variables:
+ *             pc                Incremented by the number of bytes requested
+ *
+ *      Exception:
+ *          When end-of-file is reached, or is about to be exceeded,    
+ *              throw an end-of-file exception.
+ *
+ *      Process Explanation:
+ *          End-of-file is not exactly an error, so its detection is more
+ *              a part of normal processing.
+ *          If we entered this routine with PC pointing exactly at MAX,
+ *              we are probably at the end the way we expect to be, so we
+ *              call our EOF-handling routine with a "non-premature" flag.
+ *          If the requested number of bytes puts us just even with MAX,
+ *              we have neither reached nor over-run the input stream, so
+ *              there's no call to our EOF-handling routine needed at all.
+ *          Only if the requested number of bytes puts us past MAX have we 
+ *              over-run our input stream with a "premature" condition.
+ *
+ *      Extraneous Remarks:
+ *          This is another one where it was easier to write the code
+ *              than the explanation ...  ;-}
+ *
+ **************************************************************************** */
+
+static u8 *get_bytes(int nbytes)
+{
+   u8 *retval = pc;
+   if ( pc == max )
+   {
+       throw_eof(FALSE);
+   }
+   if ( pc + nbytes > max )
+   {
+       throw_eof(TRUE);
+   }
+   pc += nbytes;
+   return( retval);
         }
 
-	return 1;
+
+/* **************************************************************************
+ *
+ *       Function name:  more_to_go
+ *       Synopsis:       Return FALSE when the last byte has been
+ *                           read from the input-stream.
+ *
+ **************************************************************************** */
+
+bool more_to_go(void)
+{
+    bool retval;
+    retval = INVERSE( pc == max );
+    return( retval);
 }
  
-u16 get_token(void)
+
+/* **************************************************************************
+ *
+ *      Function name:  next_token
+ *      Synopsis:       Retrieve the next FCode-token from the input-stream.
+ *
+ *      Inputs:
+ *         Parameters:                     NONE
+ *
+ *      Outputs:
+ *         Returned Value:                 The next FCode-token
+ *         Global/Static Variables:
+ *             fcode                       The FCode-token last read.
+ *             token_streampos             Streampos() of token just gotten
+ *
+ **************************************************************************** */
+ 
+u16 next_token(void)
 {
         u16 tok;
-        get_byte();
-        tok=inbyte;
-        if (tok != 0x00 && tok < 0x10) {
-                get_byte();
+        token_streampos = get_streampos();
+        tok = *(get_bytes(1));
+	if ( tok != 0x00 &&  tok < 0x10)
+	{
                 tok<<=8;
-                tok|=inbyte;
+              tok |= *(get_bytes(1));     
         }
         fcode=tok;
-        return tok;
+    return(tok);
 }
 
 u32 get_num32(void)
 {
-        u32 ret;
+        u32 retval;
+	u8 *num_str;
  
-        get_byte();
-        ret=inbyte<<24;
-        get_byte();
-        ret|=(inbyte<<16);
-        get_byte();
-        ret|=(inbyte<<8);
-        get_byte();
-        ret|=inbyte;
+	num_str = get_bytes(4);
+	retval = BIG_ENDIAN_LONG_FETCH(num_str);
  
-        return ret;
+        return ( retval);
 }
 
 u16 get_num16(void)
 {
-        u16 ret;
+        u16 retval;
+	u8 *num_str;
  
-        get_byte();
-        ret=inbyte<<8;
-        get_byte();
-        ret|=inbyte;
+        num_str = get_bytes(2);
+	retval = BIG_ENDIAN_WORD_FETCH(num_str);
  
-        return ret;
+        return ( retval);
 }
  
 u8 get_num8(void)
 {
-        get_byte();
+        u8  inbyte;
+
+	inbyte = *(get_bytes(1));
         return(inbyte);
 }
 
-u16 get_offset(void)
+s16 get_offset(void)
 {
+        s16 retval;
         if (offs16)
-                return (get_num16());
+        {
+	    retval = (s16)get_num16();
+	}else{
+	    retval = (s16)get_num8();
+	    /*  Make sure it's sign-extended  */
+	    retval |= ( retval & 0x80 ) ? 0xff00 : 0 ;
+	}
+ 
+        return (retval);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  get_string
+ *      Synopsis:       Return a pointer to a Forth-Style string within the
+ *                          input stream.  Note: this cannot be used to create
+ *                          a new token-name; use  get_name()  for that.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             *len                       Pointer to where the length will go
+ *
+ *      Outputs:
+ *         Returned Value:
+ *             Pointer to the string within the input stream.
+ *         Supplied Pointers:
+ *             *len                      Length of the string
+ *
+ *      Process Explanation:
+ *          Get one byte representing the length of the FORTH-style string.
+ *          Get as many bytes as the length indicates.
+ *          That's the string.  The pointer returned by  get_bytes()  is
+ *              our return value.
+ *
+ **************************************************************************** */
+
+u8 *get_string(u8 *len)
+{
+    char *retval;
+
+    *len = get_num8();
+    retval = get_bytes((int)*len);
  
-        return (get_num8());
+    return (retval); 
 }
 
 
-int scnt=0;
-u8 *get_string(void)
+/* **************************************************************************
+ *
+ *      Function name:  get_name
+ *      Synopsis:       Retrieve a copy of the next string in the input-stream
+ *                      when it is expected to be a new function-name.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             *len                       Pointer to where the length will go
+ *         Global/Static Variables:
+ *             pc                        "Where we are" in the file-stream
+ *
+ *      Outputs:
+ *         Returned Value: 
+ *             Pointer to allocated memory containing a copy of the string
+ *         Supplied Pointers:
+ *             *len                      Length of the name
+ *         Memory Allocated
+ *             Memory for the copy of the string is allocated by  strdup()
+ *         When Freed?
+ *             Never.  Retained for duration of the program.
+ *
+ *      Process Explanation:
+ *          Get the FORTH-style string.
+ *          At this point, PC points to the byte that follows the string;
+ *              we are going to save that byte and replace it with a zero,
+ *              thus creating a C-style string.
+ *          We will pass that C-style string as an argument to  strdup() ,
+ *              which will give us our return value.
+ *          Then, of course, we restore the byte we so rudely zeroed, and
+ *              proceed merrily on our way.
+ *
+ **************************************************************************** */
+
+char *get_name(u8 *len)
 {
-        u8 *data;
-        u8 size;
-        unsigned int i;
+    char *str_start;
+    char *retval;
+    u8 sav_byt;
  
-        get_byte();
-        size=inbyte;
+    str_start = get_string( len );
 
-	scnt++;
+    sav_byt = *pc;
+    *pc = 0;
 
-        data=malloc(size+2);
-	if (!data) printf ("No more memory.\n");
-        data[0]=size;
+    retval = strdup(str_start);
+    *pc = sav_byt;
  
-        for (i=1; i<size+1; i++) {
-                get_byte();
-                data[i]=inbyte;
+    return (retval);
         }
-        data[i]=0;
-        return data;
  
+/* **************************************************************************
+ *
+ *      Function name:  calc_checksum
+ *      Synopsis:       Calculate the checksum.
+ *                          Leave the input position unchanged.
+ *
+ *      Inputs:
+ *         Parameters:             NONE
+ *         Global/Static Variables:     
+ *             pc      Pointer to "where we are" in the file-stream
+ *
+ *      Outputs:
+ *         Returned Value:        Calculated checksum.
+ *         Global/Static Variables:  
+ *             pc     Reset to value upon entry
+ *
+ *      Process Explanation:
+ *          When this routine is entered, the PC is presumed to be pointing
+ *              just after the stored checksum, and just before the length
+ *              field in the FCode header.  This is the point at which we
+ *              will preserve the PC
+ *          Extract the length from the FCode header.  It includes the eight
+ *              bytes of the FCode header, so we will need to adjust for that.
+ *          The first byte after the FCode header is where the checksum
+ *              calculation begins.
+ *
+ **************************************************************************** */
+
+u16 calc_checksum(void)
+{
+    u16 retval = 0;
+    u8 *cksmptr;
+    u8 *save_pc;
+    u32 fc_blk_len;
+    int indx;
+
+    save_pc = pc;
+
+    fc_blk_len = get_num32();            /* Read len */
+    cksmptr = get_bytes(fc_blk_len-8);   /*  Make sure we have all our data  */
+
+    for ( indx = 8; indx < fc_blk_len; indx++)
+    {
+	retval += *cksmptr++;
+}
+
+    pc = save_pc;
+    return( retval);
+} 
+
+
+/* **************************************************************************
+ *
+ *      Function name:  adjust_for_pci_header
+ *      Synopsis:   Skip the PCI Header.  Adjust the pointer to 
+ *                  the start of FCode in the file-stream,
+ *                  and our pointer to "where we are" in the FCode,
+ *                  by the size of the PCI header.
+ *      
+ *      Inputs:
+ *              Parameters:     NONE
+ *              Global/Static Variables:    (Pointer to:)
+ *                  pc                     "where we are" in the file-stream
+ *                  fc_start               start of FCode in the file-stream
+ *
+ *      Outputs:
+ *              Returned Value: NONE
+ *              Global/Static Variables:
+ *                  pc                     Advanced past PCI header
+ *                  fc_start               Likewise.
+ *                  pci_image_found        Set or cleared as appropriate.
+ *                  last_defined_token     Re-initialized
+ *      
+ *      Process Explanation:
+ *          Call handle_pci_header to get the size of the PCI header,
+ *              if any, and increment  pc  and  fc_start  by the number
+ *              of bytes it returns; also, set  pci_image_found  based
+ *              on whether the "size of the PCI header" was non-zero.
+ *          (Re-)Initialize overlap detection here.  Images with multiple
+ *              PCI blocks can safely re-cycle FCode numbers; this is
+ *              not necessarily  true of multiple FCode blocks within
+ *              the same PCI block...
+ *
+ **************************************************************************** */
+
+void adjust_for_pci_header(void)
+{
+	int pci_header_size;
+	
+	pci_header_size = handle_pci_header(pc);
+	pci_image_found = pci_header_size > 0 ? TRUE : FALSE;
+	pc += pci_header_size;
+	fc_start += pci_header_size;
+	last_defined_token = 0;
 }
 
+/* **************************************************************************
+ *
+ *      Function name:  adjust_for_pci_filler
+ *      Synopsis:       Dispatch call to pci-filler-handler
+ *
+ *      Inputs:
+ *         Parameters:                    NONE
+ *         Global/Static Variables:
+ *             pci_image_found           Whether to proceed...
+ *             pci_image_end             Pointer to just after the end of
+ *                                           the current PCI image
+ *
+ *      Outputs:
+ *          Returned Value:                NONE
+ *          Global/Static Variables:
+ *              pci_image_found            Reset to FALSE
+ *
+ *      Error Detection:
+ *          Confirm that the data-stream has the complete filler,
+ *              via a call to get_bytes()
+ *
+ **************************************************************************** */
+
+void adjust_for_pci_filler(void)
+{
+    if ( pci_image_found )
+    {
+        int pci_filler_len;
+	u8 *pci_filler_ptr;
+
+	pci_filler_len = pci_image_end - pc;
+	pci_filler_ptr = get_bytes(pci_filler_len);
+	handle_pci_filler( pci_filler_ptr );
+	pci_image_found = FALSE;
+    }
+}
diff --git a/detok/stream.h b/detok/stream.h
index a6c69b0..8c88de6 100644
--- a/detok/stream.h
+++ b/detok/stream.h
@@ -1,3 +1,6 @@
+#ifndef _UTILS_DETOK_STREAM_H
+#define _UTILS_DETOK_STREAM_H
+
 /*
  *                     OpenBIOS - free your system! 
  *                            ( detokenizer )
@@ -24,16 +27,42 @@
  *
  */
 
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+
+#include "types.h"
+
+/*  Prototypes for functions exported from  stream.c     */
+
+
 int init_stream(char *name);
-int close_stream(void);
+void close_stream(void);
+bool more_to_go(void);
+
+void adjust_for_pci_header(void);
+void adjust_for_pci_filler(void);
+void init_fcode_block(void);
 
 int  get_streampos(void);
-void set_streampos(long pos);
+void set_streampos(int pos);
 
-u16 get_token(void);
+u16 next_token(void);
 u8  get_num8(void);
 u16 get_num16(void);
 u32 get_num32(void);
-u16 get_offset(void);
-u8 *get_string(void);
+s16 get_offset(void);
+u8 *get_string(u8 *len);
+char *get_name(u8 *len);
+u16 calc_checksum(void);
+
+/*  External declarations for variables defined in   stream.c   */
+
+extern unsigned int stream_max;
+extern u8 *indata;
+extern u8 *pc;
+extern u8 *max;
 
+#endif   /*  _UTILS_DETOK_STREAM_H    */
diff --git a/romheaders/Makefile b/romheaders/Makefile
index 242cea1..3794aeb 100644
--- a/romheaders/Makefile
+++ b/romheaders/Makefile
@@ -21,20 +21,21 @@
 #  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
 #
 
-
 CC  = gcc
-CFLAGS= -O2 -Wall -W -ansi
+CFLAGS= -O2 -Wall -W -ansi -I../shared
+
+SOURCES = romheaders.c ../shared/classcodes.c
 
-.SUFFIXES: .c .o
+.SUFFIXES: .c
 
 all: romheaders
 
-romheaders: romheaders.o
-	$(CC) $(CFLAGS) romheaders.o -o romheaders
+romheaders: $(SOURCES)
+	$(CC) $(CFLAGS) $(SOURCES) -o $@
 	strip romheaders
 	
 clean:
-	rm -f *.o
+	rm -f *~
 
 distclean: clean
 	rm -f romheaders
diff --git a/romheaders/romheaders.c b/romheaders/romheaders.c
index e2d3646..dc47e0e 100644
--- a/romheaders/romheaders.c
+++ b/romheaders/romheaders.c
@@ -23,6 +23,11 @@
  *
  */
 
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -30,60 +35,32 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#define u8  unsigned char
-#define u16 unsigned short
-#define u32 unsigned int
-
-#define PCI_DATA_HDR (u32) ( ('R' << 24) | ('I' << 16) | ('C' << 8) | 'P' )
-
-typedef struct {
-	u16	signature;
-	u8	reserved[0x16];
-	u16	dptr;
-} rom_header_t;
-
-typedef struct {
-	u32	signature;
-	u16	vendor;
-	u16	device;
-	u16	reserved_1;
-	u16	dlen;
-	u8	drevision;
-	u8	class_hi;
-	u16	class_lo;
-	u16	ilen;
-	u16	irevision;
-	u8	type;
-	u8	indicator;
-	u16	reserved_2;
-} pci_data_t;
+#include "pcihdr.h"
 
 char *rom=NULL;
 size_t romlen=0;
 
-/* make this endian safe without fancy system headers */
-static u16 little_word(u16 val)
-{
-	u8 *ptr=(u8 *)&val;
-	return (ptr[0]|(ptr[1]<<8));
-}
+/*  Prototypes for functions exported from  shared/classcodes.c   */
 
-static u16 little_dword(u16 val)
-{
-	u8 *ptr=(u8 *)&val;
-	return (ptr[0]|(ptr[1]<<8)|(ptr[2]<<16)|(ptr[3]<<24));
-}
+char *pci_device_class_name(u32 code);
+char *pci_code_type_name(unsigned char code);
+
+/*  Functions local to this file:
+	    int dump_rom_header(rom_header_t *data);
+	    int dump_pci_data(pci_data_t *data);
+	    void dump_platform_extensions(u8 type, rom_header_t *data);
+ */
 
-/* dump the rom headers */
 static int dump_rom_header(rom_header_t *data)
-{
-	u16 sig=little_word(data->signature);
+{   /*  Return TRUE for "no problem"  */
+	const u16 pci_header_signature = 0x55aa;
+	u16 sig=BIG_ENDIAN_WORD_FETCH(data->signature);
 	int i;
 	
 	printf ("PCI Expansion ROM Header:\n");
 	
-	printf ("  Signature: 0x%02x%02x (%s)\n", 
-			sig&0xff,sig>>8,sig==0xaa55?"Ok":"Not Ok");
+	printf ("  Signature: 0x%04x (%s)\n", 
+			sig, sig == pci_header_signature ? "Ok":"Not Ok");
 	
 	printf ("  CPU unique data:");
 	for (i=0;i<16;i++) {
@@ -92,97 +69,41 @@ static int dump_rom_header(rom_header_t *data)
 	}
 	
 	printf ("\n  Pointer to PCI Data Structure: 0x%04x\n\n",
-						little_word(data->dptr));
+				LITTLE_ENDIAN_WORD_FETCH(data->data_ptr));
 
-	return (sig==0xaa55);
+	return (sig == pci_header_signature);
 }
 
 static int dump_pci_data(pci_data_t *data)
-{
-	u32 sig=little_dword(data->signature);
-	u32 classcode=(data->class_hi<<16)|(little_word(data->class_lo));
+{   /*  Return TRUE for "no problem"  */
+	const u32 pci_data_hdr = PCI_DATA_HDR ;
+
+	u32 sig      = BIG_ENDIAN_LONG_FETCH(data->signature);
+	u32 classcode= CLASS_CODE_FETCH(data->class_code);
+	u32 dlen     = (u32)LITTLE_ENDIAN_WORD_FETCH(data->dlen);
+	u32 ilen     = (u32)LITTLE_ENDIAN_WORD_FETCH(data->ilen);
 	
 	printf("PCI Data Structure:\n");
-	printf("  Signature: '%c%c%c%c' (%s)\n", sig&0xff,(sig>>8)&0xff,
-			(sig>>16)&0xff, sig>>24, sig==PCI_DATA_HDR?"Ok":"Not Ok");
-	printf("  Vendor ID: 0x%04x\n", little_word(data->vendor));
-	printf("  Device ID: 0x%04x\n", little_word(data->device));
-	printf("  Reserved: 0x%04x\n", little_word(data->reserved_1));
-	printf("  PCI Data Structure Length: 0x%04x (%d bytes)\n", 
-			little_word(data->dlen), little_word(data->dlen));
+	printf("  Signature: 0x%04x '%c%c%c%c' ", sig,
+			sig>>24,(sig>>16)&0xff, (sig>>8)&0xff, sig&0xff);
+	printf("(%s)\n", sig == pci_data_hdr ?"Ok":"Not Ok");
+
+	printf("  Vendor ID: 0x%04x\n", LITTLE_ENDIAN_WORD_FETCH(data->vendor));
+	printf("  Device ID: 0x%04x\n", LITTLE_ENDIAN_WORD_FETCH(data->device));
+	printf("  Vital Product Data:  0x%04x\n",
+	                                   LITTLE_ENDIAN_WORD_FETCH(data->vpd));
+	printf("  PCI Data Structure Length: 0x%04x (%d bytes)\n", dlen, dlen);
 	printf("  PCI Data Structure Revision: 0x%02x\n", data->drevision);
-	printf("  Class Code: 0x%06x (",classcode);
-	switch (classcode) {
-	case 0x0100:
-		printf("SCSI Storage");
-		break;
-	case 0x0101:
-		printf("IDE Storage");
-		break;
-	case 0x0103:
-		printf("IPI Storage");
-		break;
-	case 0x0104:
-		printf("RAID Storage");
-		break;
-	case 0x0180:
-		printf("Storage");
-		break;
-		
-	case 0x0200:
-		printf("Ethernet");
-		break;
-	case 0x0201:
-		printf("Token Ring");
-		break;
-	case 0x0202:
-		printf("FDDI");
-		break;
-	case 0x0203:
-		printf("ATM");
-		break;
-	case 0x0280:
-		printf("Network");
-		
-	case 0x0300:
-		printf("VGA Display");
-		break;
-	case 0x0301:
-		printf("XGA Display");
-		break;
-	case 0x0302:
-		printf("3D Display");
-		break;
-	case 0x0380:
-		printf("Display");
-		break;
-		
-	default:
-		printf("unkown");
-	}
-	printf(")\n  Image Length: 0x%04x blocks (%d bytes)\n", 
-			little_word(data->ilen), little_word(data->ilen)*512);
+	printf("  Class Code: 0x%06x (%s)\n",classcode,
+					 pci_device_class_name(classcode));
+	printf("  Image Length: 0x%04x blocks (%d bytes)\n", ilen, ilen*512);
 	printf("  Revision Level of Code/Data: 0x%04x\n",
-			little_word(data->irevision));
-	printf("  Code Type: 0x%02x (", data->type);
-	switch (data->type) {
-	case 0:
-		printf("Intel x86");
-		break;
-	case 1: 
-		printf("Open Firmware");
-		break;
-	case 2:
-		printf("HP PA Risc");
-		break;
-	case 3:
-		printf("Intel EFI (unofficial)");
-		break;
-	default:
-		printf("unknown as of PCI specs 2.2");
-	}
-	printf(")\n  Indicator: 0x%02x %s\n", data->indicator,
-			data->indicator&0x80?"(last image in rom)":"");
+			(u32)LITTLE_ENDIAN_WORD_FETCH(data->irevision));
+	printf("  Code Type: 0x%02x (%s)\n", data->code_type,
+					  pci_code_type_name(data->code_type) );
+	printf("  Last-Image Flag: 0x%02x (%slast image in rom)\n",
+			data->last_image_flag,
+			data->last_image_flag&0x80?"":"not ");
 	printf("  Reserved: 0x%04x\n\n", little_word(data->reserved_2));
 
 	return (sig==PCI_DATA_HDR);
@@ -225,7 +146,7 @@ static void dump_platform_extensions(u8 type, rom_header_t *data)
 			printf( "  Entry point for INIT function:"
 				" 0x%x\n\n",entry);
 		} else
-			printf( "  Unable to determin entry point for INIT"
+			printf( "  Unable to determine entry point for INIT"
 				" function. Please report.\n\n");
 		
 		break;
@@ -252,9 +173,9 @@ int main(int argc, char **argv)
 
 	if (argc!=2) {
 		printf ("\nUsage: %s <romimage.img>\n",argv[0]);
-		printf ("\nromheaders dumps pci option rom headers "
+		printf ("\n  romheaders dumps pci option rom headers "
 				"according to PCI \n"
-				"specs 2.2 in human readable form\n\n");
+				"  specs 2.2 in human readable form\n\n");
 		return -1;
 	}
 	
@@ -290,23 +211,25 @@ int main(int argc, char **argv)
 	do {
 		printf("\nImage %d:\n",i);
 		if (!dump_rom_header(rom_header)) {
-			printf("Error occured. Bailing out.\n");
+			printf("Rom Header error occured. Bailing out.\n");
 			break;
 		}
 		
-		pci_data=(pci_data_t *)(rom+little_word(rom_header->dptr));
+		pci_data = (pci_data_t *)((char *)rom_header +
+			     LITTLE_ENDIAN_WORD_FETCH(rom_header->data_ptr));
 		
 		if (!dump_pci_data(pci_data)) {
-			printf("Error occured. Bailing out.\n");
+			printf("PCI Data error occured. Bailing out.\n");
 			break;
 		}
 		
-		dump_platform_extensions(pci_data->type, rom_header);
+		dump_platform_extensions(pci_data->code_type, rom_header);
 		
-		rom_header+=little_word(pci_data->ilen)*512;
+		rom_header = (rom_header_t *)((char *)rom_header +
+				LITTLE_ENDIAN_WORD_FETCH(pci_data->ilen)*512);
 		i++;
-	} while ((pci_data->indicator&0x80)!=0x80 &&
-			romlen<(unsigned long)rom_header-(unsigned long)romlen);
+	} while ((pci_data->last_image_flag&0x80)!=0x80 &&
+			(char *)rom_header < rom+(int)romlen );
 
 	return 0;
 }
diff --git a/toke/Makefile b/toke/Makefile
index 547a889..110d75f 100644
--- a/toke/Makefile
+++ b/toke/Makefile
@@ -1,11 +1,12 @@
 #
-#                     OpenBIOS - free your system! 
-#                         ( FCode tokenizer )
-#                          
-#  This program is part of a free implementation of the IEEE 1275-1994 
+#                     OpenBIOS - free your system!
+#                             ( Utilities )
+#
+#  This program is part of a free implementation of the IEEE 1275-1994
 #  Standard for Boot (Initialization Configuration) Firmware.
 #
-#  Copyright (C) 2001-2005  Stefan Reinauer, <stepan@openbios.org>
+#  Copyright (C) 2001-2006  Stefan Reinauer <stepan@openbios.org>
+#  Copyright (C) 2006 coresystems GmbH <info@coresystems.de>
 #
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -21,52 +22,39 @@
 #  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
 #
 
-ARCH     := $(shell uname -m | sed -e s/i.86/x86/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/)
-TOPDIR   := $(shell /bin/pwd)
-BUILDDIR ?= $(TOPDIR)/obj-$(ARCH)
-VPATH    := $(BUILDDIR)
+PROGRAM = toke
+
+CC      = gcc
+STRIP	= strip
+INCLUDES = -I../shared
+#CFLAGS  = -O2 -g -Wall 
+CFLAGS  = -Os -Wall -Wno-pointer-sign -DSYS_IS_GNU_Linux
+LDFLAGS = 
 
-include $(TOPDIR)/Rules.make
+OBJS  = clflags.o conditl.o devnode.o dictionary.o emit.o errhandler.o     \
+        flowcontrol.o macros.o nextfcode.o parselocals.o scanner.o stack.o \
+	stream.o strsubvocab.o ticvocab.o toke.o tokzesc.o tracesyms.o     \
+	usersymbols.o ../shared/classcodes.o
 
-CC     = gcc
-CFLAGS = -O2 -Wall -W -ansi -pedantic
-# CFLAGS = -O -g -Wall -ansi -pedantic
+all: .dependencies $(PROGRAM)
 
-# CFLAGS := $(CFLAGS) -DDEBUG_SCANNER
-# CFLAGS := $(CFLAGS) -DDEBUG_DSTACK
+$(PROGRAM): $(OBJS)
+	$(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS)
+	$(STRIP) -s $(PROGRAM)
 
-OBJECTS= toke.o stack.o stream.o dictionary.o macros.o scanner.o emit.o
+clean:
+	rm -f $(OBJS) *~
 
-.SUFFIXES: .c .o
+distclean: clean
+	rm -f $(PROGRAM) .dependencies
+	
+.dependencies: *.c 
+	@$(CC) $(CFLAGS) $(INCLUDES) -MM *.c > .dependencies
 
-all: main toke
-	@cd $(BUILDDIR) && strip toke
-	@echo -e "\nOpenBIOS tokenizer toke build finished\n"
+.PHONY: all clean distclean 
 
-# main should go to rules.make
-main:
-	@echo -e "\nWelcome to toke, the OpenBIOS fcode tokenizer.."
-	@test -r $(BUILDDIR) || ( mkdir -p $(BUILDDIR); \
-	  echo -e "\nCreating build directory $(BUILDDIR)" )
+-include .dependencies
 
-toke: $(OBJECTS)
-	@echo -n "  linking tokenizer executable... "
-	@cd $(BUILDDIR) && $(CC) $(CFLAGS) -o $@ $^
-	@echo -e "\tok"
-	
-clean:
-	@test ! -d $(BUILDDIR) && \
-		echo "Architecture $(ARCH) is already clean." || \
-		( 						 \
-			echo "Cleaning up architecture $(ARCH)"; \
-			rm -rf $(BUILDDIR)			 \
-			rm forth.dict.core			 \
-		)
+.c.o:
+	$(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@ 
 
-toke.o:       toke.c toke.h stack.h stream.h emit.h
-dictionary.o: dictionary.c toke.h dictionary.h
-emit.o:       emit.c toke.h stack.h
-macros.o:     macros.c toke.h
-scanner.o:    scanner.c toke.h stack.h stream.h dictionary.h
-stack.o:      stack.c toke.h stack.h
-stream.o:     stream.c toke.h
diff --git a/toke/Rules.make b/toke/Rules.make
deleted file mode 100644
index db82ed6..0000000
--- a/toke/Rules.make
+++ /dev/null
@@ -1,17 +0,0 @@
-# tag: Makefile rules
-
-VPATH    := $(VPATH):.
-
-.S.o:
-	echo -n "  assembling $<... "
-	$(CC) -c -nostdlib $(INCLUDES) $(CFLAGS) $< -o $(BUILDDIR)/$@ && \
-		echo -e "    \t\tok" || \
-		echo -e "    \t\tfailed"
-
-.c.o:
-	@echo -n "  compiling $<... "
-	@$(CC) -c $(CFLAGS) $(INCLUDES) $< -o $(BUILDDIR)/$@ && \
-		echo -e "   \t\tok" || \
-		echo -e "   \t\failed"
-		
-
diff --git a/toke/clflags.c b/toke/clflags.c
new file mode 100644
index 0000000..19cea65
--- /dev/null
+++ b/toke/clflags.c
@@ -0,0 +1,729 @@
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Command-Line Flags are used to control certain non-Standard
+ *          variant behaviors of the Tokenizer.
+ *      Support Functions for setting, clearing, displaying, etc.
+ *      Call them "Special-Feature Flags" in messages to the User
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *          For a given CLFlag name, the user may enter either:
+ *
+ *                   -f CLFlagName
+ *              or
+ *                   -f noCLFlagName
+ *
+ *          to either enable or disable the associated function
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Functions Exported:
+ *          set_cl_flag                 Set (or clear) a CL Flag Variable
+ *          show_all_cl_flag_settings   Show CL Flags' settings unconditionally.
+ *          list_cl_flag_settings       Display CL Flags' settings if changed.
+ *          list_cl_flag_names          Display just the names of the CL Flags.
+ *          cl_flags_help               Help Message for CL Flags
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Revision History:
+ *          Updated Mon, 08 Aug 2005 by David L. Paktor
+ *          They're not just for setting from the Command-Line anymore,
+ *              but let's still keep these names for internal use....
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *          The CL_FLAGS data structure has a field for the CLFlagName,
+ *          one for a text explanation of the function it controls, and
+ *          one for the address of the boolean variable ("flag")
+ *
+ **************************************************************************** */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "clflags.h"
+#include "errhandler.h"
+
+
+/* **************************************************************************
+ *
+ *          Global Variables Exported
+ *              (The "flags" controlled by this means)
+ *
+ **************************************************************************** */
+
+bool ibm_locals = FALSE ;
+bool ibm_locals_legacy_separator = TRUE ;
+bool ibm_legacy_separator_message = TRUE ;
+bool enable_abort_quote = TRUE ;
+bool sun_style_abort_quote = TRUE ;
+bool abort_quote_throw = TRUE ;
+bool string_remark_escape = TRUE ;
+bool hex_remark_escape = TRUE ;
+bool c_style_string_escape = TRUE ;
+bool always_headers = FALSE ;
+bool always_external = FALSE ;
+bool verbose_dup_warning = TRUE ;
+bool obso_fcode_warning = TRUE ;
+bool trace_conditionals = FALSE ;
+bool big_end_pci_image_rev = FALSE ;
+
+/*  And one to trigger a "help" message  */
+bool clflag_help = FALSE;
+
+/* **************************************************************************
+ *
+ *     The addition of the "upper/lower-case-tokens" flags introduces
+ *         some complications.  These are the variables we will actually
+ *         be exporting:
+ *
+ **************************************************************************** */
+
+bool force_tokens_case       = FALSE ;
+bool force_lower_case_tokens = FALSE ;
+
+/* **************************************************************************
+ *
+ *         but we will be entering two static variables into the table,
+ *         and keep two more to detect when a change is made...
+ *
+ **************************************************************************** */
+static bool upper_case_tokens = FALSE ;
+static bool lower_case_tokens = FALSE ;
+static bool was_upper_case_tk = FALSE ;
+static bool was_lower_case_tk = FALSE ;
+
+/* **************************************************************************
+ *
+ *              Internal Static Variables
+ *     cl_flag_change        A change was made to any of the CL Flags
+ *              Internal Static Constants
+ *     cl_flags_list         List of CL Flags and their data.
+ *
+ **************************************************************************** */
+
+static bool cl_flag_change = FALSE;
+
+static const cl_flag_t cl_flags_list[] = {
+  /*  The clflag_tabs field takes at least one tab.
+   *  If the name has fewer than 16 characters,
+   *  stick in an extra tab, and yet another tab
+   *  if the name is shorter than 8 characters
+   *  to make the formatting of the "explanation"
+   *  come out prettier.
+   */
+  { "Local-Values",
+        &ibm_locals,
+	"\t\t",
+	    "Support IBM-style Local Values (\"LV\"s)"     } ,
+
+  { "LV-Legacy-Separator",
+        &ibm_locals_legacy_separator,
+	"\t",
+	    "Allow Semicolon for Local Values Separator (\"Legacy\")"     } ,
+
+  { "LV-Legacy-Message",
+        &ibm_legacy_separator_message,
+	"\t",
+	    "Display a Message when Semicolon is used as the "
+		"Local Values Separator" } ,
+
+  { "ABORT-Quote",
+        &enable_abort_quote,
+	"\t\t",
+	    "Allow ABORT\" macro"     } ,
+
+  { "Sun-ABORT-Quote",
+        &sun_style_abort_quote,
+	"\t\t",
+	    "ABORT\" with implicit IF ... THEN"     } ,
+
+  { "ABORT-Quote-Throw",
+        &abort_quote_throw,
+	"\t",
+	    "Use -2 THROW in an Abort\" phrase, rather than ABORT"     } ,
+
+  { "String-remark-escape",
+        &string_remark_escape,
+	"\t",
+	    "Allow \"\\ (Quote-Backslash) to interrupt string parsing"     } ,
+
+  { "Hex-remark-escape",
+        &hex_remark_escape,
+	"\t",
+	    "Allow \\ (Backslash) to interrupt "
+		"hex-sequence parsing within a string"     } ,
+
+  { "C-Style-string-escape",
+        &c_style_string_escape ,
+	"\t",
+	    "Allow \\n \\t and \\xx\\ for special chars in string parsing"  } ,
+
+  { "Always-Headers",
+        &always_headers ,
+	"\t\t",
+	    "Override \"headerless\" and force to \"headers\"" } ,
+
+  { "Always-External",
+        &always_external ,
+	"\t\t",
+	    "Override \"headerless\" and \"headers\" and "
+		"force to \"external\"" } ,
+
+  { "Warn-if-Duplicate",
+        &verbose_dup_warning ,
+	"\t",
+	    "Display a WARNING message when a duplicate definition is made" } ,
+
+  { "Obsolete-FCode-Warning",
+        &obso_fcode_warning ,
+	"\t",
+	    "Display a WARNING message when an \"obsolete\" "
+		"(per the Standard) FCode is used" } ,
+
+  { "Trace-Conditionals",
+        &trace_conditionals,
+	"\t",
+	    "Display ADVISORY messages about the state of "
+		"Conditional Tokenization" } ,
+
+  { "Upper-Case-Token-Names",
+        &upper_case_tokens,
+	"\t",
+	    "Convert Token-Names to UPPER-Case" } ,
+
+
+  { "Lower-Case-Token-Names",
+        &lower_case_tokens,
+	"\t",
+	    "Convert Token-Names to lower-Case" } ,
+
+
+  { "Big-End-PCI-Rev-Level",
+        &big_end_pci_image_rev,
+	"\t",
+	    "Save the Vendor's Rev Level field of the PCI Header"
+		" in Big-Endian format" } ,
+
+
+  /*  Keep the "help" pseudo-flag last in the list  */
+  { "help",
+        &clflag_help,
+	    /*  Two extra tabs if the name is shorter than 8 chars  */
+	"\t\t\t",
+	    "Print this \"Help\" message for the Special-Feature Flags" }
+
+};
+
+static const int number_of_cl_flags =
+	 sizeof(cl_flags_list)/sizeof(cl_flag_t);
+
+
+/* **************************************************************************
+ *
+ *          CL Flags whose settings are changed in the source file should
+ *              not stay in effect for the duration of the entire batch of
+ *              tokenizations (i.e., if multiple input files are named on
+ *              the command line) the way command-line settings should.
+ *          To accomplish this we will collect the state of the flags into
+ *              a bit-mapped variable after the command line has been parsed
+ *              and restore them to their collected saved state before an
+ *              input file is processed.
+ *
+ **************************************************************************** */
+
+static long int cl_flags_bit_map;
+/*  If the number of CL Flags ever exceeds the number of bits in a long
+ *      (presently 32), we will need to change both this variable and
+ *      the routines that use it.  Of course, if the number of CL Flags
+ *      ever gets that high, it will be *seriously* unwieldy...   ;-}
+ */
+
+/* **************************************************************************
+ *
+ *      Function name:  adjust_case_flags
+ *      Synopsis:       If the last CL Flag Variable setting changed one of
+ *                          the "upper/lower-case-tokens" flags, make the 
+ *                          appropriate adjustments.
+ *
+ *      Inputs:
+ *         Parameters:                NONE
+ *         Local Static Variables:
+ *             was_upper_case_tk      State of "upper-case-tokens" flag before
+ *                                        last CL Flag Variable was processed
+ *             was_lower_case_tk      State of "lower-case-tokens" flag, before
+ *             upper_case_tokens      State of "upper-case-tokens" flag after
+ *                                        last CL Flag V'ble was processed
+ *             lower_case_tokens      State of "lower-case-tokens" flag, after
+ *         Global Variables:
+ *
+ *      Outputs:
+ *         Returned Value:            NONE
+ *         Global Variables:
+ *             force_tokens_case          TRUE if "upper/lower-case-tokens"
+ *                                            flag is in effect
+ *             force_lower_case_tokens    If force_tokens_case is TRUE, then
+ *                                            this switches between "upper"
+ *                                            or "lower" case
+ *
+ *      Process Explanation:
+ *          We cannot come out of this with both  upper_case_tokens  and
+ *               lower_case_tokens  being TRUE, though they may both be FALSE.
+ *          If neither has changed state, we need not do anything here.
+ *              If one has gone to TRUE, we must force the other to FALSE and
+ *                  we will set  force_tokens_case  to TRUE.
+ *              If one has gone to FALSE, turn  force_tokens_case  to FALSE.
+ *              If  force_tokens_case  is TRUE after all this, we must adjust
+ *                   force_lower_case_tokens  according to  lower_case_tokens
+ *
+ **************************************************************************** */
+
+static void adjust_case_flags( void)
+{
+    static bool *case_tokens[2] = { &upper_case_tokens, &lower_case_tokens };
+    static bool *was_case_tk[2] = { &was_upper_case_tk, &was_lower_case_tk };
+    int the_one = 0;
+    int the_other = 1;
+
+    for ( ; the_one < 2 ; the_one++ , the_other-- )
+    {
+	/*  If one has changed state   */
+	if ( *(case_tokens[the_one]) != *(was_case_tk[the_one]) )
+	{
+	    if ( *(case_tokens[the_one]) )
+	    {
+	        /*  If it has gone to TRUE, force the other to FALSE.  */
+		*(case_tokens[the_other]) = FALSE;
+	        /*      and set  force_tokens_case  to TRUE  */
+		force_tokens_case = TRUE;
+	    }else{
+		/*  If it has gone to FALSE turn  force_tokens_case FALSE  */
+		force_tokens_case = FALSE;
+	    }
+	    if ( force_tokens_case )
+	    {
+	        force_lower_case_tokens = lower_case_tokens;
+	    }
+	    break;  /*  Only one can have changed state.   */
+	}
+    }
+}
+
+
+
+
+/* **************************************************************************
+ *
+ *      Function name:  set_cl_flag
+ *      Synopsis:       Set (or clear) the named CL Flag Variable
+ *
+ *      Inputs:
+ *         Parameters:
+ *             flag_name           The name as supplied by the user
+ *             from_src            TRUE if called from source-input file
+ *         Static Constants:
+ *             cl_flags_list
+ *             number_of_cl_flags
+ *
+ *      Outputs:
+ *         Returned Value:         TRUE if supplied name is not valid
+ *         Global Variables:
+ *             The CL Flag Variable associated with the supplied name will
+ *                 be set or cleared according to the leading "no"
+ *         Local Static Variables:
+ *             cl_flag_change      TRUE if associated variable has changed
+ *         Printout:
+ *             If  from_src  is TRUE, print "En" or "Dis" abling:
+ *                 followed by the explanation
+ *
+ *      Error Detection:
+ *          If the supplied name is not a valid CL Flag name, or if
+ *              it's too short to be a valid CL Flag name, return TRUE.
+ *          Print a message;  either a simple print if this function was
+ *              called from a command-line argument, or an ERROR if it
+ *              was called from a line in the from source-input file.
+ *
+ *      Process Explanation:
+ *          Save the current state of the "upper/lower-case-tokens" flags
+ *          If the given name has a leading "no", make note of that fact
+ *              and remove the leading "no" from the comparison.
+ *          Compare with the list of valid CL Flag names.
+ *          If no match was found, Error.  See under Error Detection.
+ *          If a match:
+ *              Change the associated variable according to the leading "no"
+ *              Set  cl_flag_change  to TRUE  unless the variable is the one
+ *                  associated with the "help" flag; this permits the
+ *                  "Default" vs "Setting" part of  cl_flags_help() to
+ *                  work properly...
+ *              Do the conditional Printout (see above)
+ *          Adjust the "upper/lower-case-tokens" flags if one has changed.
+ *
+ **************************************************************************** */
+static bool first_err_msg = TRUE;  /*  Need extra carr-ret for first err msg  */
+bool set_cl_flag(char *flag_name, bool from_src)
+{
+    bool retval = TRUE;
+
+    was_upper_case_tk = upper_case_tokens;
+    was_lower_case_tk = lower_case_tokens;
+
+    if ( strlen(flag_name) > 3 )
+    {
+	int indx;
+	bool flagval = TRUE;
+	char *compar = flag_name;
+
+	if ( strncasecmp( flag_name, "no", 2) == 0 )
+	{
+	    flagval = FALSE;
+	    compar += 2;
+	}
+	for ( indx = 0 ; indx < number_of_cl_flags ; indx++ )
+	{
+	    if ( strcasecmp( compar, cl_flags_list[indx].clflag_name ) == 0 )
+	    {
+		retval = FALSE;
+		*(cl_flags_list[indx].flag_var) = flagval;
+
+		/*  The "help" flag is the last one in the list  */
+		if ( indx != number_of_cl_flags - 1 )
+		{
+		    cl_flag_change = TRUE;
+		}
+		if ( from_src )
+		{
+		    tokenization_error(INFO,
+		    "%sabling:  %s\n",
+		    flagval ? "En" : "Dis", cl_flags_list[indx].clflag_expln);
+		}
+		break;
+	    }
+	}
+    }
+
+    if ( retval )
+    {
+       const char* msg_txt = "Unknown Special-Feature Flag:  %s\n" ;
+       if ( from_src )
+       {
+           tokenization_error( TKERROR, (char *)msg_txt, flag_name);
+       }else{
+	   if ( first_err_msg )
+	   {
+	       printf( "\n");
+	       first_err_msg = FALSE;
+	   }
+	   printf( msg_txt, flag_name);
+       }
+    }
+
+    adjust_case_flags();
+
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  show_all_cl_flag_settings
+ *      Synopsis:       Display the settings of the CL Flags, (except "help")
+ *                          regardless of whether they have been changed.
+ *
+ *      Associated Tokenizer directive(s):        [FLAGS]
+ *                                                #FLAGS
+ *                                                [#FLAGS]
+ *                                                SHOW-FLAGS
+ *          This routine may also be invoked by a combination of
+ *              options on the command-line.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             from_src                TRUE if called from source-input file
+ *         Macro:
+ *             ERRMSG_DESTINATION        Error message destination;
+ *                                           (Development-time switch)
+ *         Static Constants:
+ *             cl_flags_list
+ *             number_of_cl_flags
+ *
+ *      Outputs:
+ *         Returned Value:                  NONE
+ *         Printout:    Directed to  stdout or to stderr 
+ *                          (see definition of ERRMSG_DESTINATION)
+ *             A header line, followed by the names of the CL Flags,
+ *                  with "No" preceding name if value is FALSE, one to a line.
+ *
+ *      Process Explanation:
+ *          If from_src is TRUE, print the header line as a Message, and
+ *              then direct output to  ERRMSG_DESTINATION .
+ *          Don't print the "help" trigger (the last flag in the array).
+ *
+ **************************************************************************** */
+
+void show_all_cl_flag_settings(bool from_src)
+{
+    const char* hdr_txt = "Special-Feature Flag settings:" ;
+    int indx;
+
+    if ( from_src )
+    {
+	tokenization_error(MESSAGE, (char *)hdr_txt);
+    }else{
+	printf("\n%s\n", hdr_txt);
+    }
+
+    for ( indx = 0 ; indx < (number_of_cl_flags - 1) ; indx++ )
+    {
+	fprintf( from_src ? ERRMSG_DESTINATION : stdout ,
+	    "\t%s%s\n",
+		*(cl_flags_list[indx].flag_var) ? "  " : "No" ,
+		    cl_flags_list[indx].clflag_name );
+    }
+    if ( from_src )   fprintf( ERRMSG_DESTINATION, "\n");
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  list_cl_flag_settings
+ *      Synopsis:       Display the settings of the CL Flags, (except "help")
+ *                          if any of them have been changed
+ *
+ *      Inputs:
+ *         Parameters:                 NONE
+ *         Local Static Variables:        
+ *             cl_flag_change          TRUE if a Flag setting has been changed.
+ *
+ *      Outputs:
+ *         Returned Value:             NONE
+ *         Printout:
+ *             Settings of the CL Flags.  See   show_all_cl_flag_settings()
+ *
+ *      Process Explanation:
+ *          Don't print anything if  cl_flag_change  is not TRUE
+ *
+ **************************************************************************** */
+
+void list_cl_flag_settings(void)
+{
+
+    if ( cl_flag_change )
+    {
+	show_all_cl_flag_settings( FALSE);
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  list_cl_flag_names
+ *      Synopsis:       Display just the names of the CL Flags
+ *                      for the Usage message
+ *
+ *      Inputs:
+ *         Parameters:                      NONE
+ *         Static Constants:
+ *             cl_flags_list                
+ *             number_of_cl_flags           
+ *
+ *      Outputs:
+ *         Returned Value:                  NONE
+ *         Printout:
+ *             A header line, followed by the names of the CL Flags,
+ *
+ **************************************************************************** */
+
+void list_cl_flag_names(void)
+{
+    int indx;
+
+    printf("Valid Special-Feature Flags are:\n");
+    for ( indx = 0 ; indx < number_of_cl_flags ; indx++ )
+    {
+        printf("\t%s\n", cl_flags_list[indx].clflag_name );
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  cl_flags_help
+ *      Synopsis:       Display Usage of the CL Flags and their defaults
+ *                      
+ *
+ *      Inputs:
+ *         Parameters::                      NONE
+ *         Static Constants:
+ *             cl_flags_list
+ *             number_of_cl_flags
+ *         Local Static Variables:
+ *             cl_flag_change                TRUE if setting has been changed.
+ *
+ *      Outputs:
+ *         Returned Value:                   NONE
+ *         Printout:
+ *             A few lines of header, followed by the default, the name
+ *             and the "explanation" of each of the CL Flags, one to a line.
+ *
+ *      Extraneous Remarks:
+ *          We take advantage of the facts that this routine is called
+ *              (1) only from the command-line, before any settings
+ *              have been changed, and (2) via changing the flag for
+ *              "help" to TRUE.  (Technically, I suppose, the default
+ *              for the "help" feature is "no", but showing will, I
+ *              think be more confusing than enlightening to the user.)
+ *          Also, I suppose a perverse user could change setting(s) on
+ *              the same command-line with a "-f help" request; we cannot
+ *              stop users from aiming at their boot and pulling the
+ *              trigger.  As my buddies in Customer Support would say:
+ *              "KMAC YOYO"  (Approximately, "You're On Your Own, Clown")...
+ *
+ *      Revision History:
+ *          Oh, all right.  If the user changed setting(s), we can do
+ *              them the minor courtesy of printing "Setting" instead
+ *              of "Default".
+ *
+ *
+ **************************************************************************** */
+
+void cl_flags_help(void )
+{
+    int indx;
+
+    printf("\n"
+           "Special-Feature Flags usage:\n"
+           "  -f   FlagName   to enable the feature associated with FlagName,\n"
+           "or\n"
+           "  -f noFlagName   to disable the feature.\n\n"
+                "%s   Flag-Name\t\t  Feature:\n\n",
+	            cl_flag_change ? "Setting" : "Default" );
+
+   for ( indx = 0 ; indx < number_of_cl_flags ; indx++ )
+    {
+	printf("  %s    %s%s%s\n",
+	    *(cl_flags_list[indx].flag_var) ? "  " : "no" ,
+	    cl_flags_list[indx].clflag_name,
+	    cl_flags_list[indx].clflag_tabs,
+	    cl_flags_list[indx].clflag_expln);
+    }
+
+}
+
+
+
+/* **************************************************************************
+ *
+ *      Function name:  save_cl_flags
+ *      Synopsis:       Collect the state of the CL Flags
+ *
+ *      Inputs:
+ *         Parameters:                     NONE
+ *         Local Static Variables:
+ *             cl_flags_list
+ *         Static Constants:
+ *             number_of_cl_flags
+ *
+ *      Outputs:
+ *         Returned Value:                 NONE
+ *         Local Static Variables:
+ *             cl_flags_bit_map            Will be set to reflect the state
+ *                                             of the CL Flags in the list.
+ *
+ *      Process Explanation:
+ *          The correspondence of bits to the list is that the first item
+ *              in the list corresponds to the low-order bit, and so on
+ *              moving toward the high-order with each successive item.
+ *          Do not save the "help" flag (last item on the list).
+ *          This routine is called after the command line has been parsed.
+ *
+ **************************************************************************** */
+
+void save_cl_flags(void)
+{
+    int indx;
+    long int moving_bit = 1;
+
+    cl_flags_bit_map = 0;
+    for ( indx = 0 ; indx < (number_of_cl_flags - 1) ; indx++ )
+    {
+	if ( *(cl_flags_list[indx].flag_var) )
+	{
+	    cl_flags_bit_map |= moving_bit;  /*  The moving finger writes,  */
+	}
+	moving_bit <<= 1;                    /*  and having writ, moves on. */
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  reset_cl_flags
+ *      Synopsis:       Restore the CL Flags to the state that was saved.
+ *
+ *      Inputs:
+ *         Parameters:                     NONE
+ *         Local Static Variables:
+ *             cl_flags_bit_map            Reflects the state of the CL Flags
+ *         Static Constants:
+ *             number_of_cl_flags
+ *
+ *      Outputs:
+ *         Returned Value:                  NONE
+ *         Local Static Variables:
+ *             cl_flags_list
+ *         Global Variables:
+ *             The CL Flag Variables will be set or cleared
+ *                 to their saved state
+ *
+ *      Process Explanation:
+ *          This routine is called before starting a new input file.
+ *              Any changes made in the source file will not stay
+ *              in effect for the next tokenization.
+ *
+ **************************************************************************** */
+
+void reset_cl_flags(void)
+{
+    int indx;
+    long int moving_bit = 1;
+
+    for ( indx = 0 ; indx < (number_of_cl_flags - 1) ; indx++ )
+    {
+	*(cl_flags_list[indx].flag_var) =
+	    BOOLVAL( cl_flags_bit_map & moving_bit) ;
+	moving_bit <<= 1;
+    }
+}
diff --git a/toke/clflags.h b/toke/clflags.h
new file mode 100644
index 0000000..26f923d
--- /dev/null
+++ b/toke/clflags.h
@@ -0,0 +1,144 @@
+#ifndef _TOKE_CLFLAGS_H
+#define _TOKE_CLFLAGS_H
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Function Prototypes and External declarations
+ *          for Command-Line Flags Support
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Structure-Types:
+ *          cl_flag_t            Data for recognizing and setting Command-Line
+ *                                   Flags, and for displaying the help message
+ *
+ *      Function Prototypes / Functions Exported:
+ *          set_cl_flag
+ *          list_cl_flag_settings
+ *          list_cl_flag_names          Display just the names of the CL Flags
+ *          cl_flags_help
+ *
+ *      Global Variables Exported
+ *                (These flags, which are set by the set_cl_flag() routine,
+ *                     are used throughout the Tokenizer to control certain
+ *                     non-Standard variant behaviors.)
+ *          ibm_locals
+ *          ibm_locals_legacy_separator
+ *          ibm_legacy_separator_message
+ *          enable_abort_quote
+ *          sun_style_abort_quote
+ *          string_remark_escape
+ *          hex_remark_escape
+ *          c_style_string_escape
+ *          always_headers
+ *          always_external
+ *          verbose_dup_warning
+ *          obso_fcode_warning
+ *          trace_conditionals
+ *          force_tokens_case
+ *          force_lower_case_tokens
+ *          big_end_pci_image_rev
+ *          clflag_help
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *          Structure-Type Name:    cl_flag_t
+ *               Data for recognizing and setting Command-Line Flags,
+ *                   and for displaying the help message
+ *
+ *   Fields:
+ *       clflag_name     *char          CL Flag name, as entered by the user
+ *       flag_var        *bool          Address of boolean ("flag") variable
+ *       clflag_tabs     *char          Tabs to align the explanations, in
+ *                                          the help message display
+ *       clflag_expln    *char          Explanation, used in help message
+ *
+ *   Since this structure will be initialized by the program, and will not
+ *       be added-to, we can structure it as purely an array, and have no
+ *       need to treat it as a linked list, hence no link-field.
+ *
+ **************************************************************************** */
+
+#include "types.h"
+
+typedef struct cl_flag
+    {
+	char             *clflag_name;
+	bool             *flag_var;
+	char             *clflag_tabs;
+	char             *clflag_expln;
+    }  cl_flag_t ;
+
+
+/* **************************************************************************
+ *
+ *          Exported Global Variables
+ *
+ **************************************************************************** */
+
+extern bool ibm_locals;
+extern bool ibm_locals_legacy_separator;
+extern bool ibm_legacy_separator_message;
+extern bool enable_abort_quote;
+extern bool sun_style_abort_quote;
+extern bool abort_quote_throw;
+extern bool string_remark_escape;
+extern bool hex_remark_escape;
+extern bool c_style_string_escape;
+extern bool always_headers;
+extern bool always_external;
+extern bool verbose_dup_warning;
+extern bool obso_fcode_warning;
+extern bool trace_conditionals;
+extern bool big_end_pci_image_rev;
+
+extern bool force_tokens_case;
+extern bool force_lower_case_tokens;
+
+extern bool clflag_help;
+
+/* **************************************************************************
+ *
+ *          Exported Functions
+ *
+ **************************************************************************** */
+
+bool set_cl_flag(char *flag_name, bool print_message);
+void cl_flags_help(void);
+void list_cl_flag_names(void);
+void show_all_cl_flag_settings(bool from_src);
+void list_cl_flag_settings(void);
+void save_cl_flags(void);
+void reset_cl_flags(void);
+
+#endif   /*  _TOKE_CLFLAGS_H    */
diff --git a/toke/conditl.c b/toke/conditl.c
new file mode 100644
index 0000000..669494c
--- /dev/null
+++ b/toke/conditl.c
@@ -0,0 +1,772 @@
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Conditional-Compilation support for Tokenizer
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Functions Exported:
+ *          init_conditionals_vocab    Initialize the "Conditionals" Vocabulary.
+ *          handle_conditional         Confirm whether a given name is a valid
+ *                                         Conditional, and, if so, perform its
+ *                                         function and return an indication.
+ *          create_conditional_alias   Add an alias to "Conditionals" vocab
+ *          reset_conditionals         Reset the "Conditionals" Vocabulary
+ *                                         to its "Built-In" position.
+ *
+ **************************************************************************** */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <string.h>
+#include <errno.h>
+
+#include "scanner.h"
+#include "errhandler.h"
+#include "ticvocab.h"
+#include "conditl.h"
+#include "stack.h"
+#include "dictionary.h"
+#include "vocabfuncts.h"
+#include "usersymbols.h"
+#include "stream.h"
+#include "clflags.h"
+
+/* **************************************************************************
+ *
+ *          Global Variables Imported
+ *              statbuf               Start of input-source buffer
+ *              pc                    Input-source Scanning pointer
+ *              iname                 Current Input File name
+ *              lineno                Current Line Number in Input File
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *              Local Static Variables
+ *      already_ignoring      Location from which to pass a parameter,
+ *                            called "alr_ign" to the main routine.  Each
+ *                            "Conditional" will have an associated routine
+ *                            that takes the pointer to this as its argument.
+ *                            The pointer to this will satisfy the "param-field"
+ *                            requirement of a TIC_HDR-style "Vocabulary"-list.
+ *      conditionals_tbl      TIC_HDR-style "Vocabulary"-list table, initialized
+ *                            as an array.
+ *      conditionals          Pointer to "tail" of Conditionals Vocabulary-list
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      The lists of synonymous forms of the #ELSE and #THEN operators
+ *          are incorporated into the "Shared Words" Vocabulary.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Function name:  is_a_then  /  is_an_else
+ *      Synopsis:       Indicate whether the given name is one of the
+ *                      [then] / [else]  synonyms
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             a_word                        Word to test
+ *
+ *      Outputs:
+ *         Returned Value:       TRUE if the given name is one of the synonyms
+ *
+ *      Process Explanation:
+ *          The functions are twins, hence bundling them like this...
+ *
+ **************************************************************************** */
+
+
+/* **************************************************************************
+ *
+ *      Support function:  is_a_type
+ *      Synopsis:          Indicate whether the given name is a "shared word"
+ *                         whose FWord Token matches the one given
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                        Target name to look for
+ *             fw_type                      The FWord Token type to match
+ *
+ *      Outputs:
+ *         Returned Value:                  TRUE if it matches
+ *
+ **************************************************************************** */
+
+
+static bool is_a_type( char *tname, fwtoken fw_type)
+{
+    bool retval = FALSE;
+    tic_fwt_hdr_t *found = (tic_fwt_hdr_t *)lookup_shared_f_exec_word( tname );
+    if ( found != NULL )
+    {
+        if ( found->pfield.fw_token == fw_type )  retval = TRUE;
+    }
+    return ( retval );
+}
+
+static bool is_a_then( char *a_word)
+{
+    bool retval = is_a_type( a_word, CONDL_ENDER);
+    return ( retval );
+}
+
+static bool is_an_else( char *a_word)
+{
+    bool retval = is_a_type( a_word, CONDL_ELSE);
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *     This is a somewhat roundabout way of passing an "already ignoring"
+ *         parameter to the various Conditional Operators.  Each operator's
+ *         Parameter-Field Pointer points to this.  The calling routine
+ *         must set it (or rely on the default); the routine that handles
+ *         nesting of Conditionals must save and restore a local copy.
+ *
+ **************************************************************************** */
+
+static bool already_ignoring = FALSE;
+
+/* **************************************************************************
+ *
+ *      Further down, will define and initialize a word-list table with
+ *          all the functions that implement the Conditional Operators,
+ *          and we'll link it in with the "Global Vocabulary" pointer.
+ *
+ *      We'll call the word-list the "Conditionals Vocabulary Table",
+ *          and refer to its entries as the "Conditionals Vocabulary",
+ *          even though it isn't really a separate vocabulary...
+ * 
+ **************************************************************************** */
+
+
+/* **************************************************************************
+ *
+ *      We also need a few common routines to pass as "Ignoring" functions
+ *          for a few occasional words that take another word or two from
+ *          the input stream as their arguments.  For example, if the user
+ *          were to write:   alias [otherwise] [else]   and that were to
+ *          occur within a segment already being ignored, we need to make
+ *          sure that this doesn't get processed as an occurrence of  [else]
+ *          Similarly with macro-definitions.
+ *
+ *      Since we are using the term "ignore a word" to mean "look it up and
+ *          process it in Ignoring-state", we need a different term to name
+ *          this class of routine; let's use the term "skip a word" where
+ *          the "word" is strictly an input token, delimited by whitespace.
+ *
+ **************************************************************************** */
+ 
+/* **************************************************************************
+ *
+ *      Function name:  skip_a_word
+ *      Synopsis:       Consume one input-token ("word") from the
+ *                          Input Stream, with no processing
+ *
+ *      Inputs:
+ *         Parameters:
+ *             pfield             "Parameter field" pointer, to satisfy
+ *                                    the calling convention, but not used
+ *
+ *      Outputs:
+ *         Returned Value:        NONE
+ *
+ **************************************************************************** */
+
+void skip_a_word( tic_bool_param_t pfield )
+{
+    /* signed long wlen = */ get_word();
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  skip_a_word_in_line
+ *      Synopsis:       Consume one input-token ("word") on the same line
+ *                          as the current line of input, from the Input
+ *                          Stream, with no processing.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             pfield             "Parameter field" pointer, to satisfy
+ *                                    the calling convention, but not used
+ *         Global Variables:
+ *             statbuf            The word being processed, which expects
+ *                                    another word on the same line; used
+ *                                    for the Error message.
+ *
+ *      Outputs:
+ *         Returned Value:        NONE
+ *
+ *      Error Detection:
+ *          get_word_in_line() will check and report if no word on same line.
+ *
+ **************************************************************************** */
+void skip_a_word_in_line( tic_bool_param_t pfield )
+{
+    /* bool isokay = */ get_word_in_line( statbuf);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  skip_two_words_in_line
+ *      Synopsis:       Consume two input-tokens ("words") on the same line
+ *                          as the current line of input, from the Input
+ *                          Stream, with no processing.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             pfield             "Parameter field" pointer, to satisfy
+ *                                    the calling convention, but not used
+ *         Global Variables:
+ *             statbuf            The word being processed, which expects
+ *                                    two words on the same line; used for
+ *                                    the Error message.
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Memory Allocated
+ *             Copy of  statbuf  for Error message.
+ *         When Freed?
+ *             End of this routine
+ *
+ *      Error Detection:
+ *          get_word_in_line() will check and report
+ *
+ **************************************************************************** */
+
+void skip_two_words_in_line( tic_bool_param_t pfield )
+{
+    char *func_cpy = strupr( strdup( statbuf));
+    if ( get_word_in_line( func_cpy) )
+    {
+        /* bool isokay = */ get_word_in_line( func_cpy);
+    }
+    free( func_cpy);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  ignore_one_word
+ *      Synopsis:       Handle a word that needs processing while "ignoring"
+ *                          Ignore the rest.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                  Target name to test
+ *         Local Static Variables:
+ *             already_ignoring       The "Already Ignoring" flag
+ *
+ *      Outputs:
+ *         Returned Value:            NONE
+ *         Global Variables:
+ *             tic_found              Set to the TIC-entry that has just been
+ *                                        found, in case it's a Macro.
+ *         Local Static Variables:
+ *             already_ignoring       Intermediately set to TRUE, then
+ *                                        returned to former state.
+ *
+ *      Process Explanation:
+ *          When we are ignoring source input, we still need to be
+ *              sensitive to the nesting of Conditional Operators, to
+ *              consume comments and user -message text-bodies, and to
+ *              expand Macros, among other things.
+ *         Rather than create special cases here for each one, we have
+ *              added an "ign_funct" pointer to those words where this
+ *              is relevant, including Conditional Operators. 
+ *          Save the state of  already_ignoring  and set it to TRUE
+ *              Execute the "Ignoring" Function associated with the entry
+ *              Restore  already_ignoring  to its previous state.
+ *          This is necessary if the word is a Conditional Operator and
+ *              is harmless otherwise.
+ *
+ **************************************************************************** */
+
+static void ignore_one_word( char *tname)
+{
+    tic_bool_hdr_t *found = (tic_bool_hdr_t *)lookup_word( tname, NULL, NULL);
+    if ( found != NULL )
+    {
+        if ( found->ign_func != NULL )
+	{
+	    bool save_already_ignoring = already_ignoring;
+	    already_ignoring = TRUE ;
+	    tic_found = (tic_hdr_t *)found;
+
+	    found->ign_func( found->pfield);
+
+	    already_ignoring = save_already_ignoring;
+	}
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  conditionally_tokenize
+ *      Synopsis:       Conduct tokenization while a Conditional-Tokenization
+ *                          operator is in effect.  This is the core of the
+ *                          implementation of Conditional-Tokenization.
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             cond             The state of the Condition-Flag that the
+ *                                  immediate Conditional Operator acquired.
+ *                                  TRUE means "do not ignore".  Its sense
+ *                                  is reversed when [ELSE] is encountered.
+ *             alr_ign          TRUE means we are Already Ignoring source input,
+ *                                  except for Conditional Operators...
+ *         Global Variables:
+ *             statbuf       The symbol (word) just retrieved from input stream.
+ *             iname         Current Input File name (for Error Messages)
+ *             lineno        Current Line Number in Input File (ditto)
+ *             trace_conditionals   Whether to issue ADVISORY messages about
+ *                                      the state of Conditional Tokenization.
+ *
+ *      Outputs:
+ *         Returned Value:       NONE
+ *         Global Variables:
+ *             statbuf           Will be advanced to the balancing [THEN] op'r.
+ *             already_ignoring  Set to TRUE if nested Conditional encountered;
+ *                                  restored to previous state when done.
+ *         Memory Allocated
+ *             Duplicate of Input File name, for Error Messages
+ *         When Freed?
+ *             Just prior to exit from routine.
+ *         Printout:
+ *             ADVISORY messages, if "Trace-Conditionals" flag was selected.
+ *             
+ *         Global Behavior:
+ *            Tokenization happens, or inputs are ignored, as necessary.
+ *
+ *      Error Detection:
+ *          End-of-file encountered on reading a word    
+ *              ERROR.  Conditional Operators must be balanced within a file
+ *          More than one [ELSE] encountered:  ERROR if processing segment;
+ *              if ignoring, WARNING.
+ *
+ *      Process Explanation:
+ *          Read a word at a time.   Allow Macros to "pop" transparently,
+ *              but not source files.
+ *          If the word is a [THEN], we are done.
+ *          If the word is an [ELSE], then, if we are not Already Ignoring,
+ *                  invert the sense of whether we are ignoring source input. 
+ *              If this is not the only [ELSE] in the block, report an Error
+ *                  and disregard it.
+ *          If we are ignoring source input, for whatever reason, we still
+ *              need to be sensitive to the nesting of Conditional Operators:
+ *              If the word is a Conditional Operator, activate it with the
+ *                  "Already Ignoring" parameter set to TRUE; doing so will
+ *                  result in a nested call to this routine.
+ *              Otherwise, i.e., if the word is not a Conditional Operator,
+ *                  we may still need to process it in "ignoring" mode:
+ *                  we need, for instance, to consume strings, comments
+ *                  and the text-bodies of user-messages in their entirety,
+ *                  in case there is a reference to an [ELSE] or suchlike.
+ *                  The words that need processing while "ignoring" will
+ *                  have a valid function-pointer in their ign_func field.
+ *          If we are not ignoring source input, pass the word along to the
+ *              tokenize_one_word routine and process it.  If the word is
+ *              a Conditional Operator, it will be handled in the context
+ *              of normal (i.e., non-ignored) tokenization, and, again, a
+ *              nested call to this routine will result...
+ *
+ *      Revision History:
+ *          Updated Thu, 23 Feb 2006 by David L. Paktor
+ *              Conditional Blocks may begin with a Conditional Operator in
+ *                  a Macro definition and do not need to be concluded in
+ *                  the body of the Macro.
+ *          Updated Fri, 10 Mar 2006 by David L. Paktor
+ *              Recognize aliased string, comment and user-message delimiters
+ *                  in a segment that is being ignored; Conditional Operators
+ *                  within the text body of any of these are always consumed
+ *                  and never unintentionally processed.  Macros are always
+ *                  processed; Conditional Operators inside a Macro body are
+ *                  recognized, so the Macro continues to function as intended.
+ *
+ **************************************************************************** */
+
+static void conditionally_tokenize( bool cond, bool alr_ign )
+{
+    
+    signed long wlen;
+
+    /*  Note:  The following variables *must* remain within
+     *      the scope of this routine; a distinct instance
+     *      is needed each time this routine is re-entered
+     *     (aka "a nested call").
+     */
+    bool ignoring;
+    bool first_else = TRUE;  /*  The "else" we see is the first.  */
+    bool not_done = TRUE;
+    unsigned int cond_strt_lineno = lineno;
+    char *cond_strt_ifile_nam = strdup( iname);
+
+    ignoring = BOOLVAL( ( cond == FALSE ) || ( alr_ign != FALSE ) );
+
+    if ( trace_conditionals )
+    {
+        char *cond_val = cond ? "True" : "False" ;
+	char *cond_junct = alr_ign ? ", but Already " : "; ";
+	char *processg = ignoring ? "Ignoring" : "Processing" ;
+	tokenization_error( INFO,
+	    "Tokenization-Condition is %s%s%s.\n",
+		cond_val, cond_junct, processg);
+    }
+
+    while ( not_done )
+    {
+        wlen = get_word();
+	if ( wlen == 0 )
+	{
+	    continue;
+	}
+
+	if ( wlen < 0 )
+	{
+	    tokenization_error( TKERROR,
+	        "Conditional without conclusion; started");
+	    just_where_started( cond_strt_ifile_nam, cond_strt_lineno);
+	    not_done = FALSE ;
+	    continue;
+	}
+
+	if ( is_a_then ( statbuf ) )
+	{
+	    if ( trace_conditionals )
+	    {
+		tokenization_error( INFO,
+		    "Concluding Conditional");
+		just_started_at( cond_strt_ifile_nam, cond_strt_lineno);
+	    }
+	    not_done = FALSE ;
+	    continue;
+	}
+
+	if ( is_an_else( statbuf ) )
+	{
+	    if ( ! alr_ign )
+	    {
+		if ( first_else )
+		{
+		    ignoring = INVERSE( ignoring);
+		}
+	    }
+
+	    if ( ! first_else )
+	    {
+		int severity = ignoring ? WARNING : TKERROR ;
+		char *the_scop = ignoring ? "(ignored)" : "the" ;
+		tokenization_error( severity, "Multiple %s directives "
+		    "within %s scope of the Conditional",
+			 strupr(statbuf), the_scop);
+		just_started_at( cond_strt_ifile_nam, cond_strt_lineno);
+	    }else{
+		first_else = FALSE;
+		if ( trace_conditionals )
+		{
+		    char *when_enc = alr_ign ? "While already" : "Now" ;
+		    char *processg = alr_ign ? "ignoring" :
+				    ignoring ? "Ignoring" : "Processing" ;
+		    char *enc       = alr_ign ? ", e" : ".  E" ;
+
+		    tokenization_error( INFO,
+			"%s %s%sncountered %s belonging to Conditional",
+			    when_enc, processg, enc, strupr(statbuf) );
+		    just_started_at( cond_strt_ifile_nam, cond_strt_lineno);
+		}
+	    }
+
+	    continue;
+	}
+
+	/*  If we are ignoring source input, for whatever reason, we still
+	 *      need to be sensitive to the nesting of Conditional Operators
+	 *      and some other commands and directives, as indicated...
+	 */
+	if ( ignoring )
+	{
+	    ignore_one_word( statbuf );
+	}else{
+	    /*  And if we're not ignoring source input, process it! */
+	    tokenize_one_word ( wlen );
+	}
+    }
+}
+
+/* **************************************************************************
+ *
+ *      We will now define a series of fairly simple functions that
+ *          will be performed by the various Conditional Operators in
+ *          the "Conditionals Vocabulary".
+ *
+ *      Each one takes, as an argument, the "parameter field" pointer,
+ *          which, in all cases, points to the local  already_ignoring 
+ *          flag, passed as an int to satisfy C's strong-typing.  The
+ *          routine will internally recast it as a  bool .
+ *
+ *      If it is TRUE, the routine will bypass the test for its particular
+ *          type of condition, and go directly to  conditionally_tokenize
+ *          In most cases, testing for the condition would be harmless,
+ *          but in the case where the test is for an item on the stack,
+ *          it would be harmful because the sequence that put the item
+ *          on the stack was also being ignored...
+ *
+ *      We'll give these functions short prologs.  Synonyms will simply
+ *          have separate entries in the Vocabulary Table, associated
+ *          with the same function.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      But first, a support routine...
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Function name:  conditional_word_in_line
+ *      Synopsis:       Common code for the types of conditionals that
+ *                          require a word on the same line.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             alr_ign         TRUE if we are already ignoring
+ *             exist_test      TRUE if the test is for "existence" of the word
+ *             exist_funct     Name of the function to call for the test
+ *         Global Variables:
+ *             stat_word       Word for which to test
+ *
+ *      Outputs:
+ *         Returned Value:     NONE
+ *
+ *      Error Detection:
+ *          The word in question must appear on the same line as the directive;
+ *              the call to  get_word_in_line()  checks for that and reports.
+ *          If the word did not appear on the same line, then the directive
+ *              will be disregarded and processing will proceed as though it
+ *              were absent.  This may lead to a cascade of errors...
+ *
+ *      Process Explanation:
+ *          The supplied  exist_funct()  will test for the existence of
+ *              the word, now read into  statbuf , in the appropriate 
+ *              venue.
+ *          We only call the  exist_funct()  if we are not already ignoring.
+ *
+ **************************************************************************** */
+
+static void conditional_word_in_line( bool alr_ign,
+                                          bool exist_test,
+                                              bool (*exist_funct)() )
+{
+    if ( get_word_in_line( statbuf) )
+    {
+    	bool cond = FALSE;
+	if ( INVERSE( alr_ign) )
+	{
+	    bool exists = exist_funct( statbuf);
+	    cond = BOOLVAL( exists == exist_test);
+	}
+	conditionally_tokenize( cond, alr_ign );
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  if_exists
+ *      Synopsis:       Test for existence of a given word, in the dictionary.
+ *
+ *      Associated Tokenizer directives:        [ifexist]
+ *                                              #ifexist
+ *                                              [#ifexist]
+ *                                              [ifexists]
+ *                                              #ifexists
+ *                                              [#ifexists]
+ *        (Note variants with and without final 's'
+ *
+ **************************************************************************** */
+
+static void if_exists( tic_param_t pfield )
+{
+    bool alr_ign = *pfield.bool_ptr;
+    conditional_word_in_line( alr_ign, TRUE, exists_in_current );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  if_not_exist
+ *      Synopsis:       Test for Non-existence, in the appropriate dictionary,)
+ *                          of the given word.
+ *
+ *      Associated Tokenizer directives:        [ifnexist]
+ *                                              #ifnexist
+ *                                              [#ifnexist]
+ *        (Note:  Variants with final 's' didn't make sense here.)
+ *
+ *      Explanatory Notes:
+ *          This is the exact inverse of  if_exists
+ *
+ **************************************************************************** */
+
+static void if_not_exist( tic_bool_param_t pfield )
+{
+    bool alr_ign = *pfield.bool_ptr;
+    conditional_word_in_line( alr_ign, FALSE, exists_in_current );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  if_defined
+ *      Synopsis:       Test for existence of a user-defined symbol
+ *
+ *      Associated Tokenizer directives:        [ifdef]
+ *                                              #ifdef
+ *                                              [#ifdef]
+ *
+ **************************************************************************** */
+
+static void if_defined( tic_bool_param_t pfield )
+{
+    bool alr_ign = *pfield.bool_ptr;
+    conditional_word_in_line( alr_ign, TRUE, exists_as_user_symbol );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  if_not_defined
+ *      Synopsis:       Test for NON-existence of a user-defined symbol
+ *
+ *      Associated Tokenizer directives:        [ifndef]
+ *                                              #ifndef
+ *                                              [#ifndef]
+ *
+ **************************************************************************** */
+
+static void if_not_defined( tic_bool_param_t pfield )
+{
+    bool alr_ign = *pfield.bool_ptr;
+    conditional_word_in_line( alr_ign, FALSE, exists_as_user_symbol );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  if_from_stack
+ *      Synopsis:       Test the number on top of the run-time stack
+ *
+ *      Associated Tokenizer directive:         [if]
+ *
+ *      Process Explanation:
+ *          When we are ignoring source input, and we still need to be
+ *              sensitive to the nesting of Conditional Operators, we
+ *              will not consume the number on the stack; this function
+ *              is after all, being ignored and should not perform any
+ *              action other than making sure the [else]s and [then]s
+ *              get properly counted.
+ *
+ **************************************************************************** */
+
+static void if_from_stack( tic_bool_param_t pfield )
+{
+    bool alr_ign = *pfield.bool_ptr;
+    bool cond = FALSE;
+
+    if ( ! alr_ign )
+    {
+        long num = dpop();
+	if (num != 0)
+	{
+	    cond = TRUE;
+	}
+    }
+    conditionally_tokenize( cond, alr_ign );
+}
+
+/*  For future functions, use  conditl.BlankTemplate.c  */
+
+/* **************************************************************************
+ *
+ *      Here, at long last, we define and initialize the structure containing
+ *          all the functions we support for Conditional Operators.
+ *
+ **************************************************************************** */
+
+#define ADD_CONDL(str, func )   BUILTIN_BOOL_TIC(str, func, already_ignoring )
+
+static tic_bool_hdr_t conditionals_vocab_tbl[] = {
+    ADD_CONDL ("[ifexist]"   , if_exists      ) ,
+    ADD_CONDL ("[ifexists]"  , if_exists      ) ,
+    ADD_CONDL ("#ifexist"    , if_exists      ) ,
+    ADD_CONDL ("#ifexists"   , if_exists      ) ,
+    ADD_CONDL ("[#ifexist]"  , if_exists      ) ,
+    ADD_CONDL ("[#ifexists]" , if_exists      ) ,
+    ADD_CONDL ("[ifnexist]"  , if_not_exist   ) ,
+    ADD_CONDL ("#ifnexist"   , if_not_exist   ) ,
+    ADD_CONDL ("[#ifnexist]" , if_not_exist   ) ,
+    ADD_CONDL ("[ifdef]"     , if_defined     ) ,
+    ADD_CONDL ("#ifdef"      , if_defined     ) ,
+    ADD_CONDL ("[#ifdef]"    , if_defined     ) ,
+    ADD_CONDL ("[ifndef]"    , if_not_defined ) ,
+    ADD_CONDL ("#ifndef"     , if_not_defined ) ,
+    ADD_CONDL ("[#ifndef]"   , if_not_defined ) ,
+    ADD_CONDL ("[if]"        , if_from_stack  )
+};
+
+
+/* **************************************************************************
+ *
+ *      Function name:  init_conditionals_vocab
+ *      Synopsis:       Initialize the "Conditionals Vocabulary Table"
+ *                          link-pointers dynamically, and link it in
+ *                          with the given ("Global") Vocabulary pointer.
+ *
+ **************************************************************************** */
+
+void init_conditionals_vocab( tic_hdr_t **tic_vocab_ptr )
+{
+    static const int conditionals_vocab_max_indx =
+	 sizeof(conditionals_vocab_tbl)/sizeof(tic_bool_hdr_t);
+
+    init_tic_vocab( (tic_hdr_t *)conditionals_vocab_tbl,
+                        conditionals_vocab_max_indx,
+                            tic_vocab_ptr );
+}
+
diff --git a/toke/conditl.h b/toke/conditl.h
new file mode 100644
index 0000000..cfb1db5
--- /dev/null
+++ b/toke/conditl.h
@@ -0,0 +1,46 @@
+#ifndef _TOKE_CONDITL_H
+#define _TOKE_CONDITL_H
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Function Prototypes for Conditional-Compilation support for Tokenizer
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+#include "types.h"
+#include "ticvocab.h"
+
+void init_conditionals_vocab( tic_hdr_t **tic_vocab_ptr );
+
+void skip_a_word( tic_bool_param_t pfield );
+void skip_a_word_in_line( tic_bool_param_t pfield );
+void skip_two_words_in_line( tic_bool_param_t pfield );
+
+#endif   /* _TOKE_CONDITL_H    */
diff --git a/toke/devnode.c b/toke/devnode.c
new file mode 100644
index 0000000..54ec03f
--- /dev/null
+++ b/toke/devnode.c
@@ -0,0 +1,595 @@
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Support routines for managing device-node vocabularies
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      The vocabulary that is created for a device-node must not remain
+ *          available outside of that node.  Also, nodes may be nested,
+ *          child within parent.
+ *      An attempt within a child-node to access directly a method defined
+ *          in the parent must be flagged as an error.  (Consider what would
+ *          happen if the method in the parent-node used instance data, and
+ *          the child-node has an instance of its own.)
+ *      The correct way is to invoke the method via "$call-parent" or the like.
+ *
+ *      We will, however, allow the user to specify a group of exceptions,
+ *          words whose scope will be "global" within the tokenization.
+ *          When "global" scope is initiated, definitions will be made to
+ *          the "core" vocabulary until "device" scope is resumed.
+ *          That will (mostly) all be handled in  dictionary.c 
+ *
+ **************************************************************************** */
+
+
+/* **************************************************************************
+ *
+ *      Functions Exported:
+ *          new_device_vocab        Create the new device-node's data-structure
+ *          delete_device_vocab     Remove device-node's data-structure
+ *          finish_device_vocab     Remove struct and give messages when
+ *                                      device is "finish"ed.
+ *          exists_in_ancestor      Issue a Message if the given word exists
+ *                                      in an ancestor of the current dev-node.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Still to be done:
+ *          Add a pair of fields to the data-structure for the Input File and
+ *              Line Number where "finish-device" occurred.  When a device-node
+ *              is "finish"ed, do not delete it, but instead fill in those
+ *              fields and the move the node to a separate linked-list.
+ *          When looking whether a word exists in an ancestor-node, also
+ *              check whether it was in a device-node that was finished and
+ *              print both where it was started and where it was finished.
+ *
+ **************************************************************************** */
+
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include "devnode.h"
+#include "errhandler.h"
+#include "scanner.h"
+#include "vocabfuncts.h"
+#include "flowcontrol.h"
+#include "stream.h"
+#include "ticvocab.h"
+
+
+/* **************************************************************************
+ *
+ *      Tokenization starts with an implicit "new-device" in effect.
+ *          The top-level device-node is never removed.
+ *
+ *      Initialize it here
+ *
+ **************************************************************************** */
+char default_top_dev_ifile_name[] = "Start of tokenization";
+
+static device_node_t top_level_dev_node = {
+     	NULL ,                          /*  parent_node    */
+	default_top_dev_ifile_name ,	/*  ifile_name.
+					 *     Something to show, Just In Case
+					 */
+	0 ,                             /*  line_no        */
+	NULL ,                          /*  tokens_vocab   */
+};
+
+/* **************************************************************************
+ *
+ *          Global Variables Exported.
+ *                                  Pointers to:
+ *     current_device_node      data-structure of current device-node
+ *     current_definitions      vocab into which to add def'ns.
+ *
+ **************************************************************************** */
+
+device_node_t *current_device_node = &top_level_dev_node;
+tic_hdr_t **current_definitions = &(top_level_dev_node.tokens_vocab);
+
+
+/* **************************************************************************
+ *
+ *          Internal Static Variables
+ *               These are used to support the routines  in_what_node() 
+ *                   and  show_node_start() , which are used to facilitate
+ *                   certain kinds of Messaging, as described later.
+ *
+ *     in_what_buffr       Buffer for the  in_what_node()  string
+ *     show_where          TRUE if the string needs to be followed-up
+ *     show_which          TRUE if follow-up should be  just_where_started()
+ *                             rather than  just_started_at()
+ *     in_what_line        Line Number to use in the follow-up
+ *     in_what_file        File Name to use in the follow-up
+ *
+ **************************************************************************** */
+
+static char in_what_buffr[50];   /*  Ought to be more than enough.  */
+static bool show_where = FALSE;
+static bool show_which;
+static int in_what_line;
+static char *in_what_file;
+
+
+/* **************************************************************************
+ *
+ *      Function name:  dev_vocab_control_struct_check
+ *      Synopsis:       Issue Warnings for unresolved flow-control constructs
+ *                          at start or end of a device-node.
+ *
+ *      Inputs:
+ *         Parameters:                     NONE
+ *         Global Variables:
+ *             statbuf                     The command being processed.
+ *
+ *      Outputs:
+ *         Returned Value:                 NONE
+ *         Printout:
+ *             Handled by  announce_control_structs() routine
+ *
+ *      Error Detection:
+ *          Handled by  announce_control_structs()  routine
+ *
+ *      Process Explanation:
+ *          Set up a buffer with the error message, based on  statbuf
+ *              and pass it to  announce_control_structs()
+ *          Release it when done.
+ *
+ **************************************************************************** */
+
+static void dev_vocab_control_struct_check( void)
+{
+    char *ccs_messg;
+
+    ccs_messg = safe_malloc(strlen(statbuf) + 32,
+        "Device-Node control-structure check");
+    
+    strcpy( ccs_messg, statbuf );
+    strupr( ccs_messg);
+    strcat( ccs_messg, " encountered");
+    announce_control_structs( WARNING, ccs_messg, 0 );
+    free( ccs_messg);
+}
+
+
+
+/* **************************************************************************
+ *
+ *      Function name:  new_device_vocab
+ *      Synopsis:       Create and initialize the data-structure for a
+ *                      new device-node when a "new-device" is created,
+ *                      with messages as appropriate.
+ *
+ *      Inputs:
+ *         Parameters:                     NONE
+ *         Global Variables:
+ *             statbuf                     The word that was just read.
+ *             iname                       Current Input-File Name
+ *             lineno                      Current line-number
+ *
+ *      Outputs:
+ *         Returned Value:                 NONE
+ *         Global Variables:
+ *             current_device_node         Will point to the new data-structure
+ *         Memory Allocated
+ *             Space for the new  device_node_t  data-structure
+ *             Space for a copy of the current input file name
+ *         When Freed?
+ *             By delete_device_vocab(), when the device-node is "finish"ed.
+ *         Printout:
+ *             Advisory message.
+ *
+ *      Error Detection:
+ *          In immediate-execution mode, Control Structures that have not
+ *              been completed are questionable;  Issue WARNINGS via the
+ *               dev_vocab_control_struct_check()  routine.
+ *
+ *      Process Explanation:
+ *          This routine is called when "new-device" is invoked, but only
+ *              if we are in immediate-execution mode.
+ *          Later on, in ERROR- or INFOrmative messages, we will want to
+ *              be able to refer to the file and line-number in which this
+ *              was encountered, so we include them in the structure.
+ *
+ **************************************************************************** */
+
+void new_device_vocab( void )
+{
+    device_node_t *new_node_data;
+
+    dev_vocab_control_struct_check();
+
+    /*  Advisory message will mention previous device-node
+     *      if there was one.  Either way starts out the same:
+     */
+#define NEW_DEV_MSG_START  "Encountered %s.  Starting new device-node."
+
+    if ( current_device_node == &top_level_dev_node )
+    {
+	tokenization_error(INFO, NEW_DEV_MSG_START "\n", statbuf );
+    }else{
+	tokenization_error(INFO, NEW_DEV_MSG_START
+	    "  Suspending definitions of parent-device node", statbuf );
+	started_at( current_device_node->ifile_name,
+	     current_device_node->line_no );
+    }
+
+    /*  Now to business...   */
+    new_node_data = safe_malloc( sizeof(device_node_t),
+        "creating new-device vocab data" );
+    new_node_data->parent_node = current_device_node;
+    new_node_data->ifile_name = strdup(iname);
+    new_node_data->line_no = lineno;
+    new_node_data->tokens_vocab = NULL;
+
+    current_device_node = new_node_data;
+    
+    current_definitions = &(current_device_node->tokens_vocab);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  delete_device_vocab
+ *      Synopsis:       Remove the vocabularies of the current device-node,
+ *                          along with its data-structure, when the device
+ *                          is "finish"ed; do not print messages.
+ *                      Do not remove the top-level device-node data-struct.
+ *
+ *      Associated FORTH words:              FINISH_DEVICE  (interpretive state)
+ *                                           END0  END1
+ *      Associated Tokenizer directives:     RESET-SYMBOLS  (in "Normal" mode)
+ *                                           FCODE-END
+ *
+ *      Inputs:
+ *         Parameters:                    NONE
+ *         Global Variables:
+ *             current_device_node        Points to current device's struct
+ *                                            Leads to chain of dev-node structs
+ *
+ *      Outputs:
+ *         Returned Value: 
+ *         Global Variables:
+ *             current_device_node        Parent-device's struct becomes current
+ *         Memory Freed
+ *             All that was allocated for the tokens and the definers
+ *                 vocabs in the current device-node
+ *             The copy of the input file name, except the top-level
+ *             The current_device_node data-structure, except the top-level
+ *
+ **************************************************************************** */
+
+void delete_device_vocab( void )
+{
+    reset_tic_vocab( current_definitions, NULL );
+
+    if ( current_device_node != &top_level_dev_node )
+    {
+	device_node_t *temp_node = current_device_node;
+	current_device_node = current_device_node->parent_node;
+	free( temp_node->ifile_name );
+	free(temp_node);
+    }
+
+    current_definitions = &(current_device_node->tokens_vocab);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  finish_device_vocab
+ *      Synopsis:       Remove the device-node data-structure and all its
+ *                          vocabularies when the device is "finish"ed,
+ *                          with appropriate messages.
+ *                      Do not remove the top-level device node data-struct.
+ *
+ *      Associated FORTH word:                 FINISH_DEVICE
+ *
+ *      Inputs:
+ *         Parameters:                    NONE
+ *         Global Variables:
+ *             current_device_node        Current device's struct pointer
+ *
+ *      Outputs:
+ *         Returned Value:                NONE
+ *         Global Variables:
+ *             current_device_node        Parent-device's struct becomes current
+ *         Printout:
+ *             Advisory message.
+ *
+ *      Error Detection:
+ *          If current_device_node is already pointing at the top-level
+ *              device node, it means there was no corresponding NEW-DEVICE
+ *              Issue an ERROR.
+ *          In immediate-execution mode, Control Structures that have not
+ *              been completed are questionable;  Issue WARNINGS via the
+ *               dev_vocab_control_struct_check()  routine.
+ *
+ *      Process Explanation:
+ *          This routine is called when "finish-device" is invoked, but only
+ *              if we are in immediate-execution mode.
+ *
+ **************************************************************************** */
+
+void finish_device_vocab( void )
+{
+    bool at_top_level;
+
+    dev_vocab_control_struct_check();
+
+    /*   We never remove the top-level device-node vocabulary,
+     *       so we need to test whether we're about to.
+     */
+
+    at_top_level = BOOLVAL( current_device_node == &top_level_dev_node );
+    if ( at_top_level )
+    {
+        tokenization_error( TKERROR,
+	    "Encountered %s without corresponding NEW-DEVICE.  "
+	    "Resetting definitions since start of tokenization.\n",
+		statbuf );
+    }else{    
+	tokenization_error(INFO,
+	    "Encountered %s.  Resetting definitions of device node",
+		statbuf );
+	started_at( current_device_node->ifile_name,
+	     current_device_node->line_no );
+    }
+
+    /*  Now to business...   */
+    delete_device_vocab();
+
+    /*   Did we just get to the top-level device-node vocabulary
+     *       when we weren't before?
+     */
+    if ( INVERSE(at_top_level) )
+    {
+	if ( current_device_node == &top_level_dev_node )
+	{
+	    tokenization_error(INFO,
+		"Resuming definitions since start of tokenization.\n" );
+	}else{
+	    tokenization_error(INFO,
+		"Resuming definitions of parent device-node" );
+	    started_at( current_device_node->ifile_name,
+		 current_device_node->line_no );
+	}
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  in_what_node
+ *      Synopsis:       Format a string for use in a Message that might
+ *                          identify the start of the given device-node.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             the_node               The device-node vocabulary about which
+ *                                        to construct the identifying phrase.
+ *         Local Static Variables:
+ *             in_what_buffr          Buffer in which to format the string.
+ *         Global Variables:
+ *             current_definitions    Device-node vocabulary currently
+ *                                        in effect.
+ *
+ *      Outputs:
+ *         Returned Value:           Pointer to buffer w/ formatted string
+ *         Local Static Variables:
+ *             in_what_buffr         Will contain the formatted string.
+ *             show_where            TRUE if the string needs to be followed-up
+ *                                        (i.e., did not contain a terminating
+ *                                        new-line) by  just_where_started()
+ *                                        or by  just_started_at()
+ *             show_which            TRUE if the follow-up call should be
+ *                                       to  just_where_started()  rather 
+ *                                       than to  just_started_at() 
+ *             in_what_line          Copy of line_no field from the_node
+ *             in_what_file          Copy of ifile_name field from the_node
+ *
+ *      Process Explanation:
+ *          Calling routine must ascertain that Global-scope is not in effect.
+ *          The returned phrase can be used as a string argument in a Message.
+ *          Set  show_where  TRUE if the_node->line_no is non-zero.
+ *          Set  show_which  TRUE if the_node is either the Current or the
+ *              Top-Level device-node
+ *          If the originating line-number in the given Node structure is zero,
+ *              the returned phrase will contain a terminating new-line.
+ *              (This only happens if the given Node is the top-level Node,
+ *              and it's the Current Node, and the "official" starting-point
+ *              hasn't yet been established by an "FCode-Starter" such as 
+ *               FCODE-VERSION2 .  Once that command has been given, even
+ *              definitions that were made prior to it belong to the Node
+ *              that started there.)
+ *          Otherwise,  show_where  is returned TRUE, and  show_which  becomes
+ *              relevant.  If the given node is the Current or the Top-Level
+ *              node, text about the originating file-name and line-number
+ *              merely describes a node that is already uniquely identified,
+ *              so the message appended to the buffer will have the phrase
+ *              "which began" (which introduces what is known in grammar as
+ *              an Appositive Subordinate Clause) and  show_which  will be
+ *              returned TRUE.  If the given node is not uniquely identifiable
+ *              without the file- and line- phrase, then the Subordinate Clause
+ *              is Indicative, and should be introduced with "that" (and no
+ *              comma); in that case, we will return  show_which  as FALSE.
+ *          After the calling routine displays the message in which the
+ *              returned phrase is used, it must call  show_node_start()
+ *              to display the followe-up message, if any.
+ *
+ **************************************************************************** */
+
+char *in_what_node(device_node_t *the_node)
+{
+    bool top_node    = BOOLVAL( the_node == &top_level_dev_node);
+    bool curr_node   = BOOLVAL( the_node == current_device_node);
+    bool known_node  = BOOLVAL( top_node || curr_node );
+    bool no_line     = BOOLVAL( the_node->line_no == 0);
+
+    show_where   = INVERSE( no_line  );
+    show_which   = known_node;
+    in_what_line = the_node->line_no;
+    in_what_file = the_node->ifile_name;
+
+    sprintf( in_what_buffr, "in the%s device-node%s",
+	INVERSE( known_node )  ? ""
+	        :  top_node    ?    " top-level"   :  " current" ,
+	
+	no_line                ?  ".\n"
+	        :  known_node  ?  ", which began"  :   ""         );
+
+    
+    return( in_what_buffr);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  show_node_start
+ *      Synopsis:       Follow-up to the  in_what_node()  call.  Print out,
+ *                          if applicable, the text about the originating
+ *                          file-name and line-number
+ *
+ *      Inputs:
+ *         Parameters:             NONE
+ *         Local Static Variables:
+ *             show_where          Nothing to do if not TRUE
+ *             show_which          TRUE if should call  just_where_started()
+ *                                     rather than  just_started_at()
+ *             in_what_line        Line Number to use in the follow-up
+ *             in_what_file        File Name to use in the follow-up
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Local Static Variables:
+ *             show_where          Force to FALSE
+ *         Printout:
+ *             Follow-up to  the in_what_node() call.  Applicable text
+ *                 about the originating file-name and line-number.
+ *
+ *      Process Explanation:
+ *          By forcing  show_where  to FALSE after this is called, we
+ *              can safely allow routines that might or might not have
+ *              called  in_what_node()  to call this routine, without
+ *              needing any additional "bookkeeping".
+ *
+ **************************************************************************** */
+
+void show_node_start( void)
+{
+    if ( show_where)
+    {
+	if ( show_which )
+	{
+	    just_where_started( in_what_file, in_what_line);
+	}else{
+	    just_started_at( in_what_file, in_what_line);
+	}
+	show_where = FALSE;
+    }
+}
+
+
+
+/* **************************************************************************
+ *
+ *      Function name:  exists_in_ancestor
+ *      Synopsis:       Issue a Message and return an indication if
+ *                          the given word exists in an ancestor of
+ *                          the current device-node.
+ *                      Used for additional error-message information.
+ *                      
+ *
+ *      Inputs:
+ *         Parameters:
+ *             m_name                   "Method" name
+ *         Global Variables:
+ *             current_device_node      Leads to chain of dev-node data-structs
+ *             scope_is_global          TRUE if "global" scope is in effect
+ *
+ *      Outputs:
+ *         Returned Value:              TRUE if word found
+ *         Printout:
+ *             If  m_name  exists in an ancestor-node, print an ADVISORY
+ *                 giving the location where the ancestor originated.
+ *
+ *      Error Detection:
+ *          None here.  Calling routine detected error; see below.
+ *
+ *      Process Explanation:
+ *          This routine was called as the result of detecting an error:
+ *              viz.,  m_name  was not found in either the current node
+ *              or the base vocabulary.  (Except:  If "global" scope is
+ *              in effect, we didn't search the current device-node).
+ *
+ **************************************************************************** */
+
+bool exists_in_ancestor( char *m_name)
+{
+    tic_hdr_t *found;
+    bool retval = FALSE;
+    if ( current_device_node != NULL )
+    {
+	device_node_t *grandpa = current_device_node->parent_node;
+
+	if ( scope_is_global )    grandpa = current_device_node;
+
+	for ( ; grandpa != NULL; grandpa = grandpa->parent_node )
+	{
+	    found = lookup_tic_entry( m_name, grandpa->tokens_vocab);
+	    if ( found != NULL )
+	    {
+		retval = TRUE;
+		break;
+	    }
+	}
+	if ( grandpa != NULL )
+	{
+	    char as_what_buf[32] = "";
+	    if ( as_a_what( found->fword_defr, as_what_buf) )
+	    {
+		strcat( as_what_buf, " ");
+	    }
+	    tokenization_error(INFO, "%s is defined %s%s", m_name,
+		as_what_buf, in_what_node( grandpa) );
+	    show_node_start();
+	}
+    }
+
+    return(retval );
+}
diff --git a/toke/devnode.h b/toke/devnode.h
new file mode 100644
index 0000000..0a11035
--- /dev/null
+++ b/toke/devnode.h
@@ -0,0 +1,86 @@
+#ifndef _TOKE_DEVNODE_H
+#define _TOKE_DEVNODE_H
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      External/Prototype/Structure definitions for device-node management
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "types.h"
+#include "ticvocab.h"
+
+/* **************************************************************************
+ *          Structure Name:    device_node_t
+ *                        Data for managing a device node; pointers
+ *                            to vocabs, data for messaging.
+ *                            
+ *   Fields:
+ *       parent_node         Pointer to similar data for parent node 
+ *       line_no             Copy of Line Number where "new-device" was invoked
+ *       ifile_name          Name of Input File where "new-device" was invoked
+ *       tokens_vocab        Pointer to vocab for this device's tokens
+ *
+ **************************************************************************** */
+
+typedef struct device_node {
+        struct device_node *parent_node ;
+	char *ifile_name ;
+	unsigned int line_no ;
+	tic_hdr_t *tokens_vocab ;
+} device_node_t;
+
+
+/* ************************************************************************** *
+ *
+ *      Global Variables Exported
+ *
+ **************************************************************************** */
+
+extern char default_top_dev_ifile_name[];
+extern device_node_t *current_device_node;
+extern tic_hdr_t **current_definitions;
+
+/* ************************************************************************** *
+ *
+ *      Function Prototypes / Functions Exported:
+ *
+ **************************************************************************** */
+void new_device_vocab( void );
+void delete_device_vocab( void );
+void finish_device_vocab( void );
+char *in_what_node(device_node_t *the_node);
+void show_node_start( void);
+bool exists_in_ancestor( char *m_name);
+
+#endif   /*  _TOKE_DEVNODE_H    */
diff --git a/toke/dictionary.c b/toke/dictionary.c
index 112c3c2..a662a4d 100644
--- a/toke/dictionary.c
+++ b/toke/dictionary.c
@@ -24,6 +24,12 @@
  *
  */
 
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+
 #include <stdio.h>
 #include <stdlib.h>
 #if defined(__linux__) && ! defined(__USE_BSD)
@@ -32,543 +38,2008 @@
 #include <string.h>
 #include <errno.h>
 
-#include "toke.h"
+#include "emit.h"
+#include "macros.h"
+#include "scanner.h"
+#include "ticvocab.h"
 #include "dictionary.h"
+#include "vocabfuncts.h"
+#include "devnode.h"
+#include "clflags.h"
+#include "parselocals.h"
+#include "errhandler.h"
+#include "tokzesc.h"
+#include "conditl.h"
+
+/* **************************************************************************
+ *
+ *      Revision History:
+ *          Updated Fri, 29 Jul 2005 by David L. Paktor
+ *          Retrofit to handle "Current Device" as a separate vocabulary;
+ *              if one is in effect, searches through it occur first, as
+ *              do definitions to it, ahead of the general vocabulary.  This
+ *              is to support managing device-node vocabularies correctly.
+ *          Updated Mon, 12 Dec 2005 by David L. Paktor
+ *          Allow the user to specify a group of exceptions, words whose
+ *              scope will be "global" within the tokenization.  Under "global"
+ *              scope, definitions will be made to the "core" vocabulary.
+ *
+ *          Wed, 14 Dec 2005 by David L. Paktor
+ *          Found a problem with the current approach.  Need to be able to
+ *              temporarily suspend meaning of "instance".  Define:  (1) an
+ *              alias for  INSTANCE  called  GENERIC_INSTANCE  (2) a macro
+ *              called  INSTANCE  that effectively no-ops it out; and, when
+ *              it is time to restore "INSTANCE" to normal functionality,
+ *              (3) an alias for  GENERIC_INSTANCE  called  INSTANCE .
+ *          Problem is that macros are treated as a separate vocabulary
+ *              from FWords (and their aliases) and searching one before the
+ *              other (either way) renders the second one searched unable to
+ *              supercede the first one:  If macros are searched first, (2)
+ *              will be found ahead of the built-in FWord (which is what we
+ *              want) but later, when we search for (3) among the FWords, it
+ *              will not be found ahead of (2).  If, on the other hand, we
+ *              search FWords first, the macro defined in (2) will never be
+ *              found.
+ *          We need a way to define both (all?) types of definitions in a
+ *              single vocabulary that will honor the LIFO order of def'ns.
+ *
+ *          Mon, 19 Dec 2005 by David L. Paktor
+ *          Begin development of implementation of a way to define both (all?)
+ *              types of definitions in a single  tic_hdr_t  type vocabulary.
+ *
+ **************************************************************************** */
+
+
+
+/* **************************************************************************
+ *
+ *      We will be creating several different lists of initial built-in
+ *          definitions; together, they constitute the Global Vocabulary.
+ *          (We will avoid the term "dictionary", since, in classical
+ *          Forth terminology, it refers to the complete collection of
+ *          vocabularies in an application.)  The usage of the pointer
+ *          to the Global Vocabulary is central to the operation of this
+ *          program and the maintenance programmer needs to understand it.
+ *          We may also refer to the Global Vocabulary as the "core" vocab.
+ *
+ *      Each initial list will be created as an array of TIC-header entries.
+ *          Because the global vocabulary is expandable by the user,
+ *          we will not be searching the lists as arrays but rather as
+ *          linked-lists; the run-time initialization routine will fill
+ *          in their link-fields and also will link the various lists
+ *          together, so we can group their initial declarations according
+ *          to our convenience.
+ *
+ *      A single pointer, called the "Global Vocabulary Dictionary Pointer"
+ *          (okay, so classical Forth terminology isn't completely rigorous...)
+ *          and abbreviated GV_DP, will point to the "tail" of the "thread".
+ *          Similar vocabularies will be created for the device-nodes; look
+ *          in the file  devnode.fth  for a more detailed discussion of those.
+ *
+ *      The "FC-Tokens" list contains the names and FCode numeric tokens
+ *          of the straightforward FORTH words that simply write a token
+ *          directly to the tokenized output.  We need to access these
+ *          without being confused by aliases or other distractions, so
+ *          we will keep a pointer to them especially for that purpose.
+ *      Therefore it is IMPORTANT:  that the "FC-Tokens" list MUST be the
+ *          first table linked by the initialization routine, so that its
+ *          last-searched entry's link-field is NULL.
+ *
+ *      The "FWords" list contains FORTH words that require additional
+ *          special action at tokenization-time.  Their numeric values
+ *          are derived from the  fword_token  enumeration declaration,
+ *          and are used as the control-expression for a SWITCH statement
+ *          with a large number of CASE labels in the  handle_internal()
+ *          function.
+ *
+ *      The "Shared Words" list contains FORTH words that can be executed
+ *          similarly both during "Tokenizer Escape" mode (i.e., the scope
+ *          of the special brackets:  tokenizer[  ...   ]tokenizer ) and
+ *          also within "Normal Tokenization" mode.  Their numeric values
+ *          are derived and used the same way as the "FWords".  Since we
+ *          will be needing to do a separate search through them at times,
+ *          we will also need a lower-bracket pointer for them.  (An upper
+ *          bracket is irrelevant for these, because aliases can be added.
+ *          This is not the case for the "FC-Tokens" list, because searches
+ *          through those will be conducted from within this program.)
+ *
+ *      The "definer" field in the TIC-header structure is primarily used to
+ *          detect attempts to apply the  TO  directive to an inappropriate
+ *          target.  Its numeric values are a subset of the "FWord tokens".
+ *          Certain "FC-Token" names are specified to be valid  TO  targets;
+ *          their entries' "definer" fields will be initialized accordingly.
+ *          Entries in FWord Token lists that are "shared" between "Normal
+ *          Tokenization" and "Tokenizer Escape" modes will have their
+ *          "definer" fields initialized to  COMMON_FWORD .  All other
+ *          entries' "definer" fields will be initialized to  UNSPECIFIED .
+ *
+ *      Other files maintain and support additional lists with the same
+ *          structure, which need to be linked together with the lists
+ *          declared here.  We prefer to keep the  GV_DP  private to this
+ *          file, so it will be passed as a parameter where needed.  (I'm
+ *          not pleased to note, however, that it can't be kept completely
+ *          private; it's needed for add_user_macro() and possibly other
+ *          functions outside this file.)
+ *
+ *      The words that can only be used during "Tokenizer Escape" mode and
+ *          the IBM-style "Locals", as well as the device-node vocabularies,
+ *          will need to be separate and will not be linked together with
+ *          the Global Vocabulary.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      We'll be initializing the lists later, but will be referencing
+ *          the pointers sooner, so we need to declare the pointers here.
+ *
+ *      We will keep all of these pointers private to this file.
+ *
+ **************************************************************************** */
+
+static tic_hdr_t *global_voc_dict_ptr  = NULL;  /*  The Global Vocabulary    */
+static tic_hdr_t *fc_tokens_list_ender = NULL;  /*  Tokens search ends here  */
+static tic_hdr_t *fc_tokens_list_start = NULL;  /*  Start the search here    */
+static tic_hdr_t *shared_fwords_ender  = NULL;  /*  Shared FWords search end */
+static tic_hdr_t *global_voc_reset_ptr = NULL;  /*  Reset-point for G.V.     */
 
-typedef struct token {
-	u8  *name;
-	u16 fcode;
-	struct token *next;
-} token_t;
 
-static token_t *dictionary=NULL;
-static token_t *forthwords=NULL;
+/* **************************************************************************
+ *
+ *      Function name:  lookup_core_word
+ *      Synopsis:       Return a pointer to the data-structure of the named
+ *                      word in the "Global" Vocabulary
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                     The name to look up
+ *         Local Static Variables:
+ *             global_voc_dict_ptr       "Tail" of Global Vocabulary
+ *
+ *      Outputs:
+ *         Returned Value:                Pointer to the data-structure, or
+ *                                            NULL if not found.
+ *
+ **************************************************************************** */
 
-static u16 lookup_token_dict(char *name, token_t *dict)
+tic_hdr_t *lookup_core_word( char *tname)
 {
-	token_t *curr;
-	
-	for (curr=dict; curr!=NULL; curr=curr->next)
-		if (!strcasecmp(name,(char *)curr->name))
-			break;
+    tic_hdr_t *found ;
 
-	if (curr)
-		return curr->fcode;
-#ifdef DEBUG_TOKE
-	printf("warning: token '%s' does not exist.\n", name);
-#endif
-	return 0xffff;
+    found = lookup_tic_entry( tname, global_voc_dict_ptr);
+    return ( found ) ;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  exists_in_core
+ *      Synopsis:       Confirm whether the given name exists in the
+ *                      Global (aka "core") Vocabulary.  Search the
+ *                      Global Vocabulary exclusively.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             name                      The name for which to look
+ *         Local Static Variables:
+ *             global_voc_dict_ptr       "Tail" of Global Vocabulary
+ *
+ *      Outputs:
+ *         Returned Value:               TRUE if name is found.
+ *
+ **************************************************************************** */
+
+bool exists_in_core( char *name)
+{
+    return exists_in_tic_vocab( name, global_voc_dict_ptr );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  handle_core_word
+ *      Synopsis:       Perform a function in the "Global" Vocabulary and
+ *                      indicate whether the name is valid.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                     The name to handle
+ *         Local Static Variables:
+ *             global_voc_dict_ptr       "Tail" of Global Vocabulary
+ *
+ *      Outputs:
+ *         Returned Value:   TRUE if the given name is valid in Global Vocab
+ *
+ *      Error Detection:
+ *          If the name is not in the "Global" Vocabulary, let the calling
+ *              routine determine whether to print an error message or to
+ *              try it out as a number.
+ *
+ **************************************************************************** */
+
+bool handle_core_word( char *tname )
+{
+    bool retval;
+
+    retval = handle_tic_vocab( tname, global_voc_dict_ptr );
+
+    return ( retval ) ;
 }
 
-u16 lookup_token(char *name)
+
+/* **************************************************************************
+ *
+ *      Function name:  create_core_alias
+ *      Synopsis:       Create, in the "Global" ("core") Vocabulary, an entry
+ *                          for NEW_NAME that behaves the same as the latest
+ *                          definition of OLD_NAME, and whose behavior will
+ *                          not change even if a new definition of OLD_NAME
+ *                          is overlaid.  Indicate if successful.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             new_name          The name for the new alias to be created
+ *             old_name          The name of the old function to be duplicated
+ *         Local Static Variables:
+ *             global_voc_dict_ptr        "Tail" of Global Vocabulary
+ *
+ *      Outputs:
+ *         Returned Value:                TRUE if OLD_NAME was found.
+ *         Local Static Variables:
+ *             global_voc_dict_ptr        Updated with the new entry
+ *         Memory Allocated
+ *             By support routine.
+ *
+ *      Process Explanation:
+ *          Both the "old" and "new" names are presumed to already point to
+ *              stable, freshly allocated memory-spaces.
+ *
+ **************************************************************************** */
+
+bool create_core_alias( char *new_name, char *old_name)
+{
+    bool retval = create_tic_alias( new_name, old_name, &global_voc_dict_ptr);
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *      The functions that go into the various lists' FUNCT field may be
+ *           defined below, or might be defined externally.
+ *
+ *      Often, we will need a function that merely recasts the type of the
+ *           parameter field before passing it to the function that does
+ *           the actual work.
+ *
+ *      Prologs will be brief or even non-existent.
+ *
+ *      Initialization macro definitions will accompany the functions.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      For the "FCode-Tokens" list, simply generate the token directly.
+ *      We need this layer for param type conversion.
+ *      In case we're ever able to eliminate it, (or just on General
+ *          Principles) we'll invoke it via a macro...
+ *
+ **************************************************************************** */
+
+static void emit_fc_token( tic_param_t pfield)
+{
+    u16 fc_tok = (u16)pfield.deflt_elem;
+    emit_fcode( fc_tok);
+}
+
+#define FC_TOKEN_FUNC  emit_fc_token
+
+#define BUILTIN_FCODE( tok, nam)   \
+     VALPARAM_TIC(nam, FC_TOKEN_FUNC, tok , UNSPECIFIED )
+
+/*  Built-in FCodes with known definers:  */
+#define BI_FCODE_VALUE( tok, nam)   \
+     VALPARAM_TIC(nam, FC_TOKEN_FUNC, tok , VALUE )
+
+#define BI_FCODE_VRBLE( tok, nam)   \
+     VALPARAM_TIC(nam, FC_TOKEN_FUNC, tok , VARIABLE )
+
+#define BI_FCODE_DEFER( tok, nam)   \
+     VALPARAM_TIC(nam, FC_TOKEN_FUNC, tok , DEFER )
+
+#define BI_FCODE_CONST( tok, nam)   \
+     VALPARAM_TIC(nam, FC_TOKEN_FUNC, tok , CONST )
+
+/* **************************************************************************
+ *
+ *      The "FCode-Tokens" list includes tokens that are identified
+ *         in the Standard as Obsolete.  We will define a function
+ *         that issues a WARNING before generating the token, and
+ *         assign it to those elements of the list.
+ *
+ *      Control the message via a command-line flag.
+ *
+ **************************************************************************** */
+
+static void obsolete_warning( void)
+{
+    if ( obso_fcode_warning )
+    {
+	tokenization_error( WARNING, "%s is an Obsolete FCode.\n",
+	    strupr(statbuf) );
+    }
+}
+
+static void obsolete_fc_token( tic_param_t pfield)
+{
+    obsolete_warning();
+    emit_fc_token( pfield);
+}
+
+#define OBSO_FC_FUNC  obsolete_fc_token
+
+#define OBSOLETE_FCODE( tok, nam)   \
+     VALPARAM_TIC(nam, OBSO_FC_FUNC, tok , UNSPECIFIED )
+
+#define OBSOLETE_VALUE( tok, nam)   \
+     VALPARAM_TIC(nam, OBSO_FC_FUNC, tok , VALUE )
+
+
+/* **************************************************************************
+ *
+ *      The function for most of the "FWords" list,  handle_internal() ,
+ *          is defined externally, but not exported in a  .h  file,
+ *          because we want to keep it as private as possible.
+ *      We will declare its prototype here.
+ *
+ *      Initialization macros for both "Normal Mode"-only and
+ *          "Shared" entries are also defined here.
+ *
+ *   Arguments:
+ *       fwt      (fword_token)    Value of the FWord Token (from Enum list)
+ *       nam      (string)         Name of the entry as seen in the source
+ *
+ **************************************************************************** */
+
+void handle_internal( tic_param_t pfield);
+/*  "Skip-a-string when Ignoring" function.  Same args and limited-proto ...  */
+void skip_string( tic_param_t pfield);
+
+#define FWORD_EXEC_FUNC  handle_internal
+
+#define BUILTIN_FWORD( fwt, nam)   \
+     FWORD_TKN_TIC(nam, FWORD_EXEC_FUNC, fwt, BI_FWRD_DEFN )
+
+#define SHARED_FWORD( fwt, nam)   \
+     FWORD_TKN_TIC(nam, FWORD_EXEC_FUNC, fwt, COMMON_FWORD )
+
+/*  Variants:  When Ignoring, SKip One Word  */
+#define SHR_FWD_SKOW( fwt, nam)   \
+     DUALFUNC_FWT_TIC(nam, FWORD_EXEC_FUNC, fwt, skip_a_word, COMMON_FWORD )
+
+/*  Variants:  When Ignoring, SKip one Word in line  */
+#define SH_FW_SK_WIL( fwt, nam)   \
+     DUALFUNC_FWT_TIC(nam, FWORD_EXEC_FUNC, fwt,     \
+         skip_a_word_in_line, COMMON_FWORD )
+
+/*  When Ignoring, SKip Two Words in line  */
+#define SH_FW_SK2WIL( fwt, nam)   \
+     DUALFUNC_FWT_TIC(nam, FWORD_EXEC_FUNC, fwt,     \
+         skip_two_words_in_line, COMMON_FWORD )
+
+/* **************************************************************************
+ *
+ *      Some of the entries in the "FWords" list -- both "Normal" (Built-in)
+ *          and "Shared" also act as an "Ignore-handler".
+ *          
+ *   Arguments:
+ *       nam      (string)         Name of the entry as seen in the source
+ *       afunc    (routine-name)   Name of internal "active" function
+ *       pval     (integer)        The "param field" item
+ *       ifunc    (routine-name)   Name of "ignore-handling" function
+ *
+ **************************************************************************** */
+
+#define SHARED_IG_HDLR(nam, afunc, pval, ifunc)     \
+    DUFNC_FWT_PARM(nam, afunc, pval, ifunc, COMMON_FWORD )
+
+/*  A "Shared" entry that uses the same routine for both of its functions  */
+#define SHR_SAMIG_FWRD( fwt, nam)   \
+    DUFNC_FWT_PARM(nam, FWORD_EXEC_FUNC, fwt, FWORD_EXEC_FUNC, COMMON_FWORD )
+
+/* **************************************************************************
+ *
+ *     But the "Normal" (Built-in) FWord Ignore-handler uses the same
+ *          routine as the  BUILTIN_FWORD for both of its functions.
+ *
+ *   Arguments:
+ *       fwt      (fword_token)    Value of the FWord Token (from Enum list)
+ *       nam      (string)         Name of the entry as seen in the source
+ *
+ **************************************************************************** */
+#define BI_IG_FW_HDLR( fwt, nam)   \
+    DUALFUNC_FWT_TIC(nam, FWORD_EXEC_FUNC, fwt, FWORD_EXEC_FUNC, BI_FWRD_DEFN )
+
+/*  A variant:  A "Built-In FWorD that SKiPs One Word", when Ignoring  */
+#define BI_FWD_SKP_OW( fwt, nam)   \
+     DUALFUNC_FWT_TIC(nam, FWORD_EXEC_FUNC, fwt, skip_a_word, BI_FWRD_DEFN )
+
+/*  Another variant:  A "Built-In FWorD String".  skip_string when Ignoring  */
+#define BI_FWD_STRING( fwt, nam)   \
+     DUALFUNC_FWT_TIC(nam, FWORD_EXEC_FUNC, fwt, skip_string, BI_FWRD_DEFN )
+
+/* **************************************************************************
+ *
+ *      In order to protect device-nodes' methods from being accessed 
+ *          by other device-nodes (with the attendant potential for
+ *          disastrous consequences), we must establish a few rules:
+ *
+ *      Each device-node has a separate vocabulary for its methods.
+ *          New definitions are made to the "current" device's vocabulary.
+ *          Searches for names go through the "current" device-node's
+ *              vocabulary first, then through the core dictionary.
+ *
+ *      A new-device (in interpretation-mode) creates a new device-node
+ *          vocabulary.  The node that had been current (presumably its
+ *          parent) remains in memory but inactive.
+ *
+ *      A finish-device (again, only in interpretation-mode) removes the
+ *          current device-node's vocabulary from memory; its presumed
+ *          parent once again becomes current.
+ *
+ *      Tokenization starts with an implicit "new-device" in effect.
+ *          The top-level device-node is never removed.
+ *
+ *      The Global Variable  current_definitions  points to the vocabulary
+ *          to which we will add and through which we will search first.
+ *
+ *      If "global" scope is in effect, then  current_definitions  will
+ *           point to the "Global" (also called "core") vocabulary.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Support for operations in "current" -- i.e., "global" vis-a-vis
+ *          "device" -- scope.
+ *      "Global" scope will not recognize words defined in "device" scope,
+ *           but "device" scope will recognize "global" words.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Functions to enter "global" scope and resume "device" scope.
+ *
+ **************************************************************************** */
+
+static tic_hdr_t **save_device_definitions;
+/* Export the indication that "global" scope is in effect  */
+bool scope_is_global = FALSE;
+
+
+void enter_global_scope( void )
+{
+    if ( scope_is_global )
 {
-	return lookup_token_dict(name, dictionary);
+	tokenization_error( WARNING,
+	    "%s -- Global Scope already in effect; ignoring.\n",
+		strupr(statbuf) );
+    }else{
+	tokenization_error( INFO,
+	    "Initiating Global Scope definitions.\n" );
+	scope_is_global = TRUE;
+	save_device_definitions = current_definitions;
+	current_definitions = &global_voc_dict_ptr;
+    }
 }
 
-u16 lookup_fword(char *name)
+void resume_device_scope( void )
 {
-	return lookup_token_dict(name, forthwords);
+    if ( scope_is_global )
+    {
+	tokenization_error( INFO,
+	    "Terminating Global Scope definitions; "
+		"resuming Device-node definitions.\n" );
+	current_definitions = save_device_definitions;
+	scope_is_global = FALSE;
+    }else{
+	tokenization_error( WARNING,
+	    "%s -- Device-node Scope already in effect; ignoring.\n",
+		strupr(statbuf) );
+    }
+
 }
 
-static int add_token_dict(u16 number, char *name, token_t **dict)
+/* **************************************************************************
+ *
+ *      Function name:  lookup_current
+ *      Synopsis:       Return a pointer to the data-structure of the named
+ *                          word, either in the Current Device-Node vocab,
+ *                          or in the Global ("core") Vocabulary.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                     The name to look for
+ *         Global Variables:
+ *             current_definitions       Current vocabulary:  Device-Node, or
+ *                                           "core" if "global" scope in effect.
+ *             scope_is_global           TRUE if "global" scope is in effect
+ *         Local Static Variables:
+ *             global_voc_dict_ptr       "Tail" of Global Vocabulary
+ *
+ *      Outputs:
+ *         Returned Value:               Pointer to the data-structure, or
+ *                                           NULL if not found.
+ *
+ *      Process Explanation:
+ *          If a current Device-Node Vocabulary in effect, search through it.
+ *          If the given name was not found, and "global" scope is not in
+ *              effect (i.e., "core" was not already searched), make a
+ *              separate search through the Global ("core") Vocabulary
+ *
+ *      Extraneous Remarks:
+ *          This is the central routine for doing general word-searches that
+ *              make use of the "normal"-mode search-list.
+ *
+ **************************************************************************** */
+
+tic_hdr_t *lookup_current( char *tname)
+{
+    /*  Search Current Device Vocabulary ahead of global (core) vocabulary  */
+    tic_hdr_t *retval;
+    retval = lookup_tic_entry( tname, *current_definitions);
+    if ( (retval == NULL) && INVERSE(scope_is_global) )
 {
-	token_t *curr;
+	retval = lookup_core_word( tname);
+    }
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  exists_in_current
+ *      Synopsis:       Confirm whether the given name exists either
+ *                          in the Current Device-Node vocab,
+ *                          or in the Global ("core") Vocabulary,
+ *                          or in Tokenizer Escape Mode, if that's current.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                     The name to look for
+ *
+ *      Outputs:
+ *         Returned Value:               TRUE if name is found
+ *
+ **************************************************************************** */
 
-	curr=malloc(sizeof(token_t));
-	if(!curr) {
-		printf("Out of memory while adding token.\n");
-		exit(-ENOMEM);
+bool exists_in_current( char *tname)
+{
+    tic_hdr_t *found = lookup_word( tname, NULL, NULL);
+    bool retval = BOOLVAL ( found != NULL);
+    return( retval);
 	}
 
-	curr->next=*dict;
-	curr->fcode=number;
-	curr->name=(u8 *)name;
 
-	*dict=curr;
-	return 0;
+/* **************************************************************************
+ *
+ *      Function name:  handle_current
+ *      Synopsis:       Perform a function in the current device-node vocab,
+ *                      if one is in effect, or in the "Global" Vocabulary.
+ *                      Indicate whether the name is valid.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                      The name to handle
+ *         Global Variables:
+ *             current_definitions        Device-Node (or Global) Vocabulary
+ *                                            currently in effect.
+ *             scope_is_global            TRUE if "global" scope is in effect
+ *         Local Static Variables:
+ *
+ *      Outputs:
+ *         Returned Value:                TRUE if the given name is valid
+ *
+ **************************************************************************** */
+
+bool handle_current( char *tname )
+{
+    bool retval = handle_tic_vocab( tname, *current_definitions );
+
+    if ( INVERSE(retval) && INVERSE(scope_is_global) )
+    {
+	retval = handle_core_word( tname );
+    }
+    return ( retval );
+
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  lookup_in_dev_node
+ *      Synopsis:       Return a pointer to the data-structure of the
+ *                          named word in the Current device node, if
+ *                          in "Device" scope.  Used for error-reporting.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                     The name to look for
+ *         Global Variables:
+ *             current_definitions        Device-Node (or Global) Vocabulary
+ *                                            currently in effect.
+ *             scope_is_global            FALSE if "Device" scope is in effect
+ *
+ *      Outputs:
+ *         Returned Value:                Pointer to the data-structure, or
+ *                                            NULL if not found.
+ *
+ **************************************************************************** */
+
+tic_hdr_t *lookup_in_dev_node( char *tname)
+{
+    tic_hdr_t *retval = NULL;
+
+    if ( INVERSE(scope_is_global) )
+{
+	retval = lookup_tic_entry( tname, *current_definitions);
+}
+    return ( retval );
+}
+
+
+/* **************************************************************************
+ *
+ *     In order to avoid unintentional "recursive"-ness, we need a way
+ *          to render a newly created colon-definition non-findable
+ *          until it's completed.
+ *
+ *      We will accomplish this by saving and reverting the pointer to
+ *          the newest entry, when we call the  hide_last_colon() , and
+ *          by restoring the pointer when we call  reveal_last_colon()
+ *
+ *      We need, therefore, to save the pointer to the last entry before
+ *          we create the new entry.
+ *
+ **************************************************************************** */
+
+/*  Update this each time a new definition is entered  */
+static tic_hdr_t *save_current = NULL;
+
+/* **************************************************************************
+ *
+ *      Function name:  add_to_current
+ *      Synopsis:       Add a new entry to the "current" scope of definitions,
+ *                          which may be either the Global Vocabulary or the
+ *                          current Device-Node Vocabulary.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             name                      The name of the new entry
+ *             fc_token                  The new entry's assigned FCode-number
+ *             fw_definer                The new entry's definer
+ *             define_token              If FALSE, suppress adding the entry,
+ *                                           but preserve the side-effect of
+ *                                           setting  save_current 
+ *         Global Variables:
+ *             current_definitions       Pointer to pointer to "tail" of the
+ *                                           Vocabulary currently in effect;
+ *                                           either Device-node or Global.
+ *
+ *      Outputs:
+ *         Returned Value:               NONE
+ *         Global Variables:
+ *             *current_definitions    Updated with the new entry
+ *         Local Static Variables:
+ *             save_current            Pointer to previous entry
+ *         Memory Allocated
+ *             For the new entry's copy of the name.
+ *         When Freed?
+ *             When the Device-Node is "finish"ed or the Global Vocabulary
+ *                 is reset, or when the program exits.
+ *
+ *      Process Explanation:
+ *          Because  current_definitions  points to the Global Vocabulary
+ *              pointer during "global" scope, this routine is extremely
+ *              straightforward.
+ *          All user-defined words have the same action, i.e., emitting
+ *              the assigned FCode-number.  The new entry's "parameter
+ *              field" size is, of course, zero; the "ignore-function"
+ *              is NULL.
+ *
+ *      Extraneous Remarks:
+ *          The  define_token  parameter is a late addition, necessitated
+ *              by the decision to continue processing after an erroneous
+ *              attempt to create a definition inside a control-structure,
+ *              in order to catch other errors. 
+ *            
+ *
+ **************************************************************************** */
+
+void add_to_current( char *name,
+                           TIC_P_DEFLT_TYPE fc_token,
+			       fwtoken definer,
+			           bool define_token)
+{
+    save_current = *current_definitions;
+    if ( define_token )
+{
+	char *nu_name = strdup( name);
+	add_tic_entry( nu_name, FC_TOKEN_FUNC, fc_token,
+			   definer, 0 , NULL, current_definitions );
+    }
+}
+
+
+void hide_last_colon ( void )
+{
+    tic_hdr_t *temp_vocab;
+
+    /*  The  add_to_current()  function will have been called before this
+     *      one when a new colon-definition is created, so  save_current
+     *      will have been set to point to the entry that had been made
+     *      just before the newest one, which we are hiding here.
+     */
+
+    temp_vocab = save_current ;
+    save_current = *current_definitions;
+    *current_definitions = temp_vocab;
+
 }
 
-int add_token(u16 number, char *name)
+void reveal_last_colon ( void )
 {
-	return add_token_dict(number, name, &dictionary);
+    /*  We call this function either when the colon-definition is
+     *      completed, or when "recursive"-ness is intentional.
+     */
+    *current_definitions = save_current ;
 }
 
-static int add_special(u16 number, char *name)
+
+/* **************************************************************************
+ *
+ *      Function name:  create_current_alias
+ *      Synopsis:       Create an alias for OLD_NAME, called NEW_NAME, in
+ *                          the "current" scope of definitions, which may
+ *                          be either the Global ("core") Vocabulary or the
+ *                          current Device-Node Vocabulary.  Indicate if
+ *                          successful (i.e., OLD_NAME was valid).
+ *                      This is actually a little trickier than it may at
+ *                          first appear; read the Rules in the Process
+ *                          Explanation for full details...
+ *
+ *      Inputs:
+ *         Parameters:
+ *             new_name          The name for the new alias to be created
+ *             old_name          The name of the old function to be duplicated
+ *         Global Variables:
+ *             current_definitions        Device-node vocabulary currently
+ *                                            in effect.
+ *             scope_is_global            TRUE if "global" scope is in effect
+ *         Local Static Variables:
+ *             global_voc_dict_ptr        "Tail" of Global Vocabulary
+ *
+ *      Outputs:
+ *         Returned Value:                TRUE if OLD_NAME was found.
+ *         Global Variables:
+ *             *current_definitions      Updated with the new entry 
+ *         Memory Allocated
+ *             By support routine.
+ *         When Freed?
+ *             When RESET-SYMBOLS is issued (if "global" scope is in effect)
+ *                 or when the device-node is "finish"ed.
+ *         Printout:
+ *             Advisory message if Rule 3 (see below) is invoked.
+ *
+ *      Process Explanation:
+ *          Both the "old" and "new" names are presumed to already point to
+ *              stable, freshly allocated memory-spaces.
+ *          Rules:
+ *          (1)
+ *          If "global" scope is in effect, and the "old" name is found in
+ *              the Global Vocabulary, then the "new" name will be created
+ *              in the Global Vocabulary.
+ *          (2)
+ *          Similarly, if "device" scope is in effect, and the "old" name is
+ *              found in the current device-node's vocabulary, the "new" name
+ *              will be created in the current device-node's vocabulary.
+ *          (3)
+ *          BUT!:  If "device" scope is in effect, and the "old" name is found
+ *              in the Global Vocabulary, then the "new" name will be created
+ *              in the current device-node's vocabulary.  It will only be
+ *              recognized in the scope of that device-node, and will be
+ *              removed from memory when the device-node is "finish"ed.
+ *          And, yes, it *is* supposed to work that way...   ;-)
+ *
+ *          Again, because  current_definitions  points to the Global Vocab
+ *              pointer during "global" scope, the first two rules of this
+ *              routine are extremely straightforward; it's Rule 3 that you
+ *              have to watch out for...  ;-)
+ *
+ *          And one other thing:
+ *              We will always make the alias's  pfld_size  zero.  See the
+ *              prolog for  create_tic_alias()  in  ticvocab.c  for details...
+ *
+ *      Extraneous Remarks:
+ *          I will stretch the rules of well-structured code here, too.
+ *
+ **************************************************************************** */
+
+bool create_current_alias( char *new_name, char *old_name )
 {
-	return add_token_dict(number, name, &forthwords);
+    bool retval = FALSE;
+
+    if ( create_tic_alias( new_name, old_name, current_definitions) )
+    {
+	 return ( TRUE );
+    }
+    
+    if ( INVERSE(scope_is_global) )
+    {
+	tic_hdr_t *found = lookup_core_word( old_name );
+	if ( found != NULL )
+	{
+	    add_tic_entry( new_name, found->funct,
+			       found->pfield.deflt_elem,
+				   found->fword_defr,
+				       0, found->ign_func,
+					   current_definitions );
+	    retval = TRUE;
+	    {
+		tokenization_error( INFO,
+		   "%s is a Global definition, but its alias, %s, "
+		       "will only be defined %s",
+			   strupr( old_name), new_name,
+			       in_what_node( current_device_node) );
+		show_node_start();
+	    }
+	}
+    }
+
+    return ( retval );
 }
 
-void init_dictionary(void) 
-{
-	add_token( 0x000, "end0" );
-	add_token( 0x010, "b(lit)" );
-	add_token( 0x011, "b(')" );
-	add_token( 0x012, "b(\")" );
-	add_token( 0x013, "bbranch" );
-	add_token( 0x014, "b?branch" );
-	add_token( 0x015, "b(loop)" );
-	add_token( 0x016, "b(+loop)" );
-	add_token( 0x017, "b(do)" );
-	add_token( 0x018, "b(?do)" );
-	add_token( 0x019, "i" );
-	add_token( 0x01a, "j" );
-	add_token( 0x01b, "b(leave)" );
-	add_token( 0x01c, "b(of)" );
-	add_token( 0x01d, "execute" );
-	add_token( 0x01e, "+" );
-	add_token( 0x01f, "-" );
-	add_token( 0x020, "*" );
-	add_token( 0x021, "/" );
-	add_token( 0x022, "mod" );
-	add_token( 0x023, "and" );
-	add_token( 0x024, "or" );
-	add_token( 0x025, "xor" );
-	add_token( 0x026, "invert" );
-	add_token( 0x027, "lshift" );
-	add_token( 0x028, "rshift" );
-	add_token( 0x029, ">>a" );
-	add_token( 0x02a, "/mod" );
-	add_token( 0x02b, "u/mod" );
-	add_token( 0x02c, "negate" );
-	add_token( 0x02d, "abs" );
-	add_token( 0x02e, "min" );
-	add_token( 0x02f, "max" );
-	add_token( 0x030, ">r" );
-	add_token( 0x031, "r>" );
-	add_token( 0x032, "r@" );
-	add_token( 0x033, "exit" );
-	add_token( 0x034, "0=" );
-	add_token( 0x035, "0<>" );
-	add_token( 0x036, "0<" );
-	add_token( 0x037, "0<=" );
-	add_token( 0x038, "0>" );
-	add_token( 0x039, "0>=" );
-	add_token( 0x03a, "<" );
-	add_token( 0x03b, ">" );
-	add_token( 0x03c, "=" );
-	add_token( 0x03d, "<>" );
-	add_token( 0x03e, "u>" );
-	add_token( 0x03f, "u<=" );
-	add_token( 0x040, "u<" );
-	add_token( 0x041, "u>=" );
-	add_token( 0x042, ">=" );
-	add_token( 0x043, "<=" );
-	add_token( 0x044, "between" );
-	add_token( 0x045, "within" );
-	add_token( 0x046, "drop" );
-	add_token( 0x047, "dup" );
-	add_token( 0x048, "over" );
-	add_token( 0x049, "swap" );
-	add_token( 0x04A, "rot" );
-	add_token( 0x04b, "-rot" );
-	add_token( 0x04c, "tuck" );
-	add_token( 0x04d, "nip" );
-	add_token( 0x04e, "pick" );
-	add_token( 0x04f, "roll" );
-	add_token( 0x050, "?dup" );
-	add_token( 0x051, "depth" );
-	add_token( 0x052, "2drop" );
-	add_token( 0x053, "2dup" );
-	add_token( 0x054, "2over" );
-	add_token( 0x055, "2swap" );
-	add_token( 0x056, "2rot" );
-	add_token( 0x057, "2/" );
-	add_token( 0x058, "u2/" );
-	add_token( 0x059, "2*" );
-	add_token( 0x05a, "/c" );
-	add_token( 0x05b, "/w" );
-	add_token( 0x05c, "/l" );
-	add_token( 0x05d, "/n" );
-	add_token( 0x05e, "ca+" );
-	add_token( 0x05f, "wa+" );
-	add_token( 0x060, "la+" );
-	add_token( 0x061, "na+" );
-	add_token( 0x062, "char+" );
-	add_token( 0x063, "wa1+" );
-	add_token( 0x064, "la1+" );
-	add_token( 0x065, "cell+" );
-	add_token( 0x066, "chars" );
-	add_token( 0x067, "/w*" );
-	add_token( 0x068, "/l*" );
-	add_token( 0x069, "cells" );
-	add_token( 0x06a, "on" );
-	add_token( 0x06b, "off" );
-	add_token( 0x06c, "+!" );
-	add_token( 0x06d, "@" );
-	add_token( 0x06e, "l@" );
-	add_token( 0x06f, "w@" );
-	add_token( 0x070, "<w@" );
-	add_token( 0x071, "c@" );
-	add_token( 0x072, "!" );
-	add_token( 0x073, "l!" );
-	add_token( 0x074, "w!" );
-	add_token( 0x075, "c!" );
-	add_token( 0x076, "2@" );
-	add_token( 0x077, "2!" );
-	add_token( 0x078, "move" );
-	add_token( 0x079, "fill" );
-	add_token( 0x07a, "comp" );
-	add_token( 0x07b, "noop" );
-	add_token( 0x07c, "lwsplit" );
-	add_token( 0x07d, "wljoin" );
-	add_token( 0x07e, "lbsplit" );
-	add_token( 0x07f, "bljoin" );
-	add_token( 0x080, "wbflip" );
-	add_token( 0x081, "upc" );
-	add_token( 0x082, "lcc" );
-	add_token( 0x083, "pack" );
-	add_token( 0x084, "count" );
-	add_token( 0x085, "body>" );
-	add_token( 0x086, ">body" );
-	add_token( 0x087, "fcode-revision" );
-	add_token( 0x088, "span" );
-	add_token( 0x089, "unloop" );
-	add_token( 0x08a, "expect" );
-	add_token( 0x08b, "alloc-mem" );
-	add_token( 0x08c, "free-mem" );
-	add_token( 0x08d, "key?" );
-	add_token( 0x08e, "key" );
-	add_token( 0x08f, "emit" );
-	add_token( 0x090, "type" );
-	add_token( 0x091, "(cr" );
-	add_token( 0x092, "cr" );
-	add_token( 0x093, "#out" );
-	add_token( 0x094, "#line" );
-	add_token( 0x095, "hold" );
-	add_token( 0x096, "<#" );
-	add_token( 0x097, "u#>" );
-	add_token( 0x098, "sign" );
-	add_token( 0x099, "u#" );
-	add_token( 0x09a, "u#s" );
-	add_token( 0x09b, "u." );
-	add_token( 0x09c, "u.r" );
-	add_token( 0x09d, "." );
-	add_token( 0x09e, ".r" );
-	add_token( 0x09f, ".s" );
-	add_token( 0x0a0, "base" );
-	add_token( 0x0a1, "convert" );
-	add_token( 0x0a2, "$number" );
-	add_token( 0x0a3, "digit" );
-	add_token( 0x0a4, "-1" );
-	add_token( 0x0a5, "0" );
-	add_token( 0x0a6, "1" );
-	add_token( 0x0a7, "2" );
-	add_token( 0x0a8, "3" );
-	add_token( 0x0a9, "bl" );
-	add_token( 0x0aa, "bs" );
-	add_token( 0x0ab, "bell" );
-	add_token( 0x0ac, "bounds" );
-	add_token( 0x0ad, "here" );
-	add_token( 0x0ae, "aligned" );
-	add_token( 0x0af, "wbsplit" );
-	add_token( 0x0b0, "bwjoin" );
-	add_token( 0x0b1, "b(<mark)" );
-	add_token( 0x0b2, "b(>resolve)" );
-	add_token( 0x0b3, "set-token-table" );
-	add_token( 0x0b4, "set-table" );
-	add_token( 0x0b5, "new-token" );
-	add_token( 0x0b6, "named-token" );
-	add_token( 0x0b7, "b(:)" );
-	add_token( 0x0b8, "b(value)" );
-	add_token( 0x0b9, "b(variable)" );
-	add_token( 0x0ba, "b(constant)" );
-	add_token( 0x0bb, "b(create)" );
-	add_token( 0x0bc, "b(defer)" );
-	add_token( 0x0bd, "b(buffer:)" );
-	add_token( 0x0be, "b(field)" );
-	add_token( 0x0bf, "b(code)" );
-	add_token( 0x0c0, "instance" );
-	add_token( 0x0c2, "b(;)" );
-	add_token( 0x0c3, "b(to)" );
-	add_token( 0x0c4, "b(case)" );
-	add_token( 0x0c5, "b(endcase)" );
-	add_token( 0x0c6, "b(endof)" );
-	add_token( 0x0c7, "#" );
-	add_token( 0x0c8, "#s" );
-	add_token( 0x0c9, "#>" );
-	add_token( 0x0ca, "external-token" );
-	add_token( 0x0cb, "$find" );
-	add_token( 0x0cc, "offset16" );
-	add_token( 0x0cd, "evaluate" );
-	add_token( 0x0d0, "c," );
-	add_token( 0x0d1, "w," );
-	add_token( 0x0d2, "l," );
-	add_token( 0x0d3, "," );
-	add_token( 0x0d4, "um*" );
-	add_token( 0x0d5, "um/mod" );
-	add_token( 0x0d8, "d+" );
-	add_token( 0x0d9, "d-" );
-	add_token( 0x0da, "get-token" );
-	add_token( 0x0db, "set-token" );
-	add_token( 0x0dc, "state" );
-	add_token( 0x0dd, "compile" );
-	add_token( 0x0de, "behavior" );
-	add_token( 0x0f0, "start0" );
-	add_token( 0x0f1, "start1" );
-	add_token( 0x0f2, "start2" );
-	add_token( 0x0f3, "start4" );
-	add_token( 0x0fc, "ferror" );
-	add_token( 0x0fd, "version1" );
-	add_token( 0x0fe, "4-byte-id" );
-	add_token( 0x0ff, "end1" );
-	add_token( 0x101, "dma-alloc" );
-	add_token( 0x102, "my-address" );
-	add_token( 0x103, "my-space" );
-	add_token( 0x104, "memmap" );
-	add_token( 0x105, "free-virtual" );
-	add_token( 0x106, ">physical" );
-	add_token( 0x10f, "my-params" );
-	add_token( 0x110, "property" );
-	add_token( 0x111, "encode-int" );
-	add_token( 0x112, "encode+" );
-	add_token( 0x113, "encode-phys" );
-	add_token( 0x114, "encode-string" );
-	add_token( 0x115, "encode-bytes" );
-	add_token( 0x116, "reg" );
-	add_token( 0x117, "intr" );
-	add_token( 0x118, "driver" );
-	add_token( 0x119, "model" );
-	add_token( 0x11a, "device-type" );
-	add_token( 0x11b, "parse-2int" );
-	add_token( 0x11c, "is-install" );
-	add_token( 0x11d, "is-remove" );
-	add_token( 0x11e, "is-selftest" );
-	add_token( 0x11f, "new-device" );
-	add_token( 0x120, "diagnostic-mode?" );
-	add_token( 0x121, "display-status" );
-	add_token( 0x122, "memory-test-issue" );
-	add_token( 0x123, "group-code" );
-	add_token( 0x124, "mask" );
-	add_token( 0x125, "get-msecs" );
-	add_token( 0x126, "ms" );
-	add_token( 0x127, "finish-device" );
-	add_token( 0x128, "decode-phys" );
-	add_token( 0x12b, "interpose" );
-	add_token( 0x130, "map-low" );
-	add_token( 0x131, "sbus-intr>cpu" );
-	add_token( 0x150, "#lines" );
-	add_token( 0x151, "#columns" );
-	add_token( 0x152, "line#" );
-	add_token( 0x153, "column#" );
-	add_token( 0x154, "inverse?" );
-	add_token( 0x155, "inverse-screen?" );
-	add_token( 0x156, "frame-buffer-busy?" );
-	add_token( 0x157, "draw-character" );
-	add_token( 0x158, "reset-screen" );
-	add_token( 0x159, "toggle-cursor" );
-	add_token( 0x15a, "erase-screen" );
-	add_token( 0x15b, "blink-screen" );
-	add_token( 0x15c, "invert-screen" );
-	add_token( 0x15d, "insert-characters" );
-	add_token( 0x15e, "delete-characters" );
-	add_token( 0x15f, "insert-lines" );
-	add_token( 0x160, "delete-lines" );
-	add_token( 0x161, "draw-logo" );
-	add_token( 0x162, "frame-buffer-adr" );
-	add_token( 0x163, "screen-height" );
-	add_token( 0x164, "screen-width" );
-	add_token( 0x165, "window-top" );
-	add_token( 0x166, "window-left" );
-	add_token( 0x16a, "default-font" );
-	add_token( 0x16b, "set-font" );
-	add_token( 0x16c, "char-height" );
-	add_token( 0x16d, "char-width" );
-	add_token( 0x16e, ">font" );
-	add_token( 0x16f, "fontbytes" );
-	add_token( 0x170, "fb1-draw-character" );
-	add_token( 0x171, "fb1-reset-screen" );
-	add_token( 0x172, "fb1-toggle-cursor" );
-	add_token( 0x173, "fb1-erase-screen" );
-	add_token( 0x174, "fb1-blink-screen" );
-	add_token( 0x175, "fb1-invert-screen" );
-	add_token( 0x176, "fb1-insert-characters" );
-	add_token( 0x177, "fb1-delete-characters" );
-	add_token( 0x178, "fb1-insert-lines" );
-	add_token( 0x179, "fb1-delete-lines" );
-	add_token( 0x17a, "fb1-draw-logo" );
-	add_token( 0x17b, "fb1-install" );
-	add_token( 0x17c, "fb1-slide-up" );
-	add_token( 0x180, "fb8-draw-character" );
-	add_token( 0x181, "fb8-reset-screen" );
-	add_token( 0x182, "fb8-toggle-cursor" );
-	add_token( 0x183, "fb8-erase-screen" );
-	add_token( 0x184, "fb8-blink-screen" );
-	add_token( 0x185, "fb8-invert-screen" );
-	add_token( 0x186, "fb8-insert-characters" );
-	add_token( 0x187, "fb8-delete-characters" );
-	add_token( 0x188, "fb8-insert-lines" );
-	add_token( 0x189, "fb8-delete-lines" );
-	add_token( 0x18a, "fb8-draw-logo" );
-	add_token( 0x18b, "fb8-install" );
-	add_token( 0x1a0, "return-buffer" );
-	add_token( 0x1a1, "xmit-packet" );
-	add_token( 0x1a2, "poll-packet" );
-	add_token( 0x1a4, "mac-address" );
-	add_token( 0x201, "device-name" );
-	add_token( 0x202, "my-args" );
-	add_token( 0x203, "my-self" );
-	add_token( 0x204, "find-package" );
-	add_token( 0x205, "open-package" );
-	add_token( 0x206, "close-package" );
-	add_token( 0x207, "find-method" );
-	add_token( 0x208, "call-package" );
-	add_token( 0x209, "$call-parent" );
-	add_token( 0x20a, "my-package" );
-	add_token( 0x20b, "ihandle>phandle" );
-	add_token( 0x20d, "my-unit" );
-	add_token( 0x20e, "$call-method" );
-	add_token( 0x20f, "$open-package" );
-	add_token( 0x210, "processor-type" );
-	add_token( 0x211, "firmware-version" );
-	add_token( 0x212, "fcode-version" );
-	add_token( 0x213, "alarm" );
-	add_token( 0x214, "(is-user-word)" );
-	add_token( 0x215, "suspend-fcode" );
-	add_token( 0x216, "abort" );
-	add_token( 0x217, "catch" );
-	add_token( 0x218, "throw" );
-	add_token( 0x219, "user-abort" );
-	add_token( 0x21a, "get-my-property" );
-	add_token( 0x21b, "decode-int" );
-	add_token( 0x21c, "decode-string" );
-	add_token( 0x21d, "get-inherited-property" );
-	add_token( 0x21e, "delete-property" );
-	add_token( 0x21f, "get-package-property" );
-	add_token( 0x220, "cpeek" );
-	add_token( 0x221, "wpeek" );
-	add_token( 0x222, "lpeek" );
-	add_token( 0x223, "cpoke" );
-	add_token( 0x224, "wpoke" );
-	add_token( 0x225, "lpoke" );
-	add_token( 0x226, "lwflip" );
-	add_token( 0x227, "lbflip" );
-	add_token( 0x228, "lbflips" );
-	add_token( 0x229, "adr-mask" );
-	add_token( 0x230, "rb@" );
-	add_token( 0x231, "rb!" );
-	add_token( 0x232, "rw@" );
-	add_token( 0x233, "rw!" );
-	add_token( 0x234, "rl@" );
-	add_token( 0x235, "rl!" );
-	add_token( 0x236, "wbflips" );
-	add_token( 0x237, "lwflips" );
-	add_token( 0x238, "probe" );
-	add_token( 0x239, "probe-virtual" );
-	add_token( 0x23b, "child" );
-	add_token( 0x23c, "peer" );
-	add_token( 0x23d, "next-property" );
-	add_token( 0x23e, "byte-load" );
-	add_token( 0x23f, "set-args" );
-	add_token( 0x240, "left-parse-string" );
+/* **************************************************************************
+ *
+ *      Support functions specific to the lists will be defined
+ *          after the lists are created.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *     Create the initial list (or "Table") of FCode-Tokens.
+ *
+ *     Most Standard FCode tokens are not specified as to their definition
+ *         type, but a few have a definer specified as either a VALUE, a
+ *         VARIABLE or a DEFER; we will enter them with the appropriate macro.
+ *
+ **************************************************************************** */
+
+static tic_hdr_t tokens_table[] =
+{
+	BUILTIN_FCODE( 0x000, "end0" ) ,
+	BUILTIN_FCODE( 0x010, "b(lit)" ) ,
+	BUILTIN_FCODE( 0x011, "b(')" ) ,
+	BUILTIN_FCODE( 0x012, "b(\")" ) ,
+	BUILTIN_FCODE( 0x013, "bbranch" ) ,
+	BUILTIN_FCODE( 0x014, "b?branch" ) ,
+	BUILTIN_FCODE( 0x015, "b(loop)" ) ,
+	BUILTIN_FCODE( 0x016, "b(+loop)" ) ,
+	BUILTIN_FCODE( 0x017, "b(do)" ) ,
+	BUILTIN_FCODE( 0x018, "b(?do)" ) ,
+	BUILTIN_FCODE( 0x019, "i" ) ,
+	BUILTIN_FCODE( 0x01a, "j" ) ,
+	BUILTIN_FCODE( 0x01b, "b(leave)" ) ,
+	BUILTIN_FCODE( 0x01c, "b(of)" ) ,
+	BUILTIN_FCODE( 0x01d, "execute" ) ,
+	BUILTIN_FCODE( 0x01e, "+" ) ,
+	BUILTIN_FCODE( 0x01f, "-" ) ,
+	BUILTIN_FCODE( 0x020, "*" ) ,
+	BUILTIN_FCODE( 0x021, "/" ) ,
+	BUILTIN_FCODE( 0x022, "mod" ) ,
+	BUILTIN_FCODE( 0x023, "and" ) ,
+	BUILTIN_FCODE( 0x024, "or" ) ,
+	BUILTIN_FCODE( 0x025, "xor" ) ,
+	BUILTIN_FCODE( 0x026, "invert" ) ,
+	BUILTIN_FCODE( 0x026, "not" ) ,           /*  Synonym for "invert" */
+	BUILTIN_FCODE( 0x027, "lshift" ) ,
+	BUILTIN_FCODE( 0x027, "<<" ) ,            /*  Synonym for "lshift" */
+	BUILTIN_FCODE( 0x028, "rshift" ) ,
+	BUILTIN_FCODE( 0x028, ">>" ) ,            /*  Synonym for "rshift" */
+	BUILTIN_FCODE( 0x029, ">>a" ) ,
+	BUILTIN_FCODE( 0x02a, "/mod" ) ,
+	BUILTIN_FCODE( 0x02b, "u/mod" ) ,
+	BUILTIN_FCODE( 0x02c, "negate" ) ,
+	BUILTIN_FCODE( 0x02d, "abs" ) ,
+	BUILTIN_FCODE( 0x02e, "min" ) ,
+	BUILTIN_FCODE( 0x02f, "max" ) ,
+	BUILTIN_FCODE( 0x030, ">r" ) ,
+	BUILTIN_FCODE( 0x031, "r>" ) ,
+	BUILTIN_FCODE( 0x032, "r@" ) ,
+	BUILTIN_FCODE( 0x033, "exit" ) ,
+	BUILTIN_FCODE( 0x034, "0=" ) ,
+	BUILTIN_FCODE( 0x035, "0<>" ) ,
+	BUILTIN_FCODE( 0x036, "0<" ) ,
+	BUILTIN_FCODE( 0x037, "0<=" ) ,
+	BUILTIN_FCODE( 0x038, "0>" ) ,
+	BUILTIN_FCODE( 0x039, "0>=" ) ,
+	BUILTIN_FCODE( 0x03a, "<" ) ,
+	BUILTIN_FCODE( 0x03b, ">" ) ,
+	BUILTIN_FCODE( 0x03c, "=" ) ,
+	BUILTIN_FCODE( 0x03d, "<>" ) ,
+	BUILTIN_FCODE( 0x03e, "u>" ) ,
+	BUILTIN_FCODE( 0x03f, "u<=" ) ,
+	BUILTIN_FCODE( 0x040, "u<" ) ,
+	BUILTIN_FCODE( 0x041, "u>=" ) ,
+	BUILTIN_FCODE( 0x042, ">=" ) ,
+	BUILTIN_FCODE( 0x043, "<=" ) ,
+	BUILTIN_FCODE( 0x044, "between" ) ,
+	BUILTIN_FCODE( 0x045, "within" ) ,
+	BUILTIN_FCODE( 0x046, "drop" ) ,
+	BUILTIN_FCODE( 0x047, "dup" ) ,
+	BUILTIN_FCODE( 0x048, "over" ) ,
+	BUILTIN_FCODE( 0x049, "swap" ) ,
+	BUILTIN_FCODE( 0x04A, "rot" ) ,
+	BUILTIN_FCODE( 0x04b, "-rot" ) ,
+	BUILTIN_FCODE( 0x04c, "tuck" ) ,
+	BUILTIN_FCODE( 0x04d, "nip" ) ,
+	BUILTIN_FCODE( 0x04e, "pick" ) ,
+	BUILTIN_FCODE( 0x04f, "roll" ) ,
+	BUILTIN_FCODE( 0x050, "?dup" ) ,
+	BUILTIN_FCODE( 0x051, "depth" ) ,
+	BUILTIN_FCODE( 0x052, "2drop" ) ,
+	BUILTIN_FCODE( 0x053, "2dup" ) ,
+	BUILTIN_FCODE( 0x054, "2over" ) ,
+	BUILTIN_FCODE( 0x055, "2swap" ) ,
+	BUILTIN_FCODE( 0x056, "2rot" ) ,
+	BUILTIN_FCODE( 0x057, "2/" ) ,
+	BUILTIN_FCODE( 0x058, "u2/" ) ,
+	BUILTIN_FCODE( 0x059, "2*" ) ,
+	BUILTIN_FCODE( 0x05a, "/c" ) ,
+	BUILTIN_FCODE( 0x05b, "/w" ) ,
+	BUILTIN_FCODE( 0x05c, "/l" ) ,
+	BUILTIN_FCODE( 0x05d, "/n" ) ,
+	BUILTIN_FCODE( 0x05e, "ca+" ) ,
+	BUILTIN_FCODE( 0x05f, "wa+" ) ,
+	BUILTIN_FCODE( 0x060, "la+" ) ,
+	BUILTIN_FCODE( 0x061, "na+" ) ,
+	BUILTIN_FCODE( 0x062, "char+" ) ,
+	BUILTIN_FCODE( 0x062, "ca1+" ) ,          /*  Synonym for char+" */
+	BUILTIN_FCODE( 0x063, "wa1+" ) ,
+	BUILTIN_FCODE( 0x064, "la1+" ) ,
+	BUILTIN_FCODE( 0x065, "cell+" ) ,
+	BUILTIN_FCODE( 0x065, "na1+" ) ,          /*  Synonym for "cell+" */
+	BUILTIN_FCODE( 0x066, "chars" ) ,
+	BUILTIN_FCODE( 0x066, "/c*" ) ,           /*  Synonym for "chars" */
+	BUILTIN_FCODE( 0x067, "/w*" ) ,
+	BUILTIN_FCODE( 0x068, "/l*" ) ,
+	BUILTIN_FCODE( 0x069, "cells" ) ,
+	BUILTIN_FCODE( 0x069, "/n*" ) ,           /*  Synonym for "cells" */
+	BUILTIN_FCODE( 0x06a, "on" ) ,
+	BUILTIN_FCODE( 0x06b, "off" ) ,
+	BUILTIN_FCODE( 0x06c, "+!" ) ,
+	BUILTIN_FCODE( 0x06d, "@" ) ,
+	BUILTIN_FCODE( 0x06e, "l@" ) ,
+	BUILTIN_FCODE( 0x06f, "w@" ) ,
+	BUILTIN_FCODE( 0x070, "<w@" ) ,
+	BUILTIN_FCODE( 0x071, "c@" ) ,
+	BUILTIN_FCODE( 0x072, "!" ) ,
+	BUILTIN_FCODE( 0x073, "l!" ) ,
+	BUILTIN_FCODE( 0x074, "w!" ) ,
+	BUILTIN_FCODE( 0x075, "c!" ) ,
+	BUILTIN_FCODE( 0x076, "2@" ) ,
+	BUILTIN_FCODE( 0x077, "2!" ) ,
+	BUILTIN_FCODE( 0x078, "move" ) ,
+	BUILTIN_FCODE( 0x079, "fill" ) ,
+	BUILTIN_FCODE( 0x07a, "comp" ) ,
+	BUILTIN_FCODE( 0x07b, "noop" ) ,
+	BUILTIN_FCODE( 0x07c, "lwsplit" ) ,
+	BUILTIN_FCODE( 0x07d, "wljoin" ) ,
+	BUILTIN_FCODE( 0x07e, "lbsplit" ) ,
+	BUILTIN_FCODE( 0x07f, "bljoin" ) ,
+	BUILTIN_FCODE( 0x080, "wbflip" ) ,
+	BUILTIN_FCODE( 0x080, "flip" ) ,   /*  Synonym for "wbflip"  */
+	BUILTIN_FCODE( 0x081, "upc" ) ,
+	BUILTIN_FCODE( 0x082, "lcc" ) ,
+	BUILTIN_FCODE( 0x083, "pack" ) ,
+	BUILTIN_FCODE( 0x084, "count" ) ,
+	BUILTIN_FCODE( 0x085, "body>" ) ,
+	BUILTIN_FCODE( 0x086, ">body" ) ,
+	BUILTIN_FCODE( 0x087, "fcode-revision" ) ,
+	BUILTIN_FCODE( 0x087, "version" ) , /*  Synonym for "fcode-revision" */
+	BI_FCODE_VRBLE( 0x088, "span" ) ,
+	BUILTIN_FCODE( 0x089, "unloop" ) ,
+	BUILTIN_FCODE( 0x08a, "expect" ) ,
+	BUILTIN_FCODE( 0x08b, "alloc-mem" ) ,
+	BUILTIN_FCODE( 0x08c, "free-mem" ) ,
+	BUILTIN_FCODE( 0x08d, "key?" ) ,
+	BUILTIN_FCODE( 0x08e, "key" ) ,
+	BUILTIN_FCODE( 0x08f, "emit" ) ,
+	BUILTIN_FCODE( 0x090, "type" ) ,
+	BUILTIN_FCODE( 0x091, "(cr" ) ,
+	BUILTIN_FCODE( 0x092, "cr" ) ,
+	BI_FCODE_VRBLE( 0x093, "#out" ) ,
+	BI_FCODE_VRBLE( 0x094, "#line" ) ,
+	BUILTIN_FCODE( 0x095, "hold" ) ,
+	BUILTIN_FCODE( 0x096, "<#" ) ,
+	BUILTIN_FCODE( 0x097, "u#>" ) ,
+	BUILTIN_FCODE( 0x098, "sign" ) ,
+	BUILTIN_FCODE( 0x099, "u#" ) ,
+	BUILTIN_FCODE( 0x09a, "u#s" ) ,
+	BUILTIN_FCODE( 0x09b, "u." ) ,
+	BUILTIN_FCODE( 0x09c, "u.r" ) ,
+	BUILTIN_FCODE( 0x09d, "." ) ,
+	BUILTIN_FCODE( 0x09e, ".r" ) ,
+	BUILTIN_FCODE( 0x09f, ".s" ) ,
+	BI_FCODE_VRBLE( 0x0a0, "base" ) ,
+	OBSOLETE_FCODE( 0x0a1, "convert" ) ,
+	BUILTIN_FCODE( 0x0a2, "$number" ) ,
+	BUILTIN_FCODE( 0x0a3, "digit" ) ,
+	BI_FCODE_CONST( 0x0a4, "-1" ) ,
+	BI_FCODE_CONST( 0x0a4, "true" ) ,          /*  Synonym for "-1" */
+	BI_FCODE_CONST( 0x0a5, "0" ) ,
+	BI_FCODE_CONST( 0x0a5, "false" ) ,         /*  Synonym for "0" */
+	BI_FCODE_CONST( 0x0a5, "struct" ) ,        /*  Synonym for "0" */
+	BI_FCODE_CONST( 0x0a6, "1" ) ,
+	BI_FCODE_CONST( 0x0a7, "2" ) ,
+	BI_FCODE_CONST( 0x0a8, "3" ) ,
+	BI_FCODE_CONST( 0x0a9, "bl" ) ,
+	BI_FCODE_CONST( 0x0aa, "bs" ) ,
+	BI_FCODE_CONST( 0x0ab, "bell" ) ,
+	BUILTIN_FCODE( 0x0ac, "bounds" ) ,
+	BUILTIN_FCODE( 0x0ad, "here" ) ,
+	BUILTIN_FCODE( 0x0ae, "aligned" ) ,
+	BUILTIN_FCODE( 0x0af, "wbsplit" ) ,
+	BUILTIN_FCODE( 0x0b0, "bwjoin" ) ,
+	BUILTIN_FCODE( 0x0b1, "b(<mark)" ) ,
+	BUILTIN_FCODE( 0x0b2, "b(>resolve)" ) ,
+	OBSOLETE_FCODE( 0x0b3, "set-token-table" ) ,
+	OBSOLETE_FCODE( 0x0b4, "set-table" ) ,
+	BUILTIN_FCODE( 0x0b5, "new-token" ) ,
+	BUILTIN_FCODE( 0x0b6, "named-token" ) ,
+	BUILTIN_FCODE( 0x0b7, "b(:)" ) ,
+	BUILTIN_FCODE( 0x0b8, "b(value)" ) ,
+	BUILTIN_FCODE( 0x0b9, "b(variable)" ) ,
+	BUILTIN_FCODE( 0x0ba, "b(constant)" ) ,
+	BUILTIN_FCODE( 0x0bb, "b(create)" ) ,
+	BUILTIN_FCODE( 0x0bc, "b(defer)" ) ,
+	BUILTIN_FCODE( 0x0bd, "b(buffer:)" ) ,
+	BUILTIN_FCODE( 0x0be, "b(field)" ) ,
+	OBSOLETE_FCODE( 0x0bf, "b(code)" ) ,
+	BUILTIN_FCODE( 0x0c0, "instance" ) ,
+	BUILTIN_FCODE( 0x0c2, "b(;)" ) ,
+	BUILTIN_FCODE( 0x0c3, "b(to)" ) ,
+	BUILTIN_FCODE( 0x0c4, "b(case)" ) ,
+	BUILTIN_FCODE( 0x0c5, "b(endcase)" ) ,
+	BUILTIN_FCODE( 0x0c6, "b(endof)" ) ,
+	BUILTIN_FCODE( 0x0c7, "#" ) ,
+	BUILTIN_FCODE( 0x0c8, "#s" ) ,
+	BUILTIN_FCODE( 0x0c9, "#>" ) ,
+	BUILTIN_FCODE( 0x0ca, "external-token" ) ,
+	BUILTIN_FCODE( 0x0cb, "$find" ) ,
+	BUILTIN_FCODE( 0x0cc, "offset16" ) ,
+	BUILTIN_FCODE( 0x0cd, "evaluate" ) ,
+	BUILTIN_FCODE( 0x0cd, "eval" ) ,   /*  Synonym for "evaluate"  */
+	BUILTIN_FCODE( 0x0d0, "c," ) ,
+	BUILTIN_FCODE( 0x0d1, "w," ) ,
+	BUILTIN_FCODE( 0x0d2, "l," ) ,
+	BUILTIN_FCODE( 0x0d3, "," ) ,
+	BUILTIN_FCODE( 0x0d4, "um*" ) ,
+	BUILTIN_FCODE( 0x0d4, "u*x" ) ,        /*  Synonym for "um*" */
+	BUILTIN_FCODE( 0x0d5, "um/mod" ) ,
+	BUILTIN_FCODE( 0x0d5, "xu/mod" ) ,   /*  Synonym for "um/mod"  */
+	BUILTIN_FCODE( 0x0d8, "d+" ) ,
+	BUILTIN_FCODE( 0x0d8, "x+" ) ,   /*  Synonym for "d+"  */
+	BUILTIN_FCODE( 0x0d9, "d-" ) ,
+	BUILTIN_FCODE( 0x0d9, "x-" ) ,   /*  Synonym for "d-"  */
+	BUILTIN_FCODE( 0x0da, "get-token" ) ,
+	BUILTIN_FCODE( 0x0db, "set-token" ) ,
+	BI_FCODE_VRBLE( 0x0dc, "state" ) ,
+	BUILTIN_FCODE( 0x0dd, "compile" ) ,
+	BUILTIN_FCODE( 0x0de, "behavior" ) ,
+	BUILTIN_FCODE( 0x0f0, "start0" ) ,
+	BUILTIN_FCODE( 0x0f1, "start1" ) ,
+	BUILTIN_FCODE( 0x0f2, "start2" ) ,
+	BUILTIN_FCODE( 0x0f3, "start4" ) ,
+	BUILTIN_FCODE( 0x0fc, "ferror" ) ,
+	BUILTIN_FCODE( 0x0fd, "version1" ) ,
+	OBSOLETE_FCODE( 0x0fe, "4-byte-id" ) ,
+	BUILTIN_FCODE( 0x0ff, "end1" ) ,
+	OBSOLETE_FCODE( 0x101, "dma-alloc" ) ,
+	BUILTIN_FCODE( 0x102, "my-address" ) ,
+	BUILTIN_FCODE( 0x103, "my-space" ) ,
+	OBSOLETE_FCODE( 0x104, "memmap" ) ,
+	BUILTIN_FCODE( 0x105, "free-virtual" ) ,
+	OBSOLETE_FCODE( 0x106, ">physical" ) ,
+	OBSOLETE_FCODE( 0x10f, "my-params" ) ,
+	BUILTIN_FCODE( 0x110, "property" ) ,
+	BUILTIN_FCODE( 0x110, "attribute" ) ,    /*  Synonym for "property"  */
+	BUILTIN_FCODE( 0x111, "encode-int" ) ,
+	BUILTIN_FCODE( 0x111, "xdrint" ) ,     /*  Synonym for "encode-int"  */
+	BUILTIN_FCODE( 0x112, "encode+" ) ,
+	BUILTIN_FCODE( 0x112, "xdr+" ) ,          /*  Synonym for "encode+"  */
+	BUILTIN_FCODE( 0x113, "encode-phys" ) ,
+	BUILTIN_FCODE( 0x113, "xdrphys" ) ,   /*  Synonym for "encode-phys"  */
+	BUILTIN_FCODE( 0x114, "encode-string" ) ,
+	BUILTIN_FCODE( 0x114, "xdrstring" ) , /* Synonym for "encode-string" */
+	BUILTIN_FCODE( 0x115, "encode-bytes" ) ,
+	BUILTIN_FCODE( 0x115, "xdrbytes" ) ,  /*  Synonym for "encode-bytes" */
+	BUILTIN_FCODE( 0x116, "reg" ) ,
+	OBSOLETE_FCODE( 0x117, "intr" ) ,
+	OBSOLETE_FCODE( 0x118, "driver" ) ,
+	BUILTIN_FCODE( 0x119, "model" ) ,
+	BUILTIN_FCODE( 0x11a, "device-type" ) ,
+	BUILTIN_FCODE( 0x11b, "parse-2int" ) ,
+	BUILTIN_FCODE( 0x11b, "decode-2int" ) , /*  Synonym for "parse-2int" */
+	BUILTIN_FCODE( 0x11c, "is-install" ) ,
+	BUILTIN_FCODE( 0x11d, "is-remove" ) ,
+	BUILTIN_FCODE( 0x11e, "is-selftest" ) ,
+	BUILTIN_FCODE( 0x11f, "new-device" ) ,
+	BUILTIN_FCODE( 0x120, "diagnostic-mode?" ) ,
+	BUILTIN_FCODE( 0x121, "display-status" ) ,
+	BUILTIN_FCODE( 0x122, "memory-test-issue" ) ,
+	OBSOLETE_FCODE( 0x123, "group-code" ) ,
+	BI_FCODE_VRBLE( 0x124, "mask" ) ,
+	BUILTIN_FCODE( 0x125, "get-msecs" ) ,
+	BUILTIN_FCODE( 0x126, "ms" ) ,
+	BUILTIN_FCODE( 0x127, "finish-device" ) ,
+	BUILTIN_FCODE( 0x128, "decode-phys" ) ,
+	BUILTIN_FCODE( 0x12b, "interpose" ) ,
+	BUILTIN_FCODE( 0x130, "map-low" ) ,
+	BUILTIN_FCODE( 0x130, "map-sbus" ) ,   /*  Synonym for "map-low"  */
+	BUILTIN_FCODE( 0x131, "sbus-intr>cpu" ) ,
+	BI_FCODE_VALUE( 0x150, "#lines" ) ,
+	BI_FCODE_VALUE( 0x151, "#columns" ) ,
+	BI_FCODE_VALUE( 0x152, "line#" ) ,
+	BI_FCODE_VALUE( 0x153, "column#" ) ,
+	BI_FCODE_VALUE( 0x154, "inverse?" ) ,
+	BI_FCODE_VALUE( 0x155, "inverse-screen?" ) ,
+	OBSOLETE_VALUE( 0x156, "frame-buffer-busy?" ) ,
+	BI_FCODE_DEFER( 0x157, "draw-character" ) ,
+	BI_FCODE_DEFER( 0x158, "reset-screen" ) ,
+	BI_FCODE_DEFER( 0x159, "toggle-cursor" ) ,
+	BI_FCODE_DEFER( 0x15a, "erase-screen" ) ,
+	BI_FCODE_DEFER( 0x15b, "blink-screen" ) ,
+	BI_FCODE_DEFER( 0x15c, "invert-screen" ) ,
+	BI_FCODE_DEFER( 0x15d, "insert-characters" ) ,
+	BI_FCODE_DEFER( 0x15e, "delete-characters" ) ,
+	BI_FCODE_DEFER( 0x15f, "insert-lines" ) ,
+	BI_FCODE_DEFER( 0x160, "delete-lines" ) ,
+	BI_FCODE_DEFER( 0x161, "draw-logo" ) ,
+	BI_FCODE_VALUE( 0x162, "frame-buffer-adr" ) ,
+	BI_FCODE_VALUE( 0x163, "screen-height" ) ,
+	BI_FCODE_VALUE( 0x164, "screen-width" ) ,
+	BI_FCODE_VALUE( 0x165, "window-top" ) ,
+	BI_FCODE_VALUE( 0x166, "window-left" ) ,
+	BUILTIN_FCODE( 0x16a, "default-font" ) ,
+	BUILTIN_FCODE( 0x16b, "set-font" ) ,
+	BI_FCODE_VALUE( 0x16c, "char-height" ) ,
+	BI_FCODE_VALUE( 0x16d, "char-width" ) ,
+	BUILTIN_FCODE( 0x16e, ">font" ) ,
+	BI_FCODE_VALUE( 0x16f, "fontbytes" ) ,
+	OBSOLETE_FCODE( 0x170, "fb1-draw-character" ) ,
+	OBSOLETE_FCODE( 0x171, "fb1-reset-screen" ) ,
+	OBSOLETE_FCODE( 0x172, "fb1-toggle-cursor" ) ,
+	OBSOLETE_FCODE( 0x173, "fb1-erase-screen" ) ,
+	OBSOLETE_FCODE( 0x174, "fb1-blink-screen" ) ,
+	OBSOLETE_FCODE( 0x175, "fb1-invert-screen" ) ,
+	OBSOLETE_FCODE( 0x176, "fb1-insert-characters" ) ,
+	OBSOLETE_FCODE( 0x177, "fb1-delete-characters" ) ,
+	OBSOLETE_FCODE( 0x178, "fb1-insert-lines" ) ,
+	OBSOLETE_FCODE( 0x179, "fb1-delete-lines" ) ,
+	OBSOLETE_FCODE( 0x17a, "fb1-draw-logo" ) ,
+	OBSOLETE_FCODE( 0x17b, "fb1-install" ) ,
+	OBSOLETE_FCODE( 0x17c, "fb1-slide-up" ) ,
+	BUILTIN_FCODE( 0x180, "fb8-draw-character" ) ,
+	BUILTIN_FCODE( 0x181, "fb8-reset-screen" ) ,
+	BUILTIN_FCODE( 0x182, "fb8-toggle-cursor" ) ,
+	BUILTIN_FCODE( 0x183, "fb8-erase-screen" ) ,
+	BUILTIN_FCODE( 0x184, "fb8-blink-screen" ) ,
+	BUILTIN_FCODE( 0x185, "fb8-invert-screen" ) ,
+	BUILTIN_FCODE( 0x186, "fb8-insert-characters" ) ,
+	BUILTIN_FCODE( 0x187, "fb8-delete-characters" ) ,
+	BUILTIN_FCODE( 0x188, "fb8-insert-lines" ) ,
+	BUILTIN_FCODE( 0x189, "fb8-delete-lines" ) ,
+	BUILTIN_FCODE( 0x18a, "fb8-draw-logo" ) ,
+	BUILTIN_FCODE( 0x18b, "fb8-install" ) ,
+	OBSOLETE_FCODE( 0x1a0, "return-buffer" ) ,
+	OBSOLETE_FCODE( 0x1a1, "xmit-packet" ) ,
+	OBSOLETE_FCODE( 0x1a2, "poll-packet" ) ,
+	BUILTIN_FCODE( 0x1a4, "mac-address" ) ,
+	BUILTIN_FCODE( 0x201, "device-name" ) ,
+	BUILTIN_FCODE( 0x201, "name" ) ,   /*  Synonym for "device-name"  */
+	BUILTIN_FCODE( 0x202, "my-args" ) ,
+	BI_FCODE_VALUE( 0x203, "my-self" ) ,
+	BUILTIN_FCODE( 0x204, "find-package" ) ,
+	BUILTIN_FCODE( 0x205, "open-package" ) ,
+	BUILTIN_FCODE( 0x206, "close-package" ) ,
+	BUILTIN_FCODE( 0x207, "find-method" ) ,
+	BUILTIN_FCODE( 0x208, "call-package" ) ,
+	BUILTIN_FCODE( 0x209, "$call-parent" ) ,
+	BUILTIN_FCODE( 0x20a, "my-parent" ) ,
+	BUILTIN_FCODE( 0x20b, "ihandle>phandle" ) ,
+	BUILTIN_FCODE( 0x20d, "my-unit" ) ,
+	BUILTIN_FCODE( 0x20e, "$call-method" ) ,
+	BUILTIN_FCODE( 0x20f, "$open-package" ) ,
+	OBSOLETE_FCODE( 0x210, "processor-type" ) ,
+	OBSOLETE_FCODE( 0x211, "firmware-version" ) ,
+	OBSOLETE_FCODE( 0x212, "fcode-version" ) ,
+	BUILTIN_FCODE( 0x213, "alarm" ) ,
+	BUILTIN_FCODE( 0x214, "(is-user-word)" ) ,
+	BUILTIN_FCODE( 0x215, "suspend-fcode" ) ,
+	BUILTIN_FCODE( 0x216, "abort" ) ,
+	BUILTIN_FCODE( 0x217, "catch" ) ,
+	BUILTIN_FCODE( 0x218, "throw" ) ,
+	BUILTIN_FCODE( 0x219, "user-abort" ) ,
+	BUILTIN_FCODE( 0x21a, "get-my-property" ) ,
+	BUILTIN_FCODE( 0x21a, "get-my-attribute" ) ,   /*  Synonym for "get-my-property"  */
+	BUILTIN_FCODE( 0x21b, "decode-int" ) ,
+	BUILTIN_FCODE( 0x21b, "xdrtoint" ) ,   /*  Synonym for "decode-int"  */
+	BUILTIN_FCODE( 0x21c, "decode-string" ) ,
+	BUILTIN_FCODE( 0x21c, "xdrtostring" ), /* Synonym for "decode-string" */
+	BUILTIN_FCODE( 0x21d, "get-inherited-property" ) ,
+	BUILTIN_FCODE( 0x21d, "get-inherited-attribute" ) ,   /*  Synonym for "get-inherited-property"  */
+	BUILTIN_FCODE( 0x21e, "delete-property" ) ,
+	BUILTIN_FCODE( 0x21e, "delete-attribute" ) ,   /*  Synonym for "delete-property"  */
+	BUILTIN_FCODE( 0x21f, "get-package-property" ) ,
+	BUILTIN_FCODE( 0x21f, "get-package-attribute" ) ,   /*  Synonym for "get-package-property"  */
+	BUILTIN_FCODE( 0x220, "cpeek" ) ,
+	BUILTIN_FCODE( 0x221, "wpeek" ) ,
+	BUILTIN_FCODE( 0x222, "lpeek" ) ,
+	BUILTIN_FCODE( 0x223, "cpoke" ) ,
+	BUILTIN_FCODE( 0x224, "wpoke" ) ,
+	BUILTIN_FCODE( 0x225, "lpoke" ) ,
+	BUILTIN_FCODE( 0x226, "lwflip" ) ,
+	BUILTIN_FCODE( 0x227, "lbflip" ) ,
+	BUILTIN_FCODE( 0x228, "lbflips" ) ,
+	OBSOLETE_FCODE( 0x229, "adr-mask" ) ,
+	BUILTIN_FCODE( 0x230, "rb@" ) ,
+	BUILTIN_FCODE( 0x231, "rb!" ) ,
+	BUILTIN_FCODE( 0x232, "rw@" ) ,
+	BUILTIN_FCODE( 0x233, "rw!" ) ,
+	BUILTIN_FCODE( 0x234, "rl@" ) ,
+	BUILTIN_FCODE( 0x235, "rl!" ) ,
+	BUILTIN_FCODE( 0x236, "wbflips" ) ,
+	BUILTIN_FCODE( 0x236, "wflips" ) ,   /*  Synonym for "wbflips"  */
+	BUILTIN_FCODE( 0x237, "lwflips" ) ,
+	BUILTIN_FCODE( 0x237, "lflips" ) ,   /*  Synonym for "lwflips"  */
+	OBSOLETE_FCODE( 0x238, "probe" ) ,
+	OBSOLETE_FCODE( 0x239, "probe-virtual" ) ,
+	BUILTIN_FCODE( 0x23b, "child" ) ,
+	BUILTIN_FCODE( 0x23c, "peer" ) ,
+	BUILTIN_FCODE( 0x23d, "next-property" ) ,
+	BUILTIN_FCODE( 0x23e, "byte-load" ) ,
+	BUILTIN_FCODE( 0x23f, "set-args" ) ,
+	BUILTIN_FCODE( 0x240, "left-parse-string" ) ,
 
 	/* FCodes from 64bit extension addendum */
-	add_token( 0x22e, "rx@" );
-	add_token( 0x22f, "rx!" );
-	add_token( 0x241, "bxjoin" );
-	add_token( 0x242, "<l@" );
-	add_token( 0x243, "lxjoin" );
-	add_token( 0x244, "wxjoin" );
-	add_token( 0x245, "x," );
-	add_token( 0x246, "x@" );
-	add_token( 0x247, "x!" );
-	add_token( 0x248, "/x" );
-	add_token( 0x249, "/x*" );
-	add_token( 0x24a, "xa+" );
-	add_token( 0x24b, "xa1+" );
-	add_token( 0x24c, "xbflip" );
-	add_token( 0x24d, "xbflips" );
-	add_token( 0x24e, "xbsplit" );
-	add_token( 0x24f, "xlflip" );
-	add_token( 0x250, "xlflips" );
-	add_token( 0x251, "xlsplit" );
-	add_token( 0x252, "xwflip" );
-	add_token( 0x253, "xwflips" );
-	add_token( 0x254, "xwsplit" );
-
-	add_special(COLON, 	":");
-	add_special(SEMICOLON, 	";");
-	add_special(TOKENIZE, 	"'");
-	add_special(AGAIN, 	"again");
-	add_special(ALIAS, 	"alias");
-	add_special(GETTOKEN, 	"[']");
-	add_special(ASCII, 	"ascii");
-	add_special(BEGIN, 	"begin");
-	add_special(BUFFER, 	"buffer:");
-	add_special(CASE, 	"case");
-	add_special(CONST, 	"constant");
-	add_special(CONTROL, 	"control");
-	add_special(CREATE, 	"create");
-	add_special(DECIMAL, 	"decimal");
-	add_special(DEFER, 	"defer");
-	add_special(CDO, 	"?do");
-	add_special(DO, 	"do");
-	add_special(ELSE, 	"else");
-	add_special(ENDCASE, 	"endcase");
-	add_special(ENDOF, 	"endof");
-	add_special(EXTERNAL, 	"external");
-	add_special(FIELD, 	"field");
-	add_special(HEADERLESS, "headerless");
-	add_special(HEADERS, 	"headers");
-	add_special(HEX, 	"hex");
-	add_special(IF, 	"if");
-	add_special(CLEAVE, 	"?leave");
-	add_special(LEAVE, 	"leave");
-	add_special(CLOOP, 	"+loop");
-	add_special(LOOP, 	"loop");
-	add_special(OCTAL,	"octal");
-	add_special(OF,		"of");
-	add_special(REPEAT,	"repeat");
-	add_special(THEN,	"then");
-	add_special(TO,		"to");
-	add_special(UNTIL,	"until");
-	add_special(VALUE,	"value");
-	add_special(VARIABLE,	"variable");
-	add_special(WHILE,	"while");
-	add_special(OFFSET16,	"offset16");
-	add_special(BEGINTOK,	"tokenizer[");
-	add_special(EMITBYTE,	"emit-byte");
-	add_special(ENDTOK,	"]tokenizer");
-	add_special(FLOAD,	"fload");
-	add_special(STRING,	"\"");
-	add_special(PSTRING,	".\"");
-	add_special(PBSTRING,	".(");
-	add_special(SSTRING,	"s\"");
-	add_special(RECURSIVE,	"recursive");
-	add_special(NEXTFCODE,	"next-fcode");
+	BUILTIN_FCODE( 0x22e, "rx@" ) ,
+	BUILTIN_FCODE( 0x22f, "rx!" ) ,
+	BUILTIN_FCODE( 0x241, "bxjoin" ) ,
+	BUILTIN_FCODE( 0x242, "<l@" ) ,
+	BUILTIN_FCODE( 0x243, "lxjoin" ) ,
+	BUILTIN_FCODE( 0x244, "wxjoin" ) ,
+	BUILTIN_FCODE( 0x245, "x," ) ,
+	BUILTIN_FCODE( 0x246, "x@" ) ,
+	BUILTIN_FCODE( 0x247, "x!" ) ,
+	BUILTIN_FCODE( 0x248, "/x" ) ,
+	BUILTIN_FCODE( 0x249, "/x*" ) ,
+	BUILTIN_FCODE( 0x24a, "xa+" ) ,
+	BUILTIN_FCODE( 0x24b, "xa1+" ) ,
+	BUILTIN_FCODE( 0x24c, "xbflip" ) ,
+	BUILTIN_FCODE( 0x24d, "xbflips" ) ,
+	BUILTIN_FCODE( 0x24e, "xbsplit" ) ,
+	BUILTIN_FCODE( 0x24f, "xlflip" ) ,
+	BUILTIN_FCODE( 0x250, "xlflips" ) ,
+	BUILTIN_FCODE( 0x251, "xlsplit" ) ,
+	BUILTIN_FCODE( 0x252, "xwflip" ) ,
+	BUILTIN_FCODE( 0x253, "xwflips" ) ,
+	BUILTIN_FCODE( 0x254, "xwsplit" )
+};
+
+static const int number_of_builtin_tokens =
+	 sizeof(tokens_table)/sizeof(tic_hdr_t);
+
+/* **************************************************************************
+ *
+ *      Support functions specific to the FCode-Tokens list.
+ *
+ **************************************************************************** */
+
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_token
+ *      Synopsis:       Emit the FCode token for the given FCode name.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             fc_name                     The name of the FCode
+ *         Local Static Variables:
+ *             fc_tokens_list_start        "Tail" of the "FC-Tokens" list
+ *
+ *      Outputs:
+ *         Returned Value:                 NONE
+ *
+ *      Error Detection:
+ *          This routine should only be called with hard-coded names from
+ *              within the program.  If the given name is not found in
+ *              the Built-in Tokens Table, that is a FATAL error.
+ *
+ *      Process Explanation:
+ *          Because the "FCode-Tokens" table was linked first, and the
+ *              pointer kept for this purpose, the "FC-Tokens" list can
+ *              be a subset of the "core" list, yet, when necessary, can
+ *              be searched with the same routines.
+ *
+ *      Extraneous Remarks:
+ *          I will bend the strict rules of well-structured code;
+ *              the exception case should never occur.
+ *
+ **************************************************************************** */
+
+void emit_token( const char *fc_name)
+{
+
+    if ( handle_tic_vocab( (char *)fc_name, fc_tokens_list_start) )
+    {
+        return;
+    }
+
+    tokenization_error( FATAL, "Did not recognize FCode name %s", fc_name);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  lookup_token
+ *      Synopsis:       Return a pointer to the data-structure of the named
+ *                      word in the "FC-Tokens" list
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                       The name to look up
+ *         Local Static Variables:
+ *             fc_tokens_list_start        "Tail" of the "FC-Tokens" list
+ *
+ *      Outputs:
+ *         Returned Value:                Pointer to the data-structure, or
+ *                                            NULL if not found.
+ *
+ **************************************************************************** */
+
+tic_hdr_t *lookup_token( char *tname)
+{
+    tic_hdr_t *found ;
+
+    found = lookup_tic_entry( tname, fc_tokens_list_start);
+    return ( found ) ;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  entry_is_token
+ *      Synopsis:       Indicate whether the supplied pointer to a tic_hdr_t
+ *                      data-structure is one for which a single-token FCode
+ *                      number is assigned.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             test_entry                The entry to test; may be NULL
+ *         Local macros:
+ *             FC_TOKEN_FUNC             The function associated with
+ *                                           most single-token entries.
+ *             OBSO_FC_FUNC              The function associated with
+ *                                           "obsolete" FCode tokens.
+ *
+ *      Outputs:
+ *         Returned Value:               TRUE if the data-structure is
+ *                                           a single-token entry.
+ *
+ *      Process Explanation:
+ *          We cannot rely on the "definer" field to indicate whether
+ *              it is a single-token entry; instead, we will look at
+ *              the associated function.
+ *          Keep this routine here to avoid needing to export the names
+ *              of the permitted functions or their synonymous macros.
+ *              If we ever need to change it, we can do so at a single
+ *              point of maintenance.
+ *          Because the entry might have been found in the initial list
+ *              of entries to the "FCode-Tokens" list, we need to check
+ *              whether the associated function is either the general
+ *              single-token emitting function,  FC_TOKEN_FUNC , or the
+ *              function  OBSO_FC_FUNC , which presents a message before
+ *              emitting, but is still a valid single-token function.
+ *
+ **************************************************************************** */
+
+bool entry_is_token( tic_hdr_t *test_entry )
+{
+    bool retval = FALSE;
+    if ( test_entry != NULL )
+    {
+	if ( ( test_entry->funct == FC_TOKEN_FUNC )  ||
+	     ( test_entry->funct ==  OBSO_FC_FUNC )  )
+	{
+	    retval = TRUE;
+	}
+    }
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  token_entry_warning
+ *      Synopsis:       Issue whatever warnings the given token_entry
+ *                      requires.  F['] needs this.
+ *      Inputs:
+ *         Parameters:
+ *             test_entry                The entry to test; may be NULL
+ *         Local macro:
+ *             OBSO_FC_FUNC              The function associated with
+ *                                           "obsolete" entries.
+ *      Outputs:
+ *         Returned Value:               NONE
+ *
+ *      Error Detection:
+ *          Warnings required by the given token_entry.
+ *
+ *      Extraneous Remarks:
+ *          At present, it's only the "Obsolete" warning.
+ *          But this is the place to add others, 
+ *              should they become necessary.
+ *
+ **************************************************************************** */
+
+void token_entry_warning( tic_hdr_t *t_entry)
+{
+    if ( t_entry->funct == OBSO_FC_FUNC )
+    {
+	obsolete_warning();
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      Create the initial "FWords" list.
+ *
+ **************************************************************************** */
+
+static tic_fwt_hdr_t fwords_list[] = {
+
+	BI_FWD_SKP_OW(COLON,	 	":") ,
+	BUILTIN_FWORD(SEMICOLON, 	";") ,
+	BI_FWD_SKP_OW(TICK, 		"'") ,
+	BUILTIN_FWORD(AGAIN, 		"again") ,
+	BI_FWD_SKP_OW(BRACK_TICK,  	 "[']") ,
+	BI_FWD_SKP_OW(ASCII,		"ascii") ,
+	BUILTIN_FWORD(BEGIN,		"begin") ,
+	BI_FWD_SKP_OW(BUFFER,		"buffer:") ,
+	BUILTIN_FWORD(CASE,		"case") ,
+	BI_FWD_SKP_OW(CONST,		"constant") ,
+	BI_FWD_SKP_OW(CONTROL,		"control") ,
+	BI_FWD_SKP_OW(CREATE,		"create") ,
+
+	BI_FWD_SKP_OW(DEFER,		"defer") ,
+	BUILTIN_FWORD(CDO,		"?do") ,
+	BUILTIN_FWORD(DO,		"do") ,
+	BUILTIN_FWORD(ELSE,		"else") ,
+	BUILTIN_FWORD(ENDCASE,		"endcase") ,
+	BUILTIN_FWORD(ENDOF,		"endof") ,
+	BUILTIN_FWORD(EXTERNAL, 	"external") ,
+	BI_FWD_SKP_OW(FIELD,		"field") ,
+	BUILTIN_FWORD(FINISH_DEVICE,	"finish-device" ) ,
+	BUILTIN_FWORD(HEADERLESS,	"headerless") ,
+	BUILTIN_FWORD(HEADERS,		"headers") ,
+
+	BUILTIN_FWORD(INSTANCE ,	"instance") ,
+
+	BUILTIN_FWORD(IF,		"if") ,
+	BUILTIN_FWORD(UNLOOP,		"unloop") ,
+	BUILTIN_FWORD(LEAVE,		"leave") ,
+	BUILTIN_FWORD(PLUS_LOOP, 	"+loop") ,
+	BUILTIN_FWORD(LOOP,		"loop") ,
+
+	BUILTIN_FWORD(OF,		"of") ,
+	BUILTIN_FWORD(REPEAT,		"repeat") ,
+	BUILTIN_FWORD(THEN,		"then") ,
+	BI_FWD_SKP_OW(TO,		"to") ,
+	BI_FWD_SKP_OW(IS,		"is") , /*  Deprecated synonym to TO  */
+	BUILTIN_FWORD(UNTIL,		"until") ,
+	BI_FWD_SKP_OW(VALUE,		"value") ,
+	BI_FWD_SKP_OW(VARIABLE,		"variable") ,
+	BUILTIN_FWORD(WHILE,		"while") ,
+	BUILTIN_FWORD(OFFSET16,		"offset16") ,
+
+	BI_FWD_STRING(STRING,		"\"") ,     /*  XXXXX  */
+	BI_FWD_STRING(PSTRING,		".\"") ,    /*  XXXXX  */
+	BI_FWD_STRING(PBSTRING,		".(") ,     /*  XXXXX  */
+	BI_FWD_STRING(SSTRING,		"s\"") ,    /*  XXXXX  */
+	BUILTIN_FWORD(IFILE_NAME,	"[input-file-name]"),
+	BUILTIN_FWORD(ILINE_NUM,	"[line-number]"),
+	BUILTIN_FWORD(RECURSE,		"recurse") ,
+	BUILTIN_FWORD(RECURSIVE,	"recursive") ,
+	BUILTIN_FWORD(RET_STK_FETCH,	"r@") ,
+	BUILTIN_FWORD(RET_STK_FROM,	"r>") ,
+	BUILTIN_FWORD(RET_STK_TO,	">r") ,
+	BUILTIN_FWORD(THEN,		"endif" ) ,  /*  Synonym for "then"  */
+	BUILTIN_FWORD(NEW_DEVICE,	"new-device" ) ,
+	BUILTIN_FWORD(LOOP_I,		"i") ,
+	BUILTIN_FWORD(LOOP_J,		"j") ,
 	/* version1 is also an fcode word, but it 
 	 * needs to trigger some tokenizer internals */
-	add_special(VERSION1,	"version1");
-	add_special(START0,	"start0");
-	add_special(START1,	"start1");
-	add_special(START2,	"start2");
-	add_special(START4,	"start4");
-	add_special(END0,	"end0");
-	add_special(END1,	"end1");
-	add_special(FCODE_V1,	"fcode-version1");
-	add_special(FCODE_V2,	"fcode-version2");
-	add_special(FCODE_V3,	"fcode-version3");
-	add_special(FCODE_END,	"fcode-end");
-	add_special(FCODE_DATE,	"fcode-date");
-	add_special(FCODE_TIME,	"fcode-time");
-	
-	add_special(HEXVAL,	"h#");
-	add_special(DECVAL,	"d#");
-	add_special(OCTVAL,	"o#");
-	add_special(CHAR,	"char");
-	add_special(CCHAR,	"[char]");
-	add_special(ABORTTXT,   "abort\"");
-
-	add_special(ENCODEFILE,	"encode-file");
+	BUILTIN_FWORD(VERSION1,		"version1") ,
+	BUILTIN_FWORD(START0,		"start0") ,
+	BUILTIN_FWORD(START1,		"start1") ,
+	BUILTIN_FWORD(START2,		"start2") ,
+	BUILTIN_FWORD(START4,		"start4") ,
+	BUILTIN_FWORD(END0,		"end0") ,
+	BUILTIN_FWORD(END1,		"end1") ,
+	BUILTIN_FWORD(FCODE_V1,		"fcode-version1") ,
+	BUILTIN_FWORD(FCODE_V2,		"fcode-version2") ,
+	BUILTIN_FWORD(FCODE_V3,		"fcode-version3") ,
+	BUILTIN_FWORD(FCODE_END,	"fcode-end") ,
+
+        /*  Support for IBM-style Locals  */
+	BI_FWD_STRING(CURLY_BRACE,	"{") ,
+	BI_FWD_STRING(DASH_ARROW,	"->") ,
+	BUILTIN_FWORD(EXIT,		"exit") ,
+
+
+	BUILTIN_FWORD(CHAR,		"char") ,
+	BUILTIN_FWORD(CCHAR,		"[char]") ,
+	BI_FWD_STRING(ABORTTXT,		"abort\"") ,
+
+	BUILTIN_FWORD(ENCODEFILE,	"encode-file") ,
+
+	BI_IG_FW_HDLR(ESCAPETOK,	"tokenizer[") ,
+	BI_IG_FW_HDLR(ESCAPETOK,	"f[") ,       /*  An IBM-ish synonym  */
+};
+
+static const int number_of_builtin_fwords =
+	 sizeof(fwords_list)/sizeof(tic_hdr_t);
+
+/* **************************************************************************
+ *
+ *      Create the initial list of "Shared_Words" (words that can
+ *          be executed similarly both during normal tokenization,
+ *          and also within "Tokenizer Escape Mode").
+ *
+ **************************************************************************** */
+
+static tic_fwt_hdr_t shared_words_list[] = {
+	SHARED_FWORD(FLOAD,		"fload") ,
+	/*  As does the "Allow Multi-Line" directive   */
+	SHR_SAMIG_FWRD(ALLOW_MULTI_LINE, "multi-line") ,
+
+	SHR_FWD_SKOW( F_BRACK_TICK,	 "f[']") ,
+
+	SH_FW_SK2WIL(ALIAS, 		"alias") ,
+	SHARED_FWORD(DECIMAL,		"decimal") ,
+	SHARED_FWORD(HEX,		"hex") ,
+	SHARED_FWORD(OCTAL,		"octal") ,
+	SH_FW_SK_WIL(HEXVAL,		"h#") ,
+	SH_FW_SK_WIL(DECVAL,		"d#") ,
+	SH_FW_SK_WIL(OCTVAL,		"o#") ,
+
+	SH_FW_SK_WIL(ASC_NUM,		"a#") ,
+	SH_FW_SK_WIL(ASC_LEFT_NUM,	"al#") ,
+
+	/* IBM-style extension.  Might be generalizable...  */
+	SHARED_FWORD(FLITERAL, 	"fliteral") ,
+
+	/*  Directives to extract the value of a Command-Line symbol */
+	SH_FW_SK_WIL(DEFINED,		"[defined]") ,
+	SH_FW_SK_WIL(DEFINED,		"#defined") ,
+	SH_FW_SK_WIL(DEFINED,		"[#defined]") ,
+
+	/*  Present the current date or time, either as an  */
+	/*  in-line string or as a user-generated message.  */
+	SHARED_FWORD(FCODE_DATE,	"[fcode-date]") ,
+	SHARED_FWORD(FCODE_TIME,	"[fcode-time]") ,
+
+	/*  Current definition under construction, similarly  */
+	SHARED_FWORD(FUNC_NAME,	"[function-name]"),
+
+	/*  Synonymous forms of the #ELSE and #THEN operators,
+	 *      associated with Conditional-Compilation,
+	 *      allowing for various syntax-styles, and for
+	 *      expansion by alias.
+	 */
+
+	/*  #ELSE  operators */
+	SHARED_FWORD(CONDL_ELSE,	"#else") ,
+	SHARED_FWORD(CONDL_ELSE,	"[else]") ,
+	SHARED_FWORD(CONDL_ELSE,	"[#else]") ,
+
+	/*  #THEN  operators */
+	SHARED_FWORD(CONDL_ENDER,	"#then") ,
+	SHARED_FWORD(CONDL_ENDER,	"[then]") ,
+	SHARED_FWORD(CONDL_ENDER,	"[#then]") ,
+	/*   #ENDIF variants for users who favor C-style notation   */
+	SHARED_FWORD(CONDL_ENDER,	"#endif") ,
+	SHARED_FWORD(CONDL_ENDER,	"[endif]") ,
+	SHARED_FWORD(CONDL_ENDER,	"[#endif]") ,
+
+
+	SHARED_FWORD(OVERLOAD,  "overload" ) ,
+
+	SHARED_FWORD(GLOB_SCOPE , "global-definitions" ) ,
+	SHARED_FWORD(DEV_SCOPE , "device-definitions" ) ,
+
+	/*  Directives to change a command-line flag value from source   */
+	SH_FW_SK_WIL(CL_FLAG,	"[FLAG]") ,
+	SH_FW_SK_WIL(CL_FLAG,	"#FLAG") ,
+	SH_FW_SK_WIL(CL_FLAG,	"[#FLAG]") ,
+
+	/*  Directives to force display of a command-line flags' values   */
+	SHARED_FWORD(SHOW_CL_FLAGS,	"[FLAGS]") ,
+	SHARED_FWORD(SHOW_CL_FLAGS,	"#FLAGS") ,
+	SHARED_FWORD(SHOW_CL_FLAGS,	"[#FLAGS]") ,
+	SHARED_FWORD(SHOW_CL_FLAGS,	"SHOW-FLAGS") ,
+
+	/*  Directives to save and retrieve the FCode Assignment number  */
+	SHARED_FWORD(PUSH_FCODE,	"FCODE-PUSH") ,
+	SHARED_FWORD(POP_FCODE, 	"FCODE-POP") ,
+
+	/*  Directive to reset the FCode Assignment number and
+	 *      re-initialize FCode Range overlap checking.
+	 */
+	SHARED_FWORD(RESET_FCODE,	"FCODE-RESET") ,
 
 	/* pci header generation is done differently 
 	 * across the available tokenizers. We try to
 	 * be compatible to all of them
 	 */
-	add_special(PCIHDR,	"pci-header");
-	add_special(PCIEND,	"pci-end");            /* SUN syntax */
-	add_special(PCIEND,	"pci-header-end");     /* Firmworks syntax */
-	add_special(PCIREV,	"pci-revision");       /* SUN syntax */
-	add_special(PCIREV,	"pci-code-revision");  /* SUN syntax */
-	add_special(PCIREV,	"set-rev-level");      /* Firmworks syntax */
-	add_special(NOTLAST,	"not-last-image");
+	SHARED_FWORD(PCIHDR,	  "pci-header") ,
+	SHARED_FWORD(PCIEND,	  "pci-end") ,           /* SUN syntax */
+	SHARED_FWORD(PCIEND,	  "pci-header-end") ,    /* Firmworks syntax */
+	SHARED_FWORD(PCIREV,	  "pci-revision") ,      /* SUN syntax */
+	SHARED_FWORD(PCIREV,	  "pci-code-revision") , /* SUN syntax */
+	SHARED_FWORD(PCIREV,	  "set-rev-level") ,     /* Firmworks syntax */
+	SHARED_FWORD(NOTLAST,	  "not-last-image") ,
+	SHARED_FWORD(NOTLAST,	  "not-last-img") ,      /* Shorthand form  */
+	SHARED_FWORD(ISLAST,	  "last-image") ,
+	SHARED_FWORD(ISLAST,	  "last-img") ,          /* Shorthand form  */
+	SHARED_FWORD(SETLAST,	  "set-last-image") ,
+	SHARED_FWORD(SETLAST,	  "set-last-img") ,      /* Shorthand form  */
+
+	SH_FW_SK_WIL(SAVEIMG,	  "save-image") ,
+	SH_FW_SK_WIL(SAVEIMG,	  "save-img") ,          /* Shorthand form  */
+
+	SHARED_FWORD(RESETSYMBS,  "reset-symbols") ,
+
+	/*  User-Macro definers    */
+	SHARED_IG_HDLR("[MACRO]", add_user_macro,  0 ,  skip_user_macro) ,
+
+	/*  Comments and Remarks   */
+	SHARED_IG_HDLR("\\",      process_remark, '\n', process_remark) ,
+	SHARED_IG_HDLR("(",       process_remark, ')',  process_remark) ,
+
+	/*  Directives to print or discard a user-generated message */
+	SHARED_IG_HDLR("[MESSAGE]",  user_message, '\n', skip_user_message) ,
+	SHARED_IG_HDLR("#MESSAGE",   user_message, '\n', skip_user_message) ,
+	SHARED_IG_HDLR("[#MESSAGE]", user_message, '\n', skip_user_message) ,
+	SHARED_IG_HDLR("#MESSAGE\"", user_message, '"' , skip_user_message) ,
+};
+
+static const int number_of_shared_words =
+	sizeof(shared_words_list)/sizeof(tic_hdr_t);
+
+/* **************************************************************************
+ *
+ *      Function name:  lookup_shared_word
+ *      Synopsis:       Return a pointer to the data-structure of the named
+ *                      word, only if it is a "Shared Word"
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                     The name to look for
+ *         Local Static Variables:
+ *             global_voc_dict_ptr       "Tail" of Global Vocabulary
+ *
+ *      Outputs:
+ *         Returned Value:                Pointer to the data-structure, or
+ *                                            NULL if not found.
+ *
+ *      Process Explanation:
+ *          The "Shared Words" are scattered among the Global Vocabulary;
+ *              the user is allowed to create aliases, which may be in the
+ *              Current-Device.  We will search through the "current" scope
+ *              and decide whether the name we found is a "Shared Word" by
+ *              looking for  COMMON_FWORD  in the "definer" field.
+ *
+ *      Extraneous Remarks:
+ *          This is the only place where an additional check of the
+ *              "definer" field is required to identify a desired entry.
+ *              Should another "definer"-type be required, I recommend 
+ *              defining a general-purpose function in  ticvocab.c  and
+ *              applying it here and in the other place(s).
+ *
+ **************************************************************************** */
+ 
+tic_hdr_t *lookup_shared_word( char *tname)
+{
+    tic_hdr_t *found ;
+    tic_hdr_t *retval = NULL ;
+
+    found = lookup_current( tname );
+    if ( found != NULL )
+    {
+	if ( found->fword_defr == COMMON_FWORD )
+	{
+	    retval = found ;
+	}
+    }
+
+    return ( retval );
+
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  handle_shared_word
+ *      Synopsis:       Perform the function associated with the given name
+ *                      only if it is a "Shared Word".  Indicate if it was.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                The "target" name for which to look
+ *
+ *      Outputs:
+ *         Returned Value:          TRUE if the name is a valid "Shared Word"
+ *
+ *      Extraneous Remarks:
+ *          This is very similar to a call to  handle_tic_vocab() except
+ *              for the additional filtering for a "Shared Word" definer.
+ *
+ **************************************************************************** */
+
+bool handle_shared_word( char *tname )
+{
+    tic_hdr_t *found ;
+    bool retval = FALSE;
+    
+    found = lookup_shared_word( tname );
+    if ( found != NULL )
+    {
+        found->funct(found->pfield);
+	retval = TRUE;
+    }
+
+    return ( retval ) ;
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  lookup_shared_f_exec_word
+ *      Synopsis:       Return a pointer to the data-structure of the named
+ *                      word, only if it is a "Shared F-Exec Word"
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                     The name to look for
+ *         Local Static Variables:
+ *             global_voc_dict_ptr       "Tail" of Global Vocabulary
+ *         Macro Definitions:
+ *             FWORD_EXEC_FUNC           The "Active" function of the
+ *                                           sub-class of "Shared Word"s
+ *                                           that is the object of this
+ *                                           routine's search
+ *
+ *      Outputs:
+ *         Returned Value:                Pointer to the data-structure, or
+ *                                            NULL if not found.
+ *
+ *      Process Explanation:
+ *          The "Shared F-Exec Words" are the subset of "Shared Words" that
+ *              have the  FWORD_EXEC_FUNC  as their "Active" function.
+ *
+ *      Extraneous Remarks:
+ *          This is the only routine that requires a check of two fields;
+ *              it seems unlikely that there will be any need to generalize
+ *              the core of this routine...
+ *
+ **************************************************************************** */
+ 
+tic_hdr_t *lookup_shared_f_exec_word( char *tname)
+{
+    tic_hdr_t *found ;
+    tic_hdr_t *retval = NULL ;
+
+    found = lookup_shared_word( tname );
+    if ( found != NULL )
+    {
+	if ( found->funct == FWORD_EXEC_FUNC )
+	{
+	    retval = found ;
+	}
+    }
+
+    return ( retval );
+
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  init_dictionary
+ *      Synopsis:       Initialize all the vocabularies.  For the Global
+ *                      Vocabulary, fill in the link fields in each of the
+ *                      otherwise pre-initialized built-in lists, link the
+ *                      lists together, and set the relevant pointers.   For
+ *                      other lists, call their initialization routines.
+ *
+ *      Inputs:
+ *         Parameters:                         NONE
+ *         Global Variables:
+ *         Local Static Variables:
+ *             tokens_table                    Base of the "FC-Tokens" list
+ *             number_of_builtin_tokens        Number of "FC-Token" entries
+ *             fwords_list                     Base of the "FWords" list
+ *             number_of_builtin_fwords        Number of "FWord" entries
+ *             shared_words_list               Base of the "Shared Words" list
+ *             number_of_shared_words          Number of "Shared Words" entries
+ *
+ *      Outputs:
+ *         Returned Value:                      NONE
+ *         Local Static Variables:
+ *             global_voc_dict_ptr              "Tail" of Global Vocabulary
+ *             fc_tokens_list_start             "Tail" of "FC-Tokens" list
+ *             fc_tokens_list_ender             End of "FC-Tokens" search
+ *             shared_fwords_ender              End of Shared Words" search
+ *             global_voc_reset_ptr             Reset-point for Global Vocab
+ *
+ *      Process Explanation:
+ *          The first linked will be the last searched.
+ *              Link the "FC-Tokens" first, and mark their limits
+ *              Link the "FWords" next,
+ *              Mark the end-limit of the "Shared Words", and link them
+ *              The "Conditionals", defined in another file, are also "Shared";
+ *                  link them next.
+ *              Then link the Built-In Macros, also defined in another file.
+ *          These constitute the Global Vocabulary.
+ *              Mark the reset-point for the Global Vocabulary.
+ *          The "Tokenizer Escape" mode vocabulary is not linked to the Global
+ *              Vocabulary; call its initialization routine.
+ *
+ *      Extraneous Remarks:
+ *          I only wish I had done this sooner...
+ *
+ **************************************************************************** */
+
+void init_dictionary( void )
+{
+
+    global_voc_dict_ptr  = NULL;   /*  Belt-and-suspenders...  */
+
+    /*  The "FC-Tokens" list must be linked first.  */
+    fc_tokens_list_ender = global_voc_dict_ptr;
+    init_tic_vocab( tokens_table,
+                	number_of_builtin_tokens,
+                            &global_voc_dict_ptr ) ;
+    fc_tokens_list_start = global_voc_dict_ptr;
+
+    /*  Link the "FWords" next */
+   init_tic_vocab( (tic_hdr_t *)fwords_list,
+                        number_of_builtin_fwords,
+                            &global_voc_dict_ptr ) ;
+
+    /*  Mark the end-limit of the "Shared Words", and link them. */
+    shared_fwords_ender = global_voc_dict_ptr;
+    init_tic_vocab( (tic_hdr_t *)shared_words_list,
+                	number_of_shared_words,
+                            &global_voc_dict_ptr ) ;
+
+    /*  Link the "Conditionals" to the Global Vocabulary.  */
+    init_conditionals_vocab( &global_voc_dict_ptr ) ;
+
+    /*  Link the Built-In Macros */
+    init_macros( &global_voc_dict_ptr ) ;
+
+    /*  Mark the reset-point for the Global Vocabulary.  */
+    global_voc_reset_ptr = global_voc_dict_ptr;
+
+    /*   Initialize the "Tokenizer Escape" mode vocabulary  */
+    init_tokz_esc_vocab();
+
+    /*   Locals and Device-Node vocabularies are initially empty  */
+
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  reset_normal_vocabs
+ *      Synopsis:       Reset the vocabularies that were created in "Normal"
+ *                          (as distinguished from "Tokenizer Escape") mode
+ *                          to the proper state for a fresh tokenization.
+ *
+ *      Associated FORTH words:              END0  END1
+ *      Associated Tokenizer directives:     RESET-SYMBOLS  (in "Normal" mode)
+ *                                           FCODE-END
+ *
+ *      Inputs:
+ *         Parameters:                NONE
+ *         Global Variables:
+ *             global_voc_reset_ptr       Position to which to reset
+ *                                            the "Global" Vocabulary
+ *             current_device_node        Vocab struct of current dev-node
+ *
+ *      Outputs:
+ *         Returned Value:            NONE
+ *         Global Variables:    
+ *             global_voc_dict_ptr       Reset to "Built-In" position 
+ *             current_device_node       Reset to point at "root" dev-node
+ *         Memory Freed
+ *             All memory allocated by user-definitions in "normal" mode
+ *             -- Macros, Conditionals and Device-node Vocabularies -- are
+ *             reset via function call.
+ *
+ *      Error Detection:
+ *          Presence of extra device-node data structure(s) indicates that
+ *              there were more "new-device" calls than "finish-device";
+ *              report each as an ERROR 
+ *
+ *      Process Explanation:
+ *          Vocabularies created in other files, that have different
+ *              data-structures, will have "reset" routines of their
+ *              own associated with them in the files in which they
+ *              are created.  Those routines will be called from here.
+ *          Definitions in the "Tokenizer Escape Vocabulary", i.e.,
+ *              the one in effect in "Tokenizer Escape" mode, are
+ *              specifically not touched by this routine.
+ *
+ **************************************************************************** */
+
+void reset_normal_vocabs( void )
+{
+    reset_tic_vocab( &global_voc_dict_ptr, global_voc_reset_ptr );
+
+    /*  Delete the top-level device-node vocab.
+     *      If there are extra device-nodes,
+     *      delete their data structures and show errors
+     */
+    do
+    {
+        if ( current_device_node->parent_node != NULL )
+	{
+	    tokenization_error( TKERROR,
+		 "Missing FINISH-DEVICE for new device");
+	    started_at( current_device_node->ifile_name,
+		 current_device_node->line_no );
+	}
+	    delete_device_vocab();
+    }  while ( current_device_node->parent_node != NULL );
+
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  reset_vocabs
+ *      Synopsis:       Reset all the vocabularies to the proper state
+ *                      for beginning a fresh tokenization, particularly
+ *                      when multiple files are named on the command-line
+ *      
+ *      Inputs:
+ *         Parameters:                NONE
+ *
+ *      Outputs:
+ *         Returned Value:            NONE
+ *         Memory Freed
+ *             All memory allocated by user-definitions will be freed
+ *
+ *      Process Explanation:
+ *          Call the  reset_normal_vocabs()  routine to get the vocabularies
+ *              that apply to "Normal" mode, then call the "reset" routine
+ *              for the "Tokenizer Escape Vocabulary", which is supposed
+ *              to persist across device-nodes but not across input-files
+ *              named on the command-line.
+ *
+ **************************************************************************** */
+
+void reset_vocabs( void )
+{
+    reset_normal_vocabs();
+    reset_tokz_esc();
 }
diff --git a/toke/dictionary.h b/toke/dictionary.h
index 3a0c0e7..3d01873 100644
--- a/toke/dictionary.h
+++ b/toke/dictionary.h
@@ -1,3 +1,6 @@
+#ifndef _TOKE_DICTIONARY_H
+#define _TOKE_DICTIONARY_H
+
 /*
  *                     OpenBIOS - free your system! 
  *                         ( FCode tokenizer )
@@ -24,81 +27,152 @@
  *
  */
 
-#define COLON		0x01
-#define SEMICOLON	0x02
-#define TOKENIZE	0x03
-#define AGAIN		0x04
-#define ALIAS		0x05
-#define GETTOKEN 	0x06
-#define ASCII		0x07
-#define BEGIN		0x08
-#define BUFFER		0x09
-#define CASE		0x0a
-#define CONST		0x0b
-#define CONTROL		0x0c
-#define CREATE		0x0d
-#define DECIMAL		0x0e
-#define DEFER		0x0f
-#define CDO		0x10
-#define DO		0x11
-#define ELSE		0x12
-#define ENDCASE		0x13
-#define ENDOF		0x14
-#define EXTERNAL	0x15
-#define FIELD		0x16
-#define HEADERLESS	0x17
-#define HEADERS		0x18
-#define HEX		0x19
-#define IF		0x1a
-#define CLEAVE		0x1b
-#define LEAVE		0x1c
-#define CLOOP		0x1d
-#define LOOP		0x1e
-#define OCTAL		0x1f
-#define OF		0x20
-#define REPEAT		0x21
-#define THEN		0x22
-#define TO		0x23
-#define UNTIL		0x24
-#define VALUE		0x25
-#define VARIABLE	0x26	
-#define WHILE		0x27
-#define OFFSET16	0x28	
-#define BEGINTOK	0x29	
-#define EMITBYTE	0x2a	
-#define ENDTOK		0x2b
-#define FLOAD		0x2c
-#define STRING		0x2d
-#define PSTRING		0x2e
-#define PBSTRING	0x2f
-#define SSTRING		0x30
-#define RECURSIVE	0x31
-#define HEXVAL		0x32
-#define DECVAL		0x33
-#define OCTVAL		0x34
-
-#define END0		0xdb
-#define END1		0xdc
-#define CHAR		0xdd
-#define CCHAR		0xde
-#define ABORTTXT	0xdf
-
-#define NEXTFCODE	0xef
-
-#define ENCODEFILE	0xf0
-
-#define FCODE_V1	0xf1
-#define FCODE_V3	0xf2
-#define NOTLAST		0xf3
-#define PCIREV		0xf4
-#define PCIHDR		0xf5
-#define PCIEND		0xf6
-#define START0		0xf7
-#define START1		0xf8
-#define START2		0xf9
-#define START4		0xfa
-#define VERSION1	0xfb
-#define FCODE_TIME	0xfc
-#define FCODE_DATE	0xfd
-#define FCODE_V2	0xfe
-#define FCODE_END	0xff
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Numeric values for FWord-type vocabulary entries.  Used by the
+ *          big "switch" statement in handle_internal(); a subset are 
+ *          also used as "definer-type" values associated with various
+ *          types of definitions.
+ *
+ **************************************************************************** */
+
+typedef enum fword_token {
+      UNSPECIFIED  = 0xBAADD00D ,  /*  Default (absence-of) "definer"        */
+      COMMON_FWORD = 0xC0EDC0DE ,  /*  Definer indicating a "shared" FWord   */
+      BI_FWRD_DEFN = 0xB1F4409D ,  /*  Definer indicating a "built-in FWord" */
+      COLON = 1 ,
+      SEMICOLON ,
+      TICK ,
+      AGAIN ,
+      ALIAS ,
+      BRACK_TICK ,
+      F_BRACK_TICK ,
+      ASCII ,
+      BEGIN ,
+      BUFFER ,
+      CASE ,
+      CONST ,
+      CONTROL ,
+      CREATE ,
+      DECIMAL ,
+      DEFER ,
+      DEFINED ,
+      CDO ,
+      DO ,
+      ELSE ,
+      ENDCASE ,
+      ENDOF ,
+      EXTERNAL ,
+      INSTANCE ,
+      FIELD ,
+      NEW_DEVICE ,
+      FINISH_DEVICE ,
+      FLITERAL ,
+      HEADERLESS ,
+      HEADERS ,
+      HEX ,
+      IF ,
+      UNLOOP ,
+      LEAVE ,
+      LOOP_I ,
+      LOOP_J ,
+      LOOP ,
+      PLUS_LOOP ,
+      OCTAL ,
+      OF ,
+      REPEAT ,
+      THEN ,
+      TO ,
+      IS ,
+      UNTIL ,
+      VALUE ,
+      VARIABLE ,
+      WHILE ,
+      OFFSET16 ,
+      ESCAPETOK ,
+      EMITBYTE ,
+      FLOAD ,
+      STRING ,
+      PSTRING ,
+      PBSTRING ,
+      SSTRING ,
+      RECURSIVE ,
+      RECURSE ,
+      RET_STK_FETCH ,
+      RET_STK_FROM ,
+      RET_STK_TO ,
+      HEXVAL ,
+      DECVAL ,
+      OCTVAL ,
+
+       ret_stk_from ,
+     ASC_NUM ,          /*  Convert char seq to number  */
+      ASC_LEFT_NUM ,     /*  same, only left-justified.  */
+
+      CONDL_ENDER ,      /*  Conditional "[THEN] / [ENDIF]" variants  */
+      CONDL_ELSE ,       /*  Conditional "[ELSE]" directive variants  */
+
+      PUSH_FCODE ,	/*  Save the FCode Assignment number  */
+      POP_FCODE ,	/*  Retrieve the FCode Assignment number  */
+      RESET_FCODE ,	/*  Reset FCode Ass't nr and overlap checking  */
+
+      CURLY_BRACE ,      /*  Support for IBM-style Locals  */
+      DASH_ARROW ,
+      LOCAL_VAL ,
+      EXIT ,
+
+      FUNC_NAME ,
+      IFILE_NAME ,
+      ILINE_NUM ,
+
+      CL_FLAG ,
+      SHOW_CL_FLAGS ,
+
+      OVERLOAD ,
+      ALLOW_MULTI_LINE ,
+      MACRO_DEF ,
+      GLOB_SCOPE ,
+      DEV_SCOPE ,
+
+      /*  This value has to be adjusted
+       *      so that  FCODE_END  comes
+       *      out to be  0xff
+       */
+      END0 = 0xd7 ,      /*   0xd7   */
+      END1 ,             /*   0xd8   */
+      CHAR ,             /*   0xd9   */
+      CCHAR ,            /*   0xda   */
+      ABORTTXT ,         /*   0xdb   */
+
+      NEXTFCODE ,        /*   0xdc   */
+
+      ENCODEFILE ,       /*   0xdd   */
+
+      FCODE_V1 ,         /*   0xde   */
+      FCODE_V3 ,         /*   0xdf   */
+      NOTLAST ,          /*   0xef   */
+      ISLAST ,           /*   0xf0   */
+      SETLAST ,          /*   0xf1   */
+      PCIREV ,           /*   0xf2   */
+      PCIHDR ,           /*   0xf3   */
+      PCIEND ,           /*   0xf4   */
+      RESETSYMBS ,       /*   0xf5   */
+      SAVEIMG ,          /*   0xf6   */
+      START0 ,           /*   0xf7   */
+      START1 ,           /*   0xf8   */
+      START2 ,           /*   0xf9   */
+      START4 ,           /*   0xfa   */
+      VERSION1 ,         /*   0xfb   */
+      FCODE_TIME ,       /*   0xfc   */
+      FCODE_DATE ,       /*   0xfd   */
+      FCODE_V2 ,         /*   0xfe   */
+      FCODE_END = 0xff   /*   0xff   */
+}  fwtoken ;
+
+#endif   /*  _TOKE_DICTIONARY_H    */
diff --git a/toke/emit.c b/toke/emit.c
index f51d49b..7ca55ef 100644
--- a/toke/emit.c
+++ b/toke/emit.c
@@ -24,283 +24,548 @@
  *
  */
 
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+
+#include "pcihdr.h"
+
 #include "toke.h"
+#include "vocabfuncts.h"
 #include "stack.h"
+#include "scanner.h"
 #include "emit.h"
+#include "clflags.h"
+#include "errhandler.h"
+#include "stream.h"
+#include "nextfcode.h"
+
+/* **************************************************************************
+ *
+ *          Global Variables Imported
+ *              verbose         Enable optional messages, set by "-v" switch
+ *              noerrors        "Ignore Errors" flag, set by "-i" switch
+ *
+ **************************************************************************** */
 
-extern bool offs16;
-extern int verbose;
-extern u8 *ostart, *opc, *oend;
 
-/* PCI data */
-extern u16 pci_vpd, pci_revision;
-extern bool pci_is_last_image;
+/* **************************************************************************
+ *
+ *      Macro to zero-fill a field of the size of the given structure
+ *          into the Output Buffer using the  emit_byte()  routine.
+ *
+ **************************************************************************** */
 
-/* header pointers */
-extern u8  *fcode_hdr;
-extern u8  *pci_hdr;
+#define EMIT_STRUCT(x)  {int j; for (j=0; j < sizeof(x) ; j++ ) emit_byte(0); }
 
-extern bool haveend;
 
-u16 lookup_token(char *name);
+/* **************************************************************************
+ *
+ *      Local Static Variables, offsets into Output Buffer of ...:
+ *          fcode_start_ob_off      First FCode-Start byte
+ *          fcode_hdr_ob_off        FCode Header (Format byte)
+ *          fcode_body_ob_off       First functional FCode after FCode Header.
+ *          pci_hdr_ob_off          Start of PCI ROM Header Block structure
+ *          pci_data_blk_ob_off     Start of PCI Data Header Block structure
+ *
+ *     For all of these, -1 means "Not initialized"
+ *
+ *************************************************************************** */
+
+static  int fcode_start_ob_off = -1;
+static  int fcode_hdr_ob_off = -1;
+static  int fcode_body_ob_off = -1;
+static  int pci_hdr_ob_off = -1;
+static  int pci_data_blk_ob_off = -1;
+
+/* **************************************************************************
+ *
+ *          These are to detect a particular error:  If FCode has
+ *              been written, before an Fcode-start<n> or before
+ *               a PCI-header
+ *
+ **************************************************************************** */
 
-static bool little_endian(void)
+static bool fcode_written = FALSE;
+
+/* **************************************************************************
+ *
+ *          Variables and Functions Imported, with
+ *          Exposure as Limited as possible:
+ *              ostart
+ *              olen
+ *              increase_output_buffer
+ *
+ **************************************************************************** */
+
+extern u8 *ostart;
+extern int olen;
+extern void increase_output_buffer( void);
+
+
+/* **************************************************************************
+ *
+ *      Function name:  init_emit
+ *      Synopsis:       Initialize Local Static Variables before starting
+ *                          Output.
+ *                      Exposure as Limited as possible.
+ *
+ **************************************************************************** */
+void init_emit( void);       /*    Prototype.  Limit Exposure.   */
+void init_emit( void)
 {
-	static short one=1;
-	return *(char *)&one==1;
+    fcode_start_ob_off  = -1;
+    fcode_hdr_ob_off    = -1;
+    fcode_body_ob_off   = -1;
+    pci_hdr_ob_off      = -1;
+    pci_data_blk_ob_off = -1;
+    fcode_written       = FALSE;
+    haveend             = FALSE;   /*  Get this one too...  */
 }
 
-int emit_byte(u8 data)
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_byte
+ *      Synopsis:       Fundamental routine for placing a byte
+ *                          into the Output Buffer.  Also, check
+ *                          whether the buffer needs to be expanded.
+ *                      For internal use only.
+ *
+ **************************************************************************** */
+
+static void emit_byte(u8 data)
 {
-	u8 *newout;
-	int newsize;
-
-	if(opc==oend) {
-		/* need more output space */
-		newsize = (oend - ostart) * 2;
-		printf("Increasing output buffer to %d bytes.\n", newsize);
-		if ((newout=realloc(ostart, newsize)) == NULL) {
-			printf("toke: could not allocate %d bytes for output buffer\n", newsize);
-			exit(-1);
-		}
-
-		/* move pointers */
-		opc=newout+(opc-ostart);
-		ostart=newout;
-		oend=ostart+newsize;
+	if ( opc == olen)
+	{
+	    increase_output_buffer();
 	}
 	
-	*opc=data;
-	opc++;
 
-	return 0;
+	*(ostart+opc) = data ;
+	opc++;
 }
 
-int emit_fcode(u16 tok)
+void emit_fcode(u16 tok)
 {
 	if ((tok>>8))
 		emit_byte(tok>>8);
 
 	emit_byte(tok&0xff);
-	
-	return 0;
+	fcode_written = TRUE;
 }
 
-int emit_token(const char *name)
-{
-	return emit_fcode(lookup_token((char *)name));
-}
-
-int emit_num32(u32 num)
+static void emit_num32(u32 num)
 {
 	emit_byte(num>>24);
 	emit_byte((num>>16)&0xff);
 	emit_byte((num>>8)&0xff);
 	emit_byte(num&0xff);
 
-	return 0;
 }
 
-int emit_num16(u16 num)
-{
-	emit_byte(num>>8);
-	emit_byte(num&0xff);
+/* **************************************************************************
+ *
+ *      Function name:  user_emit_byte
+ *      Synopsis:       Action of user-mandated call to emit-byte.
+ *                          Covers the corner-case where this is the
+ *                          first command issued in the source input.
+ *
+ **************************************************************************** */
 
-	return 0;
+void user_emit_byte(u8 data)
+{
+	emit_byte( data);
+	fcode_written = TRUE;
 }
 
-int emit_offset(s16 offs)
+void emit_offset(s16 offs)
 {
+    /*  Calling routine will test for out-of-range FCode-Offset  */
 	if (offs16)
-		emit_num16(offs);
-	else
-		emit_byte(offs);
-	
-	return 0;
+		emit_byte(offs>>8);
+	emit_byte(offs&0xff);
 }
 
-s16 receive_offset(void)
+void emit_literal(u32 num)
 {
-	s16 offs=0;
-	
-	if (offs16) {
-		offs=((*opc)<<8)|(*(opc+1));
-	} else
-		offs=(*opc);
-
-	return offs;
+    emit_token("b(lit)");
+    emit_num32(num);
 }
 
-int emit_string(u8 *string, unsigned int cnt)
+void emit_string(u8 *string, signed int cnt)
 {
-	unsigned int i=0;
+	signed int i=0;
+	signed int cnt_cpy = cnt;
 	
-	if (cnt>255) {
-		printf("string too long.");
-		exit(1);
+	if ( cnt_cpy > STRING_LEN_MAX )
+	{
+	    tokenization_error( TKERROR,
+		"String too long:  %d characters.  Truncating.\n",cnt);
+	    cnt_cpy = STRING_LEN_MAX ;
 	}
-	emit_byte(cnt);
-	for (i=0; i<cnt; i++)
+	emit_byte(cnt_cpy);
+	for (i=0; i<cnt_cpy; i++)
 		emit_byte(string[i]);
-
-	return 0;
 }
 
-int emit_fcodehdr(void)
+void emit_fcodehdr(const char *starter_name)
 {
-	/* We comply with IEEE 1275-1994 */
-	emit_byte(0x08);
 	
-	/*  checksum */
-	emit_num16(0);
+   /*  Check for error conditions   */
+    if ( fcode_written )
+    {
+        tokenization_error( TKERROR ,
+	    "Cannot create FCode header after FCode output has begun.\n");
+        if ( ! noerrors ) return ;
+    }
+
+	fcode_header_t *fcode_hdr;
+
+	fcode_start_ob_off = opc;
+	emit_token( starter_name );
+
+	fcode_hdr_ob_off = opc;
+	fcode_hdr = (fcode_header_t *)(ostart+fcode_hdr_ob_off);
 
-	/* len */
-	emit_num32(0);
+	EMIT_STRUCT(fcode_header_t);
+
+	fcode_body_ob_off = opc;
+
+	/* Format = 8 means we comply with IEEE 1275-1994 */
+	fcode_hdr->format = 0x08;
 
-	return 0;
 }
 
-int finish_fcodehdr(void)
+/* **************************************************************************
+ *
+ *      Function name:    finish_fcodehdr
+ *          Fill in the FCode header's checksum and length fields, and
+ *              reset the FCode-header pointer for the next image.
+ *
+ *          If  haveend  is true then the end0 has already been written
+ *              and  fcode_ender()  has been called.
+ *
+ *          Print a WARNING message if the end-of-file was encountered
+ *              without an end0 or an fcode-end
+ *
+ *          Print an informative message to standard-output giving the
+ *              checksum.  Call  list_fcode_ranges()  to print the
+ *              value of the last FCode-token that was assigned or
+ *              the Ranges of assigned FCode-token values if so be...
+ *              The final FCode-binary file-length will be printed
+ *              when the binary file is being closed.
+ *
+ **************************************************************************** */
+
+void finish_fcodehdr(void)
 {
-	u16 checksum=0;
-	u32 len,i;
 
-	if(!fcode_hdr)
+	if( fcode_hdr_ob_off == -1 )
 	{
-		printf("warning: trying to fix up unknown fcode header\n");
-		return -1;
+		tokenization_error( TKERROR,
+		    "Missing FCode header.\n");
+		return ;
 	}
 
-	/* If the program does not do this, we do */
+	/* If the program did not end cleanly, we'll handle it */
 	if (!haveend)
+	{
+	    tokenization_error ( WARNING,
+	    "End-of-file encountered without END0 or FCODE-END.  "
+		"Supplying END0\n");
 		emit_token("end0");
+	    fcode_ender();
+	}
 
-	len=(unsigned long)opc-(unsigned long)(fcode_hdr-1);
+	/*  Calculate and place checksum and length, if haven't already  */
+	if ( fcode_start_ob_off != -1 )
+	{
+	    u16 checksum;
+	    int length;
+
+	    u8 *fcode_body = ostart+fcode_body_ob_off;
+	    u8 *ob_end = ostart+opc;
+	    fcode_header_t *fcode_hdr =
+	         (fcode_header_t *)(ostart+fcode_hdr_ob_off);
 	
-	for (i=8;i<len;i++)
-		checksum+=fcode_hdr[i-1];
-
-	dpush((unsigned long)opc);
-	opc=fcode_hdr+1;
-	emit_num16(checksum);
-	emit_num32(len);
-	opc=(u8 *)dpop();
+	    length = opc - fcode_start_ob_off;
+
+	    for ( checksum = 0;
+	              fcode_body < ob_end ;
+		          checksum += *(fcode_body++) ) ;
+
+	    BIG_ENDIAN_WORD_STORE(fcode_hdr->checksum , checksum);
+	    BIG_ENDIAN_LONG_STORE(fcode_hdr->length , length);
+
 	if (verbose)
-		printf("toke: checksum is 0x%04x (%d bytes)\n", 
-							checksum, len);
+	    {
+		printf( "toke: checksum is 0x%04x (%d bytes).  ",
+		    checksum, length);
+		list_fcode_ranges( TRUE);
+	    }
+	}
 
-	fcode_hdr=NULL;
+	/*  Reset things for the next image...   */
+	fcode_start_ob_off = -1;
+	fcode_hdr_ob_off   = -1;
+	fcode_body_ob_off  = -1;
+	fcode_written      = FALSE;
 	haveend=FALSE;
-	return 0;
 }
 
-int emit_pcihdr(u16 vid, u16 did, u32 classid)
+/* **************************************************************************
+ *
+ *      Function name:  emit_pci_rom_hdr
+ *      Synopsis:       Write the PCI ROM Header Block into the Output Buffer
+ *
+ *      Inputs:
+ *         Parameters:                   NONE
+ *         Global Variables:        
+ *             opc                       Output Buffer Position Counter
+ *             ostart                    Start of Output Buffer
+ *
+ *      Outputs:
+ *         Returned Value:               NONE
+ *         Global Variables:    
+ *             pci_hdr_ob_off            PCI ROM Header Block Position
+ *                                           (Offset) in Output Buffer
+ *         FCode Output buffer:
+ *             Write the part of the PCI ROM Header Block we know:
+ *                 Fill in the signature and the field reserved for
+ *                 "processor architecture unique data".
+ *             Fill in the "Pointer to PCI Data Structure" with the
+ *                 size of the data structure, because the first PCI
+ *                 Data Structure will follow immediately.
+ *
+ *      Error Detection:   (Handled by calling routine)
+ *
+ **************************************************************************** */
+
+static void emit_pci_rom_hdr(void)
 {
-	int i;
+    rom_header_t *pci_hdr;
+    pci_hdr_ob_off = opc;
+    pci_hdr = (rom_header_t *)(ostart + pci_hdr_ob_off);
+
+    EMIT_STRUCT(rom_header_t);
 	
 	/* PCI start signature */
-	emit_byte(0x55); emit_byte(0xaa);
+    LITTLE_ENDIAN_WORD_STORE(pci_hdr->signature,0xaa55);
 	
 	/* Processor architecture */
-	emit_byte(0x34); emit_byte(0x00);
-
-	/* 20 bytes of padding */
-	for (i=0; i<20; i++) emit_byte(0x00);
+	/*  Note:
+	 *  The legacy code used to read:
+	 *
+	 *        pci_hdr->reserved[0] = 0x34;
+	 *
+	 *  I don't know what significance the literal  34  had, but
+	 *      by what might just be an odd coincidence, it is equal
+	 *      to the combined lengths of the  PCI-ROM-  and  PCI-Data-
+	 *      headers.
+	 *
+	 *  I suspect that it is more than merely an odd coincidence,
+	 *      and that the following would be preferable:
+	 */
+
+    LITTLE_ENDIAN_WORD_STORE( pci_hdr->reserved ,
+	(sizeof(rom_header_t) + sizeof(pci_data_t)) ) ;
+
+	/* already handled padding */
 
 	/* pointer to start of PCI data structure */
-	emit_byte(0x1c); emit_byte(0x00);
+    LITTLE_ENDIAN_WORD_STORE(pci_hdr->data_ptr, sizeof(rom_header_t) );
 
-	/* 2 bytes of zero padding */
-	emit_byte(0x00); emit_byte(0x00);
-	
-	/* PCI Data structure */
-	emit_byte('P'); emit_byte('C'); emit_byte('I'); emit_byte('R');
-	/* vendor id */
-	emit_byte(vid&0xff); emit_byte(vid>>8);
-	/* device id */
-	emit_byte(did&0xff); emit_byte(did>>8);
-	/* vital product data */
-	emit_byte(0x00); emit_byte(0x00);
-	/* length of pci data structure */
-	emit_byte(0x18); emit_byte(0x00);
-	/* PCI data structure revision */
-	emit_byte(0x00);
+}
 	
-	if (little_endian()) {
-		/* reg level programming */
-		emit_byte(classid & 0xff);
-		/* class code */
-		emit_byte((classid>>8)&0xff);
-		emit_byte((classid>>16)&0xff);
-	} else {
-		/* class code */
-		emit_byte((classid>>8)&0xff);
-		emit_byte((classid>>16)&0xff);
-		/* reg level programming */
-		emit_byte(classid & 0xff);
+/* **************************************************************************
+ *
+ *      Function name:  emit_pci_data_block
+ *      Synopsis:       Write the PCI Data Block into the Output Buffer
+ *
+ *      Inputs:
+ *         Parameters:                   NONE
+ *         Global Variables:        
+ *             opc                       Output Buffer Position Counter
+ *         Data-Stack Items:
+ *             Top:                      Class Code
+ *             Next:                     Device ID
+ *             3rd:                      Vendor ID
+ *
+ *      Outputs:
+ *         Returned Value:               NONE
+ *         Global Variables:    
+ *             pci_data_blk_ob_off       PCI Data Header Block Position
+ *                                           (Offset) in Output Buffer
+ *         Data-Stack, # of Items Popped:  3
+ *         FCode Output buffer:
+ *             Write the PCI Data Header Block:  Fill in the signature,
+ *                 Vendor ID, Device ID and Class Code, and everything
+ *                 else whose value we know.  (Size and Checksum will
+ *                 have to wait until we finish the image...)
+ *         Printout:
+ *             Advisory of Vendor, Device and Class 
+ *
+ *      Error Detection:   (Handled by calling routine)
+ *
+ **************************************************************************** */
+
+static void emit_pci_data_block(void)
+{
+    pci_data_t *pci_data_blk;
+    u32 class_id = dpop();
+    u16 dev_id   = dpop();
+    u16 vend_id  = dpop();
+
+    pci_data_blk_ob_off = opc;
+    pci_data_blk = (pci_data_t *)(ostart + pci_data_blk_ob_off);
+
+    EMIT_STRUCT(pci_data_t);
+
+    BIG_ENDIAN_LONG_STORE(pci_data_blk->signature , PCI_DATA_HDR );
+
+    LITTLE_ENDIAN_WORD_STORE(pci_data_blk->vendor , vend_id );
+    LITTLE_ENDIAN_WORD_STORE(pci_data_blk->device , dev_id );
+    LITTLE_ENDIAN_TRIPLET_STORE(pci_data_blk->class_code , class_id );
+
+    LITTLE_ENDIAN_WORD_STORE(pci_data_blk->dlen ,  sizeof(pci_data_t) );
+
+    pci_data_blk->drevision = PCI_DATA_STRUCT_REV ;
+
+	/* code type = open firmware = 1 */
+    pci_data_blk->code_type = 1;
+
+	/* last image flag */
+    pci_data_blk->last_image_flag = pci_is_last_image ? 0x80 : 0 ;
+
+    tokenization_error(INFO ,
+	"PCI header vendor id=0x%04x, "
+	    "device id=0x%04x, class=%06x\n",
+		vend_id, dev_id, class_id );
+
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_pcihdr
+ *      Synopsis:       Supervise the writing of PCI Header information
+ *                          into the Output Buffer, when the  PCI-HEADER
+ *                          tokenizer directive has been encountered.
+ *
+ *      Inputs:
+ *         Parameters:                   NONE
+ *         Global Variables:        
+ *             fcode_start_ob_off        Initted if FCode output has begun
+ *             noerrors                  The "Ignore Errors" flag
+ *
+ *      Outputs:
+ *         Returned Value:               NONE
+ *         Global Variables:    
+ *         FCode Output buffer:
+ *
+ *      Error Detection:
+ *          An attempt to write a PCI Header after FCode output -- either an
+ *              Fcode-start<n> or ordinary FCode -- has begun is an ERROR.
+ *              Report it; do nothing further, unless "Ignore Errors" is set.
+ *
+ **************************************************************************** */
+
+void emit_pcihdr(void)
+{
+
+    /*  Check for error conditions   */
+    if (
+    /*  FCODE-START<n>  has already been issued  */
+              ( fcode_start_ob_off != -1 )
+    /*  Other FCode has been written             */
+	      ||  fcode_written
+	 )
+    {
+        tokenization_error( TKERROR ,
+	    "Cannot create PCI header after FCode output has begun.\n");
+        if ( ! noerrors ) return ;
 	}
 
-	/* size of image - to be filled later */
-	emit_byte(0x00); emit_byte(0x00);
-	/* revision level */
-	emit_byte(0x00); emit_byte(0x00);
-	/* code type = open firmware */
-	emit_byte(0x01);
-	emit_byte(0x80);
-	/* 2 bytes of padding */
-	emit_byte(0x00); emit_byte(0x00);
-
-	return 0;
+	emit_pci_rom_hdr();
+
+	emit_pci_data_block();
 }
 
+/* **************************************************************************
+ *
+ *      Function name:  finish_pcihdr
+ *      Synopsis:       Fill-in the fields of the PCI Header that could
+ *                      not be determined until the end of the PCI-block.
+ *
+ *************************************************************************** */
 
-int finish_pcihdr(void)
+void finish_pcihdr(void)
 {
-	u8 *tpc;
-	u32 imgsize=opc-ostart, imgblocks;
+
+	u32 imagesize ;
+	u32 imageblocks;
 	int padding;
 	
-	if(!pci_hdr)
+	rom_header_t *pci_hdr;
+	pci_data_t   *pci_data_blk;
+
+	if( pci_data_blk_ob_off == -1 )
 	{
-		printf("error: trying to fix up unknown pci header\n");
-		return -1;
+	    tokenization_error( TKERROR,
+		"%s without PCI-HEADER\n", strupr(statbuf) );
+	    return ;
 	}
 
+	pci_hdr = (rom_header_t *)(ostart + pci_hdr_ob_off);
+	pci_data_blk = (pci_data_t *)(ostart + pci_data_blk_ob_off);
+
 	/* fix up vpd */
-	tpc=opc;
-	opc=pci_hdr+36;
-	emit_byte(pci_vpd&0xff); emit_byte(pci_vpd>>8);
-
-	/* fix up image size */
-	opc=pci_hdr+44;
-	imgblocks=(imgsize+511)>>9; /* size is in 512byte blocks */
-	emit_byte(imgblocks&0xff); emit_byte(imgblocks>>8);
+	LITTLE_ENDIAN_WORD_STORE(pci_data_blk->vpd, pci_vpd);
+
+	/*   Calculate image size and padding */
+	imagesize = opc - pci_hdr_ob_off;     /*  Padding includes PCI hdr  */
+	imageblocks = (imagesize + 511) >> 9; /*  Size in 512-byte blocks   */
+	padding = (imageblocks << 9) - imagesize;
+
+	/* fix up image size. */
+	LITTLE_ENDIAN_WORD_STORE(pci_data_blk->ilen, imageblocks);
 	
 	/* fix up revision */
-	emit_byte(pci_revision&0xff); emit_byte(pci_revision>>8);
+	if ( big_end_pci_image_rev )
+	{
+	    BIG_ENDIAN_WORD_STORE(pci_data_blk->irevision, pci_image_rev);
+	}else{
+	    LITTLE_ENDIAN_WORD_STORE(pci_data_blk->irevision, pci_image_rev);
+	}
 	
 	/* fix up last image flag */
-	opc++;
-	emit_byte(pci_is_last_image?0x80:0x00);
-	opc=tpc;
+	pci_data_blk->last_image_flag = pci_is_last_image ? 0x80 : 0 ;
 	
 	/* align to 512bytes */
-	padding=((imgsize+511)&0xfffffe00)-imgsize;
+	
 	printf("Adding %d bytes of zero padding to PCI image.\n",padding);
 	while (padding--)
 		emit_byte(0);
+	if ( ! pci_is_last_image )
+	{
+	    printf("Note:  PCI header is not last image.\n");
+	}
+	printf("\n");
 	
-	pci_hdr=NULL;
-	return 0;
+	pci_hdr_ob_off      = -1;
+	pci_data_blk_ob_off = -1;
 }
 
 void finish_headers(void)
 {
-	if (fcode_hdr) finish_fcodehdr();
-	if (pci_hdr) finish_pcihdr();
+	if (fcode_hdr_ob_off != -1) finish_fcodehdr();
+	if (pci_hdr_ob_off != -1) finish_pcihdr();
 }
 
diff --git a/toke/emit.h b/toke/emit.h
index be2d3f8..987d210 100644
--- a/toke/emit.h
+++ b/toke/emit.h
@@ -1,3 +1,6 @@
+#ifndef _TOKE_EMIT_H
+#define _TOKE_EMIT_H
+
 /*
  *                     OpenBIOS - free your system! 
  *                         ( FCode tokenizer )
@@ -24,21 +27,90 @@
  *
  */
 
-#ifndef _H_EMIT
-#define _H_EMIT
-
-int emit_byte(u8 data);
-int emit_fcode(u16 tok);
-int emit_token(const char *name);
-int emit_num32(u32 num);
-int emit_num16(u16 num);
-int emit_offset(s16 offs);
-s16 receive_offset(void);
-int emit_string(u8 *string, unsigned int cnt);
-int emit_fcodehdr(void);
-int finish_fcodehdr(void);
-int emit_pcihdr(u16 vid, u16 did, u32 classid);
-int finish_pcihdr(void);
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+ 
+#include "types.h"
+
+/* **************************************************************************
+ *          Structure Name:    fcode_header_t
+ *          Synopsis:          FCode Header within the Output Buffer
+ *                            
+ *   Fields:
+ *       format, checksum and length    All as prescribed in P1275, Sec 5.2.2.5
+ *       
+ *       Note that the Checksum and Length fields are stated as byte-arrays
+ *           rather than as integers.  This is intended to guarantee that
+ *           their endian-ness will remain independent of the endian-ness
+ *           of the host-platform on which this Tokenizer is running.
+ *       Note also that, as integers, both are BIG-Endian.      
+ *
+ **************************************************************************** */
+
+typedef struct {
+    u8  format;
+    u8  checksum[2];  /* [0] = Hi byte, [1] = Lo */
+    u8  length[4];    /* [0] = Hi, [1] = Hi-mid, [2] = Lo-mid, [3] = Lo  */
+} fcode_header_t;
+
+
+/* **************************************************************************
+ *          Macro Name:   STRING_LEN_MAX
+ *                        Max number of bytes allowable in an output string
+ *                            
+ *   Arguments:           NONE
+ *
+ *       This value must remail hard-coded and immutable.  It represents the
+ *           maximum number allowed in a FORTH counted-string's count-byte
+ *           (which is, of course, the maximum number that can be expressed
+ *           in an unsigned byte).
+ *       It should not be used for anything else (e.g., buffer sizes), and
+ *           most especially not for anything that might be changed!
+ *
+ **************************************************************************** */
+
+#define STRING_LEN_MAX    255
+
+
+/* **************************************************************************
+ *          Macro Name:   GET_BUF_MAX
+ *                        Size alloted to input-string buffer
+ *                            
+ *   Arguments:           NONE
+ *
+ *       This is a generous allotment for the buffer into which
+ *           input strings are gathered.  Overflow calculations are
+ *           also based on it.  It may be changed safely.
+ *       We like to keep it a nice power-of-two to make the memory-
+ *           allocation routine run efficiently and happily (Okay, so
+ *           that's anthropormism:  It's efficient and *we*'re happy.
+ *           Better?  I thought so...  ;-)
+ *
+ **************************************************************************** */
+
+#define GET_BUF_MAX    1024
+
+
+/* ************************************************************************** *
+ *
+ *      Function Prototypes / Functions Exported:
+ *
+ **************************************************************************** */
+
+void  emit_fcode(u16 tok);
+void  user_emit_byte(u8 data);
+
+void  emit_offset(s16 offs);
+void  emit_string(u8 *string, signed int cnt);
+void  emit_fcodehdr(const char *starter_name);
+void  finish_fcodehdr(void);
+void  emit_pcihdr(void);
+void  finish_pcihdr(void);
 void finish_headers(void);
+void  emit_end0(void);
+void  emit_literal(u32 num);
 
-#endif   /* _H_EMIT */
+#endif   /* _TOKE_EMIT_H */
diff --git a/toke/errhandler.c b/toke/errhandler.c
new file mode 100644
index 0000000..a07a6a9
--- /dev/null
+++ b/toke/errhandler.c
@@ -0,0 +1,956 @@
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Error-Handler for Tokenizer
+ *
+ *      Controls printing of various classes of errors
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Functions Exported:
+ *          init_error_handler  Initialize the error-counts,
+ *                                  announce the file names.
+ *          tokenization_error  Handle an error of the given class,
+ *                                  print the given message in the 
+ *                                  standard format.
+ *          started_at          Supplemental message, giving a back-reference
+ *                                  to the "starting"  point of a compound
+ *                                  error, including last-colon identification.
+ *          just_started_at     Supplemental back-reference to "starting"  point
+ *                                  of compound error, but without last-colon
+ *                                  identification.
+ *          where_started       Supplemental message, giving a more terse back-
+ *                                  -reference to "start" of compound-error.
+ *          just_where_started Supplemental message, more terse back-reference,
+ *                                  without last-colon identification.
+ *          in_last_colon      Supplemental back-reference message,
+ *                                  identifying last Colon-definition.
+ *          safe_malloc         malloc with built-in failure test.
+ *          error_summary       Summarize final error-message status
+ *                                  before completing tokenization.
+ *
+ **************************************************************************** */
+
+
+/* **************************************************************************
+ *
+ *          We will define a set of bit-valued error-types and a
+ *          global bit-mask.  Each error-message will be associated
+ *          with one of the bit-valued error-types.  The bit-mask,
+ *          which will be set by a combination of defaults and user
+ *          inputs (mainly command-line arguments), will control
+ *          whether an error-message of any given type is printed.
+ *          
+ *          Another bit-mask variable will accumulate the error-
+ *          types that occur within any given run; at the end of
+ *          the run, it will be examined to determine if the run
+ *          failed, i.e., if the output should be suppressed.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *          Error-types fall into the following broad categories:
+ *              FATAL           Cause to immediately stop activity
+ *              TKERROR         Sufficient to make the run a failure,
+ *                                  but not to stop activity.
+ *              WARNING         Not necessarily an error, but something
+ *                                  to avoid.  E.g., it might rely on
+ *                                  assumptions that are not necessarily
+ *                                  what the user/programmer wants.  Or:
+ *                                  It's a deprecated feature, or one
+ *                                  that might be incompatible with
+ *                                  other standard tokenizers.
+ *              INFO            Nothing is changed in processing, but
+ *                                  an advisory is still in order.
+ *              MESSAGE         Message generated by the user.  (Complete;
+ *                                  new-line will be added by display routine.)
+ *              P_MESSAGE       Partial Message -- Instigated by user, but
+ *                                  pre-formatted and not complete.  New-line
+ *                                  will be added by follow-up routine.
+ *
+ **************************************************************************** */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include "types.h"
+#include "toke.h"
+#include "stream.h"
+#include "errhandler.h"
+#include "scanner.h"
+
+/* **************************************************************************
+ *
+ *          Global Variables Imported
+ *              iname           Name of file currently being processed
+ *              lineno          Current line-number being processed
+ *              noerrors        "Ignore Errors" flag, set by "-i" switch
+ *              opc             FCode Output Buffer Position Counter
+ *              verbose         If true, enable Advisory Messages
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *              Internal Static Variables
+ *          print_msg               Whether beginning of a message was printed;
+ *                                      therefore, whether to print the rest.
+ *          errs_to_print           Error Verbosity Mask.  Bits set correspond
+ *                                      to message-types that will be printed
+ *                                      May be altered by Command-Line switches.
+ *          err_types_found         Accumulated Error-types.  Bits
+ *                                      set correspond to error-types
+ *                                      that have occurred.
+ *          message_dest            Message Dest'n.  Usually ERRMSG_DESTINATION
+ *                                      (stdout) except when we need to switch.
+ *          err_count               Count of Error Messages
+ *          warn_count              Count of Warning Messages
+ *          info_count              Count of "Advisory" Messages
+ *          user_msg_count          Count of User-generated Messages
+ *          fatal_err_exit          Exit code to be used for "Fatal" error.
+ *                                       This is a special accommodation
+ *                                       for the  safe_malloc  routine.
+ *
+ **************************************************************************** */
+
+static bool  print_msg ;
+static int errs_to_print = ( FATAL | TKERROR | WARNING | 
+                             MESSAGE | P_MESSAGE | FORCE_MSG ) ;
+static int err_types_found =  0 ;
+static int err_count       =  0 ;
+static int warn_count      =  0 ;
+static int info_count      =  0 ;
+static int user_msg_count  =  0 ;
+static int fatal_err_exit  = -1 ;
+static FILE *message_dest;     /*  Would like to init to  ERRMSG_DESTINATION
+				*      here, but the compiler complains...
+				*/
+
+/* **************************************************************************
+ *
+ *              Internal Static Constant Structure
+ *          err_category            Correlate each error-type code with its
+ *                                      Counter-variable and the printable
+ *                                      form of its name.
+ *          num_categories          Number of entries in the err_category table
+ *
+ **************************************************************************** */
+
+typedef struct {
+    int  type_bit ;		/*  Error-type single-bit code        */
+    char *category_name ;	/*  Printable-name base               */
+    char *single ;		/*  Suffix to print singular of name  */
+    char *plural ;		/*  Suffix to print plural of name    */
+    int  *counter ;		/*  Associated Counter-variable       */
+    bool new_line ;		/*  Whether to print new-line at end  */
+} err_category ;
+
+static const err_category  error_categories[] = {
+    /*  FATAL  must be the first entry in the table.   */
+    /*  No plural is needed; only one is allowed....   */
+    { FATAL,    "Fatal Error", "", "",     &err_count      , TRUE  },
+
+    { TKERROR,    "Error"     , "", "s",    &err_count      , FALSE },
+    { WARNING,    "Warning"   , "", "s",    &warn_count     , FALSE },
+    { INFO,       "Advisor"   , "y", "ies", &info_count     , FALSE },
+    { MESSAGE ,   "Message"   , "", "s",    &user_msg_count , TRUE  },
+    { P_MESSAGE , "Message"   , "", "s",    &user_msg_count , FALSE }
+};
+
+static const int num_categories =
+    ( sizeof(error_categories) / sizeof(err_category) );
+
+
+#ifdef NEEDS_STRUPR
+
+/* **************************************************************************
+ *
+ *      Function name:  toup
+ *      Synopsis:       Support function for  strupper
+ *                      Converts one character
+ *
+ *      Inputs:
+ *         Parameters:
+ *             chr_ptr                 Pointer to the character
+ *
+ *      Outputs:
+ *         Returned Value:             None
+ *         Supplied Pointers:
+ *             The character pointed to is changed
+ *
+ *      Process Explanation:
+ *          Because this fills in a lack in the host system, we cannot
+ *              rely on the functions  islower  or  toupper , which are
+ *              usually built-in but might be similarly missing.
+ *
+ **************************************************************************** */
+
+static void toup( char *chr_ptr)
+{
+    const unsigned char upcas_diff = ( 'a' - 'A' );
+    if ( ( *chr_ptr >= 'a' ) && ( *chr_ptr <= 'z' ) )
+    {
+	*chr_ptr -= upcas_diff ;
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  strupper
+ *      Synopsis:       Replacement for  strupr  on systems that don't 
+ *                      seem to have it.  A necessary hack.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             strung              Pointer to the string to be changed
+ *
+ *      Outputs:
+ *         Returned Value:         Same pointer that was passed in
+ *         Supplied Pointers:
+ *             The string pointed to will be converted to upper case
+ *
+ *      Process Explanation:
+ *          Because it fills in a lack in the host system, this routine
+ *              does not rely on the functions  islower  or  toupper
+ *              which are usually built-in but might be missing.
+ *
+ **************************************************************************** */
+
+char *strupper( char *strung)
+{
+    char *strindx;
+    for (strindx = strung; *strindx != 0; strindx++)
+    {
+        toup( strindx);
+    }
+    return strung;
+}
+
+/* **************************************************************************
+ *
+ *     If  strupr  is missing, it's a good bet that so is  strlwr 
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Function name:  tolow
+ *      Synopsis:       Support function for  strlower
+ *                      Converts one character
+ *
+ *      Inputs:
+ *         Parameters:
+ *             chr_ptr                 Pointer to the character
+ *
+ *      Outputs:
+ *         Returned Value:             None
+ *         Supplied Pointers:
+ *             The character pointed to is changed
+ *
+ *      Process Explanation:
+ *          Because this fills in a lack in the host system, we cannot
+ *              rely on the functions  isupper  or  tolower , which are
+ *              usually built-in but might be similarly missing.
+ *
+ **************************************************************************** */
+
+static void tolow( char *chr_ptr)
+{
+    const unsigned char lowcas_diff = ( 'A' - 'a' );
+    if ( ( *chr_ptr >= 'A' ) && ( *chr_ptr <= 'Z' ) )
+    {
+	*chr_ptr -= lowcas_diff ;
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  strlower
+ *      Synopsis:       Replacement for  strlwr  on systems that don't 
+ *                      seem to have it.  A necessary hack.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             strung              Pointer to the string to be changed
+ *
+ *      Outputs:
+ *         Returned Value:         Same pointer that was passed in
+ *         Supplied Pointers:
+ *             The string pointed to will be converted to lower case
+ *
+ *      Process Explanation:
+ *          Because it fills in a lack in the host system, this routine
+ *              does not rely on the functions  isupper  or  tolower
+ *              which are usually built-in but might be missing.
+ *
+ **************************************************************************** */
+
+char *strlower( char *strung)
+{
+    char *strindx;
+    for (strindx = strung; *strindx != 0; strindx++)
+    {
+        tolow( strindx);
+    }
+    return strung;
+}
+
+
+#endif  /*   NEEDS_STRUPR   */
+ 
+/* **************************************************************************
+ *
+ *      Function name:  init_error_handler
+ *      Synopsis:       Initialize the error-handler before starting a
+ *                          new tokenization; both the aspects that will
+ *                          persist across the entire run and those that
+ *                          need to be reset, such as error-counts.
+ *
+ *      Inputs:
+ *         Parameters:                 NONE
+ *         Global Variables: 
+ *              verbose                Set by "-v" switch
+ *         Macro:
+ *             ERRMSG_DESTINATION      Error message destination;
+ *                                         (Set by development-time switch)
+ *             FFLUSH_STDOUT           Flush STDOUT if err-msg-dest is STDERR
+ *
+ *      Outputs:
+ *         Returned Value:             NONE
+ *         Global Variables:
+ *             errs_to_print           Add the INFO bit if verbose is set
+ *         Local Static Variables:
+ *             message_dest            Point it at ERRMSG_DESTINATION (stderr)
+ *           Reset the following to zero:
+ *             err_types_found         Accumulated Error-types.
+ *             err_count               Count of Error Messages
+ *             warn_count              Count of Warning Messages
+ *             info_count              Count of "Advisory" Messages
+ *             user_msg_count          Count of User-generated Messages
+ *         Other Exotic Effects:
+ *             Flush stdout if Error message destination is not stdout, to
+ *                 avoid collisions with stderr once Error Messaging begins.
+ *
+ *      Extraneous Remarks:
+ *          This needs to be done before attempting to read the input file,
+ *              so that any Messages that occur there can be properly counted.
+ *
+ **************************************************************************** */
+
+void init_error_handler( void)
+{
+    message_dest  =  ERRMSG_DESTINATION;
+    if ( verbose )  errs_to_print |= INFO ;
+    err_types_found = 0 ;
+    err_count = 0 ;
+    warn_count = 0 ;
+    info_count = 0 ;
+    user_msg_count = 0 ;
+    FFLUSH_STDOUT
+}
+
+/* **************************************************************************
+ *
+ *      Function name:    tokenization_error
+ *      Synopsis:         Handle an error of the given class,
+ *                            print the given message in the standard format.
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             err_type       int        One of the bit-valued error-types
+ *             The remaining parameters are a format string and corresponding
+ *                 data objects such as would be sent to  printf() 
+ *         Global Variables:
+ *             errs_to_print        Error Verbosity Mask.
+ *             iname                Name of file currently being processed
+ *             lineno               Current line-number being processed
+ *             fatal_err_exit       Exit code for "Fatal" error, if applicable.
+ *         Macro:
+ *             ERRMSG_DESTINATION        Error message destination;
+ *                                           (Development-time switch)
+ *         Note:  Whether this routine will or will not supply a new-line
+ *             at the end of the printout depends on the category of the
+ *             message.  The new-line is included for a FATAL or a User-
+ *             Generated Message, and excluded for the rest.  For those,
+ *             the calling routine must be responsible for including a
+ *             new-line at the end of the format string or for otherwise
+ *             finishing the line, as by calling started_at()
+ *
+ *      Outputs:
+ *         Returned Value:                 NONE
+ *         Local Static Variables:
+ *             err_types_found             Accumulated Error-types.
+ *             print_msg                   Whether this message was printed;
+ *                                             may be used by started_at()
+ *                    One of the following Category Counters
+ *                         will be incremented, as applicable:
+ *             err_count
+ *             warn_count
+ *             info_count 
+ *             user_msg_count
+ *         Printout:    Directed to  stdout or stderr 
+ *                          (see definition of ERRMSG_DESTINATION)
+ *
+ *      Error Detection:
+ *              Err_type not in list
+ *                      Print special message; treat cause as an Error.
+ *                      Force printout.
+ *
+ *      Process Explanation:
+ *          Accumulated the Error-type into  err_types_found 
+ *          Identify the Error-Category:
+ *              Check the Error-Type against the bit-code.
+ *                  The Error-type may have more than one bit set,
+ *                  but if it matches the Category bit-code, it's it.
+ *              If it doesn't match any Error-Category bit-code, print
+ *                  a special message and treat it as an ERROR code.
+ *          Check the Error-Type against the Error Verbosity Mask;
+ *          If it has a bit set, print the Error-Category, together
+ *                  with the source-file name and line number, and
+ *                  the rest of the message as supplied.
+ *              The table that translates the Error-type into a printable
+ *                  Error-Category string also identifies the applicable
+ *                  Category Counter; increment it.
+ *          Of course, there's no return from a FATAL error; it exits.
+ *
+ **************************************************************************** */
+
+void tokenization_error( int err_type, char* msg, ... )
+{
+    int indx ;
+
+    /*  Initial settings:  treat as an Error.  */
+    char *catgy_name = "Error";
+    char *catgy_suffx = "";
+    int *catgy_counter = &err_count;
+    bool print_new_line = FALSE;
+
+    /*  Accumulated the Error-type into  err_types_found  */
+    err_types_found |= err_type;
+
+    /*  Identify the Error-Category.  */
+    for ( indx = 0 ; indx < num_categories ; indx ++ )
+    {
+        if ( ( error_categories[indx].type_bit & err_type ) != 0 )
+        {
+            catgy_name = error_categories[indx].category_name;
+            catgy_suffx = error_categories[indx].single;
+            catgy_counter = error_categories[indx].counter;
+	    print_new_line = error_categories[indx].new_line;
+            break;
+        }
+    }
+
+    /*  Special message if  err_type  not in list; treat as an Error.  */
+    if ( catgy_name == NULL )
+    {
+         fprintf(ERRMSG_DESTINATION,
+	      "Program error: Unknown Error-Type, 0x%08x.  "
+              "  Will treat as Error.\n", err_type) ;
+         err_types_found |= TKERROR;
+         print_msg = TRUE ;
+    } else {
+         /*  Check the Error-Type against the Error Verbosity Mask  */
+         print_msg = BOOLVAL( ( errs_to_print & err_type ) != 0 );
+    }
+
+    if ( print_msg )
+    {
+        va_list argp;
+
+        if ( iname != NULL )
+	{
+	    fprintf(ERRMSG_DESTINATION, "%s%s:  File %s, Line %d.  ",
+        	 catgy_name, catgy_suffx, iname, lineno);
+	}else{
+	    /*  Don't print iname or lineno if no file opened.  */
+	    fprintf(ERRMSG_DESTINATION, "%s%s:  ",
+        	 catgy_name, catgy_suffx);
+	}
+
+        va_start(argp, msg);
+        vfprintf(ERRMSG_DESTINATION, msg, argp);
+        va_end(argp);
+	if ( print_new_line ) fprintf(ERRMSG_DESTINATION, "\n");
+
+	/*   Increment the category-counter.  */
+	*catgy_counter += 1;
+    }
+    if ( err_type == FATAL )
+    {
+        fprintf(ERRMSG_DESTINATION, "Tokenization terminating.\n");
+        error_summary();
+        exit ( fatal_err_exit );
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  print_where_started
+ *      Synopsis:       Supplemental message, following a tokenization_error,
+ *                          giving a back-reference to the "start" point of
+ *                          the compound-error being reported.
+ *                      This is a retro-fit; it does the heavy lifting for
+ *                          the routines  started_at() ,  just_started_at() , 
+ *                           where_started() ,  just_where_started() and
+ *                           in_last_colon() .
+ *
+ *      Inputs:
+ *         Parameters:
+ *             show_started         Whether to print a phrase about "started"
+ *             show_that_st         Whether to print "that started" as opposed
+ *                                      to " , which started"
+ *             saved_ifile          File-name saved for "back-reference"
+ *             saved_lineno         Line-number saved for "back-reference"
+ *             may_show_incolon     Whether to allow a call to  in_last_colon()
+ *                                      Needed to prevent infinite recursion...
+ *         Global Variables:        
+ *             iname                Name of file currently being processed
+ *             lineno               Current line-number being processed
+ *         Local Static Variables:
+ *             print_msg            Whether the beginning part of the message
+ *                                      was printed by tokenization_error()
+ *             message_dest         Message Destination. Is ERRMSG_DESTINATION
+ *                                      (stdout) usually, except sometimes...
+ *
+ *      Outputs:
+ *         Returned Value:          None
+ *         Printout:
+ *             The remainder of a message:  the location of a back-reference.
+ *                 The phrase "that started" is switchable.  This routine
+ *                 will supply the leading space and a new-line; the routines
+ *                 that call this can be used to finish the line.
+ *
+ *      Process Explanation:
+ *          This routine is called immediately after tokenization_error()
+ *              If tokenization_error() didn't print, neither will we.
+ *              The residual state of  print_msg  will tell us that.
+ *          If the preceding message ended with something general about a
+ *              "Colon Definition" or "Device-Node" or the like, we want
+ *              the message to read:  "that started on line ... [in file ...]"
+ *          If the end of the preceding message was something more specific,
+ *              we just want the message to read:  "on line ... [in file ...]"
+ *          If the saved input file name doesn't match our current input
+ *              file name, we will print it and the saved line-number.
+ *          If the file name hasn't changed, we will print only the saved
+ *              line-number.
+ *          If neither is changed, there's no point in printing any of the
+ *              above-mentioned text.    
+ *          If a Colon-definition is in progress, show its name and the
+ *              line on which it started.  Protect against infinite loop!
+ *          End the line.
+ *
+ *      Extraneous Remarks:
+ *          This is a retrofit.  Earlier, it was just  started_at() .  Later,
+ *              I generated more specific messages, and needed a way to leave
+ *              out the "that started".  I could, theoretically, have added
+ *              the extra parameter to  started_at() , but by now there are
+ *              so many of calls to it that I'd rather leave them as is, and
+ *              just change the name of the routine in the few places that
+ *              need the terser form of the message.
+ *
+ **************************************************************************** */
+
+static void print_where_started( bool show_started,
+                                   bool show_that_st,
+				   char * saved_ifile,
+				       unsigned int saved_lineno,
+                                           bool may_show_incolon)
+{
+    if ( print_msg )
+    {
+	bool fil_is_diff;
+	bool lin_is_diff;
+
+	/*  File names are case-sensitive  */
+	fil_is_diff = BOOLVAL(strcmp(saved_ifile, iname) != 0 );
+	lin_is_diff = BOOLVAL(saved_lineno != lineno );
+	if ( fil_is_diff || lin_is_diff )
+	{
+	    if ( show_started )
+	    {
+		if ( show_that_st )
+		{
+		    fprintf(message_dest, " that");
+		}else{
+		    fprintf(message_dest, " , which");
+		}
+		fprintf(message_dest, " started");
+	    }
+	    fprintf(message_dest, " on line %d", saved_lineno);
+	    if ( fil_is_diff )
+	    {
+	        fprintf(message_dest, " of file %s", saved_ifile);
+	    }
+	}
+
+	if ( may_show_incolon )
+	{
+	    in_last_colon();
+	}else{
+	    fprintf(message_dest, "\n");
+	}
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  started_at
+ *      Synopsis:       Supplemental back-reference message,
+ *                          with the "that started"  phrase,
+ *                          and with last-colon identification.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             saved_ifile          File-name saved for "back-reference"
+ *             saved_lineno         Line-number saved for "back-reference"
+ *
+ *      Outputs:
+ *         Returned Value:          None
+ *         Global Variables:
+ *         Printout:
+ *             The "...started at..." remainder of a message, giving a back-
+ *                 -reference to the  "start" point supplied in the params,
+ *                 and the start of the current Colon-definition if one is
+ *                 in effect.
+ *             Will supply a new-line and can be used to finish the line.
+ *
+ **************************************************************************** */
+
+void started_at( char * saved_ifile, unsigned int saved_lineno)
+{
+    print_where_started( TRUE, TRUE, saved_ifile, saved_lineno, TRUE);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  print_started_at
+ *      Synopsis:       Same as started_at() except output will be directed
+ *                          to  stdout  instead of to ERRMSG_DESTINATION
+ *
+ *      Extraneous Remarks:
+ *          A retrofit.  Can you tell?
+ *
+ **************************************************************************** */
+ 
+void print_started_at( char * saved_ifile, unsigned int saved_lineno)
+{
+    message_dest = stdout;
+	started_at( saved_ifile, saved_lineno);
+    message_dest = ERRMSG_DESTINATION;
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  just_started_at
+ *      Synopsis:       Supplemental back-reference message,
+ *                          with the "that started"  phrase,
+ *                          but without last-colon identification.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             saved_ifile          File-name saved for "back-reference"
+ *             saved_lineno         Line-number saved for "back-reference"
+ *
+ *      Outputs:
+ *         Returned Value:          None
+ *         Global Variables:
+ *         Printout:
+ *             The "...started at..." remainder of a message, giving a back-
+ *                 -reference to the  "start" point supplied in the params,
+ *                 and no more.
+ *             Will supply a new-line and can be used to finish the line.
+ *
+ **************************************************************************** */
+
+void just_started_at( char * saved_ifile, unsigned int saved_lineno)
+{
+    print_where_started( TRUE, TRUE, saved_ifile, saved_lineno, FALSE);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  where_started
+ *      Synopsis:       Supplemental back-reference message,
+ *                          without the "that started"  phrase,
+ *                          but with last-colon identification.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             saved_ifile          File-name saved for "back-reference"
+ *             saved_lineno         Line-number saved for "back-reference"
+ *
+ *      Outputs:
+ *         Returned Value:          None
+ *         Global Variables:
+ *         Printout:
+ *             The remainder of a message, giving a back-reference to the
+ *                 "start" point supplied in the parameters, and the start
+ *                 of the current Colon-definition if one is in effect.
+ *             Will supply a new-line and can be used to finish the line.
+ *
+ **************************************************************************** */
+
+void where_started( char * saved_ifile, unsigned int saved_lineno)
+{
+    print_where_started( FALSE, FALSE, saved_ifile, saved_lineno, TRUE);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  just_where_started
+ *      Synopsis:       Supplemental back-reference message,
+ *                          without the "that started"  phrase,
+ *                          and without last-colon identification.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             saved_ifile          File-name saved for "back-reference"
+ *             saved_lineno         Line-number saved for "back-reference"
+ *
+ *      Outputs:
+ *         Returned Value:          None
+ *         Global Variables:
+ *         Printout:
+ *             The remainder of a message, giving a back-reference to the
+ *                 "start" point supplied in the parameters, and no more.
+ *             Will supply a new-line and can be used to finish the line.
+ *
+ **************************************************************************** */
+
+void just_where_started( char * saved_ifile, unsigned int saved_lineno)
+{
+    print_where_started( FALSE, FALSE, saved_ifile, saved_lineno, FALSE);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  in_last_colon
+ *      Synopsis:       Supplemental back-reference message, identifying
+ *                          last Colon-definition if one is in effect.
+ *                      Can be used to finish the line in either case.
+ *
+ *      Inputs:
+ *         Parameters:                   NONE
+ *         Global Variables:
+ *             incolon                   TRUE if Colon-definition is in progress
+ *             last_colon_defname        Name of last colon-definition
+ *             last_colon_filename       File where last colon-def'n made
+ *             last_colon_lineno         Line number of last colon-def'n
+ *         Local Static Variables:
+ *             print_msg            Whether the beginning part of the message
+ *                                      was printed by tokenization_error()
+ *             message_dest         Message Destination. Is ERRMSG_DESTINATION
+ *                                      (stdout) usually, except sometimes...
+ *
+ *      Outputs:
+ *         Returned Value:                  NONE
+ *         Printout:
+ *             Remainder of a message:
+ *                "in definition of  ... , which started ..."
+ *
+ *      Process Explanation:
+ *          Because this routine does some of its own printing, it needs
+ *              to check the residual state of  print_msg  first.
+ *          The calling routine does not need to test   incolon ; it can
+ *              call this to end the line in either case.
+ *
+ **************************************************************************** */
+
+void in_last_colon( void )
+{
+    if ( print_msg )
+    {
+	if ( incolon )
+	{
+	    fprintf( message_dest, " in definition of  %s ",
+		strupr( last_colon_defname) );
+	    print_where_started( TRUE, FALSE,
+		last_colon_filename, last_colon_lineno, FALSE);
+	}else{
+	    fprintf(message_dest, "\n");
+	}
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  safe_malloc
+ *      Synopsis:       malloc with built-in failure test.
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             size       size_t     Size of memory-chunk to allocate
+ *             phrase     char *     Phrase to print after "... while "
+ *                                       in case of failure.
+ *
+ *      Outputs:
+ *         Returned Value:           Pointer to allocated memory
+ *         Global Variables:
+ *             fatal_err_exit       On memory allocation failure, change
+ *                                       to a special system-defined value
+ *
+ *      Error Detection:
+ *          On memory allocation failure, declare a FATAL error.  Set up
+ *              for a special system-defined EXIT value that indicates
+ *              insufficient memory.
+ *
+ *      Process Explanation:
+ *          It is the responsibility of the calling routine to be sure
+ *              the "phrase" is unique within the program.  It is intended
+ *              as a debugging aid, to help localize the point of failure.
+ *
+ **************************************************************************** */
+
+_PTR safe_malloc( size_t size, char *phrase)
+{
+    _PTR retval ;
+    retval = malloc (size);
+    if ( !retval )
+    {
+        fatal_err_exit = -ENOMEM ;
+        tokenization_error( FATAL, "Out of memory while %s.", phrase);
+    }
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:         error_summary
+ *      Synopsis:              Summarize final error-message status
+ *                                 before completing tokenization.
+ *                             Indicate if OK to produce output.
+ *      
+ *      Inputs:
+ *         Parameters:                   NONE
+ *         Global Variables:        
+ *             noerrors             "Ignore Errors" flag, set by "-i" switch
+ *             err_types_found      Accumulated Error-types.
+ *             error_categories     Table of Error-types, Message-Counters
+ *                                      and their printable names.
+ *             opc                  FCode Output Buffer Position Counter
+ *                                      (zero means there was no output).
+ *
+ *      Outputs:
+ *         Returned Value:          True = OK to produce output (But caller
+ *                                      must still verify non-zero opc)
+ *         Printout:
+ *             Various messages.
+ *
+ *      Process Explanation:
+ *          The first entry in the error_categories table is FATAL    
+ *              We won't need to print a tally of that...
+ *      
+ **************************************************************************** */
+
+bool error_summary( void )
+{
+    /*  Bit-mask of error-types that require suppressing output   */
+    static const int suppress_mask = ( FATAL | TKERROR );
+    bool retval = TRUE;
+    bool suppressing = FALSE;
+
+    /*  There's no escaping a FATAL error   */
+    if ( ( err_types_found & FATAL ) != 0 )
+    {
+	/*   FATAL error.  Don't even bother with the tally.   */
+	suppressing = TRUE;
+    } else {
+
+	if ( opc == 0 )
+	{
+	    printf ( "Nothing Tokenized");
+	}else{
+	    printf ( "Tokenization Completed");
+	}
+
+	if ( err_types_found != 0 )
+	{
+	    int indx;
+	    bool tally_started = FALSE ;
+	    printf (". ");
+	    /*
+	     *  Print a tally of the error-types;
+	     *  handle plurals and punctuation appropriately.
+	     */
+	    /*  Start at indx = 1 to skip examining FATALs   */
+	    for ( indx = 1; indx < num_categories ; indx ++ )
+	    {
+		if ( *(error_categories[indx].counter) > 0 )
+		{
+		    printf ("%s %d %s%s",
+	        	tally_started ? "," : "" ,
+			    *(error_categories[indx].counter),
+				error_categories[indx].category_name,
+				    *(error_categories[indx].counter) > 1 ?
+					 error_categories[indx].plural :
+					     error_categories[indx].single );
+		    /*  Zero out the counter, to prevent displaying the
+		     *      number of Messages twice, since it's shared
+		     *      by the "Messages" and "P_Messages" categories.
+		     */
+		    *(error_categories[indx].counter) = 0;
+		    tally_started = TRUE;
+		}
+	    }
+	}
+        printf (".\n");
+
+	if ( ( err_types_found & suppress_mask ) != 0 )
+	{    /*  Errors found.  Not  OK to produce output    */
+             /*  Unless "Ignore Errors" flag set...          */
+	    if ( INVERSE(noerrors) )
+            {
+		suppressing = TRUE;
+            }else{
+		if ( opc > 0 )
+		{
+		    printf ("Error-detection over-ridden; "
+				"producing binary output.\n");
+		}
+            }
+	}
+    }
+    if ( suppressing )
+    {
+	retval = FALSE ;
+	printf ("Suppressing binary output.\n");
+    }
+    return ( retval );
+}
+
diff --git a/toke/errhandler.h b/toke/errhandler.h
new file mode 100644
index 0000000..e714d69
--- /dev/null
+++ b/toke/errhandler.h
@@ -0,0 +1,119 @@
+#ifndef _TOKE_ERRHANDLER_H
+#define _TOKE_ERRHANDLER_H
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Function Prototypes for Tokenizer Error-Handler
+ *
+ *      Defines symbols for the various classes of errors
+ *          for the Error-Handler and for all its users
+ *
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+#include "types.h"
+
+#define  FATAL       0x80000000
+#define  TKERROR     0x04000000
+#define  WARNING     0x00200000
+#define  INFO        0x00010000
+#define  MESSAGE     0x00000800
+#define  P_MESSAGE   0x00000040
+#define  FORCE_MSG   0x00000001
+
+void init_error_handler( void);
+void tokenization_error( int err_type, char* msg, ... );
+void started_at( char * saved_ifile, unsigned int saved_lineno);
+void print_started_at( char * saved_ifile, unsigned int saved_lineno);
+void just_started_at( char * saved_ifile, unsigned int saved_lineno);
+void where_started( char * saved_ifile, unsigned int saved_lineno);
+void just_where_started( char * saved_ifile, unsigned int saved_lineno);
+void in_last_colon( void );
+_PTR safe_malloc( size_t size, char *phrase);
+bool error_summary( void );   /*  Return TRUE if OK to produce output. */
+
+
+/* **************************************************************************
+ *
+ *      Macros:
+ *          ERRMSG_DESTINATION      During development, I used this to switch
+ *               error message destination between STDOUT and STDERR, until I
+ *               settled on which is preferable.  Recently, I have proven to
+ *               my satisfaction that STDERR is preferable:  error-messages
+ *               produced by a sub-shell will be correctly synchronized with
+ *               the error-messages we produce.  When I tested using STDOUT
+ *               for error-messages, that error-case looked garbled.
+ *          FFLUSH_STDOUT           fflush( stdout) if error message destination
+ *              is STDERR, No-op if it's STDOUT.  A few of these, judiciously
+ *              placed, kept our own regular and error messages nicely in sync.
+ *
+ **************************************************************************** */
+
+#define ERRMSG_DESTINATION stderr
+#define FFLUSH_STDOUT  fflush( stdout);
+
+/*  We're no longer switching the above.
+ *  The below is left here to show what had been done formerly.
+ */
+#if -1     /*  Switchable error-message destination  */ 
+#else      /*  Switchable error-message destination  */
+#define ERRMSG_DESTINATION stdout
+#define FFLUSH_STDOUT  /*  Don't need to do anything here  */
+#endif     /*  Switchable error-message destination  */
+
+/*  Some systems don't seem to have  strupr   */
+#ifdef SYS_IS_GNU_Linux
+#define NEEDS_STRUPR
+#endif  /*   SYS_IS_GNU_Linux   */
+#ifdef SYS_IS_AIX
+#define NEEDS_STRUPR
+#endif  /*   SYS_IS_AIX   */
+/*  ???  Should this instead be tuned to Proc'r is PPC ???  Why? */
+
+#ifdef NEEDS_STRUPR
+
+/* **************************************************************************
+ *
+ *     A necessary hack for systems that don't seem
+ *         to have  strupr  and  strlwr
+ *     Let's avoid a naming conflict, just in case... 
+ *
+ **************************************************************************** */
+
+extern char *strupper( char *strung);
+#define strupr strupper
+
+extern char *strlower( char *strung);
+#define strlwr strlower
+
+
+#endif  /*   NEEDS_STRUPR   */
+
+#endif  /*   _TOKE_ERRHANDLER_H   */
diff --git a/toke/flowcontrol.c b/toke/flowcontrol.c
new file mode 100644
index 0000000..b936fd2
--- /dev/null
+++ b/toke/flowcontrol.c
@@ -0,0 +1,2080 @@
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Support Functions for tokenizing FORTH Flow-Control structures.
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Functions Exported:
+ *               These first two do their work after the calling routine
+ *                        has written the token for the required variant:
+ *
+ *          mark_do                        Mark branches for "do" variants
+ *          resolve_loop                   Resolve "loop" variants' branches
+ *
+ *               The remaining routines' descriptions are all similar:
+ *                        Write the token(s), handle the outputs, mark
+ *                        or resolve the branches, and verify correct
+ *                        control-structure matching, for tokenizing
+ *                        the ........................ statement in FORTH
+ *          emit_if                          IF
+ *          emit_else                        ELSE
+ *          emit_then                        THEN
+ *          emit_begin                       BEGIN
+ *          emit_again                       AGAIN
+ *          emit_until                       UNTIL
+ *          emit_while                       WHILE
+ *          emit_repeat                      REPEAT
+ *          emit_case                        CASE
+ *          emit_of                          OF
+ *          emit_endof                       ENDOF
+ *          emit_endcase                     ENDCASE
+ *
+ *      Three additional routines deal with matters of overall balance
+ *      of the Control-Structures, and identify the start of any that
+ *      were not balanced.  The first just displays Messages:
+ *
+ *          announce_control_structs
+ *
+ *      The other two clear and re-balance them:
+ *
+ *          clear_control_structs_to_limit
+ *          clear_control_structs
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Still to be done:
+ *          Correct analysis of Return-Stack usage around Flow-Control
+ *              constructs, including within Do-Loops or before Loop
+ *              Elements like I and J or UNLOOP or LEAVE.
+ *          Similarly, Return-Stack usage around IF ... ELSE ... THEN
+ *              statements needs analysis.  For instance, the following:
+ * 
+ *          blablabla >R  yadayada IF  R> gubble ELSE flubble R>  THEN
+ * 
+ *              is, in fact, correct, while something like:
+ * 
+ *          blablabla >R  yadayada IF  R> gubble THEN
+ * 
+ *              is an error.
+ * 
+ *          Implementing an analysis that would be sufficiently accurate
+ *              to justify reporting an ERROR with certainty (rather than
+ *              a mere WARNING speculatively) would probably require full
+ *              coordination with management of Flow-Control constructs,
+ *              and so is noted here.
+ *
+ **************************************************************************** */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "types.h"
+#include "toke.h"
+#include "emit.h"
+#include "vocabfuncts.h"
+#include "scanner.h"
+#include "stack.h"
+#include "errhandler.h"
+#include "flowcontrol.h"
+#include "stream.h"
+
+/* **************************************************************************
+ *
+ *          Global Variables Imported
+ *              opc              FCode Output Buffer Position Counter
+ *              noerrors         "Ignore Errors" flag, set by "-i" switch     
+ *              do_loop_depth    How deep we are inside DO ... LOOP variants   
+ *              incolon          State of tokenization; TRUE if inside COLON
+ *              statbuf          The word just read from the input stream
+ *              iname            Name of input file currently being processed
+ *              lineno           Current line-number being processed
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *          Global Variables Exported
+ *              control_stack_depth        Number of items on "Control-Stack"
+ *
+ **************************************************************************** */
+
+int control_stack_depth = 0;
+
+
+/* **************************************************************************
+ *
+ *              Internal Static Functions:
+ *          push_cstag                     Push an item onto the Control-Stack
+ *          pop_cstag                      Pop one item from the Control-Stack
+ *          control_stack_size_test        Test C-S depth; report if error
+ *          control_structure_mismatch     Print error-message
+ *          offset_too_large               Print error-message
+ *          matchup_control_structure      Error-check Control-Stack
+ *          matchup_two_control_structures Error-check two Control-Stack entries
+ *          emit_fc_offset                 Error-check and output FCode-Offset
+ *          control_structure_swap         Swap control-struct branch-markers
+ *          mark_backward_target           Mark target of backward-branch
+ *          resolve_backward               Resolve backward-target for branch
+ *          mark_forward_branch            Mark forward-branch
+ *          resolve_forward                Resolve forward-branch at target
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *              Internal Named Constants
+ *   Note:  These control-structure identifier tags -- a.k.a. cstags --
+ *       are used to identify the matching components of particular
+ *       control-structures.  They are passed as parameters, and either
+ *       "Pushed" onto the "Control-Stack", or compared with what is on
+ *       "Top" of the "Control-Stack", as an error-check.
+ *
+ *            name                    used by forth words:
+ *         BEGIN_CSTAG             BEGIN AGAIN UNTIL REPEAT
+ *         IF_CSTAG                IF ELSE THEN
+ *         WHILE_CSTAG             WHILE REPEAT THEN
+ *         DO_CSTAG                DO ?DO LOOP +LOOP
+ *         CASE_CSTAG              CASE OF ENDCASE
+ *         OF_CSTAG                OF ENDOF
+ *         ENDOF_CSTAG             ENDOF ENDCASE
+ *
+ *   The numbers assigned are arbitrary; they were selected for a
+ *       high unlikelihood of being encountered in normal usage,
+ *       and constructed with a hint of mnemonic value in mind.
+ *
+ **************************************************************************** */
+                                 /*     Mnemonic:   */
+#define BEGIN_CSTAG  0xC57be916  /*  CST BEGIN      */
+#define IF_CSTAG     0xC57A901f  /*  CSTAG (0) IF   */
+#define WHILE_CSTAG  0xC573412e  /*  CST WHILE      */
+#define DO_CSTAG     0xC57A90d0  /*  CSTAG (0) DO   */
+#define CASE_CSTAG   0xC57Aca5e  /*  CSTA CASE      */
+#define OF_CSTAG     0xC57A90f0  /*  CSTAG OF (0)   */
+#define ENDOF_CSTAG  0xC57e6d0f  /*  CST ENDOF   */
+
+
+/* **************************************************************************
+ *
+ *     Control-Structure identification, matching, completion and error
+ *         messaging will be supported by a data structure, which we
+ *         will call a CSTAG-Group
+ *
+ *     It consists of one "Data-item" and several "Marker" items, thus:
+ *
+ *         The Data-item in most cases will be a value of OPC (the Output
+ *             Buffer Position Counter) which will be used in calculating 
+ *             an offset or placing an offset or both, as the case may be,
+ *             for the control structure in question.  The one exception
+ *             is for a CSTAG-Group generated by a CASE statement; its
+ *             Data-item will be an integer count of the number of "OF"s
+ *             to be resolved when the ENDCASE statement is reached.
+ *
+ *         The CSTAG for the FORTH word, as described above
+ *         The name of the input file in which the word was encountered
+ *             (actually, a pointer to a mem-alloc'ed copy of the filename)
+ *         The line number, within the input file, of the word's invocation
+ *         The Absolute Token Number in all Source Input of the word
+ *         The FORTH word that started the structure, (used in error messages)
+ *         A flag to indicate when two CSTAG-Groups are created together,
+ *             which will be used to prevent duplicate error messages when,
+ *             for instance, a  DO  is mismatched with a  REPEAT .
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *               "Control-Stack" Diagram Notation
+ *
+ *     The CSTAG-Groups will be kept in an order resembling a data-stack,
+ *         (even though it won't be the data-stack itself).  We will refer
+ *         to this list of structures as the "Control Stack", and in our
+ *         comments we will show their arrangement in a format resembling
+ *         stack-diagram remarks.
+ *
+ *     In these "Control-Stack Diagrams", we will use the notation:
+ *		   <Stmt>_{FOR|BACK}w_<TAGNAM>
+ *         to represent a CSTAG-Group generated by a <Stmt> -type of
+ *         statement, with a "FORw"ard or "BACKw"ard branch-marker and
+ *         a CSTAG of the <TAGNAM> type.
+ *
+ *     A CASE-CSTAG-Group will have a different notation:
+ *		   N_OFs...CASE_CSTAG
+ *
+ *     In all cases, a CSTAG-Group will be manipulated as a unit.
+ *
+ *     The notation for Control-Stack Diagram remarks will largely resemble
+ *         the classic form used in FORTH, i.e., enclosed in parentheses,
+ *         lowest item to the left, top item on the right, with a double-
+ *         hyphen to indicate "before" or "after".
+ *
+ *     Enclosure in {curly-braces} followed by a subscript-range indicates
+ *         that the Stack-item or Group is repeated.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      We are not keeping the "Control Stack" structures on the regular
+ *          data stack because a sneaky combination of user-inputs could
+ *          throw things into chaos were we to use that scheme.  Consider
+ *          what would happen if a number were put on the stack, say, in
+ *          tokenizer-escape mode, in between elements of a flow-control
+ *          structure...  Theoretically, there is no reason to prohibit
+ *          that, but it would be unexpectedly problematical for most
+ *          FORTH-based tokenizers.
+ *
+ *      Maintaining the "Control Stack" structures in a linked-list would
+ *          be a more nearly bullet-proof approach.  The theory of operation
+ *          would be the same, broadly speaking, and there would be no need
+ *          to check for  NOT_CSTAG  and no risk of getting the elements of
+ *          the control-structures out of sync.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *          Structure Name:    cstag_group_t
+ *          Synopsis:          Control-Structure Tag Group
+ *                            
+ *   Fields:
+ *       cs_tag             Control-structure identifier tag
+ *       cs_inp_fil         Name of input file where C-S was started
+ *       cs_line_num        Line-number in Current Source when C-S was started
+ *       cs_abs_token_num  "Absolute" Token Number when C-S was started
+ *       cs_word            The FORTH word that started the C-S
+ *       cs_not_dup         FALSE if second "Control Stack" entry for same word
+ *       cs_datum           Data-Item of the Group
+ *       prev               Pointer to previous CSTAG-Group in linked-list
+ *
+ *       All data using this structure will remain private to this file,
+ *           so we declare it here rather than in the  .h  file
+ *
+ **************************************************************************** */
+
+typedef struct cstag_group {
+    unsigned long cs_tag;
+    char *cs_inp_fil;
+    unsigned int cs_line_num;
+    unsigned int cs_abs_token_num;
+    char *cs_word;
+    bool cs_not_dup;
+    unsigned long cs_datum;
+    struct cstag_group *prev;
+} cstag_group_t;
+
+/* **************************************************************************
+ *
+ *          Internal Static Variables
+ *     control_stack          "Thread" Pointer to the linked-list of 
+ *                                 "Control Stack" structure entries
+ *     not_cs_underflow       Flag used to prevent duplicate messages
+ *     not_consuming_two      Flag used to prevent loss of messages
+ *     didnt_print_otl        Flag used to prevent duplicate messages
+ *
+ **************************************************************************** */
+
+static cstag_group_t *control_stack = NULL;   /*  "Top" of the "Stack"  */
+
+/* **************************************************************************
+ *
+ *     not_cs_underflow is used only by routines that make two calls to
+ *         resolve a marker.  It is set TRUE before the first call; if
+ *         that call had a control-stack underflow, the error-message
+ *         routine resets it to FALSE.  The calling routine can then
+ *         test it as the condition for the second call.
+ *     Routines that make only one call to resolve a marker can ignore it.
+ *
+ **************************************************************************** */
+
+static bool not_cs_underflow;  /*  No need to initialize.  */
+
+/* **************************************************************************
+ *
+ *     not_consuming_two is also used only by routines that make two calls
+ *         to resolve a marker, but for this case, those routines only need  
+ *         to reset it to FALSE and not to test it; that will be done by
+ *         the  control_structure_mismatch()  routine when it looks at
+ *         the  cs_not_dup  field.  If the mismatch occurred because of
+ *         a combination of control-structures that consume one each,
+ *         the message will be printed even for the second "Control Stack"
+ *         entry.  The routine that changed it will have to set it back to
+ *         TRUE when it's done with it.
+ *
+ *     didnt_print_otl is used similarly, but only for the offset-too-large
+ *        error in the   DO ... LOOP  type of control-structures.
+ *
+ **************************************************************************** */
+
+static bool not_consuming_two = TRUE;
+static bool didnt_print_otl = TRUE;
+
+
+/* **************************************************************************
+ *
+ *      Function name:  push_cstag
+ *      Synopsis:       Push a new CSTAG-Group onto the front ("Top")
+ *                      of the (notional) Control-Stack.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             cstag           ID Tag for Control-Structure to "Push"
+ *             datum           The Data-Item for the new CSTAG-Group
+ *         Global Variables:
+ *             iname           Name of input file currently being processed
+ *             lineno          Current-Source line-number being processed
+ *             abs_tokenno     "Absolute"Token Number of word being processed
+ *             statbuf         The word just read, which started the C-S
+ *         Local Static Variables:
+ *             control_stack   Will become the new entry's "prev"
+ *
+ *      Outputs:
+ *         Returned Value:     None
+ *         Global Variables:
+ *             control_stack_depth            Incremented
+ *         Local Static Variables:
+ *             control_stack   Will become the "previous" entry in the list
+ *         Items Pushed onto Control-Stack:
+ *             Top:            A new CSTAG-Group, params as given
+ *         Memory Allocated
+ *             New CSTAG-Group structure
+ *             Duplicate of name of current input file
+ *             Duplicate of word just read
+ *         When Freed?
+ *             When Removing a CSTAG-Group, in pop_cstag()
+ *
+ **************************************************************************** */
+
+static void push_cstag( unsigned long cstag, unsigned long datum)
+{
+    cstag_group_t *cs_temp;
+
+    cs_temp = control_stack;
+    control_stack = safe_malloc( sizeof(cstag_group_t), "pushing CSTag");
+
+    control_stack->cs_tag = cstag;
+    control_stack->cs_inp_fil = strdup(iname);
+    control_stack->cs_line_num = lineno;
+    control_stack->cs_abs_token_num = abs_token_no;
+    control_stack->cs_word = strdup(statbuf);
+    control_stack->cs_not_dup = TRUE;
+    control_stack->cs_datum = datum;
+    control_stack->prev = cs_temp;
+
+    control_stack_depth++;
+    
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  pop_cstag
+ *      Synopsis:       Remove a CSTAG-Group from the front ("Top") of the
+ *                      (notional) Control-Stack.
+ *
+ *      Inputs:
+ *         Parameters:                    NONE
+ *         Global Variables:
+ *         Local Static Variables:
+ *             control_stack              CSTAG-Group on "Top"
+ *
+ *      Outputs:
+ *         Returned Value:                NONE
+ *         Global Variables:
+ *             control_stack_depth        Decremented
+ *         Local Static Variables:
+ *             control_stack              "Previous" entry will become current
+ *         Memory Freed
+ *             mem-alloc'ed copy of input filename
+ *             mem-alloc'ed copy of Control-structure FORTH word
+ *             CSTAG-Group structure
+ *         Control-Stack, # of Items Popped:  1
+ *
+ *      Process Explanation:
+ *          The calling routine might not check for empty Control-Stack,
+ *              so we have to be sure and check it here.
+ *
+ **************************************************************************** */
+
+static void pop_cstag( void)
+{
+
+    if ( control_stack != NULL )
+    {
+	cstag_group_t *cs_temp;
+
+	cs_temp = control_stack->prev;
+	free( control_stack->cs_word );
+	free( control_stack->cs_inp_fil );
+	free( control_stack );
+	control_stack = cs_temp;
+
+	control_stack_depth--;
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  control_stack_size_test
+ *      Synopsis:       Detect Control Stack underflow; report if an ERROR.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             min_depth                 Minimum depth needed
+ *         Global Variables:
+ *             control_stack_depth       Current depth of Control Stack
+ *             statbuf                   Word to name in error message
+ *
+ *      Outputs:
+ *         Returned Value:                TRUE if adequate depth
+ *         Local Static Variables:
+ *             not_cs_underflow           Reset to FALSE if underflow detected.
+ *         Printout:
+ *             Error message is printed.
+ *                 Identify the colon definition if inside one.
+ *
+ *      Process Explanation:
+ *          Some statements need more than one item on the Control Stack;
+ *             they will do their own  control_stack_depth  testing and
+ *             make a separate call to this routine.
+ *
+ **************************************************************************** */
+
+static bool control_stack_size_test( int min_depth )
+{
+    bool retval = TRUE;
+
+    if ( control_stack_depth < min_depth )
+    {
+	retval = FALSE;
+	tokenization_error ( TKERROR,
+		"Control-Stack underflow at %s", strupr(statbuf) );
+	in_last_colon();
+
+	not_cs_underflow = FALSE;   /*  See expl'n early on in this file  */
+    }
+
+    return( retval );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  control_structure_mismatch
+ *      Synopsis:       Report an ERROR after a Control Structure mismatch
+ *                      was detected.
+ *
+ *      Inputs:
+ *         Parameters:                    NONE
+ *         Global Variables:
+ *             statbuf              Word encountered, to name in error message
+ *         Local Static Variables:
+ *             control_stack        "Pushed" Control-Structure Tag Group
+ *             not_consuming_two    See explanation early on in this file
+ *         Control-Stack Items:
+ *             Top:                 "Current" Control-Structure Tag Group
+ *                                      Some of its "Marker" information
+ *                                      will be used in the error message
+ *
+ *      Outputs:
+ *         Returned Value:                NONE
+ *         Printout:
+ *             Error message is printed
+ *
+ *      Process Explanation:
+ *          This routine is called after a mismatch is detected, and
+ *              before the CSTAG-Group is "Popped" from the notional
+ *              Control-Stack.
+ *          If the  control_stack  pointer is NULL, print a different
+ *              Error message
+ *          Don't print if the "Control Stack" entry is a duplicate and
+ *              we're processing a statement that consumes two entries.
+ *
+ **************************************************************************** */
+
+static void control_structure_mismatch( void )
+{
+    if ( control_stack->cs_not_dup || not_consuming_two )
+    {
+	tokenization_error ( TKERROR,
+	    "The %s is mismatched with the %s" ,
+		strupr(statbuf), strupr(control_stack->cs_word));
+	where_started( control_stack->cs_inp_fil, control_stack->cs_line_num );
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  offset_too_large
+ *      Synopsis:       Report an ERROR after a too-large fcode-offset
+ *                      was detected.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             too_large_for_16     TRUE if the offset is too large to be
+ *                                      expressed as a 16-bit signed number.
+ *         Global Variables:
+ *             statbuf              Word encountered, to name in error message
+ *             offs16               Whether we are using 16-bit offsets
+ *         Local Static Variables:
+ *             control_stack        "Pushed" Control-Structure Tag Group
+ *             didnt_print_otl      Switch to prevent duplicate message
+ *         Control-Stack Items:
+ *             Top:                 "Current" Control-Structure Tag Group
+ *                                      Some of its "Marker" information
+ *                                      will be used in the error message
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *         Local Static Variables:
+ *             didnt_print_otl      Will be reset to FALSE
+ *             
+ *         Printout:
+ *             Error message:
+ *                 Branch offset too large between <here> and <there>
+ *             Advisory message, if we are using 8-bit offsets, will
+ *                 indicate whether switching to 16-bit offsets would help
+ *
+ *      Process Explanation:
+ *          Two branches are involved in a DO ... LOOP  structure:  an "outer"
+ *              forward-branch and a slightly smaller "inner" backward-branch.
+ *              In the majority of cases, if one offset exceeds the limit,
+ *              both will.  There is, however, a very small but distinct
+ *              possibility that the offset for the smaller branch will not
+ *              exceed the limit while the larger one does.  To prevent two
+ *              messages from being printed in the routine instance, but still
+ *              assure that one will be printed in the rare eventuality, we
+ *              utilize the flag called  didnt_print_otl  in conjunction
+ *              with the  cs_not_dup  field.
+ *
+ **************************************************************************** */
+
+static void offset_too_large( bool too_large_for_16 )
+{
+    if ( control_stack->cs_not_dup || didnt_print_otl )
+    {
+	tokenization_error( TKERROR,
+	    "Branch offset is too large between %s and the %s" ,
+		strupr(statbuf), strupr(control_stack->cs_word));
+	where_started( control_stack->cs_inp_fil, control_stack->cs_line_num );
+	if ( INVERSE( offs16 ) )
+	{
+	    if ( too_large_for_16 )
+	    {
+		tokenization_error ( INFO,
+		    "Offset would be too large even if 16-bit offsets "
+			"were in effect.\n");
+	    }else{
+		tokenization_error ( INFO,
+		    "Offset might fit if 16-bit offsets "
+			"(e.g., fcode-version2) were used.\n" );
+	    }
+	}
+    }
+    didnt_print_otl = FALSE;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_fc_offset
+ *      Synopsis:       Test whether the given FCode-Offset is out-of-range;
+ *                      before placing it into the FCode Output Buffer.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             fc_offset               The given FCode-Offset
+ *         Global Variables:
+ *             offs16                  Whether we are using 16-bit offsets
+ *             noerrors                "Ignore Errors" flag
+ *
+ *      Outputs:
+ *         Returned Value:             NONE
+ *
+ *      Error Detection:
+ *          Error if the given FCode-Offset exceeds the range that can
+ *              be expressed by the size (i.e., 8- or 16- -bits) of the
+ *              offsets we are using.  Call  offset_too_large()  to print
+ *              the Error message; also, if  noerrors  is in effect, issue
+ *              a Warning showing the actual offset and how it will be coded.
+ *
+ *      Process Explanation:
+ *          For forward-branches, the OPC will have to be adjusted to
+ *              indicate the location that was reserved for the offset
+ *              to be written, rather than the current location.  That
+ *              will all be handled by the calling routine.
+ *          We will rely on "C"'s type-conversion (type-casting) facilities.
+ *          Look at the offset value both as an 8-bit and as a 16-bit offset,
+ *              then determine the relevant course of action.
+ *
+ **************************************************************************** */
+
+static void emit_fc_offset( int fc_offset)
+{
+    int fc_offs_s16 = (s16)fc_offset;
+    int fc_offs_s8  =  (s8)fc_offset;
+    bool too_large_for_8  = BOOLVAL( fc_offset != fc_offs_s8 );
+    bool too_large_for_16 = BOOLVAL( fc_offset != fc_offs_s16);
+
+    if ( too_large_for_16 || ( INVERSE(offs16) && too_large_for_8 ) )
+    {
+	offset_too_large( too_large_for_16 );
+	if ( noerrors )
+	{
+	    int coded_as = offs16 ? (int)fc_offs_s16 : (int)fc_offs_s8 ;
+	    tokenization_error( WARNING,
+		"Actual offset is 0x%x (=dec %d), "
+		    "but it will be coded as 0x%x (=dec %d).\n",
+			fc_offset, fc_offset, coded_as, coded_as );
+	}
+    }
+
+    emit_offset( fc_offs_s16 );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  matchup_control_structure
+ *      Synopsis:       Error-check. Compare the given control-structure
+ *                          identifier tag with the one in the CSTAG-Group
+ *                          on "Top" of the "Control Stack".
+ *                      If they don't match, report an error, and, if not
+ *                          "Ignoring Errors", return Error indication.
+ *                      If no error, pass the Data-item back to the caller.
+ *                      Do not consume the CSTAG-Group; that will be the
+ *                          responsibility of the calling routine.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             cstag          Control-struc ID Tag expected by calling function
+ *         Global Variables:
+ *             noerrors       "Ignore Errors" flag
+ *         Local Static Variables:
+ *             control_stack   "Pushed" (current) Control-Structure Tag Group
+ *         Control-Stack Items:
+ *             Top:            Current CSTAG-Group
+ *
+ *      Outputs:
+ *         Returned Value:     TRUE = Successful match, no error.
+ *
+ *      Error Detection:
+ *           Control Stack underflow or cstag mismatch.  See below for details.
+ *
+ *      Process Explanation:
+ *           If the expected cstag does not match the cs_tag from the CSTAG
+ *               Group on "Top" of the "Control Stack", print an ERROR message,
+ *               and, unless the "Ignore Errors" flag is in effect, prepare
+ *               to return FALSE.
+ *          However, if we've "underflowed" the "Control Stack", we dare not
+ *              ignore errors; that could lead to things like attempting to
+ *              write a forward-branch FCode-offset to offset ZERO, over the
+ *              FCODE- or PCI- -header block.  We don't want that...
+ *          So, if the  control_stack  pointer is NULL, we will print an
+ *              ERROR message and immediately return FALSE.
+ *          Since we will not consume the CSTAG-Group, the calling routine
+ *              can access the Data-Item and any "Marker" information it may
+ *              still require via the local  control_stack  pointer. The caller
+ *              will be responsible for removing the CSTAG-Group.
+ *
+ *      Special Exception to "Ignore Errors":
+ *          At the last usage of the  CASE_CSTAG , for the ENDCASE statement,
+ *              this routine will be called to control freeing-up memory, etc.
+ *          For the OF statement, it will be called to control incrementing
+ *              the OF-count datum.
+ *          Processing an ENDCASE statement with the datum from any other
+ *              CSTAG-Group can lead to a huge loop.
+ *          Processing any other "resolver" with the datum from an ENDCASE
+ *              CSTAG-Group can lead to mistaking a very low number for an
+ *              offset into the Output Buffer and attempting to write to it.
+ *          Incrementing the datum from any other CSTAG-Group can lead to
+ *              a variety of unacceptable errors, too many to guess.
+ *          So, if either the given cstag or the cs_tag field of the "Top"
+ *              CSTAG-Group is a CASE_CSTAG , we will not ignore errors.
+ *
+ **************************************************************************** */
+
+static bool matchup_control_structure( unsigned long cstag )
+{
+    bool retval = FALSE;
+
+    if ( control_stack_size_test( 1) )
+    {
+	retval = TRUE;
+
+	if ( control_stack->cs_tag != cstag )
+	{
+	    control_structure_mismatch();
+
+	    if (    ( INVERSE(noerrors) )
+		 || ( cstag == CASE_CSTAG )
+		 || ( control_stack->cs_tag == CASE_CSTAG )
+	            )
+	    {
+		retval = FALSE;
+	    }
+	}
+
+    }
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  control_structure_swap
+ *      Synopsis:       Swap control-structure branch-marker Groups
+ *
+ *      Inputs:
+ *         Parameters:                NONE
+ *         Local Static Variables:
+ *             control_stack          Pointer to "Control Stack" linked-list
+ *         Control-Stack Items:
+ *             Top:                   CSTAG-Group_0
+ *             Next:                  CSTAG-Group_1
+ *
+ *      Outputs:
+ *         Returned Value:            NONE
+ *         Local Static Variables:
+ *             control_stack          Points to former "previous" and vice-versa
+ *         Items on Control-Stack:
+ *             Top:                   CSTAG-Group_1
+ *             Next:                  CSTAG-Group_0
+ *
+ *      Error Detection:
+ *          If control-stack depth is not at least 2, CS underflow ERROR.
+ *              This might trigger other routines' error detections also...
+ *
+ *      Extraneous Remarks:
+ *          Before control-structure identification was implemented, offsets
+ *              were kept on the data-stack, and this was a single SWAP.
+ *          When CSTAGs were added, the "Group" was only a pair kept on the
+ *               data-stack -- the CSTAG and the Data-item -- and this
+ *               became a TWO_SWAP()
+ *          For a while, when I tried keeping the CSTAG-Group on the stack,
+ *               this became a FOUR_SWAP()
+ *          That turned out to be unacceptably brittle; this way is much
+ *               more robust. 
+ *          I am so glad I called this functionality out into a separate
+ *              routine, early on in the development process.
+ *
+ *          This is the function called  1 CSROLL  in section A.3.2.3.2
+ *              of the ANSI Forth spec, which likewise corresponds to the
+ *              modifier that Wil Baden, in his characteristically elegant
+ *              nomenclature, dubbed:  BUT 
+ *
+ **************************************************************************** */
+
+static void control_structure_swap( void )
+{
+    if ( control_stack_size_test( 2) )
+    {
+	cstag_group_t *cs_temp;
+
+	cs_temp = control_stack->prev;
+
+	control_stack->prev = cs_temp->prev;
+	cs_temp->prev = control_stack;
+	control_stack = cs_temp;
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  matchup_two_control_structures
+ *      Synopsis:       For functions that resolve two CSTAG-Groups, both
+ *                          matchup both "Top of Control Stack"  entries
+ *                          before processing them...
+ *
+ *      Inputs:
+ *         Parameters:
+ *             top_cstag      Control-struc ID Tag expected on "Top" CS entry
+ *             next_cstag     Control-struc ID Tag expected on "Next" CS entry
+ *         Local Static Variables:
+ *             not_cs_underflow   Used for underflow detection.
+ *         Control-Stack Items:
+ *             Top:            Current CSTAG-Group
+ *             Next:           Next CSTAG-Group
+ *
+ *      Outputs:
+ *         Returned Value:     TRUE = Successful matches, no error.
+ *         Global Variables:
+ *             noerrors       "Ignore Errors" flag; cleared, then restored
+ *         Local Static Variables:
+ *             not_consuming_two               Cleared, then restored
+ *         Control-Stack, # of Items Popped:   2 (if matches unsuccessful)
+ *
+ *      Error Detection:
+ *          Control Stack underflow detected by control_structure_swap()
+ *          Control Structure mismatch detected by  control_structure_mismatch()
+ *
+ *      Process Explanation:
+ *          We will use  matchup_control_structure()  to do the "heavy lifting".
+ *          We will not be ignoring errors in these cases.
+ *          Save the results of a match of  top_cstag
+ *          Swap the top two CS entries.
+ *          If an underflow was detected, there's no more matching to be done.
+ *          Otherwise:
+ *              Save the results of a match of  next_cstag
+ *              Swap the top two CS entries again, to their original order.
+ *          The result is TRUE if both matches were successful.
+ *          If the matches were not successful, consume the top two entries
+ *              (unless there's only one, in which case consume it).
+ *
+ **************************************************************************** */
+
+static bool matchup_two_control_structures( unsigned long top_cstag,
+                                                unsigned long next_cstag)
+{
+    bool retval;
+    bool topmatch;
+    bool nextmatch = FALSE;
+    bool sav_noerrors = noerrors;
+    noerrors = FALSE;
+    not_consuming_two = FALSE;
+
+    not_cs_underflow = TRUE;
+    topmatch = matchup_control_structure( top_cstag);
+    if ( not_cs_underflow )
+    {
+	control_structure_swap();
+	if ( not_cs_underflow )
+	{
+	   nextmatch = matchup_control_structure( next_cstag);
+	   control_structure_swap();
+	}
+    }
+
+    retval = BOOLVAL( topmatch && nextmatch);
+
+    if ( INVERSE( retval) )
+    {
+        pop_cstag();
+        pop_cstag();
+    }
+
+    not_consuming_two = TRUE;
+    noerrors = sav_noerrors;
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  mark_backward_target
+ *      Synopsis:       Mark the target of an expected backward-branch
+ *
+ *      Associated FORTH words:                 BEGIN  DO  ?DO
+ *
+ *      Inputs:
+ *         Parameters:
+ *             cstag              Control-structure ID tag for calling function
+ *         Global Variables:
+ *             opc                Output Buffer Position Counter
+ *
+ *      Outputs:
+ *         Returned Value:            NONE
+ *         Items Pushed onto Control-Stack:
+ *             Top:                 <Stmt>_BACKw_<TAGNAM>
+ *
+ *      Process Explanation:
+ *          Just before this function is called, the token that begins the
+ *              control-structure was written to the FCode Output buffer.
+ *          OPC, the FCode Output Buffer Position Counter, is at the
+ *              destination to which the backward-branch will be targeted.
+ *          Create a CSTAG-Group with the given C-S Tag, and OPC as its datum;
+ *              push it onto the Control-Stack.
+ *          Later, when the backward-branch is installed, the FCode-offset
+ *              will be calculated as the difference between the OPC at
+ *              that time and the target-OPC we saved here.
+ *      
+ **************************************************************************** */
+
+static void mark_backward_target(unsigned long cstag )
+{
+    push_cstag( cstag, (unsigned long)opc);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  mark_forward_branch
+ *      Synopsis:       Mark the location of, and reserve space for, the
+ *                          FCode-offset associated with a forward branch.
+ *
+ *      Associated FORTH words:                 IF  WHILE  ELSE
+ *
+ *      Inputs:
+ *         Parameters:
+ *             cstag              Control-structure ID tag for calling function
+ *
+ *      Outputs:
+ *         Returned Value:            NONE
+ *         Items Pushed onto Control-Stack:
+ *             Top:                 <Stmt>_FORw_<TAGNAM>
+ *         FCode Output buffer:
+ *             Place-holder FCode-offset of zero.
+ *
+ *      Process Explanation:
+ *          Just before this function is called, the forward-branch token
+ *              that begins the control-structure was written to the FCode
+ *              Output buffer.
+ *          It will need an FCode-offset to the destination to which it will
+ *              be targeted, once that destination is known.
+ *          Create a CSTAG-Group with the given C-S Tag, and OPC as its datum;
+ *              push it onto the Control-Stack.  (This is the same action as
+ *              for marking a backward-target.)
+ *          Then write a place-holder FCode-offset of zero to the FCode
+ *              Output buffer.
+ *          Later, when the destination is known, the FCode-offset will be
+ *              calculated as the difference between the OPC at that time
+ *              and the FCode-offset location we're saving now.  That offset
+ *              will be over-written onto the place-holder offset of zero at
+ *              the location in the Output buffer that we saved on the
+ *              Control-Stack in this routine.
+ *
+ **************************************************************************** */
+
+static void mark_forward_branch(unsigned long cstag )
+{
+    mark_backward_target(cstag );
+    emit_offset(0);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  resolve_backward
+ *      Synopsis:       Resolve backward-target when a backward branch
+ *                      is reached.  Write FCode-offset to reach saved
+ *                      target from current location.
+ *      
+ *      Associated FORTH words:                 AGAIN  UNTIL  REPEAT
+ *                                                LOOP  +LOOP
+ *
+ *      Inputs:
+ *         Parameters:
+ *             cstag              Control-structure ID tag for calling function
+ *         Global Variables:
+ *             opc                Output Buffer Position Counter
+ *         Control-Stack Items:
+ *             Top:              <Stmt>_BACKw_<TAGNAM>
+ *
+ *      Outputs:
+ *         Returned Value:             NONE
+ *         Global Variables:
+ *             opc               Incremented by size of an FCode-offset
+ *         Control-Stack, # of Items Popped:   1
+ *         FCode Output buffer:
+ *             FCode-offset to reach backward-target
+ *
+ *      Error Detection:
+ *          Test for Control-structure ID tag match.
+ *
+ *      Process Explanation:
+ *          Just before this function is called, the backward-branch token
+ *              that ends the control-structure was written to the FCode
+ *              Output buffer.
+ *          The current OPC is at the point from which the FCode-offset
+ *              is to be calculated, and at which it is to be written.
+ *          The top of the Control-Stack should have the CSTAG-Group from
+ *              the statement that prepared the backward-branch target that
+ *              we expect to resolve.  Its datum is the OPC of the target
+ *              of the backward branch.
+ *          If the supplied Control-structure ID tag does not match the one
+ *              on top of the Control-Stack, announce an error.  We will
+ *              still write an FCode-offset, but it will be a place-holder
+ *              of zero.
+ *          Otherwise, the FCode-offset we will write will be the difference
+ *              between the target-OPC and our current OPC.
+ *
+ **************************************************************************** */
+
+static void resolve_backward( unsigned long cstag)
+{
+    unsigned long targ_opc;
+    int fc_offset = 0;
+
+    if ( matchup_control_structure( cstag) )
+    {
+	targ_opc = control_stack->cs_datum;
+	fc_offset = targ_opc - opc;
+    }
+
+    emit_fc_offset( fc_offset );
+    pop_cstag();
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  resolve_forward
+ *      Synopsis:       Resolve a forward-branch when its target has been
+ *                      reached.  Write the FCode-offset into the space
+ *                      that was reserved.
+ *
+ *      Associated FORTH words:                 ELSE  THEN  REPEAT
+ *                                                LOOP  +LOOP
+ *
+ *      Inputs:
+ *         Parameters:
+ *             cstag              Control-structure ID tag for calling function
+ *         Global Variables:
+ *             opc                Output Buffer Position Counter
+ *         Control-Stack Items:
+ *             Top:               <Stmt>_FORw_<TAGNAM>
+ *
+ *      Outputs:
+ *         Returned Value:             NONE
+ *         Global Variables:
+ *             opc               Changed, then restored.
+ *         Control-Stack, # of Items Popped:   1
+ *         FCode Output buffer:
+ *             FCode-offset is written to location where space was reserved
+ *                 when the forward-branch was marked.
+ *
+ *      Error Detection:
+ *          Test for Control-structure ID tag match.
+ *
+ *      Process Explanation:
+ *          Just before this function is called, the last token -- and 
+ *              possibly, FCode-offset -- that is within the scope of
+ *              what the branch might skip was written to the FCode
+ *              Output buffer.
+ *          The current OPC is at the point from which the FCode-offset
+ *              is to be calculated, but not at which it is to be written.
+ *          The top of the Control-Stack should have the CSTAG-Group from
+ *              the statement that prepared the forward-branch we expect
+ *              to resolve, and for which our current OPC is the target.
+ *              Its datum is the OPC of the space that was reserved for
+ *              the forward-branch whose target we have just reached.
+ *          If the supplied Control-structure ID tag does not match the one
+ *              on top of the Control-Stack, announce an error and we're done.
+ *          Otherwise, the datum is used both as part of the calculation of
+ *              the FCode-offset we are about to write, and as the location
+ *              to which we will write it.
+ *          The FCode-offset is calculated as the difference between our
+ *              current OPC and the reserved OPC location.
+ *          We will not be ignoring errors in these cases, because we would
+ *              be over-writing something that might not be a place-holder
+ *              for a forward-branch at an earlier location in the FCode
+ *              Output buffer.
+ *
+ **************************************************************************** */
+
+static void resolve_forward( unsigned long cstag)
+{
+    unsigned long resvd_opc;
+    bool sav_noerrors = noerrors;
+    bool cs_match_result;
+    noerrors = FALSE;
+    /*  Restore the "ignore-errors" flag before we act on our match result
+     *      because we want it to remain in effect for  emit_fc_offset()
+     */
+    cs_match_result = matchup_control_structure( cstag);
+    noerrors = sav_noerrors;
+
+    if ( cs_match_result )
+    {
+	int saved_opc;
+	int fc_offset;
+
+	resvd_opc = control_stack->cs_datum;
+	fc_offset = opc - resvd_opc;
+
+	saved_opc = opc;
+	opc = resvd_opc;
+
+
+	emit_fc_offset( fc_offset );
+	opc = saved_opc;
+    }
+    pop_cstag();
+}
+	
+
+/* **************************************************************************
+ *
+ *      The functions that follow are the exported routines that
+ *          utilize the preceding support-routines to effect their
+ *          associated FORTH words.
+ *
+ *      The routines they call will take care of most of the Error
+ *          Detection via stack-depth checking and Control-structure
+ *          ID tag matching, so those will not be called-out in the
+ *          prologues.
+ *
+ **************************************************************************** */
+
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_if
+ *      Synopsis:       All the actions when IF is encountered
+ *
+ *      Associated FORTH word:                 IF
+ *
+ *      Inputs:
+ *         Parameters:             NONE
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Items Pushed onto Control-Stack:
+ *             Top:                If_FORw_IF
+ *         FCode Output buffer:
+ *             Token for conditional branch -- b?branch -- followed by
+ *                 place-holder of zero for FCode-offset
+ *              
+ *
+ **************************************************************************** */
+
+void emit_if( void )
+{
+    emit_token("b?branch");
+    mark_forward_branch( IF_CSTAG );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_then
+ *      Synopsis:       All the actions when THEN is encountered; also
+ *                      part of another forward-branch resolver's action.
+ *
+ *      Associated FORTH words:                 THEN  ELSE
+ *
+ *      Inputs:
+ *         Parameters:                  NONE
+ *         Local Static Variables:
+ *             control_stack       Points to "Top" Control-Structure Tag Group
+ *         Control-Stack Items:
+ *             Top:                If_FORw_IF | While_FORw_WHILE
+ *
+ *      Outputs:
+ *         Returned Value:              NONE
+ *         Control-Stack, # of Items Popped:   1
+ *         FCode Output buffer:
+ *             Token for forward-resolve -- b(>resolve) -- then the space
+ *                 reserved for the forward-branch FCode-offset is filled
+ *                 in so that it reaches the token after the  b(>resolve) . 
+ *
+ *      Process Explanation:
+ *          The THEN statement or the ELSE statement must be able to resolve
+ *              a WHILE statement, in order to implement the extended flow-
+ *              -control structures as described in sec. A.3.2.3.2 of the
+ *              ANSI Forth Spec.
+ *          But we must prevent the sequence  IF ... BEGIN ...  REPEAT  from
+ *              compiling as though it were:  IF ... BEGIN ...  AGAIN THEN
+ *          We do this by having a separate CSTAG for WHILE and allowing
+ *              it here but not allowing the IF_CSTAG when processing REPEAT.
+ *
+ **************************************************************************** */
+
+void emit_then( void )
+{
+    emit_token("b(>resolve)");
+    if ( control_stack != NULL )
+    {
+	if ( control_stack->cs_tag == WHILE_CSTAG )
+	{
+	    control_stack->cs_tag = IF_CSTAG;
+	}
+    }
+    resolve_forward( IF_CSTAG );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_else
+ *      Synopsis:       All the actions when ELSE is encountered
+ *
+ *      Associated FORTH word:                 ELSE
+ *
+ *      Inputs:
+ *         Parameters:             NONE
+ *         Global Variables:
+ *             control_stack_depth   Current depth of Control Stack
+ *         Local Static Variables:
+ *             not_cs_underflow      If this is FALSE after the c-s swap, it
+ *                                       means an underflow resulted; skip
+ *                                       the call to resolve the first marker.
+ *         Control-Stack Items:
+ *             Top:                {If_FORw_IF}1
+ *                 (Datum is OPC of earlier forward-branch; must be resolved.)
+ *
+ *      Outputs:
+ *         Returned Value:             NONE
+ *         Control-Stack, # of Items Popped:   1
+ *         Items Pushed onto Control-Stack:
+ *             Top:                {If_FORw_IF}2
+ *                 (Datum is current OPC, after forward-branch is placed.)
+ *         FCode Output buffer:
+ *             Token for unconditional branch -- bbranch-- followed by
+ *                 place-holder of zero for FCode-offset.  Then, token
+ *                  for forward-resolve -- b(>resolve) -- and the space
+ *                  reserved earlier for the conditional forward-branch
+ *                  FCode-offset is filled in to reach the token after
+ *                  the  b(>resolve) .
+ *
+ *      Error Detection:
+ *          If the "Control-Stack" is empty, bypass the forward branch
+ *              and let the call to  control_structure_swap()  report
+ *              the underflow error.  Then use  not_cs_underflow  to
+ *              control whether to resolve the forward-branch. 
+ *
+ *      Process Explanation:
+ *          The final item needed within the scope of what the earlier
+ *              conditional branch might skip is an unconditional branch
+ *              over the "else"-clause to follow.  After that, the earlier
+ *              conditional branch needs to be resolved.  This last step
+ *              is identical to the action of  THEN .
+ *
+ **************************************************************************** */
+
+void emit_else( void )
+{
+    if ( control_stack_depth > 0 )
+    {
+	emit_token("bbranch");
+	mark_forward_branch( IF_CSTAG );
+    }
+    not_cs_underflow = TRUE;
+    control_structure_swap();
+    if ( not_cs_underflow )
+    {
+        emit_then();
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_begin
+ *      Synopsis:       All the actions when BEGIN is encountered
+ *
+ *      Associated FORTH word:                 BEGIN
+ *
+ *      Inputs:
+ *         Parameters:             NONE
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Items Pushed onto Control-Stack:
+ *             Top:                Begin_BACKw_BEGIN
+ *                 (Datum is current OPC, target of future backward-branch)
+ *         FCode Output buffer:
+ *             Token for target of backward branch -- b(<mark)
+ *
+ **************************************************************************** */
+
+void emit_begin( void )
+{
+    emit_token("b(<mark)");
+    mark_backward_target( BEGIN_CSTAG );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_again
+ *      Synopsis:       All the actions when AGAIN is encountered
+ *
+ *      Associated FORTH words:               AGAIN  REPEAT
+ *
+ *      Inputs:
+ *         Parameters:             NONE
+ *         Control-Stack Items:
+ *             Top:                Begin_BACKw_BEGIN
+ *                        (Datum is OPC of backward-branch target at BEGIN)
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Control-Stack, # of Items Popped:   1
+ *         FCode Output buffer:
+ *             Token for unconditional branch -- bbranch -- followed by
+ *                 FCode-offset that reaches just after the  b(<mark) 
+ *                 token at the corresponding  BEGIN  statement. 
+ *
+ *      Process Explanation:
+ *          The FCode-offset is calculated as the difference between our
+ *              current OPC and the target-OPC saved on the Control-Stack.
+ *              
+ **************************************************************************** */
+
+void emit_again( void )
+{
+    emit_token("bbranch");
+    resolve_backward( BEGIN_CSTAG );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_until
+ *      Synopsis:       All the actions when UNTIL is encountered
+ *
+ *      Associated FORTH word:                 UNTIL
+ *
+ *      Process Explanation:
+ *          Same as AGAIN except token is conditional branch -- b?branch --
+ *              instead of unconditional.
+ *
+ **************************************************************************** */
+
+void emit_until( void )
+{
+    emit_token("b?branch");
+    resolve_backward( BEGIN_CSTAG );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_while
+ *      Synopsis:       All the actions when WHILE is encountered
+ *
+ *      Associated FORTH word:                 WHILE
+ *
+ *      Inputs:
+ *         Parameters:                  NONE
+ *         Global Variables:
+ *             control_stack_depth       Number of items on "Control-Stack"
+ *         Control-Stack Items:
+ *             Top:                      Begin_BACKw_BEGIN
+ *                                 (Datum is OPC of backward-branch target)
+ *
+ *      Outputs:
+ *         Returned Value:              NONE
+ *         Control-Stack:        1 item added below top item.
+ *         Items on Control-Stack:
+ *             Top:                Begin_BACKw_BEGIN
+ *             Next:               While_FORw_WHILE
+ *         FCode Output buffer:
+ *             Token for conditional branch -- b?branch -- followed by
+ *                 place-holder of zero for FCode-offset
+ *
+ *      Error Detection:
+ *          If the "Control-Stack" is empty, bypass creating the branch
+ *              and let the call to  control_structure_swap()  report
+ *              the underflow error.
+ *
+ *      Process Explanation:
+ *          Output a conditional forward-branch sequence, similar to  IF 
+ *              (except with a WHILE CSTAG), but be sure to leave the
+ *              control-structure branch-marker that was created by the
+ *              preceding  BEGIN   on top of the one just generated:
+ *              the  BEGIN  needs to be resolved first in any case, and
+ *              doing this here is the key to implementing the extended
+ *              control-flow structures as described in sec. A.3.2.3.2
+ *              of the ANSI Forth Spec.
+ *
+ *      Extraneous Remarks:
+ *          It was for the use of this function that Wil Baden coined the
+ *              name BUT for the control-structure swap routine.  The idea
+ *              was that the implementation of WHILE could be boiled down
+ *              to:  IF BUT   (couldn't quite fit an AND in there...;-} )
+ *          Naturally, this implementation is a smidgeon more complicated...
+ *
+ **************************************************************************** */
+
+void emit_while( void )
+{
+    if ( control_stack_depth > 0 )
+    {
+	emit_token("b?branch");
+	mark_forward_branch( WHILE_CSTAG );
+    }
+    control_structure_swap();
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_repeat
+ *      Synopsis:       All the actions when REPEAT is encountered
+ *
+ *      Associated FORTH word:                 REPEAT
+ *
+ *      Inputs:
+ *         Parameters:                  NONE
+ *         Local Static Variables:
+ *             not_cs_underflow    If FALSE after first call to resolve marker,
+ *                                     an underflow resulted; skip second call.
+ *         Control-Stack Items:
+ *             Top:                Begin_BACKw_BEGIN
+ *                        (Datum is OPC of backward-branch target at BEGIN)
+ *             Next:               If_FORw_IF
+ *                        (Datum is OPC of FCode-offset place-holder)
+ *
+ *      Outputs:
+ *         Returned Value:                    NONE
+ *         Local Static Variables:
+ *             not_consuming_two              Cleared, then restored
+ *         Control-Stack, # of Items Popped:   2
+ *         FCode Output buffer:
+ *             Token for unconditional branch -- bbranch -- followed by
+ *                 FCode-offset that reaches just after the  b(<mark) 
+ *                 token at the corresponding  BEGIN  statement.  Then
+ *                 the token for forward-resolve -- b(>resolve) -- and
+ *                 the space reserved for the conditional forward-branch
+ *                 FCode-offset is filled in so that it reaches the token
+ *                 after the  b(>resolve) .
+ *
+ *      Process Explanation:
+ *          The action is identical to that taken for AGAIN followed
+ *               by the action for THEN.
+ *          The Local Static Variable  not_consuming_two  gets cleared
+ *               and restored by this routine.
+ *
+ **************************************************************************** */
+
+void emit_repeat( void )
+{
+    if ( matchup_two_control_structures( BEGIN_CSTAG, WHILE_CSTAG ) )
+    {
+	not_cs_underflow = TRUE;
+	not_consuming_two = FALSE;
+	emit_again();
+	if ( not_cs_underflow )
+	{
+            emit_token("b(>resolve)");
+	    resolve_forward( WHILE_CSTAG );
+	}
+	not_consuming_two = TRUE;
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  mark_do
+ *      Synopsis:       Common routine for marking the branches for
+ *                      the "do" variants
+ *
+ *      Associated FORTH words:              DO  ?DO
+ *
+ *      Inputs:
+ *         Parameters:                  NONE
+ *
+ *      Outputs:
+ *         Returned Value:              NONE
+ *         Global Variables:
+ *             do_loop_depth         Incremented
+ *         Items Pushed onto Control-Stack:
+ *             Top:              Do_FORw_DO
+ *             Next:             Do_BACKw_DO
+ *         FCode Output buffer:
+ *             Place-holder of zero for FCode-offset
+ *
+ *      Error Detection:
+ *          The  do_loop_depth  counter will be used by other routines
+ *              to detect misplaced "LEAVE", "UNLOOP", "I" and suchlike.
+ *              (Imbalanced "LOOP"  statements are detected by the CSTag
+ *              matching mechanism.)
+ *
+ *      Process Explanation:
+ *          Just before this function is called, the forward-branching token
+ *              for the "DO" variant that begins the control-structure was
+ *              written to the FCode Output buffer.
+ *          It needs an FCode-offset for a forward-branch to just after
+ *              its corresponding "LOOP" variant and the FCode-offset
+ *              associated therewith.
+ *          That "LOOP" variant's associated FCode-offset is targeted
+ *              to the token that follows the one for this "DO" variant
+ *              and its FCode-offset.
+ *          Mark the forward-branch with the C-S Tag for DO and write a
+ *              place-holder FCode-offset of zero to FCode Output.
+ *          Indicate that the mark that will be processed second (but which
+ *              was made first) is a duplicate of the one that will be
+ *              processed first.
+ *          Then mark the backward-branch target, also with the DO C-S Tag.
+ *          Finally, increment the  do_loop_depth  counter.
+ *
+ *      Extraneous Remarks:
+ *          This is more complicated to describe than to code...  ;-)
+ *
+ **************************************************************************** */
+
+void mark_do( void )
+{
+    mark_forward_branch( DO_CSTAG);
+    control_stack->cs_not_dup = FALSE;
+    mark_backward_target( DO_CSTAG);
+    do_loop_depth++;
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  resolve_loop
+ *      Synopsis:       Common routine for resolving the branches for
+ *                      the "loop" variants.
+ *
+ *      Associated FORTH words:              LOOP  +LOOP
+ *
+ *      Inputs:
+ *         Parameters:                  NONE
+ *         Global Variables:
+ *             statbuf             Word read from input stream (either "loop"
+ *                                     or "+loop"), used for Error Message.
+ *         Local Static Variables:
+ *             not_cs_underflow    If FALSE after first call to resolve marker,
+ *                                     an underflow resulted; skip second call.
+ *         Control-Stack Items:
+ *             Top:                Do_FORw_DO
+ *             Next:               Do_BACKw_DO
+ *
+ *      Outputs:
+ *         Returned Value:                    NONE
+ *         Global Variables:
+ *             do_loop_depth                  Decremented
+ *         Local Static Variables:
+ *             not_consuming_two              Cleared, then restored
+ *             didnt_print_otl                Set, then set again at end.
+ *         Control-Stack, # of Items Popped:   2
+ *         FCode Output buffer:
+ *             FCode-offset that reaches just after the token of the
+ *                 corresponding "DO" variant.  Then the space reserved
+ *                 for the FCode-offset of the forward-branch associated
+ *                 with the "DO" variant is filled in so that it reaches
+ *                 the token just after the "DO" variant's FCode-offset.
+ *                 
+ *      Error Detection:
+ *          A value of zero in  do_loop_depth  before it's decremented
+ *              indicates a  DO ... LOOP  imbalance, which is an ERROR,
+ *              but our other error-reporting mechanisms will catch it,
+ *              so we don't check or report it here.
+ *
+ *      Process Explanation:
+ *          Just before this function is called, the backward-branching
+ *              token for the "LOOP" variant that ends the control-structure
+ *              was written to the FCode Output buffer.
+ *          It needs an FCode-offset for a backward-branch targeted just
+ *              after its corresponding "DO" variant and the FCode-offset
+ *              associated therewith.
+ *          That "DO" variant's associated FCode-offset is targeted to
+ *              the token that follows the one for this "LOOP" variant
+ *              and its FCode-offset.
+ *          Make sure there are two DO C-S Tag entries on the Control Stack.
+ *          Resolve the backward-branch, matching your target to the first
+ *              C-S Tag for DO
+ *          Then resolve the forward-branch, targeting to your new OPC
+ *              position, and also making sure you match the DO C-S Tag.
+ *          We keep track of  do_loop_depth  for other error-detection
+ *              by decrementing it; make sure it doesn't go below zero.
+ *          Don't bother resolving the forward-branch if we underflowed
+ *              the "Control Stack" trying to resolve the backward-branch.
+ *          If the two top C-S Tag entries are not for a DO statement, the
+ *              matchup_two_control_structures() routine will consume both
+ *              or up to two of them, and we will place a dummy offset of
+ *              zero to follow-up the backward-branching token that has
+ *              already been written.
+ *      
+ *      Extraneous Remarks:
+ *          This is only a little more complicated to describe
+ *              than to code...  ;-)
+ *
+ **************************************************************************** */
+
+void resolve_loop( void )
+{
+    if ( INVERSE( matchup_two_control_structures( DO_CSTAG, DO_CSTAG) ) )
+    {
+	emit_offset( 0 );
+    }else{
+	not_cs_underflow = TRUE;
+	didnt_print_otl = TRUE;
+	not_consuming_two = FALSE;
+	resolve_backward( DO_CSTAG);
+	if ( not_cs_underflow )
+	{
+	    resolve_forward( DO_CSTAG);
+	}
+	if ( do_loop_depth > 0 ) do_loop_depth--;
+	not_consuming_two = TRUE;
+	didnt_print_otl = TRUE;   /*  Might have gotten cleared   */
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_case
+ *      Synopsis:       All the actions when CASE is encountered
+ *
+ *      Associated FORTH word:                 CASE
+ *
+ *      Inputs:
+ *         Parameters:             NONE
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Items Pushed onto Control-Stack:
+ *             Top:              N_OFs=0...CASE_CSTAG
+ *                    (Datum is 0 , Initial count of  OF .. ENDOF  pairs)
+ *         FCode Output buffer:
+ *             Token for start of a CASE structure -- b(case)
+ *                 Does not require an FCode-offset.
+ *
+ **************************************************************************** */
+
+void emit_case( void )
+{
+    push_cstag( CASE_CSTAG, 0);
+    emit_token("b(case)");
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_of
+ *      Synopsis:       All the actions when OF is encountered
+ *
+ *      Associated FORTH word:                 OF
+ *
+ *      Inputs:
+ *         Parameters:             NONE
+ *         Control-Stack Items:
+ *             Top:                N_OFs...CASE_CSTAG
+ *                    (Datum is OF-count, number of  OF .. ENDOF  pairs)
+ *            {Next and beyond}:   {Endof_FORw_ENDOF}1..n_ofs
+ *            { Repeat for OF-count number of times }
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Control-Stack, 1 Item Pushed, 1 modified:
+ *             Top:                Of_FORw_OF
+ *             Next:               N_OFs+1...CASE_CSTAG
+ *                    (Datum has been incremented)
+ *            {3rd and beyond}:    {Endof_FORw_ENDOF}1..n_ofs
+ *            { Repeat for 1 through the un-incremented OF-count }
+ *            (Same as Next etcetera at input-time.)
+ *         FCode Output buffer:
+ *             Token for OF statement -- b(of) -- followed by
+ *                 place-holder FCode-offset of zero
+ *
+ *      Error Detection:
+ *          Matchup CASE-cstag before incrementing OF-count
+ *
+ *      Process Explanation:
+ *          Main difference between this implementation and that outlined
+ *              in "the book" (see below) is that we do not directly use
+ *              the routine for the IF statement's flow-control; we will
+ *              use a different CSTAG for better mismatch detection.
+ *
+ *      Extraneous Remarks:
+ *          This is a "by the book" (ANSI Forth spec, section A.3.2.3.2)
+ *              implementation (mostly).  Incrementing the OF-count here,
+ *              after we've matched up the CSTAG, gives us (and the user)
+ *              just a little bit more protection...
+ *
+ **************************************************************************** */
+
+void emit_of( void )
+{
+
+    if ( matchup_control_structure( CASE_CSTAG ) )
+    {
+	emit_token("b(of)");
+
+	/*
+	 *  See comment-block about "Control-Stack" Diagram Notation
+	 *       early on in this file.
+	 *
+	 */
+
+	/* (    {Endof_FORw_ENDOF}1..n_ofs  N_OFs...CASE_CSTAG -- )          */
+
+	/*  Increment the OF-count .  */
+	(control_stack->cs_datum)++;
+
+	/* (    {Endof_FORw_ENDOF}1..n_ofs  N_OFs+1...CASE_CSTAG -- )        */
+
+	mark_forward_branch( OF_CSTAG );
+	/* ( -- {Endof_FORw_ENDOF}1..n_ofs  N_OFs+1...CASE_CSTAG Of_FORw_OF )
+	 */
+    }
+    /*  Leave the CSTAG-Group on the "Control-Stack" .  */
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_endof
+ *      Synopsis:       All the actions when ENDOF is encountered
+ *
+ *      Associated FORTH word:                 ENDOF
+ *
+ *      Inputs:
+ *         Parameters:             NONE
+ *         Control-Stack Items:
+ *             Top:                Of_FORw_OF
+ *             Next:               N_OFs+1...CASE_CSTAG
+ *                    (Datum has been incremented)
+ *            {3rd and beyond}:    {Endof_FORw_ENDOF}1..n_ofs
+ *            { Repeat for 1 through the un-incremented OF-count )
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Control-Stack, 1 Item Popped, 1 new Item Pushed.
+ *             Top:                N_OFs...CASE_CSTAG
+ *                    (The count itself is unchanged from input-time, but
+ *                         the number of {Endof_FORw_ENDOF} CSTAG-Groups
+ *                         has caught up with this number, so it is
+ *                         no longer notated as " + 1 ").
+ *            {Next and beyond}:   {Endof_FORw_ENDOF}1..n_ofs
+ *            { Repeat for 1 through the updated OF-count )
+ *         FCode Output buffer:
+ *             Token for ENDOF statement -- b(endof) -- followed by
+ *                 place-holder FCode-offset of zero.  Then the space reserved
+ *                 for the FCode-offset of the forward-branch associated
+ *                 with the "OF" statement is filled in so that it reaches
+ *                 the token just after the "ENDOF" statement's FCode-offset.
+ *
+ *      Error Detection:
+ *          If control-stack depth  is not at least 2, CS underflow ERROR
+ *              and no further action.
+ *          Routine that resolves the forward-branch checks for matchup error.
+ *
+ **************************************************************************** */
+
+void emit_endof( void )
+{
+    if ( control_stack_size_test( 2) )
+    {
+	emit_token("b(endof)");
+
+	/*  See "Control-Stack" Diagram Notation comment-block  */
+
+	/*  Stack-diagrams might need to be split across lines.  */
+
+	/* (    {Endof_FORw_ENDOF}1..n_ofs  N_OFs+1...CASE_CSTAG  ...  
+	 *                       ...                          Of_FORw_OF -- )
+	 */
+	mark_forward_branch(ENDOF_CSTAG);
+	/* ( -- {Endof_FORw_ENDOF}1..n_ofs  N_OFs+1...CASE_CSTAG  ...  
+	 *                       ...  Of_FORw_OF  {Endof_FORw_ENDOF}n_ofs+1 )
+	 */
+
+	control_structure_swap();
+	/* ( -- {Endof_FORw_ENDOF}1..n_ofs  N_OFs+1...CASE_CSTAG  ...
+	 *                       ...  {Endof_FORw_ENDOF}n_ofs+1  Of_FORw_OF )
+	 */
+
+	resolve_forward( OF_CSTAG );
+	/* ( -- {Endof_FORw_ENDOF}1..n_ofs  N_OFs+1...CASE_CSTAG        ...
+	 *                       ...  {Endof_FORw_ENDOF}n_ofs+1  )
+	 */
+
+	control_structure_swap();
+	/* ( -- {Endof_FORw_ENDOF}1..n_ofs         ...
+	 *                       ...  {Endof_FORw_ENDOF}n_ofs+1   ...
+	 *                                        ...  N_OFs+1...CASE_CSTAG )
+	 */
+
+	/*  The number of ENDOF-tagged Forward-Marker pairs has now
+	 *     caught up with the incremented OF-count; therefore,
+	 *     we can notate the above as:
+	 *
+	 *  ( {Endof_FORw_ENDOF}1..n_ofs  N_OFs CASE_CSTAG )
+	 *
+	 *     and we are ready for another  OF ... ENDOF  pair,
+	 *     or for the ENDCASE statement.
+	 */
+    }
+
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  emit_endcase
+ *      Synopsis:       All the actions when ENDCASE is encountered
+ *
+ *      Associated FORTH word:                 ENDCASE
+ *
+ *      Inputs:
+ *         Parameters:             NONE
+ *         Control-Stack Items:
+ *             Top:                N_OFs...CASE_CSTAG
+ *                    (Datum is OF-count, number of  OF .. ENDOF  pairs)
+ *            {Next and beyond}:   {Endof_FORw_ENDOF}1..n_ofs
+ *            { Repeat for OF-count number of times }
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Control-Stack, # of Items Popped:  OF-count + 1
+ *         FCode Output buffer:
+ *             Token for ENDCASE statement -- b(endcase)
+ *             Then the spaces reserved for the FCode-offsets of all the
+ *                 forward-branches associated with the OF-count number
+ *                 of ENDOF statements are filled in so that they reach
+ *                 the token just after this "ENDCASE" statement.
+ *
+ *      Error Detection:
+ *          Routine that resolves the forward-branch checks for matchup error
+ *              for each forward-branch filled in, plus the matchup routine
+ *              checks before the OF-count is retrieved.
+ *
+ *      Process Explanation:
+ *          Retrieve the OF-count and resolve that number of ENDOF statements
+ *      
+ *      Extraneous Remarks:
+ *          The setup makes coding this routine appear fairly simple...  ;-}
+ *
+ **************************************************************************** */
+
+void emit_endcase( void )
+{
+    unsigned long n_endofs ;
+    if ( matchup_control_structure( CASE_CSTAG) )
+    {
+	int indx;
+
+	emit_token("b(endcase)");
+	n_endofs = control_stack->cs_datum;
+	for ( indx = 0 ; indx < n_endofs ; indx++ )
+	{
+	    /*  Because  matchup_control_structure  doesn't pop the
+	     *      control-stack, we have the  N_OFs...CASE_CSTAG
+	     *      item on top of the  Endof_FORw_ENDOF  item we
+	     *      want to resolve.  We need to keep it there so
+	     *      the  POP  is valid for the other path as well
+	     *      as at the end of this one.
+	     *  So we  SWAP  to get at the  Endof_FORw_ENDOF  item.
+	     */
+	    control_structure_swap();
+	    resolve_forward( ENDOF_CSTAG);
+	}
+    }
+    pop_cstag();
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  control_struct_incomplete
+ *      Synopsis:       Print a Message of given severity with origin info for
+ *                          a control-structure that has not been completed.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             c_s_entry             Control-structure about which to display
+ *             severity              Severity of the messages to display.
+ *             call_cond             String identifying Calling Condition;
+ *                                       used in the message.
+ *
+ *      Outputs:
+ *         Returned Value:           NONE
+ *             
+ *         Printout:
+ *             Message of given severity...
+ *
+ *      Process Explanation:
+ *          The calling routine will be responsible for all filtering of
+ *               duplicate structures and the like.  This routine will
+ *               simply display a message.
+ *
+ **************************************************************************** */
+
+static void control_struct_incomplete(
+			    int severity,
+				char *call_cond,
+				    cstag_group_t *c_s_entry)
+{
+    tokenization_error ( severity,
+	"%s before completion of %s" ,
+	    call_cond, strupr(c_s_entry->cs_word));
+    where_started( c_s_entry->cs_inp_fil, c_s_entry->cs_line_num );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  announce_control_structs
+ *      Synopsis:       Print a series of Messages (of severity as specified)
+ *                          announcing that the calling event is occurring
+ *                          in the context of Control-Flow structure(s),
+ *                          back to the given limit.  Leave the control
+ *                          structures in effect.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             severity              Severity of the messages to display.
+ *             call_cond             String identifying Calling Condition;
+ *                                       used in the message.
+ *             abs_token_limit       Limit, in terms of abs_token_no
+ *         Local Static Variables:
+ *             control_stack         Pointer to "Top" of "Control-Stack"
+ *
+ *      Outputs:
+ *         Returned Value:           NONE
+ *         Printout:
+ *             A Message for each unresolved Control-Flow structure.
+ *
+ **************************************************************************** */
+
+void announce_control_structs( int severity, char *call_cond,
+				          unsigned int abs_token_limit)
+{
+    cstag_group_t *cs_temp = control_stack;
+    while ( cs_temp != NULL )
+    {
+	if ( cs_temp->cs_abs_token_num < abs_token_limit )
+	{
+	    break;
+	}
+	if ( cs_temp->cs_not_dup )
+	{
+	    control_struct_incomplete( severity, call_cond, cs_temp );
+	}
+	cs_temp = cs_temp->prev;
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  clear_control_structs_to_limit
+ *      Synopsis:       Clear items from the "Control-Stack" back to the given
+ *                          limit.  Print error-messages with origin info for
+ *                          control-structures that have not been completed.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             call_cond                 String identifying Calling Condition;
+ *                                           used in the Error message.
+ *             abs_token_limit           Limit, in terms of abs_token_no
+ *         Global Variables:
+ *             control_stack_depth       Number of items on "Control-Stack"
+ *             control_stack             Pointer to "Top" of "Control-Stack"
+ *         Control-Stack Items:
+ *             The  cs_inp_fil  and  cs_line_num  tags of any item cleared
+ *                 from the "Control-Stack" are used in error-messages.
+ *
+ *      Outputs:
+ *         Returned Value: 
+ *         Global Variables:
+ *             do_loop_depth             Decremented when "DO" item cleared.
+ *             control_stack_depth       Decremented by called routine.
+ *         Control-Stack, # of Items Popped:  As many as go back to given limit
+ *         Memory Freed
+ *             By called routine.
+ *
+ *      Error Detection:
+ *          Any item on the "Control-Stack" represents a Control-Structure
+ *              that was not completed when the Calling Condition was
+ *              encountered.  Error; identify the origin of the structure.
+ *          No special actions if  noerrors  is set.
+ *
+ *      Process Explanation:
+ *          The given limit corresponds to the value of  abs_token_no  at
+ *              the time the colon-definition (or whatever...) was created.
+ *              Any kind of Control-Structure imbalance at the end of the
+ *              colon-definition is an error and the entries must be cleared,
+ *              but the colon-definition may have been created inside nested
+ *              interpretation-time Control-Structures, and those must be
+ *              preserved. 
+ *             
+ *          Of course, if this routine is called with a given limit of zero,
+ *              that would mean all the entries are to be cleared.  That will
+ *              be the way  clear_control_structs()  is implemented.
+ *          We control the loop by the  cs_abs_token_num  field, but also
+ *              make sure we haven't underflowed  control_stack_depth
+ *          We skip messages and other processing for items that are duplicates
+ *                    of others, based on the  cs_not_dup  field.
+ *               If the cs_tag field is  DO_CSTAG  we decrement  do_loop_depth
+ *          The  pop_cstag()  routine takes care of the rest.
+ *               
+ *      Extraneous Remarks:
+ *          This is a retrofit; necessary because we now  permit definitions
+ *              to occur inside interpretation-time Control-Structures.  Calls
+ *              to  clear_control_structs()  are already scattered around...
+ *
+ **************************************************************************** */
+
+void clear_control_structs_to_limit( char *call_cond,
+				          unsigned int abs_token_limit)
+{
+    while ( control_stack_depth > 0 )
+    {
+	if ( control_stack->cs_abs_token_num < abs_token_limit )
+	{
+	    break;
+	}
+	if ( control_stack->cs_not_dup )
+	{
+	    control_struct_incomplete( TKERROR, call_cond, control_stack );
+	    if ( control_stack->cs_tag == DO_CSTAG) do_loop_depth--;
+	}
+	pop_cstag();
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  clear_control_structs
+ *      Synopsis:       Make sure the "Control-Stack" is cleared, and print
+ *                          error-messages (giving origin information) for
+ *                          control-structures that have not been completed.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             call_cond                 String identifying Calling Condition;
+ *                                           used in the Error message.
+ *         Global Variables:
+ *             control_stack_depth       Number of items on "Control-Stack"
+ *             control_stack             Pointer to "Top" of "Control-Stack"
+ *         Control-Stack Items:
+ *             The  cs_inp_fil  and  cs_line_num  tags of any item found on
+ *                 the "Control-Stack" are used in error-messages.
+ *
+ *      Outputs:
+ *         Returned Value:               NONE
+ *         Global Variables:
+ *             control_stack_depth       Reset to zero.
+ *             do_loop_depth             Reset to zero.
+ *         Control-Stack, # of Items Popped:    All of them
+ *             
+ *      Error Detection:
+ *          Any item on the "Control-Stack" represents a Control-Structure
+ *              that was not completed when the Calling Condition was
+ *              encountered.  Error; identify the origin of the structure.
+ *          No special actions if  noerrors  is set.
+ *
+ *      Process Explanation:
+ *          Filter the duplicate messages caused by structures (e.g., DO)
+ *              that place two entries on the "Control-Stack" by testing
+ *              the  cs_not_dup  field of the "Top" "Control-Stack" item,
+ *              which would indicate double-entry...
+ *
+ *      Extraneous Remarks:
+ *          This is called before a definition of any kind, and after a 
+ *              colon-definition.  Flow-control constructs should *never*
+ *              be allowed to cross over between immediate-execution mode
+ *              and compilation mode.  Likewise, not between device-nodes.
+ *          Also, at the end of tokenization, there should not be any
+ *              unresolved flow-control constructs.
+ *
+ **************************************************************************** */
+
+void clear_control_structs( char *call_cond)
+{
+    clear_control_structs_to_limit( call_cond, 0);
+}
diff --git a/toke/flowcontrol.h b/toke/flowcontrol.h
new file mode 100644
index 0000000..e2aabf8
--- /dev/null
+++ b/toke/flowcontrol.h
@@ -0,0 +1,74 @@
+#ifndef _TOKE_FLOWCONTROL_H
+#define _TOKE_FLOWCONTROL_H
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      External Variables and Function Prototypes for Support Functions
+ *          used in tokenizing FORTH Flow-Control structures.
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+
+/* ************************************************************************** *
+ *
+ *      Global Variables Exported
+ *
+ **************************************************************************** */
+
+extern int control_stack_depth;
+ 
+/* ************************************************************************** *
+ *
+ *      Function Prototypes / Functions Exported:
+ *
+ **************************************************************************** */
+
+void emit_if( void );
+void emit_then( void );
+void emit_else( void );
+void emit_begin( void );
+void emit_again( void );
+void emit_until( void );
+void emit_while( void );
+void emit_repeat( void );
+void mark_do( void );
+void resolve_loop( void );
+void emit_case( void );
+void emit_of( void );
+void emit_endof( void );
+void emit_endcase( void );
+
+void announce_control_structs( int severity, char *call_cond,
+				          unsigned int abs_token_limit);
+void clear_control_structs_to_limit( char *call_cond,
+				          unsigned int abs_token_limit);
+void clear_control_structs( char *call_cond);
+
+#endif   /*  _TOKE_FLOWCONTROL_H    */
diff --git a/toke/macros.c b/toke/macros.c
index 92d2933..17c01cb 100644
--- a/toke/macros.c
+++ b/toke/macros.c
@@ -24,6 +24,31 @@
  *
  */
 
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Support functions for the  MACROS  vocabulary, implemented
+ *          as a TIC-Headerlist type of data structure, and linked in
+ *          to the Global Vocabulary.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Functions Exported:
+ *          init_macros             Initialize the link-pointers in the
+ *                                      initial "Built-In" portion of
+ *                                      the  macros  vocabulary
+ *          add_user_macro          Add an entry to the  macros  vocabulary
+ *          skip_user_macro         Consume a Macro definition if Ignoring
+ *
+ **************************************************************************** */
+
 #include <stdio.h>
 #include <stdlib.h>
 #if defined(__linux__) && ! defined(__USE_BSD)
@@ -32,107 +57,489 @@
 #include <string.h>
 #include <errno.h>
 
-#include "toke.h"
+#include "errhandler.h"
+#include "ticvocab.h"
+#include "stream.h"
+#include "scanner.h"
+#include "dictionary.h"
+#include "devnode.h"
+#include "macros.h"
 
-typedef struct macro {
-	u8  *name;
-	u8  *alias;
-	struct macro *next;
-} macro_t;
+/* **************************************************************************
+ *
+ *              Internal Static Variables
+ *          macros_tbl                    Initial array of "Built-In" Macros
+ *          number_of_builtin_macros      Number of "Built-In" Macro entries.
+ *
+ **************************************************************************** */
 
-static macro_t *macros=NULL;
+/* **************************************************************************
+ *
+ *      Revision History:
+ *          Thu, 27 Oct 2005 by David L. Paktor
+ *              Identify the macros that resolve to a single word.
+ *              Remove them from here and enter them as synonymous entries
+ *                  in the Tokens, Specials or Shared-words vocabularies.
+ *          Wed, 30 Nov 2005 by David L. Paktor
+ *              Allow user-definition of macros.
+ *          Fri, 06 Jan 2006 by David L. Paktor
+ *              Re-define the Macros as a TIC-Headerlist, and make them
+ *                  part of the Global Vocabulary
+ *
+ **************************************************************************** */
 
-char *lookup_macro(char *name)
+
+
+/* **************************************************************************
+ *
+ *      Function name:  macro_recursion_error
+ *      Synopsis:       Function that will go temporarily into the FUNCT
+ *                      field of a Macro's TIC-entry, to protect against
+ *                      recursive macro invocations.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             pfield              Param field of the TIC-entry; unused.
+ *         Global Variables:
+ *             statbuf             The name being invoked erroneously.
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Printout:
+ *             Error Message.
+ *
+ *      Error Detection:
+ *          If this function is called, it is an ERROR
+ *
+ *      Extraneous Remarks:
+ *          This Tokenizer does not have the early-binding characterisitics
+ *              of FORTH; its Macros are strings, evaluated when invoked
+ *              rather than when they are defined.  A reference to a name
+ *              that matches the macro would cause recursion, possibly
+ *              infinite.  We will not allow that.
+ *
+ **************************************************************************** */
+
+static void macro_recursion_error( tic_param_t pfield)
 {
-	macro_t *curr;
-	
-	for (curr=macros; curr!=NULL; curr=curr->next)
-		if (!strcasecmp(name,(char *)curr->name))
-			break;
+    tokenization_error( TKERROR,
+	"Recursive invocation of macro named %s\n", statbuf);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  eval_mac_string
+ *      Synopsis:       Function that goes into FUNCT field of a TIC-entry
+ *                      in the Macros list.  Protect against recursion.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             pfield              Param field of the TIC-entry
+ *         Global Variables:
+ *             tic_found           The TIC-entry that has just been found;
+ *                                     it's the entry for this Macro.
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Global Variables:
+ *             report_multiline    Cleared to FALSE
+ *         Global Behavior:
+ *            The Macro will be evaluated as string input.
+ *
+ *      Error Detection:
+ *          An attempt at recursion will be detected because the FUNCT field
+ *              of the Macro entry will have been temporarily be replaced by
+ *              macro_recursion_error()
+ *
+ *      Process Explanation:
+ *          Save the address of the routine that is in the FUNCT field
+ *               of the entry for this Macro.  (Hey!  It's this routine...)
+ *          Replace the FUNCT field of the Macro entry with the Macro
+ *              Recursion Error Detection routine
+ *          Pass the address of the "resumption" routine and its argument
+ *              (the entry for this Macro), to  push_source()
+ *          Recast the type of the parameter field to a string
+ *          Make it the new Input Source Buffer.
+ *          Suspend multi-line warning; see comment in body of add_user_macro()
+ *              The multi-line warning flag is kept by  push_source()
+ *
+ *      Still to be done:
+ *          If an error is encountered during Macro evaluation, display
+ *              supplemental information giving the name of the Macro 
+ *              being run, and the file and line number in which it was
+ *              defined.
+ *          This will require changes to the way user Macros are added
+ *              and retained, and to the way error messages are displayed.
+ *
+ *      Revision History:
+ *          Updated Thu, 23 Feb 2006 by David L. Paktor
+ *              Do not process Macros (or, for that matter, User-defined
+ *                  Symbols or FLOADed files) with a routine that calls
+ *                  its own instance of  tokenize(), because the Macro
+ *                  (etc.) might contain a phrase (such as the start of
+ *                  a conditional) that must be terminated within the
+ *                  body of a file, thus causing an undeserved Error.
+ *                  Instead, they need to be handled in a more sophis-
+ *                  ticated way, tied in with the operation of get_word()
+ *                  perhaps, that will make a smooth transition between
+ *                  the body of the Macro and the resumption of processing
+ *                  the source file.  The end-of-file will only be seen
+ *                  at the end of an actual input file or when getting
+ *                  a delimited string.
+ *          Updated Fri, 24 Feb 2006 by David L. Paktor
+ *              Re-integrate Recursion Error Detection with the above.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *     In order to integrate Recursion Error Detection with the smooth
+ *         transition to resumption of processing the source file, we
+ *         need to create a "resumption" routine that will restore the
+ *         normal behavior of the macro after it's completed, by re-
+ *         instating the address of the normal Macro-invocation routine;
+ *         that routine, of course, is the one that passes the address
+ *         of the "resumption" routine to push_source().  In order to
+ *         get around this chicken-and-egg dilemma, we will create a
+ *         local static variable into which the address of the normal
+ *         Macro-invocation routine will be stored.  We actually only
+ *         need it once, but we'd rather avoid the overhead of checking,
+ *         every time, whether it has already been set; since it's always
+ *         the same, there's no harm in storing it every time.
+ *
+ **************************************************************************** */
+
+typedef void (*vfunct)();  /*  Pointer to function returning void  */
+static vfunct sav_mac_funct ;
 
-	return curr?(char *)curr->alias:NULL;
+
+/* **************************************************************************
+ *
+ *     This "resumption" routine will be called by  pop_source()
+ *     The parameter is the Macro dictionary-entry whose behavior
+ *         is to be restored.
+ *
+ **************************************************************************** */
+
+static void mac_string_recovery( tic_hdr_t *macro_entry)
+{
+    (*macro_entry).funct = sav_mac_funct;
+    (*macro_entry).ign_func = sav_mac_funct;
 }
 
-int add_macro(char *name, char *alias)
+/* **************************************************************************
+ *
+ *     The normal Macro-invocation routine, at last...
+ *
+ **************************************************************************** */
+static void eval_mac_string( tic_param_t pfield)
 {
-	macro_t *curr;
+    int mac_str_len = strlen(pfield.chr_ptr);
+    /*  We can't use  (*tic_found).pfld_size  for the string length
+     *      because, if this is an alias for a macro, it will be zero...
+     */
+    /*  We can change that by de-coupling the decision to free the
+     *      param-field from whether pfld_size is non-zero (by intro-
+     *      ducing yet another field into the  tic_param_t  struct),
+     *      but we're not doing that today...
+     */
 
-	curr=malloc(sizeof(macro_t));
-	if(!curr) {
-		printf("Out of memory while adding macro.\n");
-		exit(-ENOMEM);
-	}
+    sav_mac_funct = *tic_found->funct;
+    (*tic_found).funct = macro_recursion_error;
+    (*tic_found).ign_func = macro_recursion_error;
+    push_source( mac_string_recovery, tic_found, FALSE);
+    report_multiline = FALSE;  /*  Must be done AFTER call to push_source()
+                                *      because  report_multiline  is part of
+                                *      the state that  push_source()  saves.
+				*/
+    init_inbuf( pfield.chr_ptr, mac_str_len);
+}
 
-	curr->next=macros;
-	curr->name=(u8 *)name;
-	curr->alias=(u8 *)alias;
+/* **************************************************************************
+ *
+ *     Builtin Macros do not need Recursion Error Detection.
+ *     Intermediate routine to convert parameter type.
+ *
+ **************************************************************************** */
+static void eval_builtin_mac( tic_param_t pfield)
+{
+    eval_string( pfield.chr_ptr);
+}
+/* **************************************************************************
+ *
+ *      Make a macro, because we might eliminate this layer later on.
+ *
+ **************************************************************************** */
+#define EVAL_MAC_FUNC  eval_mac_string
+#define BUILTIN_MAC_FUNC  eval_builtin_mac
+
+/* **************************************************************************
+ *
+ *      Initialization macro definition
+ *
+ **************************************************************************** */
 
-	macros=curr;
-	return 0;
+#define BUILTIN_MACRO(nam, alias) BUILTIN_MAC_TIC(nam, BUILTIN_MAC_FUNC, alias )
+
+static tic_mac_hdr_t macros_tbl[] = {
+	BUILTIN_MACRO( "(.)",		"dup abs <# u#s swap sign u#>") ,
+
+
+	BUILTIN_MACRO( "?",		"@ .") ,
+	BUILTIN_MACRO( "1+",		"1 +") ,
+	BUILTIN_MACRO( "1-",		"1 -") ,
+	BUILTIN_MACRO( "2+",		"2 +") ,
+	BUILTIN_MACRO( "2-",		"2 -") ,
+
+	BUILTIN_MACRO( "accept",      "span @ -rot expect span @ swap span !") ,
+	BUILTIN_MACRO( "allot", 	"0 max 0 ?do 0 c, loop") ,
+	BUILTIN_MACRO( "blank", 	"bl fill") ,
+	BUILTIN_MACRO( "carret",	"h# d") ,
+	BUILTIN_MACRO( ".d",		"base @ swap h# a base ! . base !") ,
+	BUILTIN_MACRO( "decode-bytes",  ">r over r@ + swap r@ - rot r>") ,
+	BUILTIN_MACRO( "3drop", 	"drop 2drop") ,
+	BUILTIN_MACRO( "3dup",		"2 pick 2 pick 2 pick") ,
+	BUILTIN_MACRO( "erase", 	"0 fill") ,
+	BUILTIN_MACRO( ".h",		"base @ swap h# 10 base ! . base !") ,
+	BUILTIN_MACRO( "linefeed",	"h# a") ,
+
+	BUILTIN_MACRO( "s.",		"(.) type space") ,
+	BUILTIN_MACRO( "space", 	"bl emit") ,
+	BUILTIN_MACRO( "spaces",	"0 max 0 ?do space loop") ,
+	BUILTIN_MACRO( "(u.)",		"<# u#s u#>") ,
+	BUILTIN_MACRO( "?leave",	"if leave then"),
+};
+
+static const int number_of_builtin_macros =
+	 sizeof(macros_tbl)/sizeof(tic_mac_hdr_t);
+
+/* **************************************************************************
+ *
+ *      Function name:  init_macros
+ *      Synopsis:       Initialize the link-pointers in the "Built-In"
+ *                          portion of the  macros  vocabulary, dynamically.
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             tic_vocab_ptr                 Pointer to Global Vocab Pointer
+ *         Global Variables:
+ *             macros_tbl                    Initial "Built-In" Macros array
+ *             number_of_builtin_macros      Number of "Built-In" Macro entries
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *         Global Variables:    
+ *             The link-fields of the initial "Built-In" Macros array entries
+ *                  will be filled in.
+ *         Supplied Pointers:
+ *             *tic_vocab_ptr                Updated to "tail" of Macros array
+ *
+ **************************************************************************** */
+
+void init_macros( tic_hdr_t **tic_vocab_ptr )
+{
+    init_tic_vocab( (tic_hdr_t *)macros_tbl,
+        number_of_builtin_macros,
+	    tic_vocab_ptr );
 }
 
-void init_macros(void) 
+
+/* **************************************************************************
+ *
+ *      Function name:  print_if_mac_err
+ *      Synopsis:       Report a user-macro definition error, if so be.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             failure             TRUE if error was detected
+ *             func_cpy            STRDUP() of function name, for error message
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Memory Freed
+ *             Contents of func_cpy, error or not.
+ *         Printout:
+ *             Error message, if  failure  is TRUE.
+ *
+ **************************************************************************** */
+static void print_if_mac_err( bool failure, char *func_cpy)
 {
-	add_macro( "eval",	"evaluate");
-	add_macro( "(.)", 	"dup abs <# u#s swap sign u#>");
-	add_macro( "<<", 	"lshift");
-	add_macro( ">>",	"rshift");
-	add_macro( "?",		"@ .");
-	add_macro( "1+",	"1 +");
-	add_macro( "1-",	"1 -");
-	add_macro( "2+",	"2 +");
-	add_macro( "2-",	"2 -");
-	/* add_macro( "abort\"",	"-2 throw"); */
-	add_macro( "accept",	"span @ -rot expect span @ swap span !");
-	add_macro( "allot",	"0 max 0 ?do 0 c, loop");
-	add_macro( "blank",	"bl fill");
-	add_macro( "/c*",	"chars");
-	add_macro( "ca1+",	"char+");
-	add_macro( "carret",	"h# d");
-	add_macro( ".d",	"base @ swap h# a base ! . base !");
-	add_macro( "decode-bytes", ">r over r@ + swap r@ - rot r>");
-	add_macro( "3drop",	"drop 2drop");
-	add_macro( "3dup",	"2 pick 2 pick 2 pick");
-	add_macro( "erase",	"0 fill");
-	add_macro( "false",	"0");
-	add_macro( ".h",	"base @ swap h# 10 base ! . base !");
-	add_macro( "linefeed",	"h# a");
-	add_macro( "/n*",	"cells");
-	add_macro( "na1+",	"cell+");
-	add_macro( "not",	"invert");
-	add_macro( "s.",	"(.) type space");
-	add_macro( "space",	"bl emit");
-	add_macro( "spaces",	"0 max 0 ?do space loop");
-	add_macro( "struct",	"0");
-	add_macro( "true",	"-1");
-	add_macro( "(u.)",	"<# u#s u#>");
-
-	/* H.7 FCode name changes */
-	add_macro( "decode-2int",		"parse-2int");
-	add_macro( "delete-attribute",		"delete-property");
-	add_macro( "get-inherited-attribute",	"get-inherited-property");
-	add_macro( "get-my-attribute",		"get-my-property");
-	add_macro( "get-package-attribute",	"get-package-property");
-	add_macro( "attribute",	  "property");
-	add_macro( "flip",	  "wbflip");
-	add_macro( "is",	  "to");
-	add_macro( "lflips",	  "lwflips");
-	add_macro( "map-sbus",	  "map-low");
-	add_macro( "u*x",	  "um*");
-	add_macro( "version",	  "fcode-revision");
-	add_macro( "wflips",	  "wbflips");
-	add_macro( "x+",	  "d+");
-	add_macro( "x-",	  "d-");
-	add_macro( "xdr+",	  "encode+");
-	add_macro( "xdrbytes",	  "encode-bytes");
-	add_macro( "xdrint",	  "encode-int");
-	add_macro( "xdrphys",	  "encode-phys");
-	add_macro( "xdrstring",	  "encode-string");
-	add_macro( "xdrtoint",	  "decode-int");
-	add_macro( "xdrtostring", "decode-string");
-	add_macro( "xu/mod",	  "um/mod");
+    if ( failure )
+    {
+	tokenization_error( TKERROR,
+	   "%s directive expects name and definition on the same line\n",
+	       strupr(func_cpy));
+    }
+    free( func_cpy);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  add_user_macro
+ *      Synopsis:       Parse input and add a user-defined Macro.
+ *
+ *      Associated Tokenizer directive:        [MACRO]
+ *
+ *      Inputs:
+ *         Parameters:                 NONE
+ *         Global Variables:
+ *             pc                      Input-source Scanning pointer
+ *             statbuf                 Symbol retrieved from input stream.
+ *             in_tokz_esc             TRUE if in "Tokenizer-Escape" mode
+ *             current_definitions     Pointer to Current Vocabulary pointer,
+ *                                         either Global or Current Device-Node
+ *             tokz_esc_vocab         "Tokenizer Escape" Vocab pointer
+ *
+ *      Outputs:
+ *         Returned Value:            NONE
+ *         Global Variables:
+ *             *current_definitions   { One of these will point  }
+ *             tokz_esc_vocab         {     to the new entry     }
+ *         Memory Allocated:
+ *             Copy of directive, for error message
+ *             Copy of Macro name
+ *             Copy of Macro body
+ *             Memory for the new entry will be allocated by support routine.
+ *         When Freed?
+ *             Copy of directive:  When error might be reported.
+ *             Macro name, body and entry:  Upon end of tokenization, or when
+ *                 RESET-SYMBOLS is issued in the same mode and Scope as when
+ *                 the Macro was defined. 
+ *
+ *      Error Detection:
+ *          At least two words in the input stream are expected to be on
+ *              the same line as the directive.  The  get_word_in_line()
+ *              and  get_rest_of_line()  routines will check for that;
+ *              we will issue the Error Message for either condition.
+ *          Check if the Macro name is a duplicate; warn_if_duplicate()
+ *              routine will issue message.
+ *
+ *      Process Explanation:
+ *          We start just after the directive has been recognized.
+ *          Get one word in line -- this is the macro name
+ *          Get input to end of line.  This is the "body" of the macro.
+ *          Add the Macro to the Current vocab, using support routine.
+ *          Set the definer field to MACRO_DEF and the Function to the
+ *              same one that's used for the built-in macros.
+ *          User-defined Macros may need to be processed while ignoring
+ *              (because they might include conditional-operators, etc.)
+ *              We will set the ign_func the same as the active function.
+ *
+ *      To be considered:
+ *          Do we want to do further filtration? 
+ *              Remove comments?
+ *              Compress whitespace?
+ *              Allow backslash at end of line to continue to next line?
+ *
+ *      Extraneous Remarks:
+ *          The scope of User-Macro definitions will follow the same rules
+ *              as all other definition types:  if Device-Definitions are
+ *              in effect, the scope of the new Macro definition will be
+ *              confined to the current Device-Node; if Global-Definitions
+ *              are in effect when it is defined, its scope will be Global;
+ *              if it was declared when we were in "Tokenizer Escape" mode,
+ *              then its scope will be limited to "Tokenizer Escape" mode.
+ *
+ **************************************************************************** */
+
+/*  This pointer is exported to this file only  */
+extern tic_hdr_t *tokz_esc_vocab ;
+
+void add_user_macro( void)
+{
+    char *macroname;
+    char *macrobody;
+    bool failure = TRUE;
+
+    /*  Copy of function name, for error message  */
+    char *func_cpy = strdup( statbuf);
+
+    if ( get_word_in_line( NULL ) )
+    {
+        /*  This is the Macro name  */
+	macroname = strdup( statbuf);
+
+	if ( INVERSE(get_rest_of_line() ) )
+	{
+	    /*  No body on line  */
+	    free( macroname);
 	
-	/* non standard but often used macros */
-	add_macro( "name",	"device-name");
-	add_macro( "endif",	"then");
+	}else{
+	    /*  We have valid Macro body on line  */
+	    int mac_body_len = 0;
+
+	    tic_hdr_t **target_vocab = current_definitions;
+	    if ( in_tokz_esc ) target_vocab = &tokz_esc_vocab ;
+
+            warn_if_duplicate( macroname);
+	    trace_creation( MACRO_DEF, macroname);
+
+	    /*  Tack on a new-line, so that a remark will appear
+	     *      to be properly terminated.   This might trigger
+	     *      an undeserved multi-line warning if the Macro
+	     *      is an improperly terminated quote; we will work
+	     *      around that problem by temporarily suspending
+	     *      multi-line warnings during macro processing.
+	     */
+	    strcat( statbuf, "\n");
+	    macrobody = strdup( statbuf);
+	    mac_body_len = strlen(macrobody);
+
+	    add_tic_entry( macroname, EVAL_MAC_FUNC,
+	                       (TIC_P_DEFLT_TYPE)macrobody,
+			           MACRO_DEF, mac_body_len,
+				       EVAL_MAC_FUNC, target_vocab );
+	    failure = FALSE;
+	}
+    }
+
+    print_if_mac_err( failure, func_cpy);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  skip_user_macro
+ *      Synopsis:       Consume the text of a user-defined Macro from the
+ *                          Input Stream, with no processing.  (Called when
+ *                          a user-Macro definer occurs in a segment that
+ *                          is being Ignored.)
+ *
+ *      Inputs:
+ *         Parameters:
+ *             pfield             "Parameter field" pointer, to satisfy
+ *                                    the calling convention, but not used
+ *         Global Variables:
+ *             statbuf            Word currently being processed.
+ *
+ *      Outputs:
+ *         Returned Value:        NONE
+ *
+ *      Error Detection:
+ *          At least two words in the input stream are expected to be on
+ *              the same line as the user-Macro definer, same as when the
+ *              directives occurs in a segment that is not being Ignored.
+ *              The  get_word_in_line()  and  get_rest_of_line()  routines
+ *              will check for condition., we will issue the Error Message.
+ *
+ *      Process Explanation:
+ *          We need to protect against the case of a macro-definition that
+ *              invokes a directive that alters Conditional processing...
+ *
+ **************************************************************************** */
+void skip_user_macro( tic_bool_param_t pfield )
+{
+    bool failure = TRUE;
+    char *func_cpy = strdup( statbuf);
+    if ( get_word_in_line( NULL ) )
+    {
+	if ( get_rest_of_line() )
+	{
+	    failure = FALSE;
+	}
+    }
+
+    print_if_mac_err( failure, func_cpy);
+
 }
diff --git a/toke/macros.h b/toke/macros.h
new file mode 100644
index 0000000..5afd170
--- /dev/null
+++ b/toke/macros.h
@@ -0,0 +1,58 @@
+#ifndef _TOKE_MACROS_H
+#define _TOKE_MACROS_H
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Prototypes for functions that operate on the  MACROS vocabulary,
+ *          which is implemented as a String-Substitution-type vocab.
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+
+#include "types.h"
+#include "ticvocab.h"
+
+/* ************************************************************************** *
+ *
+ *      Function Prototypes / Functions Exported:
+ *
+ **************************************************************************** */
+
+void init_macros( tic_hdr_t **tic_vocab_ptr );
+void add_user_macro( void);
+void skip_user_macro( tic_bool_param_t pfield );
+#if  0  /*  What's this doing here?  */
+char *lookup_macro(char *name);
+bool exists_as_macro(char *name);
+bool create_macro_alias( char *new_name, char *old_name );
+void reset_macros_vocab( void );
+#endif  /*  What's this doing here?  */
+
+#endif   /*  _TOKE_MACROS_H    */
diff --git a/toke/nextfcode.c b/toke/nextfcode.c
new file mode 100644
index 0000000..c76015a
--- /dev/null
+++ b/toke/nextfcode.c
@@ -0,0 +1,708 @@
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Functions for Managing FCode Assignment Pointer and for
+ *          Detection of Overlapping-FCode Error in Tokenizer
+ *
+ *      (C) Copyright 2006 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      The fact that the user is able to specify, at any time, the
+ *          next FCode number to be assigned introduces the risk that
+ *          a symbol might inadvertently be assigned an FCode that is
+ *          still in use by another symbol, which could lead to bizarre
+ *          and hard-to-trace failures at run-time.
+ *
+ *      This module will support a means whereby to detect and report,
+ *          as an Error, overlapping FCode assignments.
+ *
+ *      The task is further complicated by the fact that, under some
+ *          circumstances, "recycling" a range of FCodes can be done
+ *          safely, and the programmer may do so intentionally.
+ *
+ *      We will define a way for the programmer to specify that FCode
+ *          assignments are being intentionally "recycled", and that
+ *          overlaps with previously-assigned FCodes are not to be
+ *          treated as Errors.  We will not attempt to analyze whether
+ *          it is, indeed, safe to do so; the programmer who does this
+ *          is presumed to be sufficiently responsible.
+ *
+ **************************************************************************** */
+
+
+/* **************************************************************************
+ *
+ *      Functions Exported:
+ *          reset_fcode_ranges   (Re-)Initialize the range of assignable
+ *                                   FCode numbers and clear the records
+ *                                   of prevously-assigned ranges of FCodes
+ *          list_fcode_ranges    Display a final report of assigned FCode
+ *                                   ranges at end of tokenization or when
+ *                                   the  reset_fcodes()  routine is called.
+ *          set_next_fcode       Set the start of a new Range of FCode
+ *                                   numbers to be assigned.
+ *          assigning_fcode      The next FCode number is about to be assigned;
+ *                                   test for out-of-bounds, overlap, etc.
+ *                                   errors.
+ *          bump_fcode           Increment the next FCode number prior to the
+ *                                    next assignment.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Revision History:
+ *          06 Jun 06  -- Need became apparent after verification test
+ *                            against existing device-drivers.
+ *              
+ *
+ **************************************************************************** */
+
+
+/* **************************************************************************
+ *
+ *      Still to be done:
+ *          Detect and report when the Current Range stops overlapping
+ *              one particular Range and starts overlapping another.
+ *
+ *          Detect and report when the Current Range overlaps more than
+ *              one Range at a time (e.g., if other Ranges themselves
+ *              overlap, and the Current Range is stepping through them)
+ *              but, again, only display one message per overlapped Range.
+ *
+ **************************************************************************** */
+
+
+
+/* **************************************************************************
+ *
+ *          Global Variables Imported
+ *              iname              Name of current input file
+ *              lineno             Line Number within current input file
+ *
+ **************************************************************************** */
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "toke.h"
+#include "nextfcode.h"
+#include "errhandler.h"
+#include "stream.h"
+#include "scanner.h"
+
+
+/* **************************************************************************
+ *
+ *          Global Variables Exported
+ *              nextfcode          The next FCode-number to be assigned
+ *
+ **************************************************************************** */
+
+u16  nextfcode;         /*  The next FCode-number to be assigned              */
+
+/* **************************************************************************
+ *
+ *      Internal (Static) Structure:
+ *          fcode_range_t         The record of a Range of assigned FCodes
+ *
+ *   Fields:
+ *       fcr_start            FCode number at the start of a this Range
+ *       fcr_end              Last FCode number in this Range that has
+ *                                actually been assigned.  0 if none made yet.
+ *       fcr_infile           File name of where this Range was started
+ *       fcr_linenum          Line number where this Range was started
+ *       fcr_not_lapped       TRUE if an overlap error has not been reported
+ *                                against this Range.  Use this to prevent
+ *                                issuing an Error message every time an
+ *                                overlapping FCode is assigned; once per
+ *                                Range is sufficient.
+ *       fcr_next             Pointer to following entry in linked-list.
+ *
+ *   We will keep the list of assigned FCode Ranges as a forward-linked,
+ *       rather than the more usual backward-linked, list for convenience
+ *       at listing-time.  Otherwise, it doesn't make much difference.
+ *
+ **************************************************************************** */
+
+typedef struct fcode_range
+    {
+        u16                 fcr_start;
+	u16                 fcr_end ;
+	char               *fcr_infile;
+	int                 fcr_linenum;
+	bool                fcr_not_lapped;
+	struct fcode_range *fcr_next;
+    }  fcode_range_t ;
+
+
+/* **************************************************************************
+ *
+ *          Internal Static Variables
+ *     ranges_exist              TRUE if FCode Ranges have been created;
+ *                                   Prevents unnecessary overlap checking.
+ *     changes_listed            TRUE if no changes to any of the Ranges
+ *                                   have taken place since the last time
+ *                                   a Listing was displayed.  Prevents
+ *                                   unnecessary repetions (e.g., if a
+ *                                    reset_fcode_ranges()  was called
+ *                                   right after an operation that causes
+ *                                   a Listing
+ *
+ *          These four apply if no FCode Ranges have been created:
+ *
+ *     range_start               First FCode in the current first (only) range.
+ *     range_end                 Last FCode in current first (only) range that
+ *                                   has actually been assigned.  0 if none yet.
+ *     first_fcr_infile          File name of where first (only) range started.
+ *     first_fcr_linenum         Line number where first (only) range started.
+ *
+ *          These two apply after FCode Ranges have been created:
+ *
+ *     first_fc_range            Pointer to the first entry in the linked
+ *                                   list of FCode Ranges.
+ *     current_fc_range          Pointer to the entry in the linked list of
+ *                                   Ranges that contains the Current Range.
+ *
+ **************************************************************************** */
+
+static bool           ranges_exist      = FALSE;
+static bool           changes_listed    = FALSE;
+
+static u16            range_start       = FCODE_START;
+static u16            range_end         = 0;
+static char          *first_fcr_infile  = NULL;
+static int            first_fcr_linenum = 0;
+
+static fcode_range_t *first_fc_range    = NULL;
+static fcode_range_t *current_fc_range  = NULL;
+
+/* **************************************************************************
+ *
+ *      Function name:  reset_fcode_ranges
+ *      Synopsis:       (Re-)Initialize the range of assignable FCode numbers
+ *                          and clear the records of prevously-assigned Ranges
+ *
+ *      Inputs:
+ *         Parameters:                  NONE
+ *         Global Variables:
+ *             iname                    Name of current input file
+ *             lineno                   Line Number within current input file
+ *         Local Static Variables:
+ *             ranges_exist             TRUE if FCode Ranges have been created
+ *             first_fc_range           Pointer to First FCode Range
+ *             current_fc_range         Pointer to the current Range
+ *
+ *      Outputs:
+ *         Returned Value:              NONE
+ *         Global Variables:
+ *             nextfcode                Initialized to Standard start value
+ *                                          for user-assigned FCodes
+ *         Local Static Variables:
+ *             ranges_exist             Cleared to FALSE
+ *             changes_listed           Reset to FALSE
+ *             range_start              Reset to Standard start value
+ *             range_end                Reset to 0
+ *             first_fcr_infile         Copy of iname
+ *             first_fcr_linenum        Copy of lineno
+ *             first_fc_range           Reset to NULL
+ *             current_fc_range         Reset to NULL
+ *         Memory Allocated
+ *             For  first_fcr_infile , which will have a copy of  iname
+ *         When Freed?
+ *             The next time this routine is called.
+ *         Memory Freed
+ *             Any FCode Ranges that were in effect will be freed, and the
+ *                 memory for their  fcr_infile  fields will be freed.
+ *             If  iname  has changed, memory for  first_fcr_infile  will
+ *                 be freed before the new copy is made.
+ *
+ *      Process Explanation:
+ *          This will be called either as part of normal initialization
+ *              or in response to a User-issued directive.
+ *          In the former case, it may be called twice:  once before any
+ *              Source is examined, and once again in response to the first
+ *              (and only to the first) invocation of an FCode-Starter, at
+ *              which time the input file name and line number will be updated.
+ *          In the latter case, the calling routine will be responsible for
+ *              displaying any Advisory Messages and listings of previously
+ *              assigned FCode Ranges.
+ *
+ **************************************************************************** */
+
+void reset_fcode_ranges( void)
+{
+    if ( ranges_exist )
+    {
+	while ( current_fc_range != NULL )
+	{
+	    current_fc_range = first_fc_range->fcr_next;
+	    free( first_fc_range->fcr_infile);
+	    free( first_fc_range);
+	    first_fc_range = current_fc_range;
+	}
+	ranges_exist = FALSE;
+    }else{
+	if ( first_fcr_infile != NULL )
+	{
+	    if ( strcmp( first_fcr_infile, iname) != 0 )
+	    {
+		free( first_fcr_infile);
+		first_fcr_infile = NULL;
+	    }
+	}
+    }
+
+    changes_listed    = FALSE;
+    range_start       = FCODE_START;
+    range_end         = 0;
+
+    if ( first_fcr_infile == NULL )
+    {
+	first_fcr_infile = strdup( iname);
+    }
+    first_fcr_linenum = lineno;
+    nextfcode         = FCODE_START;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  list_fcode_ranges
+ *      Synopsis:       Display an Advisory of assigned FCode ranges at
+ *                          end of tokenization or upon reset_fcodes() 
+ *
+ *      Inputs:
+ *         Parameters:
+ *             final_tally               TRUE if printing a final tally at
+ *                                           end of tokenization.  
+ *         Global Variables:
+ *             verbose                   Do not print anything if not set.
+ *             nextfcode                 FCode next after last-assigned
+ *         Local Static Variables:
+ *             changes_listed            If TRUE, only print new-line.
+ *             ranges_exist              TRUE if more than one Range exists.
+ *             range_start               FCode at start of only range
+ *             range_end                 Last FCode in only range; 0 if none.
+ *             first_fc_range            Ptr to start of FCode Ranges list
+ *
+ *      Outputs:
+ *         Returned Value:               NONE
+ *         Local Static Variables:
+ *             changes_listed           Set to TRUE. 
+ *         Printout:
+ *            Printed to Standard Out on final tally, or to STDERR otherwise.
+ *            One of three formats:
+ *            1   No FCodes assigned.
+ *            2   Last assigned FCode = 0xXXX
+ *            3   FCodes assigned:
+ *                    [ No FCodes assigned in the range that started ... ]
+ *                    [ From 0xXXX to 0xYYY ** in the range that started ... ]
+ *                        (** = Indicator if the Range has an Overlap Error.)
+ *
+ *      Process Explanation:
+ *          This is called to complete an Advisory or Standard-Out Message
+ *              that doesn't end in a new-line.
+ *
+ *      Extraneous Remarks:
+ *          If we ever decide not to keep entries for Ranges in which no
+ *              assignments were made, let's not remove the code that lists
+ *              them.  It's harmless to keep it around, and we remain ready...
+ *
+ **************************************************************************** */
+
+void list_fcode_ranges( bool final_tally)
+{
+    if ( verbose )
+    {
+	FILE *message_dest = ( final_tally ? stdout : ERRMSG_DESTINATION );
+	if ( changes_listed )
+	{
+	    fprintf(message_dest, "\n");
+	}else{
+	    changes_listed = TRUE;
+
+	    if ( INVERSE(ranges_exist) )
+	    {   /*  List the first and only range  */
+		if ( range_end == 0 )
+		{
+		    fprintf(message_dest, "No FCodes assigned.\n");
+		}else{
+		    if ( range_start == FCODE_START )
+		    {
+			fprintf(message_dest,
+			    "Last assigned FCode = 0x%x\n", range_end);
+		    }else{
+			fprintf(message_dest,
+			    "FCodes assigned:  0x%x to 0x%x\n",
+				range_start, range_end);
+		    }
+		}
+		/*  We are done listing the first and only range  */
+	    }else{   /*  List the collection of Ranges  */
+
+		/*  Pionter to function returning void  */
+		typedef void (*vfunct)();
+
+		/*  Function for the  started_at()  part of the message  */
+		vfunct start_at_funct =
+	            ( final_tally ? print_started_at : started_at );
+
+
+		fcode_range_t *next_range = first_fc_range;
+
+		fprintf(message_dest, "FCodes assigned:\n");
+
+		while ( next_range != NULL )
+		{
+		    if ( next_range->fcr_end == 0 )
+		    {
+			fprintf(message_dest, "    None assigned");
+		    }else{
+			fprintf(message_dest, "    From 0x%x to 0x%x",
+			    next_range->fcr_start, next_range->fcr_end );
+			if ( INVERSE( next_range->fcr_not_lapped) )
+			{
+			    fprintf(message_dest, " ***Overlap***" );
+			}
+		    }
+		    fprintf(message_dest, " in the range");
+		    (*start_at_funct)(
+			next_range->fcr_infile, next_range->fcr_linenum );
+
+		    next_range = next_range->fcr_next;
+		}
+	    }
+	}
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  set_next_fcode
+ *      Synopsis:       Set the start of a new Range of FCode numbers
+ *
+ *      Inputs:
+ *         Parameters:
+ *             new_fcode                 Start of the new range of FCodes
+ *         Global Variables:
+ *             nextfcode                 The next FCode-number to be assigned
+ *             iname                     Name of current input file
+ *             lineno                    Line Number within current input file
+ *         Local Static Variables:
+ *             ranges_exist              TRUE if FCode Ranges have been created
+ *             range_start               First FCode in the current (first
+ *                                           and only) range
+ *             range_end                 Last FCode in only range; 0 if none.
+ *             current_fc_range          Pointer to the current Range if there
+ *                                           are more than one.
+ *
+ *      Outputs:
+ *         Returned Value:               NONE
+ *         Global Variables:
+ *             nextfcode                 Set to the start of the new range
+ *         Local Static Variables:
+ *             ranges_exist              May be set to TRUE
+ *             first_fc_range            May be initialized
+ *             current_fc_range          May be initialized or moved
+ *             first_fcr_infile          May be updated, may be made NULL
+ *             first_fcr_linenum         May be updated, may be made irrelevant
+ *             range_start               May be set to start of the new range
+ *                                           or rendered irrelevant
+ *             range_end                 Reset to 0 (by  reset_fcode_ranges() )
+ *             changes_listed            Reset to FALSE
+ *         Memory Allocated
+ *             For new Range data structure; for copy of  iname
+ *         When Freed?
+ *             By reset_fcode_ranges()
+ *
+ *      Error Detection:
+ *          Not here.
+ *          The calling routine will detect and report attempts to set an
+ *             illegal new range. 
+ *          Overlap with earlier Ranges will be detected and reported when
+ *              the FCode is actually Assigned.
+ *
+ *      Process Explanation:
+ *          The calling routine will not call this routine with a new starting
+ *              FCode that is not legal per the Standard.
+ *          It may call with a new starting FCode that is equal to  nextfcode
+ *          If no Ranges exist yet, and the new starting FCode is equal to
+ *              the current value of  nextfcode , this is a continuation of
+ *              the first and only range; do not change the file name or line
+ *              number; just go away.
+ *          If no Ranges exist yet, and no FCode assignments have been made
+ *              in the current range, then this is a new start for the first
+ *              and only range; detect the latter condition by range_end == 0
+ *              Call the  reset_fcode_ranges()  routine to update the file name
+ *              and line number, then update the remaining variables for the
+ *              current (first and only) range, and you are done here.
+ *          If no Ranges exist yet, and if FCode assignments _have_ been made
+ *              in the current (first and only) range, create a data structure
+ *              for the first (and now no longer only) Range and point both
+ *              the  first_fc_range  and  current_fc_range  pointers at it.
+ *              Set the  ranges_exist  flag to TRUE.
+ *          If Ranges exist, whether from being newly-created, above, or from
+ *              earlier, create a data structure for the new Current Range
+ *              and move the  current_fc_range  pointer to point at it.  If
+ *              the new starting FCode is equal to  nextfcode  we still want
+ *              to create a new Range that will be listed separately.
+ *          If no assignments were made within the Current Range, we will not
+ *              overwrite or delete it; it will be listed at the appropriate
+ *              time, and will be harmless in the overlap test.
+ *
+ *      Extraneous Remarks:
+ *          We will trade off the strict rules of structured code here,
+ *              in exchange for ease of coding.
+ *
+ **************************************************************************** */
+
+void set_next_fcode( u16  new_fcode)
+{
+    if ( INVERSE( ranges_exist) )
+    {    /*  The current range is the first and only.  */
+
+	if ( new_fcode == nextfcode )
+	{
+	    /*  Do nothing here  */
+	    return;
+	}
+
+	if ( range_end == 0 )
+	{   /*  No FCode assignments have been made in the current range  */
+	    /*  This is still the first and only range.                   */
+
+	    reset_fcode_ranges();   /*  Update file name and line number  */
+	    range_start = new_fcode;
+	    nextfcode = new_fcode;
+
+	    /*  We are done here  */
+	    return;
+
+	}else{  /*  Create the data structure for the first Range  */
+	    first_fc_range = safe_malloc( sizeof( fcode_range_t),
+				 "creating first FCode Range" );
+	    first_fc_range->fcr_start        = range_start;
+	    first_fc_range->fcr_end          = range_end;
+	    first_fc_range->fcr_infile       = first_fcr_infile;
+	    first_fc_range->fcr_linenum      = first_fcr_linenum;
+	    first_fc_range->fcr_not_lapped   = TRUE;
+	    first_fc_range->fcr_next         = NULL;
+
+	    first_fcr_infile  = NULL;
+	    first_fcr_linenum = 0;
+	    range_start       = FCODE_START;
+	    range_end         = 0;
+
+	    current_fc_range  = first_fc_range;
+
+	    ranges_exist      = TRUE;
+	}
+    }
+
+    /*  Previous Ranges exist now for sure!  */
+    current_fc_range->fcr_next  = safe_malloc( sizeof( fcode_range_t),
+				      "creating new FCode Range" );
+    current_fc_range = current_fc_range->fcr_next;
+
+    nextfcode                         = new_fcode;
+    current_fc_range->fcr_start       = nextfcode;
+    current_fc_range->fcr_end         = 0;
+                                  /*  Will be filled in by first assignment  */
+    current_fc_range->fcr_infile      = strdup( iname);
+    current_fc_range->fcr_linenum     = lineno;
+    current_fc_range->fcr_not_lapped  = TRUE;
+    current_fc_range->fcr_next        = NULL;
+
+    changes_listed                    = FALSE;
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  find_overlap
+ *      Synopsis:       Compare the FCode under test against existing
+ *                          FCode Ranges and return a pointer to the
+ *                          Range against which it overlaps, if any.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             test_fcode                 FCode to be tested
+ *         Global Variables:
+ *             
+ *         Local Static Variables:
+ *             ranges_exist               If not TRUE, no need to test
+ *             first_fc_range             Start of Ranges to test
+ *             current_fc_range           Do not test Current Range
+ *
+ *      Outputs:
+ *         Returned Value:                Pointer to FCode Range in which an
+ *                                            overlap exists, or NULL if none.
+ *
+ *      Error Detection:
+ *          The calling routine will treat any findings as it deems appropriate.
+ *
+ *      Process Explanation:
+ *          A Range within which no assignments were made will never "hit"
+ *              the overlap test because its  fcr_end  field will be zero
+ *              and its  fcr_start  field will be non-zero; there's no
+ *              number that will be "between" them!
+ *
+ **************************************************************************** */
+
+static fcode_range_t *find_overlap( u16 test_fcode)
+{
+    fcode_range_t *retval = NULL;
+    if ( ranges_exist )
+    {
+	fcode_range_t *test_range = first_fc_range;
+	while ( test_range != current_fc_range )
+	{
+	    if ( ( test_fcode <= test_range->fcr_end ) &&
+	         ( test_fcode >= test_range->fcr_start )  )
+	    {
+		retval = test_range;
+		break;
+	    }
+	    test_range = test_range->fcr_next;
+	}
+    }
+
+    return( retval);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  assigning_fcode
+ *      Synopsis:       Commit the next FCode number to be assigned;
+ *                          test for out-of-bounds, overlap, etc. errors.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             
+ *         Global Variables:
+ *             nextfcode
+ *         Local Static Variables:
+ *             ranges_exist         TRUE if FCode Ranges have been created
+ *             first_fc_range       First entry in linked list of Ranges.
+ *             current_fc_range     List entry for Current Range.
+ *
+ *      Outputs:
+ *         Returned Value:                  NONE
+ *         Global Variables:
+ *         Local Static Variables:
+ *             changes_listed               Reset to FALSE
+ *                    One of these two will be set to  nextfcode 
+ *             range_end                       ... if  ranges_exist  is FALSE
+ *             current_fc_range->fcr_end       ... if  ranges_exist  is TRUE
+ *
+ *      Error Detection:
+ *          FATAL if the value of  nextfcode  is larger than the legal
+ *              maximum for an FCode
+ *          ERROR if the value of  nextfcode   falls within one of the
+ *              existing Ranges (other than the current one, of course)
+ *
+ **************************************************************************** */
+
+void assigning_fcode( void)
+{
+    if ( nextfcode > FCODE_LIMIT )
+    {
+	/*  Let's give a last summarization before we crap out */
+	tokenization_error( INFO, "");
+	list_fcode_ranges( FALSE);
+
+	tokenization_error( FATAL,
+	    "Too many definitions.  "
+	    "Assigned FCode exceeds limit "
+	    "specified by IEEE-1275.");
+	/*
+	 *  No need to  return()  from here.
+	 *  FATAL error exits program.
+	 */
+    }
+
+    changes_listed = FALSE;
+
+    if ( INVERSE(ranges_exist) )
+    {    /*  No Overlap Error checking needed here.  */
+	range_end = nextfcode;
+    }else{
+	current_fc_range->fcr_end = nextfcode;
+
+	/*   Detect and report Overlap Error only once per Range  */
+	if ( current_fc_range->fcr_not_lapped )
+	{
+	    fcode_range_t *found_lap = find_overlap( nextfcode);
+	    if ( found_lap != NULL )
+	    {
+		tokenization_error( TKERROR,
+		    "Assigning FCode of 0x%x, "
+			"which overlaps the range", nextfcode);
+		started_at( found_lap->fcr_infile, found_lap->fcr_linenum);
+
+		current_fc_range->fcr_not_lapped = FALSE;
+	    }
+	}
+    }
+
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  bump_fcode
+ *      Synopsis:       Increment the next assignable FCode number
+ *                          prior to the next assignment.
+ *
+ *      Inputs:
+ *         Parameters:                   NONE
+ *         Global Variables:
+ *             nextfcode                 The next FCode-number to be assigned
+ *
+ *      Outputs:
+ *         Returned Value:               NONE
+ *         Global Variables:
+ *             nextfcode                 Incremented
+ *
+ *      Extraneous Remarks:
+ *          This looks like a no-brainer now, but if we ever need this
+ *              function to perform any more sophisticated background
+ *              activity, we can limit the scope of our modifications
+ *              to this routine.
+ *
+ **************************************************************************** */
+
+void bump_fcode( void)
+{
+    nextfcode++;
+}
diff --git a/toke/nextfcode.h b/toke/nextfcode.h
new file mode 100644
index 0000000..062bd1a
--- /dev/null
+++ b/toke/nextfcode.h
@@ -0,0 +1,80 @@
+#ifndef _TOKE_NEXTFCODE_H
+#define _TOKE_NEXTFCODE_H
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Function Prototypes for Managing FCode Assignment Pointer 
+ *         and for Detection of Overlapping-FCode Error in Tokenizer
+ *
+ *      (C) Copyright 2006 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+#include "types.h"
+
+
+/* ************************************************************************** *
+ *
+ *      Global Variables Exported
+ *
+ **************************************************************************** */
+
+extern u16  nextfcode;         /*  The next FCode-number to be assigned      */
+
+
+/* ************************************************************************** *
+ *
+ *      Function Prototypes / Functions Exported:
+ *
+ **************************************************************************** */
+
+void reset_fcode_ranges( void);
+void list_fcode_ranges( bool final_tally);
+void set_next_fcode( u16  new_fcode);
+void assigning_fcode( void);
+void bump_fcode( void);
+
+/* **************************************************************************
+ *
+ *          Macros:
+ *
+ *          FCODE_START             Standard-specified starting number for
+ *                                      user-generated FCodes.
+ *
+ *          FCODE_LIMIT             Standard-specified maximum number for
+ *                                      FCodes of any origin.
+ *
+ *      I know these are not likely to change, but I still feel better
+ *          making them named symbols, just on General Principles...
+ *
+ **************************************************************************** */
+
+#define FCODE_START  0x0800
+#define FCODE_LIMIT  0x0fff
+
+#endif   /*  _TOKE_NEXTFCODE_H    */
diff --git a/toke/parselocals.c b/toke/parselocals.c
new file mode 100644
index 0000000..84f460a
--- /dev/null
+++ b/toke/parselocals.c
@@ -0,0 +1,944 @@
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Parsing functions for IBM-style Local Values
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Functions Exported:
+ *          declare_locals      Pick up the Locals' names after the {
+ *          handle_local        Insert the code to access a Local
+ *          exists_as_local     Confirm whether a name is in the Locals vocab
+ *          assign_local        Process the "Assign to a Local" operator ( -> )
+ *          finish_locals       Insert the code for exiting a routine
+ *                                  that uses locals
+ *          forget_locals       Remove the locals' names from the search   
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *          These are the names of the three routines that will be invoked
+ *          when Locals are used.  Their definitions exist in a separate
+ *          Local Values Support FCode source-file that must be FLOADed
+ *          into the user's tokenization source.
+ *
+ **************************************************************************** */
+
+/*  Note that the enclosing curly-braces are part of the name  */
+static const char* push_locals = "{push-locals}"; /* ( #ilocals #ulocals -- ) */
+static const char* pop_locals = "{pop-locals}";   /* ( #locals -- )           */
+static const char* local_addr = "_{local}";       /* ( local# -- addr )       */
+
+/*  Switchable Fetch or Store operator to apply to  local_addr.   */
+static const char* local_op = "@";   /*  Initially Fetch  */
+
+
+/* **************************************************************************
+ *
+ *      Revision History:
+ *          Updated Wed, 13 Jul 2005 by David L. Paktor
+ *              Command-line control for:
+ *                  Support for Locals in general
+ *                  Whether to accept the "legacy" separator (semicolon)
+ *                  Whether to issue a message for the "legacy" separator
+ *          Updated Tue, 10 Jan 2006 by David L. Paktor
+ *              Convert to  tic_hdr_t  type vocabulary.
+ *
+ **************************************************************************** */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "ticvocab.h"
+#include "dictionary.h"
+#include "scanner.h"
+#include "parselocals.h"
+#include "errhandler.h"
+#include "clflags.h"
+#include "stream.h"
+#include "devnode.h"
+#include "flowcontrol.h"
+
+/* **************************************************************************
+ *
+ *      Global Variables Imported
+ *          statbuf
+ *          pc    
+ *          opc
+ *          incolon
+ *          lastcolon
+ *          ibm_locals_legacy_separator      Accept ; as the "legacy" separator
+ *          ibm_legacy_separator_message     Issue a message for "legacy" sep'r
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *          Internal Static Variables
+ *              local_names        Vocabulary for new local-names
+ *              num_ilocals        Number of initialized local variables
+ *              num_ulocals        Number of uninitialized local variables
+ *              localno            Running Local-Number to be assigned
+ *              eval_buf           Internally-generated string to be parsed
+ *              l_d_lineno         Locals Declaration Line Number
+ *
+ **************************************************************************** */
+
+static tic_hdr_t *local_names = NULL;
+static int num_ilocals = 0;
+static int num_ulocals = 0;
+static int localno = 0;
+static char eval_buf[64];
+static unsigned int l_d_lineno;  	/*  For Error Messages   */
+
+/* **************************************************************************
+ *
+ *     The  local_names  vocabulary follows the same  tic_hdr_t   structure
+ *         as the dictionaries of tokens, special-functions, etcetera.   Its
+ *         "parameter field" is an integer, used to store the Local's number,
+ *         an its "function" is invoke_local(), defined further below.
+ *
+ *     The vocabulary is initially empty, so there's no need for an "init"
+ *         or a "reset" routine.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Function name:  int_to_str
+ *      Synopsis:       Convert an integer into a compilable string.
+ *                      Suport routine for invoke_local().
+ *
+ *      Inputs:
+ *         Parameters:
+ *             num             The number to convert
+ *             bufr            The buffer into which to place it.
+ *                                 Needn't be very long:
+ *                                 five at least, ten is enough
+ *
+ *      Outputs:
+ *         Returned Value:     Pointer to  bufr
+ *             bufr            Contents are changed.
+ *
+ *      Process Explanation:
+ *          Convert into decimal.  If the number is greater than 8,
+ *              prepend a  d#  in front of it.  If less, don't.
+ *              We specifically want to avoid a  d#  in front of
+ *              the numbers 0 1 2 and 3, which are also named constants;
+ *              there's no need to treat 'em as literals.
+ *          The calling routine will be responsible for allocating
+ *              and freeing the buffer.
+ *
+ *      Extraneous Remarks:
+ *          Too bad  atoi()  isn't a Standard C function; I could convert
+ *             using the current base, and be guaranteed that it would be
+ *             interpreted in the same base.
+ *          Instead, I have to fiddle-faddle around with  d#  ...
+ *
+ **************************************************************************** */
+
+static char *int_to_str( int num, char *bufr)
+{
+     char* prefix = "d# ";
+     if ( num < 8 ) prefix = "";
+     sprintf(bufr,"%s%d",prefix, num);
+     return (bufr);
+}
+
+
+
+/* **************************************************************************
+ *
+ *      Function name:  invoke_local
+ *      Synopsis:       Compile-in the code to access the Local whose
+ *                      assigned Number is given.  This function is
+ *                      entered into the Local-Names Vocabulary entry.
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             pfield              The Vocabulary entry's Param field, taken
+ *                                     from the Assigned Number of the Local.
+ *         Local Static Variables:
+ *             local_addr          Name of  _{local}  routine, invoked
+ *                                     when a Local is used 
+ *             local_op            Fetch or Store operator to apply.
+ *
+ *      Outputs:
+ *         Returned Value:         None
+ *         Local Static Variables:
+ *             eval_buf            Phrase constructed here; will become new
+ *                                     Source Input Buffer, temporarily
+ *
+ *      Error Detection:
+ *          If the Local Values Support FCode source-file was not
+ *              FLOADed into the user's tokenization source, then
+ *              the function  _{local}  will be an "unknown name".
+ *
+ *      Process Explanation:
+ *          We are going to generate a string of the form:
+ *                  " #local _{local} OP"
+ *              and pass it to the Parser for evaluation.
+ *          The call to  _{local}  is preceded by its parameter, which is
+ *               its Assigned Local-Number, and followed by the appropriate
+ *               OPerator, which will be "Fetch" if the Local's name was
+ *               invoked by itself, or "Store" if its invocation was made
+ *               in conjuction with the  ->  operator.
+ *          The string-buffer may be local, but it must be stable.
+ *
+ *      Revision History:
+ *      Updated Thu, 24 Mar 2005 by David L. Paktor
+ *          Factored-out to permit  lookup_local()  to be a "pure"
+ *          function that can be used for duplicate-name detection.
+ *      Updated Tue, 10 Jan 2006 by David L. Paktor
+ *          Accommodate conversion to  tic_hdr_t  type vocabulary.
+ *
+ **************************************************************************** */
+
+static void invoke_local( tic_param_t pfield )
+{
+    char local_num_buf[10];
+    int loc_num = (int)pfield.deflt_elem;
+
+    int_to_str(loc_num, local_num_buf);
+    sprintf( eval_buf, "%s %s %s", local_num_buf, local_addr, local_op );
+    eval_string( eval_buf);
+
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  locals_separator
+ *      Synopsis:       Test whether the given character is the separator
+ *                          between initted and uninitted Local Names.
+ *                      Optionally, allow Semi-Colon as a separator and issue
+ *                          an optional Advisory.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             subj     One-character "subject" of the test
+ *         Global Variables:    
+ *             ibm_locals_legacy_separator     Allow Semi-Colon as a separator?
+ *             ibm_legacy_separator_message    Issue an Advisory message?
+ *
+ *      Outputs:
+ *         Returned Value:   TRUE if the character is the separator
+ *
+ *      Error Detection:
+ *          If the separator is Semi-Colon, and  ibm_locals_legacy_separator 
+ *              is TRUE, then if  ibm_legacy_separator_message  is TRUE,
+ *              issue an Advisory message.
+ *          If the flag to allow Semi-Colon is FALSE, then simply do not
+ *              acknowledge a valid separator.  Other routines will report
+ *              an erroneous attempt to use an already-defined symbol.
+ *
+ *      Revision History:
+ *          Updated Wed, 13 Jul 2005 by David L. Paktor
+ *          Bring the questions of whether to accept semicolon as a separator
+ *              -- and whether to issue a message for it -- under the control 
+ *              of external flags (eventually set by command-line switches),
+ *              rather than being hard-compiled.
+ *
+ *      Extraneous Remarks:
+ *          In the interest of avoiding too deeply nested "IF"s, I will
+ *              not be adhering strictly to the rules of structure.
+ *
+ **************************************************************************** */
+
+static bool locals_separator( char subj )
+{
+    bool retval = FALSE;
+    /*  Is it the preferred (i.e., non-legacy) separator?   */
+    if ( subj == '|' )
+    {  
+	retval = TRUE;
+	return ( retval );
+    }
+	
+    if ( ibm_locals_legacy_separator )
+    {
+	if ( subj == ';' )
+	{
+	    retval = TRUE;
+	    if ( ibm_legacy_separator_message )
+	    {
+		tokenization_error ( WARNING , "Semicolon as separator in "
+		    "Locals declaration is deprecated in favor of '|'\n");
+	    }
+	}
+    }
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  add_local
+ *      Synopsis:       Given a pointer to a name and a number, enter
+ *                      them into the vocabulary for new Local names.
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             lnum              The assigned number
+ *             lname             Pointer to the name
+ *         Local Static Variables:
+ *             local_names       The vocabulary for new Local names
+ *
+ *      Outputs:
+ *         Returned Value:       NONE
+ *         Local Static Variables:
+ *             local_names       Enter the new Local's name and number.
+ *         Memory Allocated:
+ *             A place into which the name will be copied
+ *         When Freed?
+ *             When  forget_locals()  routine frees up all memory
+ *                 allocations in the "Local Names" Vocabulary.
+ *
+ *      Process Explanation:
+ *          Allocate a stable place in memory for the name, via  strdup().
+ *          The entry's "action" will be the  invoke_local()  function,
+ *              defined above.  The "parameter field" size is zero.
+ *
+ **************************************************************************** */
+
+static void add_local( TIC_P_DEFLT_TYPE lnum, char *lname)
+{
+    char *lnamecopy ;
+
+    lnamecopy = strdup( lname);
+    add_tic_entry( lnamecopy, invoke_local, lnum,
+		       LOCAL_VAL, 0, NULL, &local_names );
+    trace_creation( LOCAL_VAL, lname);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  gather_locals
+ *      Synopsis:       Collect Local names, for both initted and uninitted
+ *                      Return an indication as to whether to continue
+ *                      gathering Locals' names
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             initted        TRUE if we are gathering initted Local names.
+ *             counter        Pointer to variable that's counting names.
+ *         Global Variables:
+ *             statbuf        The symbol just retrieved from the input stream.
+ *         Local Static Variables:
+ *             localno        Running Local-Number to be assigned
+ *             l_d_lineno     Line # of Locals Declar'n start (for err mssg)
+ *
+ *      Outputs:
+ *         Returned Value:    TRUE = Ended with initted/uninitted separator
+ *         Local Static Variables:
+ *             localno        Incremented for each Local name declared
+ *             local_names    Enter the new locals' names into the Vocabulary.
+ *                            Numeric field is assigned local number.
+ *
+ *      Error Detection:
+ *          A Local-name that duplicates an existing name is an ERROR.
+ *              Especially if that name is <Semicolon> and the flag
+ *              called  ibm_locals_legacy_separator  was not set.
+ *          Issue an Error if close-curly-brace terminator is not found,
+ *              or if imbedded comment is not terminated, before end of file.
+ *          If the Separator is found a second-or-more time, issue an Error
+ *              and continue collecting uninitted Local names.
+ *
+ *      Revision History:
+ *      Updated Thu, 24 Mar 2005 by David L. Paktor
+ *          Allow comments to be interspersed among the declarations.
+ *          Error-check duplicate Local-name.
+ *      Updated Wed, 30 Mar 2005 by David L. Paktor
+ *          Warning when name length exceeds ANSI-specified max (31 chars). 
+ *      Updated Thu, 07 Jul 2005 by David L. Paktor
+ *          Protect against PC pointer-overrun due to unterminated
+ *              comment or declaration.
+ *          Error-check for numbers.
+ *          No name-length check; doesn't go into FCode anyway.
+ *
+ **************************************************************************** */
+
+static bool gather_locals( bool initted, int *counter )
+{
+    signed long wlen;
+    bool retval = FALSE;
+
+    while ( TRUE )
+    {
+        wlen = get_word();
+
+	if ( wlen <= 0 )
+	{
+	    warn_unterm( TKERROR, "Local-Values Declaration", l_d_lineno);
+	    break;
+	}
+
+	/*  Allow comments to be interspersed among the declarations.  */
+	if ( filter_comments( statbuf) )
+	{
+	    /*  Unterminated and Multi-line checking already handled   */
+	    continue;
+	}
+	/*  Is this the terminator or the separator? */
+	if ( wlen == 1 )    /*  Maybe   */
+	{
+	    /*  Check for separator   */
+	    if (locals_separator( statbuf[0] ) )
+	    {
+	        /*  If gathering initted Local names, separator is legit  */
+	        if ( initted )
+		{
+		    retval = TRUE;
+		    break;
+		}else{
+		    tokenization_error ( TKERROR,
+		        "Excess separator -- %s -- found "
+			    "in Local-Values declaration", statbuf);
+		    in_last_colon();
+		    continue;
+		}
+	    }
+	    /*  Haven't found the separator.  Check for the terminator  */
+	    if ( statbuf[0] == '}' )
+	    {
+		break;
+	    }
+	}
+	/*  It was not the terminator or the separator  */
+	{
+	    long tmp;
+	    char *where_pt1;  char *where_pt2;
+	    /*  Error-check for duplicated names  */
+	    if ( word_exists ( statbuf, &where_pt1, &where_pt2 ) )
+	    {
+		tokenization_error ( TKERROR, "Cannot declare %s "
+		    "as a Local-Name; it's already defined %s%s",
+			statbuf, where_pt1, where_pt2 );
+		show_node_start();
+		continue;
+	    }
+	    /*  Error-check for numbers.  */
+	    if ( get_number(&tmp) )
+	    {
+		tokenization_error ( TKERROR, "Cannot declare %s "
+		    "as a Local-Name; it's a number.\n", statbuf );
+		continue;
+	    }
+
+	    /*  We've got a valid new local-name    */
+	    /*  Don't need to check name length; it won't go into the FCode  */
+
+	    /*  Increment our counting-v'ble  */
+	    *counter += 1;
+
+	    /*  Define our new local-name in the Locals' vocabulary  */
+	    add_local( localno, statbuf );
+
+	    /*  Bump the running Local-Number  */
+	    localno++;
+
+	}
+    }
+    return ( retval );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  activate_locals
+ *      Synopsis:       Compile-in the call to  {push-locals}  that
+ *                      the new definition under construction will need,
+ *                      now that the Locals have been declared.
+ *      
+ *      Inputs:
+ *         Parameters:                NONE
+ *         Global Variables:
+ *             num_ilocals              First argument to  {push-locals}
+ *             num_ulocals              Second argument to  {push-locals}
+ *             push_locals              Name of  {push-locals}  routine.
+ *
+ *      Outputs:
+ *         Returned Value:            NONE
+ *         Local Static Variables:
+ *             eval_buf               Phrase constructed here; will become
+ *                                        new Source Input Buffer, temporarily
+ *
+ *      Error Detection:
+ *          If the Local Values Support FCode source-file was not
+ *              FLOADed into the user's tokenization source, then
+ *              the function  {push-locals}  will be an "unknown name".
+ *
+ *      Process Explanation:
+ *          We are going to generate a string of the form:
+ *                  " #ilocals #ulocals {push-locals}"
+ *              and pass it to the Parser for evaluation.
+ *          The string-buffer may be local, but it must be stable.
+ *
+ *      Question under consideration.:
+ *          Do we want to check if  {push-locals}  is an unknown name,
+ *              and give the user a hint of what's needed?  And, if so,
+ *              do we do it only once, or every time?
+ *
+ **************************************************************************** */
+
+static void activate_locals( void )
+{
+    char ilocals_buf[10];
+    char ulocals_buf[10];
+     
+    int_to_str(num_ilocals, ilocals_buf ); 
+    int_to_str(num_ulocals, ulocals_buf );
+    sprintf( eval_buf,"%s %s %s",ilocals_buf, ulocals_buf, push_locals);
+    eval_string( eval_buf);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  error_check_locals
+ *      Synopsis:       Indicate whether Locals declaration is erronious
+ *      
+ *      Inputs:
+ *         Parameters:     NONE
+ *         Global Variables:
+ *             incolon             TRUE if colon def'n is in effect.
+ *             opc                 FCode Output buffer Position Counter
+ *             lastcolon           Value of opc when Colon def'n was started
+ *
+ *      Outputs:
+ *         Returned Value:         TRUE if found errors severe enough to
+ *                                     preclude further processing of Decl'n
+ *
+ *      Errors Detected:
+ *           Colon definition not in effect.  ERROR and return TRUE.
+ *           Locals declaration inside body of colon-definition (i.e., after
+ *                something has been compiled-in to it) is potentially risky,
+ *                but may be valid, and is a part of legacy practice.  It
+ *                will not be treated as an outright ERROR, but it will
+ *                generate a WARNING...
+ *           Multiple locals declarations inside a single colon-definition
+ *                are completely disallowed.  ERROR and return TRUE.
+ *           Locals declaration inside a control-structure is prohibited.
+ *                Generate an ERROR, but return FALSE to allow processing
+ *                of the declaration to continue.
+ *
+ **************************************************************************** */
+
+/*  The value of  lastcolon  when Locals Declaration is made.
+ *      If it's the same, that detects multiple locals declaration attempt.
+ */
+static int last_local_colon = 0;
+
+static bool error_check_locals ( void )
+{
+    bool retval = FALSE;
+    
+    if ( ! incolon )
+    {
+	tokenization_error ( TKERROR,
+	    "Can only declare Locals inside of a Colon-definition.\n");
+        retval = TRUE;
+    } else {
+	if ( last_local_colon == lastcolon )
+	{
+	    tokenization_error ( TKERROR, "Excess Locals Declaration");
+	    in_last_colon();
+	    retval = TRUE;
+	}else{
+            last_local_colon = lastcolon;
+	    if ( opc > lastcolon )
+	    {
+		tokenization_error ( WARNING,
+		    "Declaring Locals after the body of a Colon-definition "
+		    "has begun is not recommended.\n");
+	    }
+	    announce_control_structs( TKERROR,
+		"Local-Values Declaration encountered",
+		    last_colon_abs_token_no);
+	}
+    }
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  declare_locals
+ *      Synopsis:       Process (or Ignore) the Declaration of Locals,
+ *                          upon encountering Curly-brace ( {  )
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             ignoring            TRUE if "Ignoring"
+ *         Global Variables:
+ *             statbuf             Next symbol to process.
+ *             lineno              Current Line Number in Input File
+ *             report_multiline    FALSE to suspend multiline warning
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Global Variables:
+ *             statbuf             Advanced to end of Locals Declaration.
+ *             pc                  Bumped past the close-curly-brace
+ *         Local Static Variables:
+ *             localno             Init'd, then updated by gather_locals()
+ *             l_d_lineno          Line Number of start of Locals Declaration
+ *
+ *      Error Detection:
+ *          See  error_check_locals()
+ *              After Error messages, will bypass further processing until the
+ *                  terminating close-curly-brace of a Locals Declaration.
+ *                  If the terminating close-curly-brace missing under those
+ *                  circumstances, issue an Error
+ *              If terminating close-curly-brace is missing when the Locals
+ *                  Declaration is otherwise valid, gather_locals() will
+ *                  detect and report the Error.
+ *              Warning if multiline declaration.  Because embedded comments
+ *                  may also supppress the multiline warning, we need to save
+ *                  and restore the state of the report_multiline switch...
+ *
+ **************************************************************************** */
+
+void declare_locals ( bool ignoring)
+{
+    num_ilocals = 0;
+    num_ulocals = 0;
+    localno = 0;
+    
+    l_d_lineno = lineno;
+    bool sav_rep_mul_lin = report_multiline;
+    report_multiline = TRUE;
+
+    if ( ignoring || error_check_locals() )
+    {
+       if ( skip_until ( '}' ) )
+       {
+	   warn_unterm(TKERROR,
+	       "misplaced Local-Values Declaration", l_d_lineno);
+       }else{
+	   pc++ ;  /*  Get past the close-curly-brace  */
+       }
+    }else{
+       if (gather_locals( TRUE,  &num_ilocals ) )
+       {
+	   gather_locals( FALSE, &num_ulocals );
+       }
+    }
+
+    /*  If PC has reached the END,  gather_locals()  will
+     *      have already issued an "unterminated" Error;
+     *      a "multiline" warning would be redundant
+     *      repetitive, unnecessary, excessive, unaesthetic
+     *      and -- did I already mention? -- redundant.
+     */
+    if ( pc < end )
+    {
+	report_multiline = sav_rep_mul_lin;
+	warn_if_multiline( "Local-Values declaration", l_d_lineno);
+    }
+
+    /*  Don't do anything if no Locals were declared    */
+    /*  This could happen if the  {  }  field is empty  */
+    if ( localno != 0 )
+    {
+	activate_locals();
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  handle_local
+ *      Synopsis:       Process the given name as a Local Name;
+ *                      indicate if it was a valid Local Name.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             lname                The "Local" name for which to look
+ *         Local Static Variables:  
+ *             local_names          The vocabulary for Local names
+ *
+ *      Outputs:
+ *         Returned Value:          TRUE if the name is a valid "Local Name"
+ *
+ **************************************************************************** */
+
+static bool handle_local( char *lname)
+{
+    bool retval = handle_tic_vocab( lname, local_names );
+    return ( retval ) ;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  lookup_local
+ *      Synopsis:       Return a pointer to the data-structure of the named
+ *                      word, only if it was a valid Local Name.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             lname                The "Local" name for which to look
+ *         Local Static Variables:  
+ *             local_names          The vocabulary for Local names
+ *
+ *      Outputs:
+ *         Returned Value:          Pointer to the data-structure, or
+ *                                      NULL if not found.
+ *
+ **************************************************************************** */
+
+tic_hdr_t *lookup_local( char *lname)
+{
+    tic_hdr_t *retval = lookup_tic_entry( lname, local_names );
+    return ( retval ) ;
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  create_local_alias
+ *      Synopsis:       Create an alias in the "Local Names" Vocabulary
+ *
+ *      Associated FORTH word:              ALIAS
+ *
+ *      Inputs:
+ *         Parameters:
+ *             old_name             Name of existing entry
+ *             new_name             New name for which to create an entry
+ *
+ *      Outputs:
+ *         Returned Value:          TRUE if  old_name  found in "Locals" vocab
+ *         Global Variables:    
+ *             local_names          Will point to the new entry
+ *         Memory Allocated:
+ *             Memory for the new entry, by the support routine
+ *         When Freed?
+ *             When  forget_locals()  routine frees up all memory
+ *                 allocations in the "Local Names" Vocabulary.
+ *
+ **************************************************************************** */
+
+bool create_local_alias(char *new_name, char *old_name)
+{
+    bool retval = create_tic_alias( new_name, old_name, &local_names );
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  exists_as_local
+ *      Synopsis:       Simply confirm whether a given name exists
+ *                      within the Locals vocabulary.
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             stat_name          Name to look up
+ *
+ *      Outputs:
+ *         Returned Value:        TRUE if stat_name was a Local
+ *
+ **************************************************************************** */
+
+bool exists_as_local( char *stat_name )
+{
+    bool retval = exists_in_tic_vocab(stat_name, local_names );
+    return ( retval );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  assign_local
+ *      Synopsis:       Process the "Assign to a Local" operator ( -> )
+ *      
+ *      Inputs:
+ *         Parameters:             NONE
+ *         Global Variables:
+ *             statbuf          Next symbol to process
+ *             pc               Input-source Scanning pointer
+ *             lineno           Input-source Line Number. Used for Err Mssg.
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Global Variables:
+ *             statbuf          Advanced to next symbol
+ *             pc               Advanced; may be unchanged if error.
+ *             lineno           Advanced; may be unchanged if error
+ *             local_op         Will be set to Store and then reset to Fetch.
+ *         Global Behavior:
+ *             Construct a phrase and pass it to the Tokenizer.
+ *
+ *      Error Detection:
+ *          If next symbol is not a Local name, print ERROR message    
+ *              and restore  pc  so that the next symbol will be    
+ *              processed by ordinary means.
+ *          In the extremely unlikely case that -> is last symbol in  
+ *              the source-file, report an ERROR.
+ *
+ *      Process Explanation:
+ *          Save the PC.
+ *          Get the next symbol; check for end-of-file.
+ *          Set Local Operator ( local_op ) to "Store", to prepare to apply it.
+ *          Pass the next symbol to  handle_local() .
+ *          If  handle_local()  failed to find the name, you have
+ *              detected an error; restore  pc .
+ *          Otherwise, you have invoked the local and applied "Store" to it.
+ *          At the end, reset  local_op  to "Fetch".
+ *
+ **************************************************************************** */
+
+void assign_local ( void )
+{
+    signed long wlen;
+    bool is_okay;
+    u8 *savd_pc = pc;
+    unsigned int savd_lineno = lineno;
+
+    wlen = get_word();
+
+	if ( wlen <= 0 )
+	{
+	    warn_unterm(TKERROR, "Locals Assignment", lineno);
+	    return;
+	}
+
+    local_op = "!";   /*  Set to Store  */
+
+    is_okay = handle_local( statbuf);
+    if( INVERSE(is_okay)  )
+    {
+        tokenization_error ( TKERROR,
+	    "Cannot apply -> to %s, only to a declared Local.\n", statbuf );
+        pc = savd_pc;
+	lineno = savd_lineno;
+    }
+    local_op = "@";   /*  Reset to Fetch  */
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  finish_locals
+ *      Synopsis:       Compile-in the call to  {pop-locals}  that the
+ *                      new definition under construction will need
+ *                      when it's about to complete execution, i.e.,
+ *                      before an EXIT or a SemiColon.  But only if the
+ *                      current definition under construction is using Locals.
+ *      
+ *      Inputs:
+ *         Parameters:       NONE
+ *             
+ *         Local Static Variables:
+ *             localno            Total # of Locals.
+ *                                    Both a param to  {pop-locals} 
+ *                                    and an indicator that Locals are in use.
+ *             pop_locals         Name of  {pop-locals}  routine.
+ *
+ *      Outputs:
+ *         Returned Value:        NONE
+ *         Local Static Variables:
+ *             eval_buf            Phrase constructed here; will become new
+ *                                     Source Input Buffer, temporarily
+ *
+ *      Error Detection:
+ *          If the Local Values Support FCode source-file was not
+ *              FLOADed into the user's tokenization source, then
+ *              the function  {pop-locals}  will be an "unknown name".
+ *
+ *      Revision History:
+ *          Updated Fri, 24 Feb 2006 by David L. Paktor
+ *              The eval_string() routine no longer calls its own
+ *                  instance of  tokenize() .  In order to make a
+ *                  smooth transition between the processing the
+ *                  internally-generated string and the resumption
+ *                  of processing the source file, it simply sets
+ *                  up the string to be processed next.
+ *              In this case, however, we need to have the string
+ *                  processed right away, as the calling routine
+ *                  emits a token that must follow those generated
+ *                  by this.
+ *              Fortunately, we know the exact contents of the string.
+ *                  Two calls to tokenize_one_word() will satisfy the
+ *                  requirement.
+ *
+ **************************************************************************** */
+
+void finish_locals ( void )
+{
+     /*    Don't do anything if Locals are not in use    */
+    if ( localno > 0 )
+    {
+        char nlocals_buf[10];
+     
+        int_to_str(localno, nlocals_buf ); 
+        sprintf( eval_buf,"%s %s",nlocals_buf, pop_locals);
+        eval_string( eval_buf);
+	tokenize_one_word( get_word() );
+	tokenize_one_word( get_word() );
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  forget_locals
+ *      Synopsis:       Remove the Locals' names from the special Vocabulary
+ *                      free-up their allocated memory, and reset the Locals'
+ *                      counters (which are also the indication that Locals
+ *                      are in use).  This is done at the time a SemiColon
+ *                      is processed.  But only if the current definition
+ *                      under construction is using Locals.
+ *      
+ *      Inputs:
+ *         Parameters:              NONE
+ *         Local Static Variables:
+ *             local_names          The vocabulary for new Local names
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *         Local Static Variables:
+ *             local_names          Emptied and pointing at NULL.
+ *             num_ilocals          Reset to zero
+ *             num_ulocals              ditto
+ *             localno                  ditto
+ *         Memory Freed
+ *             All memory allocations in the "Local Names" Vocabulary.
+ *
+ **************************************************************************** */
+
+void forget_locals ( void )
+{
+     /*    Don't do anything if Locals are not in use    */
+    if ( localno != 0 )
+    {
+        reset_tic_vocab( &local_names, NULL ) ;
+
+        num_ilocals = 0;
+        num_ulocals = 0;
+        localno = 0;
+    }
+}
diff --git a/toke/parselocals.h b/toke/parselocals.h
new file mode 100644
index 0000000..90e3d7a
--- /dev/null
+++ b/toke/parselocals.h
@@ -0,0 +1,48 @@
+#ifndef _TOKE_LOCALX_H
+#define _TOKE_LOCALX_H
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *     Function Prototypes / External definitions for Parsing
+ *          functions for IBM-style Local Values in Tokenizer
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+#include "ticvocab.h"
+
+void declare_locals ( bool ignoring);
+tic_hdr_t *lookup_local( char *lname);
+bool exists_as_local( char *stat_name );
+bool create_local_alias(char *new_name, char *old_name);
+void assign_local ( void );
+void finish_locals ( void );
+void forget_locals ( void );
+
+#endif   /*  _TOKE_LOCALX_H    */
diff --git a/toke/scanner.c b/toke/scanner.c
index 0acd6ca..030f667 100644
--- a/toke/scanner.c
+++ b/toke/scanner.c
@@ -24,6 +24,12 @@
  *
  */
 
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -34,74 +40,596 @@
 #include <time.h>
 #include <ctype.h>
 
-#include "toke.h"
+#include "macros.h"
 #include "stack.h"
 #include "stream.h"
 #include "emit.h"
+#include "toke.h"
 #include "dictionary.h"
+#include "vocabfuncts.h"
+#include "scanner.h"
+#include "errhandler.h"
+#include "tokzesc.h"
+#include "conditl.h"
+#include "flowcontrol.h"
+#include "usersymbols.h"
+#include "clflags.h"
+#include "devnode.h"
+#include "tracesyms.h"
+#include "nextfcode.h"
 
-#define ERROR    do { if (!noerrors) exit(-1);  } while (0)
-
-extern u8 *start, *pc, *end, *opc, *ostart;
-extern int verbose, noerrors;
+#include "parselocals.h"
 
-u8   *statbuf=NULL;
-u16  nextfcode;
-u8   base=0x0a;
+/* **************************************************************************
+ *
+ *  Some VERY IMPORTANT global variables follow
+ *
+ **************************************************************************** */
 
-/* header pointers */
-u8  *fcode_hdr=NULL;
-u8  *pci_hdr=NULL;
+u8  *statbuf=NULL;      /*  The word just read from the input stream  */
+u8   base=0x0a;         /*  The numeric-interpretation base           */
 
 /* pci data */
 bool pci_is_last_image=TRUE;
-bool pci_want_header=FALSE;
-u16  pci_revision=0x0001;
+u16  pci_image_rev=0x0001;  /*  Vendor's Image, NOT PCI Data Structure Rev */
 u16  pci_vpd=0x0000;
 
-bool offs16=TRUE;
-static bool intok=FALSE, incolon=FALSE;
-bool haveend=FALSE;
 
-static u8 *skipws(u8 *str)
+/*  Having to do with the state of the tokenization  */
+bool offs16       = TRUE;    /*  We are using 16-bit branch- (etc) -offsets */
+bool in_tokz_esc  = FALSE;   /*  TRUE if in "Tokenizer Escape" mode   */
+bool incolon      = FALSE;   /*  TRUE if inside a colon definition    */
+bool haveend      = FALSE;   /*  TRUE if the "end" code was read.     */
+int do_loop_depth = 0;       /*  How deep we are inside DO ... LOOP variants  */
+
+/*  Used for error-checking of IBM-style Locals  */
+int lastcolon;   /*  Location in output stream of latest colon-definition. */
+
+/*  Used for error reporting   */
+char *last_colon_defname = NULL;   /*  Name of last colon-definition        */
+char *last_colon_filename = NULL;  /*  File where last colon-def'n made     */
+unsigned int last_colon_lineno;    /*  Line number of last colon-def'n      */
+bool report_multiline = TRUE;      /*  False to suspend multiline warning   */
+unsigned int last_colon_abs_token_no;
+
+/* **************************************************************************
+ *  Local variables
+ **************************************************************************** */
+static u16  last_colon_fcode;  /*  FCode-number assigned to last colon-def'n  */
+                               /*      Used for RECURSE  */
+
+static bool do_not_overload = TRUE ;  /*  False to suspend dup-name-test     */
+static bool got_until_eof = FALSE ;   /*  TRUE to signal "unterminated"      */
+
+static unsigned int last_colon_do_depth = 0;
+
+/*  State of headered-ness for name-creation  */
+typedef enum headeredness_t {
+       FLAG_HEADERLESS ,
+       FLAG_EXTERNAL ,
+       FLAG_HEADERS }  headeredness ;
+static headeredness hdr_flag = FLAG_HEADERLESS ;  /*  Init'l default state  */
+
+/*  Local variables having to do with:                                      */
+/*       ...  the state of the tokenization                                 */
+static bool is_instance = FALSE;        /*  Is "instance" is in effect?     */
+static char *instance_filename = NULL;  /*  File where "instance" invoked   */
+static unsigned int instance_lineno;    /*  Line number of "instance"       */
+static bool fcode_started = FALSE ;     /*  Only 1 fcode_starter per block. */
+static bool first_fc_starter = TRUE;    /*  Only once per tokenization...   */
+
+/*       ... with the state of the input stream,                            */
+static bool need_to_pop_source;
+
+/*       ... with the use of the return stack,                              */
+static int ret_stk_depth = 0;          /*  Return-Stack-Usage-Depth counter */
+
+/*       ... and with control of error-messaging.                           */
+           /*  Should a warning about a dangling "instance" 
+	    *      be issued at the next device-node change?
+	    */
+static bool dev_change_instance_warning = TRUE;
+
+           /*  Has a gap developed between "instance" and its application?  */
+static bool instance_definer_gap = FALSE;
+
+           /*  Shared phrases                                               */
+static char *in_tkz_esc_mode = "in Tokenizer-Escape mode.\n";
+
+
+/* **************************************************************************
+ *
+ *      Function name:  skip_ws
+ *      Synopsis:       Advance the PC past all whitespace.
+ *                      Protect against pointer over-runs 
+ *
+ *      Inputs:
+ *         Parameters:                  NONE
+ *         Global Variables:        
+ *             pc                       Input-source Scanning pointer
+ *             end                      End of input-source buffer
+ *
+ *      Outputs:
+ *         Returned Value:      TRUE if PC reached END before non-blank char
+ *         Global Variables:    
+ *             pc            Advanced to first non-blank char, or to END  
+ *             lineno        Incremented if encountered new-line along the way
+ *
+ *      Error Detection:
+ *          Return a TRUE if End of input-source buffer reached before
+ *              non-blank character.  Not necessarily an error; allow
+ *              calling routine to decide...
+ *
+ **************************************************************************** */
+
+static bool skip_ws(void)
 {
-	while (str && (*str=='\t' || *str==' ' || *str=='\n' )) {
-		if (*str=='\n') 
-			lineno++;
-		str++;
+    bool retval = TRUE;
+    char ch_tmp;
+
+    for (  ; pc < end; pc++ )
+{
+        ch_tmp = *pc;
+	if ( (ch_tmp != '\t') && (ch_tmp != ' ') && (ch_tmp != '\n' ) )
+	{
+	    retval = FALSE;
+	    break;
+	}
+        if ( ch_tmp == '\n')  lineno++;
+    }
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  skip_until
+ *      Synopsis:       Advance the PC to the given character.
+ *                      Do not copy anything into statbuf.
+ *                      Protect against pointer over-runs 
+ *
+ *      Inputs:
+ *         Parameters:
+ *             lim_ch                   Limiting Character
+ *         Global Variables:        
+ *             pc                       Input-source Scanning pointer
+ *             end                      End of input-source buffer
+ *
+ *      Outputs:
+ *         Returned Value:      TRUE if PC reached END before finding LIM_CH
+ *         Global Variables:    
+ *             pc            Advanced to first occurrence of LIM_CH, or to END  
+ *             lineno        Incremented if encountered new-line along the way
+ *
+ *      Error Detection:
+ *          Return a TRUE if End of input-source buffer reached before
+ *              desired character.  Not necessarily an error; allow calling
+ *              routine to decide...
+ *
+ **************************************************************************** */
+
+bool skip_until( char lim_ch)
+{
+    bool retval = TRUE;
+    char ch_tmp;
+
+    for (  ; pc < end; pc++ )
+    {
+        ch_tmp = *pc;
+        if ( ch_tmp == lim_ch )
+	{
+	    retval = FALSE;
+	    break;
+	}
+        if ( ch_tmp == '\n')  lineno++;
 	}
+    return ( retval );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  get_until
+ *      Synopsis:       Return, in  statbuf, the string from  PC  to the first
+ *                      occurrence of the given delimiter-character..
+ *
+ *      Inputs:
+ *         Parameters:
+ *             needle          The given delimiter-character
+ *         Global Variables:
+ *             pc              Input-source Scanning Pointer
+ *
+ *      Outputs:
+ *         Returned Value:     Length of the string obtained
+ *         Global Variables:
+ *             statbuf         The string obtained from the input stream;
+ *                                 does not include the delimiter-character.
+ *             pc              Bumped past the delimiter-character, unless
+ *                                 it's a new-line, in which case leave it
+ *                                 to be handled by  get_word()
+ *         Local Static Variables:
+ *             got_until_eof   Pass this as a signal that the end of the
+ *                                 buffer was reached before the delimiter;
+ *                                 Testing whether PC has reached END is
+ *                                 not a sufficient indication.
+ *
+ *      Error Detection:
+ *          If string overflows  statbuf  allocation, ERROR, and 
+ *              return "no string" (i.e., length = 0).
+ *          Otherwise, if delimiter not found before eof, keep string.
+ *              Protection against PC pointer-over-run past END is
+ *              provided by  skip_until() .  Reaching END will be
+ *              handled by calling routine; pass indication along
+ *              via Local Static Variable.
+ *
+ *      Process Explanation:
+ *          Skip the delimiter-character from further input, unless it's a
+ *              new-line which will be skipped anyway.  Let  skip_until() 
+ *              and  get_word()  handle incrementing line-number counters.
+ *          If skip_until()  indicated reaching end-of-file, don't bump PC
+ *
+ *      Revision History:
+ *          Updated Thu, 14 Jul 2005 by David L. Paktor
+ *              More robust testing for when PC exceeds END 
+ *                  Involved replacing  firstchar()
+ *
+ **************************************************************************** */
 	
-	return str;
+static signed long get_until(char needle)
+{                                                                               
+	u8 *safe;                                                         
+	unsigned long len = 0;
+
+	safe=pc;
+
+	got_until_eof = skip_until(needle);
+
+	len = pc - safe;
+	if (len >= GET_BUF_MAX )
+	{
+	    tokenization_error( TKERROR,
+		"get_until buffer overflow.  Max is %d.\n", GET_BUF_MAX-1 );
+	    len = GET_BUF_MAX-1;
 }
 
-static u8 *firstchar(u8 needle, u8 *str)
+	memcpy(statbuf, safe, len);
+	statbuf[len]=0;
+
+	if ( INVERSE(got_until_eof) )
 {
-	while (str && *str!=needle) {
-		if (*str=='\n') 
-			lineno++;
-		str++;
+	    if ( needle != '\n' )  pc++;
+	}
+	return len;
+}
+
+
+/* **************************************************************************
+ *
+ *          We are going to use a fairly sophisticated mechanism to
+ *              make a smooth transition between processing the body
+ *              of a Macro, a User-defined Symbol or an FLOADed file 
+ *              and the resumption of processing the source file, so
+ *              that the end-of-file will only be seen at the end of
+ *              the primary input file (the one from the command-line).
+ *         This mechanism will be tied in with the get_word() routine
+ *
+ *         We are going to define a private data-structure in which
+ *              we will save the state of the current source file,
+ *              and from which, of course, we will recover it.  Its
+ *              fields will be:
+ *                   A pointer to the next structure in the list.
+ *                   The saved values of  START  END  and  PC
+ *                   The saved values of  INAME  and  LINENO
+ *                   A flag indicating that get-word should "pause"
+ *                        before popping the source-stream because
+ *                        the input file will be changing.
+ *                   A place from which to save and recover the state of
+ *                        whether we're testing for "Multi-line" strings;
+ *                        to prevent undeserved "Multi-line" warnings
+ *                        during Macro processing.
+ *                   A pointer to a "resumption" routine, to call
+ *                        when resuming processing the source file;
+ *                        the routine takes a pointer parameter
+ *                        and has no return value.  The pointer
+ *                        may be NULL if no routine is needed.
+ *                   The pointer to pass as the parameter to the
+ *                        resumption routine.
+ *
+ **************************************************************************** */
+
+typedef struct source_state
+    {
+	struct source_state   *next;
+	u8                    *old_start;
+	u8                    *old_pc;
+	u8                    *old_end;
+	char                  *old_iname;
+	unsigned int           old_lineno;
+	bool                   pause_before_pop;
+	bool                   sav_rep_multlin;
+	void                 (*resump_func)();
+	_PTR                   resump_param;
+    } source_state_t ;
+
+static source_state_t  *saved_source = NULL;
+
+
+/* **************************************************************************
+ *
+ *      Function name:  push_source
+ *      Synopsis:       Save the state of the current source file, in the
+ *                          source_state data-structure LIFO linked-list.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             res_func              Pointer to routine to call when resuming
+ *                                       processing the saved source file.
+ *             res_param             Parameter to pass to res_func.
+ *                                   Either or both pointers may be NULL.
+ *             file_chg              TRUE if input file is going to change.
+ *         Global Variables:
+ *             start                 Points to current input buffer
+ *             end                   Points to end of current input buffer
+ *             pc                    Input point in current buffer
+ *             iname                 Name of current source file
+ *             lineno                Line number in current source file
+ *             report_multiline      Whether we're testing for "Multi-line"
+ *         Local Static Variables:
+ *             saved_source          Pointer to the source_state data-structure
+ *
+ *      Outputs:
+ *         Returned Value:           NONE
+ *         Local Static Variables:
+ *             saved_source          Points to new source_state entry
+ *         Memory Allocated
+ *             for the new source_state entry
+ *         When Freed?
+ *             When resuming processing the source file, by drop_source().
+ *
+ *      Process Explanation:
+ *          The calling routine will establish the new input buffer via
+ *              a call to init_inbuf() or the like.
+ *
+ **************************************************************************** */
+
+void push_source( void (*res_func)(), _PTR res_parm, bool file_chg )
+{
+    source_state_t  *new_sav_src;
+
+    new_sav_src = safe_malloc( sizeof(source_state_t), "pushing Source state");
+
+    new_sav_src->next = saved_source;
+    new_sav_src->old_start = start;
+    new_sav_src->old_pc = pc;
+    new_sav_src->old_end = end;
+    new_sav_src->old_iname = iname;
+    new_sav_src->old_lineno = lineno;
+    new_sav_src->pause_before_pop = file_chg;
+    new_sav_src->sav_rep_multlin = report_multiline;
+    new_sav_src->resump_func = res_func;
+    new_sav_src->resump_param = res_parm;
+
+    saved_source = new_sav_src;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  drop_source
+ *      Synopsis:       Remove last saved state of source processing
+ *                          from the source_state LIFO linked-list,
+ *                          without (or after) restoring.
+ *
+ *      Inputs:
+ *         Parameters:               NONE
+ *         Local Static Variables:
+ *             saved_source          Pointer to the source_state data-structure
+ *
+ *      Outputs:
+ *         Returned Value:           NONE
+ *         Local Static Variables:
+ *             saved_source          Points to previous source_state entry
+ *         Memory Freed
+ *             Saved source_state entry that was just "dropped"
+ *
+ *      Error Detection:
+ *          None.  Called only when linked-list is known not to be at end.  
+ *
+ **************************************************************************** */
+
+static void drop_source( void)
+{
+    source_state_t  *former_sav_src = saved_source;
+
+    saved_source = saved_source->next ;
+    free( former_sav_src);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  pop_source
+ *      Synopsis:       Restore the state of source processing as it was
+ *                          last saved in the source_state linked-list.
+ *
+ *      Inputs:
+ *         Parameters:               NONE
+ *         Local Static Variables:
+ *             saved_source          Pointer to the source_state data-structure
+ *             need_to_pop_source    If TRUE, don't check before popping.
+ *
+ *      Outputs:
+ *         Returned Value:           TRUE if reached end of linked-list
+ *         Global Variables:
+ *             start                 Points to restored input buffer
+ *             end                   Points to end of restored input buffer
+ *             pc                    Input point in restored buffer
+ *             iname                 Name of restored source file
+ *             lineno                Line number in restored source file
+ *             report_multiline      Restored to saved value.
+ *         Local Static Variables:
+ *             saved_source          Points to previous source_state entry
+ *             need_to_pop_source    TRUE if postponed popping till next time
+ *         Memory Freed
+ *             Saved source-state entry that was just "popped"
+ *
+ *      Process Explanation:
+ *          First check the need_to_pop_source flag.
+ *          If it is set, we will clear it and go ahead and pop.
+ *          If it is not set, we will check the  pause_before_pop  field
+ *                  of the top entry in the source_state linked-list.
+ *              If the  pause_before_pop  field is set, we will set the
+ *                  need_to_pop_source flag and return.
+ *              If it is not, we will go ahead and pop.
+ *          If we are going to go ahead and pop, we will call the
+ *              "Resume-Processing" routine (if it's not NULL) before
+ *              we restore the saved source state.
+ *
+ **************************************************************************** */
+
+static bool pop_source( void )
+{
+    bool retval = TRUE;
+
+    if ( saved_source != NULL )
+    {
+	retval = FALSE;
+	if ( need_to_pop_source )
+	{
+	    need_to_pop_source = FALSE;
+	}else{
+	    if ( saved_source->pause_before_pop )
+	    {
+	        need_to_pop_source = TRUE;
+		return( retval);
+	    }
+	}
+
+	if ( saved_source->resump_func != NULL )
+	{
+	    saved_source->resump_func( saved_source->resump_param);
 	}
+	report_multiline = saved_source->sav_rep_multlin;
+	lineno = saved_source->old_lineno ;
+	iname = saved_source->old_iname ;
+	end = saved_source->old_end ;
+	pc = saved_source->old_pc ;
+	start = saved_source->old_start ;
 
-	return str;
+	drop_source();
+    }
+    return( retval);
 }
 
-static unsigned long get_word(void)
+
+/* **************************************************************************
+ *
+ *      Function name:  get_word
+ *      Synopsis:       Gather the next "word" (aka Forth Token) from the
+ *                          input stream.
+ *                      A Forth Token is, of course, a string of characters
+ *                          delimited by white-space (blank, tab or new-line).
+ *                      Do not increment line-number counters here; leave
+ *                          the delimiter after the word unconsumed.
+ *
+ *      Inputs:
+ *         Parameters:                 NONE
+ *         Global Variables:
+ *             pc                      Input-stream Scanning Pointer
+ *         Local Static Variables:
+ *             need_to_pop_source      If TRUE, pop_source() as first step
+ *
+ *      Outputs:
+ *         Returned Value:             Length of "word" gotten;
+ *                                     0 if  reached end of file.
+ *                                     -1 if reached end of primary input
+ *                                         (I.e., end of all source)
+ *         Global Variables:
+ *             statbuf                 Copy of "gotten" word
+ *             pc                      Advanced to end of "gotten" word,
+ *                                         (i.e., the next word is "consumed")
+ *                                         unless returning zero.
+ *             abs_token_no            Incremented, if valid "word" (token)
+ *                                         was gotten.
+ *
+ *      Process Explanation:
+ *          Skip whitespace to the start of the token, 
+ *             then skip printable characters to the end of the token.
+ *          That part's easy, but what about when skipping whitespace
+ *              brings you to the end of the input stream?
+ *          First, look at the  need_to_pop_source  flag.  If it's set,
+ *              we came to the end of the input stream the last time
+ *              through.  Now we need to  pop_source()  first.
+ *          Next, we start skipping whitespace; this detects when we've
+ *                  reached the end of the input stream.  If we have,
+ *                  then we need to  pop_source()  again.
+ *              If  pop_source()  returned a TRUE, we've reached the end
+ *                  of the primary input file.  Return -1.
+ *              If  pop_source()  turned the  need_to_pop_source  flag
+ *                  to TRUE again, then we need to "pause" until the
+ *                  next time through; return zero.
+ *          Otherwise, we proceed with collecting the token as described.
+ *
+ *      Revision History:
+ *          Updated Thu, 23 Feb 2006 by David L. Paktor
+ *              Tied this routine in with a more sophisticated mechanism that
+ *                  makes a smooth transition between processing the body of
+ *                  a Macro, a User-defined Symbol or an FLOADed file, and 
+ *                  the resumption of processing the source file, so that the
+ *                  end-of-file will only be seen at the end of the primary
+ *                  input file (the one that came from the command-line)
+ *          Updated Fri, 24 Feb 2006 by David L. Paktor
+ *              This is trickier than I thought.  Added a global indicator
+ *                  of whether a file-boundary was crossed while getting
+ *                  the word; previously, that was indicated by a return
+ *                  value of zero, which now means something else...
+ *              The flag,  closed_stream , will be cleared every time this
+ *                  routine is entered, and set whenever close_stream() is
+ *                  entered.
+ *         Updated Tue, 28 Feb 2006 at 10:13 PST by David L. Paktor
+ *              Trickier still.  On crossing a file-boundary, must not
+ *                  consume the first word in the resumed file, for one
+ *                  call; instead, return zero.  Consume it on the next
+ *                  call.  The  closed_stream  flag is now irrelevant and
+ *                  has gone away.
+ *
+ **************************************************************************** */
+
+signed long get_word( void)
 {
 	size_t len;
 	u8 *str;
+	bool keep_skipping;
+	bool pop_result;
+
+	if ( need_to_pop_source )
+	{
+	    pop_result = pop_source();
+	}
 
-	pc=skipws(pc);
-	if (pc>=end)
+	do {
+	    keep_skipping = skip_ws();
+	    if ( keep_skipping )
+	    {
+		pop_result = pop_source();
+		if ( pop_result || need_to_pop_source )
+		{
+		    statbuf[0] = 0;
+		    if ( pop_result )
+		    {
+			return -1;
+		    }
 		return 0;
+		}
+	    }
+	} while ( keep_skipping );
 
 	str=pc;
-	while (str && *str && *str!='\n' && *str!='\t' && *str!=' ')
+	while ( (str < end) && *str && *str!='\n' && *str!='\t' && *str!=' ')
 		str++;
 
 	len=(size_t)(str-pc);
-	if (len>1023) {
-		printf("%s:%d: error: buffer overflow.\n", iname, lineno);
-		ERROR;
+	if (len >= GET_BUF_MAX )
+	{
+	    tokenization_error ( FATAL,
+		"get_word buffer overflow.  Max is %d.", GET_BUF_MAX-1 );
 	}
 
 	memcpy(statbuf, pc, len); 
@@ -112,39 +640,297 @@ static unsigned long get_word(void)
 			iname, lineno, statbuf, len);
 #endif
 	pc+=len;
+	abs_token_no++;
 	return len;
 }
 
-static unsigned long get_until(char needle)
+
+/* **************************************************************************
+ *
+ *      Function name:  get_word_in_line
+ *      Synopsis:       Get the next word on the same line as the current
+ *                      line of input.  If the end of line was reached
+ *                      before a word was found, print an error message
+ *                      and return an indication.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             func_nam        Name of the function expecting the same-line
+ *                                 input; for use in the Error Message.
+ *                                 If NULL, do not issue Error Message
+ *         Global Variables:
+ *             pc              Input character pointer.  Saved for comparison
+ *             lineno          Current input line number.  Saved for comparison
+ *
+ *      Outputs:
+ *         Returned Value:     TRUE = success.  Word was acquired on same line.
+ *         Global Variables:
+ *             statbuf         Advanced to the next word in the input stream.
+ *             pc              Advanced if no error; restored otherwise.
+ *
+ *      Error Detection:
+ *          If no next word is gotten (i.e., we're at end-of-file), or if
+ *              one is gotten but not on the same line, the routine will
+ *              return FALSE; if  func_nam  is not NULL, an ERROR Message
+ *              will be issued.
+ *          Also, the values of  PC  LINENO  and  ABS_TOKEN_NO  will be reset
+ *              to the positions they had when this routine was entered.
+ *
+ **************************************************************************** */
+
+bool get_word_in_line( char *func_nam)
 {                                                                               
-	u8 *safe;                                                         
-	unsigned long len;                                                      
+    signed long wlen;
+    bool retval = TRUE;
+    u8 *save_pc = pc;
+    unsigned int save_lineno = lineno;
+    unsigned int save_abs_token_no = abs_token_no;
 
-	safe=pc;
-	pc=firstchar(needle,safe);
-	if (pc>=end)
-		return 0;
+    /*  Copy of function name, for error message  */
+    char func_cpy[FUNC_CPY_BUF_SIZE+1];
+
+    /*  Do this first, in the likely event that  func_nam  was  statbuf   */
+    if ( func_nam != NULL )
+    {
+	strncpy( func_cpy, func_nam, FUNC_CPY_BUF_SIZE);
+	func_cpy[FUNC_CPY_BUF_SIZE] = 0;  /*  Guarantee a null terminator  */
+    }
+
+    wlen = get_word();
+    if ( ( lineno != save_lineno ) || ( wlen <= 0 ) )
+    {
+	abs_token_no = save_abs_token_no;
+	lineno = save_lineno;
+	pc = save_pc;
+	retval = FALSE;
+	if ( func_nam != NULL )
+	{
+	    tokenization_error ( TKERROR,
+	       "Operator %s expects its target on the same line\n",
+		   strupr(func_cpy));
+	}
+    }
+    return ( retval );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  get_rest_of_line
+ *      Synopsis:       Get all the remaining text on the same line as
+ *                      the current line of input.  If there is no text
+ *                      (not counting whitespace) before the end of line,
+ *                      return an indication.
+ *
+ *      Inputs:
+ *         Parameters:         NONE
+ *         Global Variables:
+ *             pc              Input character pointer.  Saved for restoration
+ *             lineno          Current input line number.  Saved for comparison
+ *
+ *      Outputs:
+ *         Returned Value:     TRUE = success.  Text was acquired on same line.
+ *         Global Variables:
+ *             statbuf         Contains the text found in the input stream.
+ *             pc              Advanced to end of line or of whitespace, if
+ *                                 no error; restored otherwise.
+ *             lineno          Preserved if no error; otherwise, restored.
+ *             abs_token_no    Restored if error; otherwise, advanced as normal.
+ *
+ *      Error Detection:
+ *          Routine will return FALSE if no text is gotten on the same line.
+ *
+ **************************************************************************** */
+
+bool get_rest_of_line( void)
+{
+    bool retval = FALSE;
+    u8 *save_pc = pc;
+    unsigned int save_lineno = lineno;
+    unsigned int save_abs_token_no = abs_token_no;
+
+    if ( INVERSE( skip_ws() ) )
+    {
+        if ( lineno == save_lineno )
+	{
+	    signed long wlen = get_until('\n');
+	    if ( wlen > 0 ) retval = TRUE;
+	}else{
+	    abs_token_no = save_abs_token_no;
+	    lineno = save_lineno;
+	    pc = save_pc;
+	}
+    }
+    return( retval);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  warn_unterm
+ *      Synopsis:       Message for "Unterminated ..." something
+ *                      Show saved line-number, where the "something" started,
+ *                      and the definition, if any, in which it occurred.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             severity              Type of error/warning message to display
+ *                                       usually either WARNING or TKERROR
+ *             something             String to print after "Unterminated"
+ *             saved_lineno          Line-Number where the "something" started
+ *         Global Variables:
+ *             lineno                Saved, then restored.
+ *             last_colon_defname    Used only if unterm_is_colon is TRUE;
+ *         Local Static Variables:
+ *             unterm_is_colon       See 07 Mar 2006 entry under Rev'n History
+ *
+ *      Outputs:
+ *         Returned Value:           NONE
+ *         Global Variables:
+ *             lineno                Saved, then restored.
+ *         Local Static Variables:
+ *             unterm_is_colon       Reset to FALSE
+ *         Printout:
+ *             Warning or Error message
+ *
+ *      Revision History:
+ *          Updated Mon, 06 Mar 2006 by David L. Paktor
+ *              Added call to in_last_colon()
+ *          Updated Tue, 07 Mar 2006 by David L. Paktor
+ *              Call to in_last_colon() works okay in most cases except for
+ *                  when the "something" is a Colon Definition; there, it
+ *                  results in the phrase: ... Definition in definition of ...
+ *                  which is awkward.  To eliminate that, I am introducing 
+ *                  a Local Static Variable flag called  unterm_is_colon
+ *                  which will be set only in the appropriate place and
+ *                  re-cleared here.  It's a retro-fit, of course; it could
+ *                  have been a parameter had the need for it occurred when
+ *                  this routine was first constructed... 
+ *
+ **************************************************************************** */
+
+static bool unterm_is_colon = FALSE;
+void warn_unterm( int severity, char *something, unsigned int saved_lineno)
+{
+    unsigned int tmp = lineno;
+    lineno = saved_lineno;
+    if ( unterm_is_colon )
+    {
+	tokenization_error( severity, "Unterminated %s of %s\n",
+	    something, strupr( last_colon_defname) );
+	unterm_is_colon = FALSE;
+    }else{
+	tokenization_error( severity, "Unterminated %s", something);
+	in_last_colon();
+    }
+    lineno = tmp;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  warn_if_multiline
+ *      Synopsis:       Test for "Multi-line ..." something and issue WARNING
+ *                      Show saved line-number, where the "something" started
+ *
+ *      Inputs:
+ *         Parameters:
+ *             something          String to print after "Unterminated"
+ *             start_lineno       Line-Number where the "something" started
+ *         Global Variables:
+ *             lineno             Line-Number where we are now
+ *             iname              Input file name, to satisfy ...where_started()
+ *                                    (Not crossing any actual file boundary.)
+ *             report_multiline   TRUE = go ahead with the message
+ *
+ *      Outputs:
+ *         Returned Value:        NONE
+ *         Global Variables:
+ *             report_multiline   Restored to TRUE.
+ *
+ *      Error Detection:
+ *          Only issue message if the current  lineno  doesn't equal
+ *              the start_lineno  
+ *
+ *      Process Explanation:
+ *          The directive "multi-line" allows the user to specify that
+ *              the next "Multi-line ..." something is intentional, and
+ *              will cause its warning to be suppressed.  It remains in
+ *              effect until it's "used"; afterwards, it's reset.
+ *
+ **************************************************************************** */
+
+void warn_if_multiline( char *something, unsigned int start_lineno )
+{
+    if ( report_multiline && ( start_lineno != lineno ) )
+    {
+	tokenization_error( WARNING, "Multi-line %s, started", something);
+	where_started( iname, start_lineno);
+    }
+    report_multiline = TRUE;
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  string_remark
+ *      Synopsis:       Suspend string parsing past end of line and
+ *                      whitespace at start of the new line.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             errmsg_txt            Text to be used for error-message.
+ *         Global Variables:
+ *             pc                    Input-source Scanning pointer
+ *
+ *      Outputs:
+ *         Returned Value:           NONE
+ *         Global Variables:
+ *             pc                    Will point to first non-blank in new line
+ *
+ *      Error Detection:
+ *          The return value of the skip_until() or skip_ws() routine
+ *             will indicate if PC goes past END.  Issue a WARNING.
+ *             The calling routine will handle things from there.
+ *
+ **************************************************************************** */
 
-	len=(unsigned long)pc-(unsigned long)safe;
-	if (len>1023) {
-		printf("%s:%d: error: buffer overflow\n", iname, lineno);
-		ERROR;
+static void string_remark(char *errmsg_txt)
+{
+    unsigned int sav_lineno = lineno;
+    bool eof = skip_until('\n');
+    if ( ! eof )
+    {
+	eof = skip_ws();
+    }
+    if ( eof )
+    {
+	warn_unterm(WARNING, errmsg_txt, sav_lineno);
 	}
 	
-	memcpy(statbuf, safe, len);
-	statbuf[len]=0;
-	return len;
 }
 
+
+/*  Convert the given string to a number in the supplied base   */
+/*  Allow -- and ignore -- embedded periods.    */
+/*  The  endptr  param represents a pointer that will be updated
+ *      with the address of the first non-numeric character encountered,
+ *      (unless it is a NULL, in which case it is ignored).
+ */
+/*  There is no test for a completely invalid string;
+ *  the calling routine is responsible for ascertaining
+ *  the validity of the string being passed.
+ */
 static long parse_number(u8 *start, u8 **endptr, int lbase) 
 {
 	long val = 0;
-	int negative = 0, curr;
+	bool negative = FALSE ;
+	int  curr;
 	u8 *nptr=start;
 
 	curr = *nptr;
-	if (curr == '-') {
-		negative=1;
+	if (curr == '-')
+	{
+		negative = TRUE ;
 		nptr++;
 	}
 	
@@ -177,993 +963,4574 @@ static long parse_number(u8 *start, u8 **endptr, int lbase)
 		*endptr=nptr;
 
 	if (negative)
-		return -val;
+	{
+		val = -val;
+	}
 	return val;
 }
 
-static u8 *get_sequence(u8 *walk)
+/* **************************************************************************
+ *
+ *      Function name:  add_byte_to_string
+ *      Synopsis:       Add the given byte (or character) to the string
+ *                          being accumulated in statbuf, but protect
+ *                          against a buffer overflow.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             nu_byte           The given character to be added
+ *             walk              Pointer to pointer to the position
+ *                                   in  statbuf  where the character
+ *                                   is to be placed
+ *         Global Variables:
+ *             statbuf           Buffer where the string is accumulated
+ *         Macros:
+ *             GET_BUF_MAX       Size of the buffer
+ *
+ *      Outputs:
+ *         Returned Value:       NONE
+ *         Supplied Pointers:
+ *             **walk            Given character is placed here
+ *             *walk             Incremented in any case
+ *
+ *      Error Detection:
+ *          If  walk  has reached end of string buffer, do not place
+ *              the character, but continue to increment  walk .
+ *              Calling routine will detect overflow.
+ *
+ **************************************************************************** */
+				
+static void add_byte_to_string( u8 nu_byte, u8 **walk )
+{
+    if ( *walk - statbuf < GET_BUF_MAX )
+    {
+	**walk = nu_byte;
+	}
+    (*walk)++;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  c_string_escape
+ *      Synopsis:       Process C-style escape syntax in strings
+ *
+ *      Inputs:
+ *         Parameters:
+ *             walk                    Pointer to pointer to area into
+ *                                         which to put acquired values
+ *         Global Variables:
+ *             pc                      Input-source Scanning pointer
+ *
+ *      Outputs:
+ *         Returned Value:             NONE
+ *         Global Variables:
+ *             pc                      Point to last character processed.
+ *         Supplied Pointers:
+ *             *walk                   Advanced by number of bytes acquired
+ *
+ *      Error Detection:
+ *          WARNING conditions.  See under "Process Explanation" below.
+ *
+ *      Process Explanation:
+ *          Start with  PC  pointing to the first character to process
+ *              i.e., after the backslash.
+ *          We recognize newline, tab and numbers
+ *          A digit-string in the current base can be converted to a number.
+ *          The first non-numeric character ends the numeric sequence
+ *              and gets swallowed up.
+ *          If the number exceeds the size of a byte, use the truncated
+ *          	value and issue a WARNING.
+ *          If the first character in the "digit"-string was non-numeric,
+ *              use the character literally and issue a WARNING.
+ *          If the character that ended the numeric sequence is a quote,
+ *              it might be the end of the string, or the start of a
+ *              special-character or even of an "( ... ) hex-sequence,
+ *              so don't swallow it up.
+ *
+ *      Still to be done:
+ *          Better protection against PC pointer-over-run past END.
+ *              Currently, this works, but it's held together by threads:
+ *              Because  init_stream  forces a null-byte at the end of
+ *              the input buffer, parse_number() exits immediately upon
+ *              encountering it.  This situation could be covered more
+ *              robustly...
+ *
+ **************************************************************************** */
+
+static void c_string_escape( u8 **walk)
 {
-	u8 val, pval[3];
+    char c = *pc;
+    u8 val;
+    /*  We will come out of this "switch" statement
+     *      with a value for  val  and a decision
+     *      as to whether to write it.
+     */
+    bool write_val = TRUE;
 	
-	pc++; /* skip the ( */
+    switch (c)
+    {
+			case 'n':
+				/* newline */
+	    val = '\n';
+				break;
+			case 't':
+				/* tab */
+	    val = '\t';
+				break;
+			default:
+
+	    /*  Digit-string?  Convert it to a number, using the current base.
+	     *  The first non-numeric character ends the numeric sequence
+	     *      and gets swallowed up.
+	     *  If the number exceeds the size of a byte, use the truncated
+	     *      value and issue a WARNING.
+	     *  If the first character in the "digit"-string was non-numeric,
+	     *      use the character literally and issue a WARNING.
+	     */
+
+	     /*
+	     *  If the sequence ender is a quote, it might be the end of
+	     *      the string, or the start of a special-character or even
+	     *      of an "( ... ) hex-sequence, so don't swallow it up.
+	     */
+	    {
+		long lval;
+		u8 *sav_pc = pc;
+		lval=parse_number(pc, &pc, base);
+		val = (u8)lval;
 #ifdef DEBUG_SCANNER
-	printf("%s:%d: debug: hex field:", iname, lineno);
+				if (verbose)
+					printf( "%s:%d: debug: escape code "
+						"0x%x\n",iname, lineno, val);
 #endif
-	pval[1]=0; pval[2]=0;
+		if ( lval > 0x0ff )
+		{
+		    tokenization_error ( WARNING,
+			"Numeric String after \\ overflows byte.  "
+			    "Using 0x%02x.\n", val);
+			}
+
+		if ( pc == sav_pc )
+		{
+		    /*  NOTE:  Here, PC hasn't been advanced past its
+		     *      saved value, so we can count on  C  remaining
+		     *      unchanged since the start of the routine.
+		     */ 
+		    /*  Don't use the null-byte at the end of the buffer  */
+		    if ( ( pc >= end ) 
+		    /*        or a sequence-ending quote.                 */
+			 || ( c == '"' ) )
+		    {
+			write_val = FALSE;
+		    }else{
+			/*  In the WARNING message, print the character
+			 *      if it's printable or show it in hex
+			 *      if it's not.
+			 */
+			if ( (c > 0x20 ) && ( c <= 0x7e) )
+			{
+			    tokenization_error ( WARNING,
+				"Unrecognized character, %c, "
+				    "after \\ in string.  "
+					"Using it literally.\n", c);
+			}else{
+			    tokenization_error ( WARNING,
+				"Unrecognized character, 0x%02x, "
+				    "after \\ in string.  "
+					"Using it literally.\n", c);
+			}
+			val = c;
+		    }
+		}
+		/*  NOTE:  Here, however, PC may have been advanced...  */
+		/*  Don't swallow the sequence-ender if it's a quote.   */
+		if ( *pc == '"' )
+		{
+		    pc--;
+		}
 
-	for(;;) {
-		while (!isxdigit(*pc) && (*pc) != ')')
-			pc++;
+	    }   /*  End of the  "default"  clause  */
+    }    /*  End of the  "switch"  statement  */
 
-		pval[0]=*pc;
-		if (pval[0]==')')
-			break;
+    if ( write_val ) add_byte_to_string( val, walk );
 
-		pc++; /* this cannot be a \n */
+}
 
-		pval[1]=*pc;
-		if ( *pc!=')' && *pc++=='\n' )
-			lineno++;
-				
-		val=parse_number(pval, NULL, 16);
-		*(walk++)=val;
+/* **************************************************************************
+ *
+ *      Function name:  get_sequence
+ *      Synopsis:       Process the Hex-Number option in strings
+ *                      Protect against PC pointer-over-run past END.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             **walk           Pointer to pointer to area into which
+ *                                  to put acquired values
+ *         Global Variables:
+ *             pc               Input-source Scanning pointer
+ *             end              End of input-source buffer
+ *
+ *      Outputs:
+ *         Returned Value:      TRUE = "Normal Completion" (I.e., not EOF)
+ *         Global Variables:
+ *             pc               Points at terminating close-paren, or END
+ *             lineno           Input File Line-Number Counter, may be incr'd
+ *         Supplied Pointers:
+ *             *walk            Advanced by number of values acquired
+ *
+ *      Error Detection:
+ *          End-of-file encountered before end of hex-sequence:
+ *              Issue a Warning, conclude processing, return FALSE.
+ *
+ *      Process Explanation:
+ *          SETUP and RULES:
+ *              Start with  PC  pointing to the first character
+ *                  after the '('  (Open-Paren)     
+ *              Bytes are gathered from digits in pairs, except
+ *                  when separated they are treated singly.
+ *              Allow a backslash in the middle of the sequence
+ *                  to skip to the end of the line and past the
+ *                  whitespace at the start of the next line,
+ *                  i.e., it acts as a comment-escape.
+ *
+ *          INITIALIZE:
+ *              PV_indx = 0
+ *              Set return-indicator to "Abnormal Completion"
+ *              Ready_to_Parse = FALSE
+ *              Stuff NULL into PVAL[2]
+ *          WHILE PC is less than END
+ *              Pick up character at PC into Next_Ch
+ *              IF  Next_Ch  is close-paren :
+ *                  Set return-indicator to "Normal Completion".
+ *                  Done!  Break out of loop.
+ *              ENDIF
+ *              IF comment-escape behavior (controlled by means of a
+ *                      command-line switch) is allowed
+ *                  IF  Next_Ch  is backslash :
+ *                      Skip to end-of line, skip whitespace.
+ *                      If that makes PC reach END :  WARNING message.
+ *                          (Don't need to break out of loop;
+ *                               normal test will terminate.)
+ *                      CONTINUE Loop.
+ *                          (Don't increment PC; PC is already at right place).
+ *                  ENDIF
+ *              ENDIF
+ *              IF  Next_Ch  is a valid Hex-Digit character :
+ *                  Stuff it into  PVAL[PV_indx]
+ *                  IF (PV_indx is 0) :
+ *                      Increment PV_indx
+ *                  ELSE
+ *                      Set Ready_to_Parse to TRUE
+ *          	    ENDIF
+ *              ELSE
+ *                  IF  Next_Ch  is a New-Line, increment Line Number counter
+ *                  IF (PV_indx is 1) :
+ *                      Stuff NULL into PVAL[1]
+ *                      Set Ready_to_Parse to TRUE
+ *          	    ENDIF
+ *              ENDIF
+ *              IF Ready_to_Parse
+ *                  Parse PVAL
+ *                  Stuff into WALK
+ *                  Reset PV_indx to zero
+ *                  Reset Ready_to_Parse to FALSE
+ *              ENDIF
+ *              Increment PC
+ *          REPEAT
+ *          Return with Normal/Abnormal completion indicator
+ *
+ **************************************************************************** */
+
+static bool get_sequence(u8 **walk)
+{
+    int pv_indx = 0;
+    bool retval = FALSE;   /*  "Abnormal Completion" indicator  */
+    bool ready_to_parse = FALSE;
+    char next_ch;
+    char pval[3];
+
+#ifdef DEBUG_SCANNER
+	printf("%s:%d: debug: hex field:", iname, lineno);
+#endif
+    pval[2]=0;
+
+    while ( pc < end )
+    {
+	next_ch = *pc;
+	if ( next_ch == ')' )
+	{
+	    retval = TRUE;
+				break;
+	}
+	if ( hex_remark_escape )
+	{
+	    if ( next_ch == '\\' )
+	    {
+		string_remark("string hex-sequence remark");
+		continue;
+	    }
+	}
+	if ( isxdigit(next_ch) )
+	{
+	    pval[pv_indx] = next_ch;
+	    if ( pv_indx == 0 )
+	    {
+		pv_indx++;
+	    }else{
+		ready_to_parse = TRUE;
+	    }
+	}else{
+	    if ( next_ch == '\n' )  lineno++ ;
+	    if ( pv_indx != 0 )
+	    {
+		pval[1] = 0;
+		ready_to_parse = TRUE;
+	    }
+	}
+	if ( ready_to_parse )
+	{
+	    u8 val = parse_number(pval, NULL, 16);
+	    *((*walk)++)=val;
 #ifdef DEBUG_SCANNER
 		printf(" %02x",val);
 #endif
+	    pv_indx = 0;
+	    ready_to_parse = FALSE;
 	}
+	pc++;
+    }
 #ifdef DEBUG_SCANNER
 	printf("\n");
 #endif
-
-	return walk;
+    return ( retval );
 }
 
-static unsigned long get_string(void)
+/* **************************************************************************
+ *
+ *    Return the length of the string.
+ *    Pack the string, without the terminating '"' (Quote), into statbuf
+ *    Protect against PC pointer-over-run past END.
+ *    Enable Quote-Backslash as a String-Remark Escape.
+ *    Allowability of Quote-Backslash as a String-Remark is under control
+ *        of a command-line switch (string_remark_escape ).
+ *    Allowability of C-style escape characters is under control
+ *        of a command-line switch ( c_style_string_escape ).
+ *
+ *    Truncate string to size of Forth Packed-String (i.e., uses leading
+ *        count-byte, so limited to 255, number that one byte can express)
+ *        unless the string is being gathered for a Message or is being
+ *        consumed for purposes of ignoring it, in either of which case
+ *        that limit need not be enforced.  Parameter "pack_str" controls
+ *        this:  TRUE  if limit needs to be enforced.
+ *
+ *    Issue WARNING if string length gets truncated.
+ *    Issue WARNING if string crosses line.
+ *        The issuance of the Multi-line WARNING is under control of a
+ *           one-shot directive similar to OVERLOAD , called  MULTI-LINE
+ *
+ *    Still to be decided:
+ *        Do we want to bring the allowability of strings crossing
+ *            lines under control of a command-line switch?
+ *
+ ************************************************************************** */
+
+static signed long get_string( bool pack_str)
 {
 	u8 *walk;
 	unsigned long len;
-	bool run=1;
-	u8 c, val;
+	char c;
+	bool run = TRUE;
+	unsigned long start_lineno = lineno;    /*  For warning message  */
 	
+	/*
+	 *  Bump past the single whitespace character that delimits
+	 *      the command -- e.g.,  ."  or  "  or suchlike -- that
+	 *      starts the string.  Allow new-line to be a command-
+	 *      -delimiting whitespace character.  Regard any sub-
+	 *      sequent whitespace characters as part of the string
+	 */
+	if (*pc++=='\n') lineno++;
+
+	got_until_eof = TRUE ;
+
 	walk=statbuf;
 	while (run) {
-		switch ((c=*pc)) {
-		case '\\':
-			switch ((c=*(++pc))) {
-			case 'n':
-				/* newline */
-				*(walk++)='\n';
+		switch ((c=*pc))
+		{
+		    /*  Standard use of '"' (Quote)  for special-char escape  */
+		    case '\"':
+			/*  Skip the '"' (Quote) */
+				pc++;
+			/*  End of the buffer also ends the string cleanly  */
+			if ( pc >= end )
+			{
+			    run = FALSE;
+			    got_until_eof = FALSE ;
 				break;
-			case 't':
-				/* tab */
-				*(walk++)='\t';
-				break;
-			default:
-				val=parse_number(pc, &pc, base);
-#ifdef DEBUG_SCANNER
-				if (verbose)
-					printf( "%s:%d: debug: escape code "
-						"0x%x\n",iname, lineno, val);
-#endif
-				*(walk++)=val;
 			}
-			break;
-		case '\"':
-			pc++; /* skip the " */
-
-			/* printf("switching: %c\n",*pc); */
-			switch(*pc) {
-			case '(':
-				walk=get_sequence(walk);
-				break;
-			case '"':
-				*(walk++)='"';
-				pc++;
+			/*  Pick up the next char after the '"' (Quote) */
+			c=*pc;
+			switch (c)
+			{
+			    case '(':
+				pc++; /* skip the '(' */
+				run = get_sequence(&walk);
 				break;
+
 			case 'n':
-				*(walk++)='\n';
-				pc++;
+				add_byte_to_string( '\n', &walk);
 				break;
 			case 'r':
-				*(walk++)='\r';
-				pc++;
+				add_byte_to_string( '\r', &walk);
 				break;
 			case 't':
-				*(walk++)='\t';
-				pc++;
+				add_byte_to_string( '\t', &walk);
 				break;
 			case 'f':
-				*(walk++)='\f';
-				pc++;
+				add_byte_to_string( '\f', &walk);
 				break;
 			case 'l':
-				*(walk++)='\n';
-				pc++;
+				add_byte_to_string( '\n', &walk);
 				break;
 			case 'b':
-				*(walk++)=0x08;
-				pc++;
+				add_byte_to_string( 0x08, &walk);
 				break;
 			case '!':
-				*(walk++)=0x07;
-				pc++;
+				add_byte_to_string( 0x07, &walk);
 				break;
 			case '^':
-				pc++;
-				c=toupper(*(pc++));
-				*(walk++)=c-'A';
+				pc++;    /*   Skip the up-arrow (Caret) */
+				add_byte_to_string( *pc & 0x1f , &walk);
 				break;
-			case '\n':
-				lineno++;
+			    /*  We're done after any of the whitespace
+			     *     characters follows a quote.
+			     */
 			case ' ':
 			case '\t':
-				run=0;
+				/*  Advance past the terminating whitespace
+				 *       character, except newline.
+				 *  Let  get_word()  handle that.
+				 */
+				pc++;
+			    case '\n':
+				run=FALSE;
+				got_until_eof = FALSE ;
 				break;
 			default:
-				*(walk++)=*(pc++);
+				/*  Control allowability of Quote-Backslash
+				 *      as a String-Remark by means of a
+				 *      command-line switch.
+				 */
+				if ( string_remark_escape )
+				{
+				    if ( c == '\\' )
+				    {
+					string_remark("string-escape remark");
+					/* The first non-blank in the new line
+					 *     has not been processed yet.
+					 *     Back up to allow it to be.
+					 */
+					pc--;
 				break;
 			}
+				}
+				add_byte_to_string( c, &walk);
+			}
 			break;
+		    case '\n':
+			/*  Allow strings to cross lines.  Include the
+			 *      newline in the string.  Account for it.
+			 */
+			lineno++;
 		default:
-			*(walk++)=c;
+			/*  Control allowability of C-style escape-character
+			 *      syntax by means of a command-line switch.
+			 */
+			if ( c_style_string_escape )
+			{
+			    if ( c == '\\' )
+			    {
+				pc++;
+				c_string_escape(&walk );
+				break;
+			    }
+			}
+			add_byte_to_string( c, &walk);
+		}
+		/*  Advance past the char processed, unless we're done.     */
+		if ( run ) pc++;
+		/*  Done if we hit end of file before string was concluded  */
+		if ( pc >= end )
+		{
+		    run = FALSE;
+		    if ( got_until_eof )
+		    {
+			warn_unterm( WARNING, "string", start_lineno);
+			/*  Prevent multiple messages for one error  */
+			got_until_eof = FALSE;
+		    }
 		}
-		if (*pc++=='\n') lineno++;
 	}
 	
-	*(walk++)=0;
-	
-	if (pc>=end)
-		return 0;
-	
-	len=(unsigned long)walk-(unsigned long)statbuf;
-	if (len>1023) {
-		printf("%s:%d: error: buffer overflow\n", iname, lineno);
-		ERROR;
+	warn_if_multiline( "string", start_lineno);
+
+	len = walk - statbuf;
+	if (len >= GET_BUF_MAX )
+	{
+	    tokenization_error ( TKERROR,
+		"get_string buffer overflow.  Max is %d\n.", GET_BUF_MAX-1 );
+	    len = GET_BUF_MAX-1;
 	}
 #ifdef DEBUG_SCANNER
 	if (verbose)
 		printf("%s:%d: debug: scanned string: '%s'\n", 
 					iname, lineno, statbuf);
 #endif
+	if ( pack_str && (len > STRING_LEN_MAX) )
+	{
+	    tokenization_error ( WARNING,
+		"String length being truncated to %d.\n", STRING_LEN_MAX );
+	    len = STRING_LEN_MAX;
+	}
+	statbuf[len] = 0;
+
+	return len ;
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  handle_user_message
+ *      Synopsis:       Collect a user-generated tokenization-time message;
+ *                          either print it or discard it.  Shared code
+ *                          for  user_message()  and  skip_user_message()
+ *
+ *      Inputs:
+ *         Parameters:
+ *             delim                End-of-string delimiter character.
+ *                                  If it's a double-quote ("), we will use
+ *                                      the get-string() routine, with all
+ *                                      its options, to collect the message.
+ *                                  Otherwise, we'll capture plain text from
+ *                                      the input stream.
+ *             print_it             TRUE if we should print the message 
+ *         Local Static Variables:
+ *             got_until_eof        TRUE if reached end of buffer before delim.
+ *         Global Variables:
+ *             lineno               Save, then restore.
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *         Global Variables:
+ *             statbuf              The string will be collected in here
+ *             
+ *         Printout (if  print_it  is TRUE):
+ *            The string, with new-line tacked on, will be printed from
+ *                the  tokenization_error()  routine as a MESSAGE.
+ *            The line-number will be shown as of the origin of the message
+ *
+ *      Error Detection:
+ *          Error-reports will be printed regardless of  print_it  param.
+ *          If delimiter was not found, show "Unterminated" warning message.
+ *          If delimiter was " (double-quote), the get_string() routine
+ *              already checked for a multi-line construct; if delimiter is
+ *              a new-line, then a multi-line construct is impossible.
+ *              otherwise, we will do the multi-line check here.
+ *
+ **************************************************************************** */
+
+static void handle_user_message( char delim, bool print_it )
+{
+    signed long wlen;
+    unsigned int start_lineno = lineno;
+    unsigned int multiline_start = lineno;    /*  For warning message  */
+    bool check_multiline = FALSE;
+    const char *ug_msg = "user-generated message";
+
+    if ( delim == '"' )
+    {
+	wlen = get_string( FALSE);
+    }else{
+	/*
+	 *  When the message-delimiter is a new-line, and the
+	 *      command-delimiter was a new-line, it means the
+	 *      string length is zero; we won't bump the PC.
+	 *  Otherwise, we will honor the convention we extend
+	 *      to  .(  whereby, if the command is delimited
+	 *      by a new-line, we allow the string to begin
+	 *      on the next line.
+	 */
+	if ( delim == '\n' )
+	{
+	    if ( *pc != '\n') pc++;
+	}else{
+		if (*pc++=='\n') lineno++;
+	    multiline_start = lineno;
+	    check_multiline = TRUE;
+	}
+	wlen = get_until( delim );
+    }
+
+    if ( print_it )
+    {
+	unsigned int tmp_lineno = lineno;
+	lineno = start_lineno;
+	/*  Don't add a new-line to body of the message.
+	 *  Routine already takes care of that.
+	 *  Besides, buffer might be full...
+	 */
+	tokenization_error( MESSAGE, statbuf);
+	lineno = tmp_lineno;
+    }
+
+    if ( got_until_eof )   /*  Crude but effective retrofit... */
+    {
+	warn_unterm(WARNING, (char *)ug_msg, start_lineno);
+    }else{
+	if ( check_multiline )
+	{
+	    warn_if_multiline( (char *)ug_msg, multiline_start);
+	}
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  user_message
+ *      Synopsis:       Collect a user-generated message and
+ *                          print it at tokenization-time.
+ *
+ *      Tokenizer directive (either mode):
+ *          Synonyms                              String Delimiter
+ *             [MESSAGE]  #MESSAGE  [#MESSAGE]        end-of-line
+ *             #MESSAGE"                                  "  
+ *      "Tokenizer-Escape" mode directive         String Delimiter
+ *          .(                                            )
+ *          ."                                            "
+ *
+ *      Inputs:
+ *         Parameter is the "parameter field" of the TIC entry, which
+ *             was initialized to the end-of-string delimiter character.
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *         Printout:                User-message, parsed from input.
+ *
+ *      Extraneous Remarks:
+ *          We would have preferred to simply use the "character value"
+ *              aspect of the union, but we found portability issues
+ *              between big- and little- -endian processors, so we still
+ *              have to recast its type here.
+ *
+ **************************************************************************** */
+
+void user_message( tic_param_t pfield )
+{
+    char delim = (char)pfield.deflt_elem ;
+    handle_user_message( delim, TRUE);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  skip_user_message
+ *      Synopsis:       Collect a user-generated message and discard it.
+ *                          Used when ignoring a Conditional section.
+ *
+ *      Tokenizer directive (either mode):
+ *          Synonyms                              String Delimiter
+ *             [MESSAGE]  #MESSAGE  [#MESSAGE]        end-of-line
+ *             #MESSAGE"                                  "  
+ *      "Tokenizer-Escape" mode directive         String Delimiter
+ *          .(                                            )
+ *          ."                                            "
+ *
+ *      Inputs:
+ *         Parameters:
+ *             pfield               "Parameter field" of the TIC entry, which
+ *                                      was initialized to the delimiter.
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *         Printout:                NONE
+ *
+ **************************************************************************** */
 
-	return len>255?255:len;
+void skip_user_message( tic_param_t pfield )
+{
+    char delim = (char)pfield.deflt_elem ;
+    handle_user_message( delim, FALSE);
 }
 
-static int get_number(long *result)
+
+
+/* **************************************************************************
+ *
+ *      Function name:  get_number
+ *      Synopsis:       If the word retrieved from the input stream is a
+ *                      valid number (under the current base) convert it.
+ *                      Return an indication if it was not.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             *result             Pointer to place to return the number
+ *         Global Variables:
+ *             statbuf             The word just read that is to be converted.
+ *             base                The current numeric-interpretation base.
+ *
+ *      Outputs:
+ *         Returned Value:         TRUE = Input was a valid number
+ *         Supplied Pointers:
+ *             *result             The converted number, if valid
+ *                                     otherwise undefined
+ *
+ *      Revision History:
+ *          Updated Mon, 28 Mar 2005 by David L. Paktor
+ *              Always use the current base.
+ *              Reversed sense of return-flag.
+ *
+ **************************************************************************** */
+
+bool get_number( long *result)
 {
-	u8 lbase, *until;
-	long val;
+    u8 *until;
+    long val;
+    bool retval = FALSE ;
 
-	lbase=intok?0x10:base;
-	val=parse_number(statbuf,&until, lbase);
+    val = parse_number(statbuf, &until, base);
 	
 #ifdef DEBUG_SCANNER
-	printf("%s:%d: debug: parsing number: base 0x%x, val 0x%lx, "
-			"processed %ld of %ld bytes\n", iname, lineno, 
-			lbase, val,(size_t)(until-statbuf), strlen((char *)statbuf));
+    printf("%s:%d: debug: parsing number: base 0x%x, val 0x%lx, "
+		"processed %ld of %ld bytes\n", iname, lineno, 
+		 base, val,(size_t)(until-statbuf), strlen((char *)statbuf));
 #endif
 
-	if (until==(statbuf+strlen((char *)statbuf))) {
-		*result=val;
-		return 0;
-	}
-		
-	return -1;
+    /*  If number-parsing ended before the end of the input word,
+     *      then the input word was not a valid number.
+     */
+    if (until==(statbuf+strlen((char *)statbuf)))
+    {
+	*result=val;
+	retval = TRUE;
+    }
+
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  deliver_number
+ *      Synopsis:       Deliver the supplied number according to the
+ *                              state of the tokenizer:
+ *                          In normal tokenization mode, emit it as an
+ *                              FCode literal.
+ *                          In  "Tokenizer-Escape" mode, push it onto
+ *                              the Data Stack.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             numval                  The number, verified to be valid.
+ *         Global Variables:
+ *             in_tokz_esc   TRUE if tokenizer is in "Tokenizer Escape" mode.
+ *
+ *      Outputs:
+ *         Returned Value:             NONE 
+ *         Items Pushed onto Data-Stack:
+ *             Top:                    The number, if  in_tokz_esc  was TRUE
+ *         FCode Output buffer:
+ *             If  in_tokz_esc  was FALSE, a  b(lit)  token will be written,
+ *                 followed by the number.
+ *
+ **************************************************************************** */
+
+static void deliver_number( long numval)
+{
+    if ( in_tokz_esc )
+    {
+        dpush( numval );
+    } else {
+        emit_literal(numval);
+    }
+}
+/* **************************************************************************
+ *
+ *      Function name:  handle_number
+ *      Synopsis:       Convert the word just retrieved from the input stream
+ *                              to a number.
+ *                      Indicate whether the string was a valid number and
+ *                              deliver it, as appropriate.
+ *
+ *      Inputs:
+ *         Parameters:                 NONE
+ *         Global Variables:
+ *             statbuf       The word that was just read, and to be converted.
+ *
+ *      Outputs:
+ *         Returned Value:    TRUE = Input string was a valid number
+ *         If input string was a valid number, the converted number will
+ *             be delivered, as appropriate, by  deliver_number(). 
+ *
+ **************************************************************************** */
+
+static bool handle_number( void )
+{
+    bool retval ;
+    long numval;
+
+    retval = get_number( &numval );
+    if ( retval )
+    {
+        deliver_number( numval );
+    }
+
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  ascii_right_number
+ *      Synopsis:       Convert a character sequence to a number, justified
+ *                          toward the right (i.e., the low-order bytes) and
+ *                          deliver it, as appropriate.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             in_str                  The input string
+ *
+ *      Outputs:
+ *         Returned Value:             NONE
+ *         The converted number will be delivered by  deliver_number(). 
+ *
+ *      Process Explanation:
+ *          The last four characters in the sequence will become the number.
+ *          If there are fewer than four, they will fill the low-order part
+ *              of the number.
+ *          Example:  PCIR            is converted to  h# 50434952
+ *                    CPU             is converted to  h# 00435055
+ *             and
+ *          	      LotsOfStuff     is equivalent to  a# tuff 
+ *                                    and is converted to  h# 74756666
+ *
+ **************************************************************************** */
+
+static void ascii_right_number( char *in_str)
+{
+    u8 nxt_ch;
+    char *str_ptr = in_str;
+    long numval = 0;
+
+    for ( nxt_ch = (u8)*str_ptr ;
+	    ( nxt_ch = (u8)*str_ptr ) != 0 ;
+        	str_ptr++ )
+    {
+        numval = ( numval << 8 ) + nxt_ch ;
+    }
+    deliver_number( numval );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  ascii_left_number
+ *      Synopsis:       Similar to  ascii_right_number()  except justified
+ *                          toward the left (i.e., the high-order bytes).
+ *                      
+ *
+ *      Inputs:
+ *         Parameters:
+ *             in_str                  The input string
+ *
+ *      Outputs:
+ *         Returned Value:            NONE
+ *         The converted number will be delivered by  deliver_number().
+ *
+ *      Process Explanation:
+ *          If there are fewer than four characters in the sequence, they
+ *              will fill the high-order part of the number.
+ *                    CPU             is converted to  h# 43505500
+ *          In all other respects, similar to  ascii_right_number()
+ *
+ **************************************************************************** */
+
+static void ascii_left_number( char *in_str)
+{
+    u8 nxt_ch;
+    char *str_ptr = in_str;
+    long numval = 0;
+    int shift_amt = 24;
+    bool shift_over = FALSE ;
+
+    for ( nxt_ch = (u8)*str_ptr ;
+	    ( nxt_ch = (u8)*str_ptr ) != 0 ;
+        	str_ptr++ )
+    {
+        if ( shift_over )  numval <<= 8;
+	if ( shift_amt == 0 )  shift_over = TRUE ;
+	numval += ( nxt_ch << shift_amt );
+	if ( shift_amt > 0 ) shift_amt -= 8;
+    }
+    deliver_number( numval );
+
 }
 
+/* **************************************************************************
+ *
+ *      Function name:  init_scanner
+ *      Synopsis:       Allocate memory the Scanner will need.
+ *                          Only need to call once per program run.
+ *
+ **************************************************************************** */
+
 void init_scanner(void)
 {
-	statbuf=malloc(1024);
-	if (!statbuf) {
-		printf ("no memory.\n");
-		exit(-1);
-	}
+	statbuf=safe_malloc(GET_BUF_MAX, "initting scanner");
 }
 
+/* **************************************************************************
+ *
+ *      Function name:  exit_scanner
+ *      Synopsis:       Free up memory the Scanner used
+ *
+ **************************************************************************** */
+
 void exit_scanner(void)
 {
 	free(statbuf);
 }
 
-#define FLAG_EXTERNAL 0x01
-#define FLAG_HEADERS  0x02
-char *name, *alias;
-int flags=0;
+/* **************************************************************************
+ *
+ *      Function name:  set_hdr_flag
+ *      Synopsis:       Set the state of the "headered-ness" flag to the
+ *                          value given, unless over-ridden by one or both
+ *                          of the "always-..." Command-Line Flags
+ *
+ *      Inputs:
+ *         Parameters:
+ *             new_flag                  New setting
+ *         Global Variables:
+ *             always_headers            Override HEADERLESS and make HEADERS
+ *             always_external           Override HEADERLESS and HEADERS;
+ *                                           make EXTERNAL
+ *
+ *      Outputs:
+ *         Returned Value:               None
+ *         Local Static Variables:
+ *             hdr_flag                  Adjusted to new setting
+ *
+ *      Process Explanation:
+ *          If  always_headers  is TRUE, and  new_flag  is not FLAG_EXTERNAL
+ *              then set to FLAG_HEADERS
+ *          If  always_external  is TRUE, set to FLAG_EXTERNAL, regardless.
+ *              (Note:  always_external  over-rides  always_headers).
+ *          Otherwise, set to  new_flag
+ *
+ **************************************************************************** */
+
+static void set_hdr_flag( headeredness new_flag)
+{
+    headeredness new_state = new_flag;
+    switch ( new_flag)
+    {
+	case FLAG_HEADERLESS:
+	    {
+		if ( always_headers )
+		{   new_state = FLAG_HEADERS;
+		}
+	    /*  No  break.  Intentional...   */
+	    }
+	case FLAG_HEADERS:
+	    {
+		if ( always_external )
+		{   new_state = FLAG_EXTERNAL;
+		}
+	    /*  No  break.  Intentional...   */
+	    }
+	case FLAG_EXTERNAL:
+	    break;  /*  Satisfy compiler's error-checking...   */
+	/*  No default needed here...   */
+    }
+
+    hdr_flag = new_state;
+
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  init_scan_state
+ *      Synopsis:       Initialize various state variables for each time
+ *                          a new tokenization scan is started.
+ *
+ *      Inputs:
+ *         Parameters:             NONE
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Global Variables:   Initialized to:
+ *             base                            0x0a (I.e., base = "decimal")
+ *             nextfcode                       By  reset_fcode_ranges()
+ *             pci_is_last_image               TRUE
+ *             incolon                         FALSE
+ *         Local Static Variables:
+ *             hdr_flag                  FLAG_HEADERLESS (unless over-ridden)
+ *             is_instance                     FALSE
+ *             last_colon_filename             NULL
+ *             instance_filename               NULL
+ *             dev_change_instance_warning     TRUE
+ *             instance_definer_gap            FALSE
+ *             need_to_pop_source              FALSE
+ *             first_fc_starter                TRUE
+ *             ret_stk_depth                   0
+ *         Memory Freed
+ *             Copies of input-file name in  last_colon_filename  and
+ *                 instance_filename , if allocated.
+ *
+ **************************************************************************** */
 
-static int create_word(void)
+void init_scan_state( void)
 {
-	unsigned long wlen;
+    base = 0x0a;
+    pci_is_last_image = TRUE;
+    incolon = FALSE;
+    is_instance = FALSE;
+    set_hdr_flag( FLAG_HEADERLESS);
+    reset_fcode_ranges();
+    first_fc_starter = TRUE;
+    if ( last_colon_filename != NULL ) free( last_colon_filename);
+    if ( instance_filename != NULL ) free( instance_filename);
+    last_colon_filename = NULL;
+    instance_filename = NULL;
+    dev_change_instance_warning = TRUE;
+    instance_definer_gap = FALSE;
+    need_to_pop_source = FALSE;
+    ret_stk_depth = 0;
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  collect_input_filename
+ *      Synopsis:       Save a copy of the current input file name in the
+ *                          given variable, for error-reporting purposes
+ *
+ *      Inputs:
+ *         Parameters:
+ *             saved_nam                    Pointer to pointer for copy of name
+ *         Global Variables:
+ *             iname                        Current input file name
+ *         Local Static Variables:
+ *
+ *      Outputs:
+ *         Returned Value:                  NONE
+ *         Supplied Pointers:
+ *             *saved_nam                   Copy of name
+ *         Memory Allocated
+ *             For copy of input file name
+ *         When Freed?
+ *             Subsequent call to this routine with same pointer
+ *             (Last copy made will be freed if starting a new tokenization,
+ *                 otherwise, will persist until end of program.) 
+ *         Memory Freed
+ *             Previous copy in same pointer.
+ *
+ *      Process Explanation:
+ *          If there is a previous copy, and it still matches the current
+ *              input-file name, we don't need to free or re-allocate.
+ *
+ **************************************************************************** */
 
-	if (incolon) {
-		printf("%s:%d: error: creating words not allowed "
-			"in colon definition.\n", iname, lineno);
-		ERROR;
+static void collect_input_filename( char **saved_nam)
+{
+    bool update_lcfn = TRUE;    /*  Need to re-allocate?  */
+    if ( *saved_nam != NULL )
+    {
+	if ( strcmp( *saved_nam, iname) == 0 )
+	{
+	    /*  Last collected filename unchanged from iname  */
+	    update_lcfn = FALSE;
+	}else{
+	    free( *saved_nam);
 	}
-	
-	if(nextfcode > 0xfff) {
-		printf("%s:%d: error: maximum number of fcode words "
-			"reached.\n", iname, lineno);
-		ERROR;
+    }
+    if ( update_lcfn )
+    {
+	*saved_nam = strdup(iname);
+    }
+} 
+
+/* **************************************************************************
+ *
+ *      Function name:  test_in_colon
+ *      Synopsis:       Error-check whether a word is being used in the
+ *                      correct state, relative to being inside a colon
+ *                      definition; issue a message if it's not.
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             wname            The name of the word in question
+ *             sb_in_colon      TRUE if the name should be used inside
+ *                                  a colon-definition only; FALSE if
+ *                                  it may only be used outside of a
+ *                                  colon-definition.
+ *             severity         Type of error/warning message to call.
+ *                                  usually either WARNING or TKERROR
+ *             use_instead      Word the error-message should suggest be
+ *                                  used "instead".  This may be a NULL,
+ *                                  in which case the "suggestion" part
+ *                                  of the message will simply be omitted.
+ *         Global Variables:
+ *             incolon          State of the tokenization; TRUE if inside
+ *                                  a colon definition
+ *
+ *      Outputs:
+ *         Returned Value:     TRUE if no error.
+ *         Printout:           Error messages as indicated.
+ *
+ *      Error Detection:
+ *          If the state, relative to being inside a colon-definition,
+ *              is not what the parameter says it should be, issue a
+ *              message of the indicated severity, and return FALSE.
+ *
+ **************************************************************************** */
+
+static bool test_in_colon ( char *wname,
+                           bool sb_in_colon,    /*  "Should Be IN colon"  */
+			        int severity,
+				     char *use_instead)
+{
+    bool is_wrong;
+    bool retval = TRUE ;
+
+    is_wrong = BOOLVAL(( sb_in_colon != FALSE ) != ( incolon != FALSE )) ;
+    if ( is_wrong )
+    {  
+        char *ui_pt1 = "";
+        char *ui_pt2 = "";
+        char *ui_pt3 = "";
+	retval = FALSE;
+	if ( use_instead != NULL )
+	{
+	    ui_pt1 = "  Use  ";
+	    ui_pt2 = use_instead;
+	    ui_pt3 = "  instead.";
 	}
-	
-	wlen=get_word();
-	name=strdup((char *)statbuf);
+	tokenization_error ( severity, "The word  %s  should not be used "
+	    "%sside of a colon definition.%s%s%s\n", strupr(wname),
+	        sb_in_colon ? "out" : "in", ui_pt1, ui_pt2, ui_pt3 );
+    }
+    return ( retval );
+}
 
-#ifdef DEBUG_SCANNER
-	printf("%s:%d: debug: defined new word %s, fcode no 0x%x\n",
-			iname, lineno, name, nextfcode);
-#endif
-	add_token(nextfcode, name);
-	if (flags) {
-		if (flags&FLAG_EXTERNAL)
-			emit_token("external-token");
-		else
-			emit_token("named-token");
-		emit_string((u8 *)name, wlen);
-	} else
-		emit_token("new-token");
-	
-	emit_fcode(nextfcode);
-	nextfcode++;
+/* **************************************************************************
+ *
+ *      Function name:  must_be_deep_in_do
+ *      Synopsis:       Check that the statement in question is called 
+ *                          from inside the given depth of structures
+ *                          of the  DO ... LOOP -type (i.e., any combination
+ *                          of DO  or ?DO  and  LOOP  or  +LOOP ).
+ *                      Show an error if it is not.
+ *
+ **************************************************************************** */
+
+static void must_be_deep_in_do( int how_deep )
+{
+    int functional_depth = do_loop_depth;
+    if ( incolon )
+    {
+        functional_depth -= last_colon_do_depth;
+    }
+    if ( functional_depth < how_deep )
+    {
+	char deep_do[64] = "";
+	int indx;
+	bool prefix = FALSE;
+
+	for ( indx = 0; indx < how_deep ; indx ++ )
+	{
+	    strcat( deep_do, "DO ... ");
+	}
+	for ( indx = 0; indx < how_deep ; indx ++ )
+	{
+	    if ( prefix )
+	    {
+		strcat( deep_do, " ... ");
+	    }
+	    strcat( deep_do, "LOOP");
+	    prefix = TRUE;
+	}
+
+	tokenization_error( TKERROR,
+	    "%s outside of  %s  structure", strupr(statbuf), deep_do);
+	in_last_colon();
+    }
+
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  bump_ret_stk_depth
+ *      Synopsis:       Increment or decrement the Return-Stack-Usage-Depth
+ *                          counter.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             bump              Amount by which to increment;
+ *                                   negative number to decrement.
+ *         Local Static Variables:
+ *             ret_stk_depth     The Return-Stack-Usage-Depth counter
+ *
+ *      Outputs:
+ *         Returned Value:        NONE
+ *         Local Static Variables:
+ *             ret_stk_depth     Incremented or decremented
+ *
+ *      Process Explanation:
+ *          This simple-seeming function is actually a place-holder
+ *             for future expansion.  Proper error-detection of
+ *             Return-Stack usage is considerably more complex than
+ *             what we are implementing here, and is deferred for a
+ *             later revision.
+ *
+ *      Still to be done:
+ *          Full detection of whether the Return-Stack has been cleared
+ *              when required, including analysis of Return-Stack usage
+ *              within Flow-Control constructs, and before Loop elements...
+ *
+ *      Extraneous Remarks:
+ *          Some FORTHs use a Loop-Control stack separate from the Return-
+ *              -Stack, but others use the Return-Stack to keep LOOP-control
+ *              elements.  An FCode program must be portable between different
+ *              environments, and so must adhere to the restrictions listed
+ *              in the ANSI Spec:
+ *
+ *       3.2.3.3   Return stack  
+ *        . . . . . .
+ *       A program may use the return stack for temporary storage during the
+ *          execution of a definition subject to the following restrictions:
+ *       	A program shall not access values on the return stack (using R@,
+ *       	    R>, 2R@ or 2R>) that it did not place there using >R or 2>R;
+ *       	A program shall not access from within a do-loop values placed
+ *       	    on the return stack before the loop was entered;
+ *       	All values placed on the return stack within a do-loop shall
+ *       	    be removed before I, J, LOOP, +LOOP, UNLOOP, or LEAVE is
+ *       	    executed;
+ *       	All values placed on the return stack within a definition
+ *       	    shall be removed before the definition is terminated
+ *       	    or before EXIT is executed.
+ *
+ **************************************************************************** */
+
+static void bump_ret_stk_depth( int bump)
+{
+    ret_stk_depth += bump;
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  ret_stk_balance_rpt
+ *      Synopsis:       Display a Message if usage of the Return-Stack
+ *                          appears to be out of balance.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             before_what         Phrase to use in Message;
+ *                                     if NULL, use statbuf...
+ *             clear_it            TRUE if this call should also clear the
+ *                                     Return-Stack-Usage-Depth counter
+ *         Global Variables:
+ *             statbuf             Word currently being processed
+ *         Local Static Variables:
+ *             ret_stk_depth       The Return-Stack-Usage-Depth counter
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Local Static Variables:
+ *             ret_stk_depth       May be cleared
+ *
+ *      Error Detection:
+ *          Based simply on whether the Return-Stack-Usage-Depth counter
+ *              is zero.  This is a weak and uncertain implementation;
+ *              therefore, the Message will be a WARNING phrased with
+ *              some equivocation.
+ *
+ *      Process Explanation:
+ *          Proper detection of Return-Stack usage errors is considerably
+ *              more complex, and is deferred for a future revision.
+ *
+ *      Still to be done:
+ *          Correct analysis of Return-Stack usage around Flow-Control
+ *              constructs.  Consider, for instance, the following:
+ * 
+ *          blablabla >R  yadayada IF  R> gubble ELSE flubble R>  THEN
+ * 
+ *              It is, in fact, correct, but the present scheme would
+ *              tag it as a possible error.  Conversely, something like:
+ * 
+ *          blablabla >R  yadayada IF  R> gubble THEN
+ * 
+ *              would not get tagged, even though it is actually an error.
+ * 
+ *          The current simple scheme also does not cover Return-Stack
+ *              usage within Do-Loops or before Loop elements like I and
+ *              J or UNLOOP or LEAVE.  Implementing something like that
+ *              would probably need to be integrated in with Flow-Control
+ *              constructs, and will be noted in  flowcontrol.c
+ *
+ **************************************************************************** */
+
+static void ret_stk_balance_rpt( char *before_what, bool clear_it)
+{
+    if ( ret_stk_depth != 0 )
+    {
+	char *what_flow = ret_stk_depth < 0 ? "deficit" : "excess" ;
+	char *what_phr =  before_what != NULL ? before_what : strupr(statbuf);
+
+	tokenization_error( WARNING,
+	    "Possible Return-Stack %s before %s", what_flow, what_phr);
+	in_last_colon();
 
-	return 0;
+	if ( clear_it )
+	{
+	    ret_stk_depth = 0;
+	}
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  ret_stk_access_rpt
+ *      Synopsis:       Display a Message if an attempt to access a value
+ *                          on the Return-Stack appears to occur before
+ *                          one was placed there.
+ *
+ *      Inputs:
+ *         Parameters:                NONE
+ *         Global Variables:
+ *             statbuf                Word currently being processed
+ *         Local Static Variables:
+ *             ret_stk_depth          The Return-Stack-Usage-Depth counter
+ *
+ *      Outputs:
+ *         Returned Value:             NONE
+ *
+ *      Error Detection:
+ *          Equivocal WARNING, based simply on whether the Return-Stack-
+ *              -Usage-Depth counter not positive.
+ *
+ *      Process Explanation:
+ *          Proper detection is deferred...
+ *
+ *      Still to be done:
+ *          Correct analysis of Return-Stack usage...
+ *
+ **************************************************************************** */
+
+static void ret_stk_access_rpt( void)
+{
+    if ( ret_stk_depth <= 0 )
+    {
+	tokenization_error( WARNING,
+	    "Possible Return-Stack access attempt by %s "
+		"without value having been placed there",
+		strupr(statbuf) );
+	in_last_colon();
+    }
 }
 
+
+
+/* **************************************************************************
+ *
+ *      Function name:  encode_file
+ *      Synopsis:       Input a (presumably binary) file and encode it
+ *                      as a series of strings which will be accumulated
+ *                      and encoded in a manner appropriate for a property.
+ *
+ *      Associated Tokenizer directive:        encode-file        
+ *
+ *      Error Detection:
+ *          Handled by support routines.
+ *
+ **************************************************************************** */
+
 static void encode_file( const char *filename )
 {
 	FILE *f;
 	size_t s;
-	int i=0;
+	int num_encoded=0;
 	
-	if( !(f=fopen(filename,"rb")) ) {
-		printf("%s:%d: opening '%s':\n", iname, lineno, filename );
-		ERROR;
-		return;
-	}
-	while( (s=fread(statbuf, 1, 255, f)) ) {
-		emit_token("b(\")");
-		emit_string(statbuf, s);
-		emit_token("encode-bytes");
-		if( i++ )
-			emit_token("encode+");
+	tokenization_error( INFO, "ENCODing File %s\n", filename );
+
+	f = open_expanded_file( filename, "rb", "encoding");
+	if( f != NULL )
+	{
+	    while( (s=fread(statbuf, 1, STRING_LEN_MAX, f)) )
+	    {
+		    emit_token("b(\")");
+		    emit_string(statbuf, s);
+		    emit_token("encode-bytes");
+		    if( num_encoded )
+			    emit_token("encode+");
+		    num_encoded += s;
+	    }
+	    fclose( f );
+	    tokenization_error ( INFO, "ENCODed %d bytes.\n", num_encoded);
 	}
-	fclose( f );
 }
 
+/* **************************************************************************
+ *
+ *      Function name:  check_name_length
+ *      Synopsis:       If the length of a user-defined name exceeds the
+ *                          ANSI-specified maximum of 31 characters, issue
+ *                          a message.  This is a hard-coded limit.
+ *                      Although our Tokenizer can handle longer names,
+ *                          they will cause big problems when encountered
+ *                          by an FCode interpreter.
+ *                      If the name is going to be included in the binary
+ *                          output, the message severity must be an ERROR.
+ *                      Otherwise, if the name is HEADERLESS, the severity
+ *                          can be reduced to a Warning; if the name is only
+ *                          defined in "Tokenizer Escape" mode the message
+ *                          severity can be further reduced to an Advisory.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             wlen                 Length of the newly-created word
+ *         Global Variables: 
+ *             in_tokz_esc          TRUE if in "Tokenizer Escape" mode.
+ *         Local Static Variables:
+ *             hdr_flag             State of headered-ness for name-creation
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *         Global Variables:        
+ *         Printout:                ERROR message if applicable.
+ *
+ *      Error Detection:
+ *             The whole point of this routine.  
+ *
+ *      Revision History:
+ *          Updated Wed, 20 Jul 2005 by David L. Paktor
+ *               Escalated from merely an informative warning to a TKERROR 
+ *          Updated Fri, 21 Oct 2005 by David L. Paktor
+ *               Adjust severity if name doesn't go into the FCode anyway...
+ *
+ **************************************************************************** */
 
-static void handle_internal(u16 tok)
+void check_name_length( signed long wlen )
 {
-	unsigned long wlen;
-	long offs1,offs2;
-	u16 itok;
-	
-#ifdef DEBUG_SCANNER
-	printf("%s:%d: debug: tokenizing control word '%s'\n",
-						iname, lineno, statbuf);
-#endif
-	switch (tok) {
-	case BEGIN:
-		emit_token("b(<mark)");
-		dpush((unsigned long)opc);
-		break;
+    if ( wlen > 31 )
+    {
+	int severity = TKERROR;
+	if ( in_tokz_esc )
+	{   severity = INFO;
+	}else{
+	    if (hdr_flag == FLAG_HEADERLESS)
+	    {   severity = WARNING;
+	    }
+	}
+	tokenization_error( severity,
+	    "ANSI Forth does not permit definition of names "
+		"longer than 31 characters.\n" );
+    }
 
-	case BUFFER:
-		create_word();
-		emit_token("b(buffer:)");
-		break;
+}
 
-	case CONST:
-		create_word();
+
+/* **************************************************************************
+ *
+ *      Function name:  definer_name
+ *      Synopsis:       Given a defining-word internal token, return
+ *                      a printable string for the definer, for use
+ *                      in an error-message.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             definer             Internal token for the defining-word
+ *             reslt_ptr           Pointer to string-pointer that takes
+ *                                     the result, if successful
+ *
+ *      Outputs:
+ *         Returned Value:         TRUE if definer was recognized
+ *         Supplied Pointers:
+ *             *reslt_ptr          If successful, points to printable string;
+ *                                     otherwise, left unchanged.
+ *
+ *
+ **************************************************************************** */
+
+static bool definer_name(fwtoken definer, char **reslt_ptr)
+{
+    bool retval = TRUE;
+    switch (definer)
+    {
+	case VARIABLE:
+	    *reslt_ptr = "VARIABLE";
+	    break;
+	case DEFER:
+	    *reslt_ptr = "DEFER";
+	    break;
+	case VALUE:
+	    *reslt_ptr = "VALUE";
+	    break;
+	case BUFFER:
+	    *reslt_ptr = "BUFFER";
+	    break;
+	case CONST:
+	    *reslt_ptr = "CONSTANT";
+	    break;
+	case COLON:
+	    *reslt_ptr = "COLON";
+	    break;
+	case CREATE:
+	    *reslt_ptr = "CREATE";
+	    break;
+	case FIELD:
+	    *reslt_ptr = "FIELD";
+	    break;
+	case MACRO_DEF:
+	    *reslt_ptr = "MACRO";
+	    break;
+	case ALIAS:
+	    *reslt_ptr = "ALIAS";
+	    break;
+	case LOCAL_VAL:
+	    *reslt_ptr = "Local Value name";
+	    break;
+	default:
+	    retval = FALSE;
+    }
+
+    return ( retval);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  as_a_what
+ *      Synopsis:       Add the phrase "as a[n] <DEF'N_TYPE>" for the given
+ *                          definition-type to the given string buffer.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             definer                 Internal token for the defining-word
+ *             as_what                 The string buffer to which to add.
+ *
+ *      Outputs:
+ *         Returned Value:             TRUE if an assigned name was found
+ *                                         for the given definer and text
+ *                                         was added to the buffer.
+ *         Supplied Pointers:
+ *             *as_what                Text is added to this buffer.
+ *
+ *      Process Explanation:
+ *          The calling routine is responsible to make sure the size of
+ *              the buffer is adequate.  Allow 25 for this routine.
+ *          The added text will not have spaces before or after; if any
+ *              are needed, they, too, are the responsibility of the
+ *              calling routine.  The return value gives a helpful clue.
+ *
+ **************************************************************************** */
+
+bool as_a_what( fwtoken definer, char *as_what)
+{
+    char *defn_type_name;
+    bool retval = definer_name(definer, &defn_type_name);
+    if ( retval )
+    {
+	strcat( as_what, "as a");
+	/*  Handle article preceding definer name
+	 *      that starts with a vowel.
+	 */
+	/*  HACK:  Only one definer name -- ALIAS --
+	 *      begins with a vowel.  Take advantage
+	 *      of that...
+	 *  Otherwise, we'd need to do something involving
+	 *      strchr( "AEIOU", defn_type_name[0] )
+	 */
+	if ( definer == ALIAS ) strcat( as_what, "n" );
+
+	strcat( as_what, " ");
+	strcat( as_what, defn_type_name);
+    }
+    return( retval);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  lookup_word
+ *      Synopsis:       Find the TIC-entry for the given word in the Current
+ *                          mode -- relative to "Tokenizer-Escape" -- and
+ *                          Scope into which definitions are being entered.
+ *                      Optionally, prepare text for various Message types.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             stat_name               Word to look up
+ *             where_pt1               Pointer to result-display string, part 1
+ *                                         NULL if not preparing text
+ *             where_pt2               Pointer to result-display string, part 2
+ *                                         NULL if not preparing text
+ *         Global Variables:
+ *             in_tokz_esc             TRUE if in "Tokenizer Escape" mode.
+ *             scope_is_global         TRUE if "global" scope is in effect
+ *             current_device_node     Current dev-node data-struct
+ *             ibm_locals              TRUE if IBM-style Locals are enabled
+ *
+ *      Outputs:
+ *         Returned Value:             Pointer to TIC-entry; NULL if not found
+ *         Supplied Pointers:
+ *             *where_pt1              Result display string, part 1 of 2
+ *             *where_pt2              Result display string, part 2 of 2
+ *
+ *      Process Explanation:
+ *          We will set the two-part result-display string in this routine
+ *              because only here do we know in which vocabulary the word
+ *              was found.
+ *          Pre-load the two parts of the result-display string.
+ *          If we are in "Tokenizer Escape" mode, look up the word:  first,
+ *              in the "Tokenizer Escape" Vocabulary, or, if not found,
+ *              among the "Shared" words.
+ *          Otherwise, we're in Normal" mode.  Look it up:  first, among the
+ *              Locals, if IBM-style Locals are enabled (it can possibly be
+ *              one if "Tokenizer Escape" mode was entered during a colon-
+ *              -definition); then, if it was not found and if "Device"
+ *              scope is in effect, look in the current device-node; then,
+ *              if not found, in the "core" vocabulary.
+ *          Load the second part of the result-display string with the
+ *               appropriate phrase for whereever it was found.
+ *          Then adjust the first part of the result-display string with
+ *               the definer, if known.
+ *
+ *          The two strings will be formatted to be printed adjacently,
+ *              without any additional spaces in the printf() format.
+ *          The first part of the result-display string will not start with
+ *              a space, but will have an intermediate space if necessary.
+ *          The second part of the result-display string will not start
+ *              with a space, and will contain the terminating new-line
+ *              if appropriate.  It might or might not have been built
+ *              with a call to  in_what_node().
+ *
+ *          If the calling routine displays the result-display strings,
+ *              it should follow-up with a call to  show_node_start()
+ *              This will be harmless if  in_what_node()  was not used
+ *              in the construction of the result-display string.
+ *          If the calling routine is NOT going to display the result strings,
+ *              it should pass NULLs for the string-pointer pointers.
+ *
+ *          The second part of the string consists of pre-coded phrases;
+ *              therefore, we can directly assign the pointer.
+ *          The first part of the string, however, has developed into
+ *              something constructed "on the fly".  Earlier, it, too,
+ *              had been a directly-assignable pointer; all the callers
+ *              to this routine expect that.  Rather than change all the
+ *              callers, we will assign a local buffer for it.
+ *
+ *      Extraneous Remarks:
+ *          We had to add the rule allowing where_pt1 or where_pt2 to be
+ *              NULL after we introduced the  in_what_node()  function.
+ *              We had cases where residue from a lookup for processing
+ *              showed up later in an unrelated Message.  The NULL rule
+ *              should prevent that.
+ *
+ **************************************************************************** */
+
+static char lookup_where_pt1_buf[32];
+
+tic_hdr_t *lookup_word( char *stat_name, char **where_pt1, char **where_pt2 )
+{
+    tic_hdr_t *found = NULL;
+    bool trail_space = TRUE;
+    bool doing_lookup = BOOLVAL( ( where_pt1 != NULL )
+			      && ( where_pt2 != NULL ) );
+    char *temp_where_pt2 = "in the core vocabulary.\n";
+
+    lookup_where_pt1_buf[0] = 0;             /*  Init'lz part-1 buffer  */
+
+    /*  "Core vocab" refers both to shared fwords and built-in tokens.  */
+
+    /*  Distinguish between "Normal" and "Tokenizer Escape" mode  */
+    if ( in_tokz_esc )
+    {   /*  "Tokenizer Escape" mode.  */
+	found = lookup_tokz_esc( stat_name);
+	if ( found != NULL )
+	{
+	    temp_where_pt2 = in_tkz_esc_mode;
+	}else{
+	    /*  "Core vocabulary".  */
+	    found = lookup_shared_word( stat_name);
+	}
+    }else{
+	/*  "Normal" tokenization mode  */
+	if ( ibm_locals )
+	{
+	    found = lookup_local( stat_name);
+	    if ( doing_lookup && ( found != NULL ) )
+	    {
+		trail_space = FALSE;
+		temp_where_pt2 = ".\n";
+	    }
+	}
+
+	if ( found == NULL )
+	{
+	    found = lookup_in_dev_node( stat_name);
+	    if ( found != NULL )
+	    {
+		if ( doing_lookup )
+		{
+		    temp_where_pt2 = in_what_node( current_device_node);
+		}
+	    }else{
+		/*  "Core vocabulary".  */
+		found = lookup_core_word( stat_name);
+	    }
+	}
+    }
+
+    if ( ( doing_lookup ) && ( found != NULL ) )
+    {
+	if ( as_a_what( found->fword_defr, lookup_where_pt1_buf) )
+	{
+	    if ( trail_space )
+	    {
+		strcat(lookup_where_pt1_buf, " ");
+	    }
+	}
+	*where_pt1 = lookup_where_pt1_buf;
+	*where_pt2 = temp_where_pt2;
+    }
+    return( found);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  word_exists
+ *      Synopsis:       Check whether a given word is already defined in the
+ *                          Current mode -- relative to "Tokenizer-Escape" --
+ *                          and Scope into which definitions are being entered. 
+ *                      Used for error-reporting.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             stat_name                 Word to look up
+ *             where_pt1                 Pointer to string, part 1 of 2,
+ *                                          to display in result
+ *             where_pt2                 Pointer to string, part 2 of 2,
+ *                                          to display in result
+ *
+ *      Outputs:
+ *         Returned Value:               TRUE if the name exists.
+ *         Supplied Pointers:
+ *             *where_pt1                Result display string, part 1 of 2
+ *             *where_pt2                Result display string, part 2 of 2
+ *
+ *      Process Explanation:
+ *          If the calling routine displays the result-display strings,
+ *              it should follow-up with a call to  show_node_start()
+ *
+ *      Extraneous Remarks:
+ *          This used to be a much heftier routine; now it's just
+ *              a wrapper around  lookup_word() .
+ *
+ **************************************************************************** */
+
+bool word_exists( char *stat_name, char **where_pt1, char **where_pt2 )
+{
+    bool retval = FALSE;
+    tic_hdr_t *found = lookup_word( stat_name, where_pt1, where_pt2 );
+
+    if ( found != NULL )
+    {
+	retval = TRUE;
+    }
+
+    return( retval);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  warn_if_duplicate
+ *      Synopsis:       Check whether a given word is already defined in
+ *                          the current mode and issue a warning if it is.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             stat_name                Word to check
+ *         Global Variables:
+ *             verbose_dup_warning      Whether to run the check at all.
+ *         Local Static Variables:
+ *             do_not_overload          FALSE if  OVERLOAD  is in effect.
+ *
+ *      Outputs:
+ *         Returned Value:              NONE
+ *         Local Static Variables:
+ *             do_not_overload          Restored to TRUE
+ *         Printout:
+ *             Warning message if a duplicate.
+ *
+ *      Error Detection:
+ *             None.  This is merely an informative warning.
+ *
+ *      Process Explanation:
+ *          "Current mode" -- meaning, whether the tokenizer is operating
+ *              in "Tokenizer Escape" mode or in normal tokenization mode --
+ *              will be recognized by the  word_exists()  function.
+ *
+ *      Extraneous Remarks:
+ *          The  OVERLOAD  directive is our best shot at creating a more
+ *              fine-grained way to temporarily bypass this test when
+ *              deliberately overloading a name.  It would be nice to have
+ *              a mechanism, comparable to the classic
+ *                     WARNING @ WARNING OFF  .....  WARNING !
+ *              that could be applied to a range of definitions, but:
+ *              (1)  That would require more of a true FORTH infrastructure;
+ *                       hence, more effort than I am willing to invest, at
+ *                       this juncture, for such a small return,
+ *              and
+ *              (2)  Most intentional-overloading ranges only cover a
+ *                       single definition anyway.
+ *
+ **************************************************************************** */
+
+void warn_if_duplicate( char *stat_name)
+{
+    if ( verbose_dup_warning && do_not_overload )
+    {
+	char *where_pt1;
+	char *where_pt2; 
+	if ( word_exists( stat_name, &where_pt1, &where_pt2) )
+	{
+	    tokenization_error( WARNING, 
+		"Duplicate definition:   %s  already exists %s%s",
+		    stat_name, where_pt1, where_pt2 );
+	    show_node_start();
+	}
+    }
+    do_not_overload = TRUE;
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  glob_not_allowed
+ *      Synopsis:       Print a Message that "XXX is not allowed."
+ *                          because Global Scope is in effect.
+ *                      Used from several places...
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             severity              Severity of the Message
+ *             not_ignoring          FALSE = "Ignoring", for the part of the
+ *                                       message about "How It's being Handled"
+ *         Global Variables:
+ *             statbuf               Disallowed word currently being processed
+ *
+ *      Outputs:
+ *         Returned Value:           NONE
+ *         Printout:                 Message of given severity.
+ *
+ **************************************************************************** */
+
+static void glob_not_allowed( int severity, bool not_ignoring)
+{
+    tokenization_error( severity, "Global Scope is in effect; "
+			"%s not allowed.  %s.\n",
+			    strupr(statbuf), 
+				 not_ignoring ?
+				     "Attempting to compensate.." :
+					  "Ignoring" );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  not_in_dict
+ *      Synopsis:       Print the message "XXX is not in dictionary."
+ *                      Used from several places...
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             stat_name                Word that could not be processed
+ *
+ *      Outputs:
+ *         Returned Value:              NONE
+ *         Printout:         Error message.
+ *
+ **************************************************************************** */
+
+static void not_in_dict( char *stat_name)
+{
+    tokenization_error ( TKERROR,
+        "Word  %s  is not in dictionary.\n", stat_name);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  tokenized_word_error
+ *      Synopsis:       Report an error when a word could not be processed
+ *                          by the tokenizer.  Messages will vary...
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             stat_name                Word that could not be processed
+ *         Global Variables:
+ *             in_tokz_esc    TRUE if tokenizer is in "Tokenizer Escape" mode.
+ *
+ *      Outputs:
+ *         Returned Value:              NONE
+ *         Printout:          Error message.  Possible Advisory about
+ *
+ *      Error Detection:
+ *          Error was detected by the calling routine...
+ *
+ *      Process Explanation:
+ *          If the tokenizer is in "Tokenizer Escape" mode, the word might
+ *              be one that can be used in normal tokenization mode;
+ *          Conversely, if the tokenizer is in normal-tokenization mode,
+ *              the word might be one that can be used in the "Escape" mode.
+ *          Or, the word is completely unknown.
+ *          Recognizing the current mode is handled by  word_exists()
+ *          However, we need to test for the *converse* of the current mode,
+ *              so before we call  word_exists()  we are going to save and
+ *              invert the setting of  in_tokz_esc  (and afterwards, of
+ *              course, restore it...)
+ *
+ **************************************************************************** */
+
+static void tokenized_word_error( char *stat_name)
+{
+    char *where_pt1;
+    char *where_pt2;
+    bool found_somewhere;
+    
+    bool sav_in_tokz_esc = in_tokz_esc;
+    in_tokz_esc = INVERSE(sav_in_tokz_esc);
+
+    found_somewhere = word_exists( stat_name, &where_pt1, &where_pt2);
+    if ( found_somewhere )
+    {
+	tokenization_error ( TKERROR, "The word %s is %s recognized "
+	    "in tokenizer-escape mode.\n",
+		 stat_name, sav_in_tokz_esc ? "not" :  "only" );
+    } else {
+	not_in_dict( stat_name);
+    }
+
+    if ( INVERSE(exists_in_ancestor( stat_name)) )
+    {
+        if ( found_somewhere && sav_in_tokz_esc )
+	{
+	    tokenization_error(INFO,
+		"%s is defined %s%s", stat_name, where_pt1, where_pt2 );
+	    show_node_start();
+	}
+    }
+
+    in_tokz_esc = sav_in_tokz_esc;
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  unresolved_instance
+ *      Synopsis:       Print the "unresolved instance" message
+ *
+ *      Inputs:
+ *         Parameters:
+ *             severity                    Severity of the Message
+ *         Local Static Variables:
+ *             instance_filename           File where "instance" invoked
+ *             instance_lineno             Line number where "instance" invoked
+ *
+ *      Outputs:
+ *         Returned Value:                 NONE
+ *         Printout:          Message.
+ *
+ *      Error Detection:
+ *          Error was detected by the calling routine...
+ *
+ **************************************************************************** */
+
+static void unresolved_instance( int severity)
+{
+    tokenization_error( severity, "Unresolved \"INSTANCE\"" );
+    just_where_started( instance_filename, instance_lineno );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  modified_by_instance
+ *      Synopsis:       Print the "[not] modified by instance" message
+ *
+ *      Inputs:
+ *         Parameters:
+ *             definer                     Internal token for the defining-word
+ *             was_modded                  FALSE if "not modified..."
+ *         Local Static Variables:
+ *             instance_filename           File where "instance" invoked
+ *             instance_lineno             Line number where "instance" invoked
+ *
+ *      Outputs:
+ *         Returned Value:                 NONE
+ *         Printout:          WARNING message.
+ *
+ *      Error Detection:
+ *          Error was detected by the calling routine...
+ *
+ **************************************************************************** */
+
+static void modified_by_instance( fwtoken definer, bool was_modded)
+{
+    char *was_not = was_modded ? "was" : "not" ;
+    char *defn_type_name;
+
+    /*  No need to check the return value  */
+    definer_name(definer, &defn_type_name);
+
+    tokenization_error ( WARNING,
+	"%s definition %s modified by \"INSTANCE\"",
+	    defn_type_name, was_not );
+    just_where_started( instance_filename, instance_lineno );
+ }
+
+/* **************************************************************************
+ *
+ *      Function name:  validate_instance
+ *      Synopsis:       If "instance" is in effect, check whether it is
+ *                          appropriate to the defining-word being called.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             definer                   Internal token for the defining-word
+ *         Local Static Variables:
+ *             is_instance               TRUE if "instance" is in effect.
+ *             instance_definer_gap      TRUE if invalid definer(s) invoked
+ *                                           since "instance" went into effect.
+ *
+ *      Outputs:
+ *         Returned Value:               NONE
+ *         Local Static Variables:
+ *             is_instance               Reset to FALSE if definer was valid.
+ *             instance_definer_gap      TRUE if definer was not valid;
+ *                                           FALSE if definer was valid.
+ *
+ *      Error Detection:
+ *          If "instance" is in effect, the only defining-words that are
+ *              valid are:  value  variable  defer  or  buffer:  Attempts
+ *              to use any other defining-word will be reported with a
+ *              WARNING, but "instance" will remain in effect.
+ *          If an invalid defining-word was invoked since "instance" went
+ *              into effect, then, when it is finally applied to a valid
+ *              definer, issue a WARNING.
+ *
+ *      Process Explanation:
+ *          Implicit in the Standard is the notion that, once INSTANCE has
+ *              been executed, it remains in effect until a valid defining-
+ *              word is encountered.  We will do the same.
+ *
+ **************************************************************************** */
+
+static void validate_instance(fwtoken definer)
+{
+    if ( is_instance )
+    {
+	bool is_error = TRUE ;
+
+	switch ( definer)
+	{
+	    case VALUE:
+	    case VARIABLE:
+	    case DEFER:
+	    case BUFFER:
+		is_error = FALSE;
+	    /*  No default needed, likewise, no breaks;      */
+	    /*  but some compilers get upset without 'em...  */
+	    default:
+		break;
+	}
+
+	if( is_error )
+	{
+	    modified_by_instance(definer, FALSE );
+	    instance_definer_gap = TRUE;
+	}else{
+	    if ( instance_definer_gap )
+	    {
+		modified_by_instance(definer, TRUE );
+	    }
+	    is_instance = FALSE;
+	    instance_definer_gap = FALSE;
+	}
+    }
+}
+    
+
+/* **************************************************************************
+ *
+ *      Function name:  trace_creation
+ *      Synopsis:       If the word being created is on the Trace List,
+ *                          display the appropriate message
+ *
+ *      Inputs:
+ *         Parameters:
+ *             definer                 Internal token for the defining-word
+ *             nu_name                 The word being created
+ *         Global Variables:
+ *             verbose                 No point in doing all this if we're
+ *                                         not showing the message anyway...
+ *             in_tokz_esc             TRUE if we are in Tokenizer-Escape mode
+ *             scope_is_global         TRUE if "global" scope is in effect
+ *             current_device_node     Current dev-node data-struct
+ *
+ *      Outputs:
+ *         Returned Value:             NONE
+ *         Printout:
+ *             Advisory Message, if the word is on the Trace List.
+ *
+ *      Process Explanation:
+ *          The order of scope-checking is important:
+ *              A Local has no scope beyond the definition in which it occurs.
+ *              Tokenizer-Escape mode supercedes "Normal" mode, and renders
+ *                  moot the differences between Global and Device scope.
+ *              Global scope is mutually exclusive with Device scope.
+ *              Device scope needs to identify where the Current device-node
+ *                  began.
+ *
+ **************************************************************************** */
+
+void trace_creation( fwtoken definer, char *nu_name)
+{
+    if ( verbose )
+    {
+	if ( is_on_trace_list( nu_name) )
+	{
+            char  as_what[96] = "";
+	    bool show_last_colon = BOOLVAL( definer == LOCAL_VAL);
+
+	    as_a_what( definer, as_what);  /*  No need to check return value. */
+
+	    /*  Scope-checking starts here, unless  show_last_colon  is TRUE.
+	     *  Come out of this with  as_what[]  filled up and
+	     *      terminated with a new-line, if appropriate,
+	     */
+	    while ( ! show_last_colon )
+	    {
+		strcat( as_what, " ");
+
+		if ( in_tokz_esc )
+		{
+		    strcat( as_what, in_tkz_esc_mode);
+		    break;
+		}
+
+		if ( scope_is_global )
+		{
+		    strcat( as_what, "with Global scope.\n");
+		}else{
+		    /*  In Device scope.  Show the Current node.   */
+		    strcat( as_what, in_what_node( current_device_node));
+		}
+		break;
+
+	    }   /*  Destination of BREAKs ...   */
+
+	    tokenization_error(INFO, "Creating %s %s", nu_name, as_what);
+
+	    if ( show_last_colon )
+	    {
+		in_last_colon();
+	    }else{
+		show_node_start();
+	    }
+
+	}
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  create_word
+ *      Synopsis:       
+ *
+ *      Inputs:
+ *         Parameters:
+ *             definer             Internal token for the defining-word
+ *         Global Variables:
+ *             control_stack_depth Number of "Control Stack" entries in effect
+ *             nextfcode           FCode-number to be assigned to the new name
+ *             statbuf             Symbol last read from the input stream
+ *             pc                  Input-source Scanning pointer
+ *             hdr_flag            State of headered-ness for name-creation
+ *             force_tokens_case   If TRUE, force token-names' case in FCode
+ *             force_lower_case_tokens
+ *                                 If  force_tokens_case  is TRUE, this
+ *                                     determines which case to force
+ *             iname               Input-source file name; for error-reporting
+ *             lineno              Input-source Line number; also for err-rep't
+ *
+ *      Outputs:
+ *         Returned Value:         TRUE if successful
+ *         Global Variables:  
+ *             nextfcode           Incremented  (by bump_fcode() )
+ *             statbuf             Advanced to next symbol; must be re-read
+ *             pc                  Advanced, then restored to previous value
+ *         Memory Allocated
+ *             Copy of the name being defined, by support routine.
+ *             Copy of input-source file name, for error-reporting
+ *         When Freed?
+ *             Copy of name being defined is freed when Current Device Vocab
+ *                 is "finished", or at end of tokenization.
+ *             Copy of input-source file name is freed at end of this routine.
+ *
+ *      Error Detection:
+ *          ERROR if already inside a colon-definition.  Discontinue
+ *              processing and return FALSE.
+ *          ERROR if inside a control-structure.  Continue processing,
+ *              though, to catch other errors, and even return TRUE;
+ *              except:  leave the new token undefined. 
+ *          Warning on duplicate name (subject to command-line control)
+ *          Message if name is excessively long; Warning if headerless.
+ *          FATAL if the value of  nextfcode  is larger than the legal
+ *              maximum for an FCode, (0x0fff).
+ *
+ *      Revision History:
+ *      Updated Thu, 24 Mar 2005 by David L. Paktor
+ *          Optional warning when name about to be created is a
+ *              duplicate of an existing name.
+ *      Updated Wed, 30 Mar 2005 by David L. Paktor
+ *          Warning when name length exceeds ANSI-specified max (31 chars).
+ *      Updated Tue, 05 Apr 2005 by David L. Paktor
+ *          Add "definer" parameter and call to  add_definer() .  Part
+ *              of the mechanism to forbid attempts to use the  TO 
+ *              directive to change values of CONSTANTs in particular
+ *              and of inappropriate targets in general.
+ *      Updated Fri, 06 May 2005 by David L. Paktor
+ *          Error-detection of   DO ...  LOOP  and  BEGIN ...  imbalance
+ *          Error-detection of  nextfcode  exceeding legal maximum (0x0fff).
+ *      Updated Wed, 20 Jul 2005 by David L. Paktor
+ *          Put Duplicate-Name-Test under command-line control...
+ *      Updated Wed, 24 Aug 2005 by David L. Paktor
+ *          Error-detection via  clear_control_structs()  routine.
+ *      Updated Tue, 10 Jan 2006 by David L. Paktor
+ *          Convert to  tic_hdr_t  type vocabulary.
+ *      Updated Thu, 20 Apr 2006 by David L. Paktor
+ *          Allow creation of new definition within body of a flow-control
+ *              structure.  (Remove error-detection via  clear_control_structs)
+ *      Updated Tue, 13 Jun 2006 by David L. Paktor
+ *          Move detection of out-of-bounds  nextfcode  to  assigning_fcode()
+ *              routine, which also detects Overlapping Ranges error.
+ *      Updated Thu, 27 Jun 2006 by David L. Paktor
+ *          Report Error for attempt to create def'n inside control structure.
+ *
+ *      Extraneous Remarks:
+ *          We must not set  incolon  to TRUE (if we are creating a colon
+ *              definition) until *AFTER* this routine has been called, due
+ *              to the initial error-checking.  If we need to detect whether
+ *              we are creating a colon definition, we can do so by testing
+ *              whether the parameter, DEFINER, equals COLON .
+ *
+ **************************************************************************** */
+
+static bool create_word(fwtoken definer)
+{
+    signed long wlen;
+    bool retval = FALSE;
+    char *defn_type_name;
+
+    /*  If already inside a colon, ERROR and discontinueprocessing    */
+    /*  If an alias to a definer is used, show the name of the alias  */
+    if ( test_in_colon(statbuf, FALSE, TKERROR, NULL) ) 
+    {
+	char defn_type_buffr[32] = "";
+	unsigned int old_lineno = lineno;    /*  For error message  */
+	bool define_token = TRUE;
+
+	{   /*  Set up definition-type text for error-message */
+
+	    /*  No need to check the return value  */
+	    definer_name(definer, &defn_type_name);
+
+	    strcat( defn_type_buffr, defn_type_name);
+	    strcat( defn_type_buffr, " definition");
+	}
+	/*  If in a control-structure, ERROR but continue processing  */
+	if ( control_stack_depth != 0 )
+	{
+	    announce_control_structs( TKERROR, defn_type_buffr, 0);
+	    /*  Leave the new token undefined.  */
+	    define_token = FALSE;
+	}
+
+	/*  Get the name of the new token  */
+	wlen = get_word();
+
+#ifdef DEBUG_SCANNER
+	printf("%s:%d: debug: defined new word %s, fcode no 0x%x\n",
+			iname, lineno, name, nextfcode);
+#endif
+	if ( wlen <= 0 )
+	{
+	    warn_unterm( TKERROR, defn_type_buffr, old_lineno);
+	}else{
+	    bool emit_token_name = TRUE;
+
+	    /*  Handle Tracing of new definitions  */
+	    trace_creation( definer, statbuf);
+
+	    /*  Other Error or Warnings as applicable  */
+	    validate_instance( definer);
+	    warn_if_duplicate( statbuf);
+	    check_name_length( wlen);
+
+	    /*  Bump FCode; error-check as applicable  */
+	    assigning_fcode();
+
+	    /*  Define the new token, unless disallowed  */
+	    add_to_current( statbuf, nextfcode, definer, define_token);
+
+	    /*  Emit appropriate FCodes:  Type of def'n,   */
+	    switch ( hdr_flag )
+	    {
+		case FLAG_HEADERS:
+		    emit_token("named-token");
+		    break;
+
+		case FLAG_EXTERNAL:
+		    emit_token("external-token");
+		    break;
+
+		default:  /*   FLAG_HEADERLESS   */
+		    emit_token("new-token");
+		    emit_token_name = FALSE;
+	    }
+
+	    /*  Emit name of token, if applicable  */
+	    if ( emit_token_name )
+	    {
+		if ( force_tokens_case )
+		{
+		    if ( force_lower_case_tokens )
+		    {
+			strlwr( statbuf);
+		    }else{
+			strupr( statbuf);
+		    }
+		}
+		emit_string((u8 *)statbuf, wlen);	
+	    }
+
+	    /*  Emit the new token's FCode   */
+	    emit_fcode(nextfcode);
+
+	    /*  Prepare FCode Assignment Counter for next definition   */
+	    bump_fcode();
+
+	    /*  Declare victory   */
+	    retval = TRUE;
+	}
+    }
+    return( retval);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  cannot_apply
+ *      Synopsis:       Print error message of the form:
+ *                     "Cannot apply <func> to <targ>, which is a <def'n>"
+ *
+ *      Inputs:
+ *         Parameters:
+ *             func_nam                    The name of the function
+ *             targ_nam                    The name of the target
+ *             defr                        The numeric-code of the definer-type
+ *
+ *      Outputs:
+ *         Returned Value:                 NONE
+ *         Printout:
+ *             The error message is the entire printout of this routine
+ *
+ *      Error Detection:
+ *          Error was detected by calling routine
+ *
+ *      Process Explanation:
+ *          The calling routine already looked up the definer for its
+ *              own purposes, so we don't need to do that again here.
+ *
+ *      Still to be done:
+ *          If the definer-name is not found, we might still look up
+ *              the target name in the various vocabularies and use
+ *              a phrase for those.  E.g., if it is a valid token,
+ *              we could say it's defined as a "primitive".  (I'm
+ *              not sure what we'd say about an FWord...)
+ *
+ **************************************************************************** */
+
+static void cannot_apply( char *func_nam, char *targ_nam, fwtoken defr)
+{
+    char *defr_name = "" ;
+    const char *defr_phrase = ", which is defined as a " ;
+
+    if ( ! definer_name(defr, &defr_name) )
+    {
+	defr_phrase = "";
+    }
+
+    tokenization_error ( TKERROR , 
+	"Cannot apply  %s  to  %s %s%s.\n",
+	     func_nam, targ_nam, defr_phrase, defr_name );
+
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  lookup_with_definer
+ *      Synopsis:       Return pointer to data-structure of named word,
+ *                      if it's valid in Current context, and supply its
+ *                      definer.  If it's not valid in Current context,
+ *                      see if it might be a Local, and supply that definer.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             stat_name                  Name to look up
+ *             *definr                    Pointer to place to put the definer.
+ *
+ *      Outputs:
+ *         Returned Value:                Pointer to data-structure, or
+ *                                            NULL if not in Current context.
+ *         Supplied Pointers:
+ *             *definr                    Definer; possibly LOCAL_VAL
+ *
+ *      Process Explanation:
+ *          If the name is not found in the Current context, and does not
+ *              exist as a Local, *definr will remain unchanged.
+ *
+ *      Extraneous Remarks:
+ *          This is an odd duck^H^H^H^H^H^H^H^H^H^H^H^H a highly-specialized 
+ *              routine created to meet some corner-case needs engendered by
+ *              the conversion to tic_hdr_t vocabularies all around, combined
+ *              with an obsessive urge to preserve a high level of detail in
+ *              our error-messages.
+ *
+ **************************************************************************** */
+
+static tic_hdr_t *lookup_with_definer( char *stat_name, fwtoken *definr )
+{
+    tic_hdr_t *retval = lookup_current( stat_name);
+    if ( retval != NULL )
+    {
+         *definr = retval->fword_defr;
+    }else{
+        if ( exists_as_local( stat_name) ) *definr = LOCAL_VAL;
+    }
+    return ( retval );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  validate_to_target
+ *      Synopsis:       Print a message if the intended target
+ *                          of the  TO  directive is not valid
+ *      
+ *      Inputs:
+ *         Parameters:                NONE
+ *         Global Variables:
+ *             statbuf             Next symbol to be read from the input stream
+ *             pc                  Input-source Scanning pointer
+ *
+ *      Outputs:
+ *         Returned Value:         TRUE = Allow  b(to)  token to be output.
+ *         Global Variables:
+ *             statbuf             Advanced to next symbol; must be re-read
+ *             pc                  Advanced, then restored to previous value
+ *
+ *      Error Detection:
+ *          If next symbol is not a valid target of  TO , issue ERROR    
+ *              message.  Restored  pc  will cause the next symbol to
+ *              be processed by ordinary means.
+ *          Allow  b(to)  token to be output in selected cases.  Even if
+ *              user has set the "Ignore Errors" flag, certain targets are
+ *              still too risky to be allowed to follow a  b(to)  token;
+ *              if "Ignore Errors" is not set, output won't get created
+ *              anyway.
+ *          Issue ERROR in the extremely unlikely case that "to" is the
+ *              last word in the Source.
+ *
+ *      Process Explanation:
+ *          Valid targets for a TO directive are words defined by:
+ *              DEFER, VALUE and arguably VARIABLE.  We will also allow
+ *              CONSTANT, but will still issue an Error message.
+ *          After the check, restore  pc ; this was only a look-ahead.
+ *              Also restore  lineno  and  abs_token_no 
+ *
+ *      Extraneous Remarks:
+ *          Main part of the mechanism to detect attempts to use the  TO 
+ *              directive to change the values of CONSTANTs in particular
+ *              and of inappropriate targets in general.
+ *
+ **************************************************************************** */
+
+static bool validate_to_target( void )
+{
+    signed long wlen;
+    tic_hdr_t *test_entry;
+    u8 *saved_pc = pc;
+    char *cmd_cpy = strupr( strdup( statbuf));    /*  For error message  */
+    unsigned int saved_lineno = lineno;
+    unsigned int saved_abs_token_no = abs_token_no;
+    fwtoken defr = UNSPECIFIED ;
+    bool targ_err = TRUE ;
+    bool retval = FALSE ;
+
+    wlen = get_word();
+    if ( wlen <= 0 )
+    {
+	warn_unterm( TKERROR, cmd_cpy, saved_lineno);
+    }else{
+
+	test_entry = lookup_with_definer( statbuf, &defr);
+	if ( test_entry != NULL )
+	{
+	    switch (defr)
+	    {
+		case VARIABLE:
+		    tokenization_error( WARNING,
+			"Applying %s to a VARIABLE (%s) is "
+			"not recommended; use  !  instead.\n",
+			cmd_cpy, statbuf);
+		case DEFER:
+		case VALUE:
+		    targ_err = FALSE ;
+		case CONST:
+		    retval = TRUE ;
+		/*  No default needed, likewise, no breaks;      */
+		/*  but some compilers get upset without 'em...  */
+		default:
+		    break;
+	    }
+	}
+
+	if ( targ_err )
+	{
+	    cannot_apply(cmd_cpy, strupr(statbuf), defr );
+	}
+
+	pc = saved_pc;
+	lineno = saved_lineno;
+	abs_token_no = saved_abs_token_no;
+    }
+    free( cmd_cpy);
+    return( retval);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  you_are_here
+ *      Synopsis:       Display a generic Advisory of the Source command
+ *                          or directive encountered and being processed
+ *
+ *      Inputs:
+ *         Parameters:                NONE
+ *         Global Variables:
+ *             statbuf                The command being processed 
+ *
+ *      Outputs:
+ *         Returned Value:            NONE
+ *         Printout:
+ *             Advisory message
+ *
+ **************************************************************************** */
+
+static void you_are_here( void)
+{
+    tokenization_error( INFO,
+	"%s encountered; processing...\n",
+	    strupr(statbuf) );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  fcode_starter
+ *      Synopsis:       Respond to one of the "FCode Starter" words
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             token_name         The FCode-token for this "Starter" word
+ *             spread             The separation between tokens.
+ *             is_offs16          Whether we are using a 16-bit number
+ *                                    for branch- (and suchlike) -offsets,
+ *                                    or the older-style 8-bit offset numbers.
+ *         Global Variables:
+ *            iname               Input-File name, used to set ifile_name 
+ *                                    field of  current_device_node
+ *            lineno              Current Input line number, used to set
+ *                                    line_no field of  current_device_node
+ *         Local Static Variables:
+ *            fcode_started       If this is TRUE, we have an Error.
+ *            first_fc_starter    Control calling  reset_fcode_ranges() ;
+ *                                    only on the first fcode_starter of
+ *                                    a tokenization.
+ *
+ *      Outputs:
+ *         Returned Value:        NONE
+ *         Global Variables:
+ *            offs16              Global "16-bit-offsets" flag
+ *            current_device_node   The ifile_name and line_no fields will be
+ *                                    loaded with the current input file name
+ *                                    and line number.  This node will be the
+ *                                    top-level device-node.
+ *            FCode Ranges will be reset the first time per tokenization
+ *                that this routine is entered.
+ *            A new FCode Range will be started every time after that.
+ *         Local Static Variables:
+ *            fcode_started       Set to TRUE.  We invoke the starter only
+ *                                    once per image-block.
+ *            first_fc_starter    Reset to FALSE if not already
+ *         Memory Allocated
+ *             Duplicate of Input-File name
+ *         When Freed?
+ *             In  fcode_ender()
+ *
+ *      Error Detection:
+ *          Spread of other than 1 -- Warning message.
+ *          "FCode Starter" previously encountered -- Warning and ignore.
+ *
+ *      Question under consideration:
+ *          Do we want directives -- such as definitions of constants --
+ *              supplied before the "FCode Starter", to be considered as
+ *              taking place in "Tokenizer Escape" mode?  That would mean
+ *              the "Starter" functions must be recognized in "Tokenizer
+ *              Escape" mode.  Many ramifications to be thought through...
+ *          I think I'm coming down strongly on the side of "No".  The user
+ *              who wants to do that can very well invoke "Tokenizer Escape"
+ *              mode explicitly.
+ *
+ **************************************************************************** */
+
+static void fcode_starter( const char *token_name, int spread, bool is_offs16)
+{
+    you_are_here();
+    if ( spread != 1 )
+    {
+        tokenization_error( WARNING, "spread of %d not supported.\n", spread);
+    }
+    if ( fcode_started )
+    {
+        tokenization_error( WARNING,
+	    "Only one \"FCode Starter\" permitted per tokenization.  "
+		"Ignoring...\n");
+    } else {
+
+	emit_fcodehdr(token_name);
+	offs16 = is_offs16;
+	fcode_started = TRUE;
+
+	current_device_node->ifile_name = strdup(iname);
+	current_device_node->line_no = lineno;
+
+	if ( first_fc_starter )
+	{
+	    reset_fcode_ranges();
+	    first_fc_starter = FALSE;
+	}else{
+	    set_next_fcode( nextfcode);
+	}
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  fcode_end_err_check
+ *      Synopsis:       Do error-checking at end of tokenization,
+ *                          whether due to FCODE-END or end-of-file,
+ *                          and reset the indicators we check.
+ *
+ *      Inputs:
+ *         Parameters:                    NONE
+ *         Global Variables:
+ *             Data-Stack depth     Is anything left on the stack?
+ *
+ *      Outputs:
+ *         Returned Value:                NONE
+ *         Global Variables:
+ *             Data-Stack           Reset to empty
+ *
+ *      Error Detection:
+ *          Unresolved control structures detected by clear_control_structs()
+ *          If anything is left on the stack, it indicates some incomplete
+ *              condition; we will treat it as a Warning.
+ *
+ **************************************************************************** */
+
+static void fcode_end_err_check( void)
+{
+    bool stack_imbal = BOOLVAL( stackdepth() != 0 );
+
+	if ( stack_imbal )
+	{
+	    tokenization_error( WARNING,
+		"Stack imbalance before end of tokenization.\n");
+	}
+    clear_stack();
+    clear_control_structs("End of tokenization");
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  fcode_ender
+ *      Synopsis:       Respond to one of the "FCode Ender" words:
+ *                          The FCode-token for "End0" or "End1"
+ *                              has already been written to the
+ *                              FCode Output buffer.
+ *                          Finish the FCode header:  fill in its
+ *                              checksum and length.
+ *                          Reset the token names defined in "normal" mode
+ *                          (Does not reset the FCode-token number)
+ *
+ *      Associated FORTH words:                 END0, END1
+ *      Associated Tokenizer directive:         FCODE-END
+ *
+ *      Inputs:
+ *         Parameters:            NONE
+ *         Global Variables:
+ *             incolon            If TRUE, a colon def'n has not been completed
+ *             last_colon_filename         For error message.
+ *             last_colon_lineno           For error message.
+ *             scope_is_global             For error detection
+ *             is_instance                 For error detection
+ *
+ *      Outputs:
+ *         Returned Value:        NONE
+ *         Global Variables:
+ *             haveend            Set to TRUE
+ *             fcode_started      Reset to FALSE.  Be ready to start anew.
+ *             FCode-defined tokens, aliases and macros -- i.e., those
+ *                 *NOT* defined in tokenizer-escape mode -- are reset.
+ *                 (Also, command-line-defined symbols are preserved).
+ *             Vocabularies will be reset
+ *             Device-node data structures will be deleted
+ *             Top-level device-node ifile_name and line_no fields
+ *                 will be reset.
+ *         Memory Freed
+ *             Duplicate of Input-File name, in top-level device-node.
+ *         Printout:
+ *             Advisory message giving current value of nextfcode
+ *                 (the "FCode-token Assignment Counter")
+ *
+ *      Error Detection:
+ *          ERROR if a Colon definition has not been completed.
+ *          ERROR if "instance" is still in effect
+ *          WARNING if Global-Scope has not been terminated; compensate.
+ *
+ *      Extraneous Remarks:
+ *          In order to accommodate odd cases, such as multiple FCode blocks
+ *          within a single PCI header, this routine does not automatically
+ *          reset nextfcode  to h# 0800
+ *
+ **************************************************************************** */
+
+void fcode_ender(void)
+{
+    if ( incolon )
+    {
+	char *tmp_iname = iname;
+	iname = last_colon_filename;
+	unterm_is_colon = TRUE;
+	warn_unterm( TKERROR, "Colon Definition", last_colon_lineno);
+	iname = tmp_iname;    
+    }
+    
+    haveend = TRUE;
+
+    if ( is_instance )
+    {
+	unresolved_instance( TKERROR);
+    }
+
+    if ( scope_is_global )
+    {
+        tokenization_error( WARNING ,
+	    "No DEVICE-DEFINITIONS directive encountered before end.  "
+		"Compensating...\n");
+	resume_device_scope();
+    }
+    fcode_end_err_check();
+    reset_normal_vocabs();
+    finish_fcodehdr();
+    fcode_started = FALSE;
+
+    if ( current_device_node->ifile_name != default_top_dev_ifile_name )
+    {
+	free( current_device_node->ifile_name );
+	current_device_node->ifile_name = default_top_dev_ifile_name;
+	current_device_node->line_no = 0;
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  get_token
+ *      Synopsis:       Read the next word in the input stream and retrieve
+ *                          its FCode-token number.  If it's not a symbol to
+ *                          which a single token is assigned (e.g., if it's
+ *                          a macro), report an error.
+ *
+ *      Associated FORTH words:                   [']  '
+ *      Associated Tokenizer directive:          F[']
+ *
+ *      Inputs:
+ *         Parameters:
+ *             *tok_entry             Place to put the pointer to token entry
+ *         Global Variables:
+ *             statbuf                The command being processed 
+ *             pc                     Input stream character pointer
+ *
+ *      Outputs:
+ *         Returned Value:            TRUE if successful (i.e., no error)
+ *         Supplied Pointers:
+ *             *tok_entry             The token entry, if no error
+ *         Global Variables:
+ *             statbuf                The next word in the input stream
+ *             pc                     Restored to previous value if error
+ *
+ *      Error Detection:
+ *          The next word in the input stream is expected to be on the
+ *              same line as the directive.  The  get_word_in_line()
+ *              routine will check for that.
+ *          If the next word in the input stream is not a symbol
+ *              for which a single-token FCode number is assigned,
+ *              report an ERROR and restore PC to its previous value.
+ *
+ **************************************************************************** */
+
+static bool get_token(tic_hdr_t **tok_entry)
+{
+    bool retval = FALSE;
+    u8 *save_pc;
+
+    /*  Copy of command being processed, for error message  */
+    char cmnd_cpy[FUNC_CPY_BUF_SIZE+1];
+    strncpy( cmnd_cpy, statbuf, FUNC_CPY_BUF_SIZE);
+    cmnd_cpy[FUNC_CPY_BUF_SIZE] = 0;   /*  Guarantee null terminator. */
+
+    save_pc = pc;
+
+    if ( get_word_in_line( statbuf) )
+    {
+	fwtoken defr = UNSPECIFIED;
+
+	/*  We need to scan the newest definitions first; they
+	 *      might supercede standard ones.  We need, though,
+	 *      to bypass built-in FWords that need to trigger
+	 *      some tokenizer internals before emitting their
+	 *      synonymous FCode Tokens, (e.g., version1 , end0 ,
+	 *      and start{0-4}); if we find one of those, we will
+	 *      need to search again, specifically within the list
+	 *      of FCode Tokens.
+	 */
+	*tok_entry = lookup_with_definer( statbuf, &defr);
+	if ( *tok_entry != NULL )
+	{
+	    /*  Built-in FWords can be uniquely identified by their
+	     *      definer,  BI_FWRD_DEFN .  The definer for "shared"
+	     *      FWords is  COMMON_FWORD  but there are none of
+	     *      those that might be synonymous with legitimate
+	     *      FCode Tokens, nor are any likely ever to be...
+	     */
+	    if ( defr == BI_FWRD_DEFN )
+	    {
+	        *tok_entry = lookup_token( statbuf);
+		retval = BOOLVAL( *tok_entry != NULL );
+	    }else{
+		retval = entry_is_token( *tok_entry);
+	    }
+	}
+
+	if ( INVERSE( retval) )
+	{
+	    cannot_apply( cmnd_cpy, strupr(statbuf), defr );
+	    pc = save_pc;
+	}
+    }
+
+    return ( retval );
+}
+
+
+static void base_change ( int new_base )
+{
+    if ( incolon && ( INVERSE( in_tokz_esc) ) )
+    {
+        emit_literal(new_base );
+	emit_token("base");
+	emit_token("!");
+    } else {
+        base = new_base;
+    }
+}
+
+static void base_val (int new_base)
+{
+    u8  *old_pc;
+
+    char base_cmnd[FUNC_CPY_BUF_SIZE+1];
+    strncpy( base_cmnd, statbuf, FUNC_CPY_BUF_SIZE);
+    base_cmnd[FUNC_CPY_BUF_SIZE] = 0;  /* Guarantee NULL terminator */
+
+    old_pc=pc;
+    if ( get_word_in_line( statbuf) )
+    {
+	u8 basecpy=base;
+
+	base = new_base;
+	if ( ! handle_number() )
+	{
+	    /*  We did get a word on the line, but it's not a valid number */
+	    tokenization_error( WARNING ,
+		 "Applying %s to non-numeric value.  Ignoring.\n",
+		      strupr(base_cmnd) );
+	    pc = old_pc;
+	}
+	base=basecpy;
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  eval_string
+ *      Synopsis:       Prepare to tokenize a string, artificially generated
+ *                          by this program or created as a user-defined
+ *                          Macro.   When done, resume at existing source.
+ *                      Keep the file-name and line-number unchanged.
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             inp_bufr          String (or buffer) to evaluate
+ *
+ *      Outputs:
+ *         Returned Value:       NONE
+ *         Global Variables, changed by call to init_inbuf():
+ *             start             Points to given string
+ *             pc                         ditto
+ *             end               Points to end of given string
+ *
+ *      Revision History:
+ *          Updated Thu, 23 Feb 2006 by David L. Paktor
+ *              This routine no longer calls its own instance of  tokenize()
+ *              It has become the gateway to the mechanism that makes a
+ *                  smooth transition between the body of the Macro, User-
+ *                  defined Symbol or internally-generated string and the
+ *                  resumption of processing the source file. 
+ *              A similar (but more complicated) transition when processing
+ *                  an FLOADed file will be handled elsewhere.
+ *          Updated Fri, 24 Feb 2006 by David L. Paktor
+ *              In order to support Macro-recursion protection, this routine
+ *                  is no longer the gateway for Macros; they will have to
+ *                  call push_source() directly.
+ *
+ **************************************************************************** */
+
+void eval_string( char *inp_bufr)
+{
+    push_source( NULL, NULL, FALSE);
+    init_inbuf( inp_bufr, strlen(inp_bufr));
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  finish_or_new_device
+ *      Synopsis:       Handle the shared logic for the NEW-DEVICE and
+ *                          FINISH-DEVICE commands.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             finishing_device		   TRUE for FINISH-DEVICE,
+ *					       FALSE for NEW-DEVICE
+ *         Global Variables:
+ *             incolon			     TRUE if inside a colon definition
+ *             noerrors 		     TRUE if ignoring errors
+ *             scope_is_global		     TRUE if "global scope" in effect
+ *         Local Static Variables:
+ *             is_instance		     TRUE if "instance" is in effect
+ *             dev_change_instance_warning   TRUE if warning hasn't been issued
+ *
+ *      Outputs:
+ *         Returned Value: 		     NONE
+ *         Local Static Variables:
+ *             dev_change_instance_warning   FALSE if warning is issued
+ *             instance_definer_gap	     TRUE if "instance" is in effect
+ *
+ *      Error Detection:
+ *          NEW-DEVICE and FINISH-DEVICE should not be used outside of
+ *              a colon-definition if global-scope is in effect.  Error
+ *              message; no further action unless we are ignoring errors.
+ *          Issue a WARNING if INSTANCE wasn't resolved before the current
+ *              device-node is changed.  Try not to be too repetitive...
+ *
+ *      Process Explanation:
+ *          The words NEW-DEVICE and FINISH-DEVICE may be incorporated into
+ *              a colon-definition, whether the word is defined in global-
+ *              or device- -scope.  Such an incorporation does not effect
+ *              a change in the device-node vocabulary; simply emit the token.
+ *          If we are in interpretation mode, though, we need to check for
+ *              errors before changing the device-node vocabulary:
+ *          If global-scope is in effect, we need to check whether we are
+ *              ignoring errors; if so, we will compensate by switching to  
+ *              device-scope.
+ *          If "instance" is in effect, it's "dangling".  It will remain
+ *              in effect through a device-node change, but this is very
+ *              bad style and deserves a WARNING, but only one for each
+ *              occurrence.  It would be unaesthetic, to say the least,
+ *              to have multiple messages for the same dangling "instance"
+ *              in a "finish-device   new-device" sequence.
+ *           We must be careful about the order we do things, because of
+ *              the messages printed as a side-effect of the node change...
+ *
+ *      Extraneous Remarks:
+ *          I will violate strict structure here.
+ *
+ **************************************************************************** */
+
+static void finish_or_new_device( bool finishing_device )
+{
+    if ( INVERSE( incolon ) )
+    {
+	if ( INVERSE( is_instance) )
+	{
+	    /*  Arm warning for next time:         */
+	    dev_change_instance_warning = TRUE;
+	}else{
+	    /*  Dangling "instance"                */
+	    instance_definer_gap = TRUE;
+	    /*   Warn only once.                   */
+	    if ( dev_change_instance_warning )
+	    {
+		unresolved_instance( WARNING);
+		dev_change_instance_warning = FALSE;
+	    }
+	}
+
+	/*  Note:  "Instance" cannot be in effect during "global" scope  */ 
+	if ( scope_is_global )
+	{
+	    glob_not_allowed( TKERROR, noerrors );
+	    if ( noerrors )
+	    {
+		 resume_device_scope();
+	    }else{
+		 return;
+	    }
+	}
+
+	if ( finishing_device )
+	{
+	     finish_device_vocab();
+	}else{
+	     new_device_vocab();
+	}
+    }
+    emit_token( finishing_device ? "finish-device" : "new-device" );
+	}
+	
+	
+/* **************************************************************************
+ *
+ *      Function name:  abort_quote
+ *      Synopsis:       Optionally implement the   ABORT"  function as
+ *                      though it were a macro.  Control whether to allow
+ *                      it, and which style to support, via switches set
+ *                      on the command-line at run-time.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tok                       Numeric-code associated with the
+ *                                           FORTH word that was just read.
+ *         Global Variables:
+ *             enable_abort_quote        Whether to allow ABORT"
+ *             sun_style_abort_quote     SUN-style versus Apple-style
+ *             abort_quote_throw         Whether to use -2 THROW vs ABORT
+ *
+ *      Outputs:
+ *         Returned Value:     TRUE if it was handled
+ *         Global Variables:
+ *             report_multiline              Reset to FALSE.
+ *         Printout:
+ *             ADVISORY:   ABORT" in fcode is not defined by IEEE 1275-1994
+ *
+ *      Error Detection:
+ *          Performed by other routines.  If user selected not to
+ *              allow  ABORT" , it will simply be treated as an
+ *              unknown word.
+ *          The string following it, however, will still be consumed.
+ *
+ *      Process Explanation:
+ *          If the supplied  tok  was not  ABORTTXT , then return FALSE.
+ *          If the  enable_abort_quote  flag is FALSE, consume the
+ *              string following the Abort" token, but be careful to
+ *              leave the  Abort" token in statbuf, as it will be used
+ *              for the error message.
+ *          Otherwise, create and prepare for processing the appropriate Macro:
+ *              For Apple Style, we push the specified string onto the stack
+ *                  and do -2 THROW (and hope the stack unwinds correctly).
+ *              For Sun Style, we test the condition on top of the stack,
+ *                  and if it's true, print the specified string before we
+ *                  do the -2 THROW.
+ *          We perform the underlying operations directly:  placing an "IF"
+ *              (if Sun Style), then placing the string.  This bypasses
+ *              any issues of double-parsing, as well as of doubly checking
+ *              for a multi-line string.
+ *          Finally, we perform the operational equivalents of the remainder
+ *              of the command sequence.
+ *
+ *      Extraneous Remarks:
+ *          I would have preferred not to have to directly perform the under-
+ *              lying operations, and instead simply prepare the entire command
+ *              sequence in a buffer, but I needed to handle the case where
+ *              quote-escaped quotes are included in the string:  If the string
+ *              were simply to be reproduced into the buffer, the quote-escaped
+ *              quotes would appear as plain quote-marks and terminate the
+ *              string parsing prematurely, leaving the rest of the string
+ *              to be treated as code instead of text...
+ *          Also, the introduction of the variability of whether to do the
+ *               -2 THROW  or to compile-in the token for  ABORT  makes the
+ *              buffer-interpretation scheme somewhat too messy for my tastes.
+ *
+ **************************************************************************** */
+	
+static bool abort_quote( fwtoken tok)
+{
+    bool retval = FALSE;
+    if ( tok == ABORTTXT )
+    {
+	if ( ! enable_abort_quote )
+	{
+	    /* ABORT" is not enabled; we'd better consume the string  */
+	    char *save_statbuf;
+	    signed long wlen;
+	    save_statbuf = strdup( (char *)statbuf);
+	    wlen = get_string( FALSE);
+	    strcpy( statbuf, save_statbuf);
+	    free( save_statbuf);
+	}else{
+	    /* ABORT" is not to be used in FCODE drivers
+	     * but Apple drivers do use it. Therefore we
+	     * allow it. We push the specified string to
+	     * the stack, do -2 THROW and hope that THROW
+	     * will correctly unwind the stack.
+	     * Presumably, Apple Source supplies its own
+	     *  IF ... THEN
+	     */
+	    char *abort_string;
+	    signed long wlen;
+
+	    retval = TRUE;
+	    tokenization_error (INFO, "ABORT\" in fcode not "
+			    "defined by IEEE 1275-1994\n");
+	    test_in_colon("ABORT\"", TRUE, TKERROR, NULL);
+	    wlen=get_string( TRUE);
+
+	    if ( sun_style_abort_quote )  emit_if();
+
+	    emit_token("b(\")");
+	    emit_string(statbuf, wlen);
+	
+	    if ( sun_style_abort_quote )  emit_token("type");
+
+	    if ( abort_quote_throw )
+	    {
+		emit_literal( -2);
+		emit_token("throw");
+	    }else{
+		emit_token("abort");
+	}
+		
+	    if ( sun_style_abort_quote )  emit_then();
+	        /*  Sun Style  */
+		abort_string = " type -2 THROW THEN:" ;
+}
+	}
+    return( retval );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  create_alias
+ *      Synopsis:       Create an alias, as specified by the user
+ *
+ *      Associated FORTH word:                 ALIAS
+ *
+ *      Inputs:
+ *         Parameters:                NONE
+ *         Global Variables:
+ *             incolon                Colon-def'n-in-progress indicator
+ *             in_tokz_esc            "Tokenizer Escape" mode indicator
+ *         Input Stream
+ *             Two words will be read.
+ *
+ *      Outputs:
+ *         Returned Value:            TRUE if succeeded.
+ *         Global Variables:    
+ *             statbuf                New name will be copied back into here.
+ *         Memory Allocated
+ *             The two words will be copied into freshly-allocated memory 
+ *                 that will be passed to the create_..._alias()  routine.
+ *         When Freed?
+ *             When Current Device Vocabulary is "finished", or at end
+ *                 of tokenization, or upon termination of program.
+ *             If not able to create alias, the copies will be freed here.
+ *
+ *      Error Detection:
+ *          If the ALIAS command was given during colon-definition, that
+ *              can be handled by this tokenizer, but it is not supported
+ *              by IEEE 1275-1994.  Issue a WARNING.
+ *          If the new name is a copy of an existing word-name, issue a warning.
+ *          If the word to which an alias is to be created does not exist
+ *              in the appropriate mode -- relative to "Tokenizer-Escape" --
+ *              that is an ERROR.
+ *          If "instance" is in effect, the ALIAS command is an ERROR.
+ *
+ *      Process Explanation:
+ *          Get two words -- the new name and the "old" word -- from the
+ *              same line of input as the ALIAS command.
+ *          Copy the new name back into statbuf for use in trace_creation.
+ *          Determine whether or not we are in "Tokenizer-Escape" mode.
+ *              Subsequent searches will take place in that same mode.
+ *          If the "new" name already exists, issue a warning.
+ *          In each vocabulary applicable to the current mode -- i.e., 
+ *                  "Tokenizer-Escape" or "Normal" -- (except:  cannot
+ *                  make aliases to "Locals"):
+ *              Try using the  create_..._alias()  routine.
+ *              If it succeeds, we are done.
+ *          IMPORTANT:  The order in which we try the vocabularies MUST
+ *              match the order in which  tokenize_one_word()  searches them. 
+ *          If all the attempts failed, the "old" word does not exist;
+ *              declare an ERROR and free up the memory that was allocated.
+ *
+ *      Extraneous Remarks:
+ *          With the separation of the  tokenizer[  state, this
+ *              function has become too complicated to keep as a
+ *              simple  CASE  in the big  SWITCH  statement anymore...
+ *
+ *          I had earlier thought that it was sufficient to create a
+ *              macro linking the "new" name to the "old" word.  There
+ *              were too many cases, though, where that didn't work.
+ *              This is cleaner.
+ *
+ *          I will not be adhering to the strict rules of structure in
+ *              this routine, as it would get me nested too deeply...
+ *
+ *      Revision History:
+ *          Updated Tue, 10 Jan 2006 by David L. Paktor
+ *              Convert to  tic_hdr_t  type vocabularies.
+ *
+ **************************************************************************** */
+
+static bool create_alias( void )
+{
+    char *new_alias ;
+
+    validate_instance(ALIAS);
+    if ( incolon )
+    {
+	 tokenization_error ( WARNING,
+	    "ALIAS during colon-definition "
+		"is not supported by IEEE 1275-1994\n");
+}
+    if ( get_word_in_line( "ALIAS") )
+    {
+
+	new_alias = strdup((char *)statbuf);
+
+	if (get_word_in_line( "ALIAS") )
+{
+	    char *old_name = strdup((char *)statbuf) ;
+
+	    /*  Copy the "new" alias name back into statbuf.
+	     *      This is a HACK ^H^H^H^H awkward way to retrofit
+	     *      support for the  trace_creation()  function.
+	     */
+	    strcpy( statbuf, new_alias);
+
+	    /*  We don't call  trace_creation()  here because we don't
+	     *      know if the creation succeeded.  However, we want
+	     *      to issue a "Duplicate" warning based on the attempt,
+	     *      even if it doesn't succeed.
+	     *  We would prefer to have the "Trace" message precede the 
+	     *      "Duplicate" warning, but we don't think it's worth
+	     *      the effort.  When it becomes worthwhile, the way to
+	     *      do it would be to factor out the block that handles
+	     *      normal-tokenization versus "Tokenizer-Escape" mode;
+	     *      condition the "Trace" message on its success-return, 
+	     *      show the "Duplicate" warning in any case, then show
+	     *      the error-message and do the cleanup conditioned on
+	     *      a failure-return.
+	     *  That will also obviate the need for a return value from
+	     *      this routine and for the copy-back into statbuf.
+	     */
+	    warn_if_duplicate(new_alias);
+
+	    /*
+	     *  Here is where we begin trying the  create_..._alias() 
+	     *      routines for the vocabularies.
+	     */
+
+	    /*
+	     *  Distinguish between "Normal" tokenization mode
+	     *  and "Tokenizer Escape" mode
+	     */
+	    if ( in_tokz_esc )
+	    {
+		if ( create_tokz_esc_alias( new_alias, old_name) )
+		    return(TRUE);
+	
+		/*
+		 *  Handle the classes of operatives that are common between
+		 *      "Tokenizer Escape" mode and "Normal" tokenization mode.
+		 *  Those classes include selected non-fcode forth constructs
+		 *     and Conditional-Compilation Operators.
+		 */
+		{
+		    tic_hdr_t *found = lookup_shared_word( old_name);
+		    if ( found != NULL )
+		    {
+			if ( create_core_alias( new_alias, old_name) )
+			    return(TRUE);
+		    }
+	}
+	    }else{
+        	/*  "Normal" tokenization mode  */
+	
+		/*  Can create aliases for "Locals", why not?  */
+		if ( create_local_alias( new_alias, old_name) )
+		    return(TRUE);
+
+		/*
+		 *  All other classes of operatives -- non-fcode forth
+		 *      constructs, Standard and user-defined fcode
+		 *      tokens, Macros, and Conditional-Compilation
+		 *      Operators, -- are included in the "currently
+		 *      active" vocabulary.
+		 */
+
+		if ( create_current_alias( new_alias, old_name) )
+		    return(TRUE);
+	
+	    }    /*  End of separate handling for normal-tokenization mode
+        	  *      versus  "Tokenizer-Escape" mode
+		  */
+
+	    /*  It's not a word, a macro or any of that other stuff.  */
+	    tokenized_word_error(old_name);
+	    free(old_name);
+	}
+	free (new_alias);
+    }
+    return(FALSE);
+}
+
+	
+/* **************************************************************************
+ *
+ *      Function name:  string_err_check
+ *      Synopsis:       Error-check after processing or Ignoring
+ *                          simple strings
+ *
+ *      Inputs:
+ *         Parameters:
+ *             is_paren           TRUE if string is Dot-Paren  .( 
+ *                                    FALSE if Ess-Quote  ( s"  )
+ *             sav_lineno         Saved Line Number, for Unterminated Error
+ *             strt_lineno        Start Line Number, for Multiline Warning
+ *         Global Variables:
+ *             noerrors 	  TRUE if ignoring errors
+ *         Local Static Variables:
+ *             got_until_eof      TRUE if reached end of buffer before delim.
+ *
+ *      Outputs:
+ *         Returned Value:        TRUE if did not reach end of buffer, or,
+ *                                    if ignoring errors, TRUE anyway.
+ *
+ *      Error Detection:
+ *          Multi-line warning, "Unterminated" Error messages, as apppropriate
+ *
+ **************************************************************************** */
+
+static  bool string_err_check( bool is_paren,
+                                  unsigned int sav_lineno,
+				      unsigned int strt_lineno )
+{
+    bool retval = noerrors ;
+    char *item_typ = is_paren ?
+	"Dot-Paren" : "Ess-Quote" ;
+    if ( got_until_eof )   /*  Crude retrofit... */
+    {
+	warn_unterm( TKERROR, item_typ, sav_lineno );
+    }else{
+	retval = TRUE;
+	warn_if_multiline( item_typ, strt_lineno );
+	}
+    return( retval);
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  handle_internal
+ *      Synopsis:       Perform the functions associated with FORTH words
+ *                      that do not map directly to a single token.  This
+ *                      is the functions that will go into the FUNCT field
+ *                      of entries in the "FWords" and "Shared Words" lists.
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             pfield               Param-field of the  tic_hdr_t  -type entry
+ *                                      associated with the FORTH-Word (FWord)
+ *                                      just read that is being "handled".
+ *         Global Variables:
+ *             statbuf              The word that was just read.
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *         Global Variables:
+ *             statbuf              More words may be read.
+ *
+ *      Error Detection:
+ *          Too numerous to list here...
+ *
+ *      Process Explanation:
+ *          Recast the type of the param-field of a  tic_hdr_t -type
+ *              entry and rename it "tok".
+ *          The "tok" will be used as the control-expression for a
+ *              SWITCH statement with a large number of CASE labels.
+ *              Both "FWords" and "shared_words" list entries will
+ *              be processed by this routine.
+ *      
+ *      Revision History:
+ *      Updated Wed, 20 Jul 2005 by David L. Paktor
+ *          Put handling of  ABORT"  under control of a run-time
+ *              command-line switch.
+ *          Put decision to support IBM-style Locals under control
+ *              of a run-time command-line switch.
+ *      Updated Tue, 17 Jan 2006 by David L. Paktor
+ *          Convert to handler for  tic_hdr_t  type vocab entries.
+ *
+ *      Extraneous Remarks:
+ *          We would prefer to keep this function private, so we will
+ *              declare its prototype here and in the one other file
+ *              where we need it, namely, dictionary.c, rather than
+ *              exporting it widely in a  .h  file.
+ *
+ **************************************************************************** */
+
+void handle_internal( tic_param_t pfield);
+void handle_internal( tic_param_t pfield)
+{
+	fwtoken tok = pfield.fw_token;
+
+	signed long wlen;
+	unsigned int sav_lineno = lineno;    /*  For error message  */
+
+	bool handy_toggle = TRUE ;   /*  Various uses...   */
+	
+#ifdef DEBUG_SCANNER
+	printf("%s:%d: debug: tokenizing control word '%s'\n",
+						iname, lineno, statbuf);
+#endif
+	switch (tok) {
+	case BEGIN:
+		emit_begin();
+		break;
+
+	case BUFFER:
+		if ( create_word(tok) )
+		{
+		emit_token("b(buffer:)");
+		}
+		break;
+
+	case CONST:
+		if ( create_word(tok) )
+		{
 		emit_token("b(constant)");
+		}
 		break;
 
 	case COLON:
-		create_word();
+		{
+		    /*  Collect error- -detection or -reporting items,
+		     *      but don't commit until we're sure the
+		     *      creation was a success.
+		     */
+		    u16 maybe_last_colon_fcode = nextfcode ;
+		    unsigned int maybe_last_colon_lineno = lineno;
+		    unsigned int maybe_last_colon_abs_token_no = abs_token_no;
+		    unsigned int maybe_last_colon_do_depth = do_loop_depth;
+		    /*  last_colon_defname
+		     *     has to wait until after call to  create_word()
+		     */
+
+		    if ( create_word(tok) )
+		    {
+			last_colon_fcode = maybe_last_colon_fcode;
+			last_colon_lineno = maybe_last_colon_lineno;
+			last_colon_abs_token_no = maybe_last_colon_abs_token_no;
+			last_colon_do_depth = maybe_last_colon_do_depth;
+			collect_input_filename( &last_colon_filename);
+			/*  Now we can get  last_colon_defname  */
+			if ( last_colon_defname != NULL )
+			{
+			    free( last_colon_defname);
+			}
+			last_colon_defname = strdup(statbuf);
+
 		emit_token("b(:)");
 		incolon=TRUE;
+			hide_last_colon();
+			lastcolon = opc;
+		    }
+		}
 		break;
 	
 	case SEMICOLON:
+		if ( test_in_colon("SEMICOLON", TRUE, TKERROR, NULL) )
+		{
+		    ret_stk_balance_rpt( "termination,", TRUE);
+		    /*  Clear Control Structures just back to where
+		     *      the current Colon-definition began.
+		     */
+		    clear_control_structs_to_limit(
+			"End of colon-definition", last_colon_abs_token_no);
+
+		    if ( ibm_locals )
+		    {
+			finish_locals();
+			forget_locals();
+		    }
+
 		emit_token("b(;)");
 		incolon=FALSE;
+		    reveal_last_colon();
+		}
 		break;
 
 	case CREATE:
-		create_word();
+		if ( create_word(tok) )
+		{
 		emit_token("b(create)");
+		}
 		break;
 
 	case DEFER:
-		create_word();
+		if ( create_word(tok) )
+		{
 		emit_token("b(defer)");
+		}
+		break;
+
+	case ALLOW_MULTI_LINE:
+		report_multiline = FALSE;
+		break;
+
+	case OVERLOAD:
+		if ( test_in_colon(statbuf, FALSE, WARNING, NULL) )
+		{
+		    do_not_overload = FALSE;
+		}
+		break;
+
+	case DEFINED:
+		if (get_word_in_line( statbuf) )
+		{
+		    eval_user_symbol(statbuf);
+		}
+		break;
+
+	case CL_FLAG:
+		if (get_word_in_line( statbuf) )
+		{
+		     set_cl_flag( statbuf, TRUE);
+		}
+		break;
+
+	case SHOW_CL_FLAGS:
+		show_all_cl_flag_settings( TRUE);
 		break;
 
 	case FIELD:
-		create_word();
+		if ( create_word(tok) )
+		{
 		emit_token("b(field)");
+		}
 		break;
 
 	case VALUE:
-		create_word();
+		if ( create_word(tok) )
+		{
 		emit_token("b(value)");
+		}
 		break;
 		
 	case VARIABLE:
-		create_word();
+		if ( create_word(tok) )
+		{
 		emit_token("b(variable)");
-		break;
-
-	case EXTERNAL:
-		flags=FLAG_EXTERNAL;
-		break;
-
-	case TOKENIZE:
-		emit_token("b(')");
+		}
 		break;
 
 	case AGAIN:
-		emit_token("bbranch");
-		offs1=dpop()-(unsigned long)opc;
-		emit_offset(offs1);
+		emit_again();
 		break;
 
 	case ALIAS:
-		wlen=get_word();
-		name=strdup((char *)statbuf);
-		wlen=get_word();
-		alias=strdup((char *)statbuf);
-		if(lookup_macro(name))
-			printf("%s:%d: warning: duplicate alias\n", 
-							iname, lineno);
-		add_macro(name,alias);
+		if ( create_alias() )
+		{
+		    trace_creation( ALIAS, statbuf);
+		}
 		break;
 
 	case CONTROL:
-		wlen=get_word();
-		emit_token("b(lit)");
-		emit_num32(statbuf[0]&0x1f);
+		if ( get_word_in_line( statbuf) )
+		{
+		    emit_literal(statbuf[0]&0x1f);
+		}
 		break;
 
 	case DO:
 		emit_token("b(do)");
-		dpush((unsigned long)opc);
-		emit_offset(0);
-		dpush((unsigned long)opc);
+		mark_do();
 		break;
 
 	case CDO:
 		emit_token("b(?do)");
-		dpush((unsigned long)opc);
-		emit_offset(0);
-		dpush((unsigned long)opc);
+		mark_do();
 		break;
 
 	case ELSE:
-		offs2=dpop();
-		emit_token("bbranch");
-		dpush((unsigned long)opc);
-		emit_offset(0);
-		emit_token("b(>resolve)");
-		offs1=(unsigned long)opc;
-		opc=(u8 *)offs2;
-		offs2=offs1-(unsigned long)opc;
-		emit_offset(offs2);
-		opc=(u8 *)offs1;
+		emit_else();
 		break;
 
 	case CASE:
-		emit_token("b(case)");
-		dpush(0);
+		emit_case();
 		break;
 
 	case ENDCASE:
-		/* first emit endcase, then calculate offsets. */
-		emit_token("b(endcase)");
-		
-		offs1=(unsigned long)opc;
-		
-		offs2=dpop();
-		while (offs2) {
-			u16 tmp;
-			
-			opc=(u8 *)(ostart+offs2);
-
-			/* we're using an fcode offset to temporarily
-			 * store our linked list. At this point we take
-			 * the signed fcode offset as unsigned as we know
-			 * that the offset will always be >0. This code
-			 * is still broken for any case statement that
-			 * occurs after the fcode bytecode grows larger 
-			 * than 64kB
-			 */
-			tmp=receive_offset();
+		emit_endcase();
+		break;
 
-			offs2=(unsigned long)offs1-(unsigned long)opc;
+	case NEW_DEVICE:
+		handy_toggle = FALSE;
+	case FINISH_DEVICE:
+		finish_or_new_device( handy_toggle );
+		break;
 
-#if defined(DEBUG_SCANNER)
-			printf ("%s:%d: debug: endcase offset 0x%lx\n",
-				iname,lineno, (unsigned long)offs2);
-#endif
-			emit_offset(offs2);
-			offs2=tmp;
+	case FLITERAL:
+		{
+		    u32 val;
+		    val = dpop();
+		    emit_literal(val);
 		}
-		opc=(u8 *)offs1;
 		break;
 
 	case OF:
-		emit_token("b(of)");
-		dpush((unsigned long)(opc-ostart));
-		emit_offset(0);
+		emit_of();
 		break;
 
 	case ENDOF:
-		offs1=dpop();
-		emit_token("b(endof)");
-		
-		offs2=dpop();
-		dpush((unsigned long)(opc-ostart));
-		emit_offset(offs2);
-		
-		offs2=(unsigned long)(opc-ostart);
-		opc=(u8 *)(ostart+offs1);
-		offs1=offs2-offs1;
-		emit_offset(offs1);
+		emit_endof();
+		break;
 		
-		opc=(u8 *)(ostart+offs2);
+	case EXTERNAL:
+		set_hdr_flag( FLAG_EXTERNAL );
 		break;
 		
 	case HEADERLESS:
-		flags=0;
+		set_hdr_flag( FLAG_HEADERLESS );
 		break;
 	
 	case HEADERS:
-		flags=FLAG_HEADERS;
+		set_hdr_flag( FLAG_HEADERS );
 		break;
 
 	case DECIMAL:
 		/* in a definition this is expanded as macro "10 base !" */
-		if (incolon) {
-			emit_token("b(lit)");
-			emit_num32(0x0a);
-			emit_token("base");
-			emit_token("!");
-		} else
-			base=10;
+		base_change ( 0x0a );
 		break;
 		
 	case HEX:
-		if (incolon) {
-			emit_token("b(lit)");
-			emit_num32(0x10);
-			emit_token("base");
-			emit_token("!");
-		} else
-			base=16;
+		base_change ( 0x10 );
 		break;
 
 	case OCTAL:
-		if (incolon) {
-			emit_token("b(lit)");
-			emit_num32(0x08);
-			emit_token("base");
-			emit_token("!");
-		} else
-			base=8;
+		base_change ( 0x08 );
 		break;
 
 	case OFFSET16:
 		if (!offs16)
-			printf("%s:%d: switching to "
-				"16bit offsets.\n", iname, lineno);
+		{
+		    tokenization_error(INFO, "Switching to 16-bit offsets.\n");
+		}else{
+		    tokenization_error(WARNING,
+			"Call of OFFSET16 is redundant.\n");
+		}
 		emit_token("offset16");
 		offs16=TRUE;
 		break;
 
 	case IF:
-		emit_token("b?branch");
-		dpush((unsigned long)opc);
-		emit_offset(0);
+		emit_if();
+		break;
+
+/* **************************************************************************
+ *
+ *      Still to be done:
+ *          Correct analysis of Return-Stack usage within Do-Loops
+ *              or before Loop Elements like I and J or UNLOOP or LEAVE.
+ *
+ **************************************************************************** */
+	case UNLOOP:
+		emit_token("unloop");
+		must_be_deep_in_do(1);
 		break;
 
-	case CLEAVE:
 	case LEAVE:
 		emit_token("b(leave)");
+		must_be_deep_in_do(1);
+		break;
+
+	case LOOP_I:
+		emit_token("i");
+		must_be_deep_in_do(1);
+		break;
+
+	case LOOP_J:
+		emit_token("j");
+		must_be_deep_in_do(2);
 		break;
 		
 	case LOOP:
 		emit_token("b(loop)");
-		offs1=dpop();
-		offs2=offs1-(unsigned long)opc;
-		emit_offset(offs2);
-		offs1=(unsigned long)opc;
-		opc=(u8 *)dpop();
-		offs2=offs1-(unsigned long)opc;
-		emit_offset(offs2);
-		opc=(u8 *)offs1;
+		resolve_loop();
 		break;
 		
-	case CLOOP:
+	case PLUS_LOOP:
 		emit_token("b(+loop)");
-		offs1=dpop();
-		offs2=offs1-(unsigned long)opc;
-		emit_offset(offs2);
-		offs1=(unsigned long)opc;
-		opc=(u8 *)dpop();
-		offs2=offs1-(unsigned long)opc;
-		emit_offset(offs2);
-		opc=(u8 *)offs1;
-		break;
-
-	case GETTOKEN:
-		emit_token("b(')");
-		wlen=get_word();
-		itok=lookup_token((char *)statbuf);
-		if (itok==0xffff) {
-			printf("%s:%d: error: no such word '%s' in [']\n",
-					iname, lineno, statbuf);
-			ERROR;
+		resolve_loop();
+		break;
+
+
+	case INSTANCE:
+		{
+		    bool set_instance_state = FALSE;
+		    bool emit_instance = TRUE;
+		    /*  We will treat "instance" in a colon-definition as
+		     *      an error, but allow it to be emitted if we're
+		     *      ignoring errors; if we're not ignoring errors,
+		     *      there's no output anyway...
+		     */
+		    if ( test_in_colon(statbuf, FALSE, TKERROR, NULL) )
+		    {   /*   We are in interpretation (not colon) state.  */
+			/*  "Instance" not allowed during "global" scope  */ 
+			if ( scope_is_global )
+			{
+			    glob_not_allowed( WARNING, FALSE );
+			    emit_instance = FALSE;
+			}else{
+			    set_instance_state = TRUE;
+			}
+		    }
+		    if ( emit_instance )
+		    {
+			if ( set_instance_state )
+			{
+			    /*  "Instance" isn't cumulative....  */
+			    if ( is_instance )
+			    {
+				unresolved_instance( WARNING);
+			    }
+			    collect_input_filename( &instance_filename);
+			    instance_lineno = lineno;
+			    is_instance = TRUE;
+			    dev_change_instance_warning = TRUE;
+			}
+			emit_token("instance");
+		    }
 		}
-		/* FIXME check size, u16 or token */
-		emit_fcode(itok);
 		break;
 		
-	case ASCII:
-		wlen=get_word();
-		emit_token("b(lit)");
-		emit_num32(statbuf[0]);
+	case GLOB_SCOPE:
+		if ( test_in_colon(statbuf, FALSE, TKERROR, NULL) )
+		{
+		    if ( INVERSE( is_instance) )
+		    {
+			enter_global_scope();
+		    }else{
+			tokenization_error( TKERROR,
+			    "Global Scope not allowed.  "
+			    "\"Instance\" is in effect; issued" );
+			just_where_started( instance_filename,
+					        instance_lineno );
+		    }
+		}
 		break;
 
-	case CHAR:
-		if (incolon)
-			printf("%s:%d: warning: CHAR cannot be used inside "
-				"of a colon definition.\n", iname, lineno);
-		wlen=get_word();
-		emit_token("b(lit)");
-		emit_num32(statbuf[0]);
+	case DEV_SCOPE:
+		if ( test_in_colon(statbuf, FALSE, TKERROR, NULL) )
+		{
+		    resume_device_scope();
+		}
 		break;
 
+	case TICK:             /*    '    */
+		test_in_colon(statbuf, FALSE, WARNING, "[']");
+	case BRACK_TICK:       /*   [']   */
+		{
+		    tic_hdr_t *token_entry;
+		    if ( get_token( &token_entry) )
+		    {
+			emit_token("b(')");
+			/* Emit the token; warning or whatever comes gratis */
+			token_entry->funct( token_entry->pfield);
+		    }
+		}
+		break;
+
+	case F_BRACK_TICK:     /*  F['] <name>
+	        		*     emits the token-number for <name>
+				*  Mainly useful to compute the argument
+				*     to   get-token   or  set-token
+				*/
+		{
+		    tic_hdr_t *token_entry;
+		    if ( get_token( &token_entry) )
+		    {
+			/*  "Obsolete" warning doesn't come gratis here...  */
+			token_entry_warning( token_entry);
+			/*  In Tokenizer-Escape mode, push the token  */
+			if ( in_tokz_esc )
+			{
+			    dpush( token_entry->pfield.deflt_elem);
+			}else{
+			    emit_literal( token_entry->pfield.deflt_elem);
+			}
+		    }
+		}
+		break;
+
+	case CHAR:
+		handy_toggle = FALSE;
 	case CCHAR:
-		wlen=get_word();
-		emit_token("b(lit)");
-		emit_num32(statbuf[0]);
+		test_in_colon(statbuf, handy_toggle, WARNING,
+		    handy_toggle ? "CHAR" : "[CHAR]" );
+	case ASCII:
+		if ( get_word_in_line( statbuf) )
+		{
+		    emit_literal(statbuf[0]);
+		}
 		break;
 		
 	case UNTIL:
-		emit_token("b?branch");
-		emit_offset(dpop()-(unsigned long)opc);
+		emit_until();
 		break;
 
 	case WHILE:
-		emit_token("b?branch");
-		dpush((unsigned long)opc);
-		emit_offset(0);
+		emit_while();
 		break;
 		
 	case REPEAT:
-		emit_token("bbranch");
-		offs2=dpop();
-		offs1=dpop();
-		offs1-=(unsigned long)opc;
-		emit_offset(offs1);
-		
-		emit_token("b(>resolve)");
-		offs1=(unsigned long)opc;
-		opc=(u8 *)offs2;
-		emit_offset(offs1-offs2);
-		opc=(u8 *)offs1;
+		emit_repeat();
 		break;
 		
 	case THEN:
-		emit_token("b(>resolve)");
-		offs1=(unsigned long)opc;
-		opc=(u8 *)dpop();
-		offs2=offs1-(unsigned long)opc;
-		emit_offset(offs2);
-		opc=(u8 *)offs1;
+		emit_then();
 		break;
 
+	case IS:
+		tokenization_error ( INFO,
+		     "Substituting  TO  for deprecated  IS\n");
 	case TO:
+		if ( validate_to_target() )
+		{
 		emit_token("b(to)");
+		}
 		break;
 
 	case FLOAD:
+		if ( get_word_in_line( statbuf) )
 		{
-			u8 *oldstart, *oldpc, *oldend;
-			char *oldiname;
-			int oldlineno;
-
-			wlen=get_word();
+		    bool stream_ok ;
 			
-			oldstart=start; oldpc=pc; oldend=end; 
-			oldiname=iname; oldlineno=lineno;
+		    push_source( close_stream, NULL, TRUE) ;
 			
-			init_stream((char *)statbuf);
-			tokenize();
-			close_stream();
+		    tokenization_error( INFO, "FLOADing %s\n", statbuf );
 			
-			iname=oldiname; lineno=oldlineno;
-			end=oldend; pc=oldpc; start=oldstart;
+		    stream_ok = init_stream( statbuf );
+		    if ( INVERSE( stream_ok) )
+		    {
+			drop_source();
+		    }
 		}
 		break;
 
-	case STRING:
-		if (*pc++=='\n') lineno++;
-		wlen=get_string();
+	case STRING:         /*  Double-Quote ( " ) string  */
+		handy_toggle = FALSE;
+	case PSTRING:        /*  Dot-Quote  ( ." ) string   */
+		wlen=get_string( TRUE);
 		emit_token("b(\")");
-		emit_string(statbuf,wlen-1);
+		emit_string(statbuf, wlen);
+		if ( handy_toggle )
+		{
+		    emit_token("type");
+		}
 		break;
 
-	case PSTRING:
+	case SSTRING:        /*  Ess-Quote  ( s"  ) string  */
+		handy_toggle = FALSE;
+	case PBSTRING:       /*  Dot-Paren  .(   string  */
 		if (*pc++=='\n') lineno++;
-		wlen=get_string();
+		{
+		    unsigned int strt_lineno = lineno;
+		    wlen = get_until( handy_toggle ? ')' : '"' );
+		    if ( string_err_check( handy_toggle,
+		             sav_lineno, strt_lineno) )
+		    {
 		emit_token("b(\")");
-		emit_string(statbuf,wlen-1);
+			emit_string(statbuf, wlen);
+			if ( handy_toggle )
+			{
 		emit_token("type");
+			}
+		    }
+		}
 		break;
 
-	case PBSTRING:
-		if (*pc++=='\n') lineno++;
-		get_until(')');
+	case FUNC_NAME:
+		if ( test_in_colon( statbuf, TRUE, TKERROR, NULL) )
+		{
+		    if ( in_tokz_esc )
+		    {
+			tokenization_error( P_MESSAGE, "Currently" );
+			in_last_colon();
+		    }else{
 		emit_token("b(\")");
-		emit_string(statbuf,strlen((char *)statbuf)-1);
-		emit_token("type");
+			emit_string( last_colon_defname,
+		            strlen( last_colon_defname) );
+			/*  if ( hdr_flag == FLAG_HEADERLESS ) { WARNING } */
+		    }
+		}
 		break;
 
-	case SSTRING:
-		if (*pc++=='\n') lineno++;
-		get_until('"');
+	case IFILE_NAME:
 		emit_token("b(\")");
-		emit_string(statbuf,strlen((char *)statbuf)-1);
-		pc++; /* skip " */
+		emit_string( iname, strlen( iname) );
 		break;
 
-	case HEXVAL:
-		{
-			u8 basecpy=base;
-			long val;
+	case ILINE_NUM:
+		emit_literal( lineno);
+		break;
 			
-			base=0x10;
-			wlen=get_word();
-			if (!get_number(&val)) {
-				emit_token("b(lit)");
-				emit_num32(val);
-			} else {
-				printf("%s:%d: warning: illegal value in h#"
-						" ignored\n", iname, lineno);
-			}
-			base=basecpy;
-		}
+	case HEXVAL:
+		base_val (0x10);
 		break;
 		
 	case DECVAL:
-		{
-			u8 basecpy=base;
-			long val;
-
-			base=0x0a;
-			wlen=get_word();
-			if (!get_number(&val)) {
-				emit_token("b(lit)");
-				emit_num32(val);
-			} else {
-				printf("%s:%d: warning: illegal value in d#"
-						" ignored\n", iname, lineno);
-			}
-			
-			base=basecpy;
-		}
+		base_val (0x0a);
 		break;
 		
 	case OCTVAL:
+		base_val (8);
+		break;
+
+	case ASC_LEFT_NUM:
+		handy_toggle = FALSE;
+	case ASC_NUM:
+		if (get_word_in_line( statbuf) )
 		{
-			u8 basecpy=base;
-			long val;
-
-			base=0x08;
-			wlen=get_word();
-			if (!get_number(&val)) {
-				emit_token("b(lit)");
-				emit_num32(val);
+		    if ( handy_toggle )
+		    {
+			ascii_right_number( statbuf);
 			} else {
-				printf("%s:%d: warning: illegal value in o#"
-						" ignored\n", iname, lineno);
+			ascii_left_number( statbuf);
 			}
-
-			base=basecpy;
 		}
 		break;
-	case BEGINTOK:
-		intok=TRUE;
+
+	case CONDL_ENDER:   /*  Conditional directives out of context  */
+	case CONDL_ELSE:
+		tokenization_error ( TKERROR,
+		    "No conditional preceding %s directive\n",
+			strupr(statbuf) );
+		break;
+
+	case PUSH_FCODE:
+		tokenization_error( INFO,
+		    "FCode-token Assignment Counter of 0x%x "
+		    "has been saved on stack.\n", nextfcode );
+		dpush( (long)nextfcode );
 		break;
 
-	case EMITBYTE:
-		if (intok)
-			emit_byte(dpop());
-		else 
-			printf ("%s:%d: warning: emit-byte outside tokenizer"
-					" scope\n", iname, lineno);
+	case POP_FCODE:
+		pop_next_fcode();
 		break;
 
-	case NEXTFCODE:
-		if (intok)
-			nextfcode=dpop();
-		else
-			printf("%s:%d: warning: next-fcode outside tokenizer"
-					" scope\n", iname, lineno);
+	case RESET_FCODE:
+		tokenization_error( INFO,
+		    "Encountered %s.  Resetting FCode-token "
+			"Assignment Counter.  ", strupr(statbuf) );
+		list_fcode_ranges( FALSE);
+		reset_fcode_ranges();
 		break;
 		
-	case ENDTOK:
-		intok=FALSE;
+	case EXIT:
+		if ( test_in_colon( statbuf, TRUE, TKERROR, NULL)
+		     || noerrors )
+		{
+		    ret_stk_balance_rpt( NULL, FALSE);
+		    if ( ibm_locals )
+		    {
+			finish_locals ();
+		    }
+		    emit_token("exit");
+		}
+		break;
+
+	case ESCAPETOK:
+		enter_tokz_esc();
 		break;
 	
 	case VERSION1:
 	case FCODE_V1:
-		printf("%s:%d: using version1 header\n", iname, lineno);
-		emit_token("version1");
-		fcode_hdr=opc;
-		emit_fcodehdr();
-		offs16=FALSE;
+		tokenization_error( INFO, "Using version1 header "
+		    "(8-bit offsets).\n");
+		fcode_starter( "version1", 1, FALSE) ;
 		break;
 	
 	case START1:
 	case FCODE_V2:
 	case FCODE_V3: /* Full IEEE 1275 */
-		emit_token("start1");
-		fcode_hdr=opc;
-		emit_fcodehdr();
-		offs16=TRUE;
+		fcode_starter( "start1", 1, TRUE);
 		break;
 		
 	case START0:
-		printf ("%s:%d: warning: spread of 0 not supported.", 
-				iname, lineno);
-		emit_token("start0");
-		fcode_hdr=opc;
-		emit_fcodehdr();
-		offs16=TRUE;
+		fcode_starter( "start0", 0, TRUE);
 		break;
 		
 	case START2:
-		printf ("%s:%d: warning: spread of 2 not supported.", 
-			iname, lineno);
-		emit_token("start2");
-		fcode_hdr=opc;
-		emit_fcodehdr();
-		offs16=TRUE;
+		fcode_starter( "start2", 2, TRUE);
 		break;
 		
 	case START4:
-		printf ("%s:%d: warning: spread of 4 not supported.", 
-			iname, lineno);
-		emit_token("start4");
-		fcode_hdr=opc;
-		emit_fcodehdr();
-		offs16=TRUE;
+		fcode_starter( "start4", 4, TRUE);
 		break;
 		
+	case END1:
+		tokenization_error( WARNING, 
+		    "Appearance of END1 in FCode source code "
+			"is not intended by IEEE 1275-1994\n");
+		handy_toggle = FALSE;
 	case END0:
 	case FCODE_END:
-		haveend=TRUE;
-		emit_token("end0");
+		if ( handy_toggle )
+		{
+		    you_are_here();
+		}
+		emit_token( handy_toggle ? "end0" : "end1" );
+		fcode_ender();
+		FFLUSH_STDOUT
 		break;
 
-	case END1:
-		haveend=TRUE;
-		emit_token("end1");
+	case RECURSE:
+		if ( test_in_colon(statbuf, TRUE, TKERROR, NULL ) )
+		{
+		    emit_fcode(last_colon_fcode);
+		}
 		break;
 		
+
 	case RECURSIVE:
+		if ( test_in_colon(statbuf, TRUE, TKERROR, NULL ) )
+		{
+		    reveal_last_colon();
+		}
+		break;
+
+	case RET_STK_FETCH:
+		ret_stk_access_rpt();
+		emit_token( "r@");
+		break;
+
+	case RET_STK_FROM:
+		ret_stk_access_rpt();
+		bump_ret_stk_depth( -1);
+		emit_token( "r>");
+		break;
+
+	case RET_STK_TO:
+		bump_ret_stk_depth( 1);
+		emit_token( ">r");
 		break;
 
 	case PCIHDR:
-		{
-			u32 classid=dpop();
-			u16 did=dpop();
-			u16 vid=dpop();
-			
-			pci_hdr=opc;
-			emit_pcihdr(vid, did, classid);
-			
-			printf("%s:%d: PCI header vendor id=0x%04x, "
-				"device id=0x%04x, class=%06x\n",
-				iname, lineno, vid, did, classid);
-		}
+		emit_pcihdr();
 		break;
 	
 	case PCIEND:
-		if (!pci_hdr) {
-			printf("%s:%d: error: pci-header-end/pci-end "
-				"without pci-header\n", iname, lineno);
-			ERROR;
-		}
 		finish_pcihdr();
+		reset_fcode_ranges();
+		FFLUSH_STDOUT
 		break;
 
 	case PCIREV:
-		pci_revision=dpop();
-		printf("%s:%d: PCI header revision=0x%04x\n", 
-				iname, lineno, pci_revision);
+		pci_image_rev = dpop();
+		tokenization_error( INFO,
+		    "PCI header revision=0x%04x%s\n", pci_image_rev,
+			big_end_pci_image_rev ?
+			    ".  Will be saved in Big-Endian format."
+			    : ""  );
 		break;
 
 	case NOTLAST:
-		pci_is_last_image=FALSE;
-		printf("%s:%d: PCI header not last image!\n",
-				iname, lineno);
+		handy_toggle = FALSE;
+	case ISLAST:
+		dpush(handy_toggle);
+	case SETLAST:
+		{
+		    u32 val = dpop();
+		    bool new_pili = BOOLVAL( (val != 0) );
+		    if ( pci_is_last_image != new_pili )
+		    {
+			tokenization_error( INFO,
+			    new_pili ?
+				"Last image for PCI header.\n" :
+				"PCI header not last image.\n" );
+			pci_is_last_image = new_pili;
+		    }
+		}
 		break;
 		
-	case ABORTTXT:
-		/* ABORT" is not to be used in FCODE drivers
-		 * but Apple drivers do use it. Therefore we
-		 * allow it. We push the specified string to
-		 * the stack, do -2 THROW and hope that THROW
-		 * will correctly unwind the stack.
-		 */
-		
-		printf("%s:%d: warning: ABORT\" in fcode not defined by "
-				"IEEE 1275-1994.\n", iname, lineno);
-		if (*pc++=='\n') lineno++;
-		wlen=get_string();
-		
-#ifdef BREAK_COMPLIANCE
-		/* IF */
-		emit_token("b?branch");
-		
-		dpush((unsigned long)opc);
-		emit_offset(0);
-#endif
-		emit_token("b(\")");
-		emit_string(statbuf,wlen-1);
-#ifdef BREAK_COMPLIANCE
-		emit_token("type");
-#endif
-		emit_token("-2");
-		emit_token("throw");
-#ifdef BREAK_COMPLIANCE
-		/* THEN */
-		emit_token("b(>resolve)");
-		offs1=(unsigned long)opc;
-		opc=(u8 *)dpop();
-		offs2=offs1-(unsigned long)opc;
-		emit_offset(offs2);
-		opc=(u8 *)offs1;
-#endif
+	case SAVEIMG:
+		if (get_word_in_line( statbuf) )
+		{
+		    free(oname);
+		    oname = strdup( statbuf );
+		    tokenization_error( INFO,
+			"Output is redirected to file:  %s\n", oname);
+		}
 		break;
 
-	case FCODE_DATE:
+	case RESETSYMBS:
+		tokenization_error( INFO,
+		    "Resetting symbols defined in %s mode.\n",
+			in_tokz_esc ? "tokenizer-escape" : "\"normal\"");
+		if ( in_tokz_esc )
 		{
-			time_t tt;
-			char fcode_date[11];
-			
-			tt=time(NULL);
-			strftime(fcode_date, 11, "%m/%d.%Y", 
-					localtime(&tt));
-			emit_token("b(\")");
-			emit_string((u8 *)fcode_date,10);
+		    reset_tokz_esc();
+		}else{
+		    reset_normal_vocabs();
 		}	
 		break;
 
+	case FCODE_DATE:
+		handy_toggle = FALSE;
 	case FCODE_TIME:
 		{
 			time_t tt;
-			char fcode_time[9];
+		    char temp_buffr[32];
 			
 			tt=time(NULL);
-			strftime(fcode_time, 9, "%H:%M:%S", 
-					localtime(&tt));
+		    if ( handy_toggle )
+		    {
+			strftime(temp_buffr, 32, "%T %Z", localtime(&tt));
+		    }else{
+			strftime(temp_buffr, 32, "%m/%d/%Y", localtime(&tt));
+		    }
+		    if ( in_tokz_esc )
+		    {
+			tokenization_error( MESSAGE, temp_buffr);
+		    }else{
 			emit_token("b(\")");
-			emit_string((u8 *)fcode_time,8);
+			emit_string((u8 *)temp_buffr, strlen(temp_buffr) );
+		    }
 		}
 		break;
 
 	case ENCODEFILE:
-		wlen=get_word();
+		if (get_word_in_line( statbuf) )
+		{
 		encode_file( (char*)statbuf );
+		}
 		break;
 
 	default:
-		printf("%s:%d: error: Unimplemented control word '%s'\n",
-				iname, lineno, statbuf);
-		ERROR;
+	    /*  IBM-style Locals, under control of a switch  */
+	    if ( ibm_locals )
+	    {
+		bool found_it = TRUE;
+		switch (tok) {
+		    case CURLY_BRACE:
+			declare_locals( FALSE);
+			break;
+		    case DASH_ARROW:
+			assign_local();
+			break;
+		    default:
+			found_it = FALSE;
 	}
+		if ( found_it ) break;
 }
 
-void tokenize(void)
+	    /*  Down here, we have our last chance to recognize a token.
+	     *      If  abort_quote  is disallowed, we will still consume
+	     *      the string.  In case the string spans more than one
+	     *      line, we want to make sure the line number displayed
+	     *      in the error-message is the one on which the disallowed
+	     *       abort_quote  token appeared, not the one where the
+	     *      string ended; therefore, we might need to be able to
+	     *      "fake-out" the line number...
+	     */
 {
-	unsigned long wlen;
-	u16 tok;
-	u8 *mac;
-	long val;
+		bool fake_out_lineno = FALSE;
+		unsigned int save_lineno = lineno;
+		unsigned int true_lineno;
+		if ( abort_quote( tok) )
+		{   break;
+		}else{
+		    if ( tok == ABORTTXT )  fake_out_lineno = TRUE;
+		}
+		true_lineno = lineno;
+
+		if ( fake_out_lineno )  lineno = save_lineno;
+		tokenization_error ( TKERROR,
+		    "Unimplemented control word '%s'\n", strupr(statbuf) );
+		if ( fake_out_lineno )  lineno = true_lineno;
+	    }
+	}
+}
 	
-	while ((wlen=get_word())!=0) {
+/* **************************************************************************
+ *
+ *      Function name:  skip_string
+ *      Synopsis:       When Ignoring, skip various kinds of strings.  Maps
+ *                          to string-handlers in handle_internal()...
+ *
+ *      Associated FORTH words:                 Double-Quote ( " ) string
+ *                                              Dot-Quote  ( ." ) string
+ *                                              Ess-Quote  ( s"  ) string
+ *                                              Dot-Paren  .(   string
+ *                                              ABORT" (even if not enabled)
+ *             { (Local-Values declaration) and -> (Local-Values assignment)
+ *                  are also handled if  ibm_locals  is enabled.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             pfield               Param-field of the entry associated with
+ *                                      the FWord that is being Ignored.
+ *         Global Variables:
+ *             statbuf              The word that was just read.
+ *             pc                   Input-stream pointer
+ *             lineno               Line-number, used for errors and warnings
+ *             ibm_locals           TRUE if IBM-style Locals are enabled
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *
+ *      Error Detection:
+ *          Multi-line warnings, "Unterminated" Errors
+ *              handled by called routines
+ *
+ *      Extraneous Remarks:
+ *          We would prefer to keep this function private, too, so we
+ *              will declare its prototype here and in the one other
+ *              file where we need it, namely, dictionary.c, rather
+ *              than exporting it widely in a  .h  file.
+ *
+ **************************************************************************** */
 
-		/* Filter comments */
-		switch (statbuf[0]) {
-		case '\\':
-			pc-=wlen;
-			get_until('\n');
-			continue;
+void skip_string( tic_param_t pfield);
+void skip_string( tic_param_t pfield)
+{
+    fwtoken tok = pfield.fw_token;
+    unsigned int sav_lineno = lineno;
+    bool handy_toggle = TRUE ;   /*  Various uses...   */
 			
-		case '(':
-			/* only a ws encapsulated '(' is a stack comment */
-			if (statbuf[1])
+    switch (tok) {
+    case STRING:         /*  Double-Quote ( " ) string    */
+    case PSTRING:        /*  Dot-Quote  ( ." ) string     */
+    case ABORTTXT:       /*  ABORT", even if not enabled  */
+	get_string( FALSE);   /*  Don't truncate; ignoring anyway  */
+	/*  Will handle multi-line warnings, etc.   */
 				break;
 			
-			pc-=wlen;
-			get_until(')');
+    case SSTRING:        /*  Ess-Quote  ( s"  ) string  */
+	handy_toggle = FALSE;
+    case PBSTRING:       /*  Dot-Paren  .(   string  */
 			if (*pc++=='\n') lineno++;
+	{
+	    unsigned int strt_lineno = lineno;
+	    get_until( handy_toggle ? ')' : '"' );
+	    string_err_check( handy_toggle, sav_lineno, strt_lineno );
+	}
+	break;
+
+    default:
+	/*  IBM-style Locals, under control of a switch  */
+	if ( ibm_locals )
+	{
+	    bool found_it = TRUE;
+	    switch (tok) {
+		case CURLY_BRACE:
+		    declare_locals( TRUE);
+		    break;
+		case DASH_ARROW:
+		    get_word();
+		    break;
+		default:
+		    found_it = FALSE;
+	    }
+	    if ( found_it ) break;
+	}
+
+	tokenization_error ( FATAL,  "Program Error.  "
+	    "Unimplemented skip-string word '%s'\n", strupr(statbuf) );
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  process_remark
+ *      Synopsis:       The active function for remarks (backslash-space)
+ *                          and comments (enclosed within parens)
+ *
+ *      Associated FORTH word(s):        \   (         
+ *
+ *      Inputs:
+ *         Parameters:
+ *             TIC entry "parameter field", init'd to delimiter character.
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *
+ *      Error Detection:
+ *          Warning if end-of-file encountered before delimiter.
+ *          Warning if multi-line parentheses-delimited comment.
+ *
+ *      Process Explanation:
+ *          Skip until the delimiter.
+ *          If end-of-file was encountered, issue Warning.
+ *          Otherwise, and if delimiter was not new-line,
+ *              check for multi-line with Warning.
+ *
+ **************************************************************************** */
+
+void process_remark( tic_param_t pfield )
+{
+    char until_char = (char)pfield.deflt_elem ;
+    unsigned int start_lineno = lineno;
+
 #ifdef DEBUG_SCANNER
+
+    get_until(until_char);
 			printf ("%s:%d: debug: stack diagram: %s)\n",
 						iname, lineno, statbuf);
-#endif
-			continue;
-		}
+#else
 
-		/* Check whether a macro with given name exists */
+    if ( skip_until( until_char) )
+    {
+	if ( until_char == '\n' )
+	{
+	    /*  Don't need any saved line number here ...  */
+	    tokenization_error ( WARNING,
+		"Unterminated remark.\n");
+	}else{
+	    warn_unterm( WARNING, "comment", start_lineno);
+	}
+    }else{
+	if ( until_char != '\n' )
+	{
+	    pc++;
+	    warn_if_multiline( "comment", start_lineno);
+	}
+    }
+#endif  /*  DEBUG_SCANNER  */
+}
 		
-		mac=(u8 *)lookup_macro((char *)statbuf);
-		if(mac) {
-			u8 *oldstart, *oldpc, *oldend;
-#ifdef DEBUG_SCANNER
-			printf("%s:%d: debug: macro %s folds out to sequence"
-				" '%s'\n", iname, lineno, statbuf, mac);
-#endif	
-			oldstart=start; oldpc=pc; oldend=end;
-			start=pc=end=mac;
-			end+=strlen((char *)mac);
 			
-			tokenize();
+/* **************************************************************************
+ *
+ *      Function name:  filter_comments
+ *      Synopsis:       Process remarks and comments in special conditions
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             inword             Current word just parsed
+ *
+ *      Outputs:
+ *         Returned Value:        TRUE if Current word is a Comment-starter.
+ *                                    Comment will be processed
+ *
+ *      Process Explanation:
+ *          We want to be able to recognize any alias the user may have
+ *              defined to a comment-delimiter, in whatever applicable
+ *              vocabulary it might be.
+ *          The active-function of any such alias will, of necessity, be
+ *              the  process_remark()  routine, defined just above.
+ *          We will search for the TIC-entry of the given word; if we don't    
+ *              find it, it's not a comment-delimiter.  If we do find it, 
+ *              and it is one, we invoke its active-function and return TRUE.
+ *          We also want to permit the "allow-multiline-comments" directive   
+ *              to be processed in the context that calls this routine, so
+ *              we will check for that condition, too.
+ *
+ **************************************************************************** */
 
-			end=oldend; pc=oldpc; start=oldstart;
+bool filter_comments( u8 *inword)
+{
+    bool retval = FALSE;
+    tic_hdr_t *found = lookup_word( inword, NULL, NULL );
 			
-			continue;
+    if ( found != NULL )
+    {
+	if ( found->funct == process_remark )
+	{
+	    found->funct( found->pfield);
+	    retval = TRUE;
+	}else{
+	    /*  Permit the "allow-multiline-comments" directive  */
+	    if ( found->funct == handle_internal )
+	    {
+	        if ( found->pfield.fw_token == ALLOW_MULTI_LINE )
+		{
+		    /*   Make sure any intended side-effects occur...  */
+		    found->funct( found->pfield);
+		    retval = TRUE;
+		}
+	    }
+	}
+    }
+    return ( retval );
 		}
 
-		/* Check whether it's a non-fcode forth construct */
 		
-		tok=lookup_fword((char *)statbuf);
-		if (tok!=0xffff) {
-#ifdef DEBUG_SCANNER
-			printf("%s:%d: debug: matched internal opcode 0x%04x\n",
-					iname, lineno, tok);
-#endif
-			handle_internal(tok);
-#ifdef DEBUG_SCANNER
-			if (verbose)
-				printf("%s:%d: debug: '%s' done.\n",
-					iname,lineno,statbuf);
-#endif
-			continue;
-		}
+/* **************************************************************************
+ *
+ *      Function name:  tokenize_one_word
+ *      Synopsis:       Tokenize the currently-obtained word
+ *                          along with whatever it consumes.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             wlen       Length of symbol just retrieved from the input stream
+ *                              This is not really used here any more; it's
+ *                              left over from an earlier implementation.
+ *         Global Variables:        
+ *             statbuf      The symbol (word) just retrieved from input stream.
+ *             in_tokz_esc  TRUE if "Tokenizer-Escape" mode is in effect; a
+ *                              different set of vocabularies from "Normal"
+ *                              mode will be checked (along with those that
+ *                              are common to both modes).  
+ *             ibm_locals   Controls whether to check for IBM-style Locals;
+ *                              set by means of a command-line switch.
+ *
+ *      Outputs:
+ *         Returned Value:      NONE
+ *         Global Variables:         
+ *             statbuf          May be incremented    
+ *             in_tokz_esc      May be set if the word just retrieved is
+ *                                  the  tokenizer[   directive. 
+ *             tic_found        
+ *
+ *      Error Detection:
+ *           If the word could neither be identified nor processed as a number,
+ *               that is an ERROR; pass it to  tokenized_word_error  for a
+ *               message.
+ *
+ *      Process Explanation:
+ *          Look for the word in each of the various lists and vocabularies
+ *              in which it might be found, as appropriate to the current
+ *              state of activity.
+ *          If found, process it accordingly.
+ *          If not found, try to process it as a number.
+ *          If cannot process it as a number, declare an error.
+ *
+ *      Revision History:
+ *          Updated Tue, 10 Jan 2006 by David L. Paktor
+ *              Convert to  tic_hdr_t  type vocabularies.
+ *          Updated Mon, 03 Apr 2006 by David L. Paktor
+ *             Replaced bulky "Normal"-vs-"Escape" block with a call
+ *                 to  lookup_word .  Attend to a small but important
+ *                 side-effect of the "handle_<vocab>" routines that
+ *                 feeds directly into the protection against self-
+ *                 -recursion in a user-defined Macro:  Set the global
+ *                 variable  tic_found  to the entry, just before we
+ *                 execute it, and we're good to go... 
+ *
+ *      Extraneous Remarks:
+ *          We trade off the strict rules of structure for simplicity
+ *              of coding.
+ *
+ **************************************************************************** */
 		
-		/* Check whether it's one of the defined fcode words */
+void tokenize_one_word( signed long wlen )
+{
 		
-		tok=lookup_token((char *)statbuf);
-		if (tok!=0xffff) {
-#ifdef DEBUG_SCANNER
-			printf("%s:%d: debug: matched fcode no 0x%04x\n",
-					iname, lineno, tok);
-#endif
-			emit_fcode(tok);
-			continue;
-		}
+    /*  The shared lookup routine now handles everything.   */
+    tic_hdr_t *found = lookup_word( statbuf, NULL, NULL );
 		
-		/* It's not a word or macro - is it a number? */
+    if ( found != NULL )
+    {
+	tic_found = found;
+	found->funct( found->pfield);
+	return ;
+    }
 		
-		if (!get_number(&val)) {
-			if (intok)
-				dpush(val);
-			else {
-				emit_fcode(lookup_token("b(lit)"));
-				emit_num32(val);
+    /*  It's not a word in any of our current contexts.
+     *      Is it a number?
+     */
+    if ( handle_number() )
+    {
+	return ;
 			}
-			continue;
+
+    /*  Could not identify - give a shout. */
+    tokenized_word_error( statbuf );
 		}
 
-		/* could not identify - bail out. */
+/* **************************************************************************
+ *
+ *      Function name:  tokenize
+ *      Synopsis:       Tokenize the current input stream.
+ *                          May be called recursively for macros and such.
+ *
+ *      Revision History:
+ *      Updated Thu, 24 Mar 2005 by David L. Paktor
+ *          Factor-out comment-filtration; apply to  gather_locals
+ *          Factor-out tokenizing a single word (for conditionals)
+ *          Separate actions of "Tokenizer-Escape" mode.
+ *
+ **************************************************************************** */
+
+void tokenize(void)
+{
+    signed long wlen = 0;
 		
-		printf("%s:%d: error: word '%s' is not in dictionary.\n",
-				iname, lineno, statbuf);
-		ERROR;
+    while ( wlen >= 0 )
+    {
+	wlen = get_word();
+	if ( wlen > 0 )
+	{
+	    tokenize_one_word( wlen );
+	}
 	}
 }
 
diff --git a/toke/scanner.h b/toke/scanner.h
new file mode 100644
index 0000000..173c907
--- /dev/null
+++ b/toke/scanner.h
@@ -0,0 +1,123 @@
+#ifndef _TOKE_SCANNER_H
+#define _TOKE_SCANNER_H
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      External/Prototype definitions for Scanning functions in Tokenizer
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+
+#include "types.h"
+#include "ticvocab.h"
+
+/* ************************************************************************** *
+ *
+ *      Global Variables Exported
+ *
+ **************************************************************************** */
+
+extern u8  *statbuf;           /*  The word just read from the input stream  */
+extern u8   base;	       /*  The numeric-interpretation base           */
+
+
+/* pci data */
+extern bool pci_is_last_image;
+extern u16  pci_image_rev;        /* Vendor's Image, NOT PCI Data Struct Rev */
+extern u16  pci_vpd;
+
+
+/*  Having to do with the state of the tokenization  */
+extern bool offs16;	     /*  Using 16-bit branch- (etc) -offsets  */
+extern bool in_tokz_esc;     /*  TRUE if in "Tokenizer Escape" mode   */
+extern bool incolon;	     /*  TRUE if inside a colon definition    */
+extern bool haveend;	     /*  TRUE if the "end" code was read.     */
+extern int do_loop_depth;    /*  How deep we are inside DO ... LOOP variants */
+
+/*  For special-case error detection or reporting */
+extern int lastcolon;	/*  Loc'n in output stream of latest colon-def'n.  */
+			/*  Used for error-checking of IBM-style Locals    */
+extern char *last_colon_defname;       /*  Name of last colon-definition     */
+extern char *last_colon_filename;      /*  File where last colon-def'n made  */
+extern unsigned int last_colon_lineno; /*  Line number of last colon-def'n   */
+extern bool report_multiline;          /*  False to suspend multiline warning */
+extern unsigned int last_colon_abs_token_no;
+
+/* ************************************************************************** *
+ *
+ *      Function Prototypes / Functions Exported:
+ *
+ **************************************************************************** */
+
+void	init_scanner( void );
+void	exit_scanner( void );
+void init_scan_state( void );
+void	 fcode_ender( void );
+
+bool skip_until( char lim_ch);
+void push_source( void (*res_func)(), _PTR res_parm, bool is_f_chg );
+signed long get_word( void);
+bool get_word_in_line( char *func_nam);
+bool get_rest_of_line( void);
+void warn_unterm( int severity,
+                            char *something,
+			        unsigned int saved_lineno);
+void warn_if_multiline( char *something, unsigned int start_lineno );
+void user_message( tic_param_t pfield );
+void skip_user_message( tic_param_t pfield );
+bool get_number( long *result);
+void eval_string( char *inp_bufr);
+
+void process_remark( tic_param_t pfield );
+bool filter_comments( u8 *inword);
+bool as_a_what( fwtoken definer, char *as_what);
+tic_hdr_t *lookup_word( char *stat_name, char **where_pt1, char **where_pt2 );
+bool word_exists( char *stat_name, char **where_pt1, char **where_pt2 );
+void warn_if_duplicate ( char *stat_name);
+void trace_creation( fwtoken definer, char *nu_name);
+void tokenize_one_word( signed long wlen );
+void check_name_length( signed long wlen );
+
+void	tokenize( void );
+
+/* **************************************************************************
+ *
+ *          Macro Name:   FUNC_CPY_BUF_SIZE
+ *                        Size of a temporary buffer to retain a copy of
+ *                        a function name taken from statbuf, when statbuf
+ *                        will be used to return a value, but the function
+ *                        name might still be needed for an error message.
+ *
+ **************************************************************************** */
+
+#define FUNC_CPY_BUF_SIZE  40
+
+
+#endif   /*  _TOKE_SCANNER_H    */
diff --git a/toke/stack.c b/toke/stack.c
index 4bd20f4..a58cd2f 100644
--- a/toke/stack.c
+++ b/toke/stack.c
@@ -24,93 +24,203 @@
  *
  */
 
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 
-#include "toke.h"
 #include "stack.h"
+#include "scanner.h"
+#include "errhandler.h"
 
+/* **************************************************************************
+ *
+ *          Global Variables Imported
+ *              statbuf          The word just read from the input stream
+ *
+ **************************************************************************** */
 
-#define GUARD_STACK
-#define EXIT_STACKERR
 
-#ifdef GLOBALSTACK
-#define STATIC static
-#else
-#define STATIC
-#endif
-STATIC long *dstack,*startdstack,*enddstack;
-#undef STATIC
+/* **************************************************************************
+ *
+ *          Global Variables Exported
+ *              dstack         Pointer to current item on top of Data Stack
+ *
+ **************************************************************************** */
+
+long *dstack;
+
+/* **************************************************************************
+ *
+ *      Local/Static Pointers  .....      to  ...         -> Points to ...
+ *          startdstack         Start of data-stack area  -> last possible item
+ *          enddstack           End of data-stack area    -> past first item
+ *
+ *************************************************************************** */
+
+static long *startdstack;
+static long *enddstack;
+
+void clear_stack(void)
+{
+    dstack = enddstack;
+}
 
 /* internal stack functions */
 
-int init_stack(void)
+void init_stack(void)
 {
-	startdstack=enddstack=malloc(MAX_ELEMENTS*sizeof(long));
-	enddstack+=MAX_ELEMENTS;
+	startdstack = safe_malloc(MAX_ELEMENTS*sizeof(long), "initting stack");
+	enddstack = startdstack + MAX_ELEMENTS;
 	dstack=enddstack;
-	return 0;
 }
 
-#ifdef GLOBALSTACK 
+/*  Input Param:  stat   TRUE = Underflow, FALSE = Overflow   */
+static void stackerror(bool stat)
+{
+    /*
+     *   Because all of our stack operations are protected and
+     *       we have no risk of the  dstack  pointer going into
+     *       invalid territory, this error needs not be  FATAL.
+     */
+    tokenization_error ( TKERROR , "stack %sflow at or near  %s \n",
+	 (stat)?"under":"over" , statbuf );
+}
 
-#ifdef GUARD_STACK
-static void stackerror(int stat)
+/*
+ *  Return TRUE if the stack depth is equal to or greater than
+ *      the supplied minimum requirement.  If not, print an error.
+ */
+bool min_stack_depth(int mindep)
 {
-  	printf ("FATAL: stack %sflow\n",
-		(stat)?"under":"over" );
-#ifdef EXIT_STACKERR
-	exit(-1);
-#endif
+    bool retval = TRUE ;
+    long *stack_result;
+
+    stack_result = dstack + mindep;
+    /*
+     *  The above appears counter-intuitive.  However, C compensates
+     *      for the size of the object of a pointer when it handles
+     *      address arithmetic.  A more explicit expression that would
+     *      yield the same result, might look something like this:
+     *
+     *        (long *)((int)dstack + (mindep * sizeof(long)))
+     *
+     *  I doubt that that form would yield tighter code, or otherwise
+     *      represent any material advantage...
+     */
+
+    if ( stack_result > enddstack )
+    {
+	retval = FALSE;
+	stackerror(TRUE);
+    }
+
+    return ( retval );
+}
+
+/*
+ *  Return TRUE if the stack has room for the supplied # of items
+ */
+static bool room_on_stack_for(int newdep)
+{
+    bool retval = TRUE ;
+    long *stack_result;
+
+    stack_result = dstack - newdep;
+    /*  See above note about "counter-intuitive" pointer address arithmetic  */
+
+    if ( stack_result < startdstack )
+    {
+	retval = FALSE;
+	stackerror(FALSE);
+    }
+
+    return ( retval );
 }
-#endif
 
 void dpush(long data)
 {
 #ifdef DEBUG_DSTACK
 	printf("dpush: sp=%p, data=0x%lx, ", dstack, data);
 #endif
-	*(--dstack)=data;
-#ifdef GUARD_STACK
-	if (dstack<startdstack) stackerror(0);
-#endif
+	if ( room_on_stack_for(1) )
+	{
+	    --dstack;
+	    *(dstack)=data;
+	}
 }
 
 long dpop(void)
 {
-  	long val;
+  	long val = 0;
 #ifdef DEBUG_DSTACK
 	printf("dpop: sp=%p, data=0x%lx, ",dstack, *dstack);
 #endif
-	val=*(dstack++);
-#ifdef GUARD_STACK
-	if (dstack>enddstack) stackerror(1);
-#endif
+	if ( min_stack_depth(1) )
+	{
+	    val=*(dstack);
+	    dstack++;
+	}
 	return val;
 }
 
 long dget(void)
 {
-	return *(dstack);
+  	long val = 0;
+	if ( min_stack_depth(1) )
+	{
+	    val = *(dstack);
+	}
+	return val;
 }
-#endif
 
-/* Stack helper functions */
-
-u8 *get_stackstring(void)
+long stackdepth(void)
 {
-	long size;
-	u8   *fstring, *retstring;
-
-	size=dpop();
-	fstring=(u8 *)dpop();
+    long depth;
+
+    depth = enddstack - dstack;
+    /*
+     *  Again, C's address arithmetic compensation comes into play.
+     *      See the note at  min_stack_depth()
+     *
+     *  A more explicit equivalent expression might look like this:
+     *
+     *        (((long int)enddstack - (long int)dstack) / sizeof(long))
+     *
+     *  I doubt any material advantage with that one either...
+     */
+
+    return (depth);
+}
 
-	retstring=malloc(size+1);
-	strncpy((char *)retstring, (const char *)fstring, size);
-	retstring[size]=0;
+void swap(void)
+{
+    long nos_temp;    /*  Next-On-Stack temp  */
+    if ( min_stack_depth(2) )
+    {
+	nos_temp = dstack[1];
+	dstack[1]= dstack[0];
+	dstack[0]= nos_temp;
+    }
+}
 
-	return retstring;
+void two_swap(void)
+{
+    long two_deep, three_deep;
+    if ( min_stack_depth(4) )
+    {
+	two_deep   = dstack[2];
+	three_deep = dstack[3];
+	dstack[2]  = dstack[0];
+	dstack[3]  = dstack[1];
+	dstack[1]  = three_deep;
+	dstack[0]  = two_deep;
+    }
 }
 
 
diff --git a/toke/stack.h b/toke/stack.h
index 9aa5c53..35f0eab 100644
--- a/toke/stack.h
+++ b/toke/stack.h
@@ -1,3 +1,6 @@
+#ifndef _TOKE_STACK_H
+#define _TOKE_STACK_H
+
 /*
  *                     OpenBIOS - free your system! 
  *                         ( FCode tokenizer )
@@ -24,23 +27,47 @@
  *
  */
 
-#ifdef ANSI_ONLY
-#define GLOBALSTACK
-#endif
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+
+#include "types.h"
+
+/* ************************************************************************** *
+ *
+ *      Macros:
+ *          MAX_ELEMENTS          Size of stack area, in "elements"
+ *
+ **************************************************************************** */
 
 #define MAX_ELEMENTS 1024
 
-#ifdef GLOBALSTACK
+/* ************************************************************************** *
+ *
+ *      Global Variables Exported
+ *
+ **************************************************************************** */
+
+extern long *dstack;
+
+/* ************************************************************************** *
+ *
+ *      Function Prototypes / Functions Exported:
+ *
+ **************************************************************************** */
+
 void dpush(long data);
 long dpop(void);
 long dget(void);
-#else
-extern long *dstack,*startdstack;
-static inline void dpush(long data) { *(--dstack)=data; }
-static inline long dpop(void) { return (long)*(dstack++); }
-static inline long dget(void) { return *(dstack); }
-#endif
 
-int init_stack(void);
-u8 *get_stackstring(void);
+void clear_stack(void);
+void init_stack(void);
+
+bool min_stack_depth(int mindep);   /*  TRUE if no error  */
+long stackdepth(void);
+void swap(void);
+void two_swap(void);
 
+#endif   /*  _TOKE_STACK_H    */
diff --git a/toke/stream.c b/toke/stream.c
index dd96a53..b7793f1 100644
--- a/toke/stream.c
+++ b/toke/stream.c
@@ -24,6 +24,12 @@
  *
  */
 
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+
 #include <stdio.h>
 #include <stdlib.h>
 #ifdef __GLIBC__
@@ -32,134 +38,1577 @@
 #include <string.h>
 #include <sys/stat.h>
 
-#include "toke.h"
+#include "emit.h"
 #include "stream.h"
+#include "errhandler.h"
+#include "toke.h"
 
-#define OUTPUT_SIZE	131072
+/* **************************************************************************
+ *
+ *      Revision History:
+ *      Updated Tue, 31 Jan 2006 by David L. Paktor
+ *          Add support for embedded Environment-Variables in path name
+ *      Updated Thu, 16 Feb 2006 David L. Paktor
+ *          Collect missing (inaccessible) filenames
+ *      Updated Thu, 16 Mar 2006 David L. Paktor
+ *          Add support for Include-Lists
+ *
+ **************************************************************************** */
 
-extern bool offs16;
-extern u16 nextfcode;
+/* **************************************************************************
+ *
+ *          Global Variables Exported
+ *              start                 Start of input-source buffer
+ *              end                   End of input-source buffer
+ *              pc                    Input-source Scanning pointer
+ *              iname                 Current Input File name
+ *              lineno                Current Line Number in Input File
+ *              ostart                Start of Output Buffer
+ *              opc                   FCode Output Buffer Position Counter
+ *              oname                 Output File name
+ *
+ **************************************************************************** */
 
-u8 *start, *pc, *end;
-char *iname;
+
+/* Input pointers, Position Counters and Length counters */
+u8 *start = NULL;
+u8 *pc;
+u8 *end;
+char *iname = NULL;
+unsigned int lineno = 0;
+unsigned int abs_token_no = 0;  /*  Absolute Token Number in all Source Input
+                                 *      Will be used to identify position
+                                 *      where colon-definition begins and
+                                 *      to limit clearing of control-structs.
+                                 */
+static unsigned int ilen;   /*  Length of Input Buffer   */
 
 /* output pointers */
-u8 *ostart, *opc, *oend, *oname;
-static unsigned int ilen;
+u8 *ostart;
+char *oname = NULL;
+unsigned int opc;           /*  Output Position Counter  */
+
+/* We want to limit exposure of this v'ble, so don't put it in  .h  file  */
+unsigned int olen;          /*  Length of Output Buffer  */
+/* We want to limit exposure of this Imported Function, likewise.  */
+void init_emit( void);
+
+/* **************************************************************************
+ *
+ *          Internal Static Variables
+ *     load_list_name       Name of the Load List File
+ *     load_list_file       (Pointer to) File-Structure for the Load List File
+ *     depncy_list_name     Name of the Dependency List File
+ *     depncy_file     (Pointer to) File-Structure for the Dependency List File
+ *     missing_list_name    Name of the Missing-Files-List File
+ *     missing_list_file    (Pointer to) File-Structure for Missing-List File
+ *     no_files_missing     TRUE if able to load all files
+ *
+ **************************************************************************** */
+
+static char *load_list_name;
+static FILE *load_list_file;
+static char *depncy_list_name;
+static FILE *depncy_file;
+static char *missing_list_name;
+static FILE *missing_list_file;
+static bool no_files_missing = TRUE;
+
+/* **************************************************************************
+ *
+ *         Private data-structure for Include-List support
+ *
+ *     Components are simply a string-pointer and a link pointer
+ *
+ **************************************************************************** */
+
+typedef struct incl_list
+{
+        char             *dir_path;
+	struct incl_list *next;
+    } incl_list_t;
+
+/* **************************************************************************
+ *
+ *          Internal Static Variables associated with Include-List support
+ *     include_list_start        Start of the Include-List
+ *     include_list_next         Next entry in Include-List to add or read
+ *     max_dir_path_len          Size of longest entry in the Include-List
+ *     include_list_full_path    Full-Path (i.e., expanded File-name with
+ *                                   Include-List Entry) that was last opened.
+ *
+ **************************************************************************** */
+static incl_list_t *include_list_start = NULL;
+static incl_list_t *include_list_next = NULL;
+static unsigned int max_dir_path_len = 0;
+static char *include_list_full_path = NULL;
+
 
-unsigned int lineno;
+/* **************************************************************************
+ *
+ *      Function name:  add_to_include_list
+ *      Synopsis:       Add an entry to the Include-List
+ *
+ *      Inputs:
+ *         Parameters:
+ *             dir_compt               Directory Component to add to Inc-List
+ *         Local Static Variables:
+ *             include_list_start      First entry in the Include-List
+ *             include_list_next       Next entry in Include-List to add
+ *             max_dir_path_len        Previous max Dir-Component Length 
+ *
+ *      Outputs:
+ *         Returned Value:             NONE
+ *         Local Static Variables:
+ *             include_list_start      Assigned a value, first time through
+ *             include_list_next       "Next" field updated with new entry,
+ *                                         then pointer updated to new entry.
+ *             max_dir_path_len        Maximum Length 
+ *         Memory Allocated
+ *             For the list-entry, and for the directory/path name to be added
+ *         When Freed?
+ *             Remains in effect through the life of the program.
+ *
+ *      Process Explanation:
+ *          Unlike most of our linked-lists, this one will be linked forward,
+ *              i.e., in the order elements are added, and will be searched
+ *              in a forward order.
+ *          This means extra code to handle the first entry.
+ *          Allocate and initialize the New Include-List Entry.
+ *          If this is the first entry, point the List-Starter at it.
+ *          Otherwise, the Last-Entry-on-the-List pointer is already valid;
+ *              point its "next" field at the New Entry.
+ *          Point the Last-Entry-on-the-List pointer at the New Entry.
+ *
+ **************************************************************************** */
 
-int init_stream( const char *name)
+void add_to_include_list( char *dir_compt)
 {
-	FILE *infile;
-	unsigned int i;
+    unsigned int new_path_len = strlen( dir_compt);
+    incl_list_t *new_i_l_e = safe_malloc( sizeof( incl_list_t),
+        "adding to include-list" );
+
+    new_i_l_e->dir_path = strdup( dir_compt);
+    new_i_l_e->next = NULL;
+
+    if ( include_list_start == NULL )
+    {
+	include_list_start = new_i_l_e;
+    }else{
+       include_list_next->next = new_i_l_e;
+    }
+    
+    include_list_next = new_i_l_e;
+    if ( new_path_len > max_dir_path_len  ) max_dir_path_len = new_path_len;
+}
+
+#define   DISPLAY_WIDTH  80
+/* **************************************************************************
+ *
+ *      Function name:  display_include_list
+ *      Synopsis:       Display the Include-List, once it's completed,
+ *                          if "verbose" mode is in effect.
+ *
+ *      Inputs:
+ *         Parameters:                    NONE
+ *         Local Static Variables:
+ *             include_list_start         First entry in the Include-List
+ *             include_list_next          Next entry, as we step through.
+ *         Macro:
+ *             DISPLAY_WIDTH              Width limit of the display
+ *
+ *      Outputs:
+ *         Returned Value:                NONE
+ *         Local Static Variables:
+ *             include_list_next          NULL, when reaches end of Incl-List
+ *         Printout:
+ *             The elements of the Include-List, separated by a space, on
+ *                 a line up to the DISPLAY_WIDTH, or on a line by itself
+ *                 if the element is wider.
+ *
+ *      Process Explanation:
+ *          The calling routine will check for the  verbose  flag.
+ *          Nothing to be done here if Include-List is NULL.
+ *          Print a header, then the list.
+ *
+ **************************************************************************** */
+
+void display_include_list( void)
+{
+    if ( include_list_start != NULL )
+    {
+        int curr_wid = DISPLAY_WIDTH;     /*  Current width; force new line  */
+	printf("\nInclude-List:");
+	include_list_next = include_list_start ;
+	while ( include_list_next != NULL )
+	{
+	    int this_wid = strlen( include_list_next->dir_path) + 1;
+	    char *separator = " ";
+	    if ( curr_wid + this_wid > DISPLAY_WIDTH )
+	    {
+	        separator = "\n\t";
+		curr_wid = 7;  /*  Allow 1 for the theoretical space  */
+	    }
+	    printf("%s%s", separator, include_list_next->dir_path);
+	    curr_wid += this_wid;
+	    include_list_next = include_list_next->next ;
+	}
+	printf("\n");
+    }
+}
+
+
+
+/* **************************************************************************
+ *
+ *          We cannot accommodate the structures of the different
+ *              routines that open files with a single function, so
+ *              we will have to divide the action up into pieces:
+ *              one routine to initialize the include-list search, a
+ *              second to return successive candidates.  The calling
+ *              routine will do the operation (stat or fopen) until
+ *              it succeeds or the list is exhausted.  Then it will
+ *              call a final routine to clean up and display messages.
+ *
+ *          I'm sure I don't need to mention that, when no include-list
+ *              is defined, these functions will still support correct
+ *              operation...
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Function name:  init_incl_list_scan
+ *      Synopsis:       Initialize the search through the Include-List
+ *
+ *      Inputs:
+ *         Parameters:
+ *             base_name               Expanded user-supplied file-name
+ *         Local Static Variables:
+ *             include_list_start      First entry in the Include-List
+ *             max_dir_path_len        Maximum Directory Component Length 
+ *
+ *      Outputs:
+ *         Returned Value:             NONE
+ *         Local Static Variables:
+ *             include_list_next       Next entry in Include-List to read
+ *             include_list_full_path  Full-Path Buffer pointer
+ *         Memory Allocated
+ *             Full-Path Buffer        (If Include-List was defined)
+ *         When Freed?
+ *             In  finish_incl_list_scan()
+ *
+ *      Process Explanation:
+ *          The  base_name  passed to the routine is expected to have
+ *              any embedded Environment-Variables already expanded.
+ *          The Full-Path Buffer is presumed to be unallocated, and
+ *              its pointer to be NULL.
+ *          The Next-Entry-to-read pointer is also presumed to be NULL.
+ *          If an Include-List has been defined, we will allocate memory
+ *              for the Full-Path Buffer and point the Next-Entry pointer
+ *              at the Start of the List.  If not, no need to do anything.
+ *
+ **************************************************************************** */
+
+static void init_incl_list_scan( char *base_name)
+{
+    if ( include_list_start != NULL )
+    {
+	/*  Allocate memory for the file-name buffer.
+	 *      maximum path-element length plus base-name length
+	 *      plus one for the slash plus one for the ending NULL
+	 */
+	unsigned int new_path_len = max_dir_path_len + strlen( base_name) + 2;
+	include_list_full_path = safe_malloc( new_path_len,
+	    "scanning include-list" );
+	include_list_next = include_list_start;
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  scan_incl_list
+ *      Synopsis:       Prepare the next candidate in the include-list search
+ *                          Indicate when the end has been reached.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             base_name               Expanded user-supplied file-name
+ *         Local Static Variables:
+ *             include_list_full_path  Full-Path Buffer pointer
+ *             include_list_next       Next entry in Include-List to read
+ *
+ *      Outputs:
+ *         Returned Value:             TRUE if valid candidate; FALSE when done
+ *         Local Static Variables:
+ *             include_list_full_path  Next Full file-name Path to use
+ *             include_list_next       Updated to next entry in the List
+ *
+ *      Process Explanation:
+ *          Include-List Components are presumed not to require any expansion;
+ *              the Shell is expected to resolve any Environment-Variables
+ *              supplied in command-line arguments before they are passed
+ *              to the (this) application-program.
+ *          We will, therefore, not attempt to expand any Components of
+ *              the Include-List.  
+ *          If the Full-Path Buffer pointer is NULL, it indicates that no
+ *              entries have been made to the Include-List and this is our
+ *              first time through this routine in this search; we will
+ *              use the base-name as supplied, presumably relative to the
+ *              current directory.  Point the buffer-pointer at the base-
+ *              -name and return "Not Done".
+ *          Otherwise, we will look at the Next-Entry pointer:
+ *              If it is NULL, we have come to the end of the Include-List;
+ *                  whether because no Include-List was defined or because
+ *                  we have reached the end, we will return "Done".
+ *              Otherwise, we will load the Full-Path Buffer with the entry
+ *                  currently indicated by the Next-Entry pointer, advance
+ *                  it to the next entry in the List and return "Not Done".
+ *          We will supply a slash as the directory-element separator in
+ *              between the Include-List entry and the  base_name 
+ *
+ *      Extraneous Remarks:
+ *          The slash as directory-element separator works in UNIX-related
+ *              environments, but is not guaranteed in others.  I would
+ *              have preferred to specify that Include-List Components are
+ *              required to end with the appropriate separator, but that
+ *              was neither acceptable nor compatible with existing practice
+ *              in other utilities, and the effort to programmatically
+ *              determine the separator used by the Host O/S was too much
+ *              for such a small return.  And besides, we already have so
+ *              many other UNIX-centric assumptions hard-coded into the
+ *              routines in this file (dollar-sign to signify Environment
+ *              Variables, period for file-name-extension separator, etc.)
+ *              that it's just too much of an uphill battle anymore...
+ *
+ **************************************************************************** */
+
+static bool scan_incl_list( char *base_name)
+{
+    bool retval = FALSE;   /*  default to "Done"  */
 	
+    if ( include_list_full_path == NULL )
+    {
+	include_list_full_path = base_name;
+	retval = TRUE;
+    }else{
+	if ( include_list_next != NULL )
+	{
+
+	    /*  Special case:  If the next Directory Component is
+	     *      an empty string, do not prepend a slash; that
+	     *      would either become a root-based absolute path,
+	     *      or, if the base-name is itself an absolute path,
+	     *      it would be a path that begins with two slashes,
+	     *      and *some* Host Operating Systems ***REALLY***
+	     *      DO NOT LIKE that!
+	     */
+	    if ( strlen( include_list_next->dir_path) == 0 )
+	    {
+		sprintf( include_list_full_path, "%s", base_name);
+	    }else{
+		sprintf( include_list_full_path, "%s/%s",
+	            include_list_next->dir_path, base_name);
+	    }
+	    include_list_next = include_list_next->next;
+	    retval = TRUE;
+	}
+    }
+
+    return( retval);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  finish_incl_list_scan
+ *      Synopsis:       Clean up after a search through the Include-List
+ *                          Display appropriate messages.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             op_succeeded            TRUE if intended operation was ok.
+ *             
+ *         Local Static Variables:
+ *             include_list_start      Non-NULL if Include-List was defined
+ *
+ *      Outputs:
+ *         Returned Value:             NONE
+ *         Local Static Variables:
+ *             include_list_full_path  Reset to NULL
+ *             include_list_next       Reset to NULL
+ *         Memory Freed
+ *             Full-Path Buffer        (If Include-List was defined)
+ *         Printout:
+ *             If file was found in Include-List, Advisory showing where.
+ *
+ **************************************************************************** */
+
+static void finish_incl_list_scan( bool op_succeeded)
+{
+    if ( include_list_start != NULL )
+    {
+	if ( op_succeeded )
+	{
+	    tokenization_error( INFO,
+		"File was found in %s\n" ,include_list_full_path );
+	}
+	free( include_list_full_path);
+    }
+    include_list_full_path = NULL;
+    include_list_next = NULL;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  open_incl_list_file
+ *      Synopsis:       Look in the Include-List, if one is defined, for
+ *                          the file whose name is given and open it.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             base_name               Expanded user-supplied file-name
+ *             mode                    Mode-string to use; usually "r" or "rb"
+ *         Local Static Variables:
+ *             include_list_full_path  Full Path to use in fopen atttempt
+ *
+ *      Outputs:
+ *         Returned Value:             File structure pointer; NULL if failed
+ *         Local Static Variables:
+ *             include_list_full_path  Full Path used, if succeeded
+ *
+ *      Error Detection:
+ *          Calling routine will detect and report Errors.
+ *
+ *      Process Explanation:
+ *          This routine will initialize and step through Include-List.
+ *              Calling routine will be responsible for "finishing" the
+ *              Include-List search, as well as any Advisory messages.
+ *
+ **************************************************************************** */
+
+static FILE *open_incl_list_file( char *base_name, char *mode)
+{
+    FILE *retval = NULL;
+
+    init_incl_list_scan( base_name);
+    while ( scan_incl_list( base_name) )
+    {
+        retval = fopen( include_list_full_path, mode);
+	if ( retval != NULL )
+	{
+	    break; 
+	}
+    }
+
+    return (retval);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  stat_incl_list_file
+ *      Synopsis:       Look in the Include-List, if defined, for given file,
+ *                          and collect its statistics.
+ *                      
+ *
+ *      Inputs:
+ *         Parameters:
+ *             base_name               Expanded user-supplied file-name
+ *             file_info               Pointer to STAT structure
+ *         Local Static Variables:
+ *             include_list_full_path  Full Path to use in file-status atttempt
+ *
+ *      Outputs:
+ *         Returned Value:             TRUE if succeeded.
+ *         Local Static Variables:
+ *             include_list_full_path  Full Path used, if succeeded
+ *         Supplied Pointers:
+ *             *file_info              File-statistics structure from STAT call
+ *
+ *      Error Detection:
+ *          Calling routine will detect and report Errors.
+ *          
+ *      Process Explanation:
+ *          This routine will initialize and step through Include-List.
+ *              Calling routine will be responsible for "finishing" the
+ *              Include-List search, as well as any Advisory messages.
+ *
+ **************************************************************************** */
+
+static bool stat_incl_list_file( char *base_name, struct stat *file_info)
+{
+    bool retval = FALSE;
+    int stat_reslt = -1;    /*  Success = 0   */
+
+    init_incl_list_scan( base_name);
+    while ( scan_incl_list( base_name) )
+    {
+        stat_reslt = stat( include_list_full_path, file_info);
+	if ( stat_reslt == 0 )
+	{
+	    retval = TRUE;
+	    break; 
+	}
+    }
+
+    return (retval);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  init_inbuf
+ *      Synopsis:       Set the given buffer as the current input source
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             inbuf         Pointer to start of new input buffer
+ *             buflen        Length of new input buffer
+ *
+ *      Outputs:
+ *         Returned Value:    NONE
+ *         Global Variables:
+ *             start             Points to given buffer
+ *             end               Points to end of new input buffer
+ *             pc                Re-initialized      
+ *
+ **************************************************************************** */
+
+void init_inbuf(char *inbuf, unsigned int buflen)
+{
+    start = inbuf;
+    pc = start;
+    end = pc + buflen;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  could_not_open
+ *      Synopsis:       Report the "Could not open" Message for various Files.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             severity                  Severity of message, WARNING or ERROR
+ *             fle_nam                   Name of file
+ *             for_what                  Phrase after "... for "
+ *
+ *      Outputs:
+ *         Returned Value:               NONE
+ *         Printout:
+ *             Message of indicated severity.
+ *
+ *      Error Detection:
+ *          Error already detected; reported here.
+ *
+ **************************************************************************** */
+
+static void could_not_open(int severity, char *fle_nam, char *for_what)
+{
+    tokenization_error( severity, "Could not open file %s for %s.\n",
+	fle_nam, for_what);
+
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  file_is_missing
+ *      Synopsis:       Add the given File to the Missing-Files-List.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             fle_nam                   Name of file
+ *         Local Static Variables:
+ *             missing_list_file         Missing-Files-List File Structure
+ *                                           May be NULL if none was opened
+ *
+ *      Outputs:
+ *         Returned Value:               NONE
+ *         Local Static Variables:
+ *             no_files_missing         Set FALSE
+ *         File Output:
+ *             Write File name to Missing-Files-List (if one was opened)
+ *
+ *      Error Detection:
+ *          Error already detected; reported here.
+ *
+ **************************************************************************** */
+
+static void file_is_missing( char *fle_nam)
+{
+    if ( missing_list_file != NULL )
+    {
+	fprintf( missing_list_file, "%s\n", fle_nam);
+	no_files_missing = FALSE;
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  add_to_load_lists
+ *      Synopsis:       Add the given input file-name to the Load-List File,
+ *                      and the Full File path to the Dependency-List File.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             in_name                  Name of given input Source File
+ *         Local Static Variables:
+ *             load_list_file           Load List File Structure pointer
+ *             depncy_file              Dependency-List File Structure ptr
+ *                            Either may be NULL if the file was not opened.
+ *             include_list_full_path   Full Path to where the file was found.
+ *
+ *      Outputs:
+ *         Returned Value:               NONE
+ *         File Output:
+ *             Write given file-name to Load-List file (if one was opened)
+ *             Write File Path to Dependency-List file (if one was opened)
+ *
+ *      Process Explanation:
+ *          Write into the Load-List file the input Source Filename in the
+ *              same form -- i.e., unexpanded -- as was supplied by the User.
+ *          Write into the Dependency-List file the full expanded path, as
+ *              supplied by the program to the Host Operating System.
+ *
+ **************************************************************************** */
+
+static void add_to_load_lists( const char *in_name)
+{
+    if ( load_list_file != NULL )
+    {
+	fprintf( load_list_file, "%s\n", in_name);
+    }
+    if ( depncy_file != NULL )
+    {
+	fprintf( depncy_file, "%s\n", include_list_full_path);
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      In the functions that support accessing files whose path-names
+ *          contain embedded Environment-Variables, the commentaries
+ *          will refer to this process, or to inputs that require it,
+ *          using variants of the term "expand".
+ *
+ *      We will also keep some of the relevant information as Local
+ *          Static Variables.
+ *
+ **************************************************************************** */
+
+static char expansion_buffer[ 2*GET_BUF_MAX];
+static bool was_expanded;
+static int expansion_msg_severity = INFO;
+
+/* **************************************************************************
+ *
+ *      Function name:  expanded_name
+ *      Synopsis:       Advisory message to display filename expansion.
+ *
+ *      Inputs:
+ *         Parameters:
+ *         Local Static Variables:
+ *             was_expanded              TRUE if expansion happened
+ *             expansion_buffer          Buffer with result of expansion
+ *             expansion_msg_severity    Whether it's an ordinary Advisory
+ *                                           or we force a message.
+ *
+ *      Outputs:
+ *         Returned Value:               NONE
+ *             
+ *         Printout:
+ *             Advisory message showing expansion, if expansion happened
+ *             Otherwise, nothing.
+ *
+ **************************************************************************** */
+
+static void expanded_name( void )
+{
+    if ( was_expanded )
+    {
+	tokenization_error( expansion_msg_severity,
+	    "File name expanded to:  %s\n", expansion_buffer);
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  expansion_error
+ *      Synopsis:       Supplemental message to display filename expansion.
+ *                      Called after an expanded-filename failure was reported.
+ *
+ *      Inputs:
+ *         Parameters:
+ *         Global Variables:
+ *             verbose                   Set by "-v" switch
+ *
+ *      Outputs:
+ *         Returned Value:               NONE
+ *         Printout:
+ *             Advisory message showing expansion, if applicable
+ *                 and if wasn't already shown.
+ *
+ *      Error Detection:
+ *          Called after Error was reported.
+ *
+ *      Process Explanation:
+ *          Presumptions are that:
+ *              An Error message, showing the user-supplied form of the
+ *                  pathname is also being displayed
+ *              An advisory message showing the pathname expansion may
+ *                  have been displayed during the expansion process,
+ *                  if  verbose  was TRUE.
+ *          The purpose of this routine is to display the expansion if
+ *              it had not already just been displayed, i.e., if  verbose
+ *              is not set to TRUE:  Temporarily force the display of an
+ *              Advisory message.
+ *
+ *      Extraneous Remarks:
+ *          If this routine is called before the Error message is displayed,
+ *              the verbose and non-verbose versions of the Log-File will
+ *              match up nicely...
+ *
+ **************************************************************************** */
+
+static void expansion_error( void )
+{
+    if ( INVERSE( verbose) )
+    {
+	expansion_msg_severity |= FORCE_MSG;
+	expanded_name();
+	expansion_msg_severity ^= FORCE_MSG;
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  expand_pathname
+ *      Synopsis:       Perform the expansion of a path-name that may contain
+ *                          embedded Environment-Variables
+ *
+ *      Inputs:
+ *         Parameters:
+ *             input_pathname           The user-supplied filename
+ *         Global/Static MACRO:
+ *             GET_BUF_MAX              Size of expansion buffer is twice this.
+ *
+ *      Outputs:
+ *         Returned Value:              Pointer to expanded name, or to
+ *                                          input if no expansion needed.
+ *                                      NULL if error.
+ *         Local Static Variables:
+ *             was_expanded             TRUE if expansion needed and succeeded
+ *             expansion_buffer         Result of expansion
+ *         Printout:
+ *             Advisory message showing expansion
+ *             Presumption is that an Advisory giving the user-supplied
+ *                 pathname was already printed.
+ *
+ *      Error Detection:
+ *          Syntax error.  System might print something; it might not be
+ *              captured, even to a log-file.  System failure return might
+ *              be the only program-detectable indication.  Display ERROR
+ *              message and return NULL pointer.  Calling routine will
+ *              display the user-supplied pathname in its Error message
+ *              indicating failure to open the file.
+ *
+ *      Process Explanation:
+ *          Generally speaking, we will let the Shell expand the Environment
+ *              Variables embedded in the user-supplied pathname.
+ *          First, though, we will see if the expansion is necessary:  Look
+ *              for the telltale character, '$', in the input string.  If
+ *              it's not there, there are no Env't-V'bles, and no expansion
+ *              is necessary.  Return the pointer to the input string and
+ *              we're done.  Otherwise.....
+ *          Acquire a temporary file-name.  Construct a string of the form:
+ *                      echo input_string > temp_file_name
+ *              and then issue that string as a command to the Shell.
+ *          If that string generates a system-call failure, report an ERROR.
+ *          Open the temporary file and read its contents.  That will be
+ *              the expansion of the input string.  If its length exceeds
+ *              the capacity of the expansion buffer, it's another ERROR.
+ *          (Of course, don't forget to delete the temporary file.)
+ *          Place the null-byte marker at the end of the expanded name,
+ *              trimming off the terminating new-line.
+ *          Success.  Display the expanded name (as an Advisory message)
+ *              Return the pointer to the expansion buffer and set the flag.
+ *              (Did I mention don't forget to delete the temporary file?)
+ *
+ *      Extraneous Remarks:
+ *          This implementation approach turned out to be the simplest and
+ *              cleanest way to accomplish our purpose.  It also boasts the
+ *              HUGE advantage of not requiring re-invention of a well-used
+ *              (proverbial) wheel.  Plus, any variations allowed by the
+ *              shell (e.g.,: $PWD:h ) are automatically converted, too,
+ *              depending on the System shell (e.g., not for Bourne shell).
+ *          In order to spare you, the maintenance programmer, unnecessary
+ *              agony, I will list a few other approaches I tested, with a
+ *              brief note about the results of each:
+ *          (1)
+ *          I actually tried parsing the input line and passing each component
+ *              V'ble to the getenv() function, accumulating the results into
+ *              a conversion buffer.  I needed to check for every possible
+ *              delimiter, and handle curly-brace enclosures.  The resultant
+ *              code was *UGLY* ... you'd be appalled!  The only good spot was
+ *              that I was able to compensate for an open-curly-brace without
+ *              a corresponding close-curly-brace (if close-c-b wasn't found,
+ *              resume the search for other delimiters...) which, apparently,
+ *              the System does not or will not do.  It was, however, too
+ *              small a compensation for all the awfulness entailed overall.
+ *
+ *          I tried various approaches to using the Environment-Variables to
+ *              convert and retrieve the input string:
+ *          (2)
+ *          Create a command-string that would set an Env't V'ble to the
+ *              input-string, and pass the command-string to the system() call,
+ *              then retrieve the Env't V'ble thus set via getenv().  No dice;
+ *              the system() call operated in a separate sub-shell and could
+ *              not export its Env't upwards.
+ *          (3)
+ *          Use the setenv() command to set an Env't V'ble to the input-string
+ *              and retrieve it via getenv().  The returned string matched the
+ *              input-string without converting it.
+ *          (4)
+ *          Use the setenv() command to set an Env't V'ble to a string like:
+ *                      `echo input_string`
+ *              Again, the string retrieved via getenv() exactly matched the
+ *              unconverted command-string, back-quotes and all.
+ *
+ *          Of course, the equivalents of (2), (3) and (4) worked as desired
+ *              when tested as direct commands to the Shell.  UNIX can be
+ *              funny that way...
+ *
+ *          Oh!  Also:  we will slightly stretch the rules of well-structured
+ *              code.
+ *
+ **************************************************************************** */
+
+static char *expand_pathname( const char *input_pathname)
+{
+    static const int buffer_max = GET_BUF_MAX * 2;
+
+    char *retval = (char *)input_pathname;
+    was_expanded = FALSE;
+
+    /*  If no '$' is found, expansion is unnecessary.  */
+    if ( strchr( input_pathname, '$') != NULL )
+    {
+	FILE *temp_file;
+	int syst_stat;
+	const char *temp_file_name = tmpnam( NULL);
+
+	/*  Use the expansion buffer for our temporary command string  */
+	sprintf( expansion_buffer,
+	    "echo %s>%s\n", input_pathname, temp_file_name);
+	syst_stat = system( expansion_buffer);
+	if ( syst_stat != 0 )
+	{
+	    tokenization_error( TKERROR,
+		"Expansion Syntax.\n");
+	    /*  The "File-Opening" error message will show the input string */
+	    return( NULL);
+	}
+
+	temp_file = fopen( temp_file_name, "r");  /*  Cannot fail.   */
+	syst_stat = fread( expansion_buffer, 1, buffer_max, temp_file);
+	/*  Error test.  Length of what we read is not a good indicator;
+	 *      it's limited anyway by buffer_max.
+	 *  Valid test is if last character read was the new-line.
+	 */
+	if ( expansion_buffer[syst_stat-1] != '\n' )
+	{
+	    tokenization_error( TKERROR,
+		"Expansion buffer overflow.  Max length is %d.\n",
+		    buffer_max);
+	    retval = NULL;
+	}else{
+	    expansion_buffer[syst_stat-1] =0;
+	    was_expanded = TRUE;
+	    retval = expansion_buffer;
+	    expanded_name();
+	}
+
+	fclose( temp_file);
+	remove( temp_file_name);
+    }
+
+    return( retval);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  open_expanded_file
+ *      Synopsis:       Open a file, expanding Environment-Variables that
+ *                          may be embedded in the given path-name.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             path_name              The user-supplied path-name
+ *             mode                   Mode-string to use; usually "r" or "rb"
+ *             for_what               Phrase to use in Messages
+ *
+ *      Outputs:
+ *         Returned Value:            Pointer to FILE structure; NULL if failed
+ *         Local Static Variables:
+ *             was_expanded          TRUE if expansion happened
+ *             expansion_buffer      Result of expansion
+ *         Printout:
+ *             Advisory message showing expansion
+ *
+ *      Error Detection:
+ *          If expansion or system-call for file-open failed,
+ *              report Error and return NULL.
+ *
+ **************************************************************************** */
+
+FILE *open_expanded_file( const char *path_name, char *mode, char *for_what)
+{
+
+    FILE *retval = NULL;
+
+    char *infile_name = expand_pathname( path_name);
+    if ( infile_name != NULL )
+    {
+        retval = open_incl_list_file( infile_name, mode);
+    }
+
+    if ( retval == NULL )
+    {
+        expansion_error();
+	tokenization_error ( TKERROR,
+	    "Failed to open file %s for %s\n", path_name, for_what );
+    }
+
+    finish_incl_list_scan( BOOLVAL( retval != NULL) );
+
+    return( retval);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  init_stream
+ *      Synopsis:       Open a file and make it the current source.
+ *                      This is called, not only at the start of tokenization,
+ *                      but also when a subsidiary file is FLOADed.
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             name                     Name of the new Input File to open
+ *                                          May be path-name containing
+ *                                          embedded Environment-Variables.
+ *         Global Variables:
+ *             oname                    NULL if opening Primary Input File
+ *         Local Static Variables:
+ *             include_list_full_path   Full Path to where the file was found
+ *
+ *      Outputs:
+ *         Returned Value:    TRUE = opened and read file successfully
+ *         Global Variables     (Only changed if successful):
+ *             iname                    Set to new Input File name
+ *             lineno                   Re-initialized to 1
+ *         Local Static Variables:
+ *             no_files_missing         Set FALSE if couldn't read input file
+ *             include_list_full_path   Retains full-path if file opened was
+ *                      the Primary Input File (as contrasted with an FLoaded
+ *                      Source file), in which case a call to  init_output()
+ *                      is expected; the Full-Path Buffer will be freed there.
+ *         Memory Allocated
+ *             Duplicate of Input File name (becomes  iname  )
+ *             A fresh input buffer; input file is copied to it.
+ *                 Becomes  start  by action of call to  init_inbuf().
+ *         When Freed?
+ *             By  close_stream()
+ *         File Output:
+ *             Write new Input File name to Load-List file.
+ *             Writing to Missing-Files-List File if failure,
+ *                 or Full File path to Dependency-List File,
+ *                 is handled by called routine.
+ *         Other Exotic Effects:
+ *             Force a flush of  stdout  before printing ERROR messages
+ *             
+ *      Error Detection:
+ *          Failure to open or read Input file:  ERROR; suppress output;
+ *              write Input File name to Missing-Files-List File.
+ *
+ *      Process Explanation:
+ *          Free local buffer on failure.
+ *          Caller should only invoke  close_stream()  if this call succeeded.
+ *          Some filesystems use zeros for new-line; we need to convert
+ *              those zeros to line-feeds.
+ *          Similarly for files that have carr-ret/line-feed; the carr-ret
+ *              will cause havoc; replace it w/ a space.
+ *      
+ *      Revision History:
+ *      Updated Thu, 07 Apr 2005 by David L. Paktor
+ *          Restructured.  If opened file, close it, even if can't read it.
+ *          Return TRUE on success.
+ *          Caller examines return value.    
+ *      Updated Wed, 13 Jul 2005 by David L. Paktor
+ *          Replace carr-rets with spaces.   
+ *      Updated Sun, 27 Nov 2005 by David L. Paktor
+ *          Write new Input File name to Load-List file. 
+ *      Updated Tue, 31 Jan 2006 by David L. Paktor
+ *          Add support for embedded Environment-Variables in path name
+ *      Updated Thu, 16 Feb 2006 David L. Paktor
+ *          Collect missing (inaccessible) filenames
+ *      Updated Fri, 17 Mar 2006 David L. O'Paktor
+ *          Add support for Include-List search
+ *
+ *      Still to be done:
+ *          Set a flag when carr-ret has been replaced by space;
+ *              when a string crosses a line, if this flag is set,
+ *              issue a warning that an extra space has been inserted.
+ *
+ **************************************************************************** */
+
+bool init_stream( const char *name)
+{
+    FILE *infile;
+    u8 *newbuf;
 	struct stat finfo;
+    bool stat_succ = FALSE;
+    bool tried_stat = FALSE;
+    bool retval = FALSE;
+    bool inp_fil_acc_err = FALSE;
+    bool inp_fil_open_err = FALSE;
+    bool inp_fil_read_err = FALSE;
+
+    char *infile_name = expand_pathname( name);
+
+    if ( (infile_name != NULL) )
+    {
+	tried_stat = TRUE;
+	stat_succ = stat_incl_list_file( infile_name, &finfo);
+    }
+
+    if ( INVERSE( stat_succ) )
+    {
+	inp_fil_acc_err = TRUE;
+    }else{
 	
-	if (stat(name,&finfo))
-		return -1;
+	infile = fopen( include_list_full_path, "r");
+	if ( infile == NULL )
+	{
+	    inp_fil_open_err = TRUE;
+	}else{
 	
 	ilen=finfo.st_size;
-	start=malloc(ilen+1);
-	if (!start)
-		return -1;
+	    newbuf = safe_malloc(ilen+1, "initting stream");
 
-        infile=fopen(name,"r");
-        if (!infile)
-                return -1;
+	    if ( fread( newbuf, ilen, 1, infile) != 1 )
+	    {
+		inp_fil_read_err = TRUE;
+		free( newbuf );
+	    } else {
+		unsigned int i;
 
-	if (fread(start, ilen, 1, infile)!=1) {
-		free(start);
-		return -1;
+		retval = TRUE ;
+		/*  Replace zeroes in the file with LineFeeds. */
+		/*  Replace carr-rets with spaces.  */
+		for (i=0; i<ilen; i++)
+		{
+		    char test_c = newbuf[i];
+		    if ( test_c == 0    ) newbuf[i] = 0x0a;
+		    if ( test_c == 0x0d ) newbuf[i] = ' ';
 	}
+		newbuf[ilen]=0;
 
+		init_inbuf(newbuf, ilen);
+
+		/*   If the -l option was specified, write the name of the
+		 *       new input-file to the Load-List file...  UNLESS
+		 *       this is the first time through and we haven't yet
+		 *       opened the Load-List file, in which case we'll
+		 *       just open it here and wait until we create the
+		 *       output-file name (since the Load-List file name
+		 *       depends on the output-file name anyway) before
+		 *       we write the initial input-file name to it.
+		 */
+		/*   Looking for the option-flag _and_ for a non-NULL value
+		 *       of the file-structure pointer is redundandundant:
+		 *       The non-NULL pointer is sufficient, once the List
+		 *       File has been created...
+		 */
+		/*   Same thing applies if the -P option was specified,
+		 *       for the Dependency-List file, except there we'll
+		 *       write the full path to where the file was found.
+		 */
+		/*   We have a routine to do both of those.   */
+		add_to_load_lists( name);
+		/*
+		 *   And... there's one slight complication:  If this is
+		 *       the first time through, (i.e., we're opening the
+		 *       Primary Input File) then we haven't yet opened the
+		 *       Dependency-List file, and we need to preserve the
+		 *       Full file-name Buffer until the call to  init_output()
+		 *       where the include-list scan will be "finish"ed.
+		 *   Actually, we want to postpone "finish"ing the inc-l scan
+		 *       for several reasons beyond the Dependency-List file, 
+		 *       such as completing the File Name Announcement first.
+		 *   A NULL output-name buffer is our indicator.
+		 */
+		if ( oname == NULL )
+		{
+		    /*  Quick way to suppress "finish"ing the i-l scan */
+		    tried_stat = FALSE; 
+		}
+	    }
 	fclose(infile);
+	}
+    }
 	
-	/* no zeroes within the file. */
-	for (i=0; i<ilen; i++) {
-		/* start[i]=start[i]?start[i]:0x0a; */
-		start[i] |= (((signed char)start[i] - 1) >> 7) & 0x0a;
+    FFLUSH_STDOUT	/*   Do this first  */
+    /*  Now we can deliver our postponed error and advisory messages  */
+    if ( INVERSE( retval) )
+    {
+	file_is_missing( (char *)name);
+	if ( inp_fil_acc_err )
+	{
+	    expansion_error();
+	    tokenization_error( TKERROR, 
+		"Could not access input file %s\n", name);
+	}else{
+	    if ( inp_fil_open_err )
+	    {
+		expansion_error();
+		could_not_open( TKERROR, (char *)name, "input");
+	    }else{
+		if ( inp_fil_read_err )
+		{
+		    expansion_error();
+		    tokenization_error( TKERROR, 
+			"Could not read input file %s\n", name);
+		}
+	    }
+	}
 	}
-	start[ilen]=0;
 	
-	pc=start; 
-	end=pc+ilen;
+    if ( tried_stat )
+    {
+        finish_incl_list_scan( stat_succ);
+    }
 
+    /*  Don't change the input file name and line-number until after
+     *      the Advisory showing where the file was found.
+     */
+    if ( retval )
+    {
 	iname=strdup(name);
-	
 	lineno=1;
+    }
 	
-	return 0;
+    return ( retval );
 	
 }
 
-int init_output( const char *in_name, const char *out_name )
+/* **************************************************************************
+ *
+ *      Function name:  extend_filename 
+ *      Synopsis:       Change the filename to the given extension
+ *
+ *      Inputs:
+ *         Parameters:
+ *             base_name                  Name of the Input Base File
+ *             new_ext                    New ext'n (with leading period)
+ *
+ *      Outputs:
+ *         Returned Value:                Result filename
+ *         Memory Allocated
+ *             Buffer for result filename
+ *         When Freed?
+ *             At end of Tokenization, by  close_output().
+ *
+ *      Process Explanation:
+ *          If the Input Base File Name has an extension, it will be replaced
+ *              with the given new extension.  If not, the new extension will
+ *              simply be appended.
+ *          If the Input Base File Name has an extension that matches the
+ *              new extension, a duplicate of the extension will be appended.
+ *
+ *      Extraneous Remarks:
+ *          I only recently added protection against the situation where the
+ *              Input Base File Name has no extension, but the Directory Path
+ *              leading to it has a period in one of the directory names.
+ *              Granted, this is a rare case, but not altogether impossible;
+ *              I would have done it earlier except for the fact that the
+ *              separator between directories may vary with different Host
+ *              Operating Systems.
+ *          However, at this point we have UNIX-centric assumptions hard-
+ *              -coded in to so many other places that we might as well
+ *              go with the slash here too.
+ *
+ **************************************************************************** */
+
+static char *extend_filename( const char *base_name, const char *new_ext)
 {
-	const char *ext;
+    char *retval;
+    char *ext;
   	unsigned int len; /* should this be size_t? */
+    const char *root;
+
+    root = strrchr(base_name, '/');
+    if ( root == NULL )  root = base_name;
+
+    ext = strrchr(root, '.');
+    if ( ext != NULL )
+    {
+        if ( strcasecmp(ext, new_ext) == 0 )
+	{
+	    ext = NULL;
+	}
+    }
+
+    len = ext ? (ext - base_name) : (unsigned int)strlen(base_name) ;
+    retval = safe_malloc(len+strlen(new_ext)+1, "extending file-name");
+    memcpy( retval, base_name, len);
+    retval[len] = 0;
+    strcat(retval, new_ext);
 
+    return( retval);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  init_output
+ *      Synopsis:       After the Input Source File has been opened, assign 
+ *                          the name for the Binary Output File; initialize
+ *                          the FCode Output Buffer; assign names for the
+ *                          FLoad List, Dependency-List, and Missing-Files
+ *                          List files; open them and write their first
+ *                          entries to them.
+ *                     Announce the Input and various output file names.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             in_name                  Name of the Input Source File
+ *             out_name                 Name of the Binary Output File, if
+ *                                          specified on the Command Line,
+ *                                          or NULL if not.
+ *         Global Variables:
+ *             fload_list               Whether to create an FLoad-List file
+ *             dependency_list          Whether to create a Dependency-List file
+ *         Local Static Variables:
+ *             include_list_full_path   Full Path to the Input Source File;
+ *                                          should still be valid from opening
+ *                                          of Primary Source Input file, for
+ *                                          first entry to Dependency-List file.
+ *
+ *      Outputs:
+ *         Returned Value:              NONE
+ *         Global Variables:
+ *             oname                    Binary Output File Name
+ *             ostart                   Start of FCode Output Buffer
+ *             opc                      FCode Output Buffer Position Counter
+ *             abs_token_no             Initialized to 1
+ *         Local Static Variables:
+ *             load_list_name           Name of the Load List File
+ *             load_list_file           FLoad List File Structure pointer
+ *             depncy_list_name         Name of the Dependency List File ptr
+ *             depncy_file              Dependency List File Structure
+ *             missing_list_name        Name of the Missing-Files-List File
+ *             missing_list_file        Missing-Files-List File Structure
+ *             no_files_missing         Initialized to TRUE
+ *         Memory Allocated
+ *             Binary Output File Name Buffer
+ *             FCode Output Buffer
+ *             FLoad List File Name Buffer
+ *             Dependency List File Name Buffer
+ *             
+ *         When Freed?
+ *             In  close_output()
+ *         File Output:
+ *             FLoad List or Dependency List files are opened (if specified).
+ *                 Primary Source Input file name and path, respectively,
+ *                 are written as the first entry to each.
+ *         Printout:
+ *             (Announcement of input file name has already been made)
+ *             Announce binary output, fload- and dependency- -list file names
+ *
+ *      Error Detection:
+ *          Failure to open FLoad List or Dependency List file:  ERROR;
+ *              suppress binary output.  Further attempts to write to
+ *              FLoad List or Dependency List files are prevented by
+ *              the respective FILE_structure pointers being NULL.
+ *          Failure to open Missing-Files-List file:  WARNING
+ *
+ *      Process Explanation:
+ *          If no Output File Name was specified on the Command Line, the
+ *              name of the Binary (FCode) Output File will be derived
+ *              from the name of the Input File by replacing its extension
+ *              with  .fc , or, if  the Input File had no extension, by
+ *              merely appending the extension  .fc 
+ *          In the odd case where the Input File name has an extension
+ *              of  .fc, we will merely append another  .fc  extension.
+ *          If  fload_list  is TRUE (i.e., the "-l" option was specified on
+ *              the command-line, the FLoad List File name will be derived
+ *              from the name of the Output File by the same rules, only with
+ *              an extension of  .fl   Open the FLoad List File.  Write the
+ *              name of the initial input file to the FLoad List File.
+ *          Similarly if the "-P" command-line option was specified, the name
+ *              of the Dependency List File will be derived with an extension
+ *              of  .P  Open it and write the Full Path for the initial input
+ *              file to it.  NOTE:  To do that, we need to have preserved the
+ *              Full Path-name Buffer from the call to  init_stream()   We
+ *              will "finish" it here, after we've used it.
+ *          The Missing-Files-List File will be created if either option was
+ *              specified.  Its name will be derived similarly, with an
+ *              extension of  .fl.missing
+ *
+ **************************************************************************** */
+
+void init_output( const char *in_name, const char *out_name )
+{
 	/* preparing output */
 
-	if( out_name )
-		oname = (u8 *)strdup( out_name );
-	else {
-		ext=strrchr(in_name, '.');
-		len=ext ? (unsigned int)(ext-in_name) : (unsigned int)strlen(in_name) ;
-		oname=malloc(len+4);
-		memcpy(oname, in_name, len);
-		oname[len] = 0;
-		strcat((char *)oname, ".fc");
+	if( out_name != NULL )
+	{
+		oname = strdup( out_name );
+	}else{
+		oname = extend_filename( in_name, ".fc"); 
 	}
 	
 	/* output buffer size. this is 128k per default now, but we
 	 * could reallocate if we run out. KISS for now.
 	 */
-	ostart=malloc(OUTPUT_SIZE);
-	if (!ostart) {
-		free(oname);
-		free(start);
-		return -1;
+	olen = OUTPUT_SIZE;
+	ostart=safe_malloc(olen, "initting output buffer");
+
+	opc = 0;
+	init_emit();  /* Init'l'zns needed by our companion file, emit.c  */
+
+	printf("Binary output to %s ", oname);
+	if ( fload_list )
+	{
+	    load_list_name = extend_filename( oname, ".fl");
+	    load_list_file = fopen( load_list_name,"w");
+	    printf("  FLoad-list to %s ", load_list_name);
+	}
+	if ( dependency_list )
+	{
+	    depncy_list_name = extend_filename( oname, ".P");
+	    depncy_file = fopen( depncy_list_name,"w");
+	    printf("  Dependency-list to %s ", depncy_list_name);
 	}
+	printf("\n");
 
-	opc=oend=ostart;
-	oend+=OUTPUT_SIZE;
+	add_to_load_lists( in_name);
 	
-	/* We're beginning a new output file, so we have to
-	 * start our own fcode numbers at 0x800 again. 
-	 */
-	nextfcode=0x800;
+	/*  Let's avoid collisions between stdout and stderr  */
+	FFLUSH_STDOUT
+
+	/*  Now we can deliver our advisory and error messages  */
 	
-	return 0;
+	{
+	    /* Suspend showing filename in advisory and error messages. */
+	    char *temp_iname = iname;
+	    iname = NULL; 
+	
+	    finish_incl_list_scan( TRUE);
+
+	    if ( fload_list && (load_list_file == NULL) )
+	    {
+	    	could_not_open( TKERROR, load_list_name, "Load-List");
+		free( load_list_name);
+	    }
+	    if ( dependency_list && (depncy_file == NULL) )
+	    {
+	    	could_not_open( TKERROR, depncy_list_name,
+		    "Dependency-List");
+		free( depncy_list_name);
 }
 
-int close_stream(void)
+	    if ( fload_list || dependency_list )
+	    {
+		missing_list_name = extend_filename( oname, ".fl.missing");
+		missing_list_file = fopen( missing_list_name,"w");
+		no_files_missing = TRUE;
+
+		if ( missing_list_file == NULL )
+		{
+		    could_not_open( WARNING, missing_list_name,
+			"Missing-Files List" );
+	            free( missing_list_name);
+		}
+	    }
+	    iname = temp_iname;
+	}
+	abs_token_no = 1;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  increase_output_buffer
+ *      Synopsis:       Reallocate the Output Buffer to double its prior size 
+ *
+ *      Inputs:
+ *         Parameters:                  NONE
+ *         Global Variables:
+ *             ostart                   Start-address of current Output Buffer
+ *             olen                     Current size of the Output Buffer
+ *         Local Static Variables:
+ *
+ *      Outputs:
+ *         Returned Value:                 NONE
+ *         Local Static Variables:
+ *             olen                     Doubled from value at input
+ *             ostart                   Start-address of new Output Buffer
+ *         Memory Allocated
+ *             A new FCode Output Buffer, using the  realloc()  facility.
+ *         When Freed?
+ *             In  close_output()
+ *         Memory Freed
+ *             Former FCode Output Buffer, also by means of  realloc() 
+ *
+ *         Printout:
+ *             Advisory message that this is taking place.
+ *
+ *      Error Detection:
+ *          FATAL if  realloc()  fails.
+ *          FATAL if output buffer has been expanded to a size beyond
+ *              what an INT can express.  Unlikely? maybe; impossible? no...
+ *
+ *      Process Explanation:
+ *          Because we are allowing the Output Buffer to be relocated, we
+ *              must take care to limit the exposure to external routines
+ *              of its actual address.  All references to locations within
+ *              the Output Buffer should be made in terms of an _offset_.
+ *
+ *      Extraneous Remarks:
+ *          Unfortunately, it is not feasible to completely isolate the
+ *              actual address of the Output Buffer, but we will keep the
+ *              exposure limited to the routines in  emit.c
+ *          Similarly, it wasn't feasible to keep this routine isolated,
+ *              nor the variable  olen  , but we will limit their exposure.
+ *
+ **************************************************************************** */
+void increase_output_buffer( void );  /*  Keep the prototype local  */
+void increase_output_buffer( void )
+{
+    u8 *newout;
+
+    if ( olen == 0 )
+    {
+	tokenization_error( FATAL,
+		"Output Buffer reallocation overflow.");
+    }else{
+	unsigned int rea_len;
+	olen = olen * 2;
+	rea_len = olen;
+	if ( rea_len == 0 )   rea_len = (unsigned int)-1;
+	tokenization_error( INFO,
+	    "Output Buffer overflow.  "
+		"Relocating and increasing to %d bytes.\n", rea_len);
+
+	newout = realloc(ostart, rea_len);
+	if ( newout == NULL)
+	{
+	    tokenization_error( FATAL,
+		"Could not reallocate %d bytes for Output Buffer", rea_len);
+	}
+
+	ostart = newout;
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  close_stream
+ *      Synopsis:       Free-up the memory used for the current input file
+ *                          whenever it is closed.  Reset pointers and
+ *                          line-counter.  Close files as necessary.
+ *
+ *      The dummy parameter is there to accommodate Macro-recursion protection. 
+ *          It's a long story; don't get me started...
+ *
+ **************************************************************************** */
+
+void close_stream( _PTR dummy)
 {
 	free(start);
 	free(iname);
-	return 0;	
+	start = NULL;
+	iname = NULL;
+	lineno = 0;
 }
 
-int close_output(void)
+/* **************************************************************************
+ *
+ *      Function name:  close_output
+ *      Synopsis:       Write the Binary Output file, if appropriate.
+ *                          Return a "Failure" flag.
+ *
+ **************************************************************************** */
+
+
+bool close_output(void)
+{
+    bool retval = TRUE;  /*  "Failure"  */
+    if ( error_summary() )
+    { 
+	if ( opc == 0 )
 {
+	    retval = FALSE;  /*  "Not a problem"  */
+	}else{
 	FILE *outfile;
-	unsigned int len;
 
-	len=(unsigned long)opc-(unsigned long)ostart;
+	    outfile=fopen( oname,"w");
+	    if (!outfile)
+	    {
+		/*  Don't do this as a  tokenization_error( TKERROR
+		 *      because those are all counted, among other reasons...
+		 */ 
+		printf( "Could not open file %s for output.\n", oname);
+	    }else{
 	
-	outfile=fopen((char *)oname,"w");
-	if (!outfile) {
-		printf("toke: error opening output file.\n");
-		return -1;
+		if ( fwrite(ostart, opc, 1, outfile) != 1 )
+		{
+		    tokenization_error( FATAL, "While writing output.");
 	}
 	
-	if(fwrite(ostart, len, 1, outfile)!=1)
-		printf ("toke: error while writing output.\n");
-
 	fclose(outfile);
 
-	printf("toke: wrote %d bytes to bytecode file '%s'\n", len, oname);
+		printf("toke: wrote %d bytes to bytecode file '%s'\n",
+		    opc, oname);
+		retval = FALSE;  /*  "No problem"  */
+	    }
+	}
+    }
 	
 	free(oname);
-	return 0;
+    free(ostart);
+    oname = NULL;
+    ostart = NULL;
+    opc = 0;
+    olen = OUTPUT_SIZE;
+
+    if ( load_list_file != NULL )
+    {
+	fclose(load_list_file);
+	free(load_list_name);
+    }
+    if ( depncy_file != NULL )
+    {
+	fclose(depncy_file);
+	free(depncy_list_name);
+    }
+    if ( missing_list_file != NULL )
+    {
+	fclose( missing_list_file);
+	if ( no_files_missing )
+	{
+	    remove( missing_list_name);
+	}
+	free( missing_list_name);
+    }
+
+    load_list_file = NULL;
+    load_list_name = NULL;
+    missing_list_file = NULL;
+    missing_list_name = NULL;
+    depncy_file = NULL;
+    depncy_list_name = NULL;
+
+    return ( retval );
 }
 
diff --git a/toke/stream.h b/toke/stream.h
index 010c7fc..cd11e9b 100644
--- a/toke/stream.h
+++ b/toke/stream.h
@@ -1,3 +1,6 @@
+#ifndef _H_STREAM
+#define _H_STREAM
+
 /*
  *                     OpenBIOS - free your system! 
  *                         ( FCode tokenizer )
@@ -24,15 +27,68 @@
  *
  */
 
-#ifndef _H_STREAM
-#define _H_STREAM
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
 
-int init_stream( const char *name );
-int close_stream(void);
-int init_output( const char *inname, const char *outname );
-int close_output(void);
+#include "types.h"
 
-extern unsigned int 	lineno;
+/* **************************************************************************
+ *
+ *          Exported Global Variables
+ *
+ **************************************************************************** */
+
+/* input pointers */
+extern u8 *start;
+extern u8 *pc;
+extern u8 *end;
 extern char		*iname;
+extern unsigned int lineno;         /* Line Number within current input file  */
+extern unsigned int abs_token_no;   /* Absolute Token Number in Source Input  */
+
+/* output pointers */
+extern char *oname;         /* output file name  */
+
+extern unsigned int opc;    /* output buffer position counter  */
+
+/* **************************************************************************
+ *
+ *    Note that the variables  ostart  and  olen , as well as the routine
+ *         increase_output_buffer  are not listed here.
+ *
+ *    We would have preferred to isolate them completely, but we would have
+ *        to disrupt the organization of  emit.c  (which we'd rather not);
+ *        in order to avoid exporting them any more widely than necessary,
+ *        we will declare them  extern  only in the file where they are
+ *        unavoidably needed.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *          Macro Name:    OUTPUT_SIZE
+ *                        Initial size of the Output Buffer
+ *
+ **************************************************************************** */
+
+#define OUTPUT_SIZE	131072
+
+
+/* **************************************************************************
+ *
+ *          Exported Functions
+ *
+ **************************************************************************** */
+
+void add_to_include_list( char *dir_compt);
+void display_include_list( void);
+FILE *open_expanded_file( const char *path_name, char *mode, char *for_what);
+bool init_stream( const char *name );
+void close_stream( _PTR dummy);
+void init_output( const char *inname, const char *outname );
+bool close_output(void);
+void init_inbuf(char *inbuf, unsigned int buflen);
 
 #endif   /* _H_STREAM */
diff --git a/toke/strsubvocab.c b/toke/strsubvocab.c
new file mode 100644
index 0000000..ddb6139
--- /dev/null
+++ b/toke/strsubvocab.c
@@ -0,0 +1,337 @@
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      General-purpose support functions for
+ *          String-Substitution-type vocabularies
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      A String-Substitution vocabulary, as the name implies, is one in
+ *          in which each an entry consists of two strings;  one that is
+ *          sought, and one that is returned as a substitute.  Macros and
+ *          aliases are implemented this way, as are also user-supplied
+ *          command-line symbol definitions.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Functions Exported:
+ *          init_str_sub_vocab     Initialize a String-Substitution vocab
+ *          add_str_sub_entry      Add an entry to a Str-Subst vocab
+ *          lookup_str_sub         Look for a name in a String-Substitution
+ *                                     vocab, return the substitution string.
+ *          exists_in_str_sub      Confirm whether a given name exists in a
+ *                                     String-Substitution vocabulary
+ *          create_str_sub_alias   Duplicate the behavior of one name with
+ *                                     another name.  Return a "success" flag.
+ *          reset_str_sub_vocab    Reset a given Str-Subst vocab to its initial
+ *                                    "Built-In" position.
+ *
+ *
+ **************************************************************************** */
+
+#include <stdio.h>
+#include <stdlib.h>
+#if defined(__linux__) && ! defined(__USE_BSD)
+#define __USE_BSD
+#endif
+#include <string.h>
+
+#include "errhandler.h"
+#include "strsubvocab.h"
+
+
+/* **************************************************************************
+ *
+ *      Function name:  init_str_sub_vocab
+ *      Synopsis:       Dynamically initialize the link-pointers
+ *                          of the.given String-Substitution vocabulary
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             str_sub_vocab_tbl   Pointer to the initial Str-Subst vocab array
+ *             max_indx            Maximum Index of the initial array.
+ *
+ *      Outputs:
+ *         Returned Value:          None
+ *         Global Variables:
+ *              The link-fields of the initial Str-Subs vocab array entries
+ *                  will be filled in.
+ *
+ **************************************************************************** */
+
+void init_str_sub_vocab( str_sub_vocab_t *str_sub_vocab_tbl, int max_indx)
+{
+    int indx;
+    for ( indx = 1 ; indx < max_indx ; indx++ )
+    {
+        str_sub_vocab_tbl[indx].next = &str_sub_vocab_tbl[indx-1];
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  add_str_sub_entry
+ *      Synopsis:       Add an entry to the given Str-Subst vocab
+ *      
+ *      Inputs:
+ *         Parameters:         Pointer to:
+ *             ename               space containing the name of the entry
+ *             subst_str           space containing the substitution string
+ *             *str_sub_vocab      the "tail" of the Str-Subst vocab-list 
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *         Supplied Pointers:
+ *             *str_sub_vocab       Will point to new entry
+ *         Memory Allocated:
+ *             Memory for the new entry will be allocated.
+ *         When Freed?
+ *             When reset_str_sub_vocab() is applied to the same vocab-list.
+ *                 In some instances, the new entry will be freed upon end
+ *                 of tokenization; in others, only on termination of program.
+ *
+ *      Error Detection:
+ *          Failure to allocate memory is a Fatal Error.
+ *
+ *      Process Explanation:
+ *          The name and substitution-string pointers are presumed to already
+ *              point to stable memory-spaces.  Memory will be allocated
+ *              for the entry itself; its pointers will be entered and the
+ *              given pointer-to-the-tail-of-the-vocabulary will be updated.
+ *
+ *      Extraneous Remarks:
+ *          This might have been where we would have checked for re-aliasing,
+ *              but the introduction of the approach to aliasing embodied in
+ *              the various  create_..._alias()  routines neatly bypasses it.
+ *
+ **************************************************************************** */
+
+void add_str_sub_entry( char *ename,
+                            char *subst_str,
+			        str_sub_vocab_t **str_sub_vocab )
+{
+    str_sub_vocab_t *new_entry;
+
+    new_entry = safe_malloc(sizeof(str_sub_vocab_t), "adding str_sub_entry");
+    new_entry->name   =  ename;
+    new_entry->alias  =  subst_str;
+    new_entry->next   = *str_sub_vocab;
+
+    *str_sub_vocab = new_entry;
+
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  lookup_str_sub
+ *      Synopsis:       Look for a name in the given Str-Subst vocabulary
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             tname                The "target" name for which to look
+ *             str_sub_vocab        The Str-Subst vocab-list
+ *
+ *      Outputs:
+ *         Returned Value:          Pointer to the substitution string, or
+ *                                      NULL pointer if name not found.
+ *                                  May be NULL if subst'n string is NULL.
+ *
+ **************************************************************************** */
+
+char *lookup_str_sub( char *tname, str_sub_vocab_t *str_sub_vocab )
+{
+    str_sub_vocab_t *curr;
+    char *retval = NULL;
+
+    for (curr = str_sub_vocab ; curr != NULL ; curr=curr->next)
+    {
+        if ( strcasecmp(tname, curr->name) == 0 )
+	{
+	    retval = curr->alias;
+	    break;
+	}
+    }
+    return ( retval ) ;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  exists_in_str_sub
+ *      Synopsis:       Confirm whether a given name exists in a given
+ *                          String-Substitution vocabulary
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             tname                The "target" name for which to look
+ *             str_sub_vocab        Pointer to the Str-Subst vocab-list
+ *
+ *      Outputs:
+ *         Returned Value:     TRUE if the name is found
+ *
+ *      Extraneous Remarks:
+ *          Because the Returned Value of lookup_str_sub() may be NULL for 
+ *              other reasons than that the name was not found, we cannot
+ *              rely on that routine, and must replicate the outer-shell
+ *              of its structure.
+ *
+ **************************************************************************** */
+
+bool exists_in_str_sub( char *tname, str_sub_vocab_t *str_sub_vocab )
+{
+    str_sub_vocab_t *curr;
+    bool retval = FALSE;
+
+    for (curr = str_sub_vocab ; curr != NULL ; curr=curr->next)
+    {
+        if ( strcasecmp(tname, curr->name) == 0 )
+	{
+	    retval = TRUE;
+	    break;
+	}
+    }
+    return ( retval );
+
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  create_str_sub_alias
+ *      Synopsis:       Create an Alias in a String-Substitution vocabulary
+ *                          Return a "success" flag.
+ *
+ *      Associated FORTH word:                 ALIAS
+ *
+ *      Inputs:
+ *         Parameters:
+ *             old_name             Name of existing entry
+ *             new_name             New name for which to create an entry
+ *             *str_sub_vocab       Pointer to "tail" of Str-Subst vocab-list
+ *
+ *      Outputs:
+ *         Returned Value:          TRUE if  old_name  found in str_sub_vocab
+ *         Supplied Pointers:
+ *             *str_sub_vocab       Will be updated to point to the new entry
+ *         Memory Allocated:
+ *             A copy of the "old" name's substitution string.
+ *         When Freed?
+ *             When reset_str_sub_vocab() is applied to the same vocab-list.
+ *                 In some instances, the new entry will be freed when the
+ *                 device-node in which it was created is "finish"ed; in
+ *                 others, only on termination of the program.
+ *
+ *      Process Explanation:
+ *          The "new" name is presumed to point to a stable memory-space.
+ *          If the given "old" name exists in the given Str-Subst vocab-list,
+ *              duplicate the substitution string into newly-allocated memory
+ *              and pass the duplicated string and the "new" name along to
+ *              the  add_str_sub_entry()  routine and return TRUE.
+ *          If the given "old" name does not exist in the given vocab-list,
+ *              return FALSE.
+ *
+ *      Extraneous Remarks:
+ *          This neatly bypasses the question of re-aliasing...  ;-)
+ *
+ *          We can rely on testing for a returned NULL from lookup_str_sub()
+ *              because we won't be applying this routine to any vocabulary
+ *              that permits a NULL in its substitution string.
+ *
+ **************************************************************************** */
+
+bool create_str_sub_alias(char *new_name,
+                              char *old_name,
+			          str_sub_vocab_t **str_sub_vocab )
+{
+    bool retval = FALSE;
+    char *old_subst_str = lookup_str_sub( old_name, *str_sub_vocab );
+    if ( old_subst_str != NULL )
+    {
+        char *new_subst_str = strdup(old_subst_str );
+	add_str_sub_entry(new_name, new_subst_str, str_sub_vocab );
+	retval = TRUE ;
+    }
+
+    return ( retval );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  reset_str_sub_vocab
+ *      Synopsis:       Reset a given Str-Subst vocab to its initial
+ *                         "Built-In" position.
+ *      
+ *      Inputs:
+ *         Parameters:
+ *            *str_sub_vocab         Pointer to the Str-Subst vocab-list 
+ *             reset_position        Position to which to reset the list
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *         Supplied Pointers:
+ *             *str_sub_vocab       Reset to given "Built-In" position.
+ *         Memory Freed
+ *             All memory allocated by user-definitions will be freed
+ *
+ *      Process Explanation:
+ *          The "stable memory-spaces" to which the name and substitution
+ *              string pointers point are presumed to have been acquired
+ *              by allocation of memory, which is reasonable for entries
+ *              created by the user as opposed to the built-in entries,
+ *              which we are, in any case, not releasing.
+ *          The substitution-string pointer may be null; watch out when
+ *              we free() it; not all C implementations forgive that.
+ *
+ **************************************************************************** */
+
+void reset_str_sub_vocab(
+            str_sub_vocab_t **str_sub_vocab ,
+	             str_sub_vocab_t *reset_position )
+{
+    str_sub_vocab_t *next_t;
+
+    next_t = *str_sub_vocab;
+    while ( next_t != reset_position  )
+    {
+	next_t = (*str_sub_vocab)->next ;
+
+	free( (*str_sub_vocab)->name );
+	if ( !(*str_sub_vocab)->alias )
+	{
+	    free( (*str_sub_vocab)->alias );
+	}
+	free( *str_sub_vocab );
+	*str_sub_vocab = next_t ;
+    }
+}
+
diff --git a/toke/strsubvocab.h b/toke/strsubvocab.h
new file mode 100644
index 0000000..5b404da
--- /dev/null
+++ b/toke/strsubvocab.h
@@ -0,0 +1,85 @@
+#ifndef _TOKE_STRSUBVOCAB_H
+#define _TOKE_STRSUBVOCAB_H
+
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Headers, general-purpose support structures, function prototypes
+ *          and macros for String-Substitution-type vocabularies.
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Structures:
+ *          str_sub_vocab_t        Entry in a String-Substitution-type vocab 
+ *
+ *      Macros:
+ *          BUILTIN_STR_SUB        Add an entry to the initial Str-Sub vocab.
+ *
+ **************************************************************************** */
+
+#include "types.h"
+
+
+typedef struct str_sub_vocab {
+	u8  *name;
+	u8  *alias;
+	struct str_sub_vocab *next;
+} str_sub_vocab_t;
+
+#if  0     /*  On the way out   */
+/*
+ *          BUILTIN_STR_SUB        Add an entry to the initial Str-Sub vocab.
+ *
+ *      Arguments:  (Both are strings)
+ *          princ         Principal name by which the string is known
+ *          subst         Substitution-string that replaces the Principal.
+ */
+#define BUILTIN_STR_SUB(princ, subst)    \
+     { princ , subst , (str_sub_vocab_t *)NULL  }
+#endif     /*  On the way out   */
+
+
+void init_str_sub_vocab( str_sub_vocab_t *str_sub_vocab_tbl,
+			            int max_indx);
+void add_str_sub_entry( char *ename,
+                        	    char *subst_str,
+			        	str_sub_vocab_t **str_sub_vocab );
+char *lookup_str_sub( char *tname, str_sub_vocab_t *str_sub_vocab );
+bool create_str_sub_alias(char *new_name,
+                        	     char *old_name,
+			        	 str_sub_vocab_t **str_sub_vocab );
+bool exists_in_str_sub( char *tname, str_sub_vocab_t *str_sub_vocab );
+void reset_str_sub_vocab( str_sub_vocab_t **str_sub_vocab ,
+	        		     str_sub_vocab_t *reset_position );
+
+
+#endif   /*  _TOKE_STRSUBVOCAB_H    */
diff --git a/toke/ticvocab.c b/toke/ticvocab.c
new file mode 100644
index 0000000..5214f8f
--- /dev/null
+++ b/toke/ticvocab.c
@@ -0,0 +1,426 @@
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      General-purpose support functions for
+ *      Threaded Interpretive Code (T. I. C.)-type vocabularies
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      We are going to implement a strategy that takes better advantage
+ *          of the concept of Threaded Interpretive Code  (well, okay,
+ *          it won't really be interpretive ... )  We will use it to
+ *          implement a small (but expandable) subset of FORTH-like
+ *          commands in Tokenizer-Escape mode, as well as a few other
+ *          things, such as conditional-tokenization.
+ *
+ *      The Threaded Interpretive Code Header data structure is described
+ *          in detail in the accompanying  ticvocab.h  header-file.
+ *
+ *      In most cases, the contents of a beginning portion of the vocabulary
+ *          are known at compile-time, and later parts are added by the
+ *          user at run-time.  (The linked-list structure is needed to allow
+ *          for that.)  We can initialize the known start of the vocabulary
+ *          easily, except for the link-pointers, as an array.
+ *      We can either explicitly state an index for each entry's link-pointer
+ *          to the previous entry (which can become a problem to maintain) or
+ *          have a function to initialize the links dynamically, at run-time.
+ *      I think I will (regretfully, resignedly) choose the latter.
+ *          
+ *      We will define a few general-purpose functions for dealing with
+ *          T. I. C. -type vocabularies.  Eventually, it might be a good
+ *          idea to convert all the vocabularies to this structure...
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *
+ *      Revision History:
+ *          Mon, 19 Dec 2005 by David L. Paktor
+ *          Begin converting most, if not all, of the vocabularies to
+ *              T. I. C. -type structure.
+ *
+ **************************************************************************** */
+
+
+/* **************************************************************************
+ *
+ *      Functions Exported:
+ *          init_tic_vocab        Initialize a TIC_HDR -type vocabulary
+ *          add_tic_entry         Add an entry to a TIC_HDR -type vocabulary
+ *          lookup_tic_entry      Look for a name in a TIC_HDR -type vocabulary
+ *          handle_tic_vocab      Perform a function in a TIC_HDR -type vocab
+ *          exists_in_tic_vocab   Confirm whether a given name exists in a
+ *                                    TIC_HDR -type vocabulary
+ *          create_tic_alias      Duplicate the behavior of one name with
+ *                                     another name.  Return a "success" flag.
+ *          reset_tic_vocab       Reset a given TIC_HDR -type vocabulary to
+ *                                    its "Built-In" position.
+ *
+ **************************************************************************** */
+
+
+/* **************************************************************************
+ *
+ *          Global Variables Exported
+ *              tic_found       The entry, in a TIC_HDR -type vocabulary,
+ *                                  that has just been found and is being 
+ *                                  "handled".  Needed for protection against
+ *                                  recursion in a User-defined Macro (which
+ *                                  should occur only rarely).
+ *
+ **************************************************************************** */
+
+
+#include <stdlib.h>
+#include <string.h>
+#include "ticvocab.h"
+#include "errhandler.h"
+
+tic_hdr_t *tic_found;
+
+/* **************************************************************************
+ *
+ *      Function name:  init_tic_vocab
+ *      Synopsis:       Dynamically initialize the link-pointers
+ *                          of the.given TIC_HDR -type vocabulary
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tic_vocab_tbl       Pointer to the initial TIC_HDR vocab array
+ *             max_indx            Maximum Index of the initial array.
+ *             tic_vocab_ptr       Pointer to the vocab "tail"
+ *
+ *      Outputs:
+ *         Returned Value:         None
+ *         Global Variables:
+ *              The link-fields of the initial TIC_HDR vocab array entries
+ *                  will be filled in.
+ *         Supplied Pointers:
+ *             *tic_vocab_ptr       Points to the last element in the array
+ *
+ *      Process Explanation:
+ *          The value that  tic_vocab_ptr  has upon entry to the routine
+ *              (which may point to the end of another array which is to
+ *              precede this one in the voacbulary) gets entered into
+ *              the link-pointer field of the first element of the array.
+ *          For this reason, it is important that all TIC_HDR vocabulary
+ *              pointers that will be pased to this routine have their
+ *              initial values explicitly declared NULL. 
+ *
+ **************************************************************************** */
+
+void init_tic_vocab( tic_hdr_t *tic_vocab_tbl,
+                         int max_indx,
+			     tic_hdr_t **tic_vocab_ptr)
+{
+    int indx;
+    for ( indx = 0 ; indx < max_indx ; indx++ )
+    {
+        tic_vocab_tbl[indx].next = *tic_vocab_ptr;
+	*tic_vocab_ptr = &tic_vocab_tbl[indx];
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  add_tic_entry
+ *      Synopsis:       Add an entry to the given TIC_HDR -type vocabulary
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname         Pointer to space containing the name of the entry
+ *             tfunct        Pointer to the routine the new entry will call
+ *             tparam        The "parameter field" value (may be a pointer)
+ *             fw_defr       FWord Token of the entry's Definer
+ *             pfldsiz       Size of "param field" (if a pointer to alloc'd mem)
+ *             ign_fnc       Pointer to "ignoring" routine for new entry
+ *             tic_vocab     Pointer to ptr to "tail" of T.I.C.-type vocab-list 
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *         Supplied Pointers:
+ *             *tic_vocab           Will point to new entry
+ *         Memory Allocated:
+ *             For the new entry.
+ *         When Freed?
+ *             When reset_tic_vocab() is applied to the same vocab-list.
+ *
+ *      Error Detection:
+ *          Failure to allocate memory is a Fatal Error.
+ *
+ *      Process Explanation:
+ *          The name pointer is presumed to already point to a stable,
+ *              newly-allocated memory-space.  If the parameter field is
+ *              actually a pointer, it, too, is presumed to already have
+ *              been allocated.
+ *          Memory will be allocated for the entry itself; its pointers
+ *              will be entered and the given pointer-to-the-tail-of-the-
+ *              -vocabulary will be updated to point to the new entry.
+ *
+ **************************************************************************** */
+
+void add_tic_entry( char *tname,
+                        void (*tfunct)(),
+                             TIC_P_DEFLT_TYPE tparam,
+                                 fwtoken fw_defr,
+				     int pfldsiz,
+                                         void (*ign_fnc)(),
+                                             tic_hdr_t **tic_vocab )
+{
+    tic_hdr_t *new_entry;
+
+    new_entry = safe_malloc(sizeof(tic_hdr_t), "adding tic_entry");
+    new_entry->name              =  tname;
+    new_entry->next              = *tic_vocab;
+    new_entry->funct             =  tfunct;
+    new_entry->pfield.deflt_elem =  tparam;
+    new_entry->fword_defr        =  fw_defr;
+    new_entry->ign_func          =  ign_fnc;
+    new_entry->pfld_size         =  pfldsiz;
+
+    *tic_vocab = new_entry;
+
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  lookup_tic_entry
+ *      Synopsis:       Look for a name in the given TIC_HDR -type vocabulary
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                The "target" name for which to look
+ *             tic_vocab            Pointer to the T. I. C. -type vocabulary
+ *
+ *      Outputs:
+ *         Returned Value:          Pointer to the relevant entry, or
+ *                                      NULL if name not found.
+ *
+ *      Extraneous Remarks:
+ *          We don't set the global  tic_found  here because this routine
+ *              is not always called when the found function is going to
+ *              be executed; sometimes it is called for error-detection,
+ *              for instance...
+ *
+ **************************************************************************** */
+ 
+tic_hdr_t *lookup_tic_entry( char *tname, tic_hdr_t *tic_vocab )
+{
+    tic_hdr_t *curr ;
+
+    for (curr = tic_vocab ; curr != NULL ; curr=curr->next)
+    {
+        if ( strcasecmp(tname, curr->name) == 0 )
+	{
+	    break;
+	}
+    }
+
+    return ( curr ) ;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  exists_in_tic_vocab
+ *      Synopsis:       Confirm whether the given name exists in the
+ *                      given TIC_HDR -type vocabulary
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                The name for which to look
+ *             tic_vocab            Pointer to the T. I. C. -type vocabulary
+ *
+ *      Outputs:
+ *         Returned Value:          TRUE if name is found,
+ *
+ **************************************************************************** */
+
+bool exists_in_tic_vocab( char *tname, tic_hdr_t *tic_vocab )
+{
+    tic_hdr_t *found ;
+    bool retval = FALSE;
+
+    found = lookup_tic_entry( tname, tic_vocab );
+    if ( found != NULL )
+    {
+	retval = TRUE;
+    }
+
+    return ( retval );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  create_tic_alias
+ *      Synopsis:       Create an Alias in a TIC_HDR -type vocabulary
+ *                          Return a "success" flag.
+ *
+ *      Associated FORTH word:                 ALIAS
+ *
+ *      Inputs:
+ *         Parameters:
+ *             old_name             Name of existing entry
+ *             new_name             New name for which to create an entry
+ *             *tic_vocab           Pointer to the "tail" of the
+ *                                      T. I. C. -type vocab-list 
+ *
+ *      Outputs:
+ *         Returned Value:          TRUE if  old_name  found in given vocab
+ *         Supplied Pointers:
+ *             *tic_vocab           Will be updated to point to the new entry
+ *         Memory Allocated:
+ *             For the new entry, by the support routine.
+ *         When Freed?
+ *             When reset_tic_vocab() is applied to the same vocab-list.
+ *
+ *      Process Explanation:
+ *          Both the "old" and "new" names are presumed to already point to
+ *              stable, freshly allocated memory-spaces.
+ *          Even if the "old" entry's  pfld_size  is not zero, meaning its
+ *              param-field is a pointer to allocated memory, we still do
+ *              not need to copy it into a freshly allocated memory-space,
+ *              as long as we make the new alias-entry's  pfld_size  zero:
+ *              the reference to the old space will work, and the old
+ *              entry's param-field memory space will not be freed with
+ *              the alias-entry but only with the "old" entry.
+ *
+ **************************************************************************** */
+
+bool create_tic_alias( char *new_name, char *old_name, tic_hdr_t **tic_vocab )
+{
+    tic_hdr_t *found ;
+    bool retval = FALSE;
+
+    found = lookup_tic_entry( old_name, *tic_vocab );
+    if ( found != NULL )
+    {
+	add_tic_entry( new_name, found->funct,
+			   found->pfield.deflt_elem,
+			       found->fword_defr,
+			           0, found->ign_func, tic_vocab );
+	retval = TRUE;
+    }
+
+    return ( retval );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  handle_tic_vocab
+ *      Synopsis:       Perform the function associated with the given name
+ *                      in the given TIC_HDR -type vocabulary
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                The "target" name for which to look
+ *             tic_vocab            Pointer to the T. I. C. -type vocabulary
+ *
+ *      Outputs:
+ *         Returned Value:   TRUE if the given name is valid in the given vocab
+ *         Global Variables:
+ *             tic_found            Points to the TIC entry of the "target"
+ *                                      name, if it was found; else, NULL.
+ *         Global Behavior:
+ *             Whatever the associated function does...
+ *
+ *      Process Explanation:
+ *          Find the name and execute its associated function.
+ *          If the name is not in the given vocabulary, return
+ *              an indication; leave it to the calling routine
+ *              to decide how to proceed.
+ *
+ **************************************************************************** */
+ 
+bool handle_tic_vocab( char *tname, tic_hdr_t *tic_vocab )
+{
+    bool retval = FALSE;
+    
+    tic_found = lookup_tic_entry( tname, tic_vocab );
+    if ( tic_found != NULL )
+    {
+        tic_found->funct( tic_found->pfield);
+	retval = TRUE;
+    }
+
+    return ( retval ) ;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  reset_tic_vocab
+ *      Synopsis:       Reset a given TIC_HDR -type vocabulary to
+ *                          its given "Built-In" position.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             *tic_vocab            Pointer to the T. I. C.-type vocab-list
+ *             reset_position        Position to which to reset the list
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Supplied Pointers:
+ *             *tic_vocab          Reset to given "Built-In" position.
+ *         Memory Freed
+ *             All memory allocated by user-definitions will be freed
+ *
+ *      Process Explanation:
+ *          The "stable memory-spaces" to which the name and parameter
+ *              field pointers point are presumed to have been acquired
+ *              by allocation of memory, which is reasonable for entries
+ *              created by the user as opposed to the built-in entries,
+ *              which we are, in any case, not releasing.
+ *          The parameter-field size field tells us whether we need to
+ *              free()  the parameter-field pointer.
+ *
+ **************************************************************************** */
+
+void reset_tic_vocab( tic_hdr_t **tic_vocab, tic_hdr_t *reset_position )
+{
+    tic_hdr_t *next_t;
+
+    next_t = *tic_vocab;
+    while ( next_t != reset_position  )
+    {
+	next_t = (*tic_vocab)->next ;
+
+	free( (*tic_vocab)->name );
+	if ( (*tic_vocab)->pfld_size != 0 )
+	{
+	    free( (*tic_vocab)->pfield.chr_ptr );
+	}
+	free( *tic_vocab );
+	*tic_vocab = next_t ;
+    }
+}
diff --git a/toke/ticvocab.h b/toke/ticvocab.h
new file mode 100644
index 0000000..0d41466
--- /dev/null
+++ b/toke/ticvocab.h
@@ -0,0 +1,478 @@
+#ifndef _TOKE_TICVOCAB_H
+#define _TOKE_TICVOCAB_H
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      General-purpose support structures and function prototypes for
+ *          Threaded Interpretive Code (T. I. C.)-type vocabularies.
+ *          See ticvocab.c
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Structures:
+ *
+ *      The Threaded Interpretive Code Header data structure consists of:
+ *          (1)  A pointer to the function name as seen in the source
+ *          (2)  A link to the next (well, preceding) element
+ *          (3)  A Pointer to the routine to run as the function's behavior
+ *               during active processing.  It takes the "parameter field"
+ *               item as its argument and has no return-value.
+ *          (4)  The "parameter field" item, which will be passed as an
+ *               argument to the function. It may be an FCode- or FWord-
+ *               -token, or an item of another type, or a pointer to data.
+ *               The function may re-cast it as needed.
+ *          (5)  The "Definer" of the entry; a member of the subset of FWord-
+ *               -tokens that may be Definers.
+ *          (6)  A Pointer to a routine to be run when the word is encountered
+ *               in a Conditional Compilation section that is being ignored.
+ *               Certain functions still need to be recognized in that state,
+ *               and will require special behaviors; those that can be simply
+ *               ignored will have a NULL pointer in this field.  The function
+ *               in this field, also, takes the "parameter field" item as its
+ *               argument and has no return-value.
+ *          (7)  The size of the data pointed to by the "parameter field" item,
+ *               if it is a pointer to allocated data; used to allocate space
+ *               for a copy of the p.f. when making an alias, and to indicate
+ *               whether the space needs to be freed.  Automatic procedures
+ *               are too often fooled, so we don't leave things to chance...
+ *      To accommodate C's insistence on strong-typing, we might need
+ *          to define different "parameter field" structure-types; see
+ *          description of "Parameter Field as a union", below.
+ *
+ *      It's not an exact name, but we'll still call it a T. I. C. Header
+ *
+ *      We will use this structure for most of our vocabularies...
+ *
+ ****************************************************************************
+ *
+ *     The "Parameter Field" is a union of several alternative types,
+ *         for convenience, to avert excessive type-casting.  It may
+ *         either be the Parameter Data itself (if it is small enough)
+ *         or a pointer to Parameter Data.
+ *     In the case where the Parameter Field is the data itself, or is a
+ *         pointer to hard-coded (non-allocated) data, the "size" field
+ *         will be zero, to indicate that no space allocation is required.
+ *     The types are (starting with the default for initialization)
+ *         A long integer (including an FCode Token)
+ *         An FWord Token
+ *         A pointer to a boolean variable
+ *         A pointer to a character or a character string
+ *         If the parameter field value is intended to be a single character,
+ *             it must be recast as a long integer, in order to preserve
+ *             portability across big- and little- -endian platforms.
+ *
+ **************************************************************************** */
+
+/* ************************************************************************** *
+ *
+ *      Macros:
+ *          NO_PARAM_TIC       Create an entry in the initial "Built-In"
+ *                                 portion of a TIC-type vocabulary with
+ *                                 an empty "param field".
+ *          NO_PARAM_IGN       Create an entry with an empty "param field"
+ *                                 whose action- and "Ignore"- -functions
+ *                                 are the same.
+ *          VALPARAM_TIC       " ... with a literal value for the "param field"
+ *          DUALFUNC_TIC       " ... with a literal "param" and both an action-
+ *                                 and an "Ignore"- -function.
+ *          DUFNC_FWT_PARM      A  tic_fwt_hdr_t -type entry with a literal
+ *                                 "param" and both an action-function and an
+ *                                 "Ignore"-function.
+ *          FWORD_TKN_TIC      " ... with an FWord Token for the "param field"
+ *          DUALFUNC_FWT_TIC   " " ... and both action- and "Ignore"- -function
+ *          BUILTIN_MAC_TIC    A  tic_mac_hdr_t -type entry with a Macro-
+ *                                 -Substitution-String "param"
+ *          BUILTIN_BOOL_TIC   A  tic_bool_hdr_t -type entry with a boolean-
+ *                                 -variable-pointer "param"
+ *
+ **************************************************************************** */
+
+#include "types.h"
+#include "dictionary.h"
+
+/* **************************************************************************
+ *
+ *      In order to work around C's limitations regarding data-typing
+ *          during initialization, we need to create some alternative
+ *          data-structures that exactly match the layout of  tic_hdr_t
+ *          as defined above, but have a different default-type for
+ *          the parameter field.
+ *      I apologize in advance for any maintenance awkwardnesses this
+ *          might engender; I would have come up with a more convenient
+ *          way to do this if I could.  At least, the pieces that need
+ *          to be co-ordinated are in close proximity to each other...
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      The differences are all centered in the "parameter field" of
+ *          the TIC header structure.  In order to make sure all the
+ *          alternative types map smoothly into each other, we will
+ *          create a series of "union" types, differing only in what
+ *          their default type is.  We will keep the "parameter field"
+ *          item the size of a Long Integer.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      This form is the default type.
+ *
+ **************************************************************************** */
+
+#define TIC_P_DEFLT_TYPE  long
+typedef union tic_param
+    {
+	TIC_P_DEFLT_TYPE  deflt_elem ;  /*  The "default element" aspect.  */
+	long              long_val ;    /*  Explicitly specifying "long"   */
+	fwtoken           fw_token ;    /*  FWord Token                    */
+	bool             *bool_ptr ;    /*  Pointer to a boolean variable  */
+	char             *chr_ptr  ;    /*  Pointer to a character string  */
+
+	/*  The "character value" aspect behaves differently on big-
+	 *      versus little- -endian platforms (for initialization,
+	 *      anyway), so we cannot actually use it.
+	 *  Keep this commented-out, as a reminder.
+	 */
+     /* char             char_val ;    */
+	/*  We will recast "character value" as an integer.  */
+
+    } tic_param_t ;
+
+typedef struct tic_hdr
+    {
+        char             *name;
+	struct tic_hdr   *next;
+	void            (*funct)();      /*  Function for active processing  */
+	tic_param_t       pfield;
+	fwtoken           fword_defr;    /*  FWord Token of entry's Definer  */
+	void            (*ign_func)();   /*  Function in "Ignored" segment   */
+	int               pfld_size;
+    }  tic_hdr_t ;
+
+/* **************************************************************************
+ *
+ *      This form is for initialization of an FWord Token list.
+ *
+ **************************************************************************** */
+
+#define TIC_FWT_P_DEFLT_TYPE  fwtoken
+typedef union tic_fwt_param
+    {
+	TIC_FWT_P_DEFLT_TYPE  deflt_elem ;  /*  "Default element" aspect.  */
+	long              long_val ;    /*  Long integer                   */
+	fwtoken           fw_token ;    /*  Explicit FWord Token           */
+	bool             *bool_ptr ;    /*  Pointer to a boolean variable  */
+	char             *chr_ptr  ;    /*  Pointer to a character string  */
+    } tic_fwt_param_t ;
+
+typedef struct tic_fwt_hdr
+    {
+        char               *name;
+	struct tic_fwt_hdr *next;
+	void              (*funct)();    /*  Function for active processing  */
+	tic_fwt_param_t     pfield;
+	fwtoken             fword_defr;  /*  FWord Token of entry's Definer  */
+	void              (*ign_func)(); /*  Function in "Ignored" segment   */
+	int                 pfld_size;
+    }  tic_fwt_hdr_t ;
+
+
+/* **************************************************************************
+ *
+ *      The third form is for initialization of Built-in Macros.  Its
+ *          default parameter field type is a pointer to a compiled-in
+ *          (i.e., constant) character string.  Its  pfld_size  can be
+ *          left as zero, because no allocated-memory copies of the
+ *          string will be needed, even for aliases.  (User-created
+ *          macros, however, will need to allocate strings; we will
+ *          deal with that elsewhere...)
+ *
+ **************************************************************************** */
+
+#define TIC_MAC_P_DEFLT_TYPE  char *
+typedef union tic_mac_param
+    {
+	TIC_MAC_P_DEFLT_TYPE  deflt_elem ;  /*  "Default element" aspect.  */
+	long              long_val ;    /*  Long integer                   */
+	fwtoken           fw_token ;    /*  FWord Token                    */
+	bool             *bool_ptr ;    /*  Pointer to a boolean variable  */
+	char            *chr_ptr ;      /*  Explicit Pointer to char str.  */
+    } tic_mac_param_t ;
+
+typedef struct tic_mac_hdr
+    {
+        char               *name;
+	struct tic_mac_hdr *next;
+	void              (*funct)();
+	tic_mac_param_t     pfield;
+	fwtoken             fword_defr;
+	void              (*ign_func)();
+	int                 pfld_size;
+    }  tic_mac_hdr_t ;
+
+/* **************************************************************************
+ *
+ *      The next form is for initialization of Condtionals.  Its default
+ *          parameter field type is a pointer to a boolean variable.
+ *
+ **************************************************************************** */
+
+#define TIC_BOOL_P_DEFLT_TYPE  bool *
+typedef union tic_bool_param
+    {
+	TIC_BOOL_P_DEFLT_TYPE deflt_elem ;  /*  "Default element" aspect.  */
+	long              long_val ;    /*  Long integer                   */
+	fwtoken           fw_token ;    /*  FWord Token                    */
+	bool             *bool_ptr ;    /*  Explicit Ptr to boolean v'ble  */
+	char             *chr_ptr  ;    /*  Pointer to a character string  */
+    } tic_bool_param_t ;
+
+typedef struct tic_bool_hdr
+    {
+        char                *name;
+	struct tic_bool_hdr *next;
+	void               (*funct)();
+	tic_bool_param_t     pfield;
+	fwtoken              fword_defr;
+	void               (*ign_func)();
+	int                  pfld_size;
+    }  tic_bool_hdr_t ;
+
+
+
+/* **************************************************************************
+ *
+ *      Various macros to create an entry in the initial "Built-In" portion
+ *           of a vocabulary-list, specified as an array of one of the
+ *           matching forms of a T. I. C. Header; each macro adjusts type
+ *           casting as needed.
+ *      In all cases, the "size" field will be set to zero, indicating that
+ *         the "param field" item is either the complete data or a pointer
+ *         to a hard-coded (non-allocated) data item.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *          Macro Name:   NO_PARAM_TIC
+ *                        Create an entry in the initial "Built-In" portion
+ *                            of a TIC_HDR -type vocabulary with an empty
+ *                            "param field"
+ *                            
+ *   Arguments:
+ *       nam      (string)         Name of the entry as seen in the source
+ *       func     (routine-name)   Name of internal function to call
+ *
+ **************************************************************************** */
+#define NO_PARAM_TIC(nam, func )  \
+  { nam , (tic_hdr_t *)NULL , func , { 0 }, UNSPECIFIED , NULL , 0 }
+
+
+/* **************************************************************************
+ *          Macro Name:   NO_PARAM_IGN
+ *                        Create an entry with an empty "param field"
+ *                            whose action-function and "Ignore"-function
+ *                            are the same.
+ *                            
+ *   Arguments:
+ *       nam      (string)         Name of the entry as seen in the source
+ *       func     (routine-name)   Name of internal function to call for both
+ *
+ *
+ **************************************************************************** */
+#define NO_PARAM_IGN(nam, func )  \
+  { nam , (tic_hdr_t *)NULL , func , { 0 }, UNSPECIFIED , func , 0 }
+
+
+/* **************************************************************************
+ *
+ *      Variations on the above, to compensate for Type-Casting complications
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *          Macro Name:   VALPARAM_TIC
+ *                        Create an entry in the initial "Built-In" portion
+ *                            of a TIC_HDR -type vocabulary with a literal
+ *                            value for the "param field" and a specifiable
+ *                            "definer".
+ *   Arguments:
+ *       nam      (string)         Name of the entry as seen in the source
+ *       func     (routine-name)   Name of internal function to call
+ *       pval     (integer)        The "param field" item
+ *       definr   (fword_token)    "Definer" of the entry
+ *
+ *      The "param field" item will be recast to the required default type.
+ *
+ **************************************************************************** */
+
+#define VALPARAM_TIC(nam, func, pval, definr )  \
+    { nam , (tic_hdr_t *)NULL , func ,  \
+        { (TIC_P_DEFLT_TYPE)(pval) }, definr , NULL , 0 }
+
+
+/* **************************************************************************
+ *          Macro Name:   DUALFUNC_TIC
+ *                        Create an entry in the initial "Built-In" portion
+ *                            of a TIC_HDR -type vocabulary with both an
+ *                            "active" and an "ignoring" function, a literal
+ *                            value for the "param field" and a specifiable
+ *                            "definer".
+ *                            
+ *   Arguments:
+ *       nam      (string)         Name of the entry as seen in the source
+ *       afunc    (routine-name)   Name of internal "active" function
+ *       pval     (integer)        The "param field" item
+ *       ifunc    (routine-name)   Name of "ignoring" function
+ *       definr   (fword_token)    "Definer" of the entry
+ *
+ *      The "param field" item will be recast to the required default type.
+ *
+ **************************************************************************** */
+#define DUALFUNC_TIC(nam, afunc, pval, ifunc, definr )  \
+    { nam , (tic_hdr_t *)NULL , afunc ,  \
+        { (TIC_P_DEFLT_TYPE)(pval) }, definr , ifunc , 0 }
+
+/*  Similar but a  tic_fwt_hdr_t  type structure  */
+#define DUFNC_FWT_PARM(nam, afunc, pval, ifunc, definr )  \
+    { nam , (tic_fwt_hdr_t *)NULL , afunc ,  \
+        { (TIC_FWT_P_DEFLT_TYPE)(pval) }, definr , ifunc , 0 }
+
+
+/* **************************************************************************
+ *          Macro Name:   FWORD_TKN_TIC
+ *                        Create an entry in the initial "Built-In" portion
+ *                            of an FWord Token list of  tic_fwt_hdr_t  type.
+ *                            
+ *   Arguments:
+ *       nam         (string)         Name of the entry as seen in the source
+ *       func        (routine-name)   Name of internal function to call
+ *       fw_tokval   (fword_token)    Value of the FWord Token
+ *       definr      (fword_token)    "Definer" of the entry
+ *
+ *      The "param field" item should not need be recast.
+ *
+ **************************************************************************** */
+
+#define FWORD_TKN_TIC(nam, func, fw_tokval, definr )    \
+    { nam , (tic_fwt_hdr_t *)NULL , func , { fw_tokval }, definr , NULL , 0 }
+
+/* **************************************************************************
+ *          Macro Name:   DUALFUNC_FWT_TIC
+ *                        Create an entry in the initial "Built-In" portion
+ *                            of an FWord Token list of  tic_fwt_hdr_t  type
+ *                            with both an action- and an "Ignore"- -function.
+ *                            
+ *   Arguments:
+ *       nam         (string)         Name of the entry as seen in the source
+ *       afunc       (routine-name)   Name of internal "Action" function
+ *       fw_tokval   (fword_token)    Value of the FWord Token
+ *       ifunc       (routine-name)   Name of "ignoring" function
+ *       definr      (fword_token)    "Definer" of the entry
+ *
+ *      The "param field" item should not need be recast.
+ *
+ **************************************************************************** */
+#define DUALFUNC_FWT_TIC(nam, afunc, fw_tokval, ifunc, definr )    \
+    { nam , (tic_fwt_hdr_t *)NULL , afunc , { fw_tokval }, definr , ifunc , 0 }
+
+/* **************************************************************************
+ *          Macro Name:   BUILTIN_MAC_TIC
+ *                        Create an entry in the initial "Built-In" portion
+ *                            of a Macros vocabulary of  tic_mac_hdr_t  type.
+ *                            
+ *   Arguments:
+ *       nam         (string)         Name of the entry as seen in the source
+ *       func        (routine-name)   Name of internal function to call
+ *       alias       (string)         Macro-Substitution string
+ *
+ *      The "param field" item should not need be recast.
+ *      The "definer" will be MACRO_DEF
+ *      Builtin Macros do not need to be expanded while Ignoring, so
+ *          the ign_func will be NULL
+ *
+ **************************************************************************** */
+
+#define BUILTIN_MAC_TIC(nam, func, alias )    \
+    { nam , (tic_mac_hdr_t *)NULL , func , { alias }, MACRO_DEF , NULL , 0 }
+
+
+/* **************************************************************************
+ *          Macro Name:   BUILTIN_BOOL_TIC
+ *                        Create an entry in the initial "Built-In" portion
+ *                            of a Condtionals list of  tic_bool_hdr_t  type.
+ *                            
+ *   Arguments:
+ *       nam         (string)          Name of the entry as seen in the source
+ *       func        (routine-name)    Name of internal function to call
+ *       bool_vbl    (boolean v'ble)   Name of the boolean variable.
+ *
+ *      The "param field" item should not need be recast.
+ *      For all of the Condtionals, the "Ignoring" function is the same
+ *          as the "Active" function.
+ *      The "definer" will be COMMON_FWORD
+ *
+ **************************************************************************** */
+
+#define BUILTIN_BOOL_TIC(nam, func, bool_vbl )    \
+    { nam , (tic_bool_hdr_t *)NULL , func , { &bool_vbl },   \
+        COMMON_FWORD , func , 0 }
+
+
+/* **************************************************************************
+ *
+ *     Exported Variables and Function Prototypes the rest of the way...
+ *
+ **************************************************************************** */
+
+extern tic_hdr_t *tic_found;
+
+void init_tic_vocab( tic_hdr_t *tic_vocab_tbl,
+                         int max_indx,
+			     tic_hdr_t **tic_vocab_ptr);
+void add_tic_entry( char *tname,
+                        void (*tfunct)(),
+                             TIC_P_DEFLT_TYPE tparam,
+                                 fwtoken fw_defr,
+				     int pfldsiz,
+                                         void (*ign_fnc)(),
+                                             tic_hdr_t **tic_vocab );
+tic_hdr_t *lookup_tic_entry( char *tname, tic_hdr_t *tic_vocab );
+bool exists_in_tic_vocab( char *tname, tic_hdr_t *tic_vocab );
+bool handle_tic_vocab( char *tname, tic_hdr_t *tic_vocab );
+bool create_tic_alias( char *new_name,
+                                  char *old_name,
+				      tic_hdr_t **tic_vocab );
+void reset_tic_vocab( tic_hdr_t **tic_vocab, tic_hdr_t *reset_position );
+
+#endif   /*  _TOKE_TICVOCAB_H    */
diff --git a/toke/toke.c b/toke/toke.c
index b6b590f..d9739a0 100644
--- a/toke/toke.c
+++ b/toke/toke.c
@@ -7,7 +7,7 @@
  *  This program is part of a free implementation of the IEEE 1275-1994 
  *  Standard for Boot (Initialization Configuration) Firmware.
  *
- *  Copyright (C) 2001-2005 by Stefan Reinauer <stepan@openbios.org>
+ *  Copyright (C) 2001-2006 by Stefan Reinauer <stepan@openbios.org>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -24,6 +24,12 @@
  *
  */
 
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -34,47 +40,214 @@
 #include <getopt.h>
 #endif
 
+#include "types.h"
 #include "toke.h"
 #include "stream.h"
 #include "stack.h"
 #include "emit.h"
 
-#define TOKE_VERSION "0.6.10"
+#define TOKE_VERSION "1.0.0"
+
+#include "vocabfuncts.h"
+#include "scanner.h"
+#include "errhandler.h"
+#include "usersymbols.h"
+#include "clflags.h"
+#include "tracesyms.h"
+
+#define CORE_COPYR   "(C) Copyright 2001-2006 Stefan Reinauer.\n" \
+		     "(C) Copyright 2006 coresystems GmbH <info@coresystems.de>"
+#define IBM_COPYR    "(C) Copyright 2005 IBM Corporation.  All Rights Reserved."
+
+/*  Temporary hack during development...  See DATE_STAMP  line below... */
+#ifdef DEVEL
+#include "date_stamp.h"
+#endif /*  DEVEL  */
+
+/* **************************************************************************
+ *
+ *     Global Variables Exported:
+ *        verbose          If true, enable optional messages.
+ *        noerrors         If true, create binary even if error(s) encountered.
+ *        fload_list       If true, create an "FLoad-List" file
+ *        dependency_list  If true, create a "Dependencies-List" file
+ *
+ **************************************************************************** */
+
+bool verbose         = FALSE;
+bool noerrors        = FALSE;
+bool fload_list      = FALSE;
+bool dependency_list = FALSE;
 
-int verbose=0;
-int noerrors=0;
+/* **************************************************************************
+ *
+ *              Internal Static Variables
+ *         outputname    Name of output file supplied on command-line
+ *                           with the optional  -o  switch.
+ *              Internal System Variable
+ *         optind        Index into argv vector of first param after options,
+ *                           from which input file names will be taken.
+ *
+ **************************************************************************** */
 
+static char *outputname = NULL;
+
+/* **************************************************************************
+ *
+ *    Print the copyright message.
+ *
+ **************************************************************************** */
 static void print_copyright(void)
 {
-        printf( "Welcome to toke - OpenBIOS tokenizer v%s\nCopyright (c)"
-		" 2001-2005 by Stefan Reinauer <stepan@openbios.org>\n"
+	printf( "Welcome to toke - OpenBIOS tokenizer v" TOKE_VERSION "\n"
+		CORE_COPYR "\n" IBM_COPYR "\n"
 		"This program is free software; you may redistribute it "
 		"under the terms of\nthe GNU General Public License. This "
-		"program has absolutely no warranty.\n\n", TOKE_VERSION);
+		"program has absolutely no warranty.\n\n");
+#ifdef DEVEL
+        /*  Temporary hack during development... */
+	printf( "\tTokenizer Compiled " DATE_STAMP "\n" );
+#endif /*  DEVEL  */
+
 }
 
+/* **************************************************************************
+ *
+ *      Function name:    usage
+ *      Synopsis:         Print convenient usage-help message
+ *
+ **************************************************************************** */
+
 static void usage(char *name)
 {
-	printf("usage: %s [-v] [-i] [-o target] <forth-file>\n\n",name);
-	printf("  -v|--verbose          print debug messages\n");
-	printf("  -i|--ignore-errors    don't bail out after an error\n");
+	printf("usage: %s [-v] [-i] [-l] [-P] [-o target] <[-d name[=value]]> "
+				"<[-f [no]flagname]> <[-I dir-path]> "
+				"<[-T symbol]> <forth-file>\n\n",name);
+	printf("  -v|--verbose          print Advisory messages\n");
+	printf("  -i|--ignore-errors    don't suppress output after errors\n");
+	printf("  -l|--load-list        create list of FLoaded file names\n");
+	printf("  -P|--dependencies     create dePendency-list file\n");
+	printf("  -o|--output-name      send output to filename given\n");
+	printf("  -d|--define           create user-defined symbol\n");
+	printf("  -f|--flag             set (or clear) Special-Feature flag\n");
+	printf("  -I|--Include          add a directory to the Include-List\n");
+	printf("  -T|--Trace            add a symbol to the Trace List\n");
 	printf("  -h|--help             print this help message\n\n");
-
+	printf("  -f|--flag    help     Help for Special-Feature flags\n");
 }
 
-int main(int argc, char **argv)
+/* **************************************************************************
+ *
+ *      Function name:    get_args
+ *      Synopsis:         Parse the Command-Line option switches
+ *      
+ *      Inputs:
+ *         Parameters:                  NONE
+ *         Global Variables:
+ *                    argc      Counter of command-line arguments
+ *                    argv      Vector pointing to command-line arguments
+ *         Command-Line Items:  The entire command-line will be parsed
+ *
+ *      Outputs:
+ *         Returned Value:              NONE
+ *         Global Variables:
+ *                verbose	     set by "-v" switch
+ *                noerrors           set by "-i" switch
+ *                fload_list         set by "-l" switch
+ *                dependency_list    set by "-P" switch
+ *         Internal Static Variables
+ *                outputname         set by "-o" switch
+ *         Internal System Variable
+ *                optind             Index into argv vector of the position
+ *                                       from which to take input file names.
+ *         Printout:
+ *                (Copyright was already printed by the main body as a
+ *                    matter of course, rather than here depending on
+ *                    the Verbose flag, because  getopt()  prints its
+ *                    own error messages and we want to be sure to show
+ *                    the Copyright notice before any error messages.)
+ *                Rules for Usage and Flags-list or Flags-help display:
+ *                  Usage message on Help-Request or error.
+ *                  Ask for usage help, get Usage plus list of Flag Names.
+ *                  Ask for Flags-help alone, get Flags-help (names plus
+ *                      explanations)
+ *                  Ask for usage help and for Flags-help, get Usage plus
+ *                      Flags-help, without redundant list of Flag Names.
+ *                  Any help-request, exit Zero
+ *                  Error in Option switches, or missing input-file name,
+ *                      get error-description plus Usage
+ *                  Error in Flag Names, get list of Flag Names.
+ *                  Any error, exit One.
+ *         Behavior:
+ *                Exit (non-failure) after printing "Help" message
+ *
+ *      Error Detection:     Exit with failure status on:
+ *          Unknown Option switches or Flag Names
+ *          Missing input file name
+ *
+ *      Process Explanation:
+ *           The following switches are recognized:
+ *               v
+ *               h
+ *               ?
+ *               i
+ *               I
+ *               l
+ *               P
+ *               o
+ *               d
+ *               f
+ *               T
+ *           The conditions they set remain in effect through
+ *               the entire program run.
+ *
+ *      Revision History:
+ *          Updated Fri, 15 Jul 2005 by David L. Paktor
+ *              Don't bail on first invalid option.
+ *              Flags to control special features
+ *              Usage messages for "special-feature" flags
+ *          Updated Mon, 18 Jul 2005 by David L. Paktor
+ *              Fine-tune Usage and Flags-list or Flags-help display.
+ *          Updated Sun, 27 Nov 2005 by David L. Paktor
+ *              Add FLoad-List flag
+ *          Updated Wed, 29 Nov 2005 by David L. Paktor
+ *              Make getopt() case-insensitive
+ *          Updated Fri, 17 Mar 2006 by David L. O'Paktor
+ *              Make getopt() case-sensitive again,
+ *                  add include-list support and dePendency-list switch
+ *
+ *      Extraneous Remarks:
+ *          We were originally thinking about defining various classes
+ *              of "Warning" Messages and (somehow) controlling their
+ *              display, but now that we have "special-feature" flags
+ *              that control the generation of specific messages, that
+ *              step has become unnecessary...
+ *
+ **************************************************************************** */
+
+static void get_args( int argc, char **argv )
 {
-	const char *optstring="vhio:?";
-	char *outputname = NULL;
+	const char *optstring="vhilPo:d:f:I:T:?";
 	int c;
+	int argindx = 0;
+	bool inval_opt = FALSE;
+	bool help_mssg = FALSE;
+	bool cl_flag_error = FALSE;
 
 	while (1) {
 #ifdef __GLIBC__
 		int option_index = 0;
 		static struct option long_options[] = {
 			{ "verbose", 0, 0, 'v' },
-			{ "ignore-errors", 0, 0, 'i' },
 			{ "help", 0, 0, 'h' },
+			{ "ignore-errors", 0, 0, 'i' },
+			{ "load-list",     0, 0, 'l' },
+			{ "dependencies",  0, 0, 'P' },
+			{ "output-name",   1, 0, 'o' },
+			{ "define",        1, 0, 'd' },
+			{ "flag",          1, 0, 'f' },
+			{ "Include",       1, 0, 'I' },
+			{ "Trace",         1, 0, 'T' },
 			{ 0, 0, 0, 0 }
 		};
 
@@ -86,63 +259,169 @@ int main(int argc, char **argv)
 		if (c == -1)
 			break;
 
+		argindx++;
 		switch (c) {
 		case 'v':
-			verbose=1;
+			verbose=TRUE;
 			break;
 		case 'o':
 			outputname = optarg;
 			break;
 		case 'i':
-			noerrors=1;
+			noerrors = TRUE;
+			break;
+		case 'l':
+			fload_list = TRUE;
+			break;
+		case 'P':
+			dependency_list = TRUE;
+			break;
+		case 'd':
+			{
+			    char *user_symb = optarg;
+			    add_user_symbol(user_symb);
+			}
+			break;
+		case 'f':
+			cl_flag_error = set_cl_flag(optarg, FALSE) ;
+			break;
+		case 'I':
+			{
+			    char *incl_list_elem = optarg;
+			    add_to_include_list(incl_list_elem);
+			}
+			break;
+		case 'T':
+			add_to_trace_list(optarg);
 			break;
-		case 'h':
 		case '?':
-			print_copyright();
-			usage(argv[0]);
-			return 0;		
+			/*  Distinguish between a '?' from the user
+			 *  and one  getopt()  returned
+			 */
+			if ( argv[argindx][1] != '?' )
+			{
+			    inval_opt = TRUE;
+			    break;
+			}
+		case 'h':
+		case 'H':
+			 help_mssg = TRUE;		
+			break;
 		default:
-			print_copyright();
+			/*  This is never executed
+			 *  because  getopt()  prints the
+			 *    "unknown option -- X"
+			 *  message and returns a '?'
+			 */
 			printf ("%s: unknown options.\n",argv[0]);
 			usage(argv[0]);
-			return 1;
+			exit( 1 );
 		}
 	}
 
-	if (verbose)
-		print_copyright();
+	if ( help_mssg )
+	{
+	    usage(argv[0]);
+	    if ( ! clflag_help )
+	    {
+	        list_cl_flag_names();
+	    }
+	}
+	if ( clflag_help )  cl_flags_help();
+	if ( help_mssg || clflag_help )
+	{
+	    exit( 0 );
+	}
 
-	if (optind >= argc) {
-		print_copyright();
-		printf ("%s: filename missing.\n",argv[0]);
+	if ( inval_opt )      printf ("unknown options.\n");
+	if (optind >= argc)   printf ("Input file name missing.\n");
+	if ( inval_opt || (optind >= argc) )
+	{
 		usage(argv[0]);
-		return 1;
+	}
+	if ( cl_flag_error )  list_cl_flag_names();
+
+	if ( inval_opt || (optind >= argc) || cl_flag_error )
+	{
+	    exit( 1);
 	}
 
+	if (verbose)
+	{
+	    list_user_symbols();
+	    list_cl_flag_settings();
+	    display_include_list();
+	}
+	save_cl_flags();
+}
+
+/* **************************************************************************
+ *
+ *      Main body of program.  Return 0 for success, 1 for failure.
+ *
+ *      Still to be done:
+ *          Devise a syntax to allow the command-line to specify multiple
+ *              input files together with an output file name for each.
+ *          Currently, the syntax allows only one output file name to be
+ *              specified; when multiple input file names are specified,
+ *              the specification of an output file name is disallowed,
+ *              and only the default output file names are permitted.
+ *              While this works around the immediate problem, a more
+ *              elegant solution could be devised...
+ *
+ **************************************************************************** */
+
+int main(int argc, char **argv)
+{
+	int retval = 0;
+
+	print_copyright();
+	get_args( argc, argv );
+
 	init_stack();
 	init_dictionary();
-	init_macros();
+
 	init_scanner();
 	
-	while (optind < argc) {
-		if (init_stream(argv[optind])) {
-			printf ("%s: warning: could not open file \"%s\"\n",
-					argv[0], argv[optind]);
-			optind++;
-			continue;
+	if ( outputname != NULL )
+	{
+	    if ( argc > optind + 1 )
+	    {
+	    /*  Multiple input file names w/ single output file name  */
+		/*  Work-around  */
+		printf( "Cannot specify single output file name "
+			"with multiple input file names.\n"
+			"Please either remove output-file-name specification,\n"
+			"or use multiple commands.\n");
+	        exit ( -2 );
+	    }
 		}
+
+	for ( ; optind < argc ; optind++ )
+	{
+	    bool stream_ok ;
+
+	    printf("\nTokenizing  %s   ", argv[optind]);
+	    init_error_handler();
+	    stream_ok = init_stream( argv[optind]);
+	    if ( stream_ok )
+	    {
 		init_output(argv[optind], outputname);
 
+		init_scan_state();
+
+		reset_vocabs();
+		reset_cl_flags();
+
 		tokenize();
 		finish_headers();
 		
-		close_output();
-		close_stream();
-		
-		optind++;
+		close_stream( NULL);
+		if ( close_output() )  retval = 1;
+	    }
 	}
 	
 	exit_scanner();
-	return 0;
+	return retval;
 }
 
diff --git a/toke/toke.h b/toke/toke.h
index 16450d1..2c4bc56 100644
--- a/toke/toke.h
+++ b/toke/toke.h
@@ -1,3 +1,6 @@
+#ifndef _TOKE_TOKE_H
+#define _TOKE_TOKE_H
+
 /*
  *                     OpenBIOS - free your system! 
  *                         ( FCode tokenizer )
@@ -24,30 +27,25 @@
  *
  */
 
-#ifndef _H_TOKE
-#define _H_TOKE
+/* **************************************************************************
+ *         Modifications made in 2005 by IBM Corporation
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Modifications Author:  David L. Paktor    dlpaktor@us.ibm.com
+ **************************************************************************** */
 
-#define u8 unsigned char
-#define u16 unsigned short
-#define u32 unsigned int
-#define s16 short
-#define bool int
-#define TRUE (-1)
-#define FALSE (0)
-#define ANSI_ONLY
 
-extern void	init_scanner( void );
-extern void	exit_scanner( void );
+#include "types.h"
 
-extern void	init_dictionary( void );
-extern void	init_macros( void );
-extern void	tokenize( void );
 
-extern u16	lookup_token(char *name);
-extern u16	lookup_fword(char *name);
-extern char	*lookup_macro(char *name);
-extern int	add_token(u16 number, char *name);
+/* ************************************************************************** *
+ *
+ *      Global Variables Exported
+ *
+ **************************************************************************** */
 
-extern int	add_macro(char *name, char *alias);
+extern bool verbose;
+extern bool noerrors;
+extern bool fload_list;
+extern bool dependency_list;
 
-#endif   /* _H_TOKE */
+#endif   /* _TOKE_TOKE_H */
diff --git a/toke/tokzesc.c b/toke/tokzesc.c
new file mode 100644
index 0000000..a45f952
--- /dev/null
+++ b/toke/tokzesc.c
@@ -0,0 +1,771 @@
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Process activity inside "Tokenizer Escape" mode.
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Functions Exported:
+ *          init_tokz_esc_vocab      Initialize the relevant vocabulary.
+ *          enter_tokz_esc           Enter "Tokenizer Escape" mode
+ *          handle_tokz_esc          Perform a function in the
+ *                                       "Tokenizer Escape" Vocabulary
+ *          exists_in_tokz_esc       Confirm whether a given name exists in 
+ *                                       the "Tokz_Esc_Vocabulary"
+ *          create_tokz_esc_alias    Add an alias to "Tokenizer Escape" space
+ *          reset_tokz_esc           Reset the "Tokenizer Escape" Vocabulary
+ *                                      to its "Built-In" position.
+ *
+ **************************************************************************** */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "ticvocab.h"
+#include "tokzesc.h"
+#include "stack.h"
+#include "emit.h"
+#include "stream.h"
+#include "scanner.h"
+#include "errhandler.h"
+#include "strsubvocab.h"
+#include "nextfcode.h"
+
+#undef TOKZTEST     /*  Define for testing only; else undef   */
+#ifdef TOKZTEST         /*  For testing only   */
+   #include "vocabfuncts.h"
+   #include "date_stamp.h"
+#endif                  /*  For testing only   */
+
+/* **************************************************************************
+ *
+ *          Global Variables Imported
+ *              in_tokz_esc    State of the tokenization operation.
+ *                                Value is FALSE if it's operating normally
+ *                                or TRUE if it's in "Tokenizer Escape" mode.
+ *              nextfcode  
+ *              statbuf    
+ *              dstack         Pointer to current item on top of Data Stack.   
+ *              base           Current tokenizer numeric conversion radix
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      We are going to implement a mini-forth using a strategy based
+ *          on the concept of Threaded Interpretive Code  (well, okay,
+ *          it won't really be interpretive ... )
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *              Internal Static Variables -- (well, almost)
+ *      tokz_esc_vocab        Pointer to "tail" of "Tokenizer Escape" Vocab
+ *
+ *      While we would prefer to keep  tokz_esc_vocab  private to this file,
+ *          we find we need it in one other place, namely, macros.c
+ *      We will declare it "extern" within that file, rather than
+ *          exporting it widely by including it in a  .h  file
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      We will define and initialize a structure consisting of all the
+ *          functions we initially support for "Tokenizer Escape" mode,
+ *          called  tokz_esc_vocab_tbl  for "Tokenizer Escape Vocab Table".
+ *      I expect we can initialize its body, but I don't think there's a
+ *          convenient way in "C" to initialize its links; we'll have to
+ *          do that dynamically, at run-time.  Oh, well...
+ *
+ *      We'll call the pointer to it the "Tokenizer Escape" Vocabulary.
+ *          We have to declare it here, because we need to refer to it in
+ *          a function that will be entered into the Table.
+ *
+ *      We would like to pre-initialize it; to do so, we would have to
+ *          declare it extern here, then later create its instance and
+ *          assign its initial value.  That would be all well and good,
+ *          except that some linkers don't handle that very well, so, to
+ *          accommodate those, we have to include its initialization in
+ *          the same routine where we initialize the Table's links.
+ *
+ *      Revision History:
+ *          Updated Wed, 04 Jan 2006 by David L. Paktor
+ *          Initialization of tokz_esc_vocab is now included with
+ *              the call to  init_tic_vocab()
+ *
+ **************************************************************************** */
+
+tic_hdr_t *tokz_esc_vocab = NULL ;
+
+/* **************************************************************************
+ *
+ *      We'll give short prologs to the simpler functions that will be
+ *          used in the "Tokenizer Escape" Vocabulary.
+ *
+ *      All these take, as an argument, the "parameter field" pointer.
+ *          To satisfy C's strong-typing, it will always be declared
+ *          of a consistent type.  The routine itself can internally
+ *          recast -- or ignore -- it, as needed.
+ *      Many of these will refer to the Global Variable  statbuf .  It
+ *          all such cases, it is used for Error reporting.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Function name:  enter_tokz_esc
+ *      Synopsis:       When you start "Tokenizer Escape" mode.
+ *
+ *      Associated Tokenizer directive:        TOKENIZER[
+ *
+ *      Process Explanation:
+ *          Enter "Tokenizer Escape" mode ...  Save the current tokenizer
+ *              numeric conversion radix, and set the radix to sixteen
+ *              (hexadecimal)
+ *
+ **************************************************************************** */
+
+static int saved_base ;    /*  Place to save the numeric conversion radix  */
+
+void enter_tokz_esc( void )
+{
+    saved_base = base ;
+    base = 16;
+    in_tokz_esc = TRUE;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  end_tokz_esc
+ *      Synopsis:       When you've reached the end of "Tokenizer Escape" mode.
+ *
+ *      Associated Tokenizer directive:        ]TOKENIZER
+ *
+ *      Process Explanation:
+ *          Exit "Tokenizer Escape" mode, resume "Normal"-mode behavior.
+ *              Restore the tokenizer numeric conversion radix to the value
+ *              saved by tokenizer[ and exit "Tokenizer Escape" mode . . .
+ *
+ **************************************************************************** */
+
+static void end_tokz_esc( tic_param_t pfield )
+{
+    in_tokz_esc = FALSE;
+    base = saved_base ;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  tokz_esc_emit_byte
+ *      Synopsis:       Emit the byte found on the data-stack
+ *                      
+ *      Associated Tokenizer directive:        EMIT-BYTE
+ *                      
+ *      Error Detection:
+ *          If number on stack is larger than a byte:  Truncate and Warn
+ *
+ **************************************************************************** */
+
+static void tokz_esc_emit_byte ( tic_param_t pfield )
+{
+    long num_on_stk = dpop();
+    u8 byt_to_emit = (u8)num_on_stk;
+    if ( byt_to_emit != num_on_stk )
+    {
+        tokenization_error( WARNING,
+	    "Value on stack for %s command is 0x%0x.  "
+		"Truncating to 0x%02x.\n",
+		     strupr(statbuf), num_on_stk, byt_to_emit);
+    }
+    user_emit_byte(byt_to_emit);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  get_fcode_from_stack
+ *      Synopsis:       Retrieve an FCode value from the data-stack.
+ *                          Indicate if erroneous
+ *
+ *      Inputs:
+ *         Parameters:
+ *             the_num           Pointer to where to put the number
+ *             the_action        Phrase to be used in ERROR message
+ *         Data-Stack Items:
+ *             Top:              Value to be retrieved
+ *
+ *      Outputs:
+ *         Returned Value:       TRUE if number is within valid FCode range
+ *         Supplied Pointers:
+ *             *the_num          Value retrieved from the data-stack
+ *
+ *      Error Detection:
+ *          If the number on the stack is larger than 16 bits, truncate
+ *              it, with a WARNING message.
+ *          If the (possibly truncated) number from the stack is larger
+ *              than the legal maximum for an FCode (0x0fff), or
+ *              less than the legal minimum (0x0800), issue an ERROR,
+ *              leave the_num unchanged and return FALSE.
+ *
+ **************************************************************************** */
+
+static bool get_fcode_from_stack( u16 *the_num, char *the_action)
+{
+    bool retval = FALSE;
+    long num_on_stk = dpop();
+    u16 test_fcode = (u16)num_on_stk;
+    if ( test_fcode != num_on_stk )
+    {
+        tokenization_error( WARNING,
+	    "Value on stack for %s command is 0x%0x.  "
+		"Truncating to 0x%03x.\n",
+		     strupr(statbuf), num_on_stk, test_fcode);
+    }
+    if ( ( test_fcode >= 0x800 ) && ( test_fcode <= 0xfff ) )
+    {
+	retval = TRUE;
+	*the_num = test_fcode;
+    }else{	tokenization_error( TKERROR, "Attempt to %s "
+	    "0x%x, which violates limit specified by IEEE-1275.  "
+		"Disallowing.\n", the_action, test_fcode );
+    }
+    return( retval );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  tokz_esc_next_fcode
+ *      Synopsis:       Set the next-fcode to the value on the data-stack
+ *                      
+ *      Associated Tokenizer Directive:          next-fcode
+ *                      
+ *      Error Detection:
+ *          If the number on the stack is not legal for an FCode, as
+ *              detected by  get_fcode_from_stack(), issue an ERROR
+ *              message and don't change nextfcode.
+ *
+ *         Printout:
+ *             Advisory showing change in FCode token Assignment Counter
+ *
+ **************************************************************************** */
+
+static void tokz_esc_next_fcode( tic_param_t pfield )
+{
+    u16 test_fcode;
+
+    if ( get_fcode_from_stack( &test_fcode, "set next fcode to") )
+    {
+	if ( test_fcode == nextfcode )
+	{
+	    tokenization_error( INFO, "FCode-token Assignment Counter "
+		"is unchanged from 0x%x.\n",
+		    nextfcode);
+	}else{
+	    tokenization_error( INFO, "FCode-token Assignment Counter "
+		"was 0x%x; has been %s to 0x%x.\n",
+		    nextfcode,
+			test_fcode > nextfcode ? "advanced" : "reset",
+			    test_fcode );
+	    set_next_fcode( test_fcode);
+	}
+    }
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  tokz_emit_fcode
+ *      Synopsis:       Emit the value on the data-stack as an FCode token
+ *                      
+ *      Associated Tokenizer Directive:          emit-fcode
+ *                      
+ *      Error Detection:
+ *          If the number on the stack is not legal for an FCode, as
+ *              detected by  get_fcode_from_stack(), issue an ERROR
+ *              message and don't emit anything.
+ *
+ *         Printout:
+ *             Advisory showing FCode being emitted.
+ *
+ **************************************************************************** */
+
+static void tokz_emit_fcode( tic_param_t pfield )
+{
+    u16 test_fcode;
+
+    if ( get_fcode_from_stack( &test_fcode, "Emit FCode value of") )
+    {
+	tokenization_error( INFO,
+	    "Emitting FCode value of 0x%x\n", test_fcode);
+	emit_fcode( test_fcode);
+    }
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  zero_equals
+ *      Synopsis:       Boolean-inversion of item on top of stack.
+ *                      If zero, make it minus-one; if non-zero, make it zero. 
+ *
+ *      Associated FORTH word-name:          0=
+ *
+ **************************************************************************** */
+
+static void  zero_equals ( tic_param_t pfield )
+{
+    *dstack = (*dstack == 0) ? -1 : 0 ;
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  tokz_esc_swap
+ *      Synopsis:       "Tokenizer Escape" mode-time data-stack SWAP operation
+ *                      
+ *      Associated FORTH word-name:          swap
+ *
+ **************************************************************************** */
+
+static void  tokz_esc_swap ( tic_param_t pfield )
+{
+    swap();
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  tokz_esc_two_swap
+ *      Synopsis:       "Tokenizer Escape" mode-time data-stack 2SWAP operation
+ *                      
+ *      Associated FORTH word-name:          2swap
+ *
+ **************************************************************************** */
+
+static void  tokz_esc_two_swap ( tic_param_t pfield )
+{
+    two_swap();
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  tokz_esc_noop
+ *      Synopsis:       "Tokenizer Escape" mode-time non-operation
+ *                      
+ *      Associated FORTH word-name:          noop
+ *
+ **************************************************************************** */
+
+static void  tokz_esc_noop ( tic_param_t pfield )
+{
+    return;
+}
+
+#ifdef TOKZTEST         /*  For testing only   */
+
+   static void  tokz_esc_emit_string( tic_param_t pfield )
+   {
+      int lenny ;
+      lenny = strlen ( pfield.chr_ptr );
+      emit_token("b(\")");
+      emit_string(pfield.chr_ptr, lenny);
+   }
+
+#endif                  /*  For testing only   */
+
+/* **************************************************************************
+ *
+ *      Function name:  do_constant
+ *      Synopsis:       The function to perform when a named constant
+ *                          that was defined in "Tokenizer Escape" mode
+ *                          is invoked in "Tokenizer Escape" mode
+ *
+ *      Associated FORTH word:                 A user-defined constant
+ *      
+ *      Inputs:
+ *         Parameters:
+ *             The param-field of the table-entry contains
+ *                 the value of the constant
+ *
+ *      Outputs:
+ *         Returned Value:         NONE
+ *         Items Pushed onto Data-Stack:
+ *             Top:              The table-entry's param-field's value
+ *
+ *      Error Detection:
+ *          An attempt, while operating in normal tokenization mode, to invoke
+ *              a named constant that was defined in "Tokenizer Escape" mode
+ *              will be detected by the main scanning loop, and need not
+ *              concern us here.
+ *
+ **************************************************************************** */
+
+static void do_constant ( tic_param_t pfield )
+{
+    dpush( pfield.long_val );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  create_constant
+ *      Synopsis:       Create a user-defined constant that will be
+ *                          recognized in "Tokenizer Escape" mode
+ *
+ *      Associated FORTH word-name:             CONSTANT  (when issued
+ *                                                  in "Tokenizer Escape" mode)
+ *
+ *      Inputs:
+ *         Parameters:                NONE
+ *         Global Variables:
+ *             statbuf         The constant's name will be taken from the
+ *                                 next word in the input stream.
+ *             do_constant     The function assigned to the definition
+ *             tokz_esc_vocab  The "Tokenizer Escape" Vocabulary pointer
+ *         Data-Stack Items:
+ *             Top:            The constant's value is popped from the stack
+ *
+ *      Outputs:
+ *         Returned Value:            NONE
+ *         Global Variables:
+ *             statbuf         Advanced to the next word in the input stream.
+ *             tokz_esc_vocab      Updated to point to new vocab entry.
+ *         Memory Allocated:
+ *             for the name and for the new entry.
+ *         When Freed?
+ *             When RESET-SYMBOLS is issued in "Tokenizer Escape" mode,
+ *                or upon end of tokenization.
+ *         Data-Stack, # of Items Popped:             1
+ *
+ *      Error Detection:
+ *          Failure to allocate memory is a Fatal Error.
+ *          Warning on excessively long name
+ *          Warning on duplicate name
+ *          Name to be defined not in same file, ERROR
+ *
+ *      Process Explanation:
+ *          Get the next word, STRDUP it (which implicitly allocates memory). 
+ *              Get the number popped off the stack.
+ *              Pass the pointer and the value to the add_tic_entry() routine.
+ *
+ **************************************************************************** */
+
+static void create_constant( tic_param_t pfield )
+{
+    char *c_name_space ;          /*  Space for copy of the name    */
+    long valu ;                   /*  Value, popped off the stack   */
+    signed long wlen;
+
+    /*  Get the name that is to be defined  */
+    wlen = get_word();
+    if ( wlen <= 0 )
+    {
+	warn_unterm( TKERROR, "Constant definition", lineno);
+	return;
+    }
+
+    valu = dpop();
+
+    /*  If ever we implement more than just this one
+     *      defining-word in "Tokenizer Escape" mode,
+     *      the lines from here to the end of the
+     *      routine should be re-factored...
+     */
+    trace_creation( CONST, statbuf);
+
+    warn_if_duplicate( statbuf );
+    check_name_length( wlen );
+
+    c_name_space = strdup( statbuf );
+
+    add_tic_entry(
+	 c_name_space,
+	     do_constant,
+		  (TIC_P_DEFLT_TYPE)valu,
+		       CONST ,
+			   0 , NULL,
+		               &tokz_esc_vocab );
+
+}
+
+/* **************************************************************************
+ *
+ *      Let's create usable named constants for "Tokenizer Escape" mode.
+ *          It's useful, it's easy and ...  well, you get the idea.
+ *
+ **************************************************************************** */
+/*  I don't think we need to any more
+static const int zero = 0 ;
+static const int minus_one = -1 ;
+static const char double_quote = '"' ;
+static const char close_paren = ')' ;
+ *  Except for this next one, of course...   */
+#ifdef TOKZTEST        /*  For testing only   */
+   static const char date_me[] =  DATE_STAMP;
+#endif                 /*  For testing only   */
+
+/* **************************************************************************
+ *
+ *      Here, at long last, we define and initialize the structure containing
+ *          all the functions we support in "Tokenizer Escape" mode.
+ *      Let's call it the "Tokenizer Escape Vocabulary Table" and the
+ *          pointer to it, the "Tokenizer Escape" Vocabulary.
+ *      We can initialize the start of the "Tokenizer Escape" Vocabulary
+ *          easily, except for the link-pointers, as an array.
+ *
+ **************************************************************************** */
+
+#define TKZESC_CONST(nam, pval)   \
+                        VALPARAM_TIC(nam, do_constant, pval, CONST )
+#define TKZ_ESC_FUNC(nam, afunc, pval, ifunc)   \
+                        DUALFUNC_TIC(nam, afunc, pval, ifunc, UNSPECIFIED)
+
+static tic_hdr_t tokz_esc_vocab_tbl[] = {
+    NO_PARAM_IGN( "]tokenizer" , end_tokz_esc                           ) ,
+
+    /*  An IBM-ish synonym.  */
+    NO_PARAM_IGN( "f]"         , end_tokz_esc                           ) ,
+    /*  An alternate synonym.  */
+    NO_PARAM_IGN( "]f"         , end_tokz_esc                           ) ,
+
+    NO_PARAM_TIC( "emit-byte"  , tokz_esc_emit_byte                     ) ,
+    NO_PARAM_TIC( "next-fcode" , tokz_esc_next_fcode                    ) ,
+    NO_PARAM_TIC( "emit-fcode" , tokz_emit_fcode                        ) ,
+    NO_PARAM_TIC( "constant"   , create_constant                        ) ,
+    NO_PARAM_TIC( "0="         , zero_equals                            ) ,
+    NO_PARAM_TIC( "swap"       , tokz_esc_swap                          ) ,
+    NO_PARAM_TIC( "2swap"      , tokz_esc_two_swap                      ) ,
+    NO_PARAM_TIC( "noop"       , tokz_esc_noop                          ) ,
+    TKZESC_CONST( "false"      ,  0                                     ) ,
+    TKZESC_CONST( "true"       , -1                                     ) ,
+    TKZ_ESC_FUNC( ".("         , user_message, ')', skip_user_message   ) ,
+    TKZ_ESC_FUNC( ".\""        , user_message, '"', skip_user_message   ) ,
+#ifdef TOKZTEST        /*  For testing only   */
+    /*  Data is a pointer to a constant string in the compiler;    */
+    /*      no need to copy, hence data_size can remain zero.      */
+    /*  We could almost use the Macro macro, except for the type.  */
+    TKZ_ESC_FUNC( "emit-date"  , tokz_esc_emit_string, date_me , NULL   ) ,
+#endif                 /*  For testing only   */
+};
+
+/* **************************************************************************
+ *
+ *      Also, keep a pointer to the "Built-In" position of
+ *          the "Tokenizer Escape" Vocabulary
+ *
+ **************************************************************************** */
+
+static const tic_hdr_t *built_in_tokz_esc =
+    &tokz_esc_vocab_tbl[(sizeof(tokz_esc_vocab_tbl)/sizeof(tic_hdr_t))-1];
+
+/* **************************************************************************
+ *
+ *      Function name:  init_tokz_esc_vocab
+ *      Synopsis:       Initialize the "Tokenizer Escape" Vocabulary
+ *                          link-pointers dynamically.
+ *
+ **************************************************************************** */
+
+void init_tokz_esc_vocab ( void )
+{
+    static const int tokz_esc_vocab_max_indx =
+	 sizeof(tokz_esc_vocab_tbl)/sizeof(tic_hdr_t) ;
+
+    tokz_esc_vocab = NULL ;   /*  Belt-and-suspenders...  */
+    init_tic_vocab(tokz_esc_vocab_tbl,
+                       tokz_esc_vocab_max_indx,
+		           &tokz_esc_vocab );
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  handle_tokz_esc
+ *      Synopsis:       Perform a function in the "Tokenizer Escape" Vocabulary
+ *                      Indicate whether the name is valid in this vocabulary.
+ *                      Handle "Tokenizer Escape" aliases implicitly.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             tname                The name to handle
+ *         Global Variables:  
+ *             tokz_esc_vocab       Pointer to "Tokenizer Escape" Vocabulary 
+ *
+ *      Outputs:
+ *         Returned Value:   TRUE if the given name is valid in tokz_esc
+ *
+ *      Process Explanation:
+ *          Find the name and execute its associated function.
+ *          If the name is not in the "Tokenizer Escape" Vocabulary,
+ *              let the calling routine determine whether to try it
+ *              out as a number or to print an error message.
+ *
+ **************************************************************************** */
+
+bool handle_tokz_esc( char *tname )
+{
+    bool retval = handle_tic_vocab( tname, tokz_esc_vocab );
+    return ( retval ) ;
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  lookup_tokz_esc
+ *      Synopsis:       Return a pointer to the data-structure of the named
+ *                      word in the"Tokenizer Escape" Vocabulary
+ *
+ *      Inputs:
+ *         Parameters:
+ *             name                 The given name for which to look
+ *         Local Static Variables:
+ *             tokz_esc_vocab       Pointer to "Tokenizer Escape" Vocabulary  
+ *
+ *      Outputs:
+ *         Returned Value:     TRUE if name is found,
+ *
+ **************************************************************************** */
+
+tic_hdr_t *lookup_tokz_esc(char *name)
+{
+    tic_hdr_t *retval = lookup_tic_entry( name, tokz_esc_vocab );
+    return ( retval );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  exists_in_tokz_esc
+ *      Synopsis:       Confirm whether a given name exists in the
+ *                          "Tokenizer Escape" Vocabulary
+ *
+ *      Inputs:
+ *         Parameters:
+ *             name                 The given name to confirm
+ *         Global Variables:  
+ *             tokz_esc_vocab       Pointer to "Tokenizer Escape" Vocabulary  
+ *
+ *      Outputs:
+ *         Returned Value:     TRUE if name is found,
+ *
+ **************************************************************************** */
+
+bool exists_in_tokz_esc(char *name)
+{
+    bool retval = exists_in_tic_vocab( name, tokz_esc_vocab );
+    return ( retval );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  create_tokz_esc_alias
+ *      Synopsis:       Create an alias in the "Tokenizer Escape" Vocabulary
+ *
+ *      Associated FORTH word:              ALIAS (in "Tokenizer Escape" mode)
+ *
+ *      Inputs:
+ *         Parameters:
+ *             old_name             Name of existing entry
+ *             new_name             New name for which to create an entry
+ *
+ *      Outputs:
+ *         Returned Value:          TRUE if  old_name  found in "Tok Esc" vocab
+ *         Global Variables:    
+ *             tokz_esc_vocab       Will point to the new entry
+ *         Memory Allocated:
+ *             Memory for the new entry will be allocated
+ *                 by the support routine
+ *         When Freed?
+ *             When RESET-SYMBOLS is issued in "Tokenizer Escape" mode,
+ *                or upon end of tokenization.
+ *
+ **************************************************************************** */
+
+bool create_tokz_esc_alias(char *new_name, char *old_name)
+{
+    bool retval = create_tic_alias( new_name, old_name, &tokz_esc_vocab );
+    return ( retval );
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  reset_tokz_esc
+ *      Synopsis:       Reset the "Tokenizer Escape" Vocabulary to
+ *                          its "Built-In" position.
+ *
+ *      Associated Tokenizer directive:       RESET-SYMBOLS  (when issued
+ *                                                in "Tokenizer Escape" mode)
+ *
+ *      Inputs:
+ *         Parameters:                 NONE
+ *         Global Variables:
+ *             tokz_esc_vocab      Pointer to "Tokenizer Escape" Vocabulary
+ *             built_in_tokz_esc   Pointer to "Built-In" position
+ *
+ *      Outputs:
+ *         Returned Value:             NONE
+ *         Global Variables:
+ *             tokz_esc_vocab      Reset to "Built-In" position
+ *         Memory Freed
+ *             Memory will be freed by the support routine
+ *
+ **************************************************************************** */
+
+void reset_tokz_esc( void )
+{
+    reset_tic_vocab( &tokz_esc_vocab, (tic_hdr_t *)built_in_tokz_esc);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  pop_next_fcode
+ *      Synopsis:       Vector off to the  tokz_esc_next_fcode  function,
+ *                      but without the pseudo-param.  A retro-fit...
+ *
+ *      Associated Tokenizer directive:   FCODE-POP  (issued in either mode)
+ *
+ *      Inputs:
+ *         Parameters:                    NONE
+ *         Data-Stack Items:
+ *             Top:                       Next FCode value, presumably saved
+ *                                            by an  FCODE-PUSH  issued earlier.
+ *
+ *      Outputs:
+ *         Returned Value: 
+ *         Global Variables:
+ *             nextfcode                  FCode token Assignment Counter
+ *
+ **************************************************************************** */
+
+void pop_next_fcode( void)
+{
+   tic_param_t dummy_param;
+   tokz_esc_next_fcode( dummy_param);
+}
diff --git a/toke/tokzesc.h b/toke/tokzesc.h
new file mode 100644
index 0000000..21c74da
--- /dev/null
+++ b/toke/tokzesc.h
@@ -0,0 +1,50 @@
+#ifndef _TOKE_TOKZESC_H
+#define _TOKE_TOKZESC_H
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      External and Prototype definitions for functions that process
+ *          activity in "Tokenizer Escape" mode
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+#include "types.h"
+#include "ticvocab.h"
+
+void init_tokz_esc_vocab( void );
+bool create_tokz_esc_alias(char *new_name, char *old_name);
+void enter_tokz_esc( void );
+bool handle_tokz_esc( char *tname );
+tic_hdr_t *lookup_tokz_esc(char *name);
+bool exists_in_tokz_esc(char *name);
+void reset_tokz_esc( void );
+void pop_next_fcode( void);
+
+#endif   /*  _TOKE_TOKZESC_H    */
diff --git a/toke/tracesyms.c b/toke/tracesyms.c
new file mode 100644
index 0000000..1577708
--- /dev/null
+++ b/toke/tracesyms.c
@@ -0,0 +1,172 @@
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Support routines for "Trace-Symbols" debugging feature
+ *
+ *      (C) Copyright 2006 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Functions Exported:
+ *          add_to_trace_list         Add the given name to the Trace List
+ *          show_initial_traces       Show pre-defined names the user
+ *                                        asked to Trace (if any)
+ *          is_on_trace_list          Indicate whether the given name is
+ *                                        on the Trace List
+ *
+ **************************************************************************** */
+
+#include <string.h>
+
+#include "tracesyms.h"
+#include "errhandler.h"
+
+
+/* **************************************************************************
+ *
+ *          Internal Static Variables
+ *     trace_list     Pointer to last entry in the Trace List linked-list
+ *                        data structure
+ *              
+ *              
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Internal (Static) Structures:
+ *          trace_entry_t           Linked-list of entries in the Trace List
+ *
+ *   Fields:
+ *       tracee              Name of the symbol to be traced
+ *       prev                Pointer to previous entry in the linked-list
+ *
+ **************************************************************************** */
+
+typedef struct trace_entry {
+      char *tracee;
+      struct trace_entry *prev;
+} trace_entry_t;
+
+static trace_entry_t *trace_list = NULL;
+
+
+
+/* **************************************************************************
+ *
+ *      Function name:  add_to_trace_list
+ *      Synopsis:       Add the given name to the Trace List
+ *                      
+ *
+ *      Inputs:
+ *         Parameters:
+ *             trace_symb            Name of the symbol to be added
+ *         Local Static Variables:
+ *             trace_list           Pointer to the Trace List
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *         Local Static Variables:
+ *             trace_list           Points to new entry in Trace List
+ *         Memory Allocated
+ *             For Trace List entry
+ *             For copy of Symbol Name
+ *         When Freed?
+ *             Never.  Well, only on termination of the program.  Trace-list
+ *                 endures for the entire batch of tokenizations.
+ *
+ *      Error Detection:
+ *          Memory allocation failure is a FATAL error.
+ *
+ **************************************************************************** */
+
+void add_to_trace_list( char *trace_symb)
+{
+    trace_entry_t *new_t_l_entry = safe_malloc( sizeof( trace_entry_t),
+        "adding to trace-list");
+    new_t_l_entry->tracee = strdup( trace_symb);
+    new_t_l_entry->prev = trace_list;
+
+    trace_list = new_t_l_entry;
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  is_on_trace_list
+ *      Synopsis:       Indicate whether the given name is on the Trace List
+ *
+ *      Inputs:
+ *         Parameters:
+ *             symb_name            Symbol-name to test
+ *         Local Static Variables:
+ *             trace_list           Pointer to the Trace List
+ *
+ *      Outputs:
+ *         Returned Value:          TRUE if Symbol-name is on the Trace List
+ *
+ **************************************************************************** */
+
+bool is_on_trace_list( char *symb_name)
+{
+    bool retval = FALSE;
+    trace_entry_t *test_entry = trace_list;
+    while ( test_entry != NULL )
+    {
+        if ( strcasecmp( symb_name, test_entry->tracee) == 0 )
+	{
+	    retval = TRUE;
+	    break;
+	}
+	test_entry = test_entry->prev;
+    }
+    return ( retval );
+}
+
+
+/* **************************************************************************
+ *
+ *      Still to be done:
+ *          Implement a function -- name it  show_initial_traces  --
+ *              that will show any pre-defined names the user asked
+ *              to Trace.  That is, if any of the names the user asked
+ *              to Trace belongs to a pre-defined function, macro or
+ *              directive, then, at the beginning of the output, issue 
+ *              Advisory Messages identifying the scope of those names.
+ * 
+ *          E.g, if the user had  -T 3DUP  -T SWAP   the function would
+ *              issue Messages like:
+ *          3DUP is pre-defined as a Macro with Global scope
+ *          SWAP is pre-defined with Global scope
+ *          SWAP is pre-defined in Tokenizer-Escape mode
+ * 
+ *          The names would, of course, remain on the Trace List and
+ *              any re-definitions of them would be reported.
+ *
+ **************************************************************************** */
diff --git a/toke/tracesyms.h b/toke/tracesyms.h
new file mode 100644
index 0000000..b50f7fe
--- /dev/null
+++ b/toke/tracesyms.h
@@ -0,0 +1,48 @@
+#ifndef _TOKE_TRACESYMS_H
+#define _TOKE_TRACESYMS_H
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      External/Prototype/Structure definitions for "Trace-Symbols" feature
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+#include "types.h"
+
+/* ************************************************************************** *
+ *
+ *      Function Prototypes / Functions Exported:
+ *
+ **************************************************************************** */
+
+void add_to_trace_list( char *trace_symb);
+bool is_on_trace_list( char *symb_name);
+
+#endif   /*  _TOKE_TRACESYMS_H    */
diff --git a/toke/usersymbols.c b/toke/usersymbols.c
new file mode 100644
index 0000000..f0acbf5
--- /dev/null
+++ b/toke/usersymbols.c
@@ -0,0 +1,363 @@
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      General-purpose support functions for
+ *          User-defined command-line compilation-control symbols
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      The syntax for user-defined command-line compilation-control symbols
+ *          is <NAME>[=<VALUE>]
+ *
+ *      The name is always required; the equal-sign and value is optional.
+ *          If you wish the "value" to contain spaces or quotes, you can
+ *          accomplish that using the shell escape conventions.
+ *
+ *      The operations that can be performed upon these symbols will be
+ *          described by the operators that use them as operands, but,
+ *          broadly speaking, the tests will either be to simply verify
+ *          the existence of a symbol, or to evaluate the defined value.
+ *
+ *      Once a symbol is defined on the command-line, it stays in effect
+ *          for the duration of the entire batch of tokenizations (i.e.,
+ *          if there are multiple input files named on the command line).
+ *          Also, there are no symbols defined at the outset.  Therefore,
+ *          there is no need for either an "init" or a "reset" routine.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      User-defined command-line compilation-control symbols are
+ *          implemented as a String-Substitution-type vocabulary.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Functions Exported:
+ *          add_user_symbol            Add a user-defined symbol to the list
+ *          lookup_user_symbol         Look for a user-defined symbol, return
+ *                                         the assigned value.
+ *          exists_as_user_symbol      Confirm whether a given name exists
+ *                                         as a user-defined symbol.
+ *          eval_user_symbol           Tokenize the value assigned to a user
+ *                                         symbol.
+ *          list_user_symbols          Print the list of user-defined symbols
+ *                                         for the Logfile.
+ *
+ **************************************************************************** */
+
+/* **************************************************************************
+ *
+ *      Still to be done:
+ *          Convert the handling of user-defined symbols to the T.I.C.
+ *              data-structure and its support routines.  This should
+ *              eliminate any further need of String-Substitution-type
+ *              vocabularies.  User-defined symbols will, however, still
+ *              need to be a separate vocabulary from the Global, because
+ *              they are required to stay in effect for the duration of
+ *              the entire batch of tokenizations...
+ *          (Afterthought:  This is only true for user-defined symbols that
+ *              were created on the command-line; if we ever allow symbols
+ *              to be defined in the Source file, they should be as volatile
+ *              as anything else that comes from a source file...
+ *           Putting source-file-derived user-defined symbols into the Global
+ *              Vocabulary could be a quasi-simple way to accomplish this.)
+ *
+ *          Enable the definition of user-symbols from the Source file, using
+ *              a syntax like:  [define] symbol   or  [define] symbol=<value>
+ *              (How to allow spaces into the <value>?  Maybe make the syntax
+ *              [define] symbol = <value components to end of line> 
+ *              delimited in a manner similar to Macro definitions.
+ *          There might be a need to be able to  [undefine]  a user-symbol
+ *              that would entail defining an  unlink_tic_entry  function.
+ *              Not difficult; just keeping this around as a reminder...
+ *
+ **************************************************************************** */
+
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#if defined(__linux__) && ! defined(__USE_BSD)
+#define __USE_BSD
+#endif
+#include <string.h>
+
+#include "errhandler.h"
+#include "strsubvocab.h"
+#include "usersymbols.h"
+#include "scanner.h"
+
+
+/* **************************************************************************
+ *
+ *              Internal Static Variables
+ *      user_symbol_list          Pointer to the "tail" of the list of
+ *                                    user-defined symbols.
+ *      user_symbol_count         Count of how many are defined
+ *
+ **************************************************************************** */
+
+static str_sub_vocab_t *user_symbol_list = NULL;
+static int user_symbol_count = 0;
+
+/* **************************************************************************
+ *
+ *      Function name:  add_user_symbol
+ *      Synopsis:       Add a user-defined symbol to the list
+ *
+ *      Inputs:
+ *         Parameters:
+ *             raw_symb             The string as supplied on the command-line.
+ *         Local Static Variables:
+ *             user_symbol_list     Pointer to the list of user-defined symbols.
+ *
+ *      Outputs:
+ *         Returned Value:                NONE
+ *         Local Static Variables:
+ *             user_symbol_list     Will be updated.
+ *             user_symbol_count    Will be incremented
+ *         Memory Allocated:
+ *             for the string(s) and the new entry
+ *         When Freed?
+ *             Never.  Well, only on termination of the program.  User-defined
+ *                 symbols endure for the entire batch of tokenizations.
+ *
+ *      Process Explanation:
+ *          The string in  raw_symb  may or may not include the optional
+ *              equal-sign and value pair.  If the equal-sign is present,
+ *              the remainder of the string will become the "value" that
+ *              will be returned by the "lookup" routine.
+ *          Memory for the name string and for the value, if there is one,
+ *              will be allocated here, in one step.  Memory for the data
+ *              structure itself will be allocated by the support routine.
+ *
+ **************************************************************************** */
+
+void add_user_symbol(char *raw_symb)
+{
+    char *symb_nam;
+    char *symb_valu;
+
+    symb_nam = strdup(raw_symb);
+    symb_valu = strchr(symb_nam,'=');
+    if ( symb_valu != NULL )
+    {
+	*symb_valu = 0;
+	symb_valu++;
+    }
+    add_str_sub_entry(symb_nam, symb_valu, &user_symbol_list );
+    user_symbol_count++;
+}
+
+
+/* **************************************************************************
+ *
+ *      Function name:  lookup_user_symbol
+ *      Synopsis:       Look for the given name as user-defined symbol, return
+ *                          the assigned value.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             symb_nam             The name for which to look.
+ *         Local Static Variables:
+ *             user_symbol_list     Pointer to the list of user-defined symbols.
+ *
+ *      Outputs:
+ *         Returned Value:          Pointer to the "value" string, or NULL
+ *                                      pointer if the name was not found.
+ *                                  May also be NULL if "value" is NULL.
+ *
+ **************************************************************************** */
+ 
+char *lookup_user_symbol(char *symb_nam)
+{
+    char *symb_valu;
+
+    symb_valu = lookup_str_sub(symb_nam, user_symbol_list );
+    return (symb_valu);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  exists_as_user_symbol
+ *      Synopsis:       Confirm whether a given name exists
+ *                      as a user-defined symbol.
+ *
+ *      Inputs:
+ *         Parameters:
+ *             symb_nam             The name for which to look.
+ *         Local Static Variables:
+ *             user_symbol_list     Pointer to the list of user-defined symbols.
+ *
+ *      Outputs:
+ *         Returned Value:      TRUE if the name is found
+ *
+ **************************************************************************** */
+
+bool exists_as_user_symbol(char *symb_nam)
+{
+    bool retval;
+
+    retval = exists_in_str_sub(symb_nam, user_symbol_list );
+    return (retval);
+}
+
+/* **************************************************************************
+ *
+ *      Function name:  eval_user_symbol
+ *      Synopsis:       Tokenize the value assigned to a user-symbol.
+ *
+ *      Associated Tokenizer directive (synonyms):      [DEFINED]
+ *                                                      #DEFINED
+ *                                                      [#DEFINED]
+ *
+ *      Syntax Notes:
+ *          (1)  The User-Defined-Symbol must appear
+ *                   on the same line as the directive.
+ *          (2)  This is not (yet) implemented in contexts that
+ *                   directly read input from the stream, e.g.,
+ *                   after  [']  or after  H#  etc.
+ *
+ *      Inputs:
+ *         Parameters:       
+ *             symbol               The User-Defined-Symbol to evaluate
+ *         Local Static Variables:
+ *             user_symbol_list     Pointer to the list of user-defined symbols.
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *         The assigned value will be tokenized.
+ *
+ *      Error Detection:
+ *          Calling routine is responsible for verifying that the user-symbol
+ *              is on the same line as the directive.
+ *          WARNING if the symbol is not found or has no assigned value. 
+ *
+ *      Process Explanation:
+ *          Look up the parameter in the User Symbol List, and retrieve
+ *              its associated value.
+ *          If it is not found, or if it has no associated value, issue
+ *              a WARNING and do nothing further.  Otherwise...
+ *          Interpret the associated value as though it were source.
+ *
+ *      Still to be done:
+ *          Hook-in this routine to the processing of:  [']  F[']  H#  FLOAD
+ *              etc., and wherever else it might be needed or useful.
+ *
+ **************************************************************************** */
+
+void eval_user_symbol(char *symbol )
+{
+    char *symb_valu;
+    symb_valu = lookup_user_symbol(symbol );
+    if ( symb_valu == NULL )
+    {
+        tokenization_error ( WARNING,
+	    "No value assigned to command-line symbol %s\n", symbol );
+    }else{
+	eval_string( symb_valu );
+    }
+
+}
+/* **************************************************************************
+ *
+ *      Function name:  list_user_symbols
+ *      Synopsis:       Print the list of user symbols for the Logfile.
+ *      
+ *      Inputs:
+ *         Parameters:              NONE
+ *         Local Static Variables:
+ *             user_symbol_list     Pointer to the list of user-defined symbols.
+ *             user_symbol_count    Count of user-defined symbols.
+ *
+ *      Outputs:
+ *         Returned Value:          NONE
+ *         Printout:                List of user symbols and their definitions;
+ *                                      nothing if user_symbol_list is NULL.
+ *
+ *      Process Explanation:
+ *          We want to display the symbols in the same order they were created.
+ *          We will:
+ *              Allocate a temporary array of pointers.
+ *              Step backwards through the linked-list of symbols, and
+ *                  enter their pointers into the array.
+ *              Collect the maximum length of the symbol names.
+ *              Step through the array in the reverse order, printing
+ *                  as we go.
+ *                  Use the max name length to space the equal-signs evenly 
+ *              Free the temporary array.
+ *
+ **************************************************************************** */
+
+void list_user_symbols(void )
+{
+    str_sub_vocab_t *curr;
+
+    if ( user_symbol_list != NULL )
+    {
+	/*  Collect the pointers and max length  */
+	str_sub_vocab_t **symb_ptr;
+	int indx = 0;
+	int maxlen = 0;
+	
+	symb_ptr = (str_sub_vocab_t **)safe_malloc(
+	   (sizeof(str_sub_vocab_t *) * user_symbol_count),
+	       "collecting user-symbol pointers" );
+	
+	for (curr = user_symbol_list ; curr != NULL ; curr=curr->next)
+	{
+            symb_ptr[indx] = curr;
+	    indx++;
+	    if ( strlen(curr->name) > maxlen ) maxlen = strlen(curr->name);
+	}
+	
+	/*  Now print 'em out  */
+	printf("\nUser-Defined Symbols:\n");
+	while ( indx > 0 )
+	{
+	    indx--;
+	    curr = symb_ptr[indx];
+	    printf("\t%s",curr->name);
+	    if ( curr->alias != NULL )
+	    {
+	        int strindx;
+		for ( strindx = strlen(curr->name) ;
+		      strindx < maxlen ; strindx++ ) printf(" ");
+		printf(" = %s",curr->alias);
+	    }
+	    printf("\n");
+	}
+	free(symb_ptr);
+    }
+}
diff --git a/toke/usersymbols.h b/toke/usersymbols.h
new file mode 100644
index 0000000..26d2869
--- /dev/null
+++ b/toke/usersymbols.h
@@ -0,0 +1,46 @@
+#ifndef _TOKE_USERSYMBOLS_H
+#define _TOKE_USERSYMBOLS_H
+
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      Prototype/External Declarations for general-purpose functions
+ *          for support of User-defined command-line compilation-control
+ *          symbols, as defined in  usersymbols.c
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+void add_user_symbol(char *raw_symb);
+char *lookup_user_symbol(char *symb_nam);
+bool exists_as_user_symbol(char *symb_nam);
+void eval_user_symbol(char *symbol );
+void list_user_symbols(void );
+
+#endif   /* _TOKE_USERSYMBOLS_H    */
diff --git a/toke/vocabfuncts.h b/toke/vocabfuncts.h
new file mode 100644
index 0000000..eb46e79
--- /dev/null
+++ b/toke/vocabfuncts.h
@@ -0,0 +1,92 @@
+#ifndef _TOKE_VOCABFUNCTS_H
+#define _TOKE_VOCABFUNCTS_H
+
+/*
+ *                     OpenBIOS - free your system!
+ *                         ( FCode tokenizer )
+ *
+ *  This program is part of a free implementation of the IEEE 1275-1994
+ *  Standard for Boot (Initialization Configuration) Firmware.
+ *
+ *  Copyright (C) 2001-2005 Stefan Reinauer, <stepan@openbios.org>
+ *
+ *  This program 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; version 2 of the License.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
+ *
+ */
+
+/* **************************************************************************
+ *
+ *      External/Prototype definitions for Vocabulary functions
+ *           in dictionary.c for Tokenizer
+ *
+ *      (C) Copyright 2005 IBM Corporation.  All Rights Reserved.
+ *      Module Author:  David L. Paktor    dlpaktor@us.ibm.com
+ *
+ **************************************************************************** */
+
+
+#include "types.h"
+#include "ticvocab.h"
+
+
+/* ************************************************************************** *
+ *
+ *      Global Variables Exported
+ *
+ **************************************************************************** */
+
+extern bool scope_is_global;
+
+/* ************************************************************************** *
+ *
+ *      Function Prototypes / Functions Exported:
+ *
+ **************************************************************************** */
+
+
+tic_hdr_t *lookup_core_word( char *tname);
+bool exists_in_core( char *name);
+bool handle_core_word( char *tname );
+bool create_core_alias( char *new_name, char *old_name);
+
+void enter_global_scope( void );
+void resume_device_scope( void );
+
+tic_hdr_t *lookup_current( char *name);
+bool exists_in_current( char *tname);
+bool handle_current( char *tname );
+tic_hdr_t *lookup_in_dev_node( char *tname);
+void add_to_current( char *name,
+                           TIC_P_DEFLT_TYPE fc_token,
+			       fwtoken definer,
+			           bool define_token);
+void hide_last_colon ( void );
+void reveal_last_colon ( void );
+bool create_current_alias( char *new_name, char *old_name );
+
+void emit_token( const char *fc_name);
+tic_hdr_t *lookup_token( char *tname);
+bool entry_is_token( tic_hdr_t *test_entry );
+void token_entry_warning( tic_hdr_t *t_entry);
+
+tic_hdr_t *lookup_shared_word( char *tname);
+bool handle_shared_word( char *tname );
+tic_hdr_t *lookup_shared_f_exec_word( char *tname);
+
+void init_dictionary( void );
+void reset_normal_vocabs( void );
+void reset_vocabs( void );
+
+
+#endif   /*  _TOKE_VOCABFUNCTS_H    */