summaryrefslogtreecommitdiff
path: root/xc/unsupported/programs/gpc/bifbuild.c
blob: 459b313411c6479608a7a57de115e8b5f883b9fb (plain)
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
/* $XConsortium: bifbuild.c,v 5.4 91/08/23 16:45:28 rws Exp $ */
/*

Copyright (c) 1989, 1990, 1991  X Consortium

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 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 X CONSORTIUM 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.

Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.

*/
/***********************************************************
Copyright (c) 1989,1990, 1991 by Sun Microsystems, Inc.

						All Rights Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Sun Microsystems and
X Consortium not be used in advertising or publicity
pertaining to distribution of the software without specific, written
prior permission.

SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

******************************************************************/

/*--------------------------------------------------------------------*\
|
|  Copyright (C) 1989,1990, 1991, National Computer Graphics Association
|
|  Permission is granted to any individual or institution to use, copy, or
|  redistribute this software so long as it is not sold for profit, provided
|  this copyright notice is retained.
|
|                         Developed for the
|                National Computer Graphics Association
|                         2722 Merrilee Drive
|                         Fairfax, VA  22031
|                           (703) 698-9600
|
|                                by
|                 SimGraphics Engineering Corporation
|                    1137 Huntington Drive  Unit A
|                      South Pasadena, CA  91030
|                           (213) 255-0900
|---------------------------------------------------------------------
|
| Author        :	SimGraphics Engineering Corportation
|
| File          :	bifbuild.c
| Date          :	Fri Feb  9 10:46:55 PST 1990
| Project       :	PLB
| Description   :	Contain the BUILD/EXECUTE functions for turning
|			parser date into BIF entities and dealing
|			with them appropriately.
|                                                                    
| Status        :	Version 1.0
|
| Revisions     :	
|
|	4/4/89		JMZ SimGEC: Fixes to bif_matrix3,
|			bif_gtransform3, bif_ltransform3,
|			bif_clear, bif_rotate3
|
|	2/90		Staff SimGEC: Background color/colorindex
|
|       2/90            MFC Tektronix, Inc.: PEX-SI API implementation.
|                       
|       5/90            MFC Tektronix, Inc.: PEX-SI API Binding change.
|
|      12/90            MFC Tektronix, Inc.: PEX-SI PEX5R1 Release.
|
\*--------------------------------------------------------------------- */
    
/*--------------------------------------------------------------------*\
|	Table of Contents
|
|	int bif_mktype(BIF_INT)
|		:	Receive a MARKER_TYPE entity from the parser
|	int bif_linetype(BIF_INT)
|		:	Receive a LINE_TYPE entity from the parser
|	int bif_lineshading(BIF_INT)
|		:	Receive a LINE_TYPE entity from the parser
|	int bif_linewidth(BIF_REAL)
|		:	Receive a LINE_WIDTH entity from the parser
|	int bif_intstyle(BIF_INT)
|		:	Receive an INTERIOR_STYLE entity from the parser
|	int bif_intpatternindex(BIF_INT)
|		:	Receive an INTERIOR_PATTERN_INDEX entity from the
|	int bif_intshade(BIF_INT)
|		:	Receive an INTERIOR_SHADING entity from the parser
|	int bif_intlight(BIF_INT)
|		:	Receive an INTERIOR_LIGHTING entity from the parser
|	int bif_curve_approx_criteria (BIF_INT, BIF_REAL)
|		:	Receive an INTERIOR_LIGHTING entity from the parser
|	int bif_curve_approx_criteria (BIF_INT,BIF_REAL)
|		:	Receive an INTERIOR_LIGHTING entity from the parser
|	int bif_curve_approx_criteria (BIF_INT,BIF_REAL)
|		:	Receive an INTERIOR_LIGHTING entity from the parser
|	int bif_surfprop(BIF_REAL, BIF_REAL, BIF_REAL, BIF_REAL,
|				BIF_REAL, BIF_REAL, BIF_REAL, BIF_REAL)
|		:	Receive a SURFACE_PROPERTIES entity from the parser
|	int bif_bkfprop(BIF_REAL, BIF_REAL, BIF_REAL, BIF_REAL,
|				BIF_REAL, BIF_REAL, BIF_REAL, BIF_REAL)
|		:	Receive a BACKFACE_PROPERTIES entity from the parser
|	int bif_bkfprocessing(BIF_INT,BIF_INT)
|		:	Receive a BACK_FACE_PROCESSING entity from
|	int bif_edgeflag(BIF_INT)
|		:	Receive an EDGE_FLAG entity from the parser
|	int bif_edgetype(BIF_INT)
|		:	Receive an EDGE_TYPE entity from the parser
|	int bif_edgewidth(BIF_REAL)
|		:	Receive an EDGE_WIDTH entity from the parser
|	int bif_textfont(BIF_INT)
|		:	Receive a TEXT_FONT entity from the parser
|	int bif_textprec(BIF_INT)
|		:	Receive a TEXT_PREC entity from the parser
|	int bif_textpath(BIF_INT)
|		:	Receive a TEXT_PATH entity from the parser
|	int bif_textalign(BIF_INT, BIF_INT)
|		:	Receive a TEXT_ALIGN entity from the parser
|	int bif_charheight(BIF_REAL)
|		:	Receive a CHAR_HEIGHT entity from the parser
|	int bif_charexp(BIF_REAL)
|		:	Receive a CHAR_EXP entity from the parser
|	int bif_charspace(BIF_REAL)
|		:	Receive a CHAR_SPACE entity from the parser
|	int bif_charupvector(BIF_REAL, BIF_REAL)
|		:	Receive a CHAR_UP_VECTOR entity from the parser
|	int bif_annotextcharheight(BIF_REAL)
|		:	Receive a ANNO_TEXT_CHAR_HEIGHT entity from the parser
|	int bif_annotextcharupvector(BIF_REAL, BIF_REAL)
|		:	Receive a ANNO_TEXT_CHAR_UP_VECTOR entity from
|	int bif_annotextstyle(BIF_INT)
|		:	Receive a ANNO_TEXT_STYLE entity from the parser
|	int bif_definelight(BIF_INT)
|		:	Begin / End receiving a DEFINE_LIGHT entity from
|	int bif_lightbasic(BIF_INT, BIF_REAL, BIF_REAL, BIF_REAL)
|		:	Receive basic data for DEFINE_LIGHT entity from
|	int bif_ldtranform(BIF_INT)
|		:	Receive the matrix id of the Light Definition
|	int bif_lightoption(BIF_INT, BIF_REAL, BIF_REAL, BIF_REAL,
|				BIF_REAL, BIF_REAL, BIF_REAL, BIF_REAL,
|				BIF_REAL, BIF_REAL, BIF_REAL)
|		:	Receive data for DEFINE_LIGHT entity from the
|	int bif_lightstate(BIF_INT)
|		:	Begin / End receiving a LIGHT_STATE entity from
|	int bif_definedepthcue(BIF_INT, BIF_INT, BIF_REAL, BIF_REAL,
|				BIF_REAL, BIF_REAL, BIF_REAL, BIF_REAL,
|				BIF_REAL)
|		:	Receive the results of a DEFINE_DEPTHCUE
|	int bif_depthcueindex(BIF_INT)
|		:	Receive a DEPTHCUE_INDEX entity from the parser
|	int bif_hlhsremoval(BIF_INT)
|		:	Receive a HLHS_REMOVAL entity from the parser
|	int bif_definecolor(BIF_INT, BIF_REAL, BIF_REAL, BIF_REAL)
|		:	Receive a DEFINE_COLOR entity from the parser
|	bif_backgroundcolor(BIF_REAL,BIF_REAL,BIF_REAL)
|		:	Define the background true color components
|	bif_backgroundcolorindex(BIF_INT)
|		:	Define the background color index
|	int bif_identity3(BIF_INT)
|		:	Receive an IDENTITY3 entity from the parser
|	int bif_concatmatrix3(BIF_INT, BIF_INT, BIF_INT)
|		:	Receive a CONCAT_MATRIX3 entity from the parser
|	int bif_invertmatrix3(BIF_INT)
|		:	Receive an INVERT_MATRIX3 entity from the parser
|	int bif_rotate3( BIF_INT, BIF_REAL, BIF_INT, BIF_INT )
|		:	Receive a ROTATE3 entity from the parser
|	BIF_INT bif_rotatexyz3(BIF_INT,BIF_REAL,BIF_REAL, BIF_REAL,BIF_INT)
|		:	Receive a ROTATE_XYZ3 entity from the parser
|	int bif_translate3(BIF_INT , BIF_REAL, BIF_REAL, BIF_REAL, BIF_INT)
|		:	Receive a TRANSLATE3 entity from the parser
|	int bif_scale3(BIF_INT , BIF_REAL, BIF_REAL, BIF_REAL, BIF_INT)
|		:	Receive a SCALE3 entity from the parser
|	int bif_matrix3(BIF_INT, *BIF_REAL, BIF_INT)
|		:	Receive a MATRIX3 entity from the parser
|	int bif_getmatrix3(BIF_INT, BIF_INT, BIF_INT)
|		:	Receive a GET_MATRIX3 entity from the parser
|	int bif_pushmatrix3()
|		:	Receive a PUSH_MATRIX3 entity from the parser
|	int bif_popmatrix3()
|		:	Receive a POP_MATRIX3 entity from the parser
|	int bif_gtransform3(*BIF_REAL)
|		:	Receive a GLOBAL_TRANSFORMATION3 entity from the
|	int bif_ltransform3(*BIF_REAL, BIF_INT)
|		:	Receive a LOCAL_TRANSFORMATION3 entity from the
|	int bif_applytoglobal3(BIF_INT)
|		:	Receive an APPLY_TO_GLOBAL3 entity from the parser
|	int bif_applytolocal3(BIF_INT, BIF_INT)
|		:	Receive an APPLY_TO_LOCAL3 entity from the parser
|	int bif_cleargeom()
|		:	Receive a CLEAR_GEOMETRY entity from the parser.
|	int bif_reportfile(*char)
|		:	Receive a REPORT_FILE entity from the parser.
|	int bif_begintest(BIF_INT)
|		:	Receive a BEGIN_TEST entity from the parser
|	int bif_endtest()
|		:	Receive an END_TEST entity from the parser
|	int bif_pause()
|		:	Receive a PAUSE entity from the parser
|	int bif_sleep(BIF_INT)
|		:	Receive a SLEEP entity from the parser
|	int indexRange(int, int, int, int)
|		:	Check the supplied index against the range
|
\*--------------------------------------------------------------------*/
    
/*--------------------------------------------------------------------*\
|	Include files 
\*--------------------------------------------------------------------*/
#include <stdio.h>
#include "biftypes.h"
#include "bifbuild.h"
#include "new_ents.h"
#include "bifparse.h"
#include "db_tools.h"
#include "doentity.h"
#include "bifmacro.h"
#include "globals.h"
#include "ph_map.h"
#include "macfunct.h"
#include "brftypes.h"
#include "brfexption.h"
#include <X11/Xfuncs.h>
    
    
/*--------------------------------------------------------------------*\
|Local #define
\*--------------------------------------------------------------------*/
    
/*--------------------------------------------------------------------*\
| Local MACROS    
\*--------------------------------------------------------------------*/
    
/*--------------------------------------------------------------------*\
| External Symbols
\*--------------------------------------------------------------------*/
    void noop_function();
    
/*--------------------------------------------------------------------*\
| Local global variables
\*--------------------------------------------------------------------*/
    /* Useful statics */
    /* Temporary entity storage */
    static BIF_All temp_ent;
    static BIF_Begintest current_test;
    static BIF_Traverser_state temp_state;
    static BIF_Traverser_state *temp_state_ptr = &temp_state;
    static BRF_state brf_state;
    static int background_color_index = -1;
    
    /* The identity matrix */
    static float ident_matrix[4][4] =
{
    1., 0., 0., 0.,
    0., 1., 0., 0.,
    0., 0., 1., 0.,
    0., 0., 0., 1.,
};


/*--------------------------------------------------------------------*\
| BEGIN PROCEDURE CODE
\*--------------------------------------------------------------------*/

/* ****************************************
 * Primitives Attributes
 * ************************************** */

/* ***************** */
/* Marker Attributes */
/* ***************** */
/*----------------------------------------------------------------------*\
| Procedure	:	int bif_mktype(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a MARKER_TYPE entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_mktype(marker_type)
    BIF_INT marker_type;
{
    static entSize = sizeof(BIF_Index);
    /* Build, Store/Execute the entity */
    /* NOTE: + 1 to map BIF markertypes to PHIGs markertypes */
    bif_index((int)(marker_type+1),entSize,MARKER_TYPE,do_markertype,
	      pset_marker_type);
} /* End procedure bif_mktype */

/* MACRO-GENERATED FUNCTIONS */
/* APPROX: MARKER_SIZE integer multiples only */
    MF_BIF_SIZE(bif_mkscale,MARKER_SIZE,do_markersize,pset_marker_size)
    
    MF_TRUE_COLOR(bif_mkcolor,MARKER_COLOR,do_markercolor,pset_marker_colr)
    
    MF_MAP_INDEX(bif_mkcolorindex,MARKER_COLOR_INDEX,
		 do_markercolorindex,pset_marker_colr)
    
/* *************** */
/* Line Attributes */
/* *************** */
/*----------------------------------------------------------------------*\
| Procedure	:	int bif_linetype(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a LINE_TYPE entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
    int bif_linetype(line_type)
    BIF_INT line_type;
{
    static int entSize = sizeof(BIF_Index);
    /* Build, Store/Execute the entity */
    /* NOTE: + 1 to map BIF linetypes to PHIGs linetypes */
    bif_index((int)(line_type+1),entSize,LINE_TYPE,do_linetype,
	      pset_linetype);
    
} /* End procedure bif_linetype */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_lineshading(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a LINE_TYPE entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_lineshading(line_shade)
    BIF_INT line_shade;
{
    /* Build, Store/Execute the entity */
    /* NOTE: + 1 to map BIF lineshading to PHIGs lineshading  */
    bif_index((int)(line_shade+1),sizeof(BIF_Index),
	      LINE_SHADING,do_lineshading, pset_line_shad_meth);
    
} /* End procedure bif_lineshading */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_linewidth(BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive a LINE_WIDTH entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_linewidth(line_width)
    BIF_REAL line_width;
{
    /* Build, Store/Execute the entity */
    bif_size((float)line_width,sizeof(BIF_Size),
	     LINE_WIDTH,do_linewidth,pset_linewidth);
    
#ifdef EXTERNALNOTE
    /* Alliant has a hardware problem with line widths > 1.
       The resultant line is deviod of any defined line type,
       and will no longer Z buffer. Since this is a temporary concern,
       merely issuing a warning to inform the user that what he sees 
       on the graphics device may not be a problem with his PLB file. This
       is a good example of 'catch all' exception handling! */
#endif
    
} /* End procedure bif_linewidth */

/* MACRO-GENERATED FUNCTIONS */
    MF_TRUE_COLOR(bif_linecolor,LINE_COLOR,do_linecolor,pset_line_colr)
    
    MF_MAP_INDEX(bif_linecolorindex,LINE_COLOR_INDEX,do_linecolorindex,
		 pset_line_colr)
    
/* ****************** */
/* Polygon Attributes */
/* ****************** */
/*----------------------------------------------------------------------*\
| Procedure	:	int bif_intstyle(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive an INTERIOR_STYLE entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
    int bif_intstyle(style_index)
    BIF_INT style_index;
{
    int sty_index;
    /* Build, Store/Execute the entity */
    sty_index = REMAP_INTSTYLE(style_index);
    /* NONSUP: interior style PATTERN */
    /* Must also do backface interior style */
    bif_2_index(sty_index, sizeof(BIF_Index),
		INTERIOR_STYLE, do_interiorstyle,
		pset_int_style,
		pset_back_int_style);
} /* End procedure bif_intstyle */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_intpatternindex(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive an INTERIOR_PATTERN_INDEX entity from the
|			parser pass it on to a generic build,
|			store/execute function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_intpatternindex(pattern_index)
    BIF_INT pattern_index;
{
    /* Build, Store/Execute the entity */
    /* Must also do back interior style index */
    bif_2_index((int)pattern_index, sizeof(BIF_Index),
		INTERIOR_PATTERN_INDEX, do_interiorpatternindex, 
		pset_int_style_ind,
		pset_back_int_style_ind);
    
} /* End procedure bif_intpatternindex */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_intshade(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive an INTERIOR_SHADING entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_intshade(shade_type)
    BIF_INT shade_type;
{
    /* Build, Store/Execute the entity */
    /* BIF shade types match the values for the GX4000 */
    /* Must also do backface interior shading */
    bif_2_index((int)shade_type, sizeof(BIF_Index),
		INTERIOR_SHADING, do_interiorshading,
		pset_int_shad_meth,
		pset_back_int_shad_meth);

} /* End procedure bif_intshade */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_intlight(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive an INTERIOR_LIGHTING entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_intlight(light_type)
    BIF_INT light_type;
{
    /* Build, Store/Execute the entity */
    /* BIF shade types match the values for the GX4000 */
    /* Must also do back interior reflectance eq */
    bif_2_index((int)light_type, sizeof(BIF_Index),
		INTERIOR_LIGHTING, do_interiorlighting,
		pset_refl_eqn,
		pset_back_refl_eqn);

} /* End procedure bif_intlight */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_curve_approx_criteria (BIF_INT, BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive an INTERIOR_LIGHTING entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
bif_curve_approx_criteria ( icriteria, approx_value ) /* ver 1.0 */
    BIF_INT icriteria;
    BIF_REAL approx_value;
{
#ifdef TEST_PRINT
    printf(" bif_curve_approx_criteria: icriteria %ld, approx_value %f\n",
	   icriteria, approx_value);
#endif /* ifdef TEST_PRINT */
}

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_curve_approx_criteria (BIF_INT,BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive an INTERIOR_LIGHTING entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
bif_surface_approx_criteria ( icriteria, u_approx_value, v_approx_value )
    BIF_INT icriteria;						/* ver 1.0 */
    BIF_REAL u_approx_value;
    BIF_REAL v_approx_value;
{
#ifdef TEST_PRINT
    printf(" bif_trimcurve_approx_criteria : icriteria %ld, u_approx_value %f\n",
	   icriteria, u_approx_value);
    printf(" v_approx_value %f\n", v_approx_value);
#endif /* ifdef TEST_PRINT */
}

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_curve_approx_criteria (BIF_INT,BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive an INTERIOR_LIGHTING entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
bif_trimcurve_approx_criteria ( icriteria, approx_value )  /* ver 1.0 */
    BIF_INT icriteria;
    BIF_REAL approx_value;
{
#ifdef TEST_PRINT
    printf(" bif_trimcurve_approx_criteria : icriteria %ld, approx_value %f\n",
	   icriteria, approx_value);
#endif /* ifdef TEST_PRINT */
}




/* MACRO-GENERATED FUNCTIONS */
    MF_TRUE_COLOR(bif_intcolor,INTERIOR_COLOR,do_interiorcolor,pset_int_colr)
    
    MF_MAP_INDEX(bif_intcolorindex,INTERIOR_COLOR_INDEX,
		 do_interiorcolorindex, pset_int_colr)
    
    MF_MAP_INDEX(bif_bkfintcolorindex,BACKFACE_INTERIOR_COLOR_INDEX,
		 do_backfaceinteriorcolorindex, pset_back_int_colr)
    
    MF_TRUE_COLOR(bif_bkfintcolor, BACKFACE_INTERIOR_COLOR,
		  do_backfaceinteriorcolor, pset_back_int_colr)
    
/*----------------------------------------------------------------------*\
| Procedure	:	int bif_surfprop(BIF_REAL, BIF_REAL, BIF_REAL,
|					BIF_REAL, BIF_REAL, BIF_REAL,
|					BIF_REAL, BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive a SURFACE_PROPERTIES entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|
|	ambient, diffuse, specular	Reflectance coefficents
|	c1, c2, c3			Specular color
|	highlight			Specular exponent
|	transparency			Transparency coefficient
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_surfprop(ambient, diffuse, specular, c1, c2, c3,
		 highlight, transparency)
    BIF_REAL ambient, diffuse, specular, c1, c2, c3, highlight, transparency;
{
    static int ent_size = sizeof(BIF_Surfaceproperties);
    BIF_All *ent;
    
#ifdef TEST_PRINT
    printf("SURFACE_PROPERTIES :\n");
    printf("ambient, diffuse, specular %f %f %f\n",
	   ambient, diffuse, specular);
    printf("c1, c2, c3 %f %f %f\n",c1, c2, c3);
    printf("highlight, transparency %f %f\n",
	   highlight, transparency);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Fill the temp_ent then allocate the entity */
    temp_ent.surfaceproperties.props.ambient_coef = ambient;
    temp_ent.surfaceproperties.props.diffuse_coef = diffuse;
    temp_ent.surfaceproperties.props.specular_coef = specular;
    
    temp_ent.surfaceproperties.props.specular_colr.type =
	wk_info.color_model;
    temp_ent.surfaceproperties.props.specular_colr.val.general.x = c1;
    temp_ent.surfaceproperties.props.specular_colr.val.general.y = c2;
    temp_ent.surfaceproperties.props.specular_colr.val.general.z = c3;
    temp_ent.surfaceproperties.props.specular_exp = highlight;
    
    ent = new_generic(&temp_ent,ent_size,SURFACE_PROPERTIES,
		      do_surfaceproperties);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef TEST_PRINT
    fprintf(stderr,"bifbuild pset_refl_props ambient = %f\n",
	    temp_ent.surfaceproperties.props.ambient_coef);
    fprintf(stderr,"bifbuild pset_refl_props diffuse = %f\n",
	    temp_ent.surfaceproperties.props.diffuse_coef);
    fprintf(stderr,"bifbuild pset_refl_props specular = %f\n",
	    temp_ent.surfaceproperties.props.specular_coef);
    fprintf(stderr,"bifbuild pset_refl_props color model = %d\n",
	    temp_ent.surfaceproperties.props.specular_colr.type);
    fprintf(stderr,"bifbuild pset_refl_props specularcolor[0] = %f\n",
	    temp_ent.surfaceproperties.props.specular_colr.val.general.x);
    fprintf(stderr,"bifbuild pset_refl_props specularcolor[1] = %f\n",
	    temp_ent.surfaceproperties.props.specular_colr.val.general.y);
    fprintf(stderr,"bifbuild pset_refl_props specularcolor[2] = %f\n",
	    temp_ent.surfaceproperties.props.specular_colr.val.general.z);
    fprintf(stderr,"bifbuild pset_refl_props highlight = %f\n",
	    temp_ent.surfaceproperties.props.specular_exp);
#endif /* TEST_PRINT */
    
    
    
    
#ifdef USING_PHIGS
    /* Call the entity in PHIGS */
    pset_refl_props(&ent->surfaceproperties.props);
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_surfprop */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_bkfprop(BIF_REAL, BIF_REAL, BIF_REAL,
|					BIF_REAL, BIF_REAL, BIF_REAL,
|					BIF_REAL, BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive a BACKFACE_PROPERTIES entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|
|	ambient, diffuse, specular	Reflectance coefficents
|	c1, c2, c3			Specular color
|	highlight			Specular exponent
|	transparency			Transparency coefficient
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_bkfprop(ambient, diffuse, specular, c1, c2, c3,
		highlight, transparency)
    BIF_REAL ambient, diffuse, specular, c1, c2, c3, highlight, transparency;
{
    static int ent_size = sizeof(BIF_Surfaceproperties);
    BIF_All *ent;
    
#ifdef TEST_PRINT
    printf("BACKFACE_PROPERTIES :\n");
    printf("ambient, diffuse, specular %f %f %f\n",
	   ambient, diffuse, specular);
    printf("c1, c2, c3 %f %f %f\n",c1, c2, c3);
    printf("highlight, transparency %f %f %f\n",
	   highlight, transparency);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Fill the temp_ent then allocate the entity */
    temp_ent.surfaceproperties.props.ambient_coef = ambient;
    temp_ent.surfaceproperties.props.diffuse_coef = diffuse;
    temp_ent.surfaceproperties.props.specular_coef = specular;
    
    temp_ent.surfaceproperties.props.specular_colr.type = 
	wk_info.color_model;
    temp_ent.surfaceproperties.props.specular_colr.val.general.x = c1;
    temp_ent.surfaceproperties.props.specular_colr.val.general.y = c2;
    temp_ent.surfaceproperties.props.specular_colr.val.general.z = c3;
    temp_ent.surfaceproperties.props.specular_exp = highlight;
    
    ent = new_generic(&temp_ent,ent_size,BACKFACE_PROPERTIES,
		      do_backfaceproperties);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Call the entity in PHIGS */
    pset_back_refl_props(&ent->surfaceproperties.props);
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_surfprop */

/*--------------------------------------------------------------------*\
| Procedure     :	int bif_bkfprocessing(BIF_INT,BIF_INT)
|---------------------------------------------------------------------
| Description	:	Receive a BACK_FACE_PROCESSING entity from
|			the parser pass it on to a generic build,
|			store/execute function.
|---------------------------------------------------------------------
| Return        :	
\*--------------------------------------------------------------------*/
int bif_bkfprocessing(ident,cull)
    BIF_INT ident, cull;
    
{
    static int ent_size = sizeof(BIF_Backfaceprocessing);
    BIF_All *ent;
#ifdef TEST_PRINT
    printf("BACKFACE_PROCESSING :\n");
    printf("identify, cull %d %d\n", ident, cull);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Fill the temp_ent then allocate the entity */
    temp_ent.backfaceprocessing.g_mode = (Pdisting_mode)ident;
    temp_ent.backfaceprocessing.cull_mode = (Pcull_mode)cull;
    
    ent = new_generic(&temp_ent,ent_size,BACKFACE_PROCESSING,
		      do_backfaceprocessing);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Call the entity in PHIGS */
    pset_face_disting_mode(ent->backfaceprocessing.g_mode);
    pset_face_cull_mode(ent->backfaceprocessing.cull_mode);
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End bif_bkfprocessing() */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_edgeflag(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive an EDGE_FLAG entity from the parser
|			pass it on to a generic build,
|			store/execute function
|
|	ENABLE		Enable edge display
|	DISABLE		Disable edge display
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_edgeflag(edge_flag)
    BIF_INT edge_flag;
{
    int edg_flag;
    /* Build, Store/Execute the entity */
    edg_flag = REMAP_EDGEFLAG(edge_flag);
    bif_index(edg_flag, sizeof(BIF_Index),
	      EDGE_FLAG,do_edgeflag,pset_edge_flag);
    
} /* End procedure bif_edgeflag */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_edgetype(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive an EDGE_TYPE entity from the parser
|			Set the line style for edges.  Pass it on to a
|			generic build, store/execute function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_edgetype(edge_type)
    BIF_INT edge_type;
{
    /* Build, Store/Execute the entity */
    /* NONSUP: Any value other than solid (BIF value = 0) */
    /* NOTE: + 1 to map BIF edgetypes to PHIGs edgetypes */
    bif_index((int)(edge_type+1), sizeof(BIF_Index),
	      EDGE_TYPE,do_edgetype,pset_edgetype);
    
} /* End procedure bif_edgetype */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_edgewidth(BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive an EDGE_WIDTH entity from the parser
|			Pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_edgewidth(scale_factor)
    BIF_REAL scale_factor;
{
    /* Build, Store/Execute the entity */
    bif_size((float)scale_factor,sizeof(BIF_Size),
	     EDGE_WIDTH,do_edgewidth,pset_edgewidth);
    
} /* End procedure bif_edgewidth */

/* MACRO-GENERATED FUNCTIONS */
    MF_TRUE_COLOR(bif_edgecolor, EDGE_COLOR, do_edgecolor, pset_edge_colr)
    
    MF_MAP_INDEX(bif_edgecolorindex,EDGE_COLOR_INDEX,
		 do_edgecolorindex, pset_edge_colr)
    
    
/* *************** */
/* Text Attributes */
/* *************** */
/*----------------------------------------------------------------------*\
| Procedure	:	int bif_textfont(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a TEXT_FONT entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
    int bif_textfont(font_id)
    BIF_INT font_id;
{
    int fnt_id;
    /* Build, Store/Execute the entity */
    /* NONSUP: Only one font is supported (BIF font -2) */
    fnt_id = REMAP_TEXTFONT(font_id);
    bif_index(fnt_id, sizeof(BIF_Index),
	      TEXT_FONT,do_textfont,pset_text_font);
    
} /* End procedure bif_textfont */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_textprec(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a TEXT_PREC entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|
|	STRING	"String" Precision	Good
|	CHAR	"Character" Precision	Better
|	STROKE	"Stroke" Precision	Best
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_textprec(precision)
    BIF_INT precision;
{
    /* Build, Store/Execute the entity */
    REMAP_TEXTPREC(precision);
    /* NONSUP: ONLY BIF_STROKE (BIF token STROKE) supported */
    bif_index((int)precision, sizeof(BIF_Index),
	      TEXT_PREC,do_textprec,pset_text_prec);
    
} /* End procedure bif_textprec */

/* MACRO-GENERATED FUNCTIONS */
    MF_TRUE_COLOR(bif_textcolor, TEXT_COLOR, do_textcolor, pset_text_colr)
    
    MF_MAP_INDEX(bif_textcolorindex,TEXT_COLOR_INDEX,
		 do_textcolorindex, pset_text_colr)
    
/*----------------------------------------------------------------------*\
| Procedure	:	int bif_textpath(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a TEXT_PATH entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_textpath(path_index)
    BIF_INT path_index;
{
    extern void fxsattxp();
    /* Build, Store/Execute the entity */
    /* NOTE: - 1 from the BIF values match the PHIGs enumerated values */
    bif_index((int)(path_index-1), sizeof(BIF_Index),
	      TEXT_PATH,do_textpath,fxsattxp);
    
} /* End procedure bif_textpath */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_textalign(BIF_INT, BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a TEXT_ALIGN entity from the parser
|			store/execute as appropriate.
|
|	horizontal_alignment	Horizontal just. see Table 3.3-10
|	vertical_alignment	Vertical   just. see Table 3.3-11
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_textalign(horizontal_alignment, vertical_alignment)
    BIF_INT horizontal_alignment, vertical_alignment;
{
    static int ent_size = sizeof(BIF_Textalign);
    BIF_All *ent;
    
#ifdef TEST_PRINT
    printf("TEXT_ALIGN: Set to %d %d\n",horizontal_alignment,
	   vertical_alignment);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Fill the temp_ent then allocate and copy the entity */
    /* BIF values match the PHIGs enumerated values */
    temp_ent.textalign.text_align.hor = (Phor_text_align)horizontal_alignment;
    temp_ent.textalign.text_align.vert = (Pvert_text_align)vertical_alignment;
    ent = new_generic(&temp_ent,ent_size,TEXT_ALIGN, do_textalign);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Call the entity in PHIGS */
    /* MERGE: BIF merges the text3 and anno text3 attributes here */
    fxsattxal(&ent->textalign.text_align);
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_textalign */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_charheight(BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive a CHAR_HEIGHT entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_charheight(height)
    BIF_REAL height;
{
    /* Build, Store/Execute the entity */
    bif_size((float)height,sizeof(BIF_Size),
	     CHAR_HEIGHT,do_charheight,pset_char_ht);
    
} /* End procedure bif_charheight */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_charexp(BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive a CHAR_EXP entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_charexp(exp)
    BIF_REAL exp;
{
    /* Build, Store/Execute the entity */
    bif_size((float)exp,sizeof(BIF_Size),
	     CHAR_EXP,do_charexp,pset_char_expan);
    
} /* End procedure bif_charexp */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_charspace(BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive a CHAR_SPACE entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_charspace(space)
    BIF_REAL space;
{
    /* Build, Store/Execute the entity */
    bif_size((float)space,sizeof(BIF_Size),
	     CHAR_SPACE,do_charspace,pset_char_space);
    
} /* End procedure bif_charspace */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_charupvector(BIF_REAL, BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive a CHAR_UP_VECTOR entity from the parser
|
|	x y	Character up vector components
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_charupvector(x, y)
    BIF_REAL x, y;
{
    static int ent_size = sizeof(BIF_Charupvector);
    BIF_All *ent;
    
#ifdef TEST_PRINT
    printf("CHAR_UP_VECTOR : Set to %f %f\n",x, y);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Allocate the entity */
    temp_ent.charupvector.up_vect.delta_x = x;
    temp_ent.charupvector.up_vect.delta_y = y;
    ent = new_generic(&temp_ent,ent_size,CHAR_UP_VECTOR,
		      do_charupvector);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Call the entity in PHIGS */
    pset_char_up_vec(&ent->charupvector.up_vect);
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_charupvector */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_annotextcharheight(BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive a ANNO_TEXT_CHAR_HEIGHT entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_annotextcharheight(height)
    BIF_REAL height;
{
    /* Build, Store/Execute the entity */
    bif_size((float)height,sizeof(BIF_Size),
	     ANNO_TEXT_CHAR_HEIGHT,
	     do_annotextcharheight,pset_anno_char_ht);
    
} /* End procedure bif_annotextcharheight */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_annotextcharupvector(BIF_REAL, BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive a ANNO_TEXT_CHAR_UP_VECTOR entity from
|			the parser.
|
|		x y	Character up vector components
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_annotextcharupvector(x, y)
    BIF_REAL x, y;
{
    static int ent_size = sizeof(BIF_Charupvector);
    BIF_All *ent;
    
#ifdef TEST_PRINT
    printf("ANNO_TEXT_CHAR_UP_VECTOR : Set to %f %f\n",x, y);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Allocate the entity */
    temp_ent.charupvector.up_vect.delta_x = x;
    temp_ent.charupvector.up_vect.delta_y = y;
    ent = new_generic(&temp_ent,ent_size,ANNO_TEXT_CHAR_UP_VECTOR,
		      do_annotextcharupvector);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Call the entity in PHIGS */
    pset_anno_char_up_vec(&ent->charupvector.up_vect);
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_annotextcharupvector */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_annotextstyle(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a ANNO_TEXT_STYLE entity from the parser
|			pass it on to a generic build, store/execute
|			function.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_annotextstyle(style)
    BIF_INT style;
{
    /* Build, Store/Execute the entity */
    /* BIF anno types match the values for the GX4000 */
    bif_index((int)style, sizeof(BIF_Index),
	      ANNO_TEXT_STYLE,do_annotextstyle,pset_anno_style);
    
} /* End procedure bif_annotextstyle */

/* ******************** */
/* Rendering Attributes */
/* ******************** */

/* ****************************** */
/* Lights and lighting Attributes */
/* ****************************** */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_definelight(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Begin / End receiving a DEFINE_LIGHT entity from
|			the parser
|	BIF_P_BEGIN 	begin entity
|	BIF_P_END	end entity
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_definelight(begin_or_end)
    BIF_INT begin_or_end;
{
    static int ent_size = sizeof(BIF_Definelight);
    BIF_All *ent;
    int ierr;
#ifdef TEST_PRINT
    BEGEND(definelight);
    fflush(stdout);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    switch ( begin_or_end )
    {
      case BIF_P_BEGIN :
	  /* Initialize entity */
	  temp_ent.definelight.ld_trans_id = -1; /* No transform */
	  /* default light type is ambient */
	  temp_ent.definelight.light_type = BIF_AMBIENT;
	  break;
	  
	case BIF_P_END :
	    /* Check / Limit / Warn / Index Range Exception */
	    ierr = indexRange(DEFINE_LIGHT,
			      (BIF_INT)temp_ent.definelight.light_number,
			      1, BIF_MAX_LIGHTS);
	  
	    if ( ierr ) /* Substitute default value for error condition */
		temp_ent.definelight.light_number = 1;

	    /* Allocate the entity */
	    ent = new_generic(&temp_ent, ent_size,
			      DEFINE_LIGHT, do_definelight);

	    /* Error check for ent == NULL ( FATAL ) */
	    ENT_ERROR(ent);
	      
	    /* Build or Execute */
	    Traverse(traverser_state, ent);
	      
#ifdef USING_PHIGS
	    /* Called by the BIF execute traverser */
	    /* No PHIGS call here */
#endif /* USING_PHIGS */
	      
	    /* Release Non-Retained Entities */
	    Free_NRE(traverser_state, ent);
      }
    
    
#endif /* PRINT_ONLY */
} /* End procedure bif_definelight */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_lightbasic(BIF_INT,
|					BIF_REAL, BIF_REAL, BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive basic data for DEFINE_LIGHT entity from
|			the parser.
|	light_number	Light table entry to define
|	c1, c2, c3	Light color
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_lightbasic(light_number, c1, c2, c3)
    BIF_INT light_number;
    BIF_REAL c1, c2, c3;
{
    
#ifdef TEST_PRINT
    printf("Lightbasic: for %d color %f %f %f \n",light_number, c1, c2, c3);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    temp_ent.definelight.light_number   = (int)light_number;
    temp_ent.definelight.color_model    = wk_info.color_model;
    temp_ent.definelight.light_color[0] = (float)c1;
    temp_ent.definelight.light_color[1] = (float)c2;
    temp_ent.definelight.light_color[2] = (float)c3;
#endif /* PRINT_ONLY */
    
} /* End bif_lightbasic */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_ldtranform(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive the matrix id of the Light Definition
|			transformation.
|
|	mat_id		Matrix table entry to define the defining coord.
|			space for the current light;
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_ldtransform(mat_id)
    BIF_INT mat_id;
{
    
#ifdef TEST_PRINT
    printf("Ldtransform: Matrix id %d\n",mat_id);
#endif /* TEST_PRINT */
    
#ifndef PRINT_ONLY
    ERROR_MATRIX_ID(mat_id,DEFINE_LIGHT);
    temp_ent.definelight.ld_trans_id = mat_id;
#endif /* PRINT_ONLY */
    
} /* End new_ldtransform */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_lightoption(BIF_INT,
|					BIF_REAL, BIF_REAL, BIF_REAL,
|					BIF_REAL, BIF_REAL, BIF_REAL,
|					BIF_REAL, BIF_REAL,
|					BIF_REAL, BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive data for DEFINE_LIGHT entity from the
|			parser that defines non-ambient lights
|
|	light_type	Type of light defined
|	x, y, z		Light position
|	u, v, w		Light direction
|	e		Concentration exponent			
|	s		Spread angle
|	a, b		Attenuation coefficients
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_lightoption(light_type, x , y , z , u , v , w , e , s , a , b)
    BIF_INT light_type;
    BIF_REAL x, y, z;
    BIF_REAL u, v, w;
    BIF_REAL e;
    BIF_REAL s;
    BIF_REAL a, b;
{
#ifdef TEST_PRINT
    printf("Lightoption : Light type %d\n",(int)light_type);
    printf("Position  %f %f %f \n",x, y, z);
    printf("Direction %f %f %f \n",u, v, w);
    printf("Expon Spread %f %f \n",e, s);
    printf("Attenuation  %f %f \n",a, b);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* NONSUP: Attenuation Factors (BIF tokens POSITIONAL, SPOT) */
    temp_ent.definelight.light_type   = REMAP_LIGHTTYPE(light_type);
    temp_ent.definelight.direction[0] = u;
    temp_ent.definelight.direction[1] = v;
    temp_ent.definelight.direction[2] = w;
    temp_ent.definelight.position[0]  = x;
    temp_ent.definelight.position[1]  = y;
    temp_ent.definelight.position[2]  = z;
    temp_ent.definelight.attenuation[0] = a;
    temp_ent.definelight.attenuation[1] = b;
    temp_ent.definelight.exponent = e;
    temp_ent.definelight.spread = s;
    
#endif /* PRINT_ONLY */
} /* End procedure bif_lightoption */


/*----------------------------------------------------------------------*\
| Procedure	:	int bif_lightstate(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Begin / End receiving a LIGHT_STATE entity from
|			the parser.
|
|	BIF_P_BEGIN 	begin entity
|			Initialize group handler for data groups ACTIVATE_LIST
|			and DEACTIVATE_LIST
|
|	BIF_P_END	end entity
|			Store accumulated lists in entity structure.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_lightstate(begin_or_end)
    BIF_INT begin_or_end;
{
    BIF_Lightstate *ent;
    Group_description *group_list;
    int num_groups;
    
#ifdef TEST_PRINT
    BEGEND(lightstate );
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    switch (begin_or_end) {
      case BIF_P_BEGIN:
	/* Start of a lightstate */
	init_groups();
	break;
	
      case BIF_P_END:
	num_groups = end_groups(&group_list);
	ent = new_lightstate(num_groups, group_list);
	ENT_ERROR(ent);
	
	/* Store or execute */		
	Traverse(traverser_state, ent);
	
	/* Send to PHIGs */
#ifdef USING_PHIGS
#ifdef TEST_PRINT
	{
	    int i;
	    for ( i = 0 ;  i < ent->activation.num_ints ; i++ )
		printf("Switching on  Light # %d\n", ent->activation.ints[i]);
	    for ( i = 0 ;  i < ent->deactivation.num_ints ; i++ )
		printf("Switching off Light # %d\n", ent->deactivation.ints[i]);
	}
#endif /* TEST_PRINT */
	pset_light_src_state(&ent->activation,&ent->deactivation);
#endif /* USING_PHIGS */
	Free_NRE(traverser_state, ent);
    }
#endif /* PRINT_ONLY */
} /* End procedure bif_lightstate */

/* ********************** */
/* Depth Cueing           */
/* ********************** */
/*--------------------------------------------------------------------*\
| Procedure     :	int bif_definedepthcue(BIF_INT, BIF_INT,
|				BIF_REAL, BIF_REAL,
|				BIF_REAL, BIF_REAL,
|				BIF_REAL, BIF_REAL, BIF_REAL)
|---------------------------------------------------------------------
| Description   :	Receive the results of a DEFINE_DEPTHCUE
|			from the parser.
|---------------------------------------------------------------------
| Return        :	Error Code (Not Implemented)
\*--------------------------------------------------------------------*/
int bif_definedepthcue(entry_id, flag, near, far, nScale, fScale, 
		       c1, c2,c3)
    
    BIF_INT entry_id;
    BIF_INT flag;
    BIF_REAL near, far;
    BIF_REAL nScale, fScale;
    BIF_REAL c1, c2,c3;
    
{
    static int ent_size = sizeof(BIF_DefineDepthCue);
    BIF_All *ent;
    BIF_DefineDepthCue *dent;
    int ierr;
#ifdef TEST_PRINT
    char *key_w, *find_keyword_token(); 
    
    key_w = find_keyword_token(flag);
    printf("DEFINE_DEPTHCUE: Entry %d (%s)\n", entry_id, key_w);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    dent = &temp_ent.definedepthcue;
    dent->ind               = (int)entry_id;
    dent->rep.mode          = (Pdcue_mode)REMAP_DCMODE(flag);
    dent->rep.ref_planes[0] = (Pfloat)far;     /* back plane in npc  */
    dent->rep.ref_planes[1] = (Pfloat)near;    /* front plane in npc */
    dent->rep.scaling[0]   = (Pfloat)fScale;  /* back scale factor  */
    dent->rep.scaling[1]   = (Pfloat)nScale;  /* front scale factor */
    dent->rep.colr.type   = wk_info.color_model;
    dent->rep.colr.val.general.x = c1;
    dent->rep.colr.val.general.y = c2;
    dent->rep.colr.val.general.z = c3;
    
    /* Check / Limit / Warn / Index Range Exception */
    ierr = indexRange(DEFINE_DEPTHCUE, (BIF_INT)dent->ind,
		      1, BIF_MAX_DCRS);
    
    if ( ierr ) /* Substitute default value */
	dent->ind = 0;

    /* Allocate the entity */
    ent = new_generic(&temp_ent, ent_size,
		      DEFINE_DEPTHCUE, do_definedepthcue);
	
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);

    /* Build or Execute */
    Traverse(traverser_state, ent);
	
#ifdef USING_PHIGS
    /* Called by the BIF execute traverser */
    /* No PHIGS call here */
#endif /* USING_PHIGS */
	
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
#endif /* PRINT_ONLY */
} /* End of procedure bif_definedepthcue */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_depthcueindex(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a DEPTHCUE_INDEX entity from the parser
|
|	dc_index	the index of the depthcue entry
|			to make the current entry.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_depthcueindex(dc_index)
    BIF_INT dc_index;
{
    int ierr;
    /* Check / Limit / Warn / Index Range Exception */
    ierr = indexRange(DEFINE_DEPTHCUE, dc_index,
		      1, BIF_MAX_DCRS);
    
    if ( ierr ) /* Substitute default value */
	dc_index = 0;

    /* Build, Store/Execute the entity */
    bif_index((int)dc_index, sizeof(BIF_Index),
	      DEPTHCUE_INDEX, do_depthcueindex, pset_dcue_ind);
    
} /* End procedure bif_depthcueindex */

/* ********************** */
/* Hidden Surface Removal */
/* ********************** */
/*----------------------------------------------------------------------*\
  | Procedure	:	int bif_hlhsremoval(BIF_INT)
  |------------------------------------------------------------------------|
  | Description	:	Receive a HLHS_REMOVAL entity from the parser
  |			pass it on to a generic build, store/execute
  |			function.
  |
  |	hlhs_flag	HL/HS switch; see Table 3.4-1
  |			BIF_DISABLE		Disable HL/HS removal
  |			BIF_ENABLE		Enable HL/HS removal
  |------------------------------------------------------------------------|
  | Return	:	Error Code
  \*----------------------------------------------------------------------*/
int bif_hlhsremoval(hlhs_flag)
    BIF_INT hlhs_flag;
{
    int hl_flag;
    /* Build, Store/Execute the entity */
    hl_flag = REMAP_HLHS(hlhs_flag);
    bif_index(hl_flag, sizeof(BIF_Index),
	      HLHS_REMOVAL, do_hlhsremoval, pset_hlhsr_id);
    
} /* End procedure bif_hlhsremoval */

/* ********************** */
/* Color Model Attributes */
/* ********************** */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_definecolor(BIF_INT,
|					BIF_REAL, BIF_REAL, BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive a DEFINE_COLOR entity from the parser
|
|	map_index	Color map table entry to define
|	c1, c2, c3	True-color components for entry
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_definecolor(map_index, c1, c2, c3)
    BIF_INT map_index;
    BIF_REAL c1, c2, c3;
{
    static int ent_size = sizeof(BIF_Definecolor);
    BIF_All *ent;
    int ierr;
    
#ifdef TEST_PRINT
    printf("DEFINE_COLOR: Color %d set to %f %f %f\n",
	   map_index, c1, c2, c3);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Allocate the entity */
    /* indexRange reporting for definecolor */
    ierr = indexRange(DEFINE_COLOR, map_index,
		      0, (BIF_INT)wk_info.cmap_size);
    if ( ierr ) /* Substitute default value */
	map_index = 1;

    temp_ent.definecolor.ind = map_index;
    temp_ent.definecolor.color_model = wk_info.color_model;
    temp_ent.definecolor.rep.rgb.red      = c1;
    temp_ent.definecolor.rep.rgb.green      = c2;
    temp_ent.definecolor.rep.rgb.blue      = c3;
    ent = new_generic(&temp_ent,ent_size,
		      DEFINE_COLOR,do_definecolor);
	
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
	
    /* Build or Execute */
    Traverse(traverser_state, ent);
	
#ifdef USING_PHIGS
    /*----------------------------------------------------*\
    | If we are redefining the entry that defines
    | the background we must ALSO redfine the
    | background.
    \*----------------------------------------------------*/
    if ( map_index == background_color_index )
	bif_backgroundcolorindex(map_index);
	
    /* Cannot be contained within PHIGS structures */
    /* Called by the BIF execute traverser */
    /* No PHIGS call here */
#endif /* USING_PHIGS */
	
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_definecolor */

/*--------------------------------------------------------------------*\
| Procedure     :	bif_backgroundcolor(BIF_REAL,BIF_REAL,BIF_REAL)
|---------------------------------------------------------------------
| Description   :	Define the background true color components
|---------------------------------------------------------------------
| Return        :	
\*--------------------------------------------------------------------*/
bif_backgroundcolor(c1, c2, c3)
    BIF_REAL c1, c2, c3;
    
{/* bif_backgroundcolor */
    float comp1, comp2, comp3;
    comp1 = (float)c1;
    comp2 = (float)c2;
    comp3 = (float)c3;
    
    /*------------------------------------------------------------*\
    | Disconnect background from the color map
    \*------------------------------------------------------------*/
    background_color_index = -1;
#ifdef USING_PHIGS
    /*------------------------------------------------------------*\
    | We set the background color by redefining map entry 0
    \*------------------------------------------------------------*/
    {
	Pcolr_rep rep;
	
	if (user_background) {
	    PLB_EXCEPTION(BIF_EX_BACKCOLOR);
	}
	else {
	    rep.rgb.red = comp1;
	    rep.rgb.green = comp2;
	    rep.rgb.blue = comp3;
	    pset_colr_rep((Pint)bench_setup.workid, 0, &rep);
	}
    }
#endif /* USING_PHIGS */
}/* bif_backgroundcolor */


/*--------------------------------------------------------------------*\
| Procedure     :	bif_backgroundcolorindex(BIF_INT)
|---------------------------------------------------------------------
| Description   :	Define the background color index
|---------------------------------------------------------------------
| Return        :	
\*--------------------------------------------------------------------*/
bif_backgroundcolorindex(lindex)
    BIF_INT lindex;
    
{/* bif_backgroundcolorindex */
    int indx;
    int type;
    int errind;
    float comp1, comp2, comp3;
    indx = (int)lindex;
    
    if ( indexRange(BACKGROUND_COLOR_INDEX, indx,
		    0, wk_info.cmap_size ) ) /* Substitute default value */
	indx = 1;

    background_color_index = indx;
#ifdef USING_PHIGS
    {
	Pcolr_rep rep;
	Pint errind;
	    
	if (user_background) {
	    PLB_EXCEPTION(BIF_EX_BACKCOLOR);
	}
	else {
	    /*----------------------------------------------------*\
	    | Offset the map index "as usual" with PHIGS/BIF
	    \*----------------------------------------------------*/
	    indx++;
	    /*----------------------------------------------------*\
	    |	Get the color we are "into"
	    \*----------------------------------------------------*/
	    
	    pinq_colr_rep((Pint)bench_setup.workid, (Pint)indx,
			  PINQ_SET, &errind, &rep);
	    
	    /*----------------------------------------------------*\
	    |	We set the background color using map entry 0
	    \*----------------------------------------------------*/
	    
	    pset_colr_rep((Pint)bench_setup.workid, (Pint)0, &rep);
	}
    }
#endif /* USING_PHIGS */
}/* bif_backgroundcolorindex */


/* ****************************************
 * Coordinate Transformation Entities
 * ************************************** */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_identity3(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive an IDENTITY3 entity from the parser
|			Implemented as a MATRIX3 / REPLACE
|
|	matrix_id	ID of matrix table entry
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_identity3(matrix_id)
    BIF_INT matrix_id;
{
    static int ent_size = sizeof(BIF_Matrix3);
    BIF_All *ent;
    
#ifdef TEST_PRINT
    printf("IDENTITY3 : Set matrix %d to the identity matrix\n",matrix_id);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Check the matrix_id */
    ERROR_MATRIX_ID(matrix_id,IDENTITY3);
    
    /* Allocate the entity */
    temp_ent.matrix3.matrix_id = matrix_id;
    temp_ent.matrix3.concat_type = BIF_REPLACE;
    copy44f(ident_matrix,temp_ent.matrix3.matrix);
    ent = new_generic(&temp_ent,ent_size,MATRIX3,do_matrix3);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Cannot be contained within PHIGS structures */
    /* Called by the BIF execute traverser */
    /* No PHIGS call here */
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_identity3 */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_concatmatrix3(BIF_INT, BIF_INT, BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a CONCAT_MATRIX3 entity from the parser
|
|	matrix_from	ID of "from" matrix table entry
|	matrix_to	ID of "to" matrix table entry
|	concat		PRECONCAT | POSTCONCAT | REPLACE
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_concatmatrix3(matrix_from, matrix_to, concat)
    BIF_INT matrix_from, matrix_to, concat;
{
    static int ent_size = sizeof(BIF_Concatmatrix3);
    BIF_All *ent;
#ifdef TEST_PRINT
    printf("CONCAT_MATRIX3 : Concat %d and %d. Operation %d\n",
	   matrix_from, matrix_to, concat);
    fflush(stdout);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Check the matrix_id's */
    ERROR_MATRIX_ID(matrix_from,CONCAT_MATRIX3);
    ERROR_MATRIX_ID(matrix_to,CONCAT_MATRIX3);
    
    /* Allocate the entity */
    temp_ent.concatmatrix3.matrix_id_from = matrix_from;
    temp_ent.concatmatrix3.matrix_id_to   = matrix_to;
    temp_ent.concatmatrix3.concat_type    = REMAP_CONCAT(concat);
    ent = new_generic(&temp_ent,ent_size,CONCAT_MATRIX3,
		      do_concatmatrix3);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Cannot be contained within PHIGS structures */
    /* Called by the BIF execute traverser */
    /* No PHIGS call here */
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_concatmatrix3 */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_invertmatrix3(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive an INVERT_MATRIX3 entity from the parser
|
|	matrix_id	ID of matrix table entry to invert
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_invertmatrix3(matrix_id)
    BIF_INT matrix_id;
{
    static int ent_size = sizeof(BIF_Invertmatrix3);
    BIF_All *ent;
#ifdef TEST_PRINT
    printf("INVERT_MATRIX3 : Invert matrix %d\n",matrix_id);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Check the matrix_id */
    ERROR_MATRIX_ID(matrix_id,INVERT_MATRIX3);
    
    /* Allocate the entity */
    temp_ent.invertmatrix3.matrix_id = matrix_id;
    ent = new_generic(&temp_ent,ent_size,INVERT_MATRIX3,
		      do_invertmatrix3);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Cannot be contained within PHIGS structures */
    /* Called by the BIF execute traverser */
    /* No PHIGS call here */
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_invertmatrix3 */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_rotate3( BIF_INT, BIF_REAL,
|						BIF_INT, BIF_INT )
|------------------------------------------------------------------------|
| Description	:	Receive a ROTATE3 entity from the parser
|			Implemented as a MATRIX3 / concat
|
|	matrix_id	ID of matrix table entry to alter
|	angle		Angle of rotation
|	axis		X_AXIS | Y_AXIS | Z_AXIS
|	concat		PRECONCAT | POSTCONCAT | REPLACE
|
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_rotate3( matrix_id, angle, axis, concat )
    BIF_INT matrix_id;
    BIF_REAL angle;
    BIF_INT axis, concat;
{
    static int ent_size = sizeof(BIF_Matrix3);
    BIF_All *ent;
    matrix4 amx;
#ifdef TEST_PRINT
    printf("ROTATE3 : id %d by %f on %d. Op=%d\n",
	   matrix_id, angle, axis, concat);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Check the matrix_id */
    ERROR_MATRIX_ID(matrix_id,ROTATE3);
    
    /* Fill the temp entity */
    switch( axis )
    {
      case X_AXIS :
	  mx_rot_x( (float)angle, amx );
	  break;
	case Y_AXIS :
	    mx_rot_y( (float)angle, amx );
	  break;
	case Z_AXIS :
	    mx_rot_z( (float)angle, amx );
	  break;
      }
    temp_ent.matrix3.matrix_id   = matrix_id;
    temp_ent.matrix3.concat_type = REMAP_CONCAT(concat);
    copy44f( amx, temp_ent.matrix3.matrix );
    ent = new_generic( &temp_ent, ent_size, MATRIX3, do_matrix3 );
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Cannot be contained within PHIGS structures */
    /* Called by the BIF execute traverser */
    /* No PHIGS call here */
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_rotate3 */

/*----------------------------------------------------------------------*\
| Procedure	:	BIF_INT bif_rotatexyz3(BIF_INT,BIF_REAL,BIF_REAL,
|						BIF_REAL,BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a ROTATE_XYZ3 entity from the parser
|		Implemented as a MATRIX3 / concat
|
|	matrix_id	ID of matrix table entry to alter
|	angle_x, angle_y, angle_z
|			Angles of rotations
|	concat		PRECONCAT | POSTCONCAT | REPLACE
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_rotatexyz3(matrix_id, angle_x, angle_y, angle_z, concat)
    BIF_INT matrix_id;
    BIF_REAL angle_x,angle_y,angle_z;
    BIF_INT concat;
{
    static int ent_size = sizeof(BIF_Matrix3);
    BIF_All *ent;
    matrix4 amx;
#ifdef TEST_PRINT
    printf("ROTATEXYZ3 : id %d by %f %f %f. Op=%d\n",
	   matrix_id, angle_x, angle_y, angle_z, concat);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Check the matrix_id */
    ERROR_MATRIX_ID(matrix_id,ROTATE_XYZ3);
    
    /* Fill the temp entity */
    mx_euler_matrix( (float)angle_x, (float)angle_y,
		    (float)angle_z, amx );
    temp_ent.matrix3.matrix_id   = matrix_id;
    temp_ent.matrix3.concat_type = REMAP_CONCAT(concat);
    copy44f( amx, temp_ent.matrix3.matrix );
    ent = new_generic( &temp_ent, ent_size, MATRIX3, do_matrix3 );
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Cannot be contained within PHIGS structures */
    /* Called by the BIF execute traverser */
    /* No PHIGS call here */
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_rotatexyz3 */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_translate3(BIF_INT ,
|					BIF_REAL, BIF_REAL, BIF_REAL,
|					BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a TRANSLATE3 entity from the parser
|		Implemented as a MATRIX3 / concat
|
|	matrix_id	ID of matrix table entry to alter
|	tx, ty, tz	Translation vector 
|	concat		PRECONCAT | POSTCONCAT | REPLACE
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_translate3(matrix_id, tx, ty, tz, concat)
    BIF_INT matrix_id;
    BIF_REAL tx, ty, tz;
    BIF_INT concat;
{
    static int ent_size = sizeof(BIF_Matrix3);
    BIF_All *ent;
    float amx[4][4];
#ifdef TEST_PRINT
    printf("TRANSLATE3 : id %d by %f %f %f. Op=%d\n",
	   matrix_id, tx, ty, tz, concat);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Check the matrix_id */
    ERROR_MATRIX_ID(matrix_id,TRANSLATE3);
    
    /* Fill the temp entity */
    mx_translate( (float)tx, (float)ty, (float)tz, amx );
    temp_ent.matrix3.matrix_id   = matrix_id;
    temp_ent.matrix3.concat_type = REMAP_CONCAT(concat);
    copy44f( amx, temp_ent.matrix3.matrix );
    ent = new_generic( &temp_ent, ent_size, MATRIX3, do_matrix3 );
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Cannot be contained within PHIGS structures */
    /* Called by the BIF execute traverser */
    /* No PHIGS call here */
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_globaltransformation3 */


/*----------------------------------------------------------------------*\
| Procedure	:	int bif_scale3(BIF_INT , BIF_REAL, BIF_REAL,
|					BIF_REAL, BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a SCALE3 entity from the parser
|			Implemented as a MATRIX3 / concat
|
|	matrix_id	ID of matrix table entry to alter
|	sx, sy, sz	Scaling vector 
|	concat		PRECONCAT | POSTCONCAT | REPLACE
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_scale3(matrix_id, sx, sy, sz, concat)
    BIF_INT matrix_id;
    BIF_REAL sx, sy, sz;
    BIF_INT concat;
{
    static int ent_size = sizeof(BIF_Matrix3);
    BIF_All *ent;
    float amx[4][4];
#ifdef TEST_PRINT
    printf("SCALE3 : id %d by %f %f %f. Op=%d\n",
	   matrix_id, sx, sy, sz, concat);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Check the matrix_id */
    ERROR_MATRIX_ID(matrix_id,SCALE3);
    
    /* Fill the temp entity */
    mx_scale( (float)sx, (float)sy, (float)sz, amx );
    temp_ent.matrix3.matrix_id   = matrix_id;
    temp_ent.matrix3.concat_type = REMAP_CONCAT(concat);
    copy44f( amx, temp_ent.matrix3.matrix );
    ent = new_generic( &temp_ent, ent_size, MATRIX3, do_matrix3 );
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Cannot be contained within PHIGS structures */
    /* Called by the BIF execute traverser */
    /* No PHIGS call here */
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_scale3 */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_matrix3(BIF_INT, *BIF_REAL, BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a MATRIX3 entity from the parser
|
|	matrix_id	ID of matrix table entry to alter
|	amatrix		Matrix to use 
|	concat		PRECONCAT | POSTCONCAT | REPLACE
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_matrix3(matrix_id, amatrix, concat)
    BIF_INT matrix_id;
    BIF_REAL  amatrix[4][4];
    BIF_INT concat;
{
    static int ent_size = sizeof(BIF_Matrix3);
    BIF_All *ent;
#ifdef TEST_PRINT
    printf("MATRIX3 : id %d  Op=%d Matrix:\n", matrix_id, concat);
    PRINT_MATRIX44(amatrix);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Check the matrix_id */
    ERROR_MATRIX_ID(matrix_id,MATRIX3);
    
    /* Fill the temp entity */
    temp_ent.matrix3.matrix_id   = matrix_id;
    temp_ent.matrix3.concat_type = REMAP_CONCAT(concat);
    Transpose44( amatrix, temp_ent.matrix3.matrix );
    ent = new_generic(&temp_ent, ent_size, MATRIX3, do_matrix3);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Cannot be contained within PHIGS structures */
    /* Called by the BIF execute traverser */
    /* No PHIGS call here */
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_matrix3 */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_getmatrix3(BIF_INT, BIF_INT, BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a GET_MATRIX3 entity from the parser
|
|	matrix_id	ID of matrix table entry to alter
|	get_this	System Matrix to use 
|	concat		PRECONCAT | POSTCONCAT | REPLACE
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_getmatrix3(matrix_id, get_this, concat)
    BIF_INT matrix_id;
    BIF_INT get_this;
    BIF_INT concat;
{
    static int ent_size = sizeof(BIF_Getmatrix3);
    BIF_All *ent;
    char *from_mat, *mat_op;
    char *find_keyword_token();
    from_mat = find_keyword_token(get_this);
    mat_op   = find_keyword_token(concat);
#ifdef TEST_PRINT
    printf("GET_MATRIX3 : Matrix id %d from %s Op= %s \n",
	   matrix_id, from_mat, mat_op);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Check the matrix_id */
    ERROR_MATRIX_ID(matrix_id,GET_MATRIX3);
    
    /* Fill the temp_ent then allocate and copy the entity */
    temp_ent.getmatrix3.matrix_id   = matrix_id;
    temp_ent.getmatrix3.get_matrix  = REMAP_GETMAT(get_this);
    temp_ent.getmatrix3.concat_type = REMAP_CONCAT(concat);
    ent = new_generic(&temp_ent, ent_size, GET_MATRIX3,
		      do_getmatrix3);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Cannot be contained within PHIGS structures */
    /* Called by the BIF execute traverser */
    /* No PHIGS call here */
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_getmatrix3 */


/*--------------------------------------------------------------------*\
| Procedure     :	int bif_pushmatrix3()
|---------------------------------------------------------------------
| Description   :	Receive a PUSH_MATRIX3 entity from the parser
|			Build, then store or execute the appropriate
|			entity.  The bif_entity only manipulates the 
|			matrix stack ( on matrix entry 0 )
|---------------------------------------------------------------------
| Return        :	Error Code (Not Implemented)
\*--------------------------------------------------------------------*/
int bif_pushmatrix3()
    
{
    static int ent_size = sizeof(BIF_No_data);
    BIF_All *ent;
    
#ifdef TEST_PRINT
    printf("PUSH_MATRIX3:\n");
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Allocate and fill the entity */
    ent = new_generic(&temp_ent, ent_size, PUSH_MATRIX3,
		      do_pushmatrix3);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Cannot be contained within PHIGS structures */
    /* Called by the BIF execute traverser */
    /* No PHIGS call here */
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End bif_pushmatrix3() */

/*--------------------------------------------------------------------*\
| Procedure     :	int bif_popmatrix3()
|---------------------------------------------------------------------
| Description   :	Receive a POP_MATRIX3 entity from the parser
|			Build, then store or execute the appropriate
|			entity.  The bif_entity only manipulates the 
|			matrix stack ( on matrix entry 0 )
|---------------------------------------------------------------------
| Return        :	Error Code (Not Implemented)
\*--------------------------------------------------------------------*/
int bif_popmatrix3()
    
{
    static int ent_size = sizeof(BIF_No_data);
    BIF_All *ent;
    
#ifdef TEST_PRINT
    printf("POP_MATRIX3:\n");
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Allocate and fill the entity */
    ent = new_generic(&temp_ent, ent_size, POP_MATRIX3,
		      do_popmatrix3);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    /* Cannot be contained within PHIGS structures */
    /* Called by the BIF execute traverser */
    /* No PHIGS call here */
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End bif_popmatrix3() */


/*----------------------------------------------------------------------*\
| Procedure	:	int bif_gtransform3(*BIF_REAL)
|------------------------------------------------------------------------|
| Description	:	Receive a GLOBAL_TRANSFORMATION3 entity from the
|			parser amatrix	Matrix to use 
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_gtransform3(amatrix)
    BIF_REAL  amatrix[4][4];
{
#ifdef USING_PHIGS
    Pmatrix3 tmp_xform;
#endif
    static int ent_size = sizeof(BIF_Globaltransformation3);
    BIF_All *ent;
#ifdef TEST_PRINT
    printf("GLOBAL_TRANSFORMATION3 : Matrix:\n");
    PRINT_MATRIX44(amatrix);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Fill the temp entity */
    Transpose44( amatrix, temp_ent.globaltransformation3.xform);
    ent = new_generic(&temp_ent, ent_size, GLOBAL_TRANSFORMATION3,
		      do_globaltransformation3);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    Cpmatrix44(amatrix, tmp_xform); /* Convert from BIF_REAL to Pmatrix3 */
    pset_global_tran3(tmp_xform);
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_gtransform3 */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_ltransform3(*BIF_REAL, BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a LOCAL_TRANSFORMATION3 entity from the
|			parser amatrix	Matrix to use 
|
|	concat		PRECONCAT | POSTCONCAT | REPLACE
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_ltransform3(amatrix, concat)
    BIF_REAL  amatrix[4][4];
    BIF_INT concat;
{
#ifdef USING_PHIGS
    Pmatrix3 tmp_xform;
#endif
    static int ent_size = sizeof(BIF_Localtransformation3);
    BIF_All *ent;
#ifdef TEST_PRINT
    printf("LOCAL_TRANSFORMATION3 : Op=%d Matrix:\n", concat);
    PRINT_MATRIX44(amatrix);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Fill the temp entity */
    Transpose44( amatrix, temp_ent.localtransformation3.xform );
    temp_ent.localtransformation3.compose_type =
	(Pcompose_type)REMAP_CONCAT(concat);
    ent = new_generic(&temp_ent, ent_size, 
		      LOCAL_TRANSFORMATION3, do_localtransformation3);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
    /* Build or Execute */
    Traverse(traverser_state, ent);
    
#ifdef USING_PHIGS
    Cpmatrix44(amatrix, tmp_xform); /* Convert from BIF_REAL to Pmatrix3 */
    pset_local_tran3(tmp_xform, ent->localtransformation3.compose_type );
#endif /* USING_PHIGS */
    
    /* Release Non-Retained Entities */
    Free_NRE(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_ltransform3 */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_applytoglobal3(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive an APPLY_TO_GLOBAL3 entity from the parser
|
|	matrix_id	ID of matrix table entry to apply to global
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_applytoglobal3(matrix_id)
    BIF_INT matrix_id;
{
    static int ent_size = sizeof(BIF_Applytoglobal3);
    BIF_All *ent;
    BIF_Applytoglobal3 *app;
    BIF_Beginstructure *str_ptr;
#ifdef TEST_PRINT
    printf("APPLY_TO_GLOBAL3 : id %d  \n", matrix_id);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Check the matrix_id */
    ERROR_MATRIX_ID(matrix_id,APPLY_TO_GLOBAL3);
    
    /* Fill the temp entity */
    app = &temp_ent.applytoglobal3;
    app->matrix_id    = matrix_id;
    if ( (str_ptr = traverser_state->open_structure) != NULL )
	app->structure_id = str_ptr->structure_id;
    else
	app->structure_id = bench_setup.nrs_stid;
    app->matrix_label = getNextLabel();
    
    /* Allocate the entity */
    ent = new_generic(&temp_ent, ent_size,
		      APPLY_TO_GLOBAL3,do_applytoglobal3);
#ifdef TEST_PRINT
    printf("push_level %d  \n", traverser_state->push_level);
#endif /* TEST_PRINT */
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
#ifdef USING_PHIGS
    /* Insert Label must be before the BIF traversal */
    plabel(app->matrix_label);
    {
	Pmatrix3 mx;
	mx_identity(mx);
	pset_global_tran3(mx);
    }
#endif /* USING_PHIGS */
    /* Store or Execute */
    Traverse(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_applytoglobal3 */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_applytolocal3(BIF_INT, BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive an APPLY_TO_LOCAL3 entity from the parser
|
|	matrix_id	ID of matrix table entry to apply to local
|	concat	PRECONCAT | POSTCONCAT | REPLACE
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_applytolocal3(matrix_id, concat)
    BIF_INT matrix_id;
    BIF_INT concat;
{
    static int ent_size = sizeof(BIF_Applytolocal3);
    BIF_All *ent;
    BIF_Applytolocal3 *app;
    BIF_Beginstructure *str_ptr;
#ifdef TEST_PRINT
    printf("APPLY_TO_LOCAL3 : id %d  Op=%d\n", matrix_id, concat);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Check the matrix_id */
    ERROR_MATRIX_ID(matrix_id,APPLY_TO_LOCAL3);
    
    /* Fill the temp entity */
    app = &temp_ent.applytolocal3;
    app->matrix_id    = matrix_id;
    app->concat_type  = REMAP_CONCAT(concat);
    if ( (str_ptr = traverser_state->open_structure) != NULL )
	app->structure_id = str_ptr->structure_id;
    else
	app->structure_id = bench_setup.nrs_stid;
    app->matrix_label = getNextLabel();
    
    /* Allocate the entity */
    ent = new_generic(&temp_ent, ent_size,
		      APPLY_TO_LOCAL3,do_applytolocal3);
    
    /* Error check for ent == NULL ( FATAL ) */
    ENT_ERROR(ent);
    
#ifdef USING_PHIGS
    /* Insert Label must be before the BIF traversal */
    plabel(app->matrix_label);
    {
	Pmatrix3 mx;
	Pcompose_type contype;
	mx_identity(mx);
	contype = (Pcompose_type)BIF_PRECONCAT;
	pset_local_tran3(mx,contype);
    }
#endif /* USING_PHIGS */
    /* Store or Execute */
    Traverse(traverser_state, ent);
    
#endif /* PRINT_ONLY */
} /* End procedure bif_applytolocal3 */

/*--------------------------------------------------------------------*\
|	* ***************************************** *
|		BIF Verb File
|	* ***************************************** *
\*--------------------------------------------------------------------*/

/*--------------------------------------------------------------------*\
|	* ***************************************** *
|		Input / Output
|	* ***************************************** *
\*--------------------------------------------------------------------*/


/*--------------------------------------------------------------------*\
|	Read Geom is a function of the parser
\*--------------------------------------------------------------------*/

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_cleargeom()
|------------------------------------------------------------------------|
| Description	:	Receive a CLEAR_GEOMETRY entity from the parser.
|			Delete all structures from memory.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_cleargeom()
{
#ifdef TEST_PRINT
    printf("CLEAR_GEOMETRY :\n");
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    db_clear_all();
    
#ifdef USING_PHIGS
    /* Nothing Here.... db_clear_all also does PEMST as well as free the 
       BIF structures		 */
#endif /* USING_PHIGS */
    
#endif /* PRINT_ONLY */
} /* End procedure bif_cleargeom */

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_reportfile(*char)
|------------------------------------------------------------------------|
| Description	:	Receive a REPORT_FILE entity from the parser.
|			Specifies new report file.
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_reportfile(file_name)
    char *file_name;
{
#ifdef TEST_PRINT
    printf("REPORT_FILE : %s\n",file_name);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    
    
    close_reportfile();
    open_reportfile(file_name);
    
    
#endif /* PRINT_ONLY */
} /* End procedure bif_reportfile */

/*--------------------------------------------------------------------*\
|	* ***************************************** *
|		Test Control
|	* ***************************************** *
\*--------------------------------------------------------------------*/

/*----------------------------------------------------------------------*\
| Procedure	:	int bif_begintest(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a BEGIN_TEST entity from the parser
|
|	n_repetitions	Number of frames
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_begintest(n_repetitions)
    BIF_INT n_repetitions;
{
    int structure_id;
    BIF_Beginstructure *ent;
#ifdef TEST_PRINT
    printf("BEGIN_TEST : repeats %d \n",n_repetitions);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* Get the pointer to the structure ( allocated if new ) */
    structure_id = bench_setup.test_stid;
    ent = db_get_str((BIF_INT)structure_id);
    
    /*  Check if we ran out of memory */
    ENT_ERROR(ent);
    
    /* Store the Current test state */
    current_test.n_repetitions = n_repetitions;
    current_test.structure_id   = structure_id;
    current_test.structure_ptr  = ent;
    current_test.structure_ptr->expanded = 0;
    
    /* Clear the Structure of its last contents */
    free_all_list(ent->top_of_list);
    ent->top_of_list = NULL;
    
    /* Open the Structure in the BIF Database / set the traverser */
    /* to the build mode */
    do_beginstructure(traverser_state, ent);
    
    /* ************************************************************* */
    /* Non-Phigs: Insert Border BIF Structure                        */
    /*      Traverse(traverser_state, border_structure.top_of_list ) */
    /* ************************************************************* */
    
#ifdef USING_PHIGS
    /* Close the Non-Retained Structure */
    fxclns();
    traverser_state->nrs_state = 0;
    
    /* ************************************************************ */
    /* Do the PHIGS calls that initialize the test_structure        */
    /* ************************************************************ */
    /* Empty the Test Structure */
    pempty_struct((Pint)structure_id);
    
    /* Open the Test Structure */
    popen_struct((Pint)structure_id);
    /* Insert the "Basestate" the Test Structure */
    pcopy_all_elems_struct((Pint)bench_setup.base_state_stid);
#endif /* USING_PHIGS */
#endif /* PRINT_ONLY */
} /* End procedure bif_begintest */

/*----------------------------------------------------------------------*\
| Procedure: int bif_endtest()
|------------------------------------------------------------------------|
| Description: Receive an END_TEST entity from the parser
|------------------------------------------------------------------------|
| Return: Error Code
\*----------------------------------------------------------------------*/
int bif_endtest()
{
    BIF_All *bif_list;
    int indx;
    slList tol; /* Top of list for CALL expansion */
#ifdef TEST_PRINT
    printf("END_TEST :\n");
    fflush(stdout);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    /* End the insertion of entities into the BIF test structure */
    /* Put the traverser into EXECUTE mode */
    do_endstructure(traverser_state,NULL);
    
#ifdef USING_PHIGS
    /* Close and the test structure */
    pclose_struct();
    
#ifdef TEST_PRINT
    printf("ppost(%d, %d, 1.0)\n",bench_setup.workid,current_test.structure_id);
    fflush(stdout);
#endif /* TEST_PRINT */
    
#ifdef EXTERNALNOTE
    /* it was discovered that the border around the test window
       was adding a substantial overhead on earlier versions
       of PLB. Because this overhead is mostly text, it tends to
       bias the PLB towards machines with faster text operations.
       The answer is to unpost the border structure just prior to the
       test loop itself, then post the test structure. After the test is run,
       the border is re-posted and the workstation updated. This presents
       the final frame with border to the user. At this point, the test
       structure is un-posted, and vanishes on the next operation.*/
#endif
    
    /* UN-post the border structure if there is one */
    if (bench_setup.border_stid)
	punpost_struct((Pint)bench_setup.workid,(Pint)bench_setup.border_stid);

#endif /* USING_PHIGS */
    
    /* Push the traverser state */
    traverser_state->currentFrame = 1;
#ifdef SYSV
    memcpy((char *)temp_state_ptr,(char *)traverser_state,
	   sizeof(BIF_Traverser_state));
#else
    bcopy((char *)traverser_state, (char *)temp_state_ptr,
	  sizeof(BIF_Traverser_state));
#endif
    /* Disable Basestate edits */
    temp_state_ptr->push_level = 1;
    bif_list = current_test.structure_ptr->top_of_list;
    
#ifndef REFER_STRUCTURE_EXISTS
    /* Expand the CALL's */
    expandStructure(current_test.structure_ptr);
    
    /* Allow instance tracing editing */
    temp_state_ptr->tol = &tol;
    temp_state_ptr->eol = &tol;
    tol.next = NULL;
    tol.data = current_test.structure_id;
    
#endif /* REFER_STRUCTURE_EXISTS */
    
#ifdef USING_PHIGS
    ppost_struct((Pint)bench_setup.workid,
		 (Pint)current_test.structure_id,(Pfloat)1.);
#endif /* USING_PHIGS */
    /* **************************** */
    /* Do the statistical traverser */
    /* **************************** */
    brf_state.brf_start_frame = 1;
    brf_state.brf_end_frame = current_test.n_repetitions;
    brf_state.brf_num_frames = current_test.n_repetitions;
    brf_init ( );
    brf_traverser( traverser_state, bif_list, &brf_state);
    brf_report(&brf_state ); /* generates the body of report */
    /* **************** */
    /* Start stop watch */
    /* **************** */
    brf_start_stopwatch();
    /* **************** */
    /* Do the test loop */
    /* **************** */
    for ( indx = 0 ; indx < current_test.n_repetitions ; indx++ )
    {
	Traverse(temp_state_ptr,bif_list);
	
#ifdef USING_PHIGS
	pupd_ws((Pint)bench_setup.workid,(Pregen_flag)PFLAG_PERFORM);
#endif /* USING_PHIGS */
	
	temp_state_ptr->currentFrame++;
	
    }
    /* **************************************** */
    /* Stop stop watch and print timing results */
    /* **************************************** */
    brf_stop_stopwatch(&brf_state);
    /* **************************************** */
    
#ifdef USING_PHIGS
    /* RE-post the border structure if it exists */
    if (bench_setup.border_stid) {
	ppost_struct((Pint)bench_setup.workid,(Pint)bench_setup.border_stid,
		     (Pfloat)1.);
	pupd_ws((Pint)bench_setup.workid,(Pregen_flag)PFLAG_PERFORM);
    }
    /* Open the Non-Reatained Structure */
    fxopns();
    traverser_state->nrs_state = 1;
#endif /* USING_PHIGS */
    
#endif /* PRINT_ONLY */
} /* End procedure bif_endtest */

/*----------------------------------------------------------------------*\
| Procedure: int bif_pause()
|------------------------------------------------------------------------|
| Description: Receive a PAUSE entity from the parser
|------------------------------------------------------------------------|
| Return: Error Code
\*----------------------------------------------------------------------*/
int bif_pause()
{
#ifdef TEST_PRINT
    printf("PAUSE :\n");
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
#ifdef USING_PHIGS
    fxpaus(&bench_setup.workid);
#else
    /* Insert a mouse or keyboard wait */
    fxpaus(&bench_setup.workid);
#endif /* USING_PHIGS */
#endif /* PRINT_ONLY */
} /* End procedure bif_pause */
/*----------------------------------------------------------------------*\
| Procedure	:	int bif_sleep(BIF_INT)
|------------------------------------------------------------------------|
| Description	:	Receive a SLEEP entity from the parser
|
|	sleep	Sleep period in seconds
|------------------------------------------------------------------------|
| Return	:	Error Code
\*----------------------------------------------------------------------*/
int bif_sleep(sleep_time)
    BIF_INT sleep_time;
{
#ifdef TEST_PRINT
    printf("SLEEP : zzzzzzz for %d sec.\n",sleep_time);
#endif /* TEST_PRINT */
#ifndef PRINT_ONLY
    sleep((unsigned)sleep_time);
#endif /* PRINT_ONLY */
} /* End procedure bif_sleep */

/*--------------------------------------------------------------------*\
| Procedure     :	int indexRange(int, int, int, int)
|---------------------------------------------------------------------
| Description   :	Check the supplied index against the range
|			Generate warning message at file load time.
|---------------------------------------------------------------------
| Return        :	-1 --> Value  < min
|			 0 --> min <= Value  <= max
|			+1 --> Value  > max
\*--------------------------------------------------------------------*/
int indexRange(token, indx, min, max)
    BIF_INT token, indx, min, max;
    
{
    int retCode;
    char *key_w, *find_keyword_token(); 
    char buffy[255];
    if ( indx > max )
    {
	retCode =  1;
	key_w = find_keyword_token(token); 
	sprintf(buffy,"%s: Index value %d > Max. (%d)",
		key_w,indx,max);
	yyerror(buffy);
    }
    else if ( indx < min )
    {
	retCode = -1;
	key_w = find_keyword_token(token); 
	sprintf(buffy,"%s: Index value %d < Min. (%d)",
		key_w,indx,min);
	yyerror(buffy);
    }
    else
    {
	retCode = 0;
    }
    
    return(retCode);
} /* End indexRange() */