File: parser.c

package info (click to toggle)
sip 2.5-2.2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,340 kB
  • ctags: 1,472
  • sloc: ansic: 11,902; sh: 6,482; yacc: 1,987; cpp: 540; lex: 423; makefile: 104
file content (4286 lines) | stat: -rw-r--r-- 111,640 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286

/*  A Bison parser, made from parser.y
    by GNU Bison version 1.28  */

#define YYBISON 1  /* Identify Bison output.  */

#define	TK_DOC	257
#define	TK_EXPORTEDDOC	258
#define	TK_MAKEFILE	259
#define	TK_VARCODE	260
#define	TK_CPPCODE	261
#define	TK_PREPYCODE	262
#define	TK_PYCODE	263
#define	TK_COPYING	264
#define	TK_MAPPEDTYPE	265
#define	TK_CODEBLOCK	266
#define	TK_IF	267
#define	TK_END	268
#define	TK_NAME	269
#define	TK_PYMETHODNAME	270
#define	TK_FILENAME	271
#define	TK_STRING	272
#define	TK_VIRTUALCODE	273
#define	TK_MEMBERCODE	274
#define	TK_FROMTYPE	275
#define	TK_CANTOTYPE	276
#define	TK_TOTYPE	277
#define	TK_TOSUBCLASS	278
#define	TK_INCLUDE	279
#define	TK_IMPORT	280
#define	TK_IMPORTTL	281
#define	TK_VERSIONCODE	282
#define	TK_HEADERCODE	283
#define	TK_EXPHEADERCODE	284
#define	TK_MODULE	285
#define	TK_CLASS	286
#define	TK_STRUCT	287
#define	TK_PUBLIC	288
#define	TK_PROTECTED	289
#define	TK_PRIVATE	290
#define	TK_SIGNALS	291
#define	TK_SLOTS	292
#define	TK_PYMETHODS	293
#define	TK_PYNUMMETHODS	294
#define	TK_PYSEQMETHODS	295
#define	TK_PYMAPMETHODS	296
#define	TK_BOOL	297
#define	TK_SHORT	298
#define	TK_INT	299
#define	TK_LONG	300
#define	TK_FLOAT	301
#define	TK_DOUBLE	302
#define	TK_CHAR	303
#define	TK_VOID	304
#define	TK_VIRTUAL	305
#define	TK_ENUM	306
#define	TK_UNSIGNED	307
#define	TK_SCOPE	308
#define	TK_CONST	309
#define	TK_STATIC	310
#define	TK_SIPSIGNAL	311
#define	TK_SIPRXCON	312
#define	TK_SIPRXDIS	313
#define	TK_SIPSLOTCON	314
#define	TK_SIPSLOTDIS	315
#define	TK_SIPARRAY	316
#define	TK_SIPUARRAY	317
#define	TK_SIPARRAYSIZE	318
#define	TK_SIPARRAYUSIZE	319
#define	TK_NUMBER	320
#define	TK_REAL	321
#define	TK_TYPEDEF	322
#define	TK_NAMESPACE	323
#define	TK_TIMELINE	324
#define	TK_SECVERSION	325
#define	TK_EXPOSE	326
#define	TK_QCHAR	327

#line 8 "parser.y"

#include <stdlib.h>
#include <string.h>

#include "sip.h"


#define	MAX_NESTED_IF		10
#define	MAX_NESTED_SCOPE	10

#define	isMainModule(m)		(currentSpec -> module == (m))


/* The different attribute name types. */

typedef enum {
	func_attr,
	var_attr,
	enum_attr,
	class_attr
} attrType;


/* Table of Python methods that can go in the PyMethods section. */

static specialPyMethod pyMethods[] = {
	{"__repr__",		SPM_METH_REPR,0,	"PyObject *",	1},
	{"__str__",		SPM_METH_STR,0,		"PyObject *",	1},
	{"__cmp__",		SPM_METH_CMP,0,		"int",		2},
	{"__hash__",		SPM_METH_HASH,0,	"long",		1},
	{"__call__",		SPM_METH_CALL,0,	"PyObject *",	3},
	{"__richcompare__",	SPM_METH_RICH,0,	"PyObject *",	-1, 0x02010000},
	{NULL}
};


/* Table of Python methods that can go in the PyNumberMethods section. */

static specialPyMethod pyNumMethods[] = {
	{"__add__",		SPM_NUM_ADD,0,		"PyObject *",	2},
	{"__sub__",		SPM_NUM_SUB,0,		"PyObject *",	2},
	{"__mul__",		SPM_NUM_MUL,0,		"PyObject *",	2},
	{"__div__",		SPM_NUM_DIV,0,		"PyObject *",	2},
	{"__mod__",		SPM_NUM_MOD,0,		"PyObject *",	2},
	{"__divmod__",		SPM_NUM_DIVMOD,0,	"PyObject *",	2},
	{"__pow__",		SPM_NUM_POW,0,		"PyObject *",	3},
	{"__neg__",		SPM_NUM_NEG,0,		"PyObject *",	1},
	{"__pos__",		SPM_NUM_POS,0,		"PyObject *",	1},
	{"__abs__",		SPM_NUM_ABS,0,		"PyObject *",	1},
	{"__nonzero__",		SPM_NUM_NONZERO,0,	"int",		1},
	{"__invert__",		SPM_NUM_INVERT,0,	"PyObject *",	1},
	{"__lshift__",		SPM_NUM_LSHIFT,0,	"PyObject *",	2},
	{"__rshift__",		SPM_NUM_RSHIFT,0,	"PyObject *",	2},
	{"__and__",		SPM_NUM_AND,0,		"PyObject *",	2},
	{"__xor__",		SPM_NUM_XOR,0,		"PyObject *",	2},
	{"__or__",		SPM_NUM_OR,0,		"PyObject *",	2},
	{"__coerce__",		SPM_NUM_COERCE,0,	"int",		-1},
	{"__int__",		SPM_NUM_INT,0,		"PyObject *",	1},
	{"__long__",		SPM_NUM_LONG,0,		"PyObject *",	1},
	{"__float__",		SPM_NUM_FLOAT,0,	"PyObject *",	1},
	{"__oct__",		SPM_NUM_OCT,0,		"PyObject *",	1},
	{"__hex__",		SPM_NUM_HEX,0,		"PyObject *",	1},
	{"__iadd__",		SPM_NUM_IADD,0,		"PyObject *",	2, 0x02000000},
	{"__isub__",		SPM_NUM_ISUB,0,		"PyObject *",	2, 0x02000000},
	{"__imul__",		SPM_NUM_IMUL,0,		"PyObject *",	2, 0x02000000},
	{"__idiv__",		SPM_NUM_IDIV,0,		"PyObject *",	2, 0x02000000},
	{"__imod__",		SPM_NUM_IMOD,0,		"PyObject *",	2, 0x02000000},
	{"__ipow__",		SPM_NUM_IPOW,0,		"PyObject *",	3, 0x02000000},
	{"__ilshift__",		SPM_NUM_ILSHIFT,0,	"PyObject *",	2, 0x02000000},
	{"__irshift__",		SPM_NUM_IRSHIFT,0,	"PyObject *",	2, 0x02000000},
	{"__iand__",		SPM_NUM_IAND,0,		"PyObject *",	2, 0x02000000},
	{"__ixor__",		0,SPM_NUM_IXOR,		"PyObject *",	2, 0x02000000},
	{"__ior__",		0,SPM_NUM_IOR,		"PyObject *",	2, 0x02000000},
	{NULL}
};


/* Table of Python methods that can go in the PySequenceMethods section. */

static specialPyMethod pySeqMethods[] = {
	{"__len__",		SPM_SEQ_LEN,0,		"int",		1},
	{"__add__",		SPM_SEQ_CONCAT,0,	"PyObject *",	2},
	{"__mul__",		SPM_SEQ_REPEAT,0,	"PyObject *",	-1},
	{"__getitem__",		SPM_SEQ_GETITEM,0,	"PyObject *",	-1},
	{"__setitem__",		SPM_SEQ_SETITEM,0,	"int",		-1},
	{"__getslice__",	SPM_SEQ_GETSLICE,0,	"PyObject *",	-1},
	{"__setslice__",	SPM_SEQ_SETSLICE,0,	"int",		-1},
	{"__contains__",	SPM_SEQ_CONTAINS,0,	"int",		2, 0x01060000},
	{"__iadd__",		SPM_SEQ_ICONCAT,0,	"PyObject *",	2, 0x02000000},
	{"__imul__",		SPM_SEQ_IREPEAT,0,	"PyObject *",	-1, 0x02000000},
	{NULL}
};


/* Table of Python methods that can go in the PyMappingMethods section. */

static specialPyMethod pyMapMethods[] = {
	{"__len__",		SPM_MAP_LEN,0,		"int",		1},
	{"__getitem__",		SPM_MAP_GETITEM,0,	"PyObject *",	2},
	{"__setitem__",		SPM_MAP_SETITEM,0,	"int",		3},
	{NULL}
};


static sipSpec *currentSpec;		/* The current spec being parsed. */
static stringList *timeSlotList;	/* The list of required primaries. */
static moduleDef *currentModule;	/* The current module being parsed. */
static mappedTypeDef *currentMappedType;	/* The current mapped type. */
static int sectionFlags;		/* The current section flags. */
static int currentOverIsVirt;		/* Set if the overload is virtual. */
static int currentIsStatic;		/* Set if the current is static. */
static int importDepth;			/* The nr. of nested imports. */
static char *previousFile;		/* The file just parsed. */
static parserContext newContext;	/* The new pending context. */
static int currentVersion;		/* The index of the version. */
static versionRange versScope[MAX_NESTED_IF];	/* Current version nest. */
static classVersDef *scopeStack[MAX_NESTED_SCOPE];	/* The scope stack. */
static int sectFlagsStack[MAX_NESTED_SCOPE];	/* The section flags stack. */
static int currentScopeIdx;		/* The scope stack index. */


static nameDef *cacheName(sipSpec *,moduleDef *,char *);
static versionDef *getVersion(void);
static void checkIfaceFile(sipSpec *,ifaceFileDef *,versionDef *,argDef *);
static ifaceFileDef *findIfaceFile(sipSpec *,scopedNameDef *);
static classDef *findClass(sipSpec *,scopedNameDef *);
static classVersDef *newClass(sipSpec *,versionDef *,scopedNameDef *);
static classVersDef *findNamespace(sipSpec *,versionDef *,scopedNameDef *);
static void finishClass(classVersDef *);
static mappedTypeDef *newMappedType(sipSpec *,argDef *,versionDef *);
static void newEnum(sipSpec *,versionDef *,moduleDef *,char *,int,enumValueDef *);
static void newTypedef(sipSpec *,versionDef *,char *,argDef *);
static void newVar(sipSpec *,versionDef *,moduleDef *,char *,int,argDef *,codeBlock *);
static void newSpecialMethod(versionDef *,char *,int,codeBlock *);
static void newCtor(versionDef *,char *,int,funcArgs *,codeBlock *);
static void newFunction(sipSpec *,versionDef *,moduleDef *,int,int,int,
			argDef *,char *,funcArgs *,int,int,optFlags *,
			codeBlock *,codeBlock *);
static optFlag *findOptFlag(optFlags *,char *,flagType);
static memberDef *findFunction(sipSpec *,versionDef *,moduleDef *,classVersDef *,char *);
static void checkAttributes(sipSpec *,classVersDef *,nameDef *,versionDef *,attrType);
static void newModule(FILE *,char *,int);
static void appendCodeBlock(codeBlock **,codeBlock *);
static void appendToClassList(classList **,classDef *);
static void parseFile(FILE *,char *,moduleDef *,int);
static void handleEOF(void);
static void handleEOM(void);
static versionQual *findQualifier(versionQual *,char *);
static scopedNameDef *text2scopedName(char *);
static void pushScope(classVersDef *);
static void popScope(void);
static classVersDef *currentScope(void);
static versionQual *newVersion(sipSpec *,moduleDef *,int,char *,char *,char *);
static void newImport(sipSpec *,char *,int);

#line 164 "parser.y"
typedef union {
	char		qchar;
	char		*text;
	long		number;
	double		real;
	argDef		memArg;
	funcArgs	arglist;
	codeBlock	*codeb;
	valueDef	value;
	valueDef	*valp;
	optFlags	optflags;
	optFlag		flag;
	scopedNameDef	*scpvalp;
	enumValueDef	*evalp;
	fcallDef	fcall;
	versionRange	versrange;
} YYSTYPE;
#include <stdio.h>

#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif



#define	YYFINAL		329
#define	YYFLAG		-32768
#define	YYNTBASE	92

#define YYTRANSLATE(x) ((unsigned)(x) <= 327 ? yytranslate[x] : 179)

static const char yytranslate[] = {     0,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,    84,     2,     2,     2,     2,    88,     2,    77,
    78,    89,    82,    80,    79,     2,    87,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,    86,    76,    90,
    81,    91,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,    74,    83,    75,    85,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     1,     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
};

#if YYDEBUG != 0
static const short yyprhs[] = {     0,
     0,     2,     5,     6,     9,    11,    13,    15,    17,    19,
    21,    23,    25,    27,    29,    31,    33,    35,    37,    39,
    41,    43,    45,    47,    49,    51,    53,    55,    57,    59,
    61,    63,    65,    66,    74,    76,    79,    81,    84,    87,
    90,    91,    99,   101,   104,   109,   110,   116,   118,   121,
   123,   128,   130,   134,   136,   139,   142,   145,   148,   151,
   152,   155,   158,   161,   164,   167,   170,   173,   176,   179,
   182,   187,   190,   197,   198,   200,   201,   203,   205,   209,
   212,   213,   216,   218,   222,   224,   226,   228,   229,   231,
   233,   235,   237,   240,   242,   246,   248,   250,   255,   257,
   259,   261,   263,   264,   266,   270,   275,   279,   280,   289,
   290,   293,   295,   299,   301,   303,   306,   308,   310,   312,
   314,   316,   318,   320,   322,   324,   326,   328,   330,   333,
   336,   339,   342,   346,   350,   354,   357,   360,   363,   366,
   369,   370,   372,   379,   386,   398,   399,   401,   402,   405,
   406,   410,   412,   416,   418,   422,   424,   426,   427,   430,
   431,   434,   436,   437,   439,   443,   445,   447,   449,   454,
   459,   461,   463,   465,   467,   470,   471,   475,   477,   479,
   481,   482,   486,   488,   493,   498,   502,   505,   506,   508,
   509,   512,   514,   519,   522,   525,   527,   529,   531,   533,
   536,   538,   540,   542,   545,   547,   549,   551
};

static const short yyrhs[] = {    93,
     0,    92,    93,     0,     0,    94,    95,     0,   113,     0,
   119,     0,   114,     0,   115,     0,   116,     0,   105,     0,
   104,     0,   112,     0,   118,     0,   120,     0,   121,     0,
   122,     0,   123,     0,   124,     0,   125,     0,   126,     0,
   127,     0,    97,     0,    96,     0,   109,     0,   111,     0,
   101,     0,   145,     0,   144,     0,   143,     0,   129,     0,
   155,     0,   172,     0,     0,    11,   177,    98,    74,    99,
    75,    76,     0,   100,     0,    99,   100,     0,   120,     0,
    21,   128,     0,    22,   128,     0,    23,   128,     0,     0,
    69,    15,   102,    74,   103,    75,    76,     0,    96,     0,
   103,    96,     0,    71,    15,    18,    18,     0,     0,    70,
   106,    74,   107,    75,     0,   108,     0,   107,   108,     0,
    15,     0,    13,    77,   110,    78,     0,    15,     0,   130,
    79,   130,     0,    14,     0,    72,    15,     0,    31,    15,
     0,    25,    17,     0,    26,    17,     0,    27,    17,     0,
     0,     6,   128,     0,    28,   128,     0,    10,   128,     0,
    29,   128,     0,    30,   128,     0,     7,   128,     0,     8,
   128,     0,     9,   128,     0,     3,   128,     0,     4,   128,
     0,     5,    17,    17,   128,     0,    12,    14,     0,    52,
   130,    74,   131,    75,    76,     0,     0,    15,     0,     0,
   132,     0,   133,     0,   132,    80,   133,     0,    15,   134,
     0,     0,    81,   135,     0,   138,     0,   135,   136,   138,
     0,    79,     0,    82,     0,    83,     0,     0,    84,     0,
    85,     0,    79,     0,    82,     0,   137,   141,     0,   140,
     0,   139,    54,   140,     0,    15,     0,   139,     0,   139,
    77,   142,    78,     0,    67,     0,    66,     0,    18,     0,
    73,     0,     0,   138,     0,   142,    80,   138,     0,    68,
   173,    15,    76,     0,    32,   139,    76,     0,     0,    32,
    15,   146,   147,    74,   150,    75,    76,     0,     0,    86,
   148,     0,   149,     0,   148,    80,   149,     0,   139,     0,
   151,     0,   150,   151,     0,   109,     0,   111,     0,   101,
     0,   145,     0,   144,     0,   143,     0,   129,     0,   122,
     0,   120,     0,   154,     0,   153,     0,   167,     0,    24,
   128,     0,    22,   128,     0,    23,   128,     0,    16,   162,
     0,    34,   152,    86,     0,    35,   152,    86,     0,    36,
   152,    86,     0,    37,    86,     0,    39,    86,     0,    40,
    86,     0,    41,    86,     0,    42,    86,     0,     0,    38,
     0,    85,    15,    77,    78,    76,   162,     0,    15,    77,
   164,    78,    76,   162,     0,   173,    15,    77,   164,    78,
   156,   157,   158,    76,   162,   163,     0,     0,    55,     0,
     0,    81,    66,     0,     0,    87,   159,    87,     0,   160,
     0,   159,    80,   160,     0,    15,     0,    15,    81,   161,
     0,    15,     0,    18,     0,     0,    20,   128,     0,     0,
    19,   128,     0,   165,     0,     0,   166,     0,   165,    80,
   166,     0,    57,     0,    58,     0,    59,     0,    60,    77,
   164,    78,     0,    61,    77,   164,    78,     0,    62,     0,
    63,     0,    64,     0,    65,     0,   174,   134,     0,     0,
    56,   168,   169,     0,   169,     0,   170,     0,   172,     0,
     0,    51,   171,   155,     0,   155,     0,   173,    15,    76,
   117,     0,    55,   177,   176,   175,     0,   177,   176,   175,
     0,   173,   158,     0,     0,    88,     0,     0,   176,    89,
     0,   139,     0,   139,    90,   178,    91,     0,    33,   139,
     0,    53,    44,     0,    44,     0,    53,     0,    45,     0,
    46,     0,    53,    46,     0,    47,     0,    48,     0,    43,
     0,    53,    49,     0,    49,     0,    50,     0,   177,     0,
   178,    80,   177,     0
};

#endif

#if YYDEBUG != 0
static const short yyrline[] = { 0,
   293,   294,   297,   314,   316,   317,   318,   319,   320,   321,
   322,   323,   324,   325,   329,   330,   334,   335,   336,   337,
   338,   339,   340,   343,   344,   345,   346,   347,   348,   349,
   350,   351,   354,   359,   376,   377,   380,   384,   393,   402,
   413,   435,   443,   444,   447,   452,   458,   478,   479,   482,
   501,   509,   537,   574,   580,   603,   616,   621,   626,   634,
   637,   642,   647,   653,   658,   663,   668,   674,   680,   686,
   691,   710,   713,   726,   729,   734,   737,   742,   743,   761,
   775,   778,   783,   784,   802,   805,   808,   813,   816,   819,
   822,   825,   830,   848,   849,   854,   859,   869,   879,   883,
   887,   891,   897,   902,   908,   926,   934,   950,   966,   975,
   976,   979,   980,   983,   997,   998,  1001,  1002,  1003,  1004,
  1005,  1006,  1007,  1008,  1012,  1016,  1017,  1018,  1019,  1030,
  1041,  1052,  1063,  1067,  1071,  1075,  1079,  1083,  1087,  1091,
  1097,  1100,  1105,  1125,  1140,  1160,  1163,  1168,  1171,  1179,
  1182,  1188,  1192,  1204,  1208,  1214,  1218,  1224,  1227,  1232,
  1235,  1240,  1298,  1303,  1309,  1341,  1348,  1355,  1362,  1372,
  1382,  1387,  1392,  1397,  1402,  1408,  1409,  1409,  1412,  1413,
  1416,  1417,  1417,  1420,  1443,  1448,  1455,  1477,  1480,  1485,
  1488,  1493,  1497,  1507,  1511,  1514,  1517,  1520,  1523,  1526,
  1529,  1532,  1535,  1538,  1541,  1544,  1549,  1555
};
#endif


#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)

static const char * const yytname[] = {   "$","error","$undefined.","TK_DOC",
"TK_EXPORTEDDOC","TK_MAKEFILE","TK_VARCODE","TK_CPPCODE","TK_PREPYCODE","TK_PYCODE",
"TK_COPYING","TK_MAPPEDTYPE","TK_CODEBLOCK","TK_IF","TK_END","TK_NAME","TK_PYMETHODNAME",
"TK_FILENAME","TK_STRING","TK_VIRTUALCODE","TK_MEMBERCODE","TK_FROMTYPE","TK_CANTOTYPE",
"TK_TOTYPE","TK_TOSUBCLASS","TK_INCLUDE","TK_IMPORT","TK_IMPORTTL","TK_VERSIONCODE",
"TK_HEADERCODE","TK_EXPHEADERCODE","TK_MODULE","TK_CLASS","TK_STRUCT","TK_PUBLIC",
"TK_PROTECTED","TK_PRIVATE","TK_SIGNALS","TK_SLOTS","TK_PYMETHODS","TK_PYNUMMETHODS",
"TK_PYSEQMETHODS","TK_PYMAPMETHODS","TK_BOOL","TK_SHORT","TK_INT","TK_LONG",
"TK_FLOAT","TK_DOUBLE","TK_CHAR","TK_VOID","TK_VIRTUAL","TK_ENUM","TK_UNSIGNED",
"TK_SCOPE","TK_CONST","TK_STATIC","TK_SIPSIGNAL","TK_SIPRXCON","TK_SIPRXDIS",
"TK_SIPSLOTCON","TK_SIPSLOTDIS","TK_SIPARRAY","TK_SIPUARRAY","TK_SIPARRAYSIZE",
"TK_SIPARRAYUSIZE","TK_NUMBER","TK_REAL","TK_TYPEDEF","TK_NAMESPACE","TK_TIMELINE",
"TK_SECVERSION","TK_EXPOSE","TK_QCHAR","'{'","'}'","';'","'('","')'","'-'","','",
"'='","'+'","'|'","'!'","'~'","':'","'/'","'&'","'*'","'<'","'>'","specification",
"statement","@1","modstatement","nsstatement","mappedtype","@2","mtbody","mtline",
"namespace","@3","nsbody","secversion","timeline","@4","versionlist","versionname",
"ifstart","versionrange","ifend","expose","module","include","import","importtl",
"optvarcode","versioncode","copying","hdrcode","exphdrcode","cppcode","prepycode",
"pycode","doc","exporteddoc","makefile","codeblock","enum","optname","optenumvalues",
"enumvalues","enumvalue","optassign","expr","binop","optunop","value","scopedname",
"scopepart","simplevalue","valuelist","typedef","opaqueclass","class","@5","superclasses",
"superlist","superclass","classbody","classline","optslot","dtor","ctor","function",
"optconst","optabstract","optflags","flaglist","flag","flagvalue","membercode",
"optvirtualcode","arglist","rawarglist","argvalue","varmember","@6","varmem",
"member","@7","variable","cpptype","argtype","optref","deref","basetype","basetypelist", NULL
};
#endif

static const short yyr1[] = {     0,
    92,    92,    94,    93,    95,    95,    95,    95,    95,    95,
    95,    95,    95,    95,    95,    95,    95,    95,    95,    95,
    95,    95,    95,    96,    96,    96,    96,    96,    96,    96,
    96,    96,    98,    97,    99,    99,   100,   100,   100,   100,
   102,   101,   103,   103,   104,   106,   105,   107,   107,   108,
   109,   110,   110,   111,   112,   113,   114,   115,   116,   117,
   117,   118,   119,   120,   121,   122,   123,   124,   125,   126,
   127,   128,   129,   130,   130,   131,   131,   132,   132,   133,
   134,   134,   135,   135,   136,   136,   136,   137,   137,   137,
   137,   137,   138,   139,   139,   140,   141,   141,   141,   141,
   141,   141,   142,   142,   142,   143,   144,   146,   145,   147,
   147,   148,   148,   149,   150,   150,   151,   151,   151,   151,
   151,   151,   151,   151,   151,   151,   151,   151,   151,   151,
   151,   151,   151,   151,   151,   151,   151,   151,   151,   151,
   152,   152,   153,   154,   155,   156,   156,   157,   157,   158,
   158,   159,   159,   160,   160,   161,   161,   162,   162,   163,
   163,   164,   165,   165,   165,   166,   166,   166,   166,   166,
   166,   166,   166,   166,   166,   168,   167,   167,   169,   169,
   171,   170,   170,   172,   173,   173,   174,   175,   175,   176,
   176,   177,   177,   177,   177,   177,   177,   177,   177,   177,
   177,   177,   177,   177,   177,   177,   178,   178
};

static const short yyr2[] = {     0,
     1,     2,     0,     2,     1,     1,     1,     1,     1,     1,
     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
     1,     1,     0,     7,     1,     2,     1,     2,     2,     2,
     0,     7,     1,     2,     4,     0,     5,     1,     2,     1,
     4,     1,     3,     1,     2,     2,     2,     2,     2,     0,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     4,     2,     6,     0,     1,     0,     1,     1,     3,     2,
     0,     2,     1,     3,     1,     1,     1,     0,     1,     1,
     1,     1,     2,     1,     3,     1,     1,     4,     1,     1,
     1,     1,     0,     1,     3,     4,     3,     0,     8,     0,
     2,     1,     3,     1,     1,     2,     1,     1,     1,     1,
     1,     1,     1,     1,     1,     1,     1,     1,     2,     2,
     2,     2,     3,     3,     3,     2,     2,     2,     2,     2,
     0,     1,     6,     6,    11,     0,     1,     0,     2,     0,
     3,     1,     3,     1,     3,     1,     1,     0,     2,     0,
     2,     1,     0,     1,     3,     1,     1,     1,     4,     4,
     1,     1,     1,     1,     2,     0,     3,     1,     1,     1,
     0,     3,     1,     4,     4,     3,     2,     0,     1,     0,
     2,     1,     4,     2,     2,     1,     1,     1,     1,     2,
     1,     1,     1,     2,     1,     1,     1,     3
};

static const short yydefact[] = {     3,
     3,     1,     0,     2,     0,     0,     0,     0,     0,     0,
     0,     0,     0,    54,    96,     0,     0,     0,     0,     0,
     0,     0,     0,     0,   203,   196,   198,   199,   201,   202,
   205,   206,    74,   197,     0,     0,     0,    46,     0,     0,
     4,    23,    22,    26,    11,    10,    24,    25,    12,     5,
     7,     8,     9,    13,     6,    14,    15,    16,    17,    18,
    19,    20,    21,    30,   192,    94,    29,    28,    27,    31,
    32,     0,   190,     0,    69,    70,     0,    66,    67,    68,
    63,    33,    74,    57,    58,    59,    62,    64,    65,    56,
    96,     0,   194,    75,     0,   195,   200,   204,   190,     0,
    41,     0,     0,    55,     0,     0,     0,   188,    72,     0,
     0,    52,     0,     0,   110,   107,    76,   188,     0,     0,
     0,     0,    95,   207,     0,    60,   163,   189,   191,   186,
    71,     0,    51,    74,     0,     0,    81,     0,    77,    78,
   185,   106,     0,    50,     0,    48,    45,     0,   193,     0,
   184,   166,   167,   168,     0,     0,   171,   172,   173,   174,
     0,   162,   164,   150,    81,     0,     0,     0,     0,    35,
    37,    53,   114,   111,   112,     0,    88,    80,     0,     0,
    43,     0,    47,    49,   208,    61,   163,   163,   146,     0,
     0,   187,   175,    38,    39,    40,     0,    36,     0,    96,
   158,     0,     0,     0,   141,   141,   141,     0,     0,     0,
     0,     0,   181,   176,     0,   119,   117,   118,   125,   124,
   123,   122,   121,   120,     0,   115,   127,   126,   183,   128,
   178,   179,   180,    91,    92,    89,    90,    82,     0,    83,
    73,    79,     0,    44,     0,     0,   147,   148,   165,   154,
     0,   152,    34,   113,   163,     0,   132,   130,   131,   129,
   142,     0,     0,     0,   136,   137,   138,   139,   140,     0,
     0,     0,     0,   116,    85,    86,    87,    88,   101,   100,
    99,   102,    97,    93,    42,   169,   170,     0,   150,     0,
     0,   151,     0,   159,   133,   134,   135,   182,     0,   177,
     0,   109,    84,    88,   149,     0,   156,   157,   155,   153,
     0,     0,     0,   104,     0,   158,   158,   158,    98,    88,
   160,   144,   143,   105,     0,   145,   161,     0,     0
};

static const short yydefgoto[] = {     1,
     2,     3,    41,    42,    43,   111,   169,   170,    44,   120,
   182,    45,    46,   102,   145,   146,    47,   113,    48,    49,
    50,    51,    52,    53,   151,    54,    55,   171,    57,   220,
    59,    60,    61,    62,    63,    75,    64,    95,   138,   139,
   140,   178,   238,   278,   239,   240,    65,    66,   284,   315,
    67,    68,    69,   115,   136,   174,   175,   225,   226,   262,
   227,   228,    70,   248,   289,   192,   251,   252,   309,   257,
   326,   161,   162,   163,   230,   271,   231,   232,   270,    71,
    72,   165,   130,   108,    73,   125
};

static const short yypact[] = {-32768,
    23,-32768,   296,-32768,    32,    32,    18,    32,    32,    32,
    32,   416,   -19,-32768,-32768,    47,   131,   134,    32,    32,
    32,   139,   142,   151,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,   152,   138,   416,   397,   162,-32768,   170,   171,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,   -38,-32768,-32768,-32768,-32768,-32768,
-32768,   173,-32768,   175,-32768,-32768,   176,-32768,-32768,-32768,
-32768,-32768,   177,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
   -57,   -33,   140,-32768,   121,-32768,-32768,-32768,-32768,   184,
-32768,   126,   191,-32768,   151,   416,   -23,    22,-32768,    32,
   141,   133,   136,   137,   132,-32768,   202,    22,   143,   147,
   207,   206,-32768,-32768,   -55,   219,   337,-32768,-32768,-32768,
-32768,     5,-32768,   152,   151,   155,   150,   157,   153,-32768,
-32768,-32768,   158,-32768,    15,-32768,-32768,   416,-32768,    32,
-32768,-32768,-32768,-32768,   163,   164,-32768,-32768,-32768,-32768,
   156,   168,-32768,   166,   150,    32,    32,    32,    16,-32768,
-32768,-32768,   140,   169,-32768,   223,    53,-32768,   167,   202,
-32768,    81,-32768,-32768,-32768,-32768,   337,   337,   187,   337,
   229,-32768,-32768,-32768,-32768,-32768,   178,-32768,   151,   174,
   241,    32,    32,    32,   239,   239,   239,   194,   195,   196,
   197,   198,-32768,-32768,   270,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,    33,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,    86,    97,-32768,
-32768,-32768,   210,-32768,   209,   211,-32768,   212,-32768,   213,
    36,-32768,-32768,-32768,   337,    32,-32768,-32768,-32768,-32768,
-32768,   204,   216,   226,-32768,-32768,-32768,-32768,-32768,   397,
   360,   218,   220,-32768,-32768,-32768,-32768,    53,-32768,-32768,
-32768,-32768,   -36,-32768,-32768,-32768,-32768,   222,   166,   124,
   229,-32768,   235,-32768,-32768,-32768,-32768,-32768,   282,-32768,
   236,-32768,-32768,    96,-32768,   240,-32768,-32768,-32768,-32768,
   242,   221,   244,-32768,   -47,   241,   241,   241,-32768,    53,
   298,-32768,-32768,-32768,    32,-32768,-32768,   315,-32768
};

static const short yypgoto[] = {-32768,
   329,-32768,-32768,  -119,-32768,-32768,-32768,   165,  -166,-32768,
-32768,-32768,-32768,-32768,-32768,   186,  -154,-32768,  -126,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,     3,-32768,   330,
-32768,-32768,-32768,-32768,-32768,    -6,  -125,   -41,-32768,-32768,
   179,   172,-32768,-32768,-32768,  -161,   -16,   227,-32768,-32768,
   -79,   -78,   -67,-32768,-32768,-32768,   148,-32768,   110,   -66,
-32768,-32768,  -165,-32768,-32768,    49,-32768,    45,-32768,  -196,
-32768,  -168,-32768,   160,-32768,-32768,    82,-32768,-32768,  -164,
   -35,-32768,   237,   255,    -3,-32768
};


#define	YYLAST		469


static const short yytable[] = {    76,
   100,    78,    79,    80,    81,    56,    92,    93,    82,   216,
   229,   233,    87,    88,    89,   105,  -108,   105,   245,   246,
   105,   217,   328,   181,   148,   166,   167,   168,  -108,   144,
   319,    99,   320,    20,    77,   149,   166,   167,   168,     8,
   304,   114,   116,    74,    20,    13,    14,   200,   201,   218,
   221,   106,   126,   127,   202,   203,   204,    83,   216,   229,
   233,    20,   244,    84,    23,    24,   205,   206,   207,   208,
   217,   209,   210,   211,   212,    25,    26,    27,    28,    29,
    30,    31,    32,   213,    33,    34,   293,    35,   214,   183,
   197,   164,   172,    13,    14,    15,   222,   223,   218,   221,
    36,    37,   124,   131,   298,   229,   233,   273,   224,   128,
   129,    15,    23,    24,   279,   291,   303,   215,   173,   321,
   322,   323,   292,    25,    26,    27,    28,    29,    30,    31,
    32,   234,    33,    34,   235,    35,   236,   237,   307,   263,
   264,   308,   314,   186,   185,   222,   223,    85,    36,    37,
    86,   164,   164,    90,   164,   243,    91,   224,   324,   194,
   195,   196,   280,   281,   275,    15,    94,   276,   277,   282,
    13,    14,    15,  -103,   234,  -103,   101,   235,   219,   236,
   237,    96,   173,    97,   103,   104,    98,   107,   109,    23,
    24,   112,   110,   105,   117,   258,   259,   260,   119,   121,
    25,    26,    27,    28,    29,    30,    31,    32,   122,    33,
    34,   -75,    35,   133,   132,   134,   137,   135,   142,   164,
   143,   144,   283,   147,   150,    36,    37,   219,   176,     8,
   177,   179,   180,   189,   299,    13,    14,   200,   201,   187,
   188,   247,   241,   250,   202,   203,   204,   190,   199,   294,
   255,    20,   191,   253,    23,    24,   205,   206,   207,   208,
   256,   209,   210,   211,   212,    25,    26,    27,    28,    29,
    30,    31,    32,   213,    33,    34,   261,    35,   214,   265,
   266,   267,   268,   269,   272,   285,   286,   305,   287,   295,
    36,    37,   288,   290,   301,   302,   312,   127,     5,     6,
     7,   296,     8,     9,    10,    11,    12,   215,    13,    14,
    15,   297,   311,   313,   329,   316,   325,   317,   327,   318,
    16,    17,    18,    19,    20,    21,    22,    23,    24,     4,
   184,   123,    58,   198,   274,   310,   193,   306,    25,    26,
    27,    28,    29,    30,    31,    32,   254,    33,    34,   249,
    35,    15,   300,   118,   141,     0,     0,     0,   242,     0,
     0,     0,     0,    36,    37,    38,    39,    40,     0,    24,
     0,     0,     0,     0,    15,     0,     0,     0,     0,    25,
    26,    27,    28,    29,    30,    31,    32,     0,     0,    34,
     0,    35,    24,   152,   153,   154,   155,   156,   157,   158,
   159,   160,    25,    26,    27,    28,    29,    30,    31,    32,
   213,    15,    34,     0,    35,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,    24,
    15,     0,     0,     0,     0,     0,     0,     0,     0,    25,
    26,    27,    28,    29,    30,    31,    32,     0,    24,    34,
     0,    35,     0,     0,     0,     0,     0,     0,    25,    26,
    27,    28,    29,    30,    31,    32,     0,     0,    34
};

static const short yycheck[] = {     6,
    36,     8,     9,    10,    11,     3,    23,    24,    12,   176,
   176,   176,    19,    20,    21,    54,    74,    54,   187,   188,
    54,   176,     0,   143,    80,    21,    22,    23,    86,    15,
    78,    35,    80,    29,    17,    91,    21,    22,    23,     7,
    77,    83,    76,    12,    29,    13,    14,    15,    16,   176,
   176,    90,    76,    77,    22,    23,    24,    77,   225,   225,
   225,    29,   182,    17,    32,    33,    34,    35,    36,    37,
   225,    39,    40,    41,    42,    43,    44,    45,    46,    47,
    48,    49,    50,    51,    52,    53,   255,    55,    56,    75,
    75,   127,   134,    13,    14,    15,   176,   176,   225,   225,
    68,    69,   106,   110,   270,   271,   271,    75,   176,    88,
    89,    15,    32,    33,    18,    80,   278,    85,   135,   316,
   317,   318,    87,    43,    44,    45,    46,    47,    48,    49,
    50,    79,    52,    53,    82,    55,    84,    85,    15,   206,
   207,    18,   304,   150,   148,   225,   225,    17,    68,    69,
    17,   187,   188,    15,   190,    75,    15,   225,   320,   166,
   167,   168,    66,    67,    79,    15,    15,    82,    83,    73,
    13,    14,    15,    78,    79,    80,    15,    82,   176,    84,
    85,    44,   199,    46,    15,    15,    49,    15,    14,    32,
    33,    15,    17,    54,    74,   202,   203,   204,    15,    74,
    43,    44,    45,    46,    47,    48,    49,    50,    18,    52,
    53,    79,    55,    78,    74,    79,    15,    86,    76,   255,
    74,    15,   239,    18,     6,    68,    69,   225,    74,     7,
    81,    75,    80,    78,   270,    13,    14,    15,    16,    77,
    77,    55,    76,    15,    22,    23,    24,    80,    80,   256,
    77,    29,    87,    76,    32,    33,    34,    35,    36,    37,
    20,    39,    40,    41,    42,    43,    44,    45,    46,    47,
    48,    49,    50,    51,    52,    53,    38,    55,    56,    86,
    86,    86,    86,    86,    15,    76,    78,    66,    78,    86,
    68,    69,    81,    81,    77,    76,    15,    77,     3,     4,
     5,    86,     7,     8,     9,    10,    11,    85,    13,    14,
    15,    86,    78,    78,     0,    76,    19,    76,   325,    76,
    25,    26,    27,    28,    29,    30,    31,    32,    33,     1,
   145,   105,     3,   169,   225,   291,   165,   289,    43,    44,
    45,    46,    47,    48,    49,    50,   199,    52,    53,   190,
    55,    15,   271,    99,   118,    -1,    -1,    -1,   180,    -1,
    -1,    -1,    -1,    68,    69,    70,    71,    72,    -1,    33,
    -1,    -1,    -1,    -1,    15,    -1,    -1,    -1,    -1,    43,
    44,    45,    46,    47,    48,    49,    50,    -1,    -1,    53,
    -1,    55,    33,    57,    58,    59,    60,    61,    62,    63,
    64,    65,    43,    44,    45,    46,    47,    48,    49,    50,
    51,    15,    53,    -1,    55,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    33,
    15,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    43,
    44,    45,    46,    47,    48,    49,    50,    -1,    33,    53,
    -1,    55,    -1,    -1,    -1,    -1,    -1,    -1,    43,    44,
    45,    46,    47,    48,    49,    50,    -1,    -1,    53
};
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
#line 3 "/usr/share/bison.simple"
/* This file comes from bison-1.28.  */

/* Skeleton output parser for bison,
   Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.  */

/* As a special exception, when this file is copied by Bison into a
   Bison output file, you may use that output file without restriction.
   This special exception was added by the Free Software Foundation
   in version 1.24 of Bison.  */

/* This is the parser code that is written into each bison parser
  when the %semantic_parser declaration is not specified in the grammar.
  It was written by Richard Stallman by simplifying the hairy parser
  used when %semantic_parser is specified.  */

#ifndef YYSTACK_USE_ALLOCA
#ifdef alloca
#define YYSTACK_USE_ALLOCA
#else /* alloca not defined */
#ifdef __GNUC__
#define YYSTACK_USE_ALLOCA
#define alloca __builtin_alloca
#else /* not GNU C.  */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
#define YYSTACK_USE_ALLOCA
#include <alloca.h>
#else /* not sparc */
/* We think this test detects Watcom and Microsoft C.  */
/* This used to test MSDOS, but that is a bad idea
   since that symbol is in the user namespace.  */
#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
#if 0 /* No need for malloc.h, which pollutes the namespace;
	 instead, just don't use alloca.  */
#include <malloc.h>
#endif
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
/* I don't know what this was needed for, but it pollutes the namespace.
   So I turned it off.   rms, 2 May 1997.  */
/* #include <malloc.h>  */
 #pragma alloca
#define YYSTACK_USE_ALLOCA
#else /* not MSDOS, or __TURBOC__, or _AIX */
#if 0
#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
		 and on HPUX 10.  Eventually we can turn this on.  */
#define YYSTACK_USE_ALLOCA
#define alloca __builtin_alloca
#endif /* __hpux */
#endif
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc */
#endif /* not GNU C */
#endif /* alloca not defined */
#endif /* YYSTACK_USE_ALLOCA not defined */

#ifdef YYSTACK_USE_ALLOCA
#define YYSTACK_ALLOC alloca
#else
#define YYSTACK_ALLOC malloc
#endif

/* Note: there must be only one dollar sign in this file.
   It is replaced by the list of actions, each action
   as one case of the switch.  */

#define yyerrok		(yyerrstatus = 0)
#define yyclearin	(yychar = YYEMPTY)
#define YYEMPTY		-2
#define YYEOF		0
#define YYACCEPT	goto yyacceptlab
#define YYABORT 	goto yyabortlab
#define YYERROR		goto yyerrlab1
/* Like YYERROR except do call yyerror.
   This remains here temporarily to ease the
   transition to the new meaning of YYERROR, for GCC.
   Once GCC version 2 has supplanted version 1, this can go.  */
#define YYFAIL		goto yyerrlab
#define YYRECOVERING()  (!!yyerrstatus)
#define YYBACKUP(token, value) \
do								\
  if (yychar == YYEMPTY && yylen == 1)				\
    { yychar = (token), yylval = (value);			\
      yychar1 = YYTRANSLATE (yychar);				\
      YYPOPSTACK;						\
      goto yybackup;						\
    }								\
  else								\
    { yyerror ("syntax error: cannot back up"); YYERROR; }	\
while (0)

#define YYTERROR	1
#define YYERRCODE	256

#ifndef YYPURE
#define YYLEX		yylex()
#endif

#ifdef YYPURE
#ifdef YYLSP_NEEDED
#ifdef YYLEX_PARAM
#define YYLEX		yylex(&yylval, &yylloc, YYLEX_PARAM)
#else
#define YYLEX		yylex(&yylval, &yylloc)
#endif
#else /* not YYLSP_NEEDED */
#ifdef YYLEX_PARAM
#define YYLEX		yylex(&yylval, YYLEX_PARAM)
#else
#define YYLEX		yylex(&yylval)
#endif
#endif /* not YYLSP_NEEDED */
#endif

/* If nonreentrant, generate the variables here */

#ifndef YYPURE

int	yychar;			/*  the lookahead symbol		*/
YYSTYPE	yylval;			/*  the semantic value of the		*/
				/*  lookahead symbol			*/

#ifdef YYLSP_NEEDED
YYLTYPE yylloc;			/*  location data for the lookahead	*/
				/*  symbol				*/
#endif

int yynerrs;			/*  number of parse errors so far       */
#endif  /* not YYPURE */

#if YYDEBUG != 0
int yydebug;			/*  nonzero means print parse trace	*/
/* Since this is uninitialized, it does not stop multiple parsers
   from coexisting.  */
#endif

/*  YYINITDEPTH indicates the initial size of the parser's stacks	*/

#ifndef	YYINITDEPTH
#define YYINITDEPTH 200
#endif

/*  YYMAXDEPTH is the maximum size the stacks can grow to
    (effective only if the built-in stack extension method is used).  */

#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif

/* Define __yy_memcpy.  Note that the size argument
   should be passed with type unsigned int, because that is what the non-GCC
   definitions require.  With GCC, __builtin_memcpy takes an arg
   of type size_t, but it can handle unsigned int.  */

#if __GNUC__ > 1		/* GNU C and GNU C++ define this.  */
#define __yy_memcpy(TO,FROM,COUNT)	__builtin_memcpy(TO,FROM,COUNT)
#else				/* not GNU C or C++ */
#ifndef __cplusplus

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__yy_memcpy (to, from, count)
     char *to;
     char *from;
     unsigned int count;
{
  register char *f = from;
  register char *t = to;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#else /* __cplusplus */

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__yy_memcpy (char *to, char *from, unsigned int count)
{
  register char *t = to;
  register char *f = from;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#endif
#endif

#line 217 "/usr/share/bison.simple"

/* The user can define YYPARSE_PARAM as the name of an argument to be passed
   into yyparse.  The argument should have type void *.
   It should actually point to an object.
   Grammar actions can access the variable by casting it
   to the proper pointer type.  */

#ifdef YYPARSE_PARAM
#ifdef __cplusplus
#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
#define YYPARSE_PARAM_DECL
#else /* not __cplusplus */
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
#endif /* not __cplusplus */
#else /* not YYPARSE_PARAM */
#define YYPARSE_PARAM_ARG
#define YYPARSE_PARAM_DECL
#endif /* not YYPARSE_PARAM */

/* Prevent warning if -Wstrict-prototypes.  */
#ifdef __GNUC__
#ifdef YYPARSE_PARAM
int yyparse (void *);
#else
int yyparse (void);
#endif
#endif

int
yyparse(YYPARSE_PARAM_ARG)
     YYPARSE_PARAM_DECL
{
  register int yystate;
  register int yyn;
  register short *yyssp;
  register YYSTYPE *yyvsp;
  int yyerrstatus;	/*  number of tokens to shift before error messages enabled */
  int yychar1 = 0;		/*  lookahead token as an internal (translated) token number */

  short	yyssa[YYINITDEPTH];	/*  the state stack			*/
  YYSTYPE yyvsa[YYINITDEPTH];	/*  the semantic value stack		*/

  short *yyss = yyssa;		/*  refer to the stacks thru separate pointers */
  YYSTYPE *yyvs = yyvsa;	/*  to allow yyoverflow to reallocate them elsewhere */

#ifdef YYLSP_NEEDED
  YYLTYPE yylsa[YYINITDEPTH];	/*  the location stack			*/
  YYLTYPE *yyls = yylsa;
  YYLTYPE *yylsp;

#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
#else
#define YYPOPSTACK   (yyvsp--, yyssp--)
#endif

  int yystacksize = YYINITDEPTH;
  int yyfree_stacks = 0;

#ifdef YYPURE
  int yychar;
  YYSTYPE yylval;
  int yynerrs;
#ifdef YYLSP_NEEDED
  YYLTYPE yylloc;
#endif
#endif

  YYSTYPE yyval;		/*  the variable used to return		*/
				/*  semantic values from the action	*/
				/*  routines				*/

  int yylen;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Starting parse\n");
#endif

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY;		/* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */

  yyssp = yyss - 1;
  yyvsp = yyvs;
#ifdef YYLSP_NEEDED
  yylsp = yyls;
#endif

/* Push a new state, which is found in  yystate  .  */
/* In all cases, when you get here, the value and location stacks
   have just been pushed. so pushing a state here evens the stacks.  */
yynewstate:

  *++yyssp = yystate;

  if (yyssp >= yyss + yystacksize - 1)
    {
      /* Give user a chance to reallocate the stack */
      /* Use copies of these so that the &'s don't force the real ones into memory. */
      YYSTYPE *yyvs1 = yyvs;
      short *yyss1 = yyss;
#ifdef YYLSP_NEEDED
      YYLTYPE *yyls1 = yyls;
#endif

      /* Get the current used size of the three stacks, in elements.  */
      int size = yyssp - yyss + 1;

#ifdef yyoverflow
      /* Each stack pointer address is followed by the size of
	 the data in use in that stack, in bytes.  */
#ifdef YYLSP_NEEDED
      /* This used to be a conditional around just the two extra args,
	 but that might be undefined if yyoverflow is a macro.  */
      yyoverflow("parser stack overflow",
		 &yyss1, size * sizeof (*yyssp),
		 &yyvs1, size * sizeof (*yyvsp),
		 &yyls1, size * sizeof (*yylsp),
		 &yystacksize);
#else
      yyoverflow("parser stack overflow",
		 &yyss1, size * sizeof (*yyssp),
		 &yyvs1, size * sizeof (*yyvsp),
		 &yystacksize);
#endif

      yyss = yyss1; yyvs = yyvs1;
#ifdef YYLSP_NEEDED
      yyls = yyls1;
#endif
#else /* no yyoverflow */
      /* Extend the stack our own way.  */
      if (yystacksize >= YYMAXDEPTH)
	{
	  yyerror("parser stack overflow");
	  if (yyfree_stacks)
	    {
	      free (yyss);
	      free (yyvs);
#ifdef YYLSP_NEEDED
	      free (yyls);
#endif
	    }
	  return 2;
	}
      yystacksize *= 2;
      if (yystacksize > YYMAXDEPTH)
	yystacksize = YYMAXDEPTH;
#ifndef YYSTACK_USE_ALLOCA
      yyfree_stacks = 1;
#endif
      yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
      __yy_memcpy ((char *)yyss, (char *)yyss1,
		   size * (unsigned int) sizeof (*yyssp));
      yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
      __yy_memcpy ((char *)yyvs, (char *)yyvs1,
		   size * (unsigned int) sizeof (*yyvsp));
#ifdef YYLSP_NEEDED
      yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
      __yy_memcpy ((char *)yyls, (char *)yyls1,
		   size * (unsigned int) sizeof (*yylsp));
#endif
#endif /* no yyoverflow */

      yyssp = yyss + size - 1;
      yyvsp = yyvs + size - 1;
#ifdef YYLSP_NEEDED
      yylsp = yyls + size - 1;
#endif

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Stack size increased to %d\n", yystacksize);
#endif

      if (yyssp >= yyss + yystacksize - 1)
	YYABORT;
    }

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Entering state %d\n", yystate);
#endif

  goto yybackup;
 yybackup:

/* Do appropriate processing given the current state.  */
/* Read a lookahead token if we need one and don't already have one.  */
/* yyresume: */

  /* First try to decide what to do without reference to lookahead token.  */

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* yychar is either YYEMPTY or YYEOF
     or a valid token in external form.  */

  if (yychar == YYEMPTY)
    {
#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Reading a token: ");
#endif
      yychar = YYLEX;
    }

  /* Convert token to internal form (in yychar1) for indexing tables with */

  if (yychar <= 0)		/* This means end of input. */
    {
      yychar1 = 0;
      yychar = YYEOF;		/* Don't call YYLEX any more */

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Now at end of input.\n");
#endif
    }
  else
    {
      yychar1 = YYTRANSLATE(yychar);

#if YYDEBUG != 0
      if (yydebug)
	{
	  fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
	  /* Give the individual parser a way to print the precise meaning
	     of a token, for further debugging info.  */
#ifdef YYPRINT
	  YYPRINT (stderr, yychar, yylval);
#endif
	  fprintf (stderr, ")\n");
	}
#endif
    }

  yyn += yychar1;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
    goto yydefault;

  yyn = yytable[yyn];

  /* yyn is what to do for this token type in this state.
     Negative => reduce, -yyn is rule number.
     Positive => shift, yyn is new state.
       New state is final state => don't bother to shift,
       just return success.
     0, or most negative number => error.  */

  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrlab;

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
#endif

  /* Discard the token being shifted unless it is eof.  */
  if (yychar != YYEOF)
    yychar = YYEMPTY;

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  /* count tokens shifted since error; after three, turn off error status.  */
  if (yyerrstatus) yyerrstatus--;

  yystate = yyn;
  goto yynewstate;

/* Do the default action for the current state.  */
yydefault:

  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;

/* Do a reduction.  yyn is the number of a rule to reduce with.  */
yyreduce:
  yylen = yyr2[yyn];
  if (yylen > 0)
    yyval = yyvsp[1-yylen]; /* implement default value of the action */

#if YYDEBUG != 0
  if (yydebug)
    {
      int i;

      fprintf (stderr, "Reducing via rule %d (line %d), ",
	       yyn, yyrline[yyn]);

      /* Print the symbols being reduced, and their result.  */
      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
	fprintf (stderr, "%s ", yytname[yyrhs[i]]);
      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
    }
#endif


  switch (yyn) {

case 3:
#line 297 "parser.y"
{
			/*
			 * We don't do these in parserEOF() because the parser
			 * is reading ahead and that would be too early.
			 */

			if (previousFile != NULL)
			{
				handleEOF();

				if (newContext.prevmod != NULL)
					handleEOM();

				free(previousFile);
				previousFile = NULL;
			}
	;
    break;}
case 14:
#line 325 "parser.y"
{
			if (isMainModule(currentModule))
				appendCodeBlock(&currentSpec -> hdrcode,yyvsp[0].codeb);
		;
    break;}
case 16:
#line 330 "parser.y"
{
			if (isMainModule(currentModule))
				appendCodeBlock(&currentSpec -> cppcode,yyvsp[0].codeb);
		;
    break;}
case 33:
#line 354 "parser.y"
{
			versionDef *vd;

			if ((vd = getVersion()) != NULL)
				currentMappedType = newMappedType(currentSpec,&yyvsp[0].memArg,vd);
		;
    break;}
case 34:
#line 359 "parser.y"
{
			if (getVersion() != NULL)
			{
				if (currentMappedType -> convfromcode == NULL)
					yyerror("%MappedType must have a %ConvertFromTypeCode directive");

				if (currentMappedType -> convtocode == NULL)
					yyerror("%MappedType must have a %ConvertToTypeCode directive");

				if (currentMappedType -> canconvtocode == NULL)
					yyerror("%MappedType must have a %CanConvertToTypeCode directive");

				currentMappedType = NULL;
			}
		;
    break;}
case 37:
#line 380 "parser.y"
{
			if (getVersion() != NULL)
				appendCodeBlock(&currentMappedType -> hdrcode,yyvsp[0].codeb);
		;
    break;}
case 38:
#line 384 "parser.y"
{
			if (getVersion() != NULL)
			{
				if (currentMappedType -> convfromcode != NULL)
					yyerror("%MappedType has more than one %ConvertFromTypeCode directive");

				currentMappedType -> convfromcode = yyvsp[0].codeb;
			}
		;
    break;}
case 39:
#line 393 "parser.y"
{
			if (getVersion() != NULL)
			{
				if (currentMappedType -> canconvtocode != NULL)
					yyerror("%MappedType has more than one %CanConvertToTypeCode directive");

				currentMappedType -> canconvtocode = yyvsp[0].codeb;
			}
		;
    break;}
case 40:
#line 402 "parser.y"
{
			if (getVersion() != NULL)
			{
				if (currentMappedType -> convtocode != NULL)
					yyerror("%MappedType has more than one %ConvertToTypeCode directive");

				currentMappedType -> convtocode = yyvsp[0].codeb;
			}
		;
    break;}
case 41:
#line 413 "parser.y"
{
			versionDef *vd;

			if ((vd = getVersion()) != NULL)
			{
				classVersDef *ns;
				scopedNameDef *fqname;

				fqname = text2scopedName(yyvsp[0].text);

				if ((ns = findNamespace(currentSpec,vd,fqname)) == NULL)
				{
					ns = newClass(currentSpec,vd,fqname);
			
					setCannotCreate(ns);
					setIsNamespace(ns);
				}

				sectionFlags = 0;

				pushScope(ns);
			}
		;
    break;}
case 42:
#line 435 "parser.y"
{
			/* Remove the namespace name. */

			if (getVersion() != NULL)
				popScope();
		;
    break;}
case 45:
#line 447 "parser.y"
{
			newVersion(currentSpec,currentModule,-1,yyvsp[-2].text,yyvsp[-1].text,yyvsp[0].text);
		;
    break;}
case 46:
#line 452 "parser.y"
{
			if (currentModule -> nrTimeSlots >= 0)
				yyerror("%Timeline has already been defined for this module");

			currentModule -> nrTimeSlots = 0;
		;
    break;}
case 47:
#line 458 "parser.y"
{
			/*
			 * If we don't know the primary version yet, use the
			 * latest one.
			 */

			if (currentModule -> required == NULL)
			{
				versionQual *vq;

				for (vq = currentModule -> timeSlots; vq != NULL; vq = vq -> next)
					if (vq -> order == currentModule -> nrTimeSlots - 1)
					{
						currentModule -> required = vq;
						break;
					}
			}
		;
    break;}
case 50:
#line 482 "parser.y"
{
			versionQual *vq;
			stringList *sl;

			vq = newVersion(currentSpec,currentModule,currentModule -> nrTimeSlots++,yyvsp[0].text,NULL,NULL);

			/* See if this is a time slot we want. */

			for (sl = timeSlotList; sl != NULL; sl = sl -> next)
				if (strcmp(vq -> name,sl -> s) == 0)
				{
					if (currentModule -> required != NULL)
						fatal("Multiple primary versions requested for the same module\n");

					currentModule -> required = vq;
				}
		;
    break;}
case 51:
#line 501 "parser.y"
{
			if (currentVersion >= MAX_NESTED_IF)
				yyerror("Internal error: increase the value of MAX_NESTED_IF");

			versScope[currentVersion++] = yyvsp[-1].versrange;
		;
    break;}
case 52:
#line 509 "parser.y"
{
			int i;

			if ((yyval.versrange.secondary = findQualifier(currentSpec -> secondaries,yyvsp[0].text)) == NULL)
				yyerror("No such secondary version");

			/*
			 * Check there isn't already a secondary in scope and
			 * set the primary.
			 */

			yyval.versrange.lowidx = 0;
			yyval.versrange.uppidx = currentModule -> nrTimeSlots;

			for (i = 0; i < currentVersion; ++i)
				if (versScope[i].secondary != NULL)
					yyerror("Cannot nest secondary versions");
				else
				{
					/*
					 * Keep overwriting with more and more
					 * specific primaries.
					 */

					yyval.versrange.lowidx = versScope[i].lowidx;
					yyval.versrange.uppidx = versScope[i].uppidx;
				}
		;
    break;}
case 53:
#line 537 "parser.y"
{
			versionQual *vq;

			if (yyvsp[-2].text == NULL)
				yyval.versrange.lowidx = (currentVersion > 0 ?
					versScope[currentVersion - 1].lowidx :
					0);
			else if ((vq = findQualifier(currentModule -> timeSlots,yyvsp[-2].text)) == NULL)
				yyerror("Lower bound is not a primary version in this module");
			else
				yyval.versrange.lowidx = vq -> order;

			if (yyvsp[0].text == NULL)
				yyval.versrange.uppidx = (currentVersion > 0 ?
					versScope[currentVersion - 1].uppidx :
					currentModule -> nrTimeSlots);
			else if ((vq = findQualifier(currentModule -> timeSlots,yyvsp[0].text)) == NULL)
				yyerror("Upper bound is not a primary version in this module");
			else
				yyval.versrange.uppidx = vq -> order;

			/* Sanity checks on the bounds. */

			if (yyval.versrange.lowidx == yyval.versrange.uppidx)
				yyerror("Lower and upper bounds must be different");

			if (yyval.versrange.lowidx > yyval.versrange.uppidx)
				yyerror("Later version specified as lower bound");

			/* Set the secondary. */

			yyval.versrange.secondary = (currentVersion > 0 ?
				versScope[currentVersion - 1].secondary :
				NULL);
		;
    break;}
case 54:
#line 574 "parser.y"
{
			if (currentVersion-- <= 0)
				yyerror("Too many %End directives");
		;
    break;}
case 55:
#line 580 "parser.y"
{
			/* Only bother if this is the main module. */

			if (isMainModule(currentModule))
			{
				expFuncDef *ef;

				/* Check it isn't already there. */

				for (ef = currentSpec -> exposed; ef != NULL; ef = ef -> next)
					if (strcmp(ef -> name,yyvsp[0].text) == 0)
						yyerror("Function has already been exposed in this module");

				ef = sipMalloc(sizeof (expFuncDef));

				ef -> name = yyvsp[0].text;
				ef -> next = currentSpec -> exposed;

				currentSpec -> exposed = ef;
			}
		;
    break;}
case 56:
#line 603 "parser.y"
{
			/* Check the module hasn't already been defined. */

			moduleDef *mod;

			for (mod = currentSpec -> moduleList; mod != NULL; mod = mod -> next)
				if (mod -> name != NULL && strcmp(mod -> name -> text,yyvsp[0].text) == 0)
					yyerror("Module is already defined");

			currentModule -> name = cacheName(currentSpec,currentModule,yyvsp[0].text);
		;
    break;}
case 57:
#line 616 "parser.y"
{
			parseFile(NULL,yyvsp[0].text,NULL,FALSE);
		;
    break;}
case 58:
#line 621 "parser.y"
{
			newImport(currentSpec,yyvsp[0].text,FALSE);
		;
    break;}
case 59:
#line 626 "parser.y"
{
			if (currentModule -> timeSlots != NULL)
				yyerror("Cannot %ImportWithTimeline after a primary version has been defined");

			newImport(currentSpec,yyvsp[0].text,TRUE);
		;
    break;}
case 60:
#line 634 "parser.y"
{
			yyval.codeb = NULL;
		;
    break;}
case 61:
#line 637 "parser.y"
{
			yyval.codeb = yyvsp[0].codeb;
		;
    break;}
case 62:
#line 642 "parser.y"
{
			appendCodeBlock(&currentSpec -> versioncode,yyvsp[0].codeb);
		;
    break;}
case 63:
#line 647 "parser.y"
{
			if (isMainModule(currentModule))
				appendCodeBlock(&currentSpec -> copying,yyvsp[0].codeb);
		;
    break;}
case 64:
#line 653 "parser.y"
{
			yyval.codeb = yyvsp[0].codeb;
		;
    break;}
case 65:
#line 658 "parser.y"
{
			appendCodeBlock(&currentSpec -> exphdrcode,yyvsp[0].codeb);
		;
    break;}
case 66:
#line 663 "parser.y"
{
			yyval.codeb = yyvsp[0].codeb;
		;
    break;}
case 67:
#line 668 "parser.y"
{
			if (isMainModule(currentModule))
				appendCodeBlock(&currentSpec -> prepycode,yyvsp[0].codeb);
		;
    break;}
case 68:
#line 674 "parser.y"
{
			if (isMainModule(currentModule))
				appendCodeBlock(&currentSpec -> pycode,yyvsp[0].codeb);
		;
    break;}
case 69:
#line 680 "parser.y"
{
			if (isMainModule(currentModule))
				appendCodeBlock(&currentSpec -> docs,yyvsp[0].codeb);
		;
    break;}
case 70:
#line 686 "parser.y"
{
			appendCodeBlock(&currentSpec -> docs,yyvsp[0].codeb);
		;
    break;}
case 71:
#line 691 "parser.y"
{
			if (isMainModule(currentModule))
			{
				mkTemplateDef *mtd;

				mtd = sipMalloc(sizeof (mkTemplateDef));

				mtd -> name = yyvsp[-2].text;
				mtd -> objext = yyvsp[-1].text;
				mtd -> templ = NULL;

				appendCodeBlock(&mtd -> templ,yyvsp[0].codeb);

				mtd -> next = currentSpec -> mktemplates;
				currentSpec -> mktemplates = mtd;
			}
		;
    break;}
case 73:
#line 713 "parser.y"
{
			versionDef *vd;

			if ((vd = getVersion()) != NULL)
			{
				if (sectionFlags != 0 && (sectionFlags & ~(SECT_IS_PUBLIC | SECT_IS_PROT)) != 0)
					yyerror("Class enums must be in the public or protected sections");

				newEnum(currentSpec,vd,currentModule,yyvsp[-4].text,sectionFlags,yyvsp[-2].evalp);
			}
		;
    break;}
case 74:
#line 726 "parser.y"
{
			yyval.text = NULL;
		;
    break;}
case 75:
#line 729 "parser.y"
{
			yyval.text = yyvsp[0].text;
		;
    break;}
case 76:
#line 734 "parser.y"
{
			yyval.evalp = NULL;
		;
    break;}
case 77:
#line 737 "parser.y"
{
			yyval.evalp = yyvsp[0].evalp;
		;
    break;}
case 79:
#line 743 "parser.y"
{
			enumValueDef *evd;

			/*
			 * Append the new value to the list so long as it
			 * isn't already there.
			 */

			for (evd = yyvsp[-2].evalp; evd -> name != yyvsp[0].evalp -> name && evd -> next != NULL; evd = evd -> next)
				;

			if (evd -> name == yyvsp[0].evalp -> name)
				yyerror("enum values given more that once in the same enum");

			evd -> next = yyvsp[0].evalp;
		;
    break;}
case 80:
#line 761 "parser.y"
{
			/*
			 * Note that we don't use the assigned value.  This is
			 * a hangover from when enums where generated in
			 * Python.  We can remove it when we have got around to
			 * updating all the .sip files.
			 */

			yyval.evalp = sipMalloc(sizeof (enumValueDef));
			yyval.evalp -> name = cacheName(currentSpec,currentModule,yyvsp[-1].text);
			yyval.evalp -> next = NULL;
		;
    break;}
case 81:
#line 775 "parser.y"
{
			yyval.valp = NULL;
		;
    break;}
case 82:
#line 778 "parser.y"
{
			yyval.valp = yyvsp[0].valp;
		;
    break;}
case 84:
#line 784 "parser.y"
{
			valueDef *vd;
 
			if (yyvsp[-2].valp -> vtype == string_value || yyvsp[0].valp -> vtype == string_value)
				yyerror("Invalid binary operator for string");
 
			/* Find the last value in the existing expression. */
 
			for (vd = yyvsp[-2].valp; vd -> next != NULL; vd = vd -> next)
				;
 
			vd -> vbinop = yyvsp[-1].qchar;
			vd -> next = yyvsp[0].valp;

			yyval.valp = yyvsp[-2].valp;
		;
    break;}
case 85:
#line 802 "parser.y"
{
			yyval.qchar = '-';
		;
    break;}
case 86:
#line 805 "parser.y"
{
			yyval.qchar = '+';
		;
    break;}
case 87:
#line 808 "parser.y"
{
			yyval.qchar = '|';
		;
    break;}
case 88:
#line 813 "parser.y"
{
			yyval.qchar = '\0';
		;
    break;}
case 89:
#line 816 "parser.y"
{
			yyval.qchar = '!';
		;
    break;}
case 90:
#line 819 "parser.y"
{
			yyval.qchar = '~';
		;
    break;}
case 91:
#line 822 "parser.y"
{
			yyval.qchar = '-';
		;
    break;}
case 92:
#line 825 "parser.y"
{
			yyval.qchar = '+';
		;
    break;}
case 93:
#line 830 "parser.y"
{
			if (yyvsp[-1].qchar != '\0' && yyvsp[0].value.vtype == string_value)
				yyerror("Invalid unary operator for string");
 
			/*
			 * Convert the value to a simple expression on the
			 * heap.
			 */
 
			yyval.valp = sipMalloc(sizeof (valueDef));
 
			*yyval.valp = yyvsp[0].value;
			yyval.valp -> vunop = yyvsp[-1].qchar;
			yyval.valp -> vbinop = '\0';
			yyval.valp -> next = NULL;
		;
    break;}
case 95:
#line 849 "parser.y"
{
			appendScopedName(&yyvsp[-2].scpvalp,yyvsp[0].scpvalp);
		;
    break;}
case 96:
#line 854 "parser.y"
{
			yyval.scpvalp = text2scopePart(yyvsp[0].text);
		;
    break;}
case 97:
#line 859 "parser.y"
{
			/*
			 * We let the C++ compiler decide if the value is a
			 * valid one - no point in building a full C++ parser
			 * here.
			 */

			yyval.value.vtype = scoped_value;
			yyval.value.u.vscp = yyvsp[0].scpvalp;
		;
    break;}
case 98:
#line 869 "parser.y"
{
			fcallDef *fcd;

			fcd = sipMalloc(sizeof (fcallDef));
			*fcd = yyvsp[-1].fcall;
			fcd -> name = yyvsp[-3].scpvalp;

			yyval.value.vtype = fcall_value;
			yyval.value.u.fcd = fcd;
		;
    break;}
case 99:
#line 879 "parser.y"
{
			yyval.value.vtype = real_value;
			yyval.value.u.vreal = yyvsp[0].real;
		;
    break;}
case 100:
#line 883 "parser.y"
{
			yyval.value.vtype = numeric_value;
			yyval.value.u.vnum = yyvsp[0].number;
		;
    break;}
case 101:
#line 887 "parser.y"
{
			yyval.value.vtype = string_value;
			yyval.value.u.vstr = cacheName(currentSpec,currentModule,yyvsp[0].text);
		;
    break;}
case 102:
#line 891 "parser.y"
{
			yyval.value.vtype = qchar_value;
			yyval.value.u.vqchar = yyvsp[0].qchar;
		;
    break;}
case 103:
#line 897 "parser.y"
{
			/* No values. */

			yyval.fcall.nrArgs = 0;
		;
    break;}
case 104:
#line 902 "parser.y"
{
			/* The single or first value. */

			yyval.fcall.args[0] = yyvsp[0].valp;
			yyval.fcall.nrArgs = 1;
		;
    break;}
case 105:
#line 908 "parser.y"
{
			/* Check that it wasn't ...(,value...). */

			if (yyval.fcall.nrArgs == 0)
				yyerror("First argument to function call is missing");

			/* Check there is room. */

			if (yyvsp[-2].fcall.nrArgs == MAX_NR_ARGS)
				yyerror("Too many arguments to function call");

			yyval.fcall = yyvsp[-2].fcall;

			yyval.fcall.args[yyval.fcall.nrArgs] = yyvsp[0].valp;
			yyval.fcall.nrArgs++;
		;
    break;}
case 106:
#line 926 "parser.y"
{
			versionDef *vd;

			if ((vd = getVersion()) != NULL)
				newTypedef(currentSpec,vd,yyvsp[-1].text,&yyvsp[-2].memArg);
		;
    break;}
case 107:
#line 934 "parser.y"
{
			versionDef *vd;

			if ((vd = getVersion()) != NULL)
			{
				classVersDef *cvd;

				cvd = newClass(currentSpec,vd,yyvsp[-1].scpvalp);

				setHasRealClassVers(cvd -> common -> iff);
				setCannotCreate(cvd);
				setIsOpaque(cvd);
			}
		;
    break;}
case 108:
#line 950 "parser.y"
{
			versionDef *vd;

			if ((vd = getVersion()) != NULL)
			{
				classVersDef *cvd;

				cvd = newClass(currentSpec,vd,text2scopedName(yyvsp[0].text));

				setHasRealClassVers(cvd -> common -> iff);
				setCannotCreate(cvd);

				sectionFlags = SECT_IS_PRIVATE;

				pushScope(cvd);
			}
		;
    break;}
case 109:
#line 966 "parser.y"
{
			if (getVersion() != NULL)
			{
				finishClass(currentScope());
				popScope();
			}
		;
    break;}
case 114:
#line 983 "parser.y"
{
			if (getVersion() != NULL)
			{
				classDef *cd = findClass(currentSpec,yyvsp[0].scpvalp);
				classVersDef *cvd = currentScope();

				appendToClassList(&cvd -> supers,cd);

				if (isMainModule(cvd -> common -> iff -> module))
					addToUsedList(&cvd -> used,cd -> iff);
			}
		;
    break;}
case 124:
#line 1008 "parser.y"
{
			if (getVersion() != NULL)
				appendCodeBlock(&currentScope() -> cppcode,yyvsp[0].codeb);
		;
    break;}
case 125:
#line 1012 "parser.y"
{
			if (getVersion() != NULL)
				appendCodeBlock(&currentScope() -> hdrcode,yyvsp[0].codeb);
		;
    break;}
case 129:
#line 1019 "parser.y"
{
			if (getVersion() != NULL)
			{
				classVersDef *cvd = currentScope();

				if (cvd -> convtosubcode != NULL)
					yyerror("Class has more than one %ConvertToSubClassCode directive");

				cvd -> convtosubcode = yyvsp[0].codeb;
			}
		;
    break;}
case 130:
#line 1030 "parser.y"
{
			if (getVersion() != NULL)
			{
				classVersDef *cvd = currentScope();

				if (cvd -> canconvtocode != NULL)
					yyerror("Class has more than one %CanConvertToTypeCode directive");

				cvd -> canconvtocode = yyvsp[0].codeb;
			}
		;
    break;}
case 131:
#line 1041 "parser.y"
{
			if (getVersion() != NULL)
			{
				classVersDef *cvd = currentScope();

				if (cvd -> convtocode != NULL)
					yyerror("Class has more than one %ConvertToTypeCode directive");

				cvd -> convtocode = yyvsp[0].codeb;
			}
		;
    break;}
case 132:
#line 1052 "parser.y"
{
			versionDef *vd;

			if ((vd = getVersion()) != NULL)
			{
				if (yyvsp[0].codeb == NULL)
					yyerror("Code to implement the special Python method must be given");

				newSpecialMethod(vd,yyvsp[-1].text,sectionFlags,yyvsp[0].codeb);
			}
		;
    break;}
case 133:
#line 1063 "parser.y"
{
			if (getVersion() != NULL)
				sectionFlags = SECT_IS_PUBLIC | yyvsp[-1].number;
		;
    break;}
case 134:
#line 1067 "parser.y"
{
			if (getVersion() != NULL)
				sectionFlags = SECT_IS_PROT | yyvsp[-1].number;
		;
    break;}
case 135:
#line 1071 "parser.y"
{
			if (getVersion() != NULL)
				sectionFlags = SECT_IS_PRIVATE | yyvsp[-1].number;
		;
    break;}
case 136:
#line 1075 "parser.y"
{
			if (getVersion() != NULL)
				sectionFlags = SECT_IS_SIGNAL;
		;
    break;}
case 137:
#line 1079 "parser.y"
{
			if (getVersion() != NULL)
				sectionFlags = SECT_IS_PYMETHOD;
		;
    break;}
case 138:
#line 1083 "parser.y"
{
			if (getVersion() != NULL)
				sectionFlags = SECT_IS_PYNUMMETHOD;
		;
    break;}
case 139:
#line 1087 "parser.y"
{
			if (getVersion() != NULL)
				sectionFlags = SECT_IS_PYSEQMETHOD;
		;
    break;}
case 140:
#line 1091 "parser.y"
{
			if (getVersion() != NULL)
				sectionFlags = SECT_IS_PYMAPMETHOD;
		;
    break;}
case 141:
#line 1097 "parser.y"
{
			yyval.number = 0;
		;
    break;}
case 142:
#line 1100 "parser.y"
{
			yyval.number = SECT_IS_SLOT;
		;
    break;}
case 143:
#line 1105 "parser.y"
{
			if (getVersion() != NULL)
			{
				classVersDef *cvd = currentScope();

				if (strcmp(classVersBaseName(cvd),yyvsp[-4].text) != 0)
					yyerror("Destructor doesn't have the same name as its class");

				if (isDtor(cvd))
					yyerror("Destructor has already been defined");

				cvd -> dtorcode = yyvsp[0].codeb;
				setIsDtor(cvd);

				if ((sectionFlags & SECT_IS_PUBLIC) == 0)
					setNoPublicDtor(cvd);
			}
		;
    break;}
case 144:
#line 1125 "parser.y"
{
			versionDef *vd;

			if ((vd = getVersion()) != NULL)
			{
				if ((sectionFlags & (SECT_IS_PUBLIC | SECT_IS_PROT | SECT_IS_PRIVATE)) == 0)
					yyerror("Constructor must be in the public, private or protected sections");

				newCtor(vd,yyvsp[-5].text,sectionFlags,&yyvsp[-3].arglist,yyvsp[0].codeb);
			}

			free(yyvsp[-5].text);
		;
    break;}
case 145:
#line 1140 "parser.y"
{
			versionDef *vd;

			if ((vd = getVersion()) != NULL)
			{
				if (sectionFlags != 0 && (sectionFlags & (SECT_IS_PUBLIC | SECT_IS_PROT | SECT_IS_PRIVATE | SECT_IS_SLOT | SECT_IS_SIGNAL)) == 0)
					yyerror("Class function must be in the public, private, protected, slot or signal sections");

				newFunction(currentSpec,vd,currentModule,
					    sectionFlags,currentIsStatic,
					    currentOverIsVirt,&yyvsp[-10].memArg,yyvsp[-9].text,&yyvsp[-7].arglist,yyvsp[-5].number,yyvsp[-4].number,
					    &yyvsp[-3].optflags,yyvsp[-1].codeb,yyvsp[0].codeb);
			}

			currentIsStatic = FALSE;
			currentOverIsVirt = FALSE;
		;
    break;}
case 146:
#line 1160 "parser.y"
{
			yyval.number = FALSE;
		;
    break;}
case 147:
#line 1163 "parser.y"
{
			yyval.number = TRUE;
		;
    break;}
case 148:
#line 1168 "parser.y"
{
			yyval.number = 0;
		;
    break;}
case 149:
#line 1171 "parser.y"
{
			if (yyvsp[0].number != 0)
				yyerror("Abstract virtual function '= 0' expected");

			yyval.number = TRUE;
		;
    break;}
case 150:
#line 1179 "parser.y"
{
			yyval.optflags.nrFlags = 0;
		;
    break;}
case 151:
#line 1182 "parser.y"
{
			yyval.optflags = yyvsp[-1].optflags;
		;
    break;}
case 152:
#line 1188 "parser.y"
{
			yyval.optflags.flags[0] = yyvsp[0].flag;
			yyval.optflags.nrFlags = 1;
		;
    break;}
case 153:
#line 1192 "parser.y"
{
			/* Check there is room. */

			if (yyvsp[-2].optflags.nrFlags == MAX_NR_FLAGS)
				yyerror("Too many optional flags");

			yyval.optflags = yyvsp[-2].optflags;

			yyval.optflags.flags[yyval.optflags.nrFlags++] = yyvsp[0].flag;
		;
    break;}
case 154:
#line 1204 "parser.y"
{
			yyval.flag.ftype = bool_flag;
			yyval.flag.fname = yyvsp[0].text;
		;
    break;}
case 155:
#line 1208 "parser.y"
{
			yyval.flag = yyvsp[0].flag;
			yyval.flag.fname = yyvsp[-2].text;
		;
    break;}
case 156:
#line 1214 "parser.y"
{
			yyval.flag.ftype = name_flag;
			yyval.flag.fvalue.sval = yyvsp[0].text;
		;
    break;}
case 157:
#line 1218 "parser.y"
{
			yyval.flag.ftype = string_flag;
			yyval.flag.fvalue.sval = yyvsp[0].text;
		;
    break;}
case 158:
#line 1224 "parser.y"
{
			yyval.codeb = NULL;
		;
    break;}
case 159:
#line 1227 "parser.y"
{
			yyval.codeb = yyvsp[0].codeb;
		;
    break;}
case 160:
#line 1232 "parser.y"
{
			yyval.codeb = NULL;
		;
    break;}
case 161:
#line 1235 "parser.y"
{
			yyval.codeb = yyvsp[0].codeb;
		;
    break;}
case 162:
#line 1240 "parser.y"
{
			int a, nrsigs, nrrxcon, nrrxdis, nrslotcon, nrslotdis, nrarray, nrarraysize;

			nrsigs = nrrxcon = nrrxdis = nrslotcon = nrslotdis = nrarray = nrarraysize = 0;

			for (a = 0; a < yyvsp[0].arglist.nrArgs; ++a)
				switch (yyvsp[0].arglist.args[a].atype)
				{
				case signal_type:
					++nrsigs;
					break;

				case rxcon_type:
					++nrrxcon;
					break;

				case rxdis_type:
					++nrrxdis;
					break;

				case slotcon_type:
					++nrslotcon;
					break;

				case slotdis_type:
					++nrslotdis;
					break;

				case array_type:
				case uarray_type:
					++nrarray;
					break;

				case arraysize_type:
				case arrayusize_type:
					++nrarraysize;
					break;
				}

			if (nrsigs == 1 && nrrxcon == 0)
				yyerror("SIP_SIGNAL can only be used with SIP_RXOBJ_CON");

			if (nrsigs > 1)
				yyerror("SIP_SIGNAL can only be given once");

			if (nrrxcon != nrslotcon || nrrxcon > 1)
				yyerror("SIP_RXOBJ_CON and SIP_SLOT_CON must both be given and at most once");

			if (nrrxdis != nrslotdis || nrrxdis > 1)
				yyerror("SIP_RXOBJ_DIS and SIP_SLOT_DIS must both be given and at most once");

			if (nrarray != nrarraysize || nrarray > 1)
				yyerror("SIP_ARRAY/SIP_UARRAY and SIP_ARRAY_SIZE/SIP_ARRAY_USIZE must both be given and at most once");

			yyval.arglist = yyvsp[0].arglist;
		;
    break;}
case 163:
#line 1298 "parser.y"
{
			/* No arguments. */

			yyval.arglist.nrArgs = 0;
		;
    break;}
case 164:
#line 1303 "parser.y"
{
			/* The single or first argument. */

			yyval.arglist.args[0] = yyvsp[0].memArg;
			yyval.arglist.nrArgs = 1;
		;
    break;}
case 165:
#line 1309 "parser.y"
{
			/* Check that it wasn't ...(,arg...). */

			if (yyval.arglist.nrArgs == 0)
				yyerror("First argument of list is missing");

			/*
			 * If this argument has no default value, then all
			 * previous ones mustn't either.
			 */

			if (yyvsp[0].memArg.defval == NULL)
			{
				int a;

				for (a = 0; a < yyvsp[-2].arglist.nrArgs; ++a)
					if (yyvsp[-2].arglist.args[a].defval != NULL)
						yyerror("Compulsory argument given after optional argument");
			}

			/* Check there is room. */

			if (yyvsp[-2].arglist.nrArgs == MAX_NR_ARGS)
				yyerror("Internal error - increase the value of MAX_NR_ARGS");

			yyval.arglist = yyvsp[-2].arglist;

			yyval.arglist.args[yyval.arglist.nrArgs] = yyvsp[0].memArg;
			yyval.arglist.nrArgs++;
		;
    break;}
case 166:
#line 1341 "parser.y"
{
			yyval.memArg.atype = signal_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;

			currentSpec -> sigslots = TRUE;
		;
    break;}
case 167:
#line 1348 "parser.y"
{
			yyval.memArg.atype = rxcon_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;

			currentSpec -> sigslots = TRUE;
		;
    break;}
case 168:
#line 1355 "parser.y"
{
			yyval.memArg.atype = rxdis_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;

			currentSpec -> sigslots = TRUE;
		;
    break;}
case 169:
#line 1362 "parser.y"
{
			yyval.memArg.atype = slotcon_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;

			yyval.memArg.u.sa = sipMalloc(sizeof (funcArgs));
			*yyval.memArg.u.sa = yyvsp[-1].arglist;

			currentSpec -> sigslots = TRUE;
		;
    break;}
case 170:
#line 1372 "parser.y"
{
			yyval.memArg.atype = slotdis_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;

			yyval.memArg.u.sa = sipMalloc(sizeof (funcArgs));
			*yyval.memArg.u.sa = yyvsp[-1].arglist;

			currentSpec -> sigslots = TRUE;
		;
    break;}
case 171:
#line 1382 "parser.y"
{
			yyval.memArg.atype = array_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;
		;
    break;}
case 172:
#line 1387 "parser.y"
{
			yyval.memArg.atype = uarray_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;
		;
    break;}
case 173:
#line 1392 "parser.y"
{
			yyval.memArg.atype = arraysize_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;
		;
    break;}
case 174:
#line 1397 "parser.y"
{
			yyval.memArg.atype = arrayusize_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;
		;
    break;}
case 175:
#line 1402 "parser.y"
{
			yyval.memArg = yyvsp[-1].memArg;
			yyval.memArg.defval = yyvsp[0].valp;
		;
    break;}
case 176:
#line 1408 "parser.y"
{currentIsStatic = TRUE;;
    break;}
case 181:
#line 1416 "parser.y"
{currentOverIsVirt = TRUE;;
    break;}
case 184:
#line 1420 "parser.y"
{
			versionDef *vd;

			if ((vd = getVersion()) != NULL)
			{
				/* Check the section. */

				if (sectionFlags != 0)
				{
					if ((sectionFlags & SECT_IS_PUBLIC) == 0)
						yyerror("Class variables must be in the public section");

					if (!currentIsStatic && yyvsp[0].codeb != NULL)
						yyerror("%VariableCode cannot be specified for non-static class variables");
				}

				newVar(currentSpec,vd,currentModule,yyvsp[-2].text,currentIsStatic,&yyvsp[-3].memArg,yyvsp[0].codeb);
			}

			currentIsStatic = FALSE;
		;
    break;}
case 185:
#line 1443 "parser.y"
{
			yyval.memArg = yyvsp[-2].memArg;
			yyval.memArg.nrderefs = yyvsp[-1].number;
			yyval.memArg.argflags = ARG_IS_CONST | yyvsp[0].number;
		;
    break;}
case 186:
#line 1448 "parser.y"
{
			yyval.memArg = yyvsp[-2].memArg;
			yyval.memArg.nrderefs = yyvsp[-1].number;
			yyval.memArg.argflags = yyvsp[0].number;
		;
    break;}
case 187:
#line 1455 "parser.y"
{
			yyval.memArg = yyvsp[-1].memArg;

			if (findOptFlag(&yyvsp[0].optflags,"Transfer",bool_flag) != NULL)
				yyval.memArg.argflags |= ARG_XFERRED;

			if (findOptFlag(&yyvsp[0].optflags,"TransferThis",bool_flag) != NULL)
				yyval.memArg.argflags |= ARG_THIS_XFERRED;

			if (findOptFlag(&yyvsp[0].optflags,"TransferBack",bool_flag) != NULL)
				yyval.memArg.argflags |= ARG_XFERRED_BACK;

			if (findOptFlag(&yyvsp[0].optflags,"Constrained",bool_flag) != NULL)
			{
				if (yyval.memArg.atype != int_type)
					yyerror("/Constrained/ may only be specified for int types");

				yyval.memArg.atype = cint_type;
			}
		;
    break;}
case 188:
#line 1477 "parser.y"
{
			yyval.number = 0;
		;
    break;}
case 189:
#line 1480 "parser.y"
{
			yyval.number = ARG_IS_REF;
		;
    break;}
case 190:
#line 1485 "parser.y"
{
			yyval.number = 0;
		;
    break;}
case 191:
#line 1488 "parser.y"
{
			yyval.number = yyvsp[-1].number + 1;
		;
    break;}
case 192:
#line 1493 "parser.y"
{
			yyval.memArg.atype = defined_type;
			yyval.memArg.u.snd = yyvsp[0].scpvalp;
		;
    break;}
case 193:
#line 1497 "parser.y"
{
			templateDef *td;

			td = sipMalloc(sizeof(templateDef));
			td -> fqname = yyvsp[-3].scpvalp;
			td -> types = yyvsp[-1].arglist;

			yyval.memArg.atype = template_type;
			yyval.memArg.u.td = td;
		;
    break;}
case 194:
#line 1507 "parser.y"
{
			yyval.memArg.atype = struct_type;
			yyval.memArg.u.sname = yyvsp[0].scpvalp;
		;
    break;}
case 195:
#line 1511 "parser.y"
{
			yyval.memArg.atype = ushort_type;
		;
    break;}
case 196:
#line 1514 "parser.y"
{
			yyval.memArg.atype = short_type;
		;
    break;}
case 197:
#line 1517 "parser.y"
{
			yyval.memArg.atype = uint_type;
		;
    break;}
case 198:
#line 1520 "parser.y"
{
			yyval.memArg.atype = int_type;
		;
    break;}
case 199:
#line 1523 "parser.y"
{
			yyval.memArg.atype = long_type;
		;
    break;}
case 200:
#line 1526 "parser.y"
{
			yyval.memArg.atype = ulong_type;
		;
    break;}
case 201:
#line 1529 "parser.y"
{
			yyval.memArg.atype = float_type;
		;
    break;}
case 202:
#line 1532 "parser.y"
{
			yyval.memArg.atype = double_type;
		;
    break;}
case 203:
#line 1535 "parser.y"
{
			yyval.memArg.atype = bool_type;
		;
    break;}
case 204:
#line 1538 "parser.y"
{
			yyval.memArg.atype = ustring_type;
		;
    break;}
case 205:
#line 1541 "parser.y"
{
			yyval.memArg.atype = string_type;
		;
    break;}
case 206:
#line 1544 "parser.y"
{
			yyval.memArg.atype = voidptr_type;
		;
    break;}
case 207:
#line 1549 "parser.y"
{
			/* The single or first type. */

			yyval.arglist.args[0] = yyvsp[0].memArg;
			yyval.arglist.nrArgs = 1;
		;
    break;}
case 208:
#line 1555 "parser.y"
{
			/* Check that it wasn't ,type... */

			if (yyval.arglist.nrArgs == 0)
				yyerror("First type of list is missing");

			/* Check there is room. */

			if (yyvsp[-2].arglist.nrArgs == MAX_NR_ARGS)
				yyerror("Internal error - increase the value of MAX_NR_ARGS");

			yyval.arglist = yyvsp[-2].arglist;

			yyval.arglist.args[yyval.arglist.nrArgs] = yyvsp[0].memArg;
			yyval.arglist.nrArgs++;
		;
    break;}
}
   /* the action file gets copied in in place of this dollarsign */
#line 543 "/usr/share/bison.simple"

  yyvsp -= yylen;
  yyssp -= yylen;
#ifdef YYLSP_NEEDED
  yylsp -= yylen;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

  *++yyvsp = yyval;

#ifdef YYLSP_NEEDED
  yylsp++;
  if (yylen == 0)
    {
      yylsp->first_line = yylloc.first_line;
      yylsp->first_column = yylloc.first_column;
      yylsp->last_line = (yylsp-1)->last_line;
      yylsp->last_column = (yylsp-1)->last_column;
      yylsp->text = 0;
    }
  else
    {
      yylsp->last_line = (yylsp+yylen-1)->last_line;
      yylsp->last_column = (yylsp+yylen-1)->last_column;
    }
#endif

  /* Now "shift" the result of the reduction.
     Determine what state that goes to,
     based on the state we popped back to
     and the rule number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTBASE];

  goto yynewstate;

yyerrlab:   /* here on detecting error */

  if (! yyerrstatus)
    /* If not already recovering from an error, report this error.  */
    {
      ++yynerrs;

#ifdef YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (yyn > YYFLAG && yyn < YYLAST)
	{
	  int size = 0;
	  char *msg;
	  int x, count;

	  count = 0;
	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
	  for (x = (yyn < 0 ? -yyn : 0);
	       x < (sizeof(yytname) / sizeof(char *)); x++)
	    if (yycheck[x + yyn] == x)
	      size += strlen(yytname[x]) + 15, count++;
	  msg = (char *) malloc(size + 15);
	  if (msg != 0)
	    {
	      strcpy(msg, "parse error");

	      if (count < 5)
		{
		  count = 0;
		  for (x = (yyn < 0 ? -yyn : 0);
		       x < (sizeof(yytname) / sizeof(char *)); x++)
		    if (yycheck[x + yyn] == x)
		      {
			strcat(msg, count == 0 ? ", expecting `" : " or `");
			strcat(msg, yytname[x]);
			strcat(msg, "'");
			count++;
		      }
		}
	      yyerror(msg);
	      free(msg);
	    }
	  else
	    yyerror ("parse error; also virtual memory exceeded");
	}
      else
#endif /* YYERROR_VERBOSE */
	yyerror("parse error");
    }

  goto yyerrlab1;
yyerrlab1:   /* here on error raised explicitly by an action */

  if (yyerrstatus == 3)
    {
      /* if just tried and failed to reuse lookahead token after an error, discard it.  */

      /* return failure if at end of input */
      if (yychar == YYEOF)
	YYABORT;

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif

      yychar = YYEMPTY;
    }

  /* Else will try to reuse lookahead token
     after shifting the error token.  */

  yyerrstatus = 3;		/* Each real token shifted decrements this */

  goto yyerrhandle;

yyerrdefault:  /* current state does not do anything special for the error token. */

#if 0
  /* This is wrong; only states that explicitly want error tokens
     should shift them.  */
  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  if (yyn) goto yydefault;
#endif

yyerrpop:   /* pop the current state because it cannot handle the error token */

  if (yyssp == yyss) YYABORT;
  yyvsp--;
  yystate = *--yyssp;
#ifdef YYLSP_NEEDED
  yylsp--;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "Error: state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

yyerrhandle:

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yyerrdefault;

  yyn += YYTERROR;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
    goto yyerrdefault;

  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrpop;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrpop;

  if (yyn == YYFINAL)
    YYACCEPT;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting error token, ");
#endif

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  yystate = yyn;
  goto yynewstate;

 yyacceptlab:
  /* YYACCEPT comes here.  */
  if (yyfree_stacks)
    {
      free (yyss);
      free (yyvs);
#ifdef YYLSP_NEEDED
      free (yyls);
#endif
    }
  return 0;

 yyabortlab:
  /* YYABORT comes here.  */
  if (yyfree_stacks)
    {
      free (yyss);
      free (yyvs);
#ifdef YYLSP_NEEDED
      free (yyls);
#endif
    }
  return 1;
}
#line 1573 "parser.y"



/*
 * Parse the specification.
 */

void parse(sipSpec *spec,FILE *fp,char *filename,char *cppMName,stringList *tsl)
{
        /* Initialise the spec. */
 
	spec -> cppmname = cppMName;
	spec -> namecache = NULL;
	spec -> moduleList = NULL;
	spec -> secondaries = NULL;
	spec -> ifacefiles = NULL;
	spec -> classes = NULL;
	spec -> classversions = NULL;
	spec -> mappedtypes = NULL;
	spec -> used = NULL;
	spec -> qobjclass = -1;
	spec -> exposed = NULL;
	spec -> enums = NULL;
	spec -> vars = NULL;
	spec -> othfuncs = NULL;
	spec -> overs = NULL;
	spec -> typedefs = NULL;
	spec -> versioncode = NULL;
	spec -> copying = NULL;
	spec -> hdrcode = NULL;
	spec -> exphdrcode = NULL;
	spec -> cppcode = NULL;
	spec -> prepycode = NULL;
	spec -> pycode = NULL;
	spec -> docs = NULL;
	spec -> mktemplates = NULL;
	spec -> sigargs = NULL;
	spec -> sigslots = FALSE;

	currentSpec = spec;
	timeSlotList = tsl;
	currentModule = NULL;
	currentMappedType = NULL;
	currentOverIsVirt = FALSE;
	currentIsStatic = FALSE;
	importDepth = -1;
	previousFile = NULL;
	currentVersion = 0;
	currentScopeIdx = 0;
	sectionFlags = 0;

	newModule(fp,filename,FALSE);
	spec -> module = currentModule;

	yyparse();

	handleEOF();
	handleEOM();
}


/*
 * Tell the parser that a complete file has now been read.
 */

void parserEOF(char *name,parserContext *pc)
{
	previousFile = sipStrdup(name);
	newContext = *pc;
}


/*
 * Append a class definition to a class list.  Append is needed specifically
 * for the list of super-classes because the order is important to Python.
 */

static void appendToClassList(classList **clp,classDef *cd)
{
	classList *new;

	/* Find the end of the list. */

	while (*clp != NULL)
		clp = &(*clp) -> next;

	new = sipMalloc(sizeof (classList));

	new -> c = cd;
	new -> next = NULL;

	*clp = new;
}


/*
 * Create a new module for the current specification and make it current.
 */

static void newModule(FILE *fp,char *filename,int inherit)
{
	parseFile(fp,filename,currentModule,inherit);

	currentModule = sipMalloc(sizeof (moduleDef));

	currentModule -> name = NULL;
	currentModule -> file = filename;
	currentModule -> depth = ++importDepth;
	currentModule -> timeSlots = NULL;
	currentModule -> nrTimeSlots = -1;
	currentModule -> required = NULL;
	currentModule -> next = currentSpec -> moduleList;

	currentSpec -> moduleList = currentModule;
}


/*
 * Switch to parsing a new file.
 */

static void parseFile(FILE *fp,char *name,moduleDef *prevmod,int inherit)
{
	parserContext pc;

	pc.ifdepth = currentVersion;
	pc.prevmod = prevmod;
	pc.inherit = inherit;

	setInputFile(fp,name,&pc);
}


/*
 * Find an interface file, or create a new one.
 */

static ifaceFileDef *findIfaceFile(sipSpec *pt,scopedNameDef *fqname)
{
	ifaceFileDef *iff;

	/* See if the name is already used. */

	for (iff = pt -> ifacefiles; iff != NULL; iff = iff -> next)
		if (sameScopedName(iff -> fqname,fqname))
			return iff;

	iff = sipMalloc(sizeof (ifaceFileDef));

	iff -> name = cacheName(pt,currentModule,scopedNameTail(fqname));
	iff -> fqname = fqname;
	iff -> module = NULL;
	iff -> ifacefileflags = 0;
	iff -> next = pt -> ifacefiles;

	pt -> ifacefiles = iff;

	return iff;
}


/*
 * Find a class definition in a parse tree.
 */

static classDef *findClass(sipSpec *pt,scopedNameDef *fqname)
{
	classDef *cd;
	ifaceFileDef *iff;

	/* See if the name is already used. */

	iff = findIfaceFile(pt,fqname);

	for (cd = pt -> classes; cd != NULL; cd = cd -> next)
		if (cd -> iff == iff)
			return cd;

	/*
	 * Create a new one.  For the moment we assume it will be defined in
	 * the same module.
	 */

	cd = sipMalloc(sizeof (classDef));

	cd -> iff = iff;
	cd -> classnr = -1;
	cd -> next = pt -> classes;

	pt -> classes = cd;

	return cd;
}


/*
 * Add an interface file to an interface file list if it isn't already there.
 */

void addToUsedList(ifaceFileList **ifflp,ifaceFileDef *iff)
{
	ifaceFileList *iffl;

	while ((iffl = *ifflp) != NULL)
	{
		/* Don't bother if it is already there. */

		if (iffl -> iff == iff)
			return;

		ifflp = &iffl -> next;
	}

	setIsUsed(iff);

	iffl = sipMalloc(sizeof (ifaceFileList));

	iffl -> iff = iff;
	iffl -> next = NULL;

	*ifflp = iffl;
}


/*
 * Check there is no module or version conflict for an interface file.
 */

static void checkIfaceFile(sipSpec *pt,ifaceFileDef *iff,versionDef *vd,argDef *ad)
{
	classVersDef *cvd;
	mappedTypeDef *mtd;

	if (iff -> module == NULL)
		iff -> module = currentModule;
	else if (iff -> module != currentModule)
	{
		fatalScopedName(iff -> fqname);
		fatal(" has already defined as a namespace, class or %%MappedType in another module\n");
	}

	for (cvd = pt -> classversions; cvd != NULL; cvd = cvd -> next)
		if (cvd -> common -> iff == iff && versionsOverlap(&cvd -> version,vd))
		{
			fatalScopedName(iff -> fqname);
			fatalVersion(pt,vd);
			fatal(" already defined as a class\n");
		}

	for (mtd = pt -> mappedtypes; mtd != NULL; mtd = mtd -> next)
		if (mtd -> iff == iff && versionsOverlap(&mtd -> version,vd))
		{
			/*
			 * We allow types based on the same template but with
			 * different arguments.
			 */

			if (ad != NULL && ad -> atype == template_type &&
			    !sameBaseType(ad,&mtd -> type,TRUE))
				continue;

			fatalScopedName(iff -> fqname);
			fatalVersion(pt,vd);
			fatal(" already defined as a %%MappedType\n");
		}

	if (isMainModule(iff -> module))
		addToUsedList(&pt -> used,iff);
}


/*
 * Find a namespace in the current module that matches the given name and
 * version.
 */

static classVersDef *findNamespace(sipSpec *pt,versionDef *vd,
				   scopedNameDef *fqname)
{
	classVersDef *cvd;

	for (cvd = pt -> classversions; cvd != NULL; cvd = cvd -> next)
	{
		/* It must be a namespace. */

		if (!isNamespace(cvd))
			continue;

		/* It must be in the current module. */

		if (currentModule != cvd -> common -> iff -> module)
			continue;

		/* It must have the same name. */

		if (!sameScopedName(fqname,cvd -> common -> iff -> fqname))
			continue;

		/* It must have a compatible version. */

		if (!versionsOverlap(vd,&cvd -> version))
			continue;

		break;
	}

	return cvd;
}


/*
 * Find an undefined (or create a new) class definition in a parse tree.
 */

static classVersDef *newClass(sipSpec *pt,versionDef *vd,scopedNameDef *fqname)
{
	classVersDef *cvd;
	classDef *cd;

	cd = findClass(pt,fqname);

	setHasClassVers(cd -> iff);

	/* Check the version hasn't already been defined. */

	checkIfaceFile(pt,cd -> iff,vd,NULL);

	/* Create the particular version. */

	cvd = sipMalloc(sizeof (classVersDef));

	cvd -> classversflags = 0;
	cvd -> common = cd;
	cvd -> ecvd = currentScope();
	cvd -> version = *vd;
	cvd -> supers = NULL;
	cvd -> hierachy = NULL;
	cvd -> ctors = NULL;
	cvd -> dtorcode = NULL;
	cvd -> members = NULL;
	cvd -> overs = NULL;
	cvd -> vmembers = NULL;
	cvd -> visible = NULL;
	cvd -> cppcode = NULL;
	cvd -> hdrcode = NULL;
	cvd -> convtosubcode = NULL;
	cvd -> convtocode = NULL;
	cvd -> canconvtocode = NULL;
	cvd -> spms = NULL;
	cvd -> combmeth = 0;
	cvd -> combmethx = 0;
	cvd -> combnummeth = 0;
	cvd -> combnummethx = 0;
	cvd -> combseqmeth = 0;
	cvd -> combseqmethx = 0;
	cvd -> combmapmeth = 0;
	cvd -> combmapmethx = 0;
	cvd -> combcmpmeth = 0;
	cvd -> combcmpmethx = 0;
	cvd -> used = NULL;
	cvd -> next = pt -> classversions;

	pt -> classversions = cvd;

	return cvd;
}


/*
 * Tidy up after finishing a class definition.
 */

static void finishClass(classVersDef *cvd)
{
	overDef *od;

	if (cvd -> ctors == NULL)
	{
		/* Provide a default ctor. */

		cvd -> ctors = sipMalloc(sizeof (ctorDef));
 
		cvd -> ctors -> args.nrArgs = 0;
		cvd -> ctors -> cppcode = NULL;
		cvd -> ctors -> version = cvd -> version;
		cvd -> ctors -> next = NULL;

		resetCannotCreate(cvd);
	}

	/* We can't create this class if it has private abstract functions. */

	for (od = cvd -> overs; od != NULL; od = od -> next)
		if (isAbstract(od) && isPrivate(od))
		{
			setCannotCreate(cvd);
			break;
		}
}


/*
 * Create a new mapped type.
 */

static mappedTypeDef *newMappedType(sipSpec *pt,argDef *ad,versionDef *vd)
{
	mappedTypeDef *mtd;
	scopedNameDef *snd;
	ifaceFileDef *iff;

	/* Check that the type is one we want to map. */

	switch (ad -> atype)
	{
	case defined_type:
		snd = ad -> u.snd;
		break;

	case template_type:
		snd = ad -> u.td -> fqname;
		break;

	case struct_type:
		snd = ad -> u.sname;
		break;

	default:
		yyerror("Invalid type for %MappedType");
	}

	iff = findIfaceFile(pt,snd);

	setHasMappedType(iff);

	/* Check the version hasn't already been defined. */

	checkIfaceFile(pt,iff,vd,ad);

	/* Create a new mapped type. */

	mtd = sipMalloc(sizeof (mappedTypeDef));

	mtd -> type = *ad;
	mtd -> iff = iff;
	mtd -> version = *vd;
	mtd -> hdrcode = NULL;
	mtd -> convfromcode = NULL;
	mtd -> convtocode = NULL;
	mtd -> canconvtocode = NULL;
	mtd -> next = pt -> mappedtypes;

	pt -> mappedtypes = mtd;

	return mtd;
}


/*
 * Create a new enum.
 */

static void newEnum(sipSpec *pt,versionDef *vd,moduleDef *mod,char *name,int flags,enumValueDef *values)
{
	enumDef *ed;
	classVersDef *escope = currentScope();
	enumValueDef *evd;

	/* Check a version of a value doesn't already exist. */

	for (evd = values; evd != NULL; evd = evd -> next)
		checkAttributes(pt,escope,evd -> name,vd,enum_attr);

	ed = sipMalloc(sizeof (enumDef));

	ed -> fqname = (name != NULL ? text2scopedName(name) : NULL);
	ed -> ecvd = escope;
	ed -> module = mod;
	ed -> values = values;
	ed -> version = *vd;
	ed -> next = pt -> enums;

	pt -> enums = ed;
}


/*
 * Create a new typedef.
 */

static void newTypedef(sipSpec *pt,versionDef *vd,char *name,argDef *type)
{
	typedefDef *td;
	scopedNameDef *fqname = text2scopedName(name);

	/* Check a version doesn't already exist. */

	for (td = pt -> typedefs; td != NULL; td = td -> next)
		if (sameScopedName(td -> fqname,fqname) && versionsOverlap(&td -> version,vd))
		{
			fatalScopedName(fqname);
			fatalVersion(pt,vd);
			fatal(" already defined\n");
		}

	td = sipMalloc(sizeof (typedefDef));

	td -> fqname = fqname;
	td -> ecvd = currentScope();
	td -> type = *type;
	td -> version = *vd;
	td -> next = pt -> typedefs;

	pt -> typedefs = td;
}


/*
 * Create a new variable.
 */

static void newVar(sipSpec *pt,versionDef *vd,moduleDef *mod,char *name,
		   int isstatic,argDef *type,codeBlock *code)
{
	varDef *var;
	classVersDef *escope = currentScope();
	nameDef *nd = cacheName(pt,mod,name);

	checkAttributes(pt,escope,nd,vd,var_attr);

	var = sipMalloc(sizeof (varDef));

	var -> name = nd;
	var -> fqname = text2scopedName(name);
	var -> ecvd = escope;
	var -> module = mod;
	var -> varflags = 0;
	var -> type = *type;
	var -> version = *vd;
	var -> accessfunc = code;
	var -> next = pt -> vars;

	if (isstatic)
		setIsStaticVar(var);

	pt -> vars = var;
}


/*
 * Create a new special method.
 */

static void newSpecialMethod(versionDef *vd,char *name,int sectFlags,codeBlock *code)
{
	spmDef *sd;
	classVersDef *cvd = currentScope();
	int *comb, *combx;
	specialPyMethod *spm;

	/* Find the method according to the section. */

	if (sectFlags & SECT_IS_PYMETHOD)
	{
		spm = pyMethods;
		comb = &cvd -> combmeth;
		combx = &cvd -> combmethx;
	}
	else if (sectFlags & SECT_IS_PYNUMMETHOD)
	{
		spm = pyNumMethods;
		comb = &cvd -> combnummeth;
		combx = &cvd -> combnummethx;
	}
	else if (sectFlags & SECT_IS_PYSEQMETHOD)
	{
		spm = pySeqMethods;
		comb = &cvd -> combseqmeth;
		combx = &cvd -> combseqmethx;
	}
	else if (sectFlags & SECT_IS_PYMAPMETHOD)
	{
		spm = pyMapMethods;
		comb = &cvd -> combmapmeth;
		combx = &cvd -> combmapmethx;
	}
	else
		yyerror("Special Python methods must be in the PyMethods, PyNumberMethods, PySequenceMethods or PyMappingMethods sections");

	while (spm -> name != NULL)
	{
		if (strcmp(spm -> name,name) == 0)
			break;

		++spm;
	}

	if (spm -> name == NULL)
		yyerror("Invalid special Python method for this section");

	/* Check one of the same name (not ID) hasn't already been given. */

	for (sd = cvd -> spms; sd != NULL; sd = sd -> next)
		if (strcmp(sd -> spm -> name,name) == 0 && versionsOverlap(&sd -> version,vd))
			yyerror("Different versions of special Python method overlap");

	sd = sipMalloc(sizeof (spmDef));

	sd -> spm = spm;
	sd -> version = *vd;
	sd -> code = code;
	sd -> next = cvd -> spms;

	cvd -> spms = sd;

	*comb |= spm -> id;
	*combx |= spm -> idxtra;
}


/*
 * Create a new ctor.
 */

static void newCtor(versionDef *vd,char *name,int sectFlags,funcArgs *args,codeBlock *code)
{
	ctorDef *ct, **ctp;
	classVersDef *cvd = currentScope();

	/* Check the name of the constructor. */

	if (strcmp(classVersBaseName(cvd),name) != 0)
		yyerror("Constructor doesn't have the same name as its class");

	/*
	 * Find the end of the list and, at the same time, check for any
	 * existing one with the same signature and version.
	 */

	for (ctp = &cvd -> ctors; *ctp != NULL; ctp = &(*ctp) -> next)
		if (sameFuncArgs(&(*ctp) -> args,args,FALSE) && versionsOverlap(&(*ctp) -> version,vd))
			yyerror("Different versions of ctor with the same Python signature overlap");

	/* Add to the list of constructors. */

	ct = sipMalloc(sizeof (ctorDef));

	ct -> ctorflags = sectFlags;
	ct -> args = *args;
	ct -> cppcode = code;
	ct -> version = *vd;
	ct -> next = NULL;

	if (isProtectedCtor(ct))
		setIsComplex(cvd);

	if (!isPrivateCtor(ct))
		resetCannotCreate(cvd);

	*ctp = ct;
}


/*
 * Create a new function.
 */

static void newFunction(sipSpec *pt,versionDef *vd,moduleDef *mod,int sflags,
			int isstatic,int isvirt,argDef *type,char *name,
			funcArgs *args,int isconst,int isabstract,
			optFlags *optflgs,codeBlock *mcode,codeBlock *vcode)
{
	classVersDef *cvd = currentScope();
	char *pname;
	overDef *od, **odp, **headp;
	optFlag *of;

	headp = (cvd != NULL ?  &cvd -> overs : &pt -> overs);

	/* Use the C++ name if a Python name wasn't given. */

	if ((of = findOptFlag(optflgs,"PyName",name_flag)) != NULL)
		pname = of -> fvalue.sval;
	else
		pname = name;

	/* Create a new overload definition. */

	od = sipMalloc(sizeof (overDef));

	/* Set the overload flags. */

	od -> overflags = sflags;

	if (isProtected(od))
		setIsComplex(cvd);

	if ((isSlot(od) || isSignal(od)) && !isPrivate(od))
	{
		if (isSignal(od))
			setIsComplex(cvd);

		pt -> sigslots = TRUE;
	}

	if (isstatic)
	{
		if (!isPublic(od) || isSlot(od) || isSignal(od))
			yyerror("Static functions must be public");

		if (isvirt)
			yyerror("Static functions cannot be virtual");

		setIsStatic(od);
	}

	if (isconst)
		setIsConst(od);

	if (isabstract)
	{
		if (sflags == 0)
			yyerror("Non-class function specified as abstract");

		if (mcode != NULL)
			yyerror("Cannot provide member code for abstract functions");

		setIsAbstract(od);
	}

	if (findOptFlag(optflgs,"ReleaseLock",bool_flag) != NULL)
		setIsBlocking(od);

	if (isvirt)
	{
		if (isSignal(od))
			yyerror("Virtual signals aren't supported");

		setIsVirtual(od);
		setIsComplex(cvd);
	}
	else if (vcode != NULL)
		yyerror("Virtual code provided for non-virtual function");

	od -> cppname = name;
	od -> args = *args;
	od -> cppcode = mcode;
	od -> virtcode = vcode;
	od -> version = *vd;
	od -> common = findFunction(pt,vd,mod,cvd,pname);

	if ((of = findOptFlag(optflgs,"PreHook",name_flag)) != NULL)
		od -> prehook = of -> fvalue.sval;
	else
		od -> prehook = NULL;

	if ((of = findOptFlag(optflgs,"PostHook",name_flag)) != NULL)
		od -> posthook = of -> fvalue.sval;
	else
		od -> posthook = NULL;

	if (type -> atype == voidptr_type && type -> nrderefs == 0)
		od -> result = NULL;
	else
	{
		od -> result = sipMalloc(sizeof (argDef));
		*od -> result = *type;
	}

	od -> next = NULL;

	/*
	 * Find the end of the list and, at the same time, check for any
	 * existing one with the same signature and an overlapping version, and
	 * that if one is static they all are.
	 */

	for (odp = headp; *odp != NULL; odp = &(*odp) -> next)
	{
		if ((*odp) -> common != od -> common)
			continue;

		if (!sameOverload(*odp,od,FALSE))
			continue;

		if (versionsOverlap(&(*odp) -> version,vd))
			yyerror("Different versions of function with the same Python signature overlap");

		if (isStatic(*odp) != isStatic(od))
			yyerror("Cannot mix static and non-static member functions with the same Python name");
	}

	*odp = od;
}


/*
 * Cache a name in a module.
 */

static nameDef *cacheName(sipSpec *pt,moduleDef *mod,char *name)
{
	nameDef *nd;

	/* See if it already exists. */

	for (nd = pt -> namecache; nd != NULL; nd = nd -> next)
		if (strcmp(nd -> text,name) == 0)
		{
			/*
			 * Use the module that is deepest in the import
			 * hierachy.  This will guarantee it really exists.
			 */

			if (nd -> module -> depth < mod -> depth)
				nd -> module = mod;

			return nd;
		}

	/* Create a new one. */

	nd = sipMalloc(sizeof (nameDef));

	nd -> text = name;
	nd -> module = mod;
	nd -> next = pt -> namecache;

	pt -> namecache = nd;

	return nd;
}


/*
 * Find (or create) an overloaded function name.
 */

static memberDef *findFunction(sipSpec *pt,versionDef *vd,moduleDef *mod,
			       classVersDef *cvd,char *pname)
{
	memberDef *md, **flist;
	nameDef *pnd;

	/* Cache the name. */

	pnd = cacheName(pt,mod,pname);

	/* Check there is no name clash. */

	checkAttributes(pt,cvd,pnd,vd,func_attr);

	/* See if it already exists. */

	flist = (cvd != NULL ? &cvd -> members : &pt -> othfuncs);

	for (md = *flist; md != NULL; md = md -> next)
		if (md -> pyname == pnd)
			return md;

	/* Create a new one. */

	md = sipMalloc(sizeof (memberDef));

	md -> pyname = pnd;
	md -> module = mod;
	md -> next = *flist;

	*flist = md;

	return md;
}


/*
 * Get the current version or NULL if we are not interested in the current
 * version.  currentScope() is only valid if getVersion() returns non-NULL.
 */

static versionDef *getVersion(void)
{
	static versionDef vers;

	if (currentVersion > 0)
	{
		versionRange *vr = &versScope[currentVersion - 1];
		int req = currentModule -> required -> order;

		if (vr -> lowidx <= req && req < vr -> uppidx)
			vers.secondary = vr -> secondary;
		else
			return NULL;
	}
	else
		vers.secondary = NULL;

	return &vers;
}


/*
 * Search a set of flags for a particular one and check its type.
 */

static optFlag *findOptFlag(optFlags *flgs,char *name,flagType ft)
{
	int f;

	for (f = 0; f < flgs -> nrFlags; ++f)
		if (strcmp(flgs -> flags[f].fname,name) == 0)
		{
			if (flgs -> flags[f].ftype != ft)
				yyerror("Optional flag has a value of the wrong type");

			return &flgs -> flags[f];
		}

	return NULL;
}


/*
 * A name is going to be used as a Python attribute name with in a Python scope
 * (ie. a Python dictionary), so check against what we already know is going in
 * the same scope in case there is a clash.
 */

static void checkAttributes(sipSpec *pt,classVersDef *pyscope,nameDef *attr,
			    versionDef *attrvd,attrType at)
{
	enumDef *ed;
	varDef *vd;
	classVersDef *cvd;

	/* Check the enum values. */

	for (ed = pt -> enums; ed != NULL; ed = ed -> next)
	{
		enumValueDef *evd;

		if (ed -> ecvd != pyscope)
			continue;

		if (!versionsOverlap(&ed -> version,attrvd))
			continue;

		for (evd = ed -> values; evd != NULL; evd = evd -> next)
			if (evd -> name == attr)
				yyerror("There is already an enum value in scope with the same Python name");
	}

	/* Check the variables. */

	for (vd = pt -> vars; vd != NULL; vd = vd -> next)
	{
		if (vd -> ecvd != pyscope)
			continue;

		if (vd -> name != attr)
			continue;

		if (!versionsOverlap(&vd -> version,attrvd))
			continue;

		yyerror("There is already a variable in scope with the same Python name");
	}

	/*
	 * Only check the members if this attribute isn't a member because we
	 * can handle members with the same name in the same scope.
	 */

	if (at != func_attr)
	{
		memberDef *md, *membs;

		membs = (pyscope != NULL ? pyscope -> members : pt -> othfuncs);

		for (md = membs; md != NULL; md = md -> next)
		{
			overDef *od, *overs;

			if (md -> pyname != attr)
				continue;

			/* Check for version conflict with all overloads. */

			overs = (pyscope != NULL ? pyscope -> overs : pt -> overs);

			for (od = overs; od != NULL; od = od -> next)
			{
				if (od -> common != md)
					continue;

				if (!versionsOverlap(&od -> version,attrvd))
					continue;

				yyerror("There is already a function in scope with the same Python name");
			}
		}
	}

	/* Check the classes. */

	for (cvd = pt -> classversions; cvd != NULL; cvd = cvd -> next)
	{
		if (cvd -> ecvd != pyscope)
			continue;

		if (cvd -> common -> iff -> name != attr)
			continue;

		if (!versionsOverlap(&cvd -> version,attrvd))
			continue;

		yyerror("There is already a class or namespace in scope with the same Python name");
	}
}


/*
 * Append a code block to a list of them.  Append is needed to give the
 * specifier easy control over the order of the documentation.
 */

static void appendCodeBlock(codeBlock **headp,codeBlock *new)
{
	while (*headp != NULL)
		headp = &(*headp) -> next;

	*headp = new;
}


/*
 * Check if two version qualifiers overlap, ie both might be true at the same
 * time.
 */

int versionsOverlap(versionDef *vd1,versionDef *vd2)
{
	/* Can't overlap if both have secondaries and they are different. */

	if (vd1 -> secondary != NULL && vd2 -> secondary != NULL && vd1 -> secondary != vd2 -> secondary)
		return FALSE;

	return TRUE;
}


/*
 * Handle the end of a fully parsed a file.
 */

static void handleEOF()
{
	/*
	 * Check that the number of nested if's is the same as when we started
	 * the file.
	 */

	if (currentVersion > newContext.ifdepth)
		fatal("Too many %%If statements in %s\n",previousFile);

	if (currentVersion < newContext.ifdepth)
		fatal("Too many %%End statements in %s\n",previousFile);
}


/*
 * Handle the end of a fully parsed a module.
 */

static void handleEOM()
{
	/* Check it has been named. */

	if (currentModule -> name == NULL)
		fatal("No %%Module has been specified for module defined in %s\n",previousFile);

	/* Check is has any primary versions ordered. */

	if (currentModule -> timeSlots != NULL && currentModule -> nrTimeSlots < 0)
		fatal("No %%PrimaryOrder has been specified for module with primary versions\n");

	/* Inherit the timeline if requested. */

	if (newContext.inherit)
	{
		newContext.prevmod -> timeSlots = currentModule -> timeSlots;
		newContext.prevmod -> nrTimeSlots = currentModule -> nrTimeSlots;
		newContext.prevmod -> required = currentModule -> required;
	}

	/* The previous module is now current. */

	currentModule = newContext.prevmod;

	--importDepth;
}


/*
 * Find an existing version qualifier in a list.
 */

static versionQual *findQualifier(versionQual *vq,char *name)
{
	while (vq != NULL)
	{
		if (strcmp(vq -> name,name) == 0)
			break;

		vq = vq -> next;
	}

	return vq;
}


/*
 * Return a copy of a scoped name.
 */

scopedNameDef *copyScopedName(scopedNameDef *snd)
{
	scopedNameDef *head;

	head = NULL;

	while (snd != NULL)
	{
		appendScopedName(&head,text2scopePart(snd -> name));
		snd = snd -> next;
	}

	return head;
}


/*
 * Append a name to a list of scopes.
 */

void appendScopedName(scopedNameDef **headp,scopedNameDef *newsnd)
{
	while (*headp != NULL)
		headp = &(*headp) -> next;

	*headp = newsnd;
}


/*
 * Free a scoped name - but not the text itself.
 */

void freeScopedName(scopedNameDef *snd)
{
	while (snd != NULL)
	{
		scopedNameDef *next = snd -> next;

		free(snd);

		snd = next;
	}
}


/*
 * Convert a text string to a scope part structure.
 */

scopedNameDef *text2scopePart(char *text)
{
	scopedNameDef *snd;

	snd = sipMalloc(sizeof (scopedNameDef));

	snd -> name = text;
	snd -> next = NULL;

	return snd;
}


/*
 * Convert a text string to a fully scoped name.
 */

static scopedNameDef *text2scopedName(char *text)
{
	classVersDef *cvd = currentScope();
	scopedNameDef *snd;

	snd = (cvd != NULL ? copyScopedName(cvd -> common -> iff -> fqname) : NULL);

	appendScopedName(&snd,text2scopePart(text));

	return snd;
}


/*
 * Return a pointer to the tail part of a scoped name.
 */

char *scopedNameTail(scopedNameDef *snd)
{
	if (snd == NULL)
		return NULL;

	while (snd -> next != NULL)
		snd = snd -> next;

	return snd -> name;
}


/*
 * Push the given scope onto the scope stack.
 */

static void pushScope(classVersDef *scope)
{
	if (currentScopeIdx >= MAX_NESTED_SCOPE)
		fatal("Internal error: increase the value of MAX_NESTED_SCOPE\n");

	scopeStack[currentScopeIdx] = scope;
	sectFlagsStack[currentScopeIdx] = sectionFlags;

	++currentScopeIdx;
}


/*
 * Pop the scope stack.
 */

static void popScope(void)
{
	if (currentScopeIdx > 0)
		sectionFlags = sectFlagsStack[currentScopeIdx--];
}


/*
 * Return the current scope.  currentScope() is only valid if getVersion()
 * returns non-NULL.
 */

static classVersDef *currentScope(void)
{
	return (currentScopeIdx > 0 ? scopeStack[currentScopeIdx - 1] : NULL);
}


/*
 * Create a new version qualifier.
 */

static versionQual *newVersion(sipSpec *pt,moduleDef *mod,int order,char *name,char *cpp,char *py)
{
	versionQual *vq, **headp;

	/* We check secondaries anyway. */

	if (findQualifier(pt -> secondaries,name) != NULL)
		yyerror("Version already defined as a secondary");

	/*
	 * If we are adding a secondary check primaries in every module.  If
	 * adding a primary then check other primaries defined in this module.
	 */

	if (order < 0)
	{
		moduleDef *md;

		for (md = pt -> moduleList; md != NULL; md = md -> next)
			if (findQualifier(md -> timeSlots,name) != NULL)
				yyerror("Secondary version already defined as a primary");

		headp = &pt -> secondaries;
	}
	else if (findQualifier(mod -> timeSlots,name) != NULL)
		yyerror("Primary version already defined in the same module");
	else
		headp = &mod -> timeSlots;

	vq = sipMalloc(sizeof (versionQual));

	vq -> name = name;
	vq -> module = mod;
	vq -> order = order;
	vq -> vqcpp = cpp;
	vq -> vqpy = py;
	vq -> next = *headp;

	*headp = vq;

	return vq;
}


/*
 * Create a new imported module.
 */

static void newImport(sipSpec *pt,char *name,int inherit)
{
	/* Ignore if the file has already been imported. */

	moduleDef *mod;

	for (mod = pt -> moduleList; mod != NULL; mod = mod -> next)
		if (strcmp(mod -> file,name) == 0)
			return;

	newModule(NULL,name,inherit);
}