1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
|
/* A Bison parser, made by GNU Bison 2.4.1. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
There are some unavoidable exceptions within include files to
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
/* Identify Bison output. */
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "2.4.1"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
/* Pure parsers. */
#define YYPURE 1
/* Push parsers. */
#define YYPUSH 0
/* Pull parsers. */
#define YYPULL 1
/* Using locations. */
#define YYLSP_NEEDED 1
/* Copy the first part of user declarations. */
/* Line 189 of yacc.c */
#line 1 "program_parse.y"
/*
* Copyright © 2009 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "main/mtypes.h"
#include "main/imports.h"
#include "shader/program.h"
#include "shader/prog_parameter.h"
#include "shader/prog_parameter_layout.h"
#include "shader/prog_statevars.h"
#include "shader/prog_instruction.h"
#include "shader/symbol_table.h"
#include "shader/program_parser.h"
extern void *yy_scan_string(char *);
extern void yy_delete_buffer(void *);
static struct asm_symbol *declare_variable(struct asm_parser_state *state,
char *name, enum asm_type t, struct YYLTYPE *locp);
static int add_state_reference(struct gl_program_parameter_list *param_list,
const gl_state_index tokens[STATE_LENGTH]);
static int initialize_symbol_from_state(struct gl_program *prog,
struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
static int initialize_symbol_from_param(struct gl_program *prog,
struct asm_symbol *param_var, const gl_state_index tokens[STATE_LENGTH]);
static int initialize_symbol_from_const(struct gl_program *prog,
struct asm_symbol *param_var, const struct asm_vector *vec,
GLboolean allowSwizzle);
static int yyparse(struct asm_parser_state *state);
static char *make_error_string(const char *fmt, ...);
static void yyerror(struct YYLTYPE *locp, struct asm_parser_state *state,
const char *s);
static int validate_inputs(struct YYLTYPE *locp,
struct asm_parser_state *state);
static void init_dst_reg(struct prog_dst_register *r);
static void set_dst_reg(struct prog_dst_register *r,
gl_register_file file, GLint index);
static void init_src_reg(struct asm_src_register *r);
static void set_src_reg(struct asm_src_register *r,
gl_register_file file, GLint index);
static void set_src_reg_swz(struct asm_src_register *r,
gl_register_file file, GLint index, GLuint swizzle);
static void asm_instruction_set_operands(struct asm_instruction *inst,
const struct prog_dst_register *dst, const struct asm_src_register *src0,
const struct asm_src_register *src1, const struct asm_src_register *src2);
static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op,
const struct prog_dst_register *dst, const struct asm_src_register *src0,
const struct asm_src_register *src1, const struct asm_src_register *src2);
static struct asm_instruction *asm_instruction_copy_ctor(
const struct prog_instruction *base, const struct prog_dst_register *dst,
const struct asm_src_register *src0, const struct asm_src_register *src1,
const struct asm_src_register *src2);
#ifndef FALSE
#define FALSE 0
#define TRUE (!FALSE)
#endif
#define YYLLOC_DEFAULT(Current, Rhs, N) \
do { \
if (YYID(N)) { \
(Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC(Rhs, 1).first_column; \
(Current).position = YYRHSLOC(Rhs, 1).position; \
(Current).last_line = YYRHSLOC(Rhs, N).last_line; \
(Current).last_column = YYRHSLOC(Rhs, N).last_column; \
} else { \
(Current).first_line = YYRHSLOC(Rhs, 0).last_line; \
(Current).last_line = (Current).first_line; \
(Current).first_column = YYRHSLOC(Rhs, 0).last_column; \
(Current).last_column = (Current).first_column; \
(Current).position = YYRHSLOC(Rhs, 0).position \
+ (Current).first_column; \
} \
} while(YYID(0))
#define YYLEX_PARAM state->scanner
/* Line 189 of yacc.c */
#line 193 "program_parse.tab.c"
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 1
#endif
/* Enabling the token table. */
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE 0
#endif
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
ARBvp_10 = 258,
ARBfp_10 = 259,
ADDRESS = 260,
ALIAS = 261,
ATTRIB = 262,
OPTION = 263,
OUTPUT = 264,
PARAM = 265,
TEMP = 266,
END = 267,
BIN_OP = 268,
BINSC_OP = 269,
SAMPLE_OP = 270,
SCALAR_OP = 271,
TRI_OP = 272,
VECTOR_OP = 273,
ARL = 274,
KIL = 275,
SWZ = 276,
TXD_OP = 277,
INTEGER = 278,
REAL = 279,
AMBIENT = 280,
ATTENUATION = 281,
BACK = 282,
CLIP = 283,
COLOR = 284,
DEPTH = 285,
DIFFUSE = 286,
DIRECTION = 287,
EMISSION = 288,
ENV = 289,
EYE = 290,
FOG = 291,
FOGCOORD = 292,
FRAGMENT = 293,
FRONT = 294,
HALF = 295,
INVERSE = 296,
INVTRANS = 297,
LIGHT = 298,
LIGHTMODEL = 299,
LIGHTPROD = 300,
LOCAL = 301,
MATERIAL = 302,
MAT_PROGRAM = 303,
MATRIX = 304,
MATRIXINDEX = 305,
MODELVIEW = 306,
MVP = 307,
NORMAL = 308,
OBJECT = 309,
PALETTE = 310,
PARAMS = 311,
PLANE = 312,
POINT_TOK = 313,
POINTSIZE = 314,
POSITION = 315,
PRIMARY = 316,
PROGRAM = 317,
PROJECTION = 318,
RANGE = 319,
RESULT = 320,
ROW = 321,
SCENECOLOR = 322,
SECONDARY = 323,
SHININESS = 324,
SIZE_TOK = 325,
SPECULAR = 326,
SPOT = 327,
STATE = 328,
TEXCOORD = 329,
TEXENV = 330,
TEXGEN = 331,
TEXGEN_Q = 332,
TEXGEN_R = 333,
TEXGEN_S = 334,
TEXGEN_T = 335,
TEXTURE = 336,
TRANSPOSE = 337,
TEXTURE_UNIT = 338,
TEX_1D = 339,
TEX_2D = 340,
TEX_3D = 341,
TEX_CUBE = 342,
TEX_RECT = 343,
TEX_SHADOW1D = 344,
TEX_SHADOW2D = 345,
TEX_SHADOWRECT = 346,
TEX_ARRAY1D = 347,
TEX_ARRAY2D = 348,
TEX_ARRAYSHADOW1D = 349,
TEX_ARRAYSHADOW2D = 350,
VERTEX = 351,
VTXATTRIB = 352,
WEIGHT = 353,
IDENTIFIER = 354,
USED_IDENTIFIER = 355,
MASK4 = 356,
MASK3 = 357,
MASK2 = 358,
MASK1 = 359,
SWIZZLE = 360,
DOT_DOT = 361,
DOT = 362
};
#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
/* Line 214 of yacc.c */
#line 126 "program_parse.y"
struct asm_instruction *inst;
struct asm_symbol *sym;
struct asm_symbol temp_sym;
struct asm_swizzle_mask swiz_mask;
struct asm_src_register src_reg;
struct prog_dst_register dst_reg;
struct prog_instruction temp_inst;
char *string;
unsigned result;
unsigned attrib;
int integer;
float real;
gl_state_index state[STATE_LENGTH];
int negate;
struct asm_vector vector;
gl_inst_opcode opcode;
struct {
unsigned swz;
unsigned rgba_valid:1;
unsigned xyzw_valid:1;
unsigned negate:1;
} ext_swizzle;
/* Line 214 of yacc.c */
#line 364 "program_parse.tab.c"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct YYLTYPE
{
int first_line;
int first_column;
int last_line;
int last_column;
} YYLTYPE;
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
# define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1
#endif
/* Copy the second part of user declarations. */
/* Line 264 of yacc.c */
#line 271 "program_parse.y"
extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param,
void *yyscanner);
/* Line 264 of yacc.c */
#line 395 "program_parse.tab.c"
#ifdef short
# undef short
#endif
#ifdef YYTYPE_UINT8
typedef YYTYPE_UINT8 yytype_uint8;
#else
typedef unsigned char yytype_uint8;
#endif
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
#elif (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
typedef signed char yytype_int8;
#else
typedef short int yytype_int8;
#endif
#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
typedef unsigned short int yytype_uint16;
#endif
#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
typedef short int yytype_int16;
#endif
#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
# define YYSIZE_T unsigned int
# endif
#endif
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
# if YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid)
# endif
# endif
# ifndef YY_
# define YY_(msgid) msgid
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(e) ((void) (e))
#else
# define YYUSE(e) /* empty */
#endif
/* Identity function, used to suppress warnings about constant conditions. */
#ifndef lint
# define YYID(n) (n)
#else
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static int
YYID (int yyi)
#else
static int
YYID (yyi)
int yyi;
#endif
{
return yyi;
}
#endif
#if ! defined yyoverflow || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */
# ifdef YYSTACK_USE_ALLOCA
# if YYSTACK_USE_ALLOCA
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
# elif defined __BUILTIN_VA_ARG_INCR
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
# elif defined _AIX
# define YYSTACK_ALLOC __alloca
# elif defined _MSC_VER
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef _STDLIB_H
# define _STDLIB_H 1
# endif
# endif
# endif
# endif
# endif
# ifdef YYSTACK_ALLOC
/* Pacify GCC's `empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
to allow for a few compiler-allocated temporary stack slots. */
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
# endif
# else
# define YYSTACK_ALLOC YYMALLOC
# define YYSTACK_FREE YYFREE
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
# if (defined __cplusplus && ! defined _STDLIB_H \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef _STDLIB_H
# define _STDLIB_H 1
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# endif
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
|| (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
&& defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
{
yytype_int16 yyss_alloc;
YYSTYPE yyvs_alloc;
YYLTYPE yyls_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ 2 * YYSTACK_GAP_MAXIMUM)
/* Copy COUNT objects from FROM to TO. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else
# define YYCOPY(To, From, Count) \
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
while (YYID (0))
# endif
# endif
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (YYID (0))
#endif
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 5
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 396
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 120
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 143
/* YYNRULES -- Number of rules. */
#define YYNRULES 282
/* YYNRULES -- Number of states. */
#define YYNSTATES 475
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 362
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
static const yytype_uint8 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, 2, 2, 2, 2, 2, 2, 2,
115, 116, 2, 113, 109, 114, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 108,
2, 117, 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, 111, 2, 112, 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, 118, 110, 119, 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, 2, 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
};
#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
YYRHS. */
static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 8, 10, 12, 15, 16, 20, 23,
24, 27, 30, 32, 34, 36, 38, 40, 42, 44,
46, 48, 50, 52, 54, 59, 64, 69, 76, 83,
92, 101, 104, 107, 120, 123, 125, 127, 129, 131,
133, 135, 137, 139, 141, 143, 145, 147, 154, 157,
162, 165, 167, 171, 177, 181, 184, 192, 195, 197,
199, 201, 203, 208, 210, 212, 214, 216, 218, 220,
222, 226, 227, 230, 233, 235, 237, 239, 241, 243,
245, 247, 249, 251, 252, 254, 256, 258, 260, 261,
265, 269, 270, 273, 276, 278, 280, 282, 284, 286,
288, 290, 292, 297, 300, 303, 305, 308, 310, 313,
315, 318, 323, 328, 330, 331, 335, 337, 339, 342,
344, 347, 349, 351, 355, 362, 363, 365, 368, 373,
375, 379, 381, 383, 385, 387, 389, 391, 393, 395,
397, 399, 402, 405, 408, 411, 414, 417, 420, 423,
426, 429, 432, 435, 439, 441, 443, 445, 451, 453,
455, 457, 460, 462, 464, 467, 469, 472, 479, 481,
485, 487, 489, 491, 493, 495, 500, 502, 504, 506,
508, 510, 512, 515, 517, 519, 525, 527, 530, 532,
534, 540, 543, 544, 551, 555, 556, 558, 560, 562,
564, 566, 569, 571, 573, 576, 581, 586, 587, 591,
593, 595, 597, 600, 602, 604, 606, 608, 614, 616,
620, 626, 632, 634, 638, 644, 646, 648, 650, 652,
654, 656, 658, 660, 662, 666, 672, 680, 690, 693,
696, 698, 700, 701, 702, 707, 709, 710, 711, 715,
719, 721, 727, 730, 733, 736, 739, 743, 746, 750,
751, 753, 755, 756, 758, 760, 761, 763, 765, 766,
768, 770, 771, 775, 776, 780, 781, 785, 787, 789,
791, 796, 798
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int16 yyrhs[] =
{
121, 0, -1, 122, 123, 125, 12, -1, 3, -1,
4, -1, 123, 124, -1, -1, 8, 262, 108, -1,
125, 126, -1, -1, 127, 108, -1, 170, 108, -1,
128, -1, 129, -1, 130, -1, 131, -1, 132, -1,
133, -1, 134, -1, 135, -1, 141, -1, 136, -1,
137, -1, 138, -1, 19, 146, 109, 142, -1, 18,
145, 109, 144, -1, 16, 145, 109, 142, -1, 14,
145, 109, 142, 109, 142, -1, 13, 145, 109, 144,
109, 144, -1, 17, 145, 109, 144, 109, 144, 109,
144, -1, 15, 145, 109, 144, 109, 139, 109, 140,
-1, 20, 144, -1, 20, 166, -1, 22, 145, 109,
144, 109, 144, 109, 144, 109, 139, 109, 140, -1,
83, 256, -1, 84, -1, 85, -1, 86, -1, 87,
-1, 88, -1, 89, -1, 90, -1, 91, -1, 92,
-1, 93, -1, 94, -1, 95, -1, 21, 145, 109,
150, 109, 147, -1, 241, 143, -1, 241, 110, 143,
110, -1, 150, 162, -1, 238, -1, 241, 150, 163,
-1, 241, 110, 150, 163, 110, -1, 151, 164, 165,
-1, 159, 161, -1, 148, 109, 148, 109, 148, 109,
148, -1, 241, 149, -1, 23, -1, 262, -1, 100,
-1, 172, -1, 152, 111, 153, 112, -1, 186, -1,
249, -1, 100, -1, 100, -1, 154, -1, 155, -1,
23, -1, 159, 160, 156, -1, -1, 113, 157, -1,
114, 158, -1, 23, -1, 23, -1, 100, -1, 104,
-1, 104, -1, 104, -1, 104, -1, 101, -1, 105,
-1, -1, 101, -1, 102, -1, 103, -1, 104, -1,
-1, 115, 166, 116, -1, 115, 167, 116, -1, -1,
168, 163, -1, 169, 163, -1, 99, -1, 100, -1,
171, -1, 178, -1, 242, -1, 245, -1, 248, -1,
261, -1, 7, 99, 117, 172, -1, 96, 173, -1,
38, 177, -1, 60, -1, 98, 175, -1, 53, -1,
29, 254, -1, 37, -1, 74, 255, -1, 50, 111,
176, 112, -1, 97, 111, 174, 112, -1, 23, -1,
-1, 111, 176, 112, -1, 23, -1, 60, -1, 29,
254, -1, 37, -1, 74, 255, -1, 179, -1, 180,
-1, 10, 99, 182, -1, 10, 99, 111, 181, 112,
183, -1, -1, 23, -1, 117, 185, -1, 117, 118,
184, 119, -1, 187, -1, 184, 109, 187, -1, 189,
-1, 225, -1, 235, -1, 189, -1, 225, -1, 236,
-1, 188, -1, 226, -1, 235, -1, 189, -1, 73,
213, -1, 73, 190, -1, 73, 192, -1, 73, 195,
-1, 73, 197, -1, 73, 203, -1, 73, 199, -1,
73, 206, -1, 73, 208, -1, 73, 210, -1, 73,
212, -1, 73, 224, -1, 47, 253, 191, -1, 201,
-1, 33, -1, 69, -1, 43, 111, 202, 112, 193,
-1, 201, -1, 60, -1, 26, -1, 72, 194, -1,
40, -1, 32, -1, 44, 196, -1, 25, -1, 253,
67, -1, 45, 111, 202, 112, 253, 198, -1, 201,
-1, 75, 257, 200, -1, 29, -1, 25, -1, 31,
-1, 71, -1, 23, -1, 76, 255, 204, 205, -1,
35, -1, 54, -1, 79, -1, 80, -1, 78, -1,
77, -1, 36, 207, -1, 29, -1, 56, -1, 28,
111, 209, 112, 57, -1, 23, -1, 58, 211, -1,
70, -1, 26, -1, 215, 66, 111, 218, 112, -1,
215, 214, -1, -1, 66, 111, 218, 106, 218, 112,
-1, 49, 219, 216, -1, -1, 217, -1, 41, -1,
82, -1, 42, -1, 23, -1, 51, 220, -1, 63,
-1, 52, -1, 81, 255, -1, 55, 111, 222, 112,
-1, 48, 111, 223, 112, -1, -1, 111, 221, 112,
-1, 23, -1, 23, -1, 23, -1, 30, 64, -1,
229, -1, 232, -1, 227, -1, 230, -1, 62, 34,
111, 228, 112, -1, 233, -1, 233, 106, 233, -1,
62, 34, 111, 233, 112, -1, 62, 46, 111, 231,
112, -1, 234, -1, 234, 106, 234, -1, 62, 46,
111, 234, 112, -1, 23, -1, 23, -1, 237, -1,
239, -1, 238, -1, 239, -1, 240, -1, 24, -1,
23, -1, 118, 240, 119, -1, 118, 240, 109, 240,
119, -1, 118, 240, 109, 240, 109, 240, 119, -1,
118, 240, 109, 240, 109, 240, 109, 240, 119, -1,
241, 24, -1, 241, 23, -1, 113, -1, 114, -1,
-1, -1, 244, 11, 243, 247, -1, 262, -1, -1,
-1, 5, 246, 247, -1, 247, 109, 99, -1, 99,
-1, 244, 9, 99, 117, 249, -1, 65, 60, -1,
65, 37, -1, 65, 250, -1, 65, 59, -1, 65,
74, 255, -1, 65, 30, -1, 29, 251, 252, -1,
-1, 39, -1, 27, -1, -1, 61, -1, 68, -1,
-1, 39, -1, 27, -1, -1, 61, -1, 68, -1,
-1, 111, 258, 112, -1, -1, 111, 259, 112, -1,
-1, 111, 260, 112, -1, 23, -1, 23, -1, 23,
-1, 6, 99, 117, 100, -1, 99, -1, 100, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 278, 278, 281, 289, 301, 302, 305, 329, 330,
333, 348, 351, 356, 363, 364, 365, 366, 367, 368,
369, 372, 373, 374, 377, 383, 389, 395, 402, 408,
415, 459, 464, 474, 518, 524, 525, 526, 527, 528,
529, 530, 531, 532, 533, 534, 535, 538, 550, 558,
575, 582, 601, 612, 632, 657, 664, 697, 704, 719,
774, 817, 826, 847, 857, 861, 890, 909, 909, 911,
918, 930, 931, 932, 935, 949, 963, 983, 994, 1006,
1008, 1009, 1010, 1011, 1014, 1014, 1014, 1014, 1015, 1018,
1022, 1027, 1034, 1041, 1048, 1071, 1094, 1095, 1096, 1097,
1098, 1099, 1102, 1121, 1125, 1131, 1135, 1139, 1143, 1152,
1161, 1165, 1170, 1176, 1187, 1187, 1188, 1190, 1194, 1198,
1202, 1208, 1208, 1210, 1228, 1254, 1257, 1268, 1274, 1280,
1281, 1288, 1294, 1300, 1308, 1314, 1320, 1328, 1334, 1340,
1348, 1349, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359,
1360, 1361, 1362, 1365, 1374, 1378, 1382, 1388, 1397, 1401,
1405, 1414, 1418, 1424, 1430, 1437, 1442, 1450, 1460, 1462,
1470, 1476, 1480, 1484, 1490, 1501, 1510, 1514, 1519, 1523,
1527, 1531, 1537, 1544, 1548, 1554, 1562, 1573, 1580, 1584,
1590, 1600, 1611, 1615, 1633, 1642, 1645, 1651, 1655, 1659,
1665, 1676, 1681, 1686, 1691, 1696, 1701, 1709, 1712, 1717,
1730, 1738, 1749, 1757, 1757, 1759, 1759, 1761, 1771, 1776,
1783, 1793, 1802, 1807, 1814, 1824, 1834, 1846, 1846, 1847,
1847, 1849, 1859, 1867, 1877, 1885, 1893, 1902, 1913, 1917,
1923, 1924, 1925, 1928, 1928, 1931, 1966, 1970, 1970, 1973,
1980, 1989, 2003, 2012, 2021, 2025, 2034, 2043, 2054, 2061,
2066, 2075, 2087, 2090, 2099, 2110, 2111, 2112, 2115, 2116,
2117, 2120, 2121, 2124, 2125, 2128, 2129, 2132, 2143, 2154,
2165, 2191, 2192
};
#endif
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
"$end", "error", "$undefined", "ARBvp_10", "ARBfp_10", "ADDRESS",
"ALIAS", "ATTRIB", "OPTION", "OUTPUT", "PARAM", "TEMP", "END", "BIN_OP",
"BINSC_OP", "SAMPLE_OP", "SCALAR_OP", "TRI_OP", "VECTOR_OP", "ARL",
"KIL", "SWZ", "TXD_OP", "INTEGER", "REAL", "AMBIENT", "ATTENUATION",
"BACK", "CLIP", "COLOR", "DEPTH", "DIFFUSE", "DIRECTION", "EMISSION",
"ENV", "EYE", "FOG", "FOGCOORD", "FRAGMENT", "FRONT", "HALF", "INVERSE",
"INVTRANS", "LIGHT", "LIGHTMODEL", "LIGHTPROD", "LOCAL", "MATERIAL",
"MAT_PROGRAM", "MATRIX", "MATRIXINDEX", "MODELVIEW", "MVP", "NORMAL",
"OBJECT", "PALETTE", "PARAMS", "PLANE", "POINT_TOK", "POINTSIZE",
"POSITION", "PRIMARY", "PROGRAM", "PROJECTION", "RANGE", "RESULT", "ROW",
"SCENECOLOR", "SECONDARY", "SHININESS", "SIZE_TOK", "SPECULAR", "SPOT",
"STATE", "TEXCOORD", "TEXENV", "TEXGEN", "TEXGEN_Q", "TEXGEN_R",
"TEXGEN_S", "TEXGEN_T", "TEXTURE", "TRANSPOSE", "TEXTURE_UNIT", "TEX_1D",
"TEX_2D", "TEX_3D", "TEX_CUBE", "TEX_RECT", "TEX_SHADOW1D",
"TEX_SHADOW2D", "TEX_SHADOWRECT", "TEX_ARRAY1D", "TEX_ARRAY2D",
"TEX_ARRAYSHADOW1D", "TEX_ARRAYSHADOW2D", "VERTEX", "VTXATTRIB",
"WEIGHT", "IDENTIFIER", "USED_IDENTIFIER", "MASK4", "MASK3", "MASK2",
"MASK1", "SWIZZLE", "DOT_DOT", "DOT", "';'", "','", "'|'", "'['", "']'",
"'+'", "'-'", "'('", "')'", "'='", "'{'", "'}'", "$accept", "program",
"language", "optionSequence", "option", "statementSequence", "statement",
"instruction", "ALU_instruction", "TexInstruction", "ARL_instruction",
"VECTORop_instruction", "SCALARop_instruction", "BINSCop_instruction",
"BINop_instruction", "TRIop_instruction", "SAMPLE_instruction",
"KIL_instruction", "TXD_instruction", "texImageUnit", "texTarget",
"SWZ_instruction", "scalarSrcReg", "scalarUse", "swizzleSrcReg",
"maskedDstReg", "maskedAddrReg", "extendedSwizzle", "extSwizComp",
"extSwizSel", "srcReg", "dstReg", "progParamArray", "progParamArrayMem",
"progParamArrayAbs", "progParamArrayRel", "addrRegRelOffset",
"addrRegPosOffset", "addrRegNegOffset", "addrReg", "addrComponent",
"addrWriteMask", "scalarSuffix", "swizzleSuffix", "optionalMask",
"optionalCcMask", "ccTest", "ccTest2", "ccMaskRule", "ccMaskRule2",
"namingStatement", "ATTRIB_statement", "attribBinding", "vtxAttribItem",
"vtxAttribNum", "vtxOptWeightNum", "vtxWeightNum", "fragAttribItem",
"PARAM_statement", "PARAM_singleStmt", "PARAM_multipleStmt",
"optArraySize", "paramSingleInit", "paramMultipleInit",
"paramMultInitList", "paramSingleItemDecl", "paramSingleItemUse",
"paramMultipleItem", "stateMultipleItem", "stateSingleItem",
"stateMaterialItem", "stateMatProperty", "stateLightItem",
"stateLightProperty", "stateSpotProperty", "stateLightModelItem",
"stateLModProperty", "stateLightProdItem", "stateLProdProperty",
"stateTexEnvItem", "stateTexEnvProperty", "ambDiffSpecProperty",
"stateLightNumber", "stateTexGenItem", "stateTexGenType",
"stateTexGenCoord", "stateFogItem", "stateFogProperty",
"stateClipPlaneItem", "stateClipPlaneNum", "statePointItem",
"statePointProperty", "stateMatrixRow", "stateMatrixRows",
"optMatrixRows", "stateMatrixItem", "stateOptMatModifier",
"stateMatModifier", "stateMatrixRowNum", "stateMatrixName",
"stateOptModMatNum", "stateModMatNum", "statePaletteMatNum",
"stateProgramMatNum", "stateDepthItem", "programSingleItem",
"programMultipleItem", "progEnvParams", "progEnvParamNums",
"progEnvParam", "progLocalParams", "progLocalParamNums",
"progLocalParam", "progEnvParamNum", "progLocalParamNum",
"paramConstDecl", "paramConstUse", "paramConstScalarDecl",
"paramConstScalarUse", "paramConstVector", "signedFloatConstant",
"optionalSign", "TEMP_statement", "@1", "optVarSize",
"ADDRESS_statement", "@2", "varNameList", "OUTPUT_statement",
"resultBinding", "resultColBinding", "optResultFaceType",
"optResultColorType", "optFaceType", "optColorType",
"optTexCoordUnitNum", "optTexImageUnitNum", "optLegacyTexUnitNum",
"texCoordUnitNum", "texImageUnitNum", "legacyTexUnitNum",
"ALIAS_statement", "string", 0
};
#endif
# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
token YYLEX-NUM. */
static const yytype_uint16 yytoknum[] =
{
0, 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, 59, 44,
124, 91, 93, 43, 45, 40, 41, 61, 123, 125
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint16 yyr1[] =
{
0, 120, 121, 122, 122, 123, 123, 124, 125, 125,
126, 126, 127, 127, 128, 128, 128, 128, 128, 128,
128, 129, 129, 129, 130, 131, 132, 133, 134, 135,
136, 137, 137, 138, 139, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 141, 142, 142,
143, 143, 144, 144, 145, 146, 147, 148, 149, 149,
150, 150, 150, 150, 151, 151, 152, 153, 153, 154,
155, 156, 156, 156, 157, 158, 159, 160, 161, 162,
163, 163, 163, 163, 164, 164, 164, 164, 164, 165,
165, 165, 166, 167, 168, 169, 170, 170, 170, 170,
170, 170, 171, 172, 172, 173, 173, 173, 173, 173,
173, 173, 173, 174, 175, 175, 176, 177, 177, 177,
177, 178, 178, 179, 180, 181, 181, 182, 183, 184,
184, 185, 185, 185, 186, 186, 186, 187, 187, 187,
188, 188, 189, 189, 189, 189, 189, 189, 189, 189,
189, 189, 189, 190, 191, 191, 191, 192, 193, 193,
193, 193, 193, 194, 195, 196, 196, 197, 198, 199,
200, 201, 201, 201, 202, 203, 204, 204, 205, 205,
205, 205, 206, 207, 207, 208, 209, 210, 211, 211,
212, 213, 214, 214, 215, 216, 216, 217, 217, 217,
218, 219, 219, 219, 219, 219, 219, 220, 220, 221,
222, 223, 224, 225, 225, 226, 226, 227, 228, 228,
229, 230, 231, 231, 232, 233, 234, 235, 235, 236,
236, 237, 238, 238, 239, 239, 239, 239, 240, 240,
241, 241, 241, 243, 242, 244, 244, 246, 245, 247,
247, 248, 249, 249, 249, 249, 249, 249, 250, 251,
251, 251, 252, 252, 252, 253, 253, 253, 254, 254,
254, 255, 255, 256, 256, 257, 257, 258, 259, 260,
261, 262, 262
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 4, 1, 1, 2, 0, 3, 2, 0,
2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 4, 4, 4, 6, 6, 8,
8, 2, 2, 12, 2, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 6, 2, 4,
2, 1, 3, 5, 3, 2, 7, 2, 1, 1,
1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
3, 0, 2, 2, 1, 1, 1, 1, 1, 1,
1, 1, 1, 0, 1, 1, 1, 1, 0, 3,
3, 0, 2, 2, 1, 1, 1, 1, 1, 1,
1, 1, 4, 2, 2, 1, 2, 1, 2, 1,
2, 4, 4, 1, 0, 3, 1, 1, 2, 1,
2, 1, 1, 3, 6, 0, 1, 2, 4, 1,
3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 3, 1, 1, 1, 5, 1, 1,
1, 2, 1, 1, 2, 1, 2, 6, 1, 3,
1, 1, 1, 1, 1, 4, 1, 1, 1, 1,
1, 1, 2, 1, 1, 5, 1, 2, 1, 1,
5, 2, 0, 6, 3, 0, 1, 1, 1, 1,
1, 2, 1, 1, 2, 4, 4, 0, 3, 1,
1, 1, 2, 1, 1, 1, 1, 5, 1, 3,
5, 5, 1, 3, 5, 1, 1, 1, 1, 1,
1, 1, 1, 1, 3, 5, 7, 9, 2, 2,
1, 1, 0, 0, 4, 1, 0, 0, 3, 3,
1, 5, 2, 2, 2, 2, 3, 2, 3, 0,
1, 1, 0, 1, 1, 0, 1, 1, 0, 1,
1, 0, 3, 0, 3, 0, 3, 1, 1, 1,
4, 1, 1
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
static const yytype_uint16 yydefact[] =
{
0, 3, 4, 0, 6, 1, 9, 0, 5, 246,
281, 282, 0, 247, 0, 0, 0, 2, 0, 0,
0, 0, 0, 0, 0, 242, 0, 0, 8, 0,
12, 13, 14, 15, 16, 17, 18, 19, 21, 22,
23, 20, 0, 96, 97, 121, 122, 98, 0, 99,
100, 101, 245, 7, 0, 0, 0, 0, 0, 65,
0, 88, 64, 0, 0, 0, 0, 0, 76, 0,
0, 94, 240, 241, 31, 32, 83, 0, 0, 0,
10, 11, 0, 243, 250, 248, 0, 0, 125, 242,
123, 259, 257, 253, 255, 252, 271, 254, 242, 84,
85, 86, 87, 91, 242, 242, 242, 242, 242, 242,
78, 55, 81, 80, 82, 92, 233, 232, 0, 0,
0, 0, 60, 0, 242, 83, 0, 61, 63, 134,
135, 213, 214, 136, 229, 230, 0, 242, 0, 0,
0, 280, 102, 126, 0, 127, 131, 132, 133, 227,
228, 231, 0, 261, 260, 262, 0, 256, 0, 0,
54, 0, 0, 0, 26, 0, 25, 24, 268, 119,
117, 271, 104, 0, 0, 0, 0, 0, 0, 265,
0, 265, 0, 0, 275, 271, 142, 143, 144, 145,
147, 146, 148, 149, 150, 151, 0, 152, 268, 109,
0, 107, 105, 271, 0, 114, 103, 83, 0, 52,
0, 0, 0, 0, 244, 249, 0, 239, 238, 263,
264, 258, 277, 0, 242, 95, 0, 0, 83, 242,
0, 48, 0, 51, 0, 242, 269, 270, 118, 120,
0, 0, 0, 212, 183, 184, 182, 0, 165, 267,
266, 164, 0, 0, 0, 0, 207, 203, 0, 202,
271, 195, 189, 188, 187, 0, 0, 0, 0, 108,
0, 110, 0, 0, 106, 0, 242, 234, 69, 0,
67, 68, 0, 242, 242, 251, 0, 124, 272, 28,
89, 90, 93, 27, 0, 79, 50, 273, 0, 0,
225, 0, 226, 0, 186, 0, 174, 0, 166, 0,
171, 172, 155, 156, 173, 153, 154, 0, 0, 201,
0, 204, 197, 199, 198, 194, 196, 279, 0, 170,
169, 176, 177, 0, 0, 116, 0, 113, 0, 0,
53, 0, 62, 77, 71, 47, 0, 0, 0, 242,
49, 0, 34, 0, 242, 220, 224, 0, 0, 265,
211, 0, 209, 0, 210, 0, 276, 181, 180, 178,
179, 175, 200, 0, 111, 112, 115, 242, 235, 0,
0, 70, 242, 58, 57, 59, 242, 0, 0, 0,
129, 137, 140, 138, 215, 216, 139, 278, 0, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 30, 29, 185, 160, 162, 159, 0, 157, 158,
0, 206, 208, 205, 190, 0, 74, 72, 75, 73,
0, 0, 0, 0, 141, 192, 242, 128, 274, 163,
161, 167, 168, 242, 236, 242, 0, 0, 0, 0,
191, 130, 0, 0, 0, 0, 218, 0, 222, 0,
237, 242, 0, 217, 0, 221, 0, 0, 56, 33,
219, 223, 0, 0, 193
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
-1, 3, 4, 6, 8, 9, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 298,
411, 41, 161, 231, 74, 60, 69, 345, 346, 384,
232, 61, 126, 279, 280, 281, 381, 427, 429, 70,
344, 111, 296, 115, 103, 160, 75, 227, 76, 228,
42, 43, 127, 206, 338, 274, 336, 172, 44, 45,
46, 144, 90, 287, 389, 145, 128, 390, 391, 129,
186, 315, 187, 418, 440, 188, 251, 189, 441, 190,
330, 316, 307, 191, 333, 371, 192, 246, 193, 305,
194, 264, 195, 434, 450, 196, 325, 326, 373, 261,
319, 363, 365, 361, 197, 130, 393, 394, 455, 131,
395, 457, 132, 301, 303, 396, 133, 149, 134, 135,
151, 77, 47, 139, 48, 49, 54, 85, 50, 62,
97, 155, 221, 252, 238, 157, 352, 266, 223, 398,
328, 51, 12
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
#define YYPACT_NINF -401
static const yytype_int16 yypact[] =
{
193, -401, -401, 27, -401, -401, 62, 143, -401, 24,
-401, -401, -30, -401, -18, 12, 83, -401, 15, 15,
15, 15, 15, 15, 67, 61, 15, 15, -401, 127,
-401, -401, -401, -401, -401, -401, -401, -401, -401, -401,
-401, -401, 144, -401, -401, -401, -401, -401, 204, -401,
-401, -401, -401, -401, 155, 136, 138, 34, 140, -401,
147, 108, -401, 150, 156, 157, 158, 160, -401, 162,
159, -401, -401, -401, -401, -401, 102, -13, 163, 164,
-401, -401, 165, -401, -401, 166, 170, 10, 235, 0,
-401, 141, -401, -401, -401, -401, 167, -401, 131, -401,
-401, -401, -401, 168, 131, 131, 131, 131, 131, 131,
-401, -401, -401, -401, -401, -401, -401, -401, 104, 97,
114, 38, 169, 30, 131, 102, 171, -401, -401, -401,
-401, -401, -401, -401, -401, -401, 30, 131, 172, 155,
175, -401, -401, -401, 173, -401, -401, -401, -401, -401,
-401, -401, 223, -401, -401, 123, 253, -401, 177, 149,
-401, 178, -10, 181, -401, 182, -401, -401, 134, -401,
-401, 167, -401, 183, 184, 185, 213, 99, 186, 154,
187, 146, 153, 7, 188, 167, -401, -401, -401, -401,
-401, -401, -401, -401, -401, -401, 215, -401, 134, -401,
190, -401, -401, 167, 191, 192, -401, 102, -48, -401,
1, 195, 196, 214, 166, -401, 189, -401, -401, -401,
-401, -401, -401, 180, 131, -401, 194, 197, 102, 131,
30, -401, 203, 205, 201, 131, -401, -401, -401, -401,
285, 288, 289, -401, -401, -401, -401, 291, -401, -401,
-401, -401, 248, 291, 33, 206, 207, -401, 208, -401,
167, 14, -401, -401, -401, 293, 292, 92, 209, -401,
299, -401, 301, 299, -401, 216, 131, -401, -401, 217,
-401, -401, 221, 131, 131, -401, 212, -401, -401, -401,
-401, -401, -401, -401, 218, -401, -401, 220, 224, 225,
-401, 226, -401, 227, -401, 228, -401, 230, -401, 231,
-401, -401, -401, -401, -401, -401, -401, 304, 309, -401,
312, -401, -401, -401, -401, -401, -401, -401, 232, -401,
-401, -401, -401, 161, 313, -401, 233, -401, 234, 238,
-401, 13, -401, -401, 137, -401, 242, -15, 243, 3,
-401, 314, -401, 133, 131, -401, -401, 296, 94, 146,
-401, 245, -401, 246, -401, 247, -401, -401, -401, -401,
-401, -401, -401, 249, -401, -401, -401, 131, -401, 332,
337, -401, 131, -401, -401, -401, 131, 142, 114, 28,
-401, -401, -401, -401, -401, -401, -401, -401, 250, -401,
-401, -401, -401, -401, -401, -401, -401, -401, -401, -401,
-401, -401, -401, -401, -401, -401, -401, 331, -401, -401,
68, -401, -401, -401, -401, 43, -401, -401, -401, -401,
255, 256, 257, 258, -401, 300, 3, -401, -401, -401,
-401, -401, -401, 131, -401, 131, 201, 285, 288, 259,
-401, -401, 252, 264, 265, 263, 261, 266, 270, 313,
-401, 131, 133, -401, 285, -401, 288, 80, -401, -401,
-401, -401, 313, 267, -401
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
-401, -401, -401, -401, -401, -401, -401, -401, -401, -401,
-401, -401, -401, -401, -401, -401, -401, -401, -401, -69,
-82, -401, -100, 151, -86, 210, -401, -401, -366, -401,
-54, -401, -401, -401, -401, -401, -401, -401, -401, 174,
-401, -401, -401, -118, -401, -401, 229, -401, -401, -401,
-401, -401, 295, -401, -401, -401, 110, -401, -401, -401,
-401, -401, -401, -401, -401, -401, -401, -51, -401, -88,
-401, -401, -401, -401, -401, -401, -401, -401, -401, -401,
-401, -311, 139, -401, -401, -401, -401, -401, -401, -401,
-401, -401, -401, -401, -401, -2, -401, -401, -400, -401,
-401, -401, -401, -401, -401, 298, -401, -401, -401, -401,
-401, -401, -401, -390, -295, 302, -401, -401, -136, -87,
-120, -89, -401, -401, -401, -401, -401, 251, -401, 176,
-401, -401, -401, -176, 198, -153, -401, -401, -401, -401,
-401, -401, -6
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If zero, do what YYDEFACT says.
If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -230
static const yytype_int16 yytable[] =
{
152, 146, 150, 52, 208, 254, 164, 209, 383, 167,
116, 117, 158, 116, 117, 162, 430, 162, 239, 163,
162, 165, 166, 125, 278, 118, 233, 5, 118, 13,
14, 15, 267, 262, 16, 152, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 419, 118, 119,
271, 212, 119, 116, 117, 322, 323, 456, 310, 467,
120, 276, 119, 120, 311, 387, 312, 198, 118, 207,
7, 277, 473, 120, 470, 199, 388, 263, 53, 453,
58, 55, 211, 121, 10, 11, 121, 122, 200, 275,
122, 201, 119, 310, 233, 468, 324, 123, 202, 311,
230, 68, 313, 120, 314, 124, 121, 321, 124, 442,
292, 56, 203, 72, 73, 59, 72, 73, 124, 310,
414, 124, 377, 10, 11, 311, 121, 331, 244, 293,
122, 173, 378, 168, 415, 204, 205, 436, 289, 314,
162, 169, 175, 174, 176, 88, 332, 437, 124, 299,
177, 89, 443, 458, 416, 245, 341, 178, 179, 180,
71, 181, 444, 182, 170, 314, 417, 68, 153, 91,
92, 471, 183, 249, 72, 73, 432, 93, 171, 248,
154, 249, 57, 420, 219, 250, 472, 152, 433, 184,
185, 220, 424, 250, 347, 236, 1, 2, 348, 94,
95, 255, 237, 112, 256, 257, 113, 114, 258, 99,
100, 101, 102, 82, 96, 83, 259, 399, 400, 401,
402, 403, 404, 405, 406, 407, 408, 409, 410, 63,
64, 65, 66, 67, 260, 80, 78, 79, 367, 368,
369, 370, 10, 11, 72, 73, 217, 218, 71, 225,
379, 380, 81, 86, 84, 87, 98, 425, 143, 104,
152, 392, 150, 110, 138, 105, 106, 107, 412, 108,
141, 109, 136, 137, 215, 140, 222, 243, 156, 58,
-66, 268, 210, 159, 297, 216, 224, 229, 152, 213,
234, 235, 288, 347, 240, 241, 242, 247, 253, 265,
431, 270, 272, 273, 283, 284, 286, 295, 300, -229,
290, 302, 304, 291, 306, 308, 327, 317, 318, 320,
334, 329, 335, 452, 337, 343, 340, 360, 350, 342,
349, 351, 362, 353, 354, 364, 372, 397, 355, 356,
357, 385, 358, 359, 366, 374, 375, 152, 392, 150,
376, 382, 386, 413, 152, 426, 347, 421, 422, 423,
428, 424, 438, 439, 445, 446, 449, 464, 447, 448,
459, 460, 347, 461, 462, 463, 466, 454, 465, 474,
469, 294, 142, 339, 282, 451, 435, 147, 226, 285,
214, 148, 309, 0, 0, 0, 269
};
static const yytype_int16 yycheck[] =
{
89, 89, 89, 9, 124, 181, 106, 125, 23, 109,
23, 24, 98, 23, 24, 104, 382, 106, 171, 105,
109, 107, 108, 77, 23, 38, 162, 0, 38, 5,
6, 7, 185, 26, 10, 124, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 358, 38, 62,
203, 137, 62, 23, 24, 41, 42, 447, 25, 459,
73, 109, 62, 73, 31, 62, 33, 29, 38, 123,
8, 119, 472, 73, 464, 37, 73, 70, 108, 445,
65, 99, 136, 96, 99, 100, 96, 100, 50, 207,
100, 53, 62, 25, 230, 461, 82, 110, 60, 31,
110, 100, 69, 73, 71, 118, 96, 260, 118, 420,
228, 99, 74, 113, 114, 100, 113, 114, 118, 25,
26, 118, 109, 99, 100, 31, 96, 35, 29, 229,
100, 34, 119, 29, 40, 97, 98, 109, 224, 71,
229, 37, 28, 46, 30, 111, 54, 119, 118, 235,
36, 117, 109, 448, 60, 56, 276, 43, 44, 45,
99, 47, 119, 49, 60, 71, 72, 100, 27, 29,
30, 466, 58, 27, 113, 114, 34, 37, 74, 25,
39, 27, 99, 359, 61, 39, 106, 276, 46, 75,
76, 68, 112, 39, 283, 61, 3, 4, 284, 59,
60, 48, 68, 101, 51, 52, 104, 105, 55, 101,
102, 103, 104, 9, 74, 11, 63, 84, 85, 86,
87, 88, 89, 90, 91, 92, 93, 94, 95, 19,
20, 21, 22, 23, 81, 108, 26, 27, 77, 78,
79, 80, 99, 100, 113, 114, 23, 24, 99, 100,
113, 114, 108, 117, 99, 117, 109, 377, 23, 109,
349, 349, 349, 104, 99, 109, 109, 109, 354, 109,
100, 109, 109, 109, 99, 109, 23, 64, 111, 65,
111, 66, 111, 115, 83, 112, 109, 109, 377, 117,
109, 109, 112, 382, 111, 111, 111, 111, 111, 111,
386, 111, 111, 111, 109, 109, 117, 104, 23, 104,
116, 23, 23, 116, 23, 67, 23, 111, 111, 111,
111, 29, 23, 443, 23, 104, 110, 23, 110, 112,
118, 111, 23, 109, 109, 23, 23, 23, 112, 112,
112, 347, 112, 112, 112, 112, 112, 436, 436, 436,
112, 109, 109, 57, 443, 23, 445, 112, 112, 112,
23, 112, 112, 32, 109, 109, 66, 106, 111, 111,
111, 119, 461, 109, 109, 112, 106, 446, 112, 112,
462, 230, 87, 273, 210, 436, 388, 89, 159, 213,
139, 89, 253, -1, -1, -1, 198
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint16 yystos[] =
{
0, 3, 4, 121, 122, 0, 123, 8, 124, 125,
99, 100, 262, 5, 6, 7, 10, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 126, 127,
128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
138, 141, 170, 171, 178, 179, 180, 242, 244, 245,
248, 261, 262, 108, 246, 99, 99, 99, 65, 100,
145, 151, 249, 145, 145, 145, 145, 145, 100, 146,
159, 99, 113, 114, 144, 166, 168, 241, 145, 145,
108, 108, 9, 11, 99, 247, 117, 117, 111, 117,
182, 29, 30, 37, 59, 60, 74, 250, 109, 101,
102, 103, 104, 164, 109, 109, 109, 109, 109, 109,
104, 161, 101, 104, 105, 163, 23, 24, 38, 62,
73, 96, 100, 110, 118, 150, 152, 172, 186, 189,
225, 229, 232, 236, 238, 239, 109, 109, 99, 243,
109, 100, 172, 23, 181, 185, 189, 225, 235, 237,
239, 240, 241, 27, 39, 251, 111, 255, 144, 115,
165, 142, 241, 144, 142, 144, 144, 142, 29, 37,
60, 74, 177, 34, 46, 28, 30, 36, 43, 44,
45, 47, 49, 58, 75, 76, 190, 192, 195, 197,
199, 203, 206, 208, 210, 212, 215, 224, 29, 37,
50, 53, 60, 74, 97, 98, 173, 150, 240, 163,
111, 150, 144, 117, 247, 99, 112, 23, 24, 61,
68, 252, 23, 258, 109, 100, 166, 167, 169, 109,
110, 143, 150, 238, 109, 109, 61, 68, 254, 255,
111, 111, 111, 64, 29, 56, 207, 111, 25, 27,
39, 196, 253, 111, 253, 48, 51, 52, 55, 63,
81, 219, 26, 70, 211, 111, 257, 255, 66, 254,
111, 255, 111, 111, 175, 163, 109, 119, 23, 153,
154, 155, 159, 109, 109, 249, 117, 183, 112, 144,
116, 116, 163, 142, 143, 104, 162, 83, 139, 144,
23, 233, 23, 234, 23, 209, 23, 202, 67, 202,
25, 31, 33, 69, 71, 191, 201, 111, 111, 220,
111, 255, 41, 42, 82, 216, 217, 23, 260, 29,
200, 35, 54, 204, 111, 23, 176, 23, 174, 176,
110, 240, 112, 104, 160, 147, 148, 241, 144, 118,
110, 111, 256, 109, 109, 112, 112, 112, 112, 112,
23, 223, 23, 221, 23, 222, 112, 77, 78, 79,
80, 205, 23, 218, 112, 112, 112, 109, 119, 113,
114, 156, 109, 23, 149, 262, 109, 62, 73, 184,
187, 188, 189, 226, 227, 230, 235, 23, 259, 84,
85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
95, 140, 144, 57, 26, 40, 60, 72, 193, 201,
253, 112, 112, 112, 112, 240, 23, 157, 23, 158,
148, 144, 34, 46, 213, 215, 109, 119, 112, 32,
194, 198, 201, 109, 119, 109, 109, 111, 111, 66,
214, 187, 240, 148, 139, 228, 233, 231, 234, 111,
119, 109, 109, 112, 106, 112, 106, 218, 148, 140,
233, 234, 106, 218, 112
};
#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 yyerrorlab
/* 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); \
yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK (1); \
goto yybackup; \
} \
else \
{ \
yyerror (&yylloc, state, YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (YYID (0))
#define YYTERROR 1
#define YYERRCODE 256
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (YYID (N)) \
{ \
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
} \
else \
{ \
(Current).first_line = (Current).last_line = \
YYRHSLOC (Rhs, 0).last_line; \
(Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \
} \
while (YYID (0))
#endif
/* YY_LOCATION_PRINT -- Print the location on the stream.
This macro was not mandated originally: define only if we know
we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT
# if YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \
(Loc).last_line, (Loc).last_column)
# else
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif
#endif
/* YYLEX -- calling `yylex' with the right arguments. */
#ifdef YYLEX_PARAM
# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
#else
# define YYLEX yylex (&yylval, &yylloc, scanner)
#endif
/* Enable debugging if requested. */
#if YYDEBUG
# ifndef YYFPRINTF
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (YYID (0))
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \
Type, Value, Location, state); \
YYFPRINTF (stderr, "\n"); \
} \
} while (YYID (0))
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct asm_parser_state *state)
#else
static void
yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, state)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
YYLTYPE const * const yylocationp;
struct asm_parser_state *state;
#endif
{
if (!yyvaluep)
return;
YYUSE (yylocationp);
YYUSE (state);
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# else
YYUSE (yyoutput);
# endif
switch (yytype)
{
default:
break;
}
}
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, struct asm_parser_state *state)
#else
static void
yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, state)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
YYLTYPE const * const yylocationp;
struct asm_parser_state *state;
#endif
{
if (yytype < YYNTOKENS)
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
else
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
YY_LOCATION_PRINT (yyoutput, *yylocationp);
YYFPRINTF (yyoutput, ": ");
yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, state);
YYFPRINTF (yyoutput, ")");
}
/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included). |
`------------------------------------------------------------------*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
#else
static void
yy_stack_print (yybottom, yytop)
yytype_int16 *yybottom;
yytype_int16 *yytop;
#endif
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
{
int yybot = *yybottom;
YYFPRINTF (stderr, " %d", yybot);
}
YYFPRINTF (stderr, "\n");
}
# define YY_STACK_PRINT(Bottom, Top) \
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
} while (YYID (0))
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, struct asm_parser_state *state)
#else
static void
yy_reduce_print (yyvsp, yylsp, yyrule, state)
YYSTYPE *yyvsp;
YYLTYPE *yylsp;
int yyrule;
struct asm_parser_state *state;
#endif
{
int yynrhs = yyr2[yyrule];
int yyi;
unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)])
, &(yylsp[(yyi + 1) - (yynrhs)]) , state);
YYFPRINTF (stderr, "\n");
}
}
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
yy_reduce_print (yyvsp, yylsp, Rule, state); \
} while (YYID (0))
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
evaluated with infinite-precision integer arithmetic. */
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
#if YYERROR_VERBOSE
# ifndef yystrlen
# if defined __GLIBC__ && defined _STRING_H
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
#else
static YYSIZE_T
yystrlen (yystr)
const char *yystr;
#endif
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
continue;
return yylen;
}
# endif
# endif
# ifndef yystpcpy
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
# define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
#else
static char *
yystpcpy (yydest, yysrc)
char *yydest;
const char *yysrc;
#endif
{
char *yyd = yydest;
const char *yys = yysrc;
while ((*yyd++ = *yys++) != '\0')
continue;
return yyd - 1;
}
# endif
# endif
# ifndef yytnamerr
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
quotes and backslashes, so that it's suitable for yyerror. The
heuristic is that double-quoting is unnecessary unless the string
contains an apostrophe, a comma, or backslash (other than
backslash-backslash). YYSTR is taken from yytname. If YYRES is
null, do not copy; instead, return the length of what the result
would have been. */
static YYSIZE_T
yytnamerr (char *yyres, const char *yystr)
{
if (*yystr == '"')
{
YYSIZE_T yyn = 0;
char const *yyp = yystr;
for (;;)
switch (*++yyp)
{
case '\'':
case ',':
goto do_not_strip_quotes;
case '\\':
if (*++yyp != '\\')
goto do_not_strip_quotes;
/* Fall through. */
default:
if (yyres)
yyres[yyn] = *yyp;
yyn++;
break;
case '"':
if (yyres)
yyres[yyn] = '\0';
return yyn;
}
do_not_strip_quotes: ;
}
if (! yyres)
return yystrlen (yystr);
return yystpcpy (yyres, yystr) - yyres;
}
# endif
/* Copy into YYRESULT an error message about the unexpected token
YYCHAR while in state YYSTATE. Return the number of bytes copied,
including the terminating null byte. If YYRESULT is null, do not
copy anything; just return the number of bytes that would be
copied. As a special case, return 0 if an ordinary "syntax error"
message will do. Return YYSIZE_MAXIMUM if overflow occurs during
size calculation. */
static YYSIZE_T
yysyntax_error (char *yyresult, int yystate, int yychar)
{
int yyn = yypact[yystate];
if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
return 0;
else
{
int yytype = YYTRANSLATE (yychar);
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
YYSIZE_T yysize = yysize0;
YYSIZE_T yysize1;
int yysize_overflow = 0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
int yyx;
# if 0
/* This is so xgettext sees the translatable formats that are
constructed on the fly. */
YY_("syntax error, unexpected %s");
YY_("syntax error, unexpected %s, expecting %s");
YY_("syntax error, unexpected %s, expecting %s or %s");
YY_("syntax error, unexpected %s, expecting %s or %s or %s");
YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
# endif
char *yyfmt;
char const *yyf;
static char const yyunexpected[] = "syntax error, unexpected %s";
static char const yyexpecting[] = ", expecting %s";
static char const yyor[] = " or %s";
char yyformat[sizeof yyunexpected
+ sizeof yyexpecting - 1
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
* (sizeof yyor - 1))];
char const *yyprefix = yyexpecting;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yycount = 1;
yyarg[0] = yytname[yytype];
yyfmt = yystpcpy (yyformat, yyunexpected);
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
yyformat[sizeof yyunexpected - 1] = '\0';
break;
}
yyarg[yycount++] = yytname[yyx];
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
yysize_overflow |= (yysize1 < yysize);
yysize = yysize1;
yyfmt = yystpcpy (yyfmt, yyprefix);
yyprefix = yyor;
}
yyf = YY_(yyformat);
yysize1 = yysize + yystrlen (yyf);
yysize_overflow |= (yysize1 < yysize);
yysize = yysize1;
if (yysize_overflow)
return YYSIZE_MAXIMUM;
if (yyresult)
{
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
char *yyp = yyresult;
int yyi = 0;
while ((*yyp = *yyf) != '\0')
{
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyf += 2;
}
else
{
yyp++;
yyf++;
}
}
}
return yysize;
}
}
#endif /* YYERROR_VERBOSE */
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, struct asm_parser_state *state)
#else
static void
yydestruct (yymsg, yytype, yyvaluep, yylocationp, state)
const char *yymsg;
int yytype;
YYSTYPE *yyvaluep;
YYLTYPE *yylocationp;
struct asm_parser_state *state;
#endif
{
YYUSE (yyvaluep);
YYUSE (yylocationp);
YYUSE (state);
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
switch (yytype)
{
default:
break;
}
}
/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int yyparse (struct asm_parser_state *state);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */
/*-------------------------.
| yyparse or yypush_parse. |
`-------------------------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
int
yyparse (void *YYPARSE_PARAM)
#else
int
yyparse (YYPARSE_PARAM)
void *YYPARSE_PARAM;
#endif
#else /* ! YYPARSE_PARAM */
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
int
yyparse (struct asm_parser_state *state)
#else
int
yyparse (state)
struct asm_parser_state *state;
#endif
#endif
{
/* The lookahead symbol. */
int yychar;
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
/* Location data for the lookahead symbol. */
YYLTYPE yylloc;
/* Number of syntax errors so far. */
int yynerrs;
int yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* The stacks and their tools:
`yyss': related to states.
`yyvs': related to semantic values.
`yyls': related to locations.
Refer to the stacks thru separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
yytype_int16 yyssa[YYINITDEPTH];
yytype_int16 *yyss;
yytype_int16 *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs;
YYSTYPE *yyvsp;
/* The location stack. */
YYLTYPE yylsa[YYINITDEPTH];
YYLTYPE *yyls;
YYLTYPE *yylsp;
/* The locations where the error started and ended. */
YYLTYPE yyerror_range[2];
YYSIZE_T yystacksize;
int yyn;
int yyresult;
/* Lookahead token as an internal (translated) token number. */
int yytoken;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
YYLTYPE yyloc;
#if YYERROR_VERBOSE
/* Buffer for error messages, and its allocated size. */
char yymsgbuf[128];
char *yymsg = yymsgbuf;
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
yytoken = 0;
yyss = yyssa;
yyvs = yyvsa;
yyls = yylsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
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;
yyvsp = yyvs;
yylsp = yyls;
#if YYLTYPE_IS_TRIVIAL
/* Initialize the default location before parsing starts. */
yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = 1;
#endif
goto yysetstate;
/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate. |
`------------------------------------------------------------*/
yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */
yyssp++;
yysetstate:
*yyssp = yystate;
if (yyss + yystacksize - 1 <= yyssp)
{
/* Get the current used size of the three stacks, in elements. */
YYSIZE_T yysize = yyssp - yyss + 1;
#ifdef yyoverflow
{
/* 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;
yytype_int16 *yyss1 = yyss;
YYLTYPE *yyls1 = yyls;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yyls1, yysize * sizeof (*yylsp),
&yystacksize);
yyls = yyls1;
yyss = yyss1;
yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
goto yyexhaustedlab;
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH;
{
yytype_int16 *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
YYSTACK_RELOCATE (yyls_alloc, yyls);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
yylsp = yyls + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
if (yystate == YYFINAL)
YYACCEPT;
goto yybackup;
/*-----------.
| yybackup. |
`-----------*/
yybackup:
/* Do appropriate processing given the current state. Read a
lookahead token if we need one and don't already have one. */
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYPACT_NINF)
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
yychar = YYLEX;
}
if (yychar <= YYEOF)
{
yychar = yytoken = YYEOF;
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else
{
yytoken = YYTRANSLATE (yychar);
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
}
/* If the proper action on seeing token YYTOKEN is to reduce or to
detect an error, take that action. */
yyn += yytoken;
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
goto yydefault;
yyn = yytable[yyn];
if (yyn <= 0)
{
if (yyn == 0 || yyn == YYTABLE_NINF)
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
/* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
/* Discard the shifted token. */
yychar = YYEMPTY;
yystate = yyn;
*++yyvsp = yylval;
*++yylsp = yylloc;
goto yynewstate;
/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state. |
`-----------------------------------------------------------*/
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
goto yyreduce;
/*-----------------------------.
| yyreduce -- Do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
`$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
users should not rely upon it. Assigning to YYVAL
unconditionally makes the parser a bit smaller, and it avoids a
GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen];
/* Default location. */
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
case 3:
/* Line 1455 of yacc.c */
#line 282 "program_parse.y"
{
if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid fragment program header");
}
state->mode = ARB_vertex;
;}
break;
case 4:
/* Line 1455 of yacc.c */
#line 290 "program_parse.y"
{
if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex program header");
}
state->mode = ARB_fragment;
state->option.TexRect =
(state->ctx->Extensions.NV_texture_rectangle != GL_FALSE);
;}
break;
case 7:
/* Line 1455 of yacc.c */
#line 306 "program_parse.y"
{
int valid = 0;
if (state->mode == ARB_vertex) {
valid = _mesa_ARBvp_parse_option(state, (yyvsp[(2) - (3)].string));
} else if (state->mode == ARB_fragment) {
valid = _mesa_ARBfp_parse_option(state, (yyvsp[(2) - (3)].string));
}
free((yyvsp[(2) - (3)].string));
if (!valid) {
const char *const err_str = (state->mode == ARB_vertex)
? "invalid ARB vertex program option"
: "invalid ARB fragment program option";
yyerror(& (yylsp[(2) - (3)]), state, err_str);
YYERROR;
}
;}
break;
case 10:
/* Line 1455 of yacc.c */
#line 334 "program_parse.y"
{
if ((yyvsp[(1) - (2)].inst) != NULL) {
if (state->inst_tail == NULL) {
state->inst_head = (yyvsp[(1) - (2)].inst);
} else {
state->inst_tail->next = (yyvsp[(1) - (2)].inst);
}
state->inst_tail = (yyvsp[(1) - (2)].inst);
(yyvsp[(1) - (2)].inst)->next = NULL;
state->prog->NumInstructions++;
}
;}
break;
case 12:
/* Line 1455 of yacc.c */
#line 352 "program_parse.y"
{
(yyval.inst) = (yyvsp[(1) - (1)].inst);
state->prog->NumAluInstructions++;
;}
break;
case 13:
/* Line 1455 of yacc.c */
#line 357 "program_parse.y"
{
(yyval.inst) = (yyvsp[(1) - (1)].inst);
state->prog->NumTexInstructions++;
;}
break;
case 24:
/* Line 1455 of yacc.c */
#line 378 "program_parse.y"
{
(yyval.inst) = asm_instruction_ctor(OPCODE_ARL, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
;}
break;
case 25:
/* Line 1455 of yacc.c */
#line 384 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
;}
break;
case 26:
/* Line 1455 of yacc.c */
#line 390 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL);
;}
break;
case 27:
/* Line 1455 of yacc.c */
#line 396 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL);
;}
break;
case 28:
/* Line 1455 of yacc.c */
#line 403 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL);
;}
break;
case 29:
/* Line 1455 of yacc.c */
#line 410 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), & (yyvsp[(6) - (8)].src_reg), & (yyvsp[(8) - (8)].src_reg));
;}
break;
case 30:
/* Line 1455 of yacc.c */
#line 416 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), NULL, NULL);
if ((yyval.inst) != NULL) {
const GLbitfield tex_mask = (1U << (yyvsp[(6) - (8)].integer));
GLbitfield shadow_tex = 0;
GLbitfield target_mask = 0;
(yyval.inst)->Base.TexSrcUnit = (yyvsp[(6) - (8)].integer);
if ((yyvsp[(8) - (8)].integer) < 0) {
shadow_tex = tex_mask;
(yyval.inst)->Base.TexSrcTarget = -(yyvsp[(8) - (8)].integer);
(yyval.inst)->Base.TexShadow = 1;
} else {
(yyval.inst)->Base.TexSrcTarget = (yyvsp[(8) - (8)].integer);
}
target_mask = (1U << (yyval.inst)->Base.TexSrcTarget);
/* If this texture unit was previously accessed and that access
* had a different texture target, generate an error.
*
* If this texture unit was previously accessed and that access
* had a different shadow mode, generate an error.
*/
if ((state->prog->TexturesUsed[(yyvsp[(6) - (8)].integer)] != 0)
&& ((state->prog->TexturesUsed[(yyvsp[(6) - (8)].integer)] != target_mask)
|| ((state->prog->ShadowSamplers & tex_mask)
!= shadow_tex))) {
yyerror(& (yylsp[(8) - (8)]), state,
"multiple targets used on one texture image unit");
YYERROR;
}
state->prog->TexturesUsed[(yyvsp[(6) - (8)].integer)] |= target_mask;
state->prog->ShadowSamplers |= shadow_tex;
}
;}
break;
case 31:
/* Line 1455 of yacc.c */
#line 460 "program_parse.y"
{
(yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL);
state->fragment.UsesKill = 1;
;}
break;
case 32:
/* Line 1455 of yacc.c */
#line 465 "program_parse.y"
{
(yyval.inst) = asm_instruction_ctor(OPCODE_KIL_NV, NULL, NULL, NULL, NULL);
(yyval.inst)->Base.DstReg.CondMask = (yyvsp[(2) - (2)].dst_reg).CondMask;
(yyval.inst)->Base.DstReg.CondSwizzle = (yyvsp[(2) - (2)].dst_reg).CondSwizzle;
(yyval.inst)->Base.DstReg.CondSrc = (yyvsp[(2) - (2)].dst_reg).CondSrc;
state->fragment.UsesKill = 1;
;}
break;
case 33:
/* Line 1455 of yacc.c */
#line 475 "program_parse.y"
{
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (12)].temp_inst), & (yyvsp[(2) - (12)].dst_reg), & (yyvsp[(4) - (12)].src_reg), & (yyvsp[(6) - (12)].src_reg), & (yyvsp[(8) - (12)].src_reg));
if ((yyval.inst) != NULL) {
const GLbitfield tex_mask = (1U << (yyvsp[(10) - (12)].integer));
GLbitfield shadow_tex = 0;
GLbitfield target_mask = 0;
(yyval.inst)->Base.TexSrcUnit = (yyvsp[(10) - (12)].integer);
if ((yyvsp[(12) - (12)].integer) < 0) {
shadow_tex = tex_mask;
(yyval.inst)->Base.TexSrcTarget = -(yyvsp[(12) - (12)].integer);
(yyval.inst)->Base.TexShadow = 1;
} else {
(yyval.inst)->Base.TexSrcTarget = (yyvsp[(12) - (12)].integer);
}
target_mask = (1U << (yyval.inst)->Base.TexSrcTarget);
/* If this texture unit was previously accessed and that access
* had a different texture target, generate an error.
*
* If this texture unit was previously accessed and that access
* had a different shadow mode, generate an error.
*/
if ((state->prog->TexturesUsed[(yyvsp[(10) - (12)].integer)] != 0)
&& ((state->prog->TexturesUsed[(yyvsp[(10) - (12)].integer)] != target_mask)
|| ((state->prog->ShadowSamplers & tex_mask)
!= shadow_tex))) {
yyerror(& (yylsp[(12) - (12)]), state,
"multiple targets used on one texture image unit");
YYERROR;
}
state->prog->TexturesUsed[(yyvsp[(10) - (12)].integer)] |= target_mask;
state->prog->ShadowSamplers |= shadow_tex;
}
;}
break;
case 34:
/* Line 1455 of yacc.c */
#line 519 "program_parse.y"
{
(yyval.integer) = (yyvsp[(2) - (2)].integer);
;}
break;
case 35:
/* Line 1455 of yacc.c */
#line 524 "program_parse.y"
{ (yyval.integer) = TEXTURE_1D_INDEX; ;}
break;
case 36:
/* Line 1455 of yacc.c */
#line 525 "program_parse.y"
{ (yyval.integer) = TEXTURE_2D_INDEX; ;}
break;
case 37:
/* Line 1455 of yacc.c */
#line 526 "program_parse.y"
{ (yyval.integer) = TEXTURE_3D_INDEX; ;}
break;
case 38:
/* Line 1455 of yacc.c */
#line 527 "program_parse.y"
{ (yyval.integer) = TEXTURE_CUBE_INDEX; ;}
break;
case 39:
/* Line 1455 of yacc.c */
#line 528 "program_parse.y"
{ (yyval.integer) = TEXTURE_RECT_INDEX; ;}
break;
case 40:
/* Line 1455 of yacc.c */
#line 529 "program_parse.y"
{ (yyval.integer) = -TEXTURE_1D_INDEX; ;}
break;
case 41:
/* Line 1455 of yacc.c */
#line 530 "program_parse.y"
{ (yyval.integer) = -TEXTURE_2D_INDEX; ;}
break;
case 42:
/* Line 1455 of yacc.c */
#line 531 "program_parse.y"
{ (yyval.integer) = -TEXTURE_RECT_INDEX; ;}
break;
case 43:
/* Line 1455 of yacc.c */
#line 532 "program_parse.y"
{ (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; ;}
break;
case 44:
/* Line 1455 of yacc.c */
#line 533 "program_parse.y"
{ (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; ;}
break;
case 45:
/* Line 1455 of yacc.c */
#line 534 "program_parse.y"
{ (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; ;}
break;
case 46:
/* Line 1455 of yacc.c */
#line 535 "program_parse.y"
{ (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; ;}
break;
case 47:
/* Line 1455 of yacc.c */
#line 539 "program_parse.y"
{
/* FIXME: Is this correct? Should the extenedSwizzle be applied
* FIXME: to the existing swizzle?
*/
(yyvsp[(4) - (6)].src_reg).Base.Swizzle = (yyvsp[(6) - (6)].swiz_mask).swizzle;
(yyvsp[(4) - (6)].src_reg).Base.Negate = (yyvsp[(6) - (6)].swiz_mask).mask;
(yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), NULL, NULL);
;}
break;
case 48:
/* Line 1455 of yacc.c */
#line 551 "program_parse.y"
{
(yyval.src_reg) = (yyvsp[(2) - (2)].src_reg);
if ((yyvsp[(1) - (2)].negate)) {
(yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
}
;}
break;
case 49:
/* Line 1455 of yacc.c */
#line 559 "program_parse.y"
{
(yyval.src_reg) = (yyvsp[(3) - (4)].src_reg);
if (!state->option.NV_fragment) {
yyerror(& (yylsp[(2) - (4)]), state, "unexpected character '|'");
YYERROR;
}
if ((yyvsp[(1) - (4)].negate)) {
(yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
}
(yyval.src_reg).Base.Abs = 1;
;}
break;
case 50:
/* Line 1455 of yacc.c */
#line 576 "program_parse.y"
{
(yyval.src_reg) = (yyvsp[(1) - (2)].src_reg);
(yyval.src_reg).Base.Swizzle = _mesa_combine_swizzles((yyval.src_reg).Base.Swizzle,
(yyvsp[(2) - (2)].swiz_mask).swizzle);
;}
break;
case 51:
/* Line 1455 of yacc.c */
#line 583 "program_parse.y"
{
struct asm_symbol temp_sym;
if (!state->option.NV_fragment) {
yyerror(& (yylsp[(1) - (1)]), state, "expected scalar suffix");
YYERROR;
}
memset(& temp_sym, 0, sizeof(temp_sym));
temp_sym.param_binding_begin = ~0;
initialize_symbol_from_const(state->prog, & temp_sym, & (yyvsp[(1) - (1)].vector), GL_TRUE);
set_src_reg_swz(& (yyval.src_reg), PROGRAM_CONSTANT,
temp_sym.param_binding_begin,
temp_sym.param_binding_swizzle);
;}
break;
case 52:
/* Line 1455 of yacc.c */
#line 602 "program_parse.y"
{
(yyval.src_reg) = (yyvsp[(2) - (3)].src_reg);
if ((yyvsp[(1) - (3)].negate)) {
(yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
}
(yyval.src_reg).Base.Swizzle = _mesa_combine_swizzles((yyval.src_reg).Base.Swizzle,
(yyvsp[(3) - (3)].swiz_mask).swizzle);
;}
break;
case 53:
/* Line 1455 of yacc.c */
#line 613 "program_parse.y"
{
(yyval.src_reg) = (yyvsp[(3) - (5)].src_reg);
if (!state->option.NV_fragment) {
yyerror(& (yylsp[(2) - (5)]), state, "unexpected character '|'");
YYERROR;
}
if ((yyvsp[(1) - (5)].negate)) {
(yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate;
}
(yyval.src_reg).Base.Abs = 1;
(yyval.src_reg).Base.Swizzle = _mesa_combine_swizzles((yyval.src_reg).Base.Swizzle,
(yyvsp[(4) - (5)].swiz_mask).swizzle);
;}
break;
case 54:
/* Line 1455 of yacc.c */
#line 633 "program_parse.y"
{
(yyval.dst_reg) = (yyvsp[(1) - (3)].dst_reg);
(yyval.dst_reg).WriteMask = (yyvsp[(2) - (3)].swiz_mask).mask;
(yyval.dst_reg).CondMask = (yyvsp[(3) - (3)].dst_reg).CondMask;
(yyval.dst_reg).CondSwizzle = (yyvsp[(3) - (3)].dst_reg).CondSwizzle;
(yyval.dst_reg).CondSrc = (yyvsp[(3) - (3)].dst_reg).CondSrc;
if ((yyval.dst_reg).File == PROGRAM_OUTPUT) {
/* Technically speaking, this should check that it is in
* vertex program mode. However, PositionInvariant can never be
* set in fragment program mode, so it is somewhat irrelevant.
*/
if (state->option.PositionInvariant
&& ((yyval.dst_reg).Index == VERT_RESULT_HPOS)) {
yyerror(& (yylsp[(1) - (3)]), state, "position-invariant programs cannot "
"write position");
YYERROR;
}
state->prog->OutputsWritten |= BITFIELD64_BIT((yyval.dst_reg).Index);
}
;}
break;
case 55:
/* Line 1455 of yacc.c */
#line 658 "program_parse.y"
{
set_dst_reg(& (yyval.dst_reg), PROGRAM_ADDRESS, 0);
(yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask;
;}
break;
case 56:
/* Line 1455 of yacc.c */
#line 665 "program_parse.y"
{
const unsigned xyzw_valid =
((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0)
| ((yyvsp[(3) - (7)].ext_swizzle).xyzw_valid << 1)
| ((yyvsp[(5) - (7)].ext_swizzle).xyzw_valid << 2)
| ((yyvsp[(7) - (7)].ext_swizzle).xyzw_valid << 3);
const unsigned rgba_valid =
((yyvsp[(1) - (7)].ext_swizzle).rgba_valid << 0)
| ((yyvsp[(3) - (7)].ext_swizzle).rgba_valid << 1)
| ((yyvsp[(5) - (7)].ext_swizzle).rgba_valid << 2)
| ((yyvsp[(7) - (7)].ext_swizzle).rgba_valid << 3);
/* All of the swizzle components have to be valid in either RGBA
* or XYZW. Note that 0 and 1 are valid in both, so both masks
* can have some bits set.
*
* We somewhat deviate from the spec here. It would be really hard
* to figure out which component is the error, and there probably
* isn't a lot of benefit.
*/
if ((rgba_valid != 0x0f) && (xyzw_valid != 0x0f)) {
yyerror(& (yylsp[(1) - (7)]), state, "cannot combine RGBA and XYZW swizzle "
"components");
YYERROR;
}
(yyval.swiz_mask).swizzle = MAKE_SWIZZLE4((yyvsp[(1) - (7)].ext_swizzle).swz, (yyvsp[(3) - (7)].ext_swizzle).swz, (yyvsp[(5) - (7)].ext_swizzle).swz, (yyvsp[(7) - (7)].ext_swizzle).swz);
(yyval.swiz_mask).mask = ((yyvsp[(1) - (7)].ext_swizzle).negate) | ((yyvsp[(3) - (7)].ext_swizzle).negate << 1) | ((yyvsp[(5) - (7)].ext_swizzle).negate << 2)
| ((yyvsp[(7) - (7)].ext_swizzle).negate << 3);
;}
break;
case 57:
/* Line 1455 of yacc.c */
#line 698 "program_parse.y"
{
(yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle);
(yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0;
;}
break;
case 58:
/* Line 1455 of yacc.c */
#line 705 "program_parse.y"
{
if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector");
YYERROR;
}
(yyval.ext_swizzle).swz = ((yyvsp[(1) - (1)].integer) == 0) ? SWIZZLE_ZERO : SWIZZLE_ONE;
/* 0 and 1 are valid for both RGBA swizzle names and XYZW
* swizzle names.
*/
(yyval.ext_swizzle).xyzw_valid = 1;
(yyval.ext_swizzle).rgba_valid = 1;
;}
break;
case 59:
/* Line 1455 of yacc.c */
#line 720 "program_parse.y"
{
char s;
if (strlen((yyvsp[(1) - (1)].string)) > 1) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector");
YYERROR;
}
s = (yyvsp[(1) - (1)].string)[0];
free((yyvsp[(1) - (1)].string));
switch (s) {
case 'x':
(yyval.ext_swizzle).swz = SWIZZLE_X;
(yyval.ext_swizzle).xyzw_valid = 1;
break;
case 'y':
(yyval.ext_swizzle).swz = SWIZZLE_Y;
(yyval.ext_swizzle).xyzw_valid = 1;
break;
case 'z':
(yyval.ext_swizzle).swz = SWIZZLE_Z;
(yyval.ext_swizzle).xyzw_valid = 1;
break;
case 'w':
(yyval.ext_swizzle).swz = SWIZZLE_W;
(yyval.ext_swizzle).xyzw_valid = 1;
break;
case 'r':
(yyval.ext_swizzle).swz = SWIZZLE_X;
(yyval.ext_swizzle).rgba_valid = 1;
break;
case 'g':
(yyval.ext_swizzle).swz = SWIZZLE_Y;
(yyval.ext_swizzle).rgba_valid = 1;
break;
case 'b':
(yyval.ext_swizzle).swz = SWIZZLE_Z;
(yyval.ext_swizzle).rgba_valid = 1;
break;
case 'a':
(yyval.ext_swizzle).swz = SWIZZLE_W;
(yyval.ext_swizzle).rgba_valid = 1;
break;
default:
yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector");
YYERROR;
break;
}
;}
break;
case 60:
/* Line 1455 of yacc.c */
#line 775 "program_parse.y"
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
free((yyvsp[(1) - (1)].string));
if (s == NULL) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable");
YYERROR;
} else if ((s->type != at_param) && (s->type != at_temp)
&& (s->type != at_attrib)) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable");
YYERROR;
} else if ((s->type == at_param) && s->param_is_array) {
yyerror(& (yylsp[(1) - (1)]), state, "non-array access to array PARAM");
YYERROR;
}
init_src_reg(& (yyval.src_reg));
switch (s->type) {
case at_temp:
set_src_reg(& (yyval.src_reg), PROGRAM_TEMPORARY, s->temp_binding);
break;
case at_param:
set_src_reg_swz(& (yyval.src_reg), s->param_binding_type,
s->param_binding_begin,
s->param_binding_swizzle);
break;
case at_attrib:
set_src_reg(& (yyval.src_reg), PROGRAM_INPUT, s->attrib_binding);
state->prog->InputsRead |= (1U << (yyval.src_reg).Base.Index);
if (!validate_inputs(& (yylsp[(1) - (1)]), state)) {
YYERROR;
}
break;
default:
YYERROR;
break;
}
;}
break;
case 61:
/* Line 1455 of yacc.c */
#line 818 "program_parse.y"
{
set_src_reg(& (yyval.src_reg), PROGRAM_INPUT, (yyvsp[(1) - (1)].attrib));
state->prog->InputsRead |= (1U << (yyval.src_reg).Base.Index);
if (!validate_inputs(& (yylsp[(1) - (1)]), state)) {
YYERROR;
}
;}
break;
case 62:
/* Line 1455 of yacc.c */
#line 827 "program_parse.y"
{
if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr
&& ((unsigned) (yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) {
yyerror(& (yylsp[(3) - (4)]), state, "out of bounds array access");
YYERROR;
}
init_src_reg(& (yyval.src_reg));
(yyval.src_reg).Base.File = (yyvsp[(1) - (4)].sym)->param_binding_type;
if ((yyvsp[(3) - (4)].src_reg).Base.RelAddr) {
(yyvsp[(1) - (4)].sym)->param_accessed_indirectly = 1;
(yyval.src_reg).Base.RelAddr = 1;
(yyval.src_reg).Base.Index = (yyvsp[(3) - (4)].src_reg).Base.Index;
(yyval.src_reg).Symbol = (yyvsp[(1) - (4)].sym);
} else {
(yyval.src_reg).Base.Index = (yyvsp[(1) - (4)].sym)->param_binding_begin + (yyvsp[(3) - (4)].src_reg).Base.Index;
}
;}
break;
case 63:
/* Line 1455 of yacc.c */
#line 848 "program_parse.y"
{
gl_register_file file = ((yyvsp[(1) - (1)].temp_sym).name != NULL)
? (yyvsp[(1) - (1)].temp_sym).param_binding_type
: PROGRAM_CONSTANT;
set_src_reg_swz(& (yyval.src_reg), file, (yyvsp[(1) - (1)].temp_sym).param_binding_begin,
(yyvsp[(1) - (1)].temp_sym).param_binding_swizzle);
;}
break;
case 64:
/* Line 1455 of yacc.c */
#line 858 "program_parse.y"
{
set_dst_reg(& (yyval.dst_reg), PROGRAM_OUTPUT, (yyvsp[(1) - (1)].result));
;}
break;
case 65:
/* Line 1455 of yacc.c */
#line 862 "program_parse.y"
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
free((yyvsp[(1) - (1)].string));
if (s == NULL) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable");
YYERROR;
} else if ((s->type != at_output) && (s->type != at_temp)) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable");
YYERROR;
}
switch (s->type) {
case at_temp:
set_dst_reg(& (yyval.dst_reg), PROGRAM_TEMPORARY, s->temp_binding);
break;
case at_output:
set_dst_reg(& (yyval.dst_reg), PROGRAM_OUTPUT, s->output_binding);
break;
default:
set_dst_reg(& (yyval.dst_reg), s->param_binding_type, s->param_binding_begin);
break;
}
;}
break;
case 66:
/* Line 1455 of yacc.c */
#line 891 "program_parse.y"
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
free((yyvsp[(1) - (1)].string));
if (s == NULL) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable");
YYERROR;
} else if ((s->type != at_param) || !s->param_is_array) {
yyerror(& (yylsp[(1) - (1)]), state, "array access to non-PARAM variable");
YYERROR;
} else {
(yyval.sym) = s;
}
;}
break;
case 69:
/* Line 1455 of yacc.c */
#line 912 "program_parse.y"
{
init_src_reg(& (yyval.src_reg));
(yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer);
;}
break;
case 70:
/* Line 1455 of yacc.c */
#line 919 "program_parse.y"
{
/* FINISHME: Add support for multiple address registers.
*/
/* FINISHME: Add support for 4-component address registers.
*/
init_src_reg(& (yyval.src_reg));
(yyval.src_reg).Base.RelAddr = 1;
(yyval.src_reg).Base.Index = (yyvsp[(3) - (3)].integer);
;}
break;
case 71:
/* Line 1455 of yacc.c */
#line 930 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
case 72:
/* Line 1455 of yacc.c */
#line 931 "program_parse.y"
{ (yyval.integer) = (yyvsp[(2) - (2)].integer); ;}
break;
case 73:
/* Line 1455 of yacc.c */
#line 932 "program_parse.y"
{ (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;}
break;
case 74:
/* Line 1455 of yacc.c */
#line 936 "program_parse.y"
{
if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) {
char s[100];
_mesa_snprintf(s, sizeof(s),
"relative address offset too large (%d)", (yyvsp[(1) - (1)].integer));
yyerror(& (yylsp[(1) - (1)]), state, s);
YYERROR;
} else {
(yyval.integer) = (yyvsp[(1) - (1)].integer);
}
;}
break;
case 75:
/* Line 1455 of yacc.c */
#line 950 "program_parse.y"
{
if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) {
char s[100];
_mesa_snprintf(s, sizeof(s),
"relative address offset too large (%d)", (yyvsp[(1) - (1)].integer));
yyerror(& (yylsp[(1) - (1)]), state, s);
YYERROR;
} else {
(yyval.integer) = (yyvsp[(1) - (1)].integer);
}
;}
break;
case 76:
/* Line 1455 of yacc.c */
#line 964 "program_parse.y"
{
struct asm_symbol *const s = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string));
free((yyvsp[(1) - (1)].string));
if (s == NULL) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid array member");
YYERROR;
} else if (s->type != at_address) {
yyerror(& (yylsp[(1) - (1)]), state,
"invalid variable for indexed array access");
YYERROR;
} else {
(yyval.sym) = s;
}
;}
break;
case 77:
/* Line 1455 of yacc.c */
#line 984 "program_parse.y"
{
if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector");
YYERROR;
} else {
(yyval.swiz_mask) = (yyvsp[(1) - (1)].swiz_mask);
}
;}
break;
case 78:
/* Line 1455 of yacc.c */
#line 995 "program_parse.y"
{
if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) {
yyerror(& (yylsp[(1) - (1)]), state,
"address register write mask must be \".x\"");
YYERROR;
} else {
(yyval.swiz_mask) = (yyvsp[(1) - (1)].swiz_mask);
}
;}
break;
case 83:
/* Line 1455 of yacc.c */
#line 1011 "program_parse.y"
{ (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;}
break;
case 88:
/* Line 1455 of yacc.c */
#line 1015 "program_parse.y"
{ (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;}
break;
case 89:
/* Line 1455 of yacc.c */
#line 1019 "program_parse.y"
{
(yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg);
;}
break;
case 90:
/* Line 1455 of yacc.c */
#line 1023 "program_parse.y"
{
(yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg);
;}
break;
case 91:
/* Line 1455 of yacc.c */
#line 1027 "program_parse.y"
{
(yyval.dst_reg).CondMask = COND_TR;
(yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP;
(yyval.dst_reg).CondSrc = 0;
;}
break;
case 92:
/* Line 1455 of yacc.c */
#line 1035 "program_parse.y"
{
(yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg);
(yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle;
;}
break;
case 93:
/* Line 1455 of yacc.c */
#line 1042 "program_parse.y"
{
(yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg);
(yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle;
;}
break;
case 94:
/* Line 1455 of yacc.c */
#line 1049 "program_parse.y"
{
const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string));
if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) {
char *const err_str =
make_error_string("invalid condition code \"%s\"", (yyvsp[(1) - (1)].string));
yyerror(& (yylsp[(1) - (1)]), state, (err_str != NULL)
? err_str : "invalid condition code");
if (err_str != NULL) {
free(err_str);
}
YYERROR;
}
(yyval.dst_reg).CondMask = cond;
(yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP;
(yyval.dst_reg).CondSrc = 0;
;}
break;
case 95:
/* Line 1455 of yacc.c */
#line 1072 "program_parse.y"
{
const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string));
if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) {
char *const err_str =
make_error_string("invalid condition code \"%s\"", (yyvsp[(1) - (1)].string));
yyerror(& (yylsp[(1) - (1)]), state, (err_str != NULL)
? err_str : "invalid condition code");
if (err_str != NULL) {
free(err_str);
}
YYERROR;
}
(yyval.dst_reg).CondMask = cond;
(yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP;
(yyval.dst_reg).CondSrc = 0;
;}
break;
case 102:
/* Line 1455 of yacc.c */
#line 1103 "program_parse.y"
{
struct asm_symbol *const s =
declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)]));
if (s == NULL) {
free((yyvsp[(2) - (4)].string));
YYERROR;
} else {
s->attrib_binding = (yyvsp[(4) - (4)].attrib);
state->InputsBound |= (1U << s->attrib_binding);
if (!validate_inputs(& (yylsp[(4) - (4)]), state)) {
YYERROR;
}
}
;}
break;
case 103:
/* Line 1455 of yacc.c */
#line 1122 "program_parse.y"
{
(yyval.attrib) = (yyvsp[(2) - (2)].attrib);
;}
break;
case 104:
/* Line 1455 of yacc.c */
#line 1126 "program_parse.y"
{
(yyval.attrib) = (yyvsp[(2) - (2)].attrib);
;}
break;
case 105:
/* Line 1455 of yacc.c */
#line 1132 "program_parse.y"
{
(yyval.attrib) = VERT_ATTRIB_POS;
;}
break;
case 106:
/* Line 1455 of yacc.c */
#line 1136 "program_parse.y"
{
(yyval.attrib) = VERT_ATTRIB_WEIGHT;
;}
break;
case 107:
/* Line 1455 of yacc.c */
#line 1140 "program_parse.y"
{
(yyval.attrib) = VERT_ATTRIB_NORMAL;
;}
break;
case 108:
/* Line 1455 of yacc.c */
#line 1144 "program_parse.y"
{
if (!state->ctx->Extensions.EXT_secondary_color) {
yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported");
YYERROR;
}
(yyval.attrib) = VERT_ATTRIB_COLOR0 + (yyvsp[(2) - (2)].integer);
;}
break;
case 109:
/* Line 1455 of yacc.c */
#line 1153 "program_parse.y"
{
if (!state->ctx->Extensions.EXT_fog_coord) {
yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported");
YYERROR;
}
(yyval.attrib) = VERT_ATTRIB_FOG;
;}
break;
case 110:
/* Line 1455 of yacc.c */
#line 1162 "program_parse.y"
{
(yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer);
;}
break;
case 111:
/* Line 1455 of yacc.c */
#line 1166 "program_parse.y"
{
yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported");
YYERROR;
;}
break;
case 112:
/* Line 1455 of yacc.c */
#line 1171 "program_parse.y"
{
(yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer);
;}
break;
case 113:
/* Line 1455 of yacc.c */
#line 1177 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference");
YYERROR;
}
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
case 117:
/* Line 1455 of yacc.c */
#line 1191 "program_parse.y"
{
(yyval.attrib) = FRAG_ATTRIB_WPOS;
;}
break;
case 118:
/* Line 1455 of yacc.c */
#line 1195 "program_parse.y"
{
(yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer);
;}
break;
case 119:
/* Line 1455 of yacc.c */
#line 1199 "program_parse.y"
{
(yyval.attrib) = FRAG_ATTRIB_FOGC;
;}
break;
case 120:
/* Line 1455 of yacc.c */
#line 1203 "program_parse.y"
{
(yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer);
;}
break;
case 123:
/* Line 1455 of yacc.c */
#line 1211 "program_parse.y"
{
struct asm_symbol *const s =
declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)]));
if (s == NULL) {
free((yyvsp[(2) - (3)].string));
YYERROR;
} else {
s->param_binding_type = (yyvsp[(3) - (3)].temp_sym).param_binding_type;
s->param_binding_begin = (yyvsp[(3) - (3)].temp_sym).param_binding_begin;
s->param_binding_length = (yyvsp[(3) - (3)].temp_sym).param_binding_length;
s->param_binding_swizzle = SWIZZLE_XYZW;
s->param_is_array = 0;
}
;}
break;
case 124:
/* Line 1455 of yacc.c */
#line 1229 "program_parse.y"
{
if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) {
free((yyvsp[(2) - (6)].string));
yyerror(& (yylsp[(4) - (6)]), state,
"parameter array size and number of bindings must match");
YYERROR;
} else {
struct asm_symbol *const s =
declare_variable(state, (yyvsp[(2) - (6)].string), (yyvsp[(6) - (6)].temp_sym).type, & (yylsp[(2) - (6)]));
if (s == NULL) {
free((yyvsp[(2) - (6)].string));
YYERROR;
} else {
s->param_binding_type = (yyvsp[(6) - (6)].temp_sym).param_binding_type;
s->param_binding_begin = (yyvsp[(6) - (6)].temp_sym).param_binding_begin;
s->param_binding_length = (yyvsp[(6) - (6)].temp_sym).param_binding_length;
s->param_binding_swizzle = SWIZZLE_XYZW;
s->param_is_array = 1;
}
}
;}
break;
case 125:
/* Line 1455 of yacc.c */
#line 1254 "program_parse.y"
{
(yyval.integer) = 0;
;}
break;
case 126:
/* Line 1455 of yacc.c */
#line 1258 "program_parse.y"
{
if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) > state->limits->MaxParameters)) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size");
YYERROR;
} else {
(yyval.integer) = (yyvsp[(1) - (1)].integer);
}
;}
break;
case 127:
/* Line 1455 of yacc.c */
#line 1269 "program_parse.y"
{
(yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym);
;}
break;
case 128:
/* Line 1455 of yacc.c */
#line 1275 "program_parse.y"
{
(yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym);
;}
break;
case 130:
/* Line 1455 of yacc.c */
#line 1282 "program_parse.y"
{
(yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length;
(yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym);
;}
break;
case 131:
/* Line 1455 of yacc.c */
#line 1289 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
initialize_symbol_from_state(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
;}
break;
case 132:
/* Line 1455 of yacc.c */
#line 1295 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
initialize_symbol_from_param(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
;}
break;
case 133:
/* Line 1455 of yacc.c */
#line 1301 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
initialize_symbol_from_const(state->prog, & (yyval.temp_sym), & (yyvsp[(1) - (1)].vector), GL_TRUE);
;}
break;
case 134:
/* Line 1455 of yacc.c */
#line 1309 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
initialize_symbol_from_state(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
;}
break;
case 135:
/* Line 1455 of yacc.c */
#line 1315 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
initialize_symbol_from_param(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
;}
break;
case 136:
/* Line 1455 of yacc.c */
#line 1321 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
initialize_symbol_from_const(state->prog, & (yyval.temp_sym), & (yyvsp[(1) - (1)].vector), GL_TRUE);
;}
break;
case 137:
/* Line 1455 of yacc.c */
#line 1329 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
initialize_symbol_from_state(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
;}
break;
case 138:
/* Line 1455 of yacc.c */
#line 1335 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
initialize_symbol_from_param(state->prog, & (yyval.temp_sym), (yyvsp[(1) - (1)].state));
;}
break;
case 139:
/* Line 1455 of yacc.c */
#line 1341 "program_parse.y"
{
memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym)));
(yyval.temp_sym).param_binding_begin = ~0;
initialize_symbol_from_const(state->prog, & (yyval.temp_sym), & (yyvsp[(1) - (1)].vector), GL_FALSE);
;}
break;
case 140:
/* Line 1455 of yacc.c */
#line 1348 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;}
break;
case 141:
/* Line 1455 of yacc.c */
#line 1349 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
case 142:
/* Line 1455 of yacc.c */
#line 1352 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
case 143:
/* Line 1455 of yacc.c */
#line 1353 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
case 144:
/* Line 1455 of yacc.c */
#line 1354 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
case 145:
/* Line 1455 of yacc.c */
#line 1355 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
case 146:
/* Line 1455 of yacc.c */
#line 1356 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
case 147:
/* Line 1455 of yacc.c */
#line 1357 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
case 148:
/* Line 1455 of yacc.c */
#line 1358 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
case 149:
/* Line 1455 of yacc.c */
#line 1359 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
case 150:
/* Line 1455 of yacc.c */
#line 1360 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
case 151:
/* Line 1455 of yacc.c */
#line 1361 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
case 152:
/* Line 1455 of yacc.c */
#line 1362 "program_parse.y"
{ memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;}
break;
case 153:
/* Line 1455 of yacc.c */
#line 1366 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_MATERIAL;
(yyval.state)[1] = (yyvsp[(2) - (3)].integer);
(yyval.state)[2] = (yyvsp[(3) - (3)].integer);
;}
break;
case 154:
/* Line 1455 of yacc.c */
#line 1375 "program_parse.y"
{
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
case 155:
/* Line 1455 of yacc.c */
#line 1379 "program_parse.y"
{
(yyval.integer) = STATE_EMISSION;
;}
break;
case 156:
/* Line 1455 of yacc.c */
#line 1383 "program_parse.y"
{
(yyval.integer) = STATE_SHININESS;
;}
break;
case 157:
/* Line 1455 of yacc.c */
#line 1389 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_LIGHT;
(yyval.state)[1] = (yyvsp[(3) - (5)].integer);
(yyval.state)[2] = (yyvsp[(5) - (5)].integer);
;}
break;
case 158:
/* Line 1455 of yacc.c */
#line 1398 "program_parse.y"
{
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
case 159:
/* Line 1455 of yacc.c */
#line 1402 "program_parse.y"
{
(yyval.integer) = STATE_POSITION;
;}
break;
case 160:
/* Line 1455 of yacc.c */
#line 1406 "program_parse.y"
{
if (!state->ctx->Extensions.EXT_point_parameters) {
yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported");
YYERROR;
}
(yyval.integer) = STATE_ATTENUATION;
;}
break;
case 161:
/* Line 1455 of yacc.c */
#line 1415 "program_parse.y"
{
(yyval.integer) = (yyvsp[(2) - (2)].integer);
;}
break;
case 162:
/* Line 1455 of yacc.c */
#line 1419 "program_parse.y"
{
(yyval.integer) = STATE_HALF_VECTOR;
;}
break;
case 163:
/* Line 1455 of yacc.c */
#line 1425 "program_parse.y"
{
(yyval.integer) = STATE_SPOT_DIRECTION;
;}
break;
case 164:
/* Line 1455 of yacc.c */
#line 1431 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(2) - (2)].state)[0];
(yyval.state)[1] = (yyvsp[(2) - (2)].state)[1];
;}
break;
case 165:
/* Line 1455 of yacc.c */
#line 1438 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT;
;}
break;
case 166:
/* Line 1455 of yacc.c */
#line 1443 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR;
(yyval.state)[1] = (yyvsp[(1) - (2)].integer);
;}
break;
case 167:
/* Line 1455 of yacc.c */
#line 1451 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_LIGHTPROD;
(yyval.state)[1] = (yyvsp[(3) - (6)].integer);
(yyval.state)[2] = (yyvsp[(5) - (6)].integer);
(yyval.state)[3] = (yyvsp[(6) - (6)].integer);
;}
break;
case 169:
/* Line 1455 of yacc.c */
#line 1463 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = (yyvsp[(3) - (3)].integer);
(yyval.state)[1] = (yyvsp[(2) - (3)].integer);
;}
break;
case 170:
/* Line 1455 of yacc.c */
#line 1471 "program_parse.y"
{
(yyval.integer) = STATE_TEXENV_COLOR;
;}
break;
case 171:
/* Line 1455 of yacc.c */
#line 1477 "program_parse.y"
{
(yyval.integer) = STATE_AMBIENT;
;}
break;
case 172:
/* Line 1455 of yacc.c */
#line 1481 "program_parse.y"
{
(yyval.integer) = STATE_DIFFUSE;
;}
break;
case 173:
/* Line 1455 of yacc.c */
#line 1485 "program_parse.y"
{
(yyval.integer) = STATE_SPECULAR;
;}
break;
case 174:
/* Line 1455 of yacc.c */
#line 1491 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector");
YYERROR;
}
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
case 175:
/* Line 1455 of yacc.c */
#line 1502 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_TEXGEN;
(yyval.state)[1] = (yyvsp[(2) - (4)].integer);
(yyval.state)[2] = (yyvsp[(3) - (4)].integer) + (yyvsp[(4) - (4)].integer);
;}
break;
case 176:
/* Line 1455 of yacc.c */
#line 1511 "program_parse.y"
{
(yyval.integer) = STATE_TEXGEN_EYE_S;
;}
break;
case 177:
/* Line 1455 of yacc.c */
#line 1515 "program_parse.y"
{
(yyval.integer) = STATE_TEXGEN_OBJECT_S;
;}
break;
case 178:
/* Line 1455 of yacc.c */
#line 1520 "program_parse.y"
{
(yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S;
;}
break;
case 179:
/* Line 1455 of yacc.c */
#line 1524 "program_parse.y"
{
(yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S;
;}
break;
case 180:
/* Line 1455 of yacc.c */
#line 1528 "program_parse.y"
{
(yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S;
;}
break;
case 181:
/* Line 1455 of yacc.c */
#line 1532 "program_parse.y"
{
(yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S;
;}
break;
case 182:
/* Line 1455 of yacc.c */
#line 1538 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = (yyvsp[(2) - (2)].integer);
;}
break;
case 183:
/* Line 1455 of yacc.c */
#line 1545 "program_parse.y"
{
(yyval.integer) = STATE_FOG_COLOR;
;}
break;
case 184:
/* Line 1455 of yacc.c */
#line 1549 "program_parse.y"
{
(yyval.integer) = STATE_FOG_PARAMS;
;}
break;
case 185:
/* Line 1455 of yacc.c */
#line 1555 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_CLIPPLANE;
(yyval.state)[1] = (yyvsp[(3) - (5)].integer);
;}
break;
case 186:
/* Line 1455 of yacc.c */
#line 1563 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector");
YYERROR;
}
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
case 187:
/* Line 1455 of yacc.c */
#line 1574 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = (yyvsp[(2) - (2)].integer);
;}
break;
case 188:
/* Line 1455 of yacc.c */
#line 1581 "program_parse.y"
{
(yyval.integer) = STATE_POINT_SIZE;
;}
break;
case 189:
/* Line 1455 of yacc.c */
#line 1585 "program_parse.y"
{
(yyval.integer) = STATE_POINT_ATTENUATION;
;}
break;
case 190:
/* Line 1455 of yacc.c */
#line 1591 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(1) - (5)].state)[0];
(yyval.state)[1] = (yyvsp[(1) - (5)].state)[1];
(yyval.state)[2] = (yyvsp[(4) - (5)].integer);
(yyval.state)[3] = (yyvsp[(4) - (5)].integer);
(yyval.state)[4] = (yyvsp[(1) - (5)].state)[2];
;}
break;
case 191:
/* Line 1455 of yacc.c */
#line 1601 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(1) - (2)].state)[0];
(yyval.state)[1] = (yyvsp[(1) - (2)].state)[1];
(yyval.state)[2] = (yyvsp[(2) - (2)].state)[2];
(yyval.state)[3] = (yyvsp[(2) - (2)].state)[3];
(yyval.state)[4] = (yyvsp[(1) - (2)].state)[2];
;}
break;
case 192:
/* Line 1455 of yacc.c */
#line 1611 "program_parse.y"
{
(yyval.state)[2] = 0;
(yyval.state)[3] = 3;
;}
break;
case 193:
/* Line 1455 of yacc.c */
#line 1616 "program_parse.y"
{
/* It seems logical that the matrix row range specifier would have
* to specify a range or more than one row (i.e., $5 > $3).
* However, the ARB_vertex_program spec says "a program will fail
* to load if <a> is greater than <b>." This means that $3 == $5
* is valid.
*/
if ((yyvsp[(3) - (6)].integer) > (yyvsp[(5) - (6)].integer)) {
yyerror(& (yylsp[(3) - (6)]), state, "invalid matrix row range");
YYERROR;
}
(yyval.state)[2] = (yyvsp[(3) - (6)].integer);
(yyval.state)[3] = (yyvsp[(5) - (6)].integer);
;}
break;
case 194:
/* Line 1455 of yacc.c */
#line 1634 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(2) - (3)].state)[0];
(yyval.state)[1] = (yyvsp[(2) - (3)].state)[1];
(yyval.state)[2] = (yyvsp[(3) - (3)].integer);
;}
break;
case 195:
/* Line 1455 of yacc.c */
#line 1642 "program_parse.y"
{
(yyval.integer) = 0;
;}
break;
case 196:
/* Line 1455 of yacc.c */
#line 1646 "program_parse.y"
{
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
case 197:
/* Line 1455 of yacc.c */
#line 1652 "program_parse.y"
{
(yyval.integer) = STATE_MATRIX_INVERSE;
;}
break;
case 198:
/* Line 1455 of yacc.c */
#line 1656 "program_parse.y"
{
(yyval.integer) = STATE_MATRIX_TRANSPOSE;
;}
break;
case 199:
/* Line 1455 of yacc.c */
#line 1660 "program_parse.y"
{
(yyval.integer) = STATE_MATRIX_INVTRANS;
;}
break;
case 200:
/* Line 1455 of yacc.c */
#line 1666 "program_parse.y"
{
if ((yyvsp[(1) - (1)].integer) > 3) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference");
YYERROR;
}
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
case 201:
/* Line 1455 of yacc.c */
#line 1677 "program_parse.y"
{
(yyval.state)[0] = STATE_MODELVIEW_MATRIX;
(yyval.state)[1] = (yyvsp[(2) - (2)].integer);
;}
break;
case 202:
/* Line 1455 of yacc.c */
#line 1682 "program_parse.y"
{
(yyval.state)[0] = STATE_PROJECTION_MATRIX;
(yyval.state)[1] = 0;
;}
break;
case 203:
/* Line 1455 of yacc.c */
#line 1687 "program_parse.y"
{
(yyval.state)[0] = STATE_MVP_MATRIX;
(yyval.state)[1] = 0;
;}
break;
case 204:
/* Line 1455 of yacc.c */
#line 1692 "program_parse.y"
{
(yyval.state)[0] = STATE_TEXTURE_MATRIX;
(yyval.state)[1] = (yyvsp[(2) - (2)].integer);
;}
break;
case 205:
/* Line 1455 of yacc.c */
#line 1697 "program_parse.y"
{
yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported");
YYERROR;
;}
break;
case 206:
/* Line 1455 of yacc.c */
#line 1702 "program_parse.y"
{
(yyval.state)[0] = STATE_PROGRAM_MATRIX;
(yyval.state)[1] = (yyvsp[(3) - (4)].integer);
;}
break;
case 207:
/* Line 1455 of yacc.c */
#line 1709 "program_parse.y"
{
(yyval.integer) = 0;
;}
break;
case 208:
/* Line 1455 of yacc.c */
#line 1713 "program_parse.y"
{
(yyval.integer) = (yyvsp[(2) - (3)].integer);
;}
break;
case 209:
/* Line 1455 of yacc.c */
#line 1718 "program_parse.y"
{
/* Since GL_ARB_vertex_blend isn't supported, only modelview matrix
* zero is valid.
*/
if ((yyvsp[(1) - (1)].integer) != 0) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid modelview matrix index");
YYERROR;
}
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
case 210:
/* Line 1455 of yacc.c */
#line 1731 "program_parse.y"
{
/* Since GL_ARB_matrix_palette isn't supported, just let any value
* through here. The error will be generated later.
*/
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
case 211:
/* Line 1455 of yacc.c */
#line 1739 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector");
YYERROR;
}
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
case 212:
/* Line 1455 of yacc.c */
#line 1750 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = STATE_DEPTH_RANGE;
;}
break;
case 217:
/* Line 1455 of yacc.c */
#line 1762 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = state->state_param_enum;
(yyval.state)[1] = STATE_ENV;
(yyval.state)[2] = (yyvsp[(4) - (5)].state)[0];
(yyval.state)[3] = (yyvsp[(4) - (5)].state)[1];
;}
break;
case 218:
/* Line 1455 of yacc.c */
#line 1772 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(1) - (1)].integer);
(yyval.state)[1] = (yyvsp[(1) - (1)].integer);
;}
break;
case 219:
/* Line 1455 of yacc.c */
#line 1777 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(1) - (3)].integer);
(yyval.state)[1] = (yyvsp[(3) - (3)].integer);
;}
break;
case 220:
/* Line 1455 of yacc.c */
#line 1784 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = state->state_param_enum;
(yyval.state)[1] = STATE_ENV;
(yyval.state)[2] = (yyvsp[(4) - (5)].integer);
(yyval.state)[3] = (yyvsp[(4) - (5)].integer);
;}
break;
case 221:
/* Line 1455 of yacc.c */
#line 1794 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = state->state_param_enum;
(yyval.state)[1] = STATE_LOCAL;
(yyval.state)[2] = (yyvsp[(4) - (5)].state)[0];
(yyval.state)[3] = (yyvsp[(4) - (5)].state)[1];
;}
break;
case 222:
/* Line 1455 of yacc.c */
#line 1803 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(1) - (1)].integer);
(yyval.state)[1] = (yyvsp[(1) - (1)].integer);
;}
break;
case 223:
/* Line 1455 of yacc.c */
#line 1808 "program_parse.y"
{
(yyval.state)[0] = (yyvsp[(1) - (3)].integer);
(yyval.state)[1] = (yyvsp[(3) - (3)].integer);
;}
break;
case 224:
/* Line 1455 of yacc.c */
#line 1815 "program_parse.y"
{
memset((yyval.state), 0, sizeof((yyval.state)));
(yyval.state)[0] = state->state_param_enum;
(yyval.state)[1] = STATE_LOCAL;
(yyval.state)[2] = (yyvsp[(4) - (5)].integer);
(yyval.state)[3] = (yyvsp[(4) - (5)].integer);
;}
break;
case 225:
/* Line 1455 of yacc.c */
#line 1825 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference");
YYERROR;
}
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
case 226:
/* Line 1455 of yacc.c */
#line 1835 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference");
YYERROR;
}
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
case 231:
/* Line 1455 of yacc.c */
#line 1850 "program_parse.y"
{
(yyval.vector).count = 4;
(yyval.vector).data[0] = (yyvsp[(1) - (1)].real);
(yyval.vector).data[1] = (yyvsp[(1) - (1)].real);
(yyval.vector).data[2] = (yyvsp[(1) - (1)].real);
(yyval.vector).data[3] = (yyvsp[(1) - (1)].real);
;}
break;
case 232:
/* Line 1455 of yacc.c */
#line 1860 "program_parse.y"
{
(yyval.vector).count = 1;
(yyval.vector).data[0] = (yyvsp[(1) - (1)].real);
(yyval.vector).data[1] = (yyvsp[(1) - (1)].real);
(yyval.vector).data[2] = (yyvsp[(1) - (1)].real);
(yyval.vector).data[3] = (yyvsp[(1) - (1)].real);
;}
break;
case 233:
/* Line 1455 of yacc.c */
#line 1868 "program_parse.y"
{
(yyval.vector).count = 1;
(yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer);
(yyval.vector).data[1] = (float) (yyvsp[(1) - (1)].integer);
(yyval.vector).data[2] = (float) (yyvsp[(1) - (1)].integer);
(yyval.vector).data[3] = (float) (yyvsp[(1) - (1)].integer);
;}
break;
case 234:
/* Line 1455 of yacc.c */
#line 1878 "program_parse.y"
{
(yyval.vector).count = 4;
(yyval.vector).data[0] = (yyvsp[(2) - (3)].real);
(yyval.vector).data[1] = 0.0f;
(yyval.vector).data[2] = 0.0f;
(yyval.vector).data[3] = 1.0f;
;}
break;
case 235:
/* Line 1455 of yacc.c */
#line 1886 "program_parse.y"
{
(yyval.vector).count = 4;
(yyval.vector).data[0] = (yyvsp[(2) - (5)].real);
(yyval.vector).data[1] = (yyvsp[(4) - (5)].real);
(yyval.vector).data[2] = 0.0f;
(yyval.vector).data[3] = 1.0f;
;}
break;
case 236:
/* Line 1455 of yacc.c */
#line 1895 "program_parse.y"
{
(yyval.vector).count = 4;
(yyval.vector).data[0] = (yyvsp[(2) - (7)].real);
(yyval.vector).data[1] = (yyvsp[(4) - (7)].real);
(yyval.vector).data[2] = (yyvsp[(6) - (7)].real);
(yyval.vector).data[3] = 1.0f;
;}
break;
case 237:
/* Line 1455 of yacc.c */
#line 1904 "program_parse.y"
{
(yyval.vector).count = 4;
(yyval.vector).data[0] = (yyvsp[(2) - (9)].real);
(yyval.vector).data[1] = (yyvsp[(4) - (9)].real);
(yyval.vector).data[2] = (yyvsp[(6) - (9)].real);
(yyval.vector).data[3] = (yyvsp[(8) - (9)].real);
;}
break;
case 238:
/* Line 1455 of yacc.c */
#line 1914 "program_parse.y"
{
(yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real);
;}
break;
case 239:
/* Line 1455 of yacc.c */
#line 1918 "program_parse.y"
{
(yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer));
;}
break;
case 240:
/* Line 1455 of yacc.c */
#line 1923 "program_parse.y"
{ (yyval.negate) = FALSE; ;}
break;
case 241:
/* Line 1455 of yacc.c */
#line 1924 "program_parse.y"
{ (yyval.negate) = TRUE; ;}
break;
case 242:
/* Line 1455 of yacc.c */
#line 1925 "program_parse.y"
{ (yyval.negate) = FALSE; ;}
break;
case 243:
/* Line 1455 of yacc.c */
#line 1928 "program_parse.y"
{ (yyval.integer) = (yyvsp[(2) - (2)].integer); ;}
break;
case 245:
/* Line 1455 of yacc.c */
#line 1932 "program_parse.y"
{
/* NV_fragment_program_option defines the size qualifiers in a
* fairly broken way. "SHORT" or "LONG" can optionally be used
* before TEMP or OUTPUT. However, neither is a reserved word!
* This means that we have to parse it as an identifier, then check
* to make sure it's one of the valid values. *sigh*
*
* In addition, the grammar in the extension spec does *not* allow
* the size specifier to be optional, but all known implementations
* do.
*/
if (!state->option.NV_fragment) {
yyerror(& (yylsp[(1) - (1)]), state, "unexpected IDENTIFIER");
YYERROR;
}
if (strcmp("SHORT", (yyvsp[(1) - (1)].string)) == 0) {
} else if (strcmp("LONG", (yyvsp[(1) - (1)].string)) == 0) {
} else {
char *const err_str =
make_error_string("invalid storage size specifier \"%s\"",
(yyvsp[(1) - (1)].string));
yyerror(& (yylsp[(1) - (1)]), state, (err_str != NULL)
? err_str : "invalid storage size specifier");
if (err_str != NULL) {
free(err_str);
}
YYERROR;
}
;}
break;
case 246:
/* Line 1455 of yacc.c */
#line 1966 "program_parse.y"
{
;}
break;
case 247:
/* Line 1455 of yacc.c */
#line 1970 "program_parse.y"
{ (yyval.integer) = (yyvsp[(1) - (1)].integer); ;}
break;
case 249:
/* Line 1455 of yacc.c */
#line 1974 "program_parse.y"
{
if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) {
free((yyvsp[(3) - (3)].string));
YYERROR;
}
;}
break;
case 250:
/* Line 1455 of yacc.c */
#line 1981 "program_parse.y"
{
if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) {
free((yyvsp[(1) - (1)].string));
YYERROR;
}
;}
break;
case 251:
/* Line 1455 of yacc.c */
#line 1990 "program_parse.y"
{
struct asm_symbol *const s =
declare_variable(state, (yyvsp[(3) - (5)].string), at_output, & (yylsp[(3) - (5)]));
if (s == NULL) {
free((yyvsp[(3) - (5)].string));
YYERROR;
} else {
s->output_binding = (yyvsp[(5) - (5)].result);
}
;}
break;
case 252:
/* Line 1455 of yacc.c */
#line 2004 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.result) = VERT_RESULT_HPOS;
} else {
yyerror(& (yylsp[(2) - (2)]), state, "invalid program result name");
YYERROR;
}
;}
break;
case 253:
/* Line 1455 of yacc.c */
#line 2013 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.result) = VERT_RESULT_FOGC;
} else {
yyerror(& (yylsp[(2) - (2)]), state, "invalid program result name");
YYERROR;
}
;}
break;
case 254:
/* Line 1455 of yacc.c */
#line 2022 "program_parse.y"
{
(yyval.result) = (yyvsp[(2) - (2)].result);
;}
break;
case 255:
/* Line 1455 of yacc.c */
#line 2026 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.result) = VERT_RESULT_PSIZ;
} else {
yyerror(& (yylsp[(2) - (2)]), state, "invalid program result name");
YYERROR;
}
;}
break;
case 256:
/* Line 1455 of yacc.c */
#line 2035 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer);
} else {
yyerror(& (yylsp[(2) - (3)]), state, "invalid program result name");
YYERROR;
}
;}
break;
case 257:
/* Line 1455 of yacc.c */
#line 2044 "program_parse.y"
{
if (state->mode == ARB_fragment) {
(yyval.result) = FRAG_RESULT_DEPTH;
} else {
yyerror(& (yylsp[(2) - (2)]), state, "invalid program result name");
YYERROR;
}
;}
break;
case 258:
/* Line 1455 of yacc.c */
#line 2055 "program_parse.y"
{
(yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer);
;}
break;
case 259:
/* Line 1455 of yacc.c */
#line 2061 "program_parse.y"
{
(yyval.integer) = (state->mode == ARB_vertex)
? VERT_RESULT_COL0
: FRAG_RESULT_COLOR;
;}
break;
case 260:
/* Line 1455 of yacc.c */
#line 2067 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.integer) = VERT_RESULT_COL0;
} else {
yyerror(& (yylsp[(1) - (1)]), state, "invalid program result name");
YYERROR;
}
;}
break;
case 261:
/* Line 1455 of yacc.c */
#line 2076 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.integer) = VERT_RESULT_BFC0;
} else {
yyerror(& (yylsp[(1) - (1)]), state, "invalid program result name");
YYERROR;
}
;}
break;
case 262:
/* Line 1455 of yacc.c */
#line 2087 "program_parse.y"
{
(yyval.integer) = 0;
;}
break;
case 263:
/* Line 1455 of yacc.c */
#line 2091 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.integer) = 0;
} else {
yyerror(& (yylsp[(1) - (1)]), state, "invalid program result name");
YYERROR;
}
;}
break;
case 264:
/* Line 1455 of yacc.c */
#line 2100 "program_parse.y"
{
if (state->mode == ARB_vertex) {
(yyval.integer) = 1;
} else {
yyerror(& (yylsp[(1) - (1)]), state, "invalid program result name");
YYERROR;
}
;}
break;
case 265:
/* Line 1455 of yacc.c */
#line 2110 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
case 266:
/* Line 1455 of yacc.c */
#line 2111 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
case 267:
/* Line 1455 of yacc.c */
#line 2112 "program_parse.y"
{ (yyval.integer) = 1; ;}
break;
case 268:
/* Line 1455 of yacc.c */
#line 2115 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
case 269:
/* Line 1455 of yacc.c */
#line 2116 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
case 270:
/* Line 1455 of yacc.c */
#line 2117 "program_parse.y"
{ (yyval.integer) = 1; ;}
break;
case 271:
/* Line 1455 of yacc.c */
#line 2120 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
case 272:
/* Line 1455 of yacc.c */
#line 2121 "program_parse.y"
{ (yyval.integer) = (yyvsp[(2) - (3)].integer); ;}
break;
case 273:
/* Line 1455 of yacc.c */
#line 2124 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
case 274:
/* Line 1455 of yacc.c */
#line 2125 "program_parse.y"
{ (yyval.integer) = (yyvsp[(2) - (3)].integer); ;}
break;
case 275:
/* Line 1455 of yacc.c */
#line 2128 "program_parse.y"
{ (yyval.integer) = 0; ;}
break;
case 276:
/* Line 1455 of yacc.c */
#line 2129 "program_parse.y"
{ (yyval.integer) = (yyvsp[(2) - (3)].integer); ;}
break;
case 277:
/* Line 1455 of yacc.c */
#line 2133 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector");
YYERROR;
}
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
case 278:
/* Line 1455 of yacc.c */
#line 2144 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector");
YYERROR;
}
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
case 279:
/* Line 1455 of yacc.c */
#line 2155 "program_parse.y"
{
if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) {
yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector");
YYERROR;
}
(yyval.integer) = (yyvsp[(1) - (1)].integer);
;}
break;
case 280:
/* Line 1455 of yacc.c */
#line 2166 "program_parse.y"
{
struct asm_symbol *exist = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string));
struct asm_symbol *target = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(4) - (4)].string));
free((yyvsp[(4) - (4)].string));
if (exist != NULL) {
char m[1000];
_mesa_snprintf(m, sizeof(m), "redeclared identifier: %s", (yyvsp[(2) - (4)].string));
free((yyvsp[(2) - (4)].string));
yyerror(& (yylsp[(2) - (4)]), state, m);
YYERROR;
} else if (target == NULL) {
free((yyvsp[(2) - (4)].string));
yyerror(& (yylsp[(4) - (4)]), state,
"undefined variable binding in ALIAS statement");
YYERROR;
} else {
_mesa_symbol_table_add_symbol(state->st, 0, (yyvsp[(2) - (4)].string), target);
}
;}
break;
/* Line 1455 of yacc.c */
#line 4937 "program_parse.tab.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
*++yylsp = yyloc;
/* 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 - YYNTOKENS] + *yyssp;
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTOKENS];
goto yynewstate;
/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
#if ! YYERROR_VERBOSE
yyerror (&yylloc, state, YY_("syntax error"));
#else
{
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
{
YYSIZE_T yyalloc = 2 * yysize;
if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
yyalloc = YYSTACK_ALLOC_MAXIMUM;
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
yymsg = (char *) YYSTACK_ALLOC (yyalloc);
if (yymsg)
yymsg_alloc = yyalloc;
else
{
yymsg = yymsgbuf;
yymsg_alloc = sizeof yymsgbuf;
}
}
if (0 < yysize && yysize <= yymsg_alloc)
{
(void) yysyntax_error (yymsg, yystate, yychar);
yyerror (&yylloc, state, yymsg);
}
else
{
yyerror (&yylloc, state, YY_("syntax error"));
if (yysize != 0)
goto yyexhaustedlab;
}
}
#endif
}
yyerror_range[0] = yylloc;
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= YYEOF)
{
/* Return failure if at end of input. */
if (yychar == YYEOF)
YYABORT;
}
else
{
yydestruct ("Error: discarding",
yytoken, &yylval, &yylloc, state);
yychar = YYEMPTY;
}
}
/* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
/* Pacify compilers like GCC when the user code never invokes
YYERROR and the label yyerrorlab therefore never appears in user
code. */
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
yyerror_range[0] = yylsp[1-yylen];
/* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
yystate = *yyssp;
goto yyerrlab1;
/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (yyn != YYPACT_NINF)
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
YYABORT;
yyerror_range[0] = *yylsp;
yydestruct ("Error: popping",
yystos[yystate], yyvsp, yylsp, state);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
*++yyvsp = yylval;
yyerror_range[1] = yylloc;
/* Using YYLLOC is tempting, but would change the location of
the lookahead. YYLOC is available though. */
YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
*++yylsp = yyloc;
/* Shift the error token. */
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
yystate = yyn;
goto yynewstate;
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here. |
`-------------------------------------*/
yyacceptlab:
yyresult = 0;
goto yyreturn;
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
yyresult = 1;
goto yyreturn;
#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
yyexhaustedlab:
yyerror (&yylloc, state, YY_("memory exhausted"));
yyresult = 2;
/* Fall through. */
#endif
yyreturn:
if (yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, &yylloc, state);
/* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
yystos[*yyssp], yyvsp, yylsp, state);
YYPOPSTACK (1);
}
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
/* Make sure YYID is used. */
return YYID (yyresult);
}
/* Line 1675 of yacc.c */
#line 2195 "program_parse.y"
void
asm_instruction_set_operands(struct asm_instruction *inst,
const struct prog_dst_register *dst,
const struct asm_src_register *src0,
const struct asm_src_register *src1,
const struct asm_src_register *src2)
{
/* In the core ARB extensions only the KIL instruction doesn't have a
* destination register.
*/
if (dst == NULL) {
init_dst_reg(& inst->Base.DstReg);
} else {
inst->Base.DstReg = *dst;
}
/* The only instruction that doesn't have any source registers is the
* condition-code based KIL instruction added by NV_fragment_program_option.
*/
if (src0 != NULL) {
inst->Base.SrcReg[0] = src0->Base;
inst->SrcReg[0] = *src0;
} else {
init_src_reg(& inst->SrcReg[0]);
}
if (src1 != NULL) {
inst->Base.SrcReg[1] = src1->Base;
inst->SrcReg[1] = *src1;
} else {
init_src_reg(& inst->SrcReg[1]);
}
if (src2 != NULL) {
inst->Base.SrcReg[2] = src2->Base;
inst->SrcReg[2] = *src2;
} else {
init_src_reg(& inst->SrcReg[2]);
}
}
struct asm_instruction *
asm_instruction_ctor(gl_inst_opcode op,
const struct prog_dst_register *dst,
const struct asm_src_register *src0,
const struct asm_src_register *src1,
const struct asm_src_register *src2)
{
struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction);
if (inst) {
_mesa_init_instructions(& inst->Base, 1);
inst->Base.Opcode = op;
asm_instruction_set_operands(inst, dst, src0, src1, src2);
}
return inst;
}
struct asm_instruction *
asm_instruction_copy_ctor(const struct prog_instruction *base,
const struct prog_dst_register *dst,
const struct asm_src_register *src0,
const struct asm_src_register *src1,
const struct asm_src_register *src2)
{
struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction);
if (inst) {
_mesa_init_instructions(& inst->Base, 1);
inst->Base.Opcode = base->Opcode;
inst->Base.CondUpdate = base->CondUpdate;
inst->Base.CondDst = base->CondDst;
inst->Base.SaturateMode = base->SaturateMode;
inst->Base.Precision = base->Precision;
asm_instruction_set_operands(inst, dst, src0, src1, src2);
}
return inst;
}
void
init_dst_reg(struct prog_dst_register *r)
{
memset(r, 0, sizeof(*r));
r->File = PROGRAM_UNDEFINED;
r->WriteMask = WRITEMASK_XYZW;
r->CondMask = COND_TR;
r->CondSwizzle = SWIZZLE_NOOP;
}
/** Like init_dst_reg() but set the File and Index fields. */
void
set_dst_reg(struct prog_dst_register *r, gl_register_file file, GLint index)
{
const GLint maxIndex = 1 << INST_INDEX_BITS;
const GLint minIndex = 0;
ASSERT(index >= minIndex);
(void) minIndex;
ASSERT(index <= maxIndex);
(void) maxIndex;
ASSERT(file == PROGRAM_TEMPORARY ||
file == PROGRAM_ADDRESS ||
file == PROGRAM_OUTPUT);
memset(r, 0, sizeof(*r));
r->File = file;
r->Index = index;
r->WriteMask = WRITEMASK_XYZW;
r->CondMask = COND_TR;
r->CondSwizzle = SWIZZLE_NOOP;
}
void
init_src_reg(struct asm_src_register *r)
{
memset(r, 0, sizeof(*r));
r->Base.File = PROGRAM_UNDEFINED;
r->Base.Swizzle = SWIZZLE_NOOP;
r->Symbol = NULL;
}
/** Like init_src_reg() but set the File and Index fields.
* \return GL_TRUE if a valid src register, GL_FALSE otherwise
*/
void
set_src_reg(struct asm_src_register *r, gl_register_file file, GLint index)
{
set_src_reg_swz(r, file, index, SWIZZLE_XYZW);
}
void
set_src_reg_swz(struct asm_src_register *r, gl_register_file file, GLint index,
GLuint swizzle)
{
const GLint maxIndex = (1 << INST_INDEX_BITS) - 1;
const GLint minIndex = -(1 << INST_INDEX_BITS);
ASSERT(file < PROGRAM_FILE_MAX);
ASSERT(index >= minIndex);
(void) minIndex;
ASSERT(index <= maxIndex);
(void) maxIndex;
memset(r, 0, sizeof(*r));
r->Base.File = file;
r->Base.Index = index;
r->Base.Swizzle = swizzle;
r->Symbol = NULL;
}
/**
* Validate the set of inputs used by a program
*
* Validates that legal sets of inputs are used by the program. In this case
* "used" included both reading the input or binding the input to a name using
* the \c ATTRIB command.
*
* \return
* \c TRUE if the combination of inputs used is valid, \c FALSE otherwise.
*/
int
validate_inputs(struct YYLTYPE *locp, struct asm_parser_state *state)
{
const int inputs = state->prog->InputsRead | state->InputsBound;
if (((inputs & 0x0ffff) & (inputs >> 16)) != 0) {
yyerror(locp, state, "illegal use of generic attribute and name attribute");
return 0;
}
return 1;
}
struct asm_symbol *
declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
struct YYLTYPE *locp)
{
struct asm_symbol *s = NULL;
struct asm_symbol *exist = (struct asm_symbol *)
_mesa_symbol_table_find_symbol(state->st, 0, name);
if (exist != NULL) {
yyerror(locp, state, "redeclared identifier");
} else {
s = calloc(1, sizeof(struct asm_symbol));
s->name = name;
s->type = t;
switch (t) {
case at_temp:
if (state->prog->NumTemporaries >= state->limits->MaxTemps) {
yyerror(locp, state, "too many temporaries declared");
free(s);
return NULL;
}
s->temp_binding = state->prog->NumTemporaries;
state->prog->NumTemporaries++;
break;
case at_address:
if (state->prog->NumAddressRegs >= state->limits->MaxAddressRegs) {
yyerror(locp, state, "too many address registers declared");
free(s);
return NULL;
}
/* FINISHME: Add support for multiple address registers.
*/
state->prog->NumAddressRegs++;
break;
default:
break;
}
_mesa_symbol_table_add_symbol(state->st, 0, s->name, s);
s->next = state->sym;
state->sym = s;
}
return s;
}
int add_state_reference(struct gl_program_parameter_list *param_list,
const gl_state_index tokens[STATE_LENGTH])
{
const GLuint size = 4; /* XXX fix */
char *name;
GLint index;
name = _mesa_program_state_string(tokens);
index = _mesa_add_parameter(param_list, PROGRAM_STATE_VAR, name,
size, GL_NONE, NULL, tokens, 0x0);
param_list->StateFlags |= _mesa_program_state_flags(tokens);
/* free name string here since we duplicated it in add_parameter() */
free(name);
return index;
}
int
initialize_symbol_from_state(struct gl_program *prog,
struct asm_symbol *param_var,
const gl_state_index tokens[STATE_LENGTH])
{
int idx = -1;
gl_state_index state_tokens[STATE_LENGTH];
memcpy(state_tokens, tokens, sizeof(state_tokens));
param_var->type = at_param;
param_var->param_binding_type = PROGRAM_STATE_VAR;
/* If we are adding a STATE_MATRIX that has multiple rows, we need to
* unroll it and call add_state_reference() for each row
*/
if ((state_tokens[0] == STATE_MODELVIEW_MATRIX ||
state_tokens[0] == STATE_PROJECTION_MATRIX ||
state_tokens[0] == STATE_MVP_MATRIX ||
state_tokens[0] == STATE_TEXTURE_MATRIX ||
state_tokens[0] == STATE_PROGRAM_MATRIX)
&& (state_tokens[2] != state_tokens[3])) {
int row;
const int first_row = state_tokens[2];
const int last_row = state_tokens[3];
for (row = first_row; row <= last_row; row++) {
state_tokens[2] = state_tokens[3] = row;
idx = add_state_reference(prog->Parameters, state_tokens);
if (param_var->param_binding_begin == ~0U) {
param_var->param_binding_begin = idx;
param_var->param_binding_swizzle = SWIZZLE_XYZW;
}
param_var->param_binding_length++;
}
}
else {
idx = add_state_reference(prog->Parameters, state_tokens);
if (param_var->param_binding_begin == ~0U) {
param_var->param_binding_begin = idx;
param_var->param_binding_swizzle = SWIZZLE_XYZW;
}
param_var->param_binding_length++;
}
return idx;
}
int
initialize_symbol_from_param(struct gl_program *prog,
struct asm_symbol *param_var,
const gl_state_index tokens[STATE_LENGTH])
{
int idx = -1;
gl_state_index state_tokens[STATE_LENGTH];
memcpy(state_tokens, tokens, sizeof(state_tokens));
assert((state_tokens[0] == STATE_VERTEX_PROGRAM)
|| (state_tokens[0] == STATE_FRAGMENT_PROGRAM));
assert((state_tokens[1] == STATE_ENV)
|| (state_tokens[1] == STATE_LOCAL));
/*
* The param type is STATE_VAR. The program parameter entry will
* effectively be a pointer into the LOCAL or ENV parameter array.
*/
param_var->type = at_param;
param_var->param_binding_type = PROGRAM_STATE_VAR;
/* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements,
* we need to unroll it and call add_state_reference() for each row
*/
if (state_tokens[2] != state_tokens[3]) {
int row;
const int first_row = state_tokens[2];
const int last_row = state_tokens[3];
for (row = first_row; row <= last_row; row++) {
state_tokens[2] = state_tokens[3] = row;
idx = add_state_reference(prog->Parameters, state_tokens);
if (param_var->param_binding_begin == ~0U) {
param_var->param_binding_begin = idx;
param_var->param_binding_swizzle = SWIZZLE_XYZW;
}
param_var->param_binding_length++;
}
}
else {
idx = add_state_reference(prog->Parameters, state_tokens);
if (param_var->param_binding_begin == ~0U) {
param_var->param_binding_begin = idx;
param_var->param_binding_swizzle = SWIZZLE_XYZW;
}
param_var->param_binding_length++;
}
return idx;
}
/**
* Put a float/vector constant/literal into the parameter list.
* \param param_var returns info about the parameter/constant's location,
* binding, type, etc.
* \param vec the vector/constant to add
* \param allowSwizzle if true, try to consolidate constants which only differ
* by a swizzle. We don't want to do this when building
* arrays of constants that may be indexed indirectly.
* \return index of the constant in the parameter list.
*/
int
initialize_symbol_from_const(struct gl_program *prog,
struct asm_symbol *param_var,
const struct asm_vector *vec,
GLboolean allowSwizzle)
{
unsigned swizzle;
const int idx = _mesa_add_unnamed_constant(prog->Parameters,
vec->data, vec->count,
allowSwizzle ? &swizzle : NULL);
param_var->type = at_param;
param_var->param_binding_type = PROGRAM_CONSTANT;
if (param_var->param_binding_begin == ~0U) {
param_var->param_binding_begin = idx;
param_var->param_binding_swizzle = allowSwizzle ? swizzle : SWIZZLE_XYZW;
}
param_var->param_binding_length++;
return idx;
}
char *
make_error_string(const char *fmt, ...)
{
int length;
char *str;
va_list args;
va_start(args, fmt);
/* Call vsnprintf once to determine how large the final string is. Call it
* again to do the actual formatting. from the vsnprintf manual page:
*
* Upon successful return, these functions return the number of
* characters printed (not including the trailing '\0' used to end
* output to strings).
*/
length = 1 + vsnprintf(NULL, 0, fmt, args);
str = malloc(length);
if (str) {
vsnprintf(str, length, fmt, args);
}
va_end(args);
return str;
}
void
yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s)
{
char *err_str;
err_str = make_error_string("glProgramStringARB(%s)\n", s);
if (err_str) {
_mesa_error(state->ctx, GL_INVALID_OPERATION, err_str);
free(err_str);
}
err_str = make_error_string("line %u, char %u: error: %s\n",
locp->first_line, locp->first_column, s);
_mesa_set_program_error(state->ctx, locp->position, err_str);
if (err_str) {
free(err_str);
}
}
GLboolean
_mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
GLsizei len, struct asm_parser_state *state)
{
struct asm_instruction *inst;
unsigned i;
GLubyte *strz;
GLboolean result = GL_FALSE;
void *temp;
struct asm_symbol *sym;
state->ctx = ctx;
state->prog->Target = target;
state->prog->Parameters = _mesa_new_parameter_list();
/* Make a copy of the program string and force it to be NUL-terminated.
*/
strz = (GLubyte *) malloc(len + 1);
if (strz == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
return GL_FALSE;
}
memcpy (strz, str, len);
strz[len] = '\0';
state->prog->String = strz;
state->st = _mesa_symbol_table_ctor();
state->limits = (target == GL_VERTEX_PROGRAM_ARB)
? & ctx->Const.VertexProgram
: & ctx->Const.FragmentProgram;
state->MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits;
state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits;
state->MaxTextureUnits = ctx->Const.MaxTextureUnits;
state->MaxClipPlanes = ctx->Const.MaxClipPlanes;
state->MaxLights = ctx->Const.MaxLights;
state->MaxProgramMatrices = ctx->Const.MaxProgramMatrices;
state->state_param_enum = (target == GL_VERTEX_PROGRAM_ARB)
? STATE_VERTEX_PROGRAM : STATE_FRAGMENT_PROGRAM;
_mesa_set_program_error(ctx, -1, NULL);
_mesa_program_lexer_ctor(& state->scanner, state, (const char *) str, len);
yyparse(state);
_mesa_program_lexer_dtor(state->scanner);
if (ctx->Program.ErrorPos != -1) {
goto error;
}
if (! _mesa_layout_parameters(state)) {
struct YYLTYPE loc;
loc.first_line = 0;
loc.first_column = 0;
loc.position = len;
yyerror(& loc, state, "invalid PARAM usage");
goto error;
}
/* Add one instruction to store the "END" instruction.
*/
state->prog->Instructions =
_mesa_alloc_instructions(state->prog->NumInstructions + 1);
inst = state->inst_head;
for (i = 0; i < state->prog->NumInstructions; i++) {
struct asm_instruction *const temp = inst->next;
state->prog->Instructions[i] = inst->Base;
inst = temp;
}
/* Finally, tag on an OPCODE_END instruction */
{
const GLuint numInst = state->prog->NumInstructions;
_mesa_init_instructions(state->prog->Instructions + numInst, 1);
state->prog->Instructions[numInst].Opcode = OPCODE_END;
}
state->prog->NumInstructions++;
state->prog->NumParameters = state->prog->Parameters->NumParameters;
state->prog->NumAttributes = _mesa_bitcount(state->prog->InputsRead);
/*
* Initialize native counts to logical counts. The device driver may
* change them if program is translated into a hardware program.
*/
state->prog->NumNativeInstructions = state->prog->NumInstructions;
state->prog->NumNativeTemporaries = state->prog->NumTemporaries;
state->prog->NumNativeParameters = state->prog->NumParameters;
state->prog->NumNativeAttributes = state->prog->NumAttributes;
state->prog->NumNativeAddressRegs = state->prog->NumAddressRegs;
result = GL_TRUE;
error:
for (inst = state->inst_head; inst != NULL; inst = temp) {
temp = inst->next;
free(inst);
}
state->inst_head = NULL;
state->inst_tail = NULL;
for (sym = state->sym; sym != NULL; sym = temp) {
temp = sym->next;
free((void *) sym->name);
free(sym);
}
state->sym = NULL;
_mesa_symbol_table_dtor(state->st);
state->st = NULL;
return result;
}
|