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
|
// { dg-do assemble }
// { dg-require-effective-target ilp32 } */
// { dg-options "-w" }
// prms-id: 784
//# 1 "GctSymbol.GctSymbol.CHMap.cc"
// This may look like C code, but it is really -*- C++ -*-
/*
Copyright (C) 1988, 2000, 2002 Free Software Foundation
written by Doug Lea (dl@rocky.oswego.edu)
This file is part of the GNU C++ Library. This library is free
software; you can redistribute it and/or modify it under the terms of
the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version. This library 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//#pragma implementation
//# 1 "GctSymbol.GctSymbol.CHMap.h" 1
// This may look like C code, but it is really -*- C++ -*-
/*
Copyright (C) 1988 Free Software Foundation
written by Doug Lea (dl@rocky.oswego.edu)
This file is part of the GNU C++ Library. This library is free
software; you can redistribute it and/or modify it under the terms of
the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version. This library 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//#pragma interface
//# 1 "GctSymbol.GctSymbol.Map.h" 1
// This may look like C code, but it is really -*- C++ -*-
/*
Copyright (C) 1988 Free Software Foundation
written by Doug Lea (dl@rocky.oswego.edu)
This file is part of the GNU C++ Library. This library is free
software; you can redistribute it and/or modify it under the terms of
the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version. This library 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//#pragma interface
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/Pix.h" 1
typedef void* Pix;
//# 26 "GctSymbol.GctSymbol.Map.h" 2
//# 1 "GctSymbol.defs.h" 1
// This may look like C code, but it is really -*- C++ -*-
/*
Copyright (C) 1988 Free Software Foundation
written by Doug Lea (dl@rocky.oswego.edu)
This file is part of the GNU C++ Library. This library is free
software; you can redistribute it and/or modify it under the terms of
the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version. This library 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//# 1 "../../GctSymbol.h" 1
// -*- C++ -*-
//
// GctSymbol class
//
// Expects to be included by Gct.h
//
// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
//
//#pragma interface
//# 25 "../../GctSymbol.h" 2
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 1
// This may look like C code, but it is really -*- C++ -*-
/*
Copyright (C) 1988 Free Software Foundation
written by Doug Lea (dl@rocky.oswego.edu)
This file is part of the GNU C++ Library. This library is free
software; you can redistribute it and/or modify it under the terms of
the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version. This library 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//#pragma interface
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stream.h" 1
// Compatibility with old library.
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
// This is part of the iostream library, providing -*- C++ -*- input/output.
// Copyright (C) 1991 Per Bothner.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//#pragma interface
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/streambuf.h" 1
// This is part of the iostream library, providing -*- C++ -*- input/output.
// Copyright (C) 1991 Per Bothner.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//#pragma interface
/* KLUDGES!! */
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 1
extern "C" {
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/mips/lib/gcc/decstatn/cygnus-1.96/include/stddef.h" 1
/* This avoids lossage on Sunos but only if stdtypes.h comes first.
There's no way to win with the other order! Sun lossage. */
/* In case nobody has defined these types, but we aren't running under
GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
__WCHAR_TYPE__ have reasonable values. This can happen if the
parts of GCC is compiled by an older compiler, that actually
include gstddef.h, such as collect2. */
/* Signed type of difference of two pointers. */
typedef long int ptrdiff_t;
/* Unsigned type of `sizeof' something. */
typedef unsigned int size_t;
/* Data type for wide chars. */
/* A null pointer constant. */
/* Offset of member MEMBER in a struct of type TYPE. */
//# 7 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stddef.h" 2
}
//# 25 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/streambuf.h" 2
class ostream; class streambuf;
typedef long streamoff, streampos;
struct _ios_fields { // The data members of an ios.
streambuf *_strbuf;
ostream* _tie;
long _width;
unsigned long _flags;
char _fill;
unsigned char _state;
unsigned short _precision;
};
enum state_value { _good = 0, _eof = 1, _fail = 2, _bad = 4 };
class ios : public _ios_fields {
public:
enum io_state { goodbit=0, eofbit=1, failbit=2, badbit=4 };
enum open_mode {
in=1,
out=2,
ate=4,
app=8,
trunc=16,
nocreate=32,
noreplace=64 };
enum seek_dir { beg, cur, end};
enum { skipws=01, left=02, right=04, internal=010,
dec=020, oct=040, hex=0100,
showbase=0200, showpoint=0400, uppercase=01000, showpos=02000,
scientific=04000, fixed=0100000, unitbuf=020000, stdio=040000,
dont_close=0x80000000 //Don't close streambuf when destroying stream
};
ostream* tie() { return _tie; }
ostream* tie(ostream* val) { ostream* save=_tie; _tie=val; return save; }
// Methods to change the format state.
char fill() { return _fill; }
char fill(char newf) { char oldf = _fill; _fill = newf; return oldf; }
unsigned long flags() { return _flags; }
unsigned long flags(unsigned long new_val) {
unsigned long old_val = _flags; _flags = new_val; return old_val; }
unsigned short precision() { return _precision; }
unsigned short precision(int newp) {
unsigned short oldp = _precision; _precision = (unsigned short)newp;
return oldp; }
unsigned long setf(unsigned long val) {
unsigned long oldbits = _flags;
_flags |= val; return oldbits; }
unsigned long setf(unsigned long val, unsigned long mask) {
unsigned long oldbits = _flags;
_flags = (_flags & ~mask) | (val & mask); return oldbits; }
unsigned long unsetf(unsigned long mask) {
unsigned long oldbits = _flags & mask;
_flags &= ~mask; return oldbits; }
long width() { return _width; }
long width(long val) { long save = _width; _width = val; return save; }
static const unsigned long basefield;
static const unsigned long adjustfield;
static const unsigned long floatfield;
streambuf* rdbuf() { return _strbuf; }
void clear(int state = 0) { _state = state; }
int good() { return _state == 0; }
int eof() { return _state & ios::eofbit; }
int fail() { return _state & (ios::badbit|ios::failbit); }
int bad() { return _state & ios::badbit; }
int rdstate() { return _state; }
void set(int flag) { _state |= flag; }
operator void*() { return fail() ? (void*)0 : (void*)this; }
int operator!() { return fail(); }
void unset(state_value flag) { _state &= ~flag; }
void close();
int is_open();
int readable();
int writable();
protected:
ios(streambuf*sb) { _strbuf=sb; _state=0; _width=0; _fill=' ';
_flags=ios::skipws; _precision=6; }
};
typedef ios::seek_dir _seek_dir;
// Magic numbers and bits for the _flags field.
// The magic numbers use the high-order bits of _flags;
// the remaining bits are abailable for variable flags.
// Note: The magic numbers must all be negative if stdio
// emulation is desired.
struct __streambuf {
// NOTE: If this is changed, also change __FILE in stdio/stdio.h!
int _flags; /* High-order word is _IO_MAGIC; rest is flags. */
char* _gptr; /* Current get pointer */
char* _egptr; /* End of get area. */
char* _eback; /* Start of putback+get area. */
char* _pbase; /* Start of put area. */
char* _pptr; /* Current put pointer. */
char* _epptr; /* End of put area. */
char* _base; /* Start of reserve area. */
char* _ebuf; /* End of reserve area. */
struct streambuf *_chain;
};
struct streambuf : private __streambuf {
friend class ios;
friend class istream;
friend class ostream;
protected:
static streambuf* _list_all; /* List of open streambufs. */
streambuf*& xchain() { return _chain; }
void _un_link();
void _link_in();
char* gptr() const { return _gptr; }
char* pptr() const { return _pptr; }
char* egptr() const { return _egptr; }
char* epptr() const { return _epptr; }
char* pbase() const { return _pbase; }
char* eback() const { return _eback; }
char* ebuf() const { return _ebuf; }
char* base() const { return _base; }
void xput_char(char c) { *_pptr++ = c; }
int xflags() { return _flags; }
int xflags(int f) { int fl = _flags; _flags = f; return fl; }
void xsetflags(int f) { _flags |= f; }
void gbump(int n) { _gptr += n; }
void pbump(int n) { _pptr += n; }
void setb(char* b, char* eb, int a=0);
void setp(char* p, char* ep) { _pbase=_pptr=p; _epptr=ep; }
void setg(char* eb, char* g, char *eg) { _eback=eb; _gptr=g; _egptr=eg; }
public:
static int flush_all();
static void flush_all_linebuffered(); // Flush all line buffered files.
virtual int underflow(); // Leave public for now
virtual int overflow(int c = (-1) ); // Leave public for now
virtual int doallocate();
virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
virtual streampos seekpos(streampos pos, int mode = ios::in|ios::out);
int sputbackc(char c);
int sungetc();
streambuf();
virtual ~streambuf();
int unbuffered() { return _flags & 2 ? 1 : 0; }
int linebuffered() { return _flags & 0x4000 ? 1 : 0; }
void unbuffered(int i)
{ if (i) _flags |= 2 ; else _flags &= ~2 ; }
void linebuffered(int i)
{ if (i) _flags |= 0x4000 ; else _flags &= ~0x4000 ; }
int allocate() {
if (base() || unbuffered()) return 0;
else return doallocate(); }
virtual int sync();
virtual int pbackfail(int c);
virtual int ungetfail();
virtual streambuf* setbuf(char* p, int len);
int in_avail() { return _egptr - _gptr; }
int out_waiting() { return _pptr - _pbase; }
virtual int sputn(const char* s, int n);
virtual int sgetn(char* s, int n);
long sgetline(char* buf, size_t n, char delim, int putback_delim);
int sbumpc() {
if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
else return *(unsigned char*)_gptr++; }
int sgetc() {
if (_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
else return *(unsigned char*)_gptr; }
int snextc() {
if (++_gptr >= _egptr && underflow() == (-1) ) return (-1) ;
else return *(unsigned char*)_gptr; }
int sputc(int c) {
if (_pptr >= _epptr) return overflow(c);
return *_pptr++ = c, (unsigned char)c; }
int vscan(char const *fmt0, char* ap);
int vform(char const *fmt0, char* ap);
};
struct __file_fields {
char _fake;
char _shortbuf[1];
short _fileno;
int _blksize;
char* _save_gptr;
char* _save_egptr;
long _offset;
};
class filebuf : public streambuf {
struct __file_fields _fb;
void init();
public:
filebuf();
filebuf(int fd);
filebuf(int fd, char* p, int len);
~filebuf();
filebuf* attach(int fd);
filebuf* open(const char *filename, const char *mode);
filebuf* open(const char *filename, int mode, int prot = 0664);
virtual int underflow();
virtual int overflow(int c = (-1) );
int is_open() { return _fb._fileno >= 0; }
int fd() { return is_open() ? _fb._fileno : (-1) ; }
filebuf* close();
virtual int doallocate();
virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out);
int sputn(const char* s, int n);
int sgetn(char* s, int n);
protected: // See documentation in filebuf.C.
virtual int pbackfail(int c);
virtual int sync();
int is_reading() { return eback() != egptr(); }
char* cur_ptr() { return is_reading() ? gptr() : pptr(); }
/* System's idea of pointer */
char* file_ptr() { return _fb._save_gptr ? _fb._save_egptr : egptr(); }
int do_flush();
// Low-level operations (Usually invoke system calls.)
virtual int sys_read(char* buf, size_t size);
virtual long sys_seek(long , _seek_dir);
virtual long sys_write(const void*, long);
virtual int sys_stat(void*); // Actually, a (struct stat*)
virtual int sys_close();
};
inline int ios::readable() { return rdbuf()->_flags & 4 ; }
inline int ios::writable() { return rdbuf()->_flags & 8 ; }
inline int ios::is_open() {return rdbuf()->_flags & 4 +8 ;}
//# 25 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 2
class istream; class ostream;
typedef istream& (*__imanip)(istream&);
typedef ostream& (*__omanip)(ostream&);
extern istream& ws(istream& ins);
extern ostream& flush(ostream& outs);
extern ostream& endl(ostream& outs);
extern ostream& ends(ostream& outs);
class ostream : public ios
{
void do_osfx();
public:
ostream();
ostream(streambuf* sb, ostream* tied=(__null) );
~ostream();
int opfx() { if (!good()) return 0; if (_tie) _tie->flush(); return 1; }
void osfx() { if (flags() & (ios::unitbuf|ios::stdio))
do_osfx(); }
streambuf* ostreambuf() const { return _strbuf; }
ostream& flush();
ostream& put(char c);
ostream& write(const char *s, int n);
ostream& write(const unsigned char *s, int n) { return write((char*)s, n);}
ostream& write(const void *s, int n) { return write((char*)s, n);}
ostream& seekp(streampos);
ostream& seekp(streamoff, _seek_dir);
streampos tellp();
ostream& form(const char *format ...);
ostream& vform(const char *format, char* args);
};
ostream& operator<<(ostream&, char c);
ostream& operator<<(ostream& os, unsigned char c) { return os << (char)c; }
//ostream& operator<<(ostream &os, signed char c) { return os << (char)c; }
extern ostream& operator<<(ostream&, const char *s);
inline ostream& operator<<(ostream& os, const unsigned char *s)
{ return os << (const char*)s; }
//inline ostream& operator<<(ostream& os, const signed char *s)
//{ return os << (const char*)s; }
ostream& operator<<(ostream&, void *p);
ostream& operator<<(ostream&, int n);
ostream& operator<<(ostream&, long n);
ostream& operator<<(ostream&, unsigned int n);
ostream& operator<<(ostream&, unsigned long n);
ostream& operator<<(ostream& os, short n) {return os << (int)n;}
ostream& operator<<(ostream& os, unsigned short n)
{return os << (unsigned int)n;}
ostream& operator<<(ostream&, float n);
ostream& operator<<(ostream&, double n);
ostream& operator<<(ostream& os, __omanip func) { return (*func)(os); }
ostream& operator<<(ostream&, streambuf*);
class istream : public ios
{
size_t _gcount;
public:
istream();
istream(streambuf* sb, ostream*tied=(__null) );
~istream();
streambuf* istreambuf() const { return _strbuf; }
istream& get(char& c);
istream& get(unsigned char& c);
istream& read(char *ptr, int n);
istream& read(unsigned char *ptr, int n) { return read((char*)ptr, n); }
istream& read(void *ptr, int n) { return read((char*)ptr, n); }
int get() { return _strbuf->sbumpc(); }
istream& getline(char* ptr, int len, char delim = '\n');
istream& get(char* ptr, int len, char delim = '\n');
istream& gets(char **s, char delim = '\n');
int ipfx(int need) {
if (!good()) { set(ios::failbit); return 0; }
if (_tie && (need == 0 || rdbuf()->in_avail())) ; //??? THIS LINE IS QUESTIONABLE */
if (!need && (flags() & ios::skipws) && !ws(*this)) return 0;
return 1;
}
int ipfx0() { // Optimized version of ipfx(0).
if (!good()) { set(ios::failbit); return 0; }
if (_tie) _tie->flush();
if ((flags() & ios::skipws) && !ws(*this)) return 0;
return 1;
}
int ipfx1() { // Optimized version of ipfx(1).
if (!good()) { set(ios::failbit); return 0; }
if (_tie && rdbuf()->in_avail() == 0) _tie->flush();
return 1;
}
size_t gcount() { return _gcount; }
istream& seekg(streampos);
istream& seekg(streamoff, _seek_dir);
streampos tellg();
istream& putback(char ch) {
if (good() && _strbuf->sputbackc(ch) == (-1) ) clear(ios::badbit);
return *this;}
istream& unget() {
if (good() && _strbuf->sungetc() == (-1) ) clear(ios::badbit);
return *this;}
istream& unget(char ch) { return putback(ch); }
int skip(int i);
};
istream& operator>>(istream&, char*);
istream& operator>>(istream& is, unsigned char* p) { return is >> (char*)p; }
//istream& operator>>(istream& is, signed char* p) { return is >> (char*)p; }
istream& operator>>(istream&, char& c);
istream& operator>>(istream&, unsigned char& c);
//istream& operator>>(istream&, signed char& c);
istream& operator>>(istream&, int&);
istream& operator>>(istream&, long&);
istream& operator>>(istream&, short&);
istream& operator>>(istream&, unsigned int&);
istream& operator>>(istream&, unsigned long&);
istream& operator>>(istream&, unsigned short&);
istream& operator>>(istream&, float&);
istream& operator>>(istream&, double&);
istream& operator>>(istream& is, __imanip func) { return (*func)(is); }
class iostream : public ios {
size_t _gcount;
public:
iostream();
operator istream&() { return *(istream*)this; }
operator ostream&() { return *(ostream*)this; }
~iostream();
// NOTE: These duplicate istream methods.
istream& get(char& c) { return ((istream*)this)->get(c); }
istream& get(unsigned char& c) { return ((istream*)this)->get(c); }
istream& read(char *ptr, int n) { return ((istream*)this)->read(ptr, n); }
istream& read(unsigned char *ptr, int n)
{ return ((istream*)this)->read((char*)ptr, n); }
istream& read(void *ptr, int n)
{ return ((istream*)this)->read((char*)ptr, n); }
int get() { return _strbuf->sbumpc(); }
istream& getline(char* ptr, int len, char delim = '\n')
{ return ((istream*)this)->getline(ptr, len, delim); }
istream& get(char* ptr, int len, char delim = '\n')
{ return ((istream*)this)->get(ptr, len, delim); }
istream& gets(char **s, char delim = '\n')
{ return ((istream*)this)->gets(s, delim); }
int ipfx(int need) { return ((istream*)this)->ipfx(need); }
int ipfx0() { return ((istream*)this)->ipfx0(); }
int ipfx1() { return ((istream*)this)->ipfx1(); }
size_t gcount() { return _gcount; }
istream& putback(char ch) { return ((istream*)this)->putback(ch); }
istream& unget() { return ((istream*)this)->unget(); }
istream& seekg(streampos pos) { return ((istream*)this)->seekg(pos); }
istream& seekg(streamoff off, _seek_dir dir)
{ return ((istream*)this)->seekg(off, dir); }
streampos tellg() { return ((istream*)this)->tellg(); }
istream& unget(char ch) { return putback(ch); }
// NOTE: These duplicate ostream methods.
int opfx() { return ((ostream*)this)->opfx(); }
void osfx() { ((ostream*)this)->osfx(); }
ostream& flush() { return ((ostream*)this)->flush(); }
ostream& put(char c) { return ((ostream*)this)->put(c); }
ostream& write(const char *s, int n)
{ return ((ostream*)this)->write(s, n); }
ostream& write(const unsigned char *s, int n)
{ return ((ostream*)this)->write((char*)s, n); }
ostream& write(const void *s, int n)
{ return ((ostream*)this)->write((char*)s, n); }
ostream& form(const char *format ...);
ostream& vform(const char *format, char* args)
{ return ((ostream*)this)->vform(format, args); }
ostream& seekp(streampos pos) { return ((ostream*)this)->seekp(pos); }
ostream& seekp(streamoff off, _seek_dir dir)
{ return ((ostream*)this)->seekp(off, dir); }
streampos tellp() { return ((ostream*)this)->tellp(); }
};
extern istream cin;
extern ostream cout, cerr, clog; // clog->rdbuf() == cerr->rdbuf()
inline ostream& ostream::put(char c) { _strbuf->sputc(c); return *this; }
struct Iostream_init { } ; // Compatibility hack for AT&T libraray.
//# 7 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/stream.h" 2
extern char* form(char*, ...);
extern char* dec(long, int=0);
extern char* dec(int, int=0);
extern char* dec(unsigned long, int=0);
extern char* dec(unsigned int, int=0);
extern char* hex(long, int=0);
extern char* hex(int, int=0);
extern char* hex(unsigned long, int=0);
extern char* hex(unsigned int, int=0);
extern char* oct(long, int=0);
extern char* oct(int, int=0);
extern char* oct(unsigned long, int=0);
extern char* oct(unsigned int, int=0);
inline istream& WS(istream& str) { return ws(str); }
//# 26 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 2
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/Regex.h" 1
// This may look like C code, but it is really -*- C++ -*-
/*
Copyright (C) 1988 Free Software Foundation
written by Doug Lea (dl@rocky.oswego.edu)
This file is part of the GNU C++ Library. This library is free
software; you can redistribute it and/or modify it under the terms of
the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version. This library 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//#pragma interface
struct re_pattern_buffer; // defined elsewhere
struct re_registers;
class Regex
{
private:
Regex(const Regex&) {} // no X(X&)
void operator = (const Regex&) {} // no assignment
protected:
re_pattern_buffer* buf;
re_registers* reg;
public:
Regex(const char* t,
int fast = 0,
int bufsize = 40,
const char* transtable = 0);
~Regex();
int match(const char* s, int len, int pos = 0) const;
int search(const char* s, int len,
int& matchlen, int startpos = 0) const;
int match_info(int& start, int& length, int nth = 0) const;
int OK() const; // representation invariant
};
// some built in regular expressions
extern const Regex RXwhite; // = "[ \n\t\r\v\f]+"
extern const Regex RXint; // = "-?[0-9]+"
extern const Regex RXdouble; // = "-?\\(\\([0-9]+\\.[0-9]*\\)\\|
// \\([0-9]+\\)\\|\\(\\.[0-9]+\\)\\)
// \\([eE][---+]?[0-9]+\\)?"
extern const Regex RXalpha; // = "[A-Za-z]+"
extern const Regex RXlowercase; // = "[a-z]+"
extern const Regex RXuppercase; // = "[A-Z]+"
extern const Regex RXalphanum; // = "[0-9A-Za-z]+"
extern const Regex RXidentifier; // = "[A-Za-z_][A-Za-z0-9_]*"
//# 27 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 2
struct StrRep // internal String representations
{
unsigned short len; // string length
unsigned short sz; // allocated space
char s[1]; // the string starts here
// (at least 1 char for trailing null)
// allocated & expanded via non-public fcts
};
// primitive ops on StrReps -- nearly all String fns go through these.
StrRep* Salloc(StrRep*, const char*, int, int);
StrRep* Scopy(StrRep*, StrRep*);
StrRep* Sresize(StrRep*, int);
StrRep* Scat(StrRep*, const char*, int, const char*, int);
StrRep* Scat(StrRep*, const char*, int,const char*,int, const char*,int);
StrRep* Sprepend(StrRep*, const char*, int);
StrRep* Sreverse(StrRep*, StrRep*);
StrRep* Supcase(StrRep*, StrRep*);
StrRep* Sdowncase(StrRep*, StrRep*);
StrRep* Scapitalize(StrRep*, StrRep*);
// These classes need to be defined in the order given
class String;
class SubString;
class SubString
{
friend class String;
protected:
String& S; // The String I'm a substring of
unsigned short pos; // starting position in S's rep
unsigned short len; // length of substring
void assign(StrRep*, const char*, int = -1);
SubString(String& x, int p, int l);
SubString(const SubString& x);
public:
// Note there are no public constructors. SubStrings are always
// created via String operations
~SubString();
void operator = (const String& y);
void operator = (const SubString& y);
void operator = (const char* t);
void operator = (char c);
// return 1 if target appears anywhere in SubString; else 0
int contains(char c) const;
int contains(const String& y) const;
int contains(const SubString& y) const;
int contains(const char* t) const;
int contains(const Regex& r) const;
// return 1 if target matches entire SubString
int matches(const Regex& r) const;
// IO
friend ostream& operator<<(ostream& s, const SubString& x);
// status
unsigned int length() const;
int empty() const;
const char* chars() const;
int OK() const;
};
class String
{
friend class SubString;
protected:
StrRep* rep; // Strings are pointers to their representations
// some helper functions
int search(int, int, const char*, int = -1) const;
int search(int, int, char) const;
int match(int, int, int, const char*, int = -1) const;
int _gsub(const char*, int, const char* ,int);
int _gsub(const Regex&, const char*, int);
SubString _substr(int, int);
public:
// constructors & assignment
String();
String(const String& x);
String(const SubString& x);
String(const char* t);
String(const char* t, int len);
String(char c);
~String();
void operator = (const String& y);
void operator = (const char* y);
void operator = (char c);
void operator = (const SubString& y);
// concatenation
void operator += (const String& y);
void operator += (const SubString& y);
void operator += (const char* t);
void operator += (char c);
void prepend(const String& y);
void prepend(const SubString& y);
void prepend(const char* t);
void prepend(char c);
// procedural versions:
// concatenate first 2 args, store result in last arg
friend void cat(const String&, const String&, String&);
friend void cat(const String&, const SubString&, String&);
friend void cat(const String&, const char*, String&);
friend void cat(const String&, char, String&);
friend void cat(const SubString&, const String&, String&);
friend void cat(const SubString&, const SubString&, String&);
friend void cat(const SubString&, const char*, String&);
friend void cat(const SubString&, char, String&);
friend void cat(const char*, const String&, String&);
friend void cat(const char*, const SubString&, String&);
friend void cat(const char*, const char*, String&);
friend void cat(const char*, char, String&);
// double concatenation, by request. (yes, there are too many versions,
// but if one is supported, then the others should be too...)
// Concatenate first 3 args, store in last arg
friend void cat(const String&,const String&, const String&,String&);
friend void cat(const String&,const String&,const SubString&,String&);
friend void cat(const String&,const String&, const char*, String&);
friend void cat(const String&,const String&, char, String&);
friend void cat(const String&,const SubString&,const String&,String&);
friend void cat(const String&,const SubString&,const SubString&,String&);
friend void cat(const String&,const SubString&, const char*, String&);
friend void cat(const String&,const SubString&, char, String&);
friend void cat(const String&,const char*, const String&, String&);
friend void cat(const String&,const char*, const SubString&, String&);
friend void cat(const String&,const char*, const char*, String&);
friend void cat(const String&,const char*, char, String&);
friend void cat(const char*, const String&, const String&,String&);
friend void cat(const char*,const String&,const SubString&,String&);
friend void cat(const char*,const String&, const char*, String&);
friend void cat(const char*,const String&, char, String&);
friend void cat(const char*,const SubString&,const String&,String&);
friend void cat(const char*,const SubString&,const SubString&,String&);
friend void cat(const char*,const SubString&, const char*, String&);
friend void cat(const char*,const SubString&, char, String&);
friend void cat(const char*,const char*, const String&, String&);
friend void cat(const char*,const char*, const SubString&, String&);
friend void cat(const char*,const char*, const char*, String&);
friend void cat(const char*,const char*, char, String&);
// searching & matching
// return position of target in string or -1 for failure
int index(char c, int startpos = 0) const;
int index(const String& y, int startpos = 0) const;
int index(const SubString& y, int startpos = 0) const;
int index(const char* t, int startpos = 0) const;
int index(const Regex& r, int startpos = 0) const;
// return 1 if target appears anyhere in String; else 0
int contains(char c) const;
int contains(const String& y) const;
int contains(const SubString& y) const;
int contains(const char* t) const;
int contains(const Regex& r) const;
// return 1 if target appears anywhere after position pos
// (or before, if pos is negative) in String; else 0
int contains(char c, int pos) const;
int contains(const String& y, int pos) const;
int contains(const SubString& y, int pos) const;
int contains(const char* t, int pos) const;
int contains(const Regex& r, int pos) const;
// return 1 if target appears at position pos in String; else 0
int matches(char c, int pos = 0) const;
int matches(const String& y, int pos = 0) const;
int matches(const SubString& y, int pos = 0) const;
int matches(const char* t, int pos = 0) const;
int matches(const Regex& r, int pos = 0) const;
// return number of occurences of target in String
int freq(char c) const;
int freq(const String& y) const;
int freq(const SubString& y) const;
int freq(const char* t) const;
// SubString extraction
// Note that you can't take a substring of a const String, since
// this leaves open the possiblility of indirectly modifying the
// String through the SubString
SubString at(int pos, int len);
SubString operator () (int pos, int len); // synonym for at
SubString at(const String& x, int startpos = 0);
SubString at(const SubString& x, int startpos = 0);
SubString at(const char* t, int startpos = 0);
SubString at(char c, int startpos = 0);
SubString at(const Regex& r, int startpos = 0);
SubString before(int pos);
SubString before(const String& x, int startpos = 0);
SubString before(const SubString& x, int startpos = 0);
SubString before(const char* t, int startpos = 0);
SubString before(char c, int startpos = 0);
SubString before(const Regex& r, int startpos = 0);
SubString through(int pos);
SubString through(const String& x, int startpos = 0);
SubString through(const SubString& x, int startpos = 0);
SubString through(const char* t, int startpos = 0);
SubString through(char c, int startpos = 0);
SubString through(const Regex& r, int startpos = 0);
SubString from(int pos);
SubString from(const String& x, int startpos = 0);
SubString from(const SubString& x, int startpos = 0);
SubString from(const char* t, int startpos = 0);
SubString from(char c, int startpos = 0);
SubString from(const Regex& r, int startpos = 0);
SubString after(int pos);
SubString after(const String& x, int startpos = 0);
SubString after(const SubString& x, int startpos = 0);
SubString after(const char* t, int startpos = 0);
SubString after(char c, int startpos = 0);
SubString after(const Regex& r, int startpos = 0);
// deletion
// delete len chars starting at pos
void del(int pos, int len);
// delete the first occurrence of target after startpos
void del(const String& y, int startpos = 0);
void del(const SubString& y, int startpos = 0);
void del(const char* t, int startpos = 0);
void del(char c, int startpos = 0);
void del(const Regex& r, int startpos = 0);
// global substitution: substitute all occurrences of pat with repl
int gsub(const String& pat, const String& repl);
int gsub(const SubString& pat, const String& repl);
int gsub(const char* pat, const String& repl);
int gsub(const char* pat, const char* repl);
int gsub(const Regex& pat, const String& repl);
// friends & utilities
// split string into array res at separators; return number of elements
friend int split(const String& x, String res[], int maxn,
const String& sep);
friend int split(const String& x, String res[], int maxn,
const Regex& sep);
friend String common_prefix(const String& x, const String& y,
int startpos = 0);
friend String common_suffix(const String& x, const String& y,
int startpos = -1);
friend String replicate(char c, int n);
friend String replicate(const String& y, int n);
friend String join(String src[], int n, const String& sep);
// simple builtin transformations
friend String reverse(const String& x);
friend String upcase(const String& x);
friend String downcase(const String& x);
friend String capitalize(const String& x);
// in-place versions of above
void reverse();
void upcase();
void downcase();
void capitalize();
// element extraction
char& operator [] (int i);
char elem(int i) const;
char firstchar() const;
char lastchar() const;
// conversion
operator const char*() const;
const char* chars() const;
// IO
friend ostream& operator<<(ostream& s, const String& x);
friend ostream& operator<<(ostream& s, const SubString& x);
friend istream& operator>>(istream& s, String& x);
friend int readline(istream& s, String& x,
char terminator = '\n',
int discard_terminator = 1);
// status
unsigned int length() const;
int empty() const;
// preallocate some space for String
void alloc(int newsize);
// report current allocation (not length!)
int allocation() const;
volatile void error(const char* msg) const;
int OK() const;
};
typedef String StrTmp; // for backward compatibility
// other externs
int compare(const String& x, const String& y);
int compare(const String& x, const SubString& y);
int compare(const String& x, const char* y);
int compare(const SubString& x, const String& y);
int compare(const SubString& x, const SubString& y);
int compare(const SubString& x, const char* y);
int fcompare(const String& x, const String& y); // ignore case
extern StrRep _nilStrRep;
extern String _nilString;
// other inlines
String operator + (const String& x, const String& y);
String operator + (const String& x, const SubString& y);
String operator + (const String& x, const char* y);
String operator + (const String& x, char y);
String operator + (const SubString& x, const String& y);
String operator + (const SubString& x, const SubString& y);
String operator + (const SubString& x, const char* y);
String operator + (const SubString& x, char y);
String operator + (const char* x, const String& y);
String operator + (const char* x, const SubString& y);
int operator==(const String& x, const String& y);
int operator!=(const String& x, const String& y);
int operator> (const String& x, const String& y);
int operator>=(const String& x, const String& y);
int operator< (const String& x, const String& y);
int operator<=(const String& x, const String& y);
int operator==(const String& x, const SubString& y);
int operator!=(const String& x, const SubString& y);
int operator> (const String& x, const SubString& y);
int operator>=(const String& x, const SubString& y);
int operator< (const String& x, const SubString& y);
int operator<=(const String& x, const SubString& y);
int operator==(const String& x, const char* t);
int operator!=(const String& x, const char* t);
int operator> (const String& x, const char* t);
int operator>=(const String& x, const char* t);
int operator< (const String& x, const char* t);
int operator<=(const String& x, const char* t);
int operator==(const SubString& x, const String& y);
int operator!=(const SubString& x, const String& y);
int operator> (const SubString& x, const String& y);
int operator>=(const SubString& x, const String& y);
int operator< (const SubString& x, const String& y);
int operator<=(const SubString& x, const String& y);
int operator==(const SubString& x, const SubString& y);
int operator!=(const SubString& x, const SubString& y);
int operator> (const SubString& x, const SubString& y);
int operator>=(const SubString& x, const SubString& y);
int operator< (const SubString& x, const SubString& y);
int operator<=(const SubString& x, const SubString& y);
int operator==(const SubString& x, const char* t);
int operator!=(const SubString& x, const char* t);
int operator> (const SubString& x, const char* t);
int operator>=(const SubString& x, const char* t);
int operator< (const SubString& x, const char* t);
int operator<=(const SubString& x, const char* t);
// status reports, needed before defining other things
inline unsigned int String::length() const { return rep->len; }
inline int String::empty() const { return rep->len == 0; }
inline const char* String::chars() const { return &(rep->s[0]); }
inline int String::allocation() const { return rep->sz; }
inline void String::alloc(int newsize) { rep = Sresize(rep, newsize); }
inline unsigned int SubString::length() const { return len; }
inline int SubString::empty() const { return len == 0; }
inline const char* SubString::chars() const { return &(S.rep->s[pos]); }
// constructors
inline String::String()
: rep(&_nilStrRep) {}
inline String::String(const String& x)
: rep(Scopy(0, x.rep)) {}
inline String::String(const char* t)
: rep(Salloc(0, t, -1, -1)) {}
inline String::String(const char* t, int tlen)
: rep(Salloc(0, t, tlen, tlen)) {}
inline String::String(const SubString& y)
: rep(Salloc(0, y.chars(), y.length(), y.length())) {}
inline String::String(char c)
: rep(Salloc(0, &c, 1, 1)) {}
inline String::~String() { if (rep != &_nilStrRep) delete rep; }
inline SubString::SubString(const SubString& x)
:S(x.S), pos(x.pos), len(x.len) {}
inline SubString::SubString(String& x, int first, int l)
:S(x), pos(first), len(l) {}
inline SubString::~SubString() {}
// assignment
inline void String::operator = (const String& y)
{
rep = Scopy(rep, y.rep);
}
inline void String::operator=(const char* t)
{
rep = Salloc(rep, t, -1, -1);
}
inline void String::operator=(const SubString& y)
{
rep = Salloc(rep, y.chars(), y.length(), y.length());
}
inline void String::operator=(char c)
{
rep = Salloc(rep, &c, 1, 1);
}
inline void SubString::operator = (const char* ys)
{
assign(0, ys);
}
inline void SubString::operator = (char ch)
{
assign(0, &ch, 1);
}
inline void SubString::operator = (const String& y)
{
assign(y.rep, y.chars(), y.length());
}
inline void SubString::operator = (const SubString& y)
{
assign(y.S.rep, y.chars(), y.length());
}
// Zillions of cats...
inline void cat(const String& x, const String& y, String& r)
{
r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
}
inline void cat(const String& x, const SubString& y, String& r)
{
r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
}
inline void cat(const String& x, const char* y, String& r)
{
r.rep = Scat(r.rep, x.chars(), x.length(), y, -1);
}
inline void cat(const String& x, char y, String& r)
{
r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1);
}
inline void cat(const SubString& x, const String& y, String& r)
{
r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
}
inline void cat(const SubString& x, const SubString& y, String& r)
{
r.rep = Scat(r.rep, x.chars(), x.length(), y.chars(), y.length());
}
inline void cat(const SubString& x, const char* y, String& r)
{
r.rep = Scat(r.rep, x.chars(), x.length(), y, -1);
}
inline void cat(const SubString& x, char y, String& r)
{
r.rep = Scat(r.rep, x.chars(), x.length(), &y, 1);
}
inline void cat(const char* x, const String& y, String& r)
{
r.rep = Scat(r.rep, x, -1, y.chars(), y.length());
}
inline void cat(const char* x, const SubString& y, String& r)
{
r.rep = Scat(r.rep, x, -1, y.chars(), y.length());
}
inline void cat(const char* x, const char* y, String& r)
{
r.rep = Scat(r.rep, x, -1, y, -1);
}
inline void cat(const char* x, char y, String& r)
{
r.rep = Scat(r.rep, x, -1, &y, 1);
}
inline void cat(const String& a, const String& x, const String& y, String& r)
{
r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
}
inline void cat(const String& a, const String& x, const SubString& y, String& r)
{
r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
}
inline void cat(const String& a, const String& x, const char* y, String& r)
{
r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1);
}
inline void cat(const String& a, const String& x, char y, String& r)
{
r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1);
}
inline void cat(const String& a, const SubString& x, const String& y, String& r)
{
r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
}
inline void cat(const String& a, const SubString& x, const SubString& y, String& r)
{
r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y.chars(), y.length());
}
inline void cat(const String& a, const SubString& x, const char* y, String& r)
{
r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), y, -1);
}
inline void cat(const String& a, const SubString& x, char y, String& r)
{
r.rep = Scat(r.rep, a.chars(), a.length(), x.chars(), x.length(), &y, 1);
}
inline void cat(const String& a, const char* x, const String& y, String& r)
{
r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length());
}
inline void cat(const String& a, const char* x, const SubString& y, String& r)
{
r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y.chars(), y.length());
}
inline void cat(const String& a, const char* x, const char* y, String& r)
{
r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, y, -1);
}
inline void cat(const String& a, const char* x, char y, String& r)
{
r.rep = Scat(r.rep, a.chars(), a.length(), x, -1, &y, 1);
}
inline void cat(const char* a, const String& x, const String& y, String& r)
{
r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
}
inline void cat(const char* a, const String& x, const SubString& y, String& r)
{
r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
}
inline void cat(const char* a, const String& x, const char* y, String& r)
{
r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1);
}
inline void cat(const char* a, const String& x, char y, String& r)
{
r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1);
}
inline void cat(const char* a, const SubString& x, const String& y, String& r)
{
r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
}
inline void cat(const char* a, const SubString& x, const SubString& y, String& r)
{
r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y.chars(), y.length());
}
inline void cat(const char* a, const SubString& x, const char* y, String& r)
{
r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), y, -1);
}
inline void cat(const char* a, const SubString& x, char y, String& r)
{
r.rep = Scat(r.rep, a, -1, x.chars(), x.length(), &y, 1);
}
inline void cat(const char* a, const char* x, const String& y, String& r)
{
r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length());
}
inline void cat(const char* a, const char* x, const SubString& y, String& r)
{
r.rep = Scat(r.rep, a, -1, x, -1, y.chars(), y.length());
}
inline void cat(const char* a, const char* x, const char* y, String& r)
{
r.rep = Scat(r.rep, a, -1, x, -1, y, -1);
}
inline void cat(const char* a, const char* x, char y, String& r)
{
r.rep = Scat(r.rep, a, -1, x, -1, &y, 1);
}
// operator versions
inline void String::operator +=(const String& y)
{
cat(*this, y, *this);
}
inline void String::operator +=(const SubString& y)
{
cat(*this, y, *this);
}
inline void String::operator += (const char* y)
{
cat(*this, y, *this);
}
inline void String:: operator +=(char y)
{
cat(*this, y, *this);
}
// constructive concatenation
inline String operator + (const String& x, const String& y) return r; // { dg-error "" }
{
cat(x, y, r); // { dg-error "" }
}
inline String operator + (const String& x, const SubString& y) return r; // { dg-error "" }
{
cat(x, y, r); // { dg-error "" }
}
inline String operator + (const String& x, const char* y) return r; // { dg-error "" }
{
cat(x, y, r); // { dg-error "" }
}
inline String operator + (const String& x, char y) return r; // { dg-error "" }
{
cat(x, y, r); // { dg-error "" }
}
inline String operator + (const SubString& x, const String& y) return r; // { dg-error "" }
{
cat(x, y, r); // { dg-error "" }
}
inline String operator + (const SubString& x, const SubString& y) return r; // { dg-error "" }
{
cat(x, y, r); // { dg-error "" }
}
inline String operator + (const SubString& x, const char* y) return r; // { dg-error "" }
{
cat(x, y, r); // { dg-error "" }
}
inline String operator + (const SubString& x, char y) return r; // { dg-error "" }
{
cat(x, y, r); // { dg-error "" }
}
inline String operator + (const char* x, const String& y) return r; // { dg-error "" }
{
cat(x, y, r); // { dg-error "" }
}
inline String operator + (const char* x, const SubString& y) return r; // { dg-error "" }
{
cat(x, y, r); // { dg-error "" }
}
inline String reverse(const String& x) return r; // { dg-error "" }
{
r.rep = Sreverse(x.rep, r.rep); // { dg-error "" }
}
inline String upcase(const String& x) return r; // { dg-error "" }
{
r.rep = Supcase(x.rep, r.rep); // { dg-error "" }
}
inline String downcase(const String& x) return r; // { dg-error "" }
{
r.rep = Sdowncase(x.rep, r.rep); // { dg-error "" }
}
inline String capitalize(const String& x) return r; // { dg-error "" }
{
r.rep = Scapitalize(x.rep, r.rep); // { dg-error "" }
}
//# 883 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h"
// prepend
inline void String::prepend(const String& y)
{
rep = Sprepend(rep, y.chars(), y.length());
}
inline void String::prepend(const char* y)
{
rep = Sprepend(rep, y, -1);
}
inline void String::prepend(char y)
{
rep = Sprepend(rep, &y, 1);
}
inline void String::prepend(const SubString& y)
{
rep = Sprepend(rep, y.chars(), y.length());
}
// misc transformations
inline void String::reverse()
{
rep = Sreverse(rep, rep);
}
inline void String::upcase()
{
rep = Supcase(rep, rep);
}
inline void String::downcase()
{
rep = Sdowncase(rep, rep);
}
inline void String::capitalize()
{
rep = Scapitalize(rep, rep);
}
// element extraction
inline char& String::operator [] (int i)
{
if (((unsigned)i) >= length()) error("invalid index");
return rep->s[i];
}
inline char String::elem (int i) const
{
if (((unsigned)i) >= length()) error("invalid index");
return rep->s[i];
}
inline char String::firstchar() const
{
return elem(0);
}
inline char String::lastchar() const
{
return elem(length() - 1);
}
// searching
inline int String::index(char c, int startpos) const
{
return search(startpos, length(), c);
}
inline int String::index(const char* t, int startpos) const
{
return search(startpos, length(), t);
}
inline int String::index(const String& y, int startpos) const
{
return search(startpos, length(), y.chars(), y.length());
}
inline int String::index(const SubString& y, int startpos) const
{
return search(startpos, length(), y.chars(), y.length());
}
inline int String::index(const Regex& r, int startpos) const
{
int unused; return r.search(chars(), length(), unused, startpos);
}
inline int String::contains(char c) const
{
return search(0, length(), c) >= 0;
}
inline int String::contains(const char* t) const
{
return search(0, length(), t) >= 0;
}
inline int String::contains(const String& y) const
{
return search(0, length(), y.chars(), y.length()) >= 0;
}
inline int String::contains(const SubString& y) const
{
return search(0, length(), y.chars(), y.length()) >= 0;
}
inline int String::contains(char c, int p) const
{
return match(p, length(), 0, &c, 1) >= 0;
}
inline int String::contains(const char* t, int p) const
{
return match(p, length(), 0, t) >= 0;
}
inline int String::contains(const String& y, int p) const
{
return match(p, length(), 0, y.chars(), y.length()) >= 0;
}
inline int String::contains(const SubString& y, int p) const
{
return match(p, length(), 0, y.chars(), y.length()) >= 0;
}
inline int String::contains(const Regex& r) const
{
int unused; return r.search(chars(), length(), unused, 0) >= 0;
}
inline int String::contains(const Regex& r, int p) const
{
return r.match(chars(), length(), p) >= 0;
}
inline int String::matches(const SubString& y, int p) const
{
return match(p, length(), 1, y.chars(), y.length()) >= 0;
}
inline int String::matches(const String& y, int p) const
{
return match(p, length(), 1, y.chars(), y.length()) >= 0;
}
inline int String::matches(const char* t, int p) const
{
return match(p, length(), 1, t) >= 0;
}
inline int String::matches(char c, int p) const
{
return match(p, length(), 1, &c, 1) >= 0;
}
inline int String::matches(const Regex& r, int p) const
{
int l = (p < 0)? -p : length() - p;
return r.match(chars(), length(), p) == l;
}
inline int SubString::contains(const char* t) const
{
return S.search(pos, pos+len, t) >= 0;
}
inline int SubString::contains(const String& y) const
{
return S.search(pos, pos+len, y.chars(), y.length()) >= 0;
}
inline int SubString::contains(const SubString& y) const
{
return S.search(pos, pos+len, y.chars(), y.length()) >= 0;
}
inline int SubString::contains(char c) const
{
return S.search(pos, pos+len, 0, c) >= 0;
}
inline int SubString::contains(const Regex& r) const
{
int unused; return r.search(chars(), len, unused, 0) >= 0;
}
inline int SubString::matches(const Regex& r) const
{
return r.match(chars(), len, 0) == len;
}
inline int String::gsub(const String& pat, const String& r)
{
return _gsub(pat.chars(), pat.length(), r.chars(), r.length());
}
inline int String::gsub(const SubString& pat, const String& r)
{
return _gsub(pat.chars(), pat.length(), r.chars(), r.length());
}
inline int String::gsub(const Regex& pat, const String& r)
{
return _gsub(pat, r.chars(), r.length());
}
inline int String::gsub(const char* pat, const String& r)
{
return _gsub(pat, -1, r.chars(), r.length());
}
inline int String::gsub(const char* pat, const char* r)
{
return _gsub(pat, -1, r, -1);
}
inline ostream& operator<<(ostream& s, const String& x)
{
s << x.chars(); return s;
}
// a zillion comparison operators
inline int operator==(const String& x, const String& y)
{
return compare(x, y) == 0;
}
inline int operator!=(const String& x, const String& y)
{
return compare(x, y) != 0;
}
inline int operator>(const String& x, const String& y)
{
return compare(x, y) > 0;
}
inline int operator>=(const String& x, const String& y)
{
return compare(x, y) >= 0;
}
inline int operator<(const String& x, const String& y)
{
return compare(x, y) < 0;
}
inline int operator<=(const String& x, const String& y)
{
return compare(x, y) <= 0;
}
inline int operator==(const String& x, const SubString& y)
{
return compare(x, y) == 0;
}
inline int operator!=(const String& x, const SubString& y)
{
return compare(x, y) != 0;
}
inline int operator>(const String& x, const SubString& y)
{
return compare(x, y) > 0;
}
inline int operator>=(const String& x, const SubString& y)
{
return compare(x, y) >= 0;
}
inline int operator<(const String& x, const SubString& y)
{
return compare(x, y) < 0;
}
inline int operator<=(const String& x, const SubString& y)
{
return compare(x, y) <= 0;
}
inline int operator==(const String& x, const char* t)
{
return compare(x, t) == 0;
}
inline int operator!=(const String& x, const char* t)
{
return compare(x, t) != 0;
}
inline int operator>(const String& x, const char* t)
{
return compare(x, t) > 0;
}
inline int operator>=(const String& x, const char* t)
{
return compare(x, t) >= 0;
}
inline int operator<(const String& x, const char* t)
{
return compare(x, t) < 0;
}
inline int operator<=(const String& x, const char* t)
{
return compare(x, t) <= 0;
}
inline int operator==(const SubString& x, const String& y)
{
return compare(y, x) == 0;
}
inline int operator!=(const SubString& x, const String& y)
{
return compare(y, x) != 0;
}
inline int operator>(const SubString& x, const String& y)
{
return compare(y, x) < 0;
}
inline int operator>=(const SubString& x, const String& y)
{
return compare(y, x) <= 0;
}
inline int operator<(const SubString& x, const String& y)
{
return compare(y, x) > 0;
}
inline int operator<=(const SubString& x, const String& y)
{
return compare(y, x) >= 0;
}
inline int operator==(const SubString& x, const SubString& y)
{
return compare(x, y) == 0;
}
inline int operator!=(const SubString& x, const SubString& y)
{
return compare(x, y) != 0;
}
inline int operator>(const SubString& x, const SubString& y)
{
return compare(x, y) > 0;
}
inline int operator>=(const SubString& x, const SubString& y)
{
return compare(x, y) >= 0;
}
inline int operator<(const SubString& x, const SubString& y)
{
return compare(x, y) < 0;
}
inline int operator<=(const SubString& x, const SubString& y)
{
return compare(x, y) <= 0;
}
inline int operator==(const SubString& x, const char* t)
{
return compare(x, t) == 0;
}
inline int operator!=(const SubString& x, const char* t)
{
return compare(x, t) != 0;
}
inline int operator>(const SubString& x, const char* t)
{
return compare(x, t) > 0;
}
inline int operator>=(const SubString& x, const char* t)
{
return compare(x, t) >= 0;
}
inline int operator<(const SubString& x, const char* t)
{
return compare(x, t) < 0;
}
inline int operator<=(const SubString& x, const char* t)
{
return compare(x, t) <= 0;
}
// a helper needed by at, before, etc.
inline SubString String::_substr(int first, int l)
{
if (first >= length() ) // ??? THIS LINE IS QUESTIONABLE
return SubString(_nilString, 0, 0) ;
else
return SubString(*this, first, l);
}
//# 26 "../../GctSymbol.h" 2
//# 1 "../../../../../../mips/include/Gct/Object/GctHashObject.h" 1
// -*- C++ -*-
//
// GctHashObject class (is abstract)
//
// Expects to be included by Object.h or where needed explicitly.
//
// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
//
//#pragma interface
//# 1 "../../../../../../mips/include/Gct/Object/GctObject.h" 1
// -*- C++ -*-
//
// GctObject class (is abstract)
//
// Expects to be included by Object.h or where needed explicitly.
//
// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
//
//#pragma interface
//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
// -*- C++ -*-
//
// tostrstream class
//
// A terminated oststream - an ostsrstream that auto-terminates on str()
//
// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
//
//#pragma interface
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/strstream.h" 1
// This is part of the iostream library, providing input/output for C++.
// Copyright (C) 1991 Per Bothner.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//#pragma interface
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
// This is part of the iostream library, providing -*- C++ -*- input/output.
// Copyright (C) 1991 Per Bothner.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
//# 23 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/strstream.h" 2
class strstreambuf : public streambuf {
size_t *lenp; /* current (logical) length (i.e. valid data bytes) */
size_t *sizep; /* allocated (physical) buffer size */
char **bufp;
size_t _len;
size_t _size;
char *buf;
int _frozen;
protected:
virtual int overflow(int = (-1) );
public:
strstreambuf();
strstreambuf(int initial);
strstreambuf(char *ptr, int size, char *pstart = (__null) );
~strstreambuf();
int frozen() { return _frozen; }
void freeze(int n=1) { _frozen = n != 0; }
size_t pcount();
char *str();
};
class istrstream : public istream {
public:
istrstream(char*);
istrstream(char*, int);
strstreambuf* rdbuf() { return (strstreambuf*)_strbuf; }
};
class ostrstream : public ostream {
public:
ostrstream();
ostrstream(char *cp, int n, int mode=ios::out);
size_t pcount() { return ((strstreambuf*)_strbuf)->pcount(); }
char *str() { return ((strstreambuf*)_strbuf)->str(); }
void freeze(int n = 1) { ((strstreambuf*)_strbuf)->freeze(n); }
int frozen() { return ((strstreambuf*)_strbuf)->frozen(); }
strstreambuf* rdbuf() { return (strstreambuf*)_strbuf; }
};
//# 25 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 2
//
// tostrstream class
//
// An isteam class that doesn't have that nasty skipws parameter that
// you have to remember to set. This class simply provides the istream
// functionality with a set of constructors which defaults skipws to
// FALSE (instead of defaulting to TRUE as is the case with plain istream).
//
class tostrstream: public ostrstream {
public:
tostrstream(): ostrstream()
{ }
// This constructor defines cp as the buffer to use for the
// stream (instead of one of its own devising); it does NOT
// initialize the ostrstream to contain cp (of length n).
tostrstream(char *cp, int n, int mode=ios::out): ostrtream(cp, n, mode) // { dg-error "" }
{ }
char *str()
{
char *s = ostrstream::str();
s[ostrstream::pcount()] = '\0';
return s;
}
};
//# 25 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 1
// -*- C++ -*-
//
// GttObject class (is abstract)
//
// Expects to be included where needed explicitly.
//
// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
//
//#pragma interface
//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
// -*- C++ -*-
//# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
//# 25 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 1
// -*- C++ -*-
//
// GttErrorHandler class
//
// Expects to be included by Gtt.h
//
// Wendell Baker, Berkeley CAD Group, 1992 (wbaker@ic.Berkeley.EDU)
//
//#pragma interface
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
//# 25 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 1
// -*- C++ -*-
//
// Fake up a libstuff++
//
// This is done as a complete and utter hack; this library has no function
// at all being in the boot area; it is here solely in order to provide a
// libstuff++ against which the Makefiles can resolve link lines.
//
// The only reason that this is done is to allow the STANDARD_C++_LIBRARIES
// as provided by the Makefile templates in the boot area to be the same
// ones that are used by the tools outside this hierarchy.
//
// The tools outside this hierarchy use a different libstuff++; one that is
// written in C++. This one is not written in C++ in order to be simpler.
//
//#pragma interface
extern "C" {
//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 1
/*
* Useful stuff
*/
/*
*/
//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/ansi.h" 1
/*
* ANSI Compiler Support
*
* David Harrison
* University of California, Berkeley
* 1988
*
* ANSI compatible compilers are supposed to define the preprocessor
* directive __STDC__. Based on this directive, this file defines
* certain ANSI specific macros.
*
* ARGS:
* Used in function prototypes. Example:
* extern int foo
* ARGS((char *blah, double threshold));
*/
/*
*
* Modifications
* Wendell C Baker
* University of California, Berkeley
*/
/* Function prototypes */
//# 15 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 2
/*
* If g++, then we stub out part of this thing and let the C++ types take
* over and do the same job; some compatibility must be given however
*/
/*
* Use the GNU libg++ definition
*/
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
//# 26 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h" 2
//# 35 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h"
/*
* Make various pieces of C code that use the old ``Boolean''
* be compatible by faking up the definition of Boolean using
* the new bool type.
*/
//# 58 "/sandbox/wbaker/wbaker0/source/mips/include/stuff.h"
typedef long FitAny; /* can fit any integral type */
/*
* typedef char *String; - DO NOT USE THIS - it conflicts with C++
* typedef char **Stringv; - just use char* and char** instead.
* - void* can be used for arbitrary pointers
*/
extern int nocase_strcmp (char *, char *) ;
extern int nocase_strncmp (char *, char *, int) ;
extern bool nocase_strequal (char *, char *) ;
extern bool nocase_strnequal (char *, char *, int) ;
extern bool lead_strequal (char *, char *) ;
extern bool nocase_lead_strequal (char *, char *) ;
extern int strhash (char *, int) ;
extern int nocase_strhash (char *, int) ;
extern int sign (int) ;
/*
* Some useful macros.
*/
//# 33 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
}
//
// This is here because we wish to provide externs for the two
// functions btoa(bool, unsigned = 0) and operator<<(ostream&, bool)
// because they are not provided in bool.h.
//
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
//# 41 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
extern const char *stringify(bool b);
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
// This is part of the iostream library, providing -*- C++ -*- input/output.
// Copyright (C) 1991 Per Bothner.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
//# 43 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
extern ostream& operator<<(ostream&, bool);
// Should this be kept separate? bool isn't, but then is
// included here only to define ostream& operator<<(ostream&, bool)
//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/unit.h" 1
// -*- C++ -*-
//
// unit enum
//
// Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
//
//
// unit enum
//
// This _looks_ silly, but it has an important theoretical basis in category
// theory. For the pragmatic reason for its existence, see the example below.
//
enum unit {
UNIT = 1,
};
extern const char *stringify(unit u);
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
// This is part of the iostream library, providing -*- C++ -*- input/output.
// Copyright (C) 1991 Per Bothner.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
//# 28 "/sandbox/wbaker/wbaker0/source/mips/include/unit.h" 2
extern ostream& operator<<(ostream&, unit);
//
// A unit is used in cases where the type signature of an overloaded
// function must be differentiated in some stronger way than can be
// denoted unambiguously in the C++ syntax. This enum is used to give
// one of the functions a different type signature, thereby allowing
// the overloading.
//
// The use of ``unit'' instead of int or bool is important because a unit
// has only one possible value; therefore it adds no more information to
// the code. For example, say a bool was used instead, then in the testing
// phase, would have to ask: what if TRUE was given, what if FALSE was given.
// The problem is compounded if char or int is used.
//
// Example:
//
// class ID {
// public:
// ID(); // construct a null ID
// ID(unit); // alloc a ID with a new id
// private:
// static unsigned high_water;
// unsigned id;
// };
//
// Try working this example save that ID implements all of the generic
// features of the identifier object, but the high_water is stored
// in the heir. That is what originally motivated the creation of unit.
//
//# 48 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 2
//
// In the spirit of the standard GNU error handler functions
// as described in
// typedef void (*one_arg_error_handler_t)(const char*);
// a one argument error handler function pointer
// typedef void (*two_arg_error_handler_t)(const char*, const char*);
// a two argument error handler function pointer
//
// And now the NEW
//
// typedef void (*zero_arg_error_handler_t)();
// a zero argument error handler function pointer
//
typedef void (*zero_arg_error_handler_t)();
//
// In the spirit of the default GNU error handler functions
// as described in
// extern void default_one_arg_error_handler(const char *message);
// print out message on stderr, and do the default thing (abort)
// extern void default_two_arg_error_handler(const char *kind, const char *message);
// print out kind and message on stderr, and do the default thing (abort)
//
// And now the NEW
//
// extern void default_zero_arg_error_handler(const char *message);
// do the default thing (abort)
//
extern void default_zero_arg_error_handler();
// Guaranteed to exit (1)
extern void exit_zero_arg_error_handler();
extern void exit_one_arg_error_handler(const char *message);
extern void exit_two_arg_error_handler(const char *kind, const char *message);
// Guaranteed to abort()
extern void abort_zero_arg_error_handler();
extern void abort_one_arg_error_handler(const char *message);
extern void abort_two_arg_error_handler(const char *kind, const char *message);
//
// In the spirit of the standard GNU error handlers
// as described in
// extern void verbose_File_error_handler(const char*);
// perror and set errno = 0
// extern void quiet_File_error_handler(const char*);
// set errno = 0
// extern void fatal_File_error_handler(const char*);
// perror and exit 1
//
// And now the NEW
//
// extern void preserve_File_error_handler(const char *message);
// no perror, no assignment to errno.
//
extern void preserve_File_error_handler(const char *message);
//# 27 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
// -*- C++ -*-
//# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
//# 28 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttErrorHandler.h" 2
//
// It is expected that this will be virtually multiply inherited
// into all of the classes that need error reporting services.
//
// The typical way to have that done is by inheriting the GttObject
// as a virtual base class.
//
//
// GttErrorHandler class
//
class GttErrorHandler {
public:
GttErrorHandler();
GttErrorHandler(const char *program);
virtual ~GttErrorHandler();
//
// Error messages
// - an unacceptable, but expected and recoverable condition
// was detected (but the test fails)
// - errors are for ``the expected environment was not found''
// rather than for ``file couldn't be opened''
// - these messages cannot be shut off
// - the error handler determines the recovery action
// TODO - one day exceptions will be used here
//
static void error(const char *message);
static void error(tostrstream& message);
static void error(const char *function, const char *message);
static void error(const char *function, tostrstream& message);
static void error(const char *class_name, const char *method, const char *message);
static void error(const char *class_name, const char *method, tostrstream& message);
//
// Fatal messages
// - an unacceptable and unexpected error was detected
// the data invariants were violated, there is no recovery
// - these messages cannot be shut off
// - the error handler determines the recovery action
// TODO - one day exceptions will be used here
//
static void fatal(const char *message);
static void fatal(tostrstream& message);
static void fatal(const char *function, const char *message);
static void fatal(const char *function, tostrstream& message);
static void fatal(const char *class_name, const char *method, const char *message);
static void fatal(const char *class_name, const char *method, tostrstream& message);
private:
//
// Two underscores are used here in order to prevent confusion of these
// private variables with any of the heir's private variables. Note that
// access control is different than visibility in C++, so all the variable
// names in a class hierarchy must be unique.
//
static bool __partial_init;
static void __partial_initialize();
static bool __full_init;
static void __full_initialize(const char *program);
static char *__program;
static void __handle_error();
static void __handle_fatal();
static void __add_newline(const char *message);
static bool __output_valid();
static ostream *__output;
};
//# 27 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
//
// GttObject class (is abstract)
//
class GttObject: virtual public GttErrorHandler {
protected:
GttObject();
GttObject(const GttObject&);
virtual ~GttObject(); // ensure descendants have virtual destructors
public:
//
// I/O Support
//
// The value typically persists only long enough for an i/o operation
// to be performed (see the defintion of output via operator<<(... ) below)
virtual const char *stringify();
protected:
// This is the buffer into which the printed representation of this
// object will be put when the time comes. It is associated with the
// object so it will never go away (so long as the object exists).
// Use a pointer so that you only pay for the space when I/O is used
tostrstream *stringbuf;
void clear_stringbuf();
public:
//
// Consistency
//
// The global data invariant for the whole object (heirs included).
// This OK function will call the local invariant function ok() if
// necessary and in addition the OK functions of the heirs
// This is expected to compute the data invariant of the object.
// It will execute GctErrorHandler::fatal if there is wrong.
virtual void OK() const;
protected:
//
// consistency
//
// This function computes the invariant which is local to this object.
// It does not call any of the ancestor's OK() or ok() functions.
// It is not a virtual function so that it can be called from within a
// constructor with impunity. Thus this function MUST NOT call any
// virtual functions either; it should call them by their full name if
// that is necessary. The global OK() function will call this function
// as necessary.
//
// This function must NOT NEVER EVER be made virtual.
void ok() const;
protected:
//
// Class Name
//
// This must return a static (constant) string which is the name
// of the class being declared. By convention, not all classes
// must have one of these, but the major root abstract class must
// have one in order to allow the stringify() to work approximately
// correctly.
virtual const char *class_name() const = 0;
};
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
// This is part of the iostream library, providing -*- C++ -*- input/output.
// Copyright (C) 1991 Per Bothner.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
//# 91 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 2
extern ostream& operator<<(ostream&, GttObject&);
// There may be other X& operator<<(X&, GttObject&) defined in the
// packages defining class X. For example see the definition of
// GttUnitObject& operator<<(GttUnitObject&, GttObject&) in Unit.
//# 27 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
//# 1 "../../../../../../mips/include/Gct/GctErrorHandler.h" 1
// -*- C++ -*-
//
// GctErrorHandler class
//
// Expects to be included by Gct.h
//
// Wendell Baker, Berkeley CAD Group, 1991 (wbaker@ic.Berkeley.EDU)
//
//#pragma interface
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/bool.h" 1
//# 25 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h" 1
// This may look like C code, but it is really -*- C++ -*-
/*
Copyright (C) 1988 Free Software Foundation
written by Doug Lea (dl@rocky.oswego.edu)
This file is part of the GNU C++ Library. This library is free
software; you can redistribute it and/or modify it under the terms of
the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version. This library 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//# 1321 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h"
//# 26 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
// This is part of the iostream library, providing -*- C++ -*- input/output.
// Copyright (C) 1991 Per Bothner.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
//# 27 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h" 1
// -*- C++ -*-
//# 107 "/sandbox/wbaker/wbaker0/source/mips/include/stuff++.h"
//# 29 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h" 1
// -*- C++ -*-
//# 52 "/sandbox/wbaker/wbaker0/source/mips/include/tostrstream.h"
//# 30 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
//# 1 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h" 1
// -*- C++ -*-
//# 98 "/sandbox/wbaker/wbaker0/source/mips/include/Gtt/GttObject.h"
//# 32 "../../../../../../mips/include/Gct/GctErrorHandler.h" 2
//
// It is expected that this will be virtually multiply inherited
// into all of the classes that need error reporting services.
//
// The typical way to have that done is by inheriting the GctObject
// as a virtual base class.
//
//
// GctErrorHandler class
//
// GPP_1_96_BUG
// NOTE - virtual public GttObject should be MI into GctObject - but that
// causes g++ 1.96 to segfault; so we must inherit GttObject here and use SI
// GPP_1_96_BUG
class GctErrorHandler: virtual public GttObject {
public:
GctErrorHandler();
GctErrorHandler(const String& program);
virtual ~GctErrorHandler();
//
// Debugging messages
// - these are turned off for production code.
// - these messages can be shut off
//
static void debug(const char *message);
static void debug(tostrstream& message);
static void debug(const char *function, const char *message);
static void debug(const char *function, tostrstream& message);
static void debug(const char *class_name, const char *method, const char *message);
static void debug(const char *class_name, const char *method, tostrstream& message);
static bool debug(); // current debug switch
static void debug(bool value); // change the debug switch
//
// Informational messages
// - these correspond to a ``verbose'' mode
// - these are not errors, just chatty progress reports
// - these messages can be shut off
//
static void note(const char *message);
static void note(tostrstream& message);
static void note(const char *function, const char *message);
static void note(const char *function, tostrstream& message);
static void note(const char *class_name, const char *method, const char *message);
static void note(const char *class_name, const char *method, tostrstream& message);
static bool note(); // current note switch
static void note(bool value); // change the note switch
//
// Warning messages
// - warnings are system-recoverable errors
// - the system has noticed something and taken some
// corrective action
// - these messages can be shut off
//
static void warning(const char *message);
static void warning(tostrstream& message);
static void warning(const char *function, const char *message);
static void warning(const char *function, tostrstream& message);
static void warning(const char *class_name, const char *method, const char *message);
static void warning(const char *class_name, const char *method, tostrstream& message);
static bool warning(); // current warning switch
static void warning(bool value); // change the warning switch
//
// Error messages
// - an unacceptable, but expected and recoverable
// condition was detected
// - errors are for ``the expected environment was not found''
// rather than for ``file couldn't be opened''
// - these messages cannot be shut off
// - the error handler determines the recovery action
// TODO - one day exceptions will be used here
//
static void error(const char *message);
static void error(tostrstream& message);
static void error(const char *function, const char *message);
static void error(const char *function, tostrstream& message);
static void error(const char *class_name, const char *method, const char *message);
static void error(const char *class_name, const char *method, tostrstream& message);
// can't turn off errors - no ``static void error(bool value);''
static zero_arg_error_handler_t error(); // current error handler
static void error(zero_arg_error_handler_t handler);// change the error handler
static void error_is_lib_error_handler(); // change the error handler
static void error_is_exit(); // change the error handler
// Describes the fatal handler - WATCHOUT - implicitly uses AllocRing
static const char *error_handler_description();
//
// Fatal messages
// - an unacceptable and unexpected error was detected
// the data invariants were violated, there is no recovery
// - these messages cannot be shut off
// - the error handler determines the recovery action
// TODO - one day exceptions will be used here
//
static void fatal(const char *message);
static void fatal(tostrstream& message);
static void fatal(const char *function, const char *message);
static void fatal(const char *function, tostrstream& message);
static void fatal(const char *class_name, const char *method, const char *message);
static void fatal(const char *class_name, const char *method, tostrstream& message);
// can't turn off fatals - no ``static void fatal(bool value);''
static zero_arg_error_handler_t fatal(); // return the fatal handler
static void fatal(zero_arg_error_handler_t handler); // change the fatal handler
static void fatal_is_exit(); // change the fatal handler
static void fatal_is_abort(); // change the fatal handler
// Describes the fatal handler - WATCHOUT - implicitly uses AllocRing
static const char *fatal_handler_description();
private:
//
// Two underscores are used here in order to prevent confusion of these
// private variables with any of the heir's private variables. Note that
// access control is different than visibility in C++, so all the variable
// names in a class hierarchy must be unique.
//
static bool __debug;
static bool __note;
static bool __warning;
static void (*__error_handler)(); // can't turn off errors
static void (*__fatal_handler)(); // can't turn off fatals
static bool __partial_init;
static void __partial_initialize();
static bool __full_init;
static void __full_initialize(const char *program);
static char *__program;
static void __handle_error();
static void __handle_fatal();
static void __add_newline(const char *message);
static void __message_switch(bool value, bool& flag, const char *description);
static void __message_switch(bool value, bool& flag);
static const char *__describe_handler(zero_arg_error_handler_t handler);
static bool __output_valid();
static ostream *__output;
// GPP_1_96_BUG
const char *class_name() const;
// GPP_1_96_BUG
};
//# 29 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
//
// GctObject class (is abstract)
//
class GctObject: virtual public GctErrorHandler /*, virtual public GttObject*/ {
protected:
GctObject();
GctObject(const GctObject&);
virtual ~GctObject(); // ensure descendants have virtual destructors
public:
//
// I/O Support
//
// The value typically persists only long enough for an i/o operation
// to be performed (see the defintion of output via operator<<(... ) below)
virtual const char *stringify();
protected:
// This is the buffer into which the printed representation of this
// object will be put when the time comes. It is associated with the
// object so it will never go away (so long as the object exists).
// Use a pointer so that you only pay for the space when I/O is used
tostrstream *stringbuf;
void clear_stringbuf();
public:
//
// Consistency (global consistency)
//
// The global data invariant for the whole object (heirs included).
// This OK function will call the local invariant function ok() if
// necessary and in addition the OK functions of the heirs
// This is expected to compute the data invariant of the object.
// It will execute GctErrorHandler::fatal if there is wrong.
virtual void OK() const;
protected:
//
// consistency (local consistency)
//
// This function computes the invariant which is local to this object.
// It does not call any of the ancestor's OK() or ok() functions.
// It is not a virtual function so that it can be called from within a
// constructor with impunity. Thus this function MUST NOT call any
// virtual functions either; it should call them by their full name if
// that is necessary. The global OK() function will call this function
// as necessary.
//
// This function must NOT NEVER EVER be made virtual.
void ok() const;
protected:
//
// Class Name
//
// This must return a static (constant) string which is the name
// of the class being declared. By convention, not all classes
// must have one of these, but the major root abstract class must
// have one in order to allow the stringify() to work approximately
// correctly.
virtual const char *class_name() const = 0;
public:
//
// The ``id'' of this object
//
// NOTE - we explicitly allow the situation where this function
// can return the address of the object - the ``this'' pointer
// instead of a computed id field (the __object_id field below).
//
// This function is protected because we don't want too much dependence
// on this notion of object identity. I want to be able to rip it
// out if it becomes to cumbersome.
unsigned objectId() const;
private:
//
// Symbolic ID
//
// NOTE - Normally this would be implemented by the `this' pointer.
// TODO - remove this for production code
//
// However, in order to make the test suites run on all machines, we
// make this into a symbolic id that is maintained with each object.
// Thus the valid outputs are always consistent across all machines.
unsigned __object_id;
static unsigned __next_id;
};
//# 1 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h" 1
// This is part of the iostream library, providing -*- C++ -*- input/output.
// Copyright (C) 1991 Per Bothner.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//# 210 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/iostream.h"
//# 117 "../../../../../../mips/include/Gct/Object/GctObject.h" 2
extern ostream& operator<<(ostream&, GctObject&);
//# 25 "../../../../../../mips/include/Gct/Object/GctHashObject.h" 2
//
// GctHashObject class (is abstract)
//
class GctHashObject: virtual public GctObject {
protected:
GctHashObject();
GctHashObject(const GctHashObject&);
public:
//
// hash support
//
virtual unsigned hash() const;
};
//# 28 "../../GctSymbol.h" 2
//
// GctSymbol
//
class GctSymbol: virtual public GctHashObject, String {
public:
GctSymbol(); // vacuous symbol required for genclass usage
GctSymbol(const char*);
GctSymbol(const String&);
GctSymbol(const GctSymbol&);
operator const char *() const;
bool operator==(const GctSymbol&) const;
bool operator!=(const GctSymbol&) const;
bool operator<=(const GctSymbol&) const;
bool operator<(const GctSymbol&) const;
bool operator>=(const GctSymbol&) const;
bool operator>(const GctSymbol&) const;
unsigned hash() const;
// I/O Support
const char *stringify();
// Consistency
void OK() const;
private:
const char *class_name() const;
};
extern unsigned hash(GctSymbol&); // genclass support (no const)
//
// Inline functions
//
// Note - none of the String operators save for operator const char *()
// are String member functions, instead, they are anonymous functions
// which work by overloading.
//
GctSymbol::operator const char *() const
{
return String::operator const char *();
}
bool
GctSymbol::operator==(const GctSymbol& other) const
{
return (bool)::operator==(*this, other);
}
bool
GctSymbol::operator!=(const GctSymbol& other) const
{
return (bool)::operator!=(*this, other);
}
bool
GctSymbol::operator<=(const GctSymbol& other) const
{
return (bool)::operator<=(*this, other);
}
bool
GctSymbol::operator<(const GctSymbol& other) const
{
return (bool)::operator<(*this, other);
}
bool
GctSymbol::operator>=(const GctSymbol& other) const
{
return (bool)::operator>=(*this, other);
}
bool
GctSymbol::operator>(const GctSymbol& other) const
{
return (bool)::operator>(*this, other);
}
//# 25 "GctSymbol.defs.h" 2
// equality operator
// less-than-or-equal
// comparison : less-than -> 0
// hash function
extern unsigned int hash(GctSymbol&);
// initial capacity for structures requiring one
//# 27 "GctSymbol.GctSymbol.Map.h" 2
class GctSymbolGctSymbolMap
{
protected:
int count;
GctSymbol def;
public:
GctSymbolGctSymbolMap(GctSymbol& dflt);
virtual ~GctSymbolGctSymbolMap();
int length(); // current number of items
int empty();
virtual int contains(GctSymbol& key); // is key mapped?
virtual void clear(); // delete all items
virtual GctSymbol& operator [] (GctSymbol& key) = 0; // access contents by key
virtual void del(GctSymbol& key) = 0; // delete entry
virtual Pix first() = 0; // Pix of first item or 0
virtual void next(Pix& i) = 0; // advance to next or 0
virtual GctSymbol& key(Pix i) = 0; // access key at i
virtual GctSymbol& contents(Pix i) = 0; // access contents at i
virtual int owns(Pix i); // is i a valid Pix ?
virtual Pix seek(GctSymbol& key); // Pix of key
GctSymbol& dflt(); // access default val
void error(const char* msg);
virtual int OK() = 0; // rep invariant
};
inline GctSymbolGctSymbolMap::~GctSymbolGctSymbolMap() {}
inline int GctSymbolGctSymbolMap::length()
{
return count;
}
inline int GctSymbolGctSymbolMap::empty()
{
return count == 0;
}
inline GctSymbol& GctSymbolGctSymbolMap::dflt()
{
return def;
}
inline GctSymbolGctSymbolMap::GctSymbolGctSymbolMap(GctSymbol& dflt) :def(dflt)
{
count = 0;
}
//# 26 "GctSymbol.GctSymbol.CHMap.h" 2
struct GctSymbolGctSymbolCHNode
{
GctSymbolGctSymbolCHNode* tl;
GctSymbol hd;
GctSymbol cont;
GctSymbolGctSymbolCHNode();
GctSymbolGctSymbolCHNode(GctSymbol& h, GctSymbol& c, GctSymbolGctSymbolCHNode* t = 0);
~GctSymbolGctSymbolCHNode();
};
inline GctSymbolGctSymbolCHNode::GctSymbolGctSymbolCHNode() {}
inline GctSymbolGctSymbolCHNode::GctSymbolGctSymbolCHNode(GctSymbol& h, GctSymbol& c, GctSymbolGctSymbolCHNode* t)
: hd(h), cont(c), tl(t) {}
inline GctSymbolGctSymbolCHNode::~GctSymbolGctSymbolCHNode() {}
typedef GctSymbolGctSymbolCHNode* GctSymbolGctSymbolCHNodePtr;
class GctSymbolGctSymbolCHMap : public GctSymbolGctSymbolMap
{
protected:
GctSymbolGctSymbolCHNode** tab;
unsigned int size;
public:
GctSymbolGctSymbolCHMap(GctSymbol& dflt,unsigned int sz=100 );
GctSymbolGctSymbolCHMap(GctSymbolGctSymbolCHMap& a);
~GctSymbolGctSymbolCHMap();
GctSymbol& operator [] (GctSymbol& key);
void del(GctSymbol& key);
Pix first();
void next(Pix& i);
GctSymbol& key(Pix i);
GctSymbol& contents(Pix i);
Pix seek(GctSymbol& key);
int contains(GctSymbol& key);
void clear();
int OK();
};
inline GctSymbolGctSymbolCHMap::~GctSymbolGctSymbolCHMap()
{
clear();
delete tab;
}
inline int GctSymbolGctSymbolCHMap::contains(GctSymbol& key)
{
return seek(key) != 0;
}
inline GctSymbol& GctSymbolGctSymbolCHMap::key(Pix p)
{
if (p == 0) error("null Pix");
return ((GctSymbolGctSymbolCHNode*)p)->hd;
}
inline GctSymbol& GctSymbolGctSymbolCHMap::contents(Pix p)
{
if (p == 0) error("null Pix");
return ((GctSymbolGctSymbolCHNode*)p)->cont;
}
//# 22 "GctSymbol.GctSymbol.CHMap.cc" 2
// The nodes are linked together serially via a version
// of a trick used in some vtables: odd pointers are
// actually links to the next table entry.
// Not terrible, but not wonderful either
static inline int goodCHptr(GctSymbolGctSymbolCHNode* t)
{
return ((((unsigned)t) & 1) == 0);
}
static inline GctSymbolGctSymbolCHNode* index_to_CHptr(int i)
{
return (GctSymbolGctSymbolCHNode*)((i << 1) + 1);
}
static inline int CHptr_to_index(GctSymbolGctSymbolCHNode* t)
{
return ( ((unsigned) t) >> 1);
}
GctSymbolGctSymbolCHMap::GctSymbolGctSymbolCHMap(GctSymbol& dflt, unsigned int sz)
:GctSymbolGctSymbolMap(dflt)
{
tab = (GctSymbolGctSymbolCHNode**)(new GctSymbolGctSymbolCHNodePtr[size = sz]);
for (unsigned int i = 0; i < size; ++i) tab[i] = index_to_CHptr(i+1);
count = 0;
}
GctSymbolGctSymbolCHMap::GctSymbolGctSymbolCHMap(GctSymbolGctSymbolCHMap& a) :GctSymbolGctSymbolMap(a.def)
{
tab = (GctSymbolGctSymbolCHNode**)(new GctSymbolGctSymbolCHNodePtr[size = a.size]);
for (unsigned int i = 0; i < size; ++i) tab[i] = index_to_CHptr(i+1);
count = 0;
for (Pix p = a.first(); p; a.next(p)) (*this)[a.key(p)] = a.contents(p); // { dg-bogus "" } type `GctSymbol' is derived from private `String'
}
|