1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692
|
/*----------------------------------------------------------------------------
-- --
-- FLORIST (FSU Implementation of POSIX.5) COMPONENTS --
-- --
-- --
-- C - P O S I X . C --
-- --
-- --
-- Copyright (C) 1991-1994, Florida State University --
-- Copyright (C) 1995-2014, AdaCore --
-- --
-- This file is a component of FLORIST, an implementation of an Ada API --
-- for the POSIX OS services, for use with the GNAT Ada compiler and --
-- the FSU Gnu Ada Runtime Library (GNARL). The interface is intended --
-- to be close to that specified in IEEE STD 1003.5: 1990 and IEEE STD --
-- 1003.5b: 1996. --
-- --
-- FLORIST is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the --
-- Free Software Foundation; either version 2, or (at your option) any --
-- later version. FLORIST is distributed in the hope that it will be --
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. You should have received a --
-- copy of the GNU General Public License distributed with GNARL; see --
-- file COPYING. If not, write to the Free Software Foundation, 59 --
-- Temple Place - Suite 330, Boston, MA 02111-1307, USA --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
----------------------------------------------------------------------------*/
/* file: c-posix.c
===============
This program generates the files:
posix.ads, posix-limits.ads, posix-options.ads, posix-c.ads
*/
/* includes
========
Files pconfig.h and config.h are generated
by the "configure" script, which in turn is generated
by running "autoconf" on "configure.in".
*/
#include "confsrc/pconfig.h"
#include <errno.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "confsrc/config.h"
#ifdef __hpux__
/* HP-UX headers define an obsolete (and wrong) OPEN_MAX when
_XOPEN_SOURCE_EXTENDED is defined. Since we need this macro (_XOPEN.*)
to get other POSIX definitions, we kludge here by undefining this unwanted
symbol. */
#undef OPEN_MAX
#endif
int indent = 0;
int ifprintf (FILE *stream, const char * format, ...) {
va_list arg;
int done;
int i;
va_start(arg, format);
for (i = 0; i < indent; i++) fprintf(stream, " ");
done = vfprintf(stream, format, arg);
va_end(arg);
return done;
}
/* Files pconfig.h and config.h are generated
by the "configure" script, which in turn is generated
by running "autoconf" on "configure.in".
*/
/* .... The following #define may belong in pconfig.h.
Consider moving it there?
*/
/* TRY_MACRO_LINKNAMES activates a workaround for header files
that define macros for certain POSIX function names, so that
a substitute linkname is used. See macro GFUNC for more info.
*/
#define TRY_MACRO_LINKNAMES
/* Macros
======
*/
#define NON_SUPPORT_MESSAGE(NAME)\
ifprintf(fp," -- *** MISSING: %s *** --\n", NAME);\
warn("missing",NAME);
/* universal constant declarations
-------------------------------
In the original design, we did not account for the possibility
of long integers coming out as negative with the "%d" format.
We then added GUCST, but have only used it for known problem
cases. By rights, we should go through all the POSIX symbols,
find the ones that are used sa bit-masks, and make sure they
all are put out using the unsigned format.
*/
#define GUCST(name, value) \
ifprintf(fp," %s : constant := %u;\n", name, value);
#define GCST(name, value) \
ifprintf(fp," %s : constant := %d;\n", name, value);
int max_GCST2;
#define GCST2(name, name2, value) \
ifprintf(fp," %s,\n", name);\
ifprintf(fp," %s : constant := %d;\n", name2, value); \
if (value > max_GCST2) max_GCST2 = value;
#define GDFLT(name, value) \
NON_SUPPORT_MESSAGE(name)\
ifprintf(fp," %s : constant := %d;\n", name, value);
#define GUFLT(name, value) \
NON_SUPPORT_MESSAGE(name)\
ifprintf(fp," %s : constant := %u;\n", name, value);
#define GDFLT2(name, name2) \
NON_SUPPORT_MESSAGE(name)\
GCST2(name, name2, -1);
/* We use -1 for value above because this may be a missing
errno value, for which 0 may mean no error.
*/
/* struct type definitions
-----------------------
They are only to be used in the sequence
GT1 (GT2 | GT2A | GT2V | GT2P)+ GT3.
Do not interleave any other text or macros.
*/
/* GT1
---
start of code to generate a struct/record declaration
C type name is struct TYPENAME
Ada type name is struct_TYPENAME
*/
#define GT1(TYPENAME,WE_HAVE_IT)\
void g_struct_##TYPENAME(){\
int we_have_it = WE_HAVE_IT;\
struct TYPENAME DUMMY;\
char const typename [] = #TYPENAME;\
int typekind = STRUCT_TYPE;\
component_t comps [] = {\
/* GT1T
----
start of code to generate a struct/record declaration
C type name is TYPENAME
Ada type name is struct_TYPENAME
*/
#define GT1T(TYPENAME,WE_HAVE_IT)\
void g_##TYPENAME(){\
int we_have_it = WE_HAVE_IT;\
TYPENAME DUMMY;\
char const typename [] = #TYPENAME;\
int typekind = TYPEDEF_STRUCT_TYPE;\
component_t comps [] = {\
/* GT1R
---
start of code to generate a struct/record declaration for structs
that have a pointer to the struct type as a component.
C type name is struct TYPENAME
Ada type name is struct_TYPENAME
*/
#define GT1R(TYPENAME,WE_HAVE_IT)\
void g_struct_##TYPENAME(){\
int we_have_it = WE_HAVE_IT;\
struct TYPENAME DUMMY;\
char const typename [] = #TYPENAME;\
int typekind = RECURSIVE_STRUCT_TYPE;\
component_t comps [] = {\
/* GT2
---
component of struct/record type, non-aliased
component name is COMPNAME
component C type is CMPTYP
function ada_type_name maps C type name to Ada
*/
#define GT2(COMPNAME,CMPTYP)\
#COMPNAME, #CMPTYP, sizeof(CMPTYP),\
((char *)&DUMMY.COMPNAME - (char *)&DUMMY), 0,
/* GT2_XPND_ARGS
--------
As GT2, but expands any macros passed as arguments.
*/
#define GT2_XPND_ARGS(COMPNAME,CMPTYP)\
GT2(COMPNAME,CMPTYP)
/* GT2A
----
variant of GT2, for component that is an array
the component C type is CMPTYP
which is an array with components of type CMPCMPTYP
N is the number of components
*/
#define GT2A(COMPNAME,CMPTYP,CMPCMPTYP,N)\
#COMPNAME, #CMPTYP, sizeof(CMPCMPTYP)*N,\
((char *)&DUMMY.COMPNAME - (char *)&DUMMY), 0,
/* GT2V
----
variant of GT2, for component that is volatile
*/
#define GT2V(COMPNAME,CMPTYP)\
#COMPNAME, #CMPTYP, sizeof(CMPTYP),\
((char *)&DUMMY.COMPNAME - (char *)&DUMMY), 1,
/* GT2P
----
variant of GT2, for component that is a pointer
to a function
component name is COMPNAME
component C type name is CMPTYP
function ada_type_name maps C type name to Ada
*/
void (*DUMMYFPTR) ();
#define GT2P(COMPNAME,CMPTYP)\
#COMPNAME, #CMPTYP, sizeof(DUMMYFPTR),\
((char *)&DUMMY.COMPNAME - (char *)&DUMMY), 0,
/* GT3
---
end of struct/record component list
*/
#define GT3\
0, 0, 0, 0, 0};\
if (! we_have_it) {\
ifprintf(fp," -- *** MISSING: %s *** --\n", typename);\
warn("missing struct type",typename);}\
save_type(typename, sizeof(DUMMY), typekind, comps);\
print_type_declaration(typename,fp);}
/* gen_unchckd_conv
----------------
generate an unchecked conversion FUNC from FROM to TO.
*/
#define gen_unchckd_conv(FUNC,FROM,TO)\
ifprintf(fp, " function %s is new Unchecked_Conversion (%s, %s);\n",\
FUNC, FROM, TO);
/* gen_renaming
------------
generate a renaming ALIAS for ENT.
*/
#define gen_renaming(ALIAS,ENT)\
ifprintf(fp, " %s renames %s;\n", ALIAS, ENT);
/* other macros
------------
*/
#ifdef ENOSYS
#else
#define ENOSYS -1
#endif
#define DEFAULTSIZE (sizeof(int)*bits_per_byte)
/* the number of bits in the dummy type that is used
to stand in for an unsupported type
*/
#define XTI_ERROR_FIRST 10000
#define XTI_ERROR_LAST 19999
#define EAI_ERROR_FIRST 20000
#define EAI_ERROR_LAST 29999
/* offsets applied to error codes from t_errno
(T_xxxx) and codes from addrinfo (EAI_xxxxx).
*/
/* type declarations
=================
*/
/* We build a linked list structure to keep track of
of information about POSIX types
for which we might want to generate some output, either to the
configuration files, or to an Ada package specification.
*/
typedef struct component {
char * compname; /* name of component */
char * typename; /* definition of component type */
int size; /* sizeof (typename) */
int offset; /* offset of component, in bytes */
int is_volatile; /* 0 = nonvolatile, 1 = volatile */
} component_t;
/* describes a record component */
/* type kinds */
#define SIGNED_INTEGER_TYPE 1
#define UNSIGNED_INTEGER_TYPE 2
#define STRUCT_TYPE 3
#define TYPEDEF_STRUCT_TYPE 4
#define OPAQUE_TYPE 5
#define CHAR_ARRAY_TYPE 6
#define RECURSIVE_STRUCT_TYPE 7 /* BLH */
/* .... may need to also define a case for union types
.... may not need to distinquish struct from typedef */
typedef struct type {
char *typename;
int typesize;
int typekind;
int is_printed;
component_t *comps;
struct type *next;
} type_t;
/* describes a type */
type_t *all_type_list = NULL;
type_t **all_type_tail = &all_type_list;
/* subprograms
===========
*/
void warn(const char msg1[], const char msg2[]);
void quit(const char msg1[], const char msg2[]);
void save_type
(char const name[],
int typesize,
int typekind,
component_t *comps);
void print_type_declaration(char const name[], FILE *fp);
void gieeeheader(const char pkgname[]);
void gspecheader(const char pkgname[]);
void print_ada_type (char const typename[]);
int wordsize(int n);
void gbrg(char name[], char lb[], char ub[]);
void gsitp(char name[], int size);
void gdflsitp(char name[]);
void guitp(char name[], int size);
void gdfluitp(char name[]);
void gptp(char name[], int size);
void gptrtp(char const ptrname[], char const desname[]);
void gdflptp(char name[]);
void gfunc(char const name[], char const xname[], int have_it);
void gfuncd(char const name[], char const xname[], int have_it);
void gmaxi(char const name[], int lower_bound);
void gmaxii(char const name[], int lower_bound);
void gmaxn(char const name[], int lower_bound);
void gmaxnn(char const name[], int lower_bound);
void gpmaxn(char const name[], int value);
void gpmaxr(char const name[], char const oname[]);
void grename(char const name[], char const oname[]);
void create_options();
void create_limits();
void create_posix();
void create_c();
/* variables
=========
*/
int bits_per_byte = 0;
/* the number of bits in a byte,
used for converting C "sizeof" return values
to Ada 'size values
*/
char error_message[128];
/* a temporary buffer for building error messages
It is global because we want to be able to return
a pointer to it from inside a function.
*/
FILE *fp; /* current output file */
int network_byte_order;
/* 1 means we have network order locally, and so don't
need reordering
*/
/* Table of name to link name mappings
-----------------------------------
The following table enumerates mappings to make from name to
link name. */
char *name_to_linkname_table[] = {
/* The following are variadic functions, so we call them via a
wrapper in posix-macros.c. */
"open", "__gnat_florist_open",
"sem_open", "__gnat_florist_sem_open",
/* The following are implemented as macros on some platforms, so we
call them via a wrapper in posix-macros.c. */
"stat", "__gnat_florist_stat",
"fstat", "__gnat_florist_fstat",
"lstat", "__gnat_florist_lstat",
/* The following is implemented as an inline function on some platforms */
"uname", "__gnat_florist_uname",
#if (_FILE_OFFSET_BITS == 64) && !defined(__LP64__)
/* For a 32-bit system with large file support, force linking against
64-bit functions. */
"readdir", "readdir64",
"readdir_r", "readdir64_r",
"lseek", "lseek64",
"ftruncate", "ftruncate64",
/* Note: we already have C wrappers for stat/fstat/lstat so they do not
need to be listed here. */
#elif __DARWIN_64_BIT_INO_T && !__DARWIN_ONLY_64_BIT_INO_T
/* On Darwin some symbols are versioned to account for optional 64-bit
inode numbers. */
"readdir", "readdir" __DARWIN_SUF_64_BIT_INO_T,
"readdir_r", "readdir_r" __DARWIN_SUF_64_BIT_INO_T,
#endif
NULL
};
/* Map a name to a linkname. */
const char *n2ln (const char *name) {
char **i = name_to_linkname_table;
while (*i) {
if (strcmp (name, *i) == 0)
return *(i + 1);
i += 2;
}
return name;
}
/* declarations for C types
------------------------
If you make any changes here, also make changes
where Ada types are put out, below. (***)
*/
/* the following are required by the C language standard
*/
void g_size_t(){
gsitp("size_t", sizeof(size_t));
gptrtp("size_t", "size_t");
}
void g_time_t(){
gsitp("time_t", sizeof(time_t));
gptrtp("time_t", "time_t");
}
void g_clock_t(){
guitp("clock_t", sizeof(clock_t));
gptrtp("clock_t", "clock_t");
}
/* no sense configuring to do without the following types,
since they are too basic
*/
void g_off_t(){gsitp("off_t", sizeof(off_t));}
void g_pid_t(){gsitp("pid_t", sizeof(pid_t));}
void g_gid_t(){guitp("gid_t", sizeof(gid_t));}
void g_uid_t(){guitp("uid_t", sizeof(uid_t));}
void g_mode_t(){guitp("mode_t", sizeof(mode_t));}
void g_ssize_t(){gsitp("ssize_t", sizeof(ssize_t));}
#ifdef HAVE_DIRENT_H
void g_DIR(){DIR * x; gptp("DIR", sizeof(x));}
#else
void g_DIR(){gdflptp("DIR");}
#endif
#ifdef HAVE_ino_t
void g_ino_t(){guitp("ino_t",sizeof(ino_t));}
#else
void g_ino_t(){gdfluitp("ino_t");}
#endif
#ifdef HAVE_dev_t
void g_dev_t(){guitp("dev_t", sizeof(dev_t));}
#else
void g_dev_t(){gdfluitp("dev_t");}
#endif
#ifdef HAVE_nlink_t
void g_nlink_t(){guitp("nlink_t", sizeof(nlink_t));}
#else
void g_nlink_t(){gdfluitp("nlink_t");}
#endif
#ifdef HAVE_blksize_t
void g_blksize_t(){guitp("blksize_t", sizeof(blksize_t));}
#else
void g_blksize_t(){gdfluitp("blksize_t");}
#endif
#ifdef HAVE_blkcnt_t
void g_blkcnt_t(){guitp("blkcnt_t", sizeof(blkcnt_t));}
#else
void g_blkcnt_t(){gdfluitp("blkcnt_t");}
#endif
#ifdef HAVE_cc_t
void g_cc_t(){guitp("cc_t", sizeof(cc_t));}
#else
void g_cc_t(){gdfluitp("cc_t");}
#endif
#ifdef HAVE_tcflag_t
void g_tcflag_t(){guitp("tcflag_t", sizeof(tcflag_t));}
#else
void g_tcflag_t(){gdfluitp("tcflag_t");}
#endif
#ifdef HAVE_clockid_t
void g_clockid_t(){gsitp("clockid_t", sizeof(clockid_t));}
#else
void g_clockid_t(){gdflsitp("clockid_t");}
#endif
#ifdef HAVE_mqd_t
void g_mqd_t(){gsitp("mqd_t", sizeof(mqd_t));}
#else
/* mqd_t must be signed, since the value -1 is used for error return
*/
void g_mqd_t(){gdflsitp("mqd_t");}
#endif
#ifdef HAVE_fd_set
void g_fd_set(){gptp("fd_set", sizeof(fd_set));}
#else
void g_fd_set(){gdflptp("fd_set");}
#endif
#ifdef HAVE_pthread_attr_t
void g_pthread_attr_t(){gptp("pthread_attr_t", sizeof(pthread_attr_t));}
#else
void g_pthread_attr_t(){gdflptp("pthread_attr_t");}
#endif
#ifdef HAVE_pthread_cond_t
void g_pthread_cond_t(){gptp("pthread_cond_t", sizeof(pthread_cond_t));}
#else
void g_pthread_cond_t(){gdflptp("pthread_cond_t");}
#endif
#ifdef HAVE_pthread_condattr_t
void g_pthread_condattr_t()
{gptp("pthread_condattr_t", sizeof(pthread_condattr_t));}
#else
void g_pthread_condattr_t(){gdflptp("pthread_condattr_t");}
#endif
#ifdef HAVE_pthread_key_t
void g_pthread_key_t(){gptp("pthread_key_t", sizeof(pthread_key_t));}
#else
void g_pthread_key_t(){gdflptp("pthread_key_t");}
#endif
#ifdef HAVE_pthread_mutex_t
void g_pthread_mutex_t(){gptp("pthread_mutex_t", sizeof(pthread_mutex_t));}
#else
void g_pthread_mutex_t(){gdflptp("pthread_mutex_t");}
#endif
#ifdef HAVE_pthread_mutexattr_t
void g_pthread_mutexattr_t()
{gptp("pthread_mutexattr_t", sizeof(pthread_mutexattr_t));}
#else
void g_pthread_mutexattr_t(){gdflptp("pthread_mutexattr_t");}
#endif
#ifdef HAVE_pthread_once_t
void g_pthread_once_t(){gptp("pthread_once_t", sizeof(pthread_once_t));}
#else
void g_pthread_once_t(){gdflptp("pthread_once_t");}
#endif
#ifdef HAVE_pthread_t
void g_pthread_t(){gptp("pthread_t", sizeof(pthread_t));}
#else
void g_pthread_t(){gdflptp("pthread_t");}
#endif
#ifdef HAVE_sem_t
void g_sem_t(){gptp("sem_t", sizeof(sem_t));}
#else
void g_sem_t(){gdflptp("sem_t");}
#endif
#ifdef HAVE_sigset_t
void g_sigset_t(){gptp("sigset_t", sizeof(sigset_t));}
#else
void g_sigset_t(){gdflptp("sigset_t");}
#endif
#ifdef HAVE_speed_t
void g_speed_t(){guitp("speed_t", sizeof(speed_t));}
#else
void g_speed_t(){gdfluitp("speed_t");}
#endif
#ifdef HAVE_socklen_t
void g_socklen_t(){guitp("socklen_t", sizeof(socklen_t));}
#else
void g_socklen_t(){gdfluitp("socklen_t");}
#endif
#ifdef HAVE_timer_t
void g_timer_t(){guitp("timer_t", sizeof(timer_t));}
#else
void g_timer_t(){gdfluitp("timer_t");}
#endif
/* sigval must precede siginfo_t and struct sigevent
*/
#ifdef HAVE_sigval
#else
union sigval {
int sival_int;
void *sival_ptr;
};
#endif
void g_sigval(){
#if defined(__hpux__) && defined(__ia64__)
/* The definition of sigval on HP-UX for IA64 requires special
treatment because the layout of the C type is unusual. */
ifprintf(fp," type Sigval_Int_Part is record\n");
ifprintf(fp," sival_int : int;\n");
ifprintf(fp," end record;\n");
ifprintf(fp," for Sigval_Int_Part use record\n");
ifprintf(fp," sival_int at 12 range 0 .. 31;\n");
ifprintf(fp," end record;\n");
ifprintf(fp," type Sigval_Ptr_Part is record\n");
ifprintf(fp," sival_ptr : System.Address;\n");
ifprintf(fp," end record;\n");
ifprintf(fp," for Sigval_Ptr_Part use record\n");
ifprintf(fp," sival_ptr at 8 range 0 .. 63;\n");
ifprintf(fp," end record;\n");
ifprintf(fp," type sigval (Dummy : Boolean := True) is record\n");
ifprintf(fp," case Dummy is\n");
ifprintf(fp," when True => Int_Part : Sigval_Int_Part;\n");
ifprintf(fp," when False => Ptr_Part : Sigval_Ptr_Part;\n");
ifprintf(fp," end case;\n");
ifprintf(fp," end record;\n");
ifprintf(fp," pragma Unchecked_Union (sigval);\n");
ifprintf(fp," null_sigval : constant sigval :=\n");
ifprintf(fp," (Dummy => False, Ptr_Part => (sival_ptr ");
ifprintf(fp,"=> System.Null_Address));\n");
#else
ifprintf(fp," type sigval (Dummy : Boolean := True) is record\n");
ifprintf(fp," case Dummy is\n");
ifprintf(fp," when True => sival_int : int;\n");
ifprintf(fp," when False => sival_ptr : System.Address;\n");
ifprintf(fp," end case;\n");
ifprintf(fp," end record;\n");
ifprintf(fp," pragma Unchecked_Union (sigval);\n");
ifprintf(fp," null_sigval : constant sigval :=\n");
ifprintf(fp," (Dummy => False, sival_ptr ");
ifprintf(fp,"=> System.Null_Address);\n");
#endif
ifprintf(fp," sigval_byte_size : constant := %d;\n",
sizeof (union sigval));
ifprintf(fp," sigval_alignment : constant := ALIGNMENT;\n");
}
/* siginfo_t must precede sigaction
*/
#ifdef HAVE_siginfo_t
GT1T(siginfo_t, 1)
#else
typedef struct siginfo {
int si_signo;
int si_code;
union sigval si_value;
} siginfo_t;
GT1T(siginfo_t, 0)
#endif
GT2(si_signo, int)
GT2(si_code, int)
GT2(si_value, union sigval)
GT3
/* sigevent must precede aiocb
*/
#ifdef HAVE_struct_sigevent
GT1(sigevent, 1)
#else
struct sigevent {
int sigev_notify;
int sigev_signo;
union sigval sigev_value;
/* void (*)(union sigval) sigev_notify_function; */
int sigev_notify_function;
/* (pthread_attr_t *) sigev_notify_attributes; */
int sigev_notify_attributes;
};
GT1(sigevent, 0)
#endif
GT2(sigev_notify,int)
GT2(sigev_signo,int)
GT2(sigev_value,union sigval)
#ifdef HAVE_component_sigev_notify_function
GT2(sigev_notify_function, void (*)(union sigval))
GT2(sigev_notify_attributes,pthread_attr_t *)
#endif
GT3
#ifdef HAVE_struct_aiocb
GT1(aiocb, 1)
#else
struct aiocb {
int aio_fildes;
off_t aio_offset;
volatile void * aio_buf;
size_t aio_nbytes;
int aio_reqprio;
struct sigevent aio_sigevent;
int aio_lio_opcode;
};
GT1(aiocb, 0)
#endif
GT2(aio_fildes, int)
GT2(aio_offset, off_t)
GT2V(aio_buf, volatile void *)
GT2(aio_nbytes, size_t)
GT2(aio_reqprio, int)
GT2(aio_sigevent, struct sigevent)
GT2(aio_lio_opcode, int)
GT3
#ifdef HAVE_struct_dirent
GT1(dirent, 1)
#else
struct dirent {
char d_name[1];
};
GT1(dirent, 0)
#endif
GT2A(d_name, POSIX_String (1 .. 1), char, 1)
GT3
#ifdef HAVE_struct_flock
GT1(flock, 1)
#else
struct flock {
short l_type;
short l_whence;
off_t l_start;
off_t l_len;
pid_t l_pid;
};
GT1(flock, 0)
#endif
GT2(l_type, short)
GT2(l_whence, short)
GT2(l_start, off_t)
GT2(l_len, off_t)
GT2(l_pid, pid_t)
GT3
#ifdef HAVE_struct_group
GT1(group, 1)
#else
struct group {
char * gr_name;
gid_t gr_gid;
char ** gr_mem;
};
GT1(group, 0)
#endif
GT2(gr_name, char *)
GT2(gr_gid, gid_t)
GT2(gr_mem, char **)
GT3
#ifdef HAVE_struct_mq_attr
GT1(mq_attr, 1)
#else
struct mq_attr {
long mq_flags;
long mq_maxmsg;
long mq_msgsize;
long mq_curmsgs;
};
GT1(mq_attr, 0)
#endif
GT2(mq_flags, long)
GT2(mq_maxmsg, long)
GT2(mq_msgsize, long)
GT2(mq_curmsgs, long)
GT3
#ifdef HAVE_struct_passwd
GT1(passwd, 1)
#else
struct passwd {
char * pw_name;
uid_t pw_uid;
gid_t pw_gid;
char * pw_dir;
char * pw_shell;
};
GT1(passwd, 0)
#endif
GT2(pw_name, char *)
GT2(pw_uid, uid_t)
GT2(pw_gid, gid_t)
GT2(pw_dir, char *)
GT2(pw_shell, char *)
GT3
#if defined(HAVE_struct_sigaction) || defined(HAVE_struct_cma_sigaction)
GT1(sigaction, 1)
#else
struct sigaction {
void (*sa_handler)();
sigset_t sa_mask;
int sa_flags;
void (*sa_sigaction)(int,siginfo_t *, void *);
};
GT1(sigaction, 0)
#endif
GT2P(sa_handler, System.Address)
GT2(sa_mask, sigset_t)
GT2(sa_flags, int)
#ifdef HAVE_component_sa_sigaction
GT2P(sa_sigaction, System.Address)
#else
#endif
GT3
/* ....how to put message if a component, like
sa_sigaction, if it is missing? consider putting a
mark in the component descriptor.
*/
/* ....check P1003.1c to see what is the correct component name
Provenzano uses "prio". We had "sched_priority".
*/
#ifdef HAVE_struct_sched_param
GT1(sched_param, 1)
#else
struct sched_param {
int sched_priority;
};
GT1(sched_param, 0)
#endif
GT2(sched_priority, int)
GT3
#ifdef HAVE_struct_stat
GT1(stat, 1)
#else
struct stat {
mode_t st_mode;
ino_t st_ino;
dev_t st_dev;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
off_t st_size;
blksize_t st_blksize;
blkcnt_t st_blocks;
time_t st_atime;
time_t st_mtime;
time_t st_ctime;
};
GT1(stat, 0)
#endif
GT2(st_mode, mode_t)
GT2(st_ino, ino_t)
GT2(st_dev, dev_t)
GT2(st_nlink, nlink_t)
GT2(st_uid, uid_t)
GT2(st_gid, gid_t)
GT2(st_size, off_t)
GT2(st_blksize, blksize_t)
GT2(st_blocks, blkcnt_t)
GT2(st_atime, time_t)
GT2(st_mtime, time_t)
GT2(st_ctime, time_t)
GT3
#ifdef HAVE_struct_termios
GT1(termios, 1)
#else
struct termios {
tcflag_t c_iflag;
tcflag_t c_oflag;
tcflag_t c_cflag;
tcflag_t c_lflag;
cc_t c_cc[1];
};
GT1(termios, 0)
#endif
GT2(c_iflag, tcflag_t)
GT2(c_oflag, tcflag_t)
GT2(c_cflag, tcflag_t)
GT2(c_lflag, tcflag_t)
GT2A(c_cc, cc_t_array, cc_t, NCCS)
GT3
#ifdef HAVE_suseconds_t
#else
#ifdef HAVE_struct_timeval
struct timeval struct_timeval_temp;
typedef __typeof__ (struct_timeval_temp.tv_usec) suseconds_t;
#else
typedef int suseconds_t;
#endif
#endif
#ifdef HAVE_struct_timeval
GT1(timeval, 1)
#else
struct timeval {
time_t tv_sec;
suseconds_t tv_usec;
};
GT1(timeval, 0)
#endif
GT2(tv_sec, time_t)
GT2(tv_usec, suseconds_t)
GT3
struct timeval struct_timeval_dummy;
void g_suseconds_t()
{gsitp("suseconds_t", sizeof(struct_timeval_dummy.tv_usec));}
#ifdef HAVE_struct_iovec
GT1(iovec, 1)
#else
struct iovec {
char * iov_base;
size_t iov_len;
};
GT1(iovec, 0)
#endif
GT2(iov_base, char *)
GT2(iov_len, size_t)
GT3
#ifdef HAVE_struct_timespec
GT1(timespec, 1)
#else
struct timespec {
time_t tv_sec;
long tv_nsec;
};
GT1(timespec, 0)
#endif
GT2(tv_sec,time_t)
GT2(tv_nsec,long)
GT3
#ifdef HAVE_struct_itimerspec
GT1(itimerspec, 1)
#else
struct itimerspec {
struct timespec it_interval;
struct timespec it_value;
};
GT1(itimerspec, 0)
#endif
GT2(it_interval, struct timespec)
GT2(it_value, struct timespec)
GT3
#ifdef HAVE_struct_tm
GT1(tm, 1)
#else
struct tm {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
};
GT1(tm, 0)
#endif
GT2(tm_sec,int)
GT2(tm_min,int)
GT2(tm_hour,int)
GT2(tm_mday,int)
GT2(tm_mon,int)
GT2(tm_year,int)
GT2(tm_wday,int)
GT2(tm_yday,int)
GT2(tm_isdst,int)
GT3
#ifdef HAVE_struct_tms
GT1(tms, 1)
#else
struct tms {
clock_t tms_utime;
clock_t tms_stime;
clock_t tms_cstime;
clock_t tms_cutime;
};
GT1(tms, 0)
#endif
GT2(tms_utime, clock_t)
GT2(tms_stime, clock_t)
GT2(tms_cutime, clock_t)
GT2(tms_cstime, clock_t)
GT3
#ifdef HAVE_struct_utimbuf
GT1(utimbuf, 1)
#else
struct utimbuf {
time_t modtime;
time_t actime;
};
GT1(utimbuf, 0)
#endif
GT2(modtime, time_t)
GT2(actime, time_t)
GT3
#ifdef HAVE_struct_utsname
GT1(utsname, 1)
#else
struct utsname {
char sysname [257];
char nodename [257];
char release [257];
char version [257];
char machine [257];
};
GT1(utsname, 0)
#endif
GT2A(sysname, utsname_sysname_string, char, sizeof(DUMMY.sysname))
GT2A(nodename, utsname_nodename_string, char, sizeof(DUMMY.nodename))
GT2A(release, utsname_release_string, char, sizeof(DUMMY.release))
GT2A(version, utsname_version_string, char, sizeof(DUMMY.version))
GT2A(machine, utsname_machine_string, char, sizeof(DUMMY.machine))
GT3
#ifdef HAVE_sa_family_t
#else
typedef unsigned short sa_family_t;
#endif
#ifdef HAVE_in_port_t
#else
typedef unsigned short in_port_t;
#endif
/* in_addr_t should be 4 bytes long
It is likely to be defined as int or long,
depending on the machine architecture.
We use char[4] here if the system does not
define an appropriate type.
*/
#ifdef HAVE_struct_in_addr
#ifdef HAVE_in_addr_t
#else
typedef char in_addr_t[4];
#endif
GT1(in_addr, 1)
#else
#ifdef HAVE_in_addr_t
#else
typedef char in_addr_t[4];
#endif
struct in_addr {
in_addr_t s_addr;
};
GT1(in_addr, 0)
#endif
GT2(s_addr, in_addr_t)
GT3
#ifdef HAVE_struct_sockaddr
GT1(sockaddr, 1)
#else
struct sockaddr {
sa_family_t sa_family;
char sa_data [14];
};
GT1(sockaddr, 0)
#endif
GT2(sa_family, sa_family_t)
GT2A(sa_data, POSIX_String (1 .. 14), char, sizeof (DUMMY.sa_data))
GT3
#ifdef HAVE_struct_sockaddr_un
GT1(sockaddr_un, 1)
#else
struct sockaddr_un {
sa_family_t sun_family;
char sun_path [100];
};
GT1(sockaddr_un, 0)
#endif
GT2(sun_family, sa_family_t)
GT2A(sun_path, sun_path_string, char, sizeof (DUMMY.sun_path))
GT3
#ifdef HAVE_struct_sockaddr_in
GT1(sockaddr_in, 1)
#else
struct sockaddr_in {
sa_family_t sin_family;
in_port_t sin_port;
struct in_addr sin_addr;
char sin_zero [8];
};
GT1(sockaddr_in, 0)
#endif
GT2(sin_family, sa_family_t)
GT2(sin_port, in_port_t)
GT2(sin_addr, struct in_addr)
GT2A(sin_zero, POSIX_String (1 .. 8), char, 8)
GT3
#ifdef HAVE_struct_linger
GT1(linger, 1)
#else
struct linger {
int l_onoff;
int l_linger;
};
GT1(linger, 0)
#endif
GT2(l_onoff, int)
GT2(l_linger, int)
GT3
#ifdef HAVE_struct_msghdr
GT1(msghdr, 1)
#else
struct msghdr {
struct sockaddr * msg_name;
size_t msg_namelen;
struct iovec * msg_iov;
size_t msg_iovlen;
#ifdef _BSD4_3_
caddr_t msg_accrights; /* access rights sent/received */
int msg_accrightslen;
#else
char * msg_control;
size_t msg_controllen;
int msg_flags;
#endif
};
GT1(msghdr, 0)
#endif
GT2(msg_name, struct sockaddr *)
GT2(msg_namelen, size_t)
GT2(msg_iov, struct iovec *)
GT2(msg_iovlen, size_t)
#ifdef _BSD4_3_
GT2(msg_accrights,caddr_t)
GT2(msg_accrightslen,int)
#else
#ifdef HAVE_component_msg_control
GT2(msg_control, char *)
#endif
#ifdef HAVE_component_msg_controllen
#if defined (__sparc__) && defined (__arch64__)
GT2(msg_controllen, int)
#else
#ifdef HAVE_socklen_t
GT2(msg_controllen, socklen_t)
#else
GT2(msg_controllen, size_t)
#endif
#endif
#endif
#ifdef HAVE_component_msg_flags
GT2(msg_flags, int)
#endif
#endif
GT3
#ifdef HAVE_struct_cmsghdr
GT1(cmsghdr, 1)
#else
struct cmsghdr {
int cmsg_level;
int cmsg_type;
size_t cmsg_len;
};
GT1(cmsghdr, 0)
#endif
GT2(cmsg_level, int)
GT2(cmsg_type, int)
#if (defined (__sparc__) && defined (__arch64__))
GT2(cmsg_len, int)
#elif HAVE_socklen_t
GT2(cmsg_len, socklen_t)
#else
GT2(cmsg_len, size_t)
#endif
GT3
#ifdef HAVE_struct_ip_opts
GT1(ip_opts, 1)
#else
struct ip_opts {
struct in_addr ip_dst;
char ip_opts[40];
};
GT1(ip_opts, 0)
#endif
GT2(ip_dst, struct in_addr)
GT2A(ip_opts, POSIX.Octet_Array (1 .. 40), char, 40)
GT3
#ifdef HAVE_struct_hostent
GT1(hostent, 1)
#else
struct hostent {
char * h_name;
char ** h_aliases;
int h_addrtype;
int h_length;
char ** h_addr_list;
};
GT1(hostent, 0)
#endif
GT2(h_name, char *)
GT2(h_aliases, char **)
GT2(h_addrtype, int)
GT2(h_length, int)
GT2(h_addr_list, char **)
GT3
#ifdef HAVE_struct_netent
GT1(netent, 1)
#else
struct netent {
char * n_name;
char ** n_aliases;
int n_addrtype;
unsigned long n_net;
};
GT1(netent, 0)
#endif
GT2(n_name, char *)
GT2(n_aliases, char **)
GT2(n_addrtype, int)
GT2(n_net, in_addr_t)
/* POSIX 1003.1g/D6.4 says n_net should be unsigned long,
but it should be 4 bytes and unsigned long might be longer
than that on some systems.
Solaris 2.6 uses in_addr_t, which seems safer.
*/
GT3
#ifdef HAVE_struct_protoent
GT1(protoent, 1)
#else
struct protoent {
char * p_name;
char ** p_aliases;
int p_proto;
};
GT1(protoent, 0)
#endif
GT2(p_name, char *)
GT2(p_aliases, char **)
GT2(p_proto, int)
GT3
#ifdef HAVE_struct_servent
GT1(servent, 1)
#else
struct servent {
char * s_name;
char ** s_aliases;
int s_port;
char * s_proto;
};
GT1(servent, 0)
#endif
GT2(s_name, char *)
GT2(s_aliases, char **)
GT2(s_port, int)
GT2(s_proto, char *)
GT3
/* BLH : Changed GT1 to GT1R to handle addrinfo pointer */
#ifdef HAVE_struct_addrinfo
GT1R(addrinfo, 1)
#else
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
struct sockaddr * ai_addr;
char * ai_canonname;
struct addrinfo * ai_next;
};
GT1R(addrinfo, 0)
#endif
GT2(ai_flags, int)
GT2(ai_family, int)
GT2(ai_socktype, int)
GT2(ai_protocol, int)
/* Workaround layout issue on Sparc64 version 10. */
#if defined (__solaris10__) && defined (__arch64__)
GT2(_ai_pad, int)
GT2(ai_addrlen, int)
#else
GT2(ai_addrlen, size_t)
#endif
GT2(ai_addr, struct sockaddr *)
GT2(ai_canonname, char *)
GT2(ai_next, struct addrinfo *)
GT3
/* XTI structs */
/* netbuf must precede all others
*/
#ifdef HAVE_struct_netbuf
GT1(netbuf,1)
#else
struct netbuf {
unsigned int maxlen;
unsigned int len;
char * buf;
};
GT1(netbuf,0)
#endif
GT2(maxlen, unsigned int)
GT2(len, unsigned int)
GT2(buf, char *)
GT3
/* t_info structure */
#ifndef XTI_TINFO_FTYPE
#define XTI_TINFO_FTYPE long
#endif
#ifdef HAVE_struct_t_info
GT1(t_info,1)
#else
struct t_info {
XTI_TINFO_FTYPE addr;
XTI_TINFO_FTYPE options;
XTI_TINFO_FTYPE tsdu;
XTI_TINFO_FTYPE etsdu;
XTI_TINFO_FTYPE connect;
XTI_TINFO_FTYPE discon;
XTI_TINFO_FTYPE servtype;
XTI_TINFO_FTYPE flags;
};
GT1(t_info,0)
#endif
GT2_XPND_ARGS(addr, XTI_TINFO_FTYPE)
GT2_XPND_ARGS(options, XTI_TINFO_FTYPE)
GT2_XPND_ARGS(tsdu, XTI_TINFO_FTYPE)
GT2_XPND_ARGS(etsdu, XTI_TINFO_FTYPE)
GT2_XPND_ARGS(connect, XTI_TINFO_FTYPE)
GT2_XPND_ARGS(discon, XTI_TINFO_FTYPE)
GT2_XPND_ARGS(servtype, XTI_TINFO_FTYPE)
#ifndef _TLI_ /* not xti compliant but usable */
GT2_XPND_ARGS(flags, XTI_TINFO_FTYPE)
#endif
GT3
/* t_opthdr structure */
#ifndef XTI_OPTHDR_FTYPE
#define XTI_OPTHDR_FTYPE unsigned long
#endif
#ifdef HAVE_struct_t_opthdr
GT1(t_opthdr,1)
#else
struct t_opthdr {
XTI_OPTHDR_FTYPE len;
XTI_OPTHDR_FTYPE level;
XTI_OPTHDR_FTYPE name;
XTI_OPTHDR_FTYPE status;
};
GT1(t_opthdr,0)
#endif
GT2_XPND_ARGS(len, XTI_OPTHDR_FTYPE)
GT2_XPND_ARGS(level, XTI_OPTHDR_FTYPE)
GT2_XPND_ARGS(name, XTI_OPTHDR_FTYPE)
GT2_XPND_ARGS(status, XTI_OPTHDR_FTYPE)
GT3
/* t_bind structure */
#ifdef HAVE_struct_t_bind
GT1(t_bind,1)
#else
struct t_bind {
struct netbuf addr;
unsigned qlen;
};
GT1(t_bind,0)
#endif
GT2(addr, struct netbuf)
GT2(qlen, unsigned)
GT3
/* t_optmgmt structure */
#ifdef HAVE_struct_t_optmgmt
GT1(t_optmgmt,1)
#else
struct t_optmgmt {
struct netbuf opt;
long flags;
};
GT1(t_optmgmt,0)
#endif
GT2(opt, struct netbuf)
GT2(flags, long)
GT3
/* t_discon structure */
#ifdef HAVE_struct_t_discon
GT1(t_discon,1)
#else
struct t_discon {
struct netbuf udata;
int reason;
int sequence;
};
GT1(t_discon,0)
#endif
GT2(udata, struct netbuf)
GT2(reason, int)
GT2(sequence, int)
GT3
/* t_call structure */
#ifdef HAVE_struct_t_call
GT1(t_call,1)
#else
struct t_call {
struct netbuf addr;
struct netbuf opt;
struct netbuf udata;
int sequence;
};
GT1(t_call, 0)
#endif
GT2(addr, struct netbuf)
GT2(opt, struct netbuf)
GT2(udata, struct netbuf)
GT2(sequence, int)
GT3
/* t_unitdata structure */
#ifdef HAVE_struct_t_unitdata
GT1(t_unitdata,1)
#else
struct t_unitdata {
struct netbuf addr;
struct netbuf opt;
struct netbuf udata;
};
GT1(t_unitdata,0)
#endif
GT2(addr, struct netbuf)
GT2(opt, struct netbuf)
GT2(udata, struct netbuf)
GT3
/* t_uderr structure */
#ifdef HAVE_struct_t_uderr
GT1(t_uderr,1)
#else
struct t_uderr {
struct netbuf addr;
struct netbuf opt;
long error;
};
GT1(t_uderr,0)
#endif
GT2(addr, struct netbuf)
GT2(opt, struct netbuf)
GT2(error, long)
GT3
/* Sturcture used with linger option */
#ifndef XTI_LINGER_FTYPE
#define XTI_LINGER_FTYPE long
#endif
#ifdef HAVE_struct_t_linger
GT1(t_linger,1)
#else
struct t_linger {
XTI_LINGER_FTYPE l_onoff;
XTI_LINGER_FTYPE l_linger;
};
GT1(t_linger,0)
#endif
GT2_XPND_ARGS(l_onoff, XTI_LINGER_FTYPE)
GT2_XPND_ARGS(l_linger, XTI_LINGER_FTYPE)
GT3
/* t_iovec structure */
#ifdef HAVE_struct_t_iovec
GT1(t_iovec,1)
#else
struct t_iovec {
char * iov_base;
unsigned int iov_len;
};
GT1(t_iovec,0)
#endif
GT2(iov_base, char *)
GT2(iov_len, unsigned int)
GT3
/* t_kpalive structure */
#ifndef XTI_KPALIVE_FTYPE
#define XTI_KPALIVE_FTYPE long
#endif
#ifdef HAVE_struct_t_kpalive
GT1(t_kpalive,1)
#else
struct t_kpalive {
XTI_KPALIVE_FTYPE kp_onoff;
XTI_KPALIVE_FTYPE kp_timeout;
};
GT1(t_kpalive,0)
#endif
GT2_XPND_ARGS(kp_onoff, XTI_KPALIVE_FTYPE)
GT2_XPND_ARGS(kp_timeout, XTI_KPALIVE_FTYPE)
GT3
/*
Poll/Select
*/
/* pollfd structure */
#ifdef HAVE_struct_pollfd
GT1(pollfd,1)
#else
struct pollfd {
int fd;
short events;
short revents;
};
GT1(pollfd,0)
#endif
GT2(fd, int)
GT2(events, short)
GT2(revents, short)
GT3
/* fd_set type
-----------
POSIX.1G does not require fd_set to be a (visible) struct
*/
#ifdef HAVE_fd_set
#else
typedef struct fd_set {
unsigned int fds_bits[32];
} fd_set;
#endif
/* warn
----
*/
void warn(const char msg1[], const char msg2[]) {
fprintf(stderr,"%s: %s\n",msg1,msg2);
}
/* quit
----
*/
void quit(const char msg1[], const char msg2[]) {
warn(msg1, msg2);
exit(-1);
}
/* save_type
---------
make a permanent copy of the information about a type with
components, linked into a list on all_type_list,
and return a pointer to the new node.
*/
void save_type
(char const name[],
int typesize,
int typekind,
component_t *comps) {
type_t *tmp;
int count;
component_t *p;
tmp = all_type_list;
for (tmp=all_type_list;
tmp && strcmp(tmp->typename,name);
tmp=tmp->next);
if (tmp) quit("DUPLICATE TYPE DEFINITION",name);
tmp = malloc(sizeof(type_t));
tmp->typekind = typekind;
tmp->is_printed = 0;
count = strlen(name);
tmp->typename = malloc(count+1);
memcpy(tmp->typename,name,count+1);
tmp->typesize = typesize;
count = 0;
if (comps) {
for (p=comps;p->compname;p++) {
/* Normalize component names by stripping out leading underscores. */
while (p -> compname [0] == '_') p -> compname++;
count++;
}
tmp->comps = malloc((count+1)*sizeof(component_t));
memcpy(tmp->comps,comps,(count+1)*sizeof(component_t));
}
tmp->next = NULL;
*all_type_tail = tmp;
all_type_tail = &tmp->next;
}
/* print_type_declaration
----------------------
print out Ada type declaration for C type
with specified name
*/
void print_type_declaration(char const name[], FILE *fp) {
type_t * type;
component_t const * p;
char extended_name[128];
type = all_type_list;
for (type=all_type_list;
type && strcmp(type->typename,name);
type=type->next);
if (type == NULL) {
NON_SUPPORT_MESSAGE(name);
return;
}
if (type->is_printed) ("TYPE ALREADY DECLARED",name);
if (type->typekind == STRUCT_TYPE ||
type->typekind == RECURSIVE_STRUCT_TYPE) {
if (strlen(type->typename)>=sizeof(extended_name)) {
quit("type name too long",type->typename);
}
strcpy(extended_name,"struct_");
strcat(extended_name,type->typename);
} else {
if (strlen(type->typename)>=sizeof(extended_name)) {
quit("type name too long",type->typename);
}
strcpy(extended_name,type->typename);
}
switch (type->typekind) {
case SIGNED_INTEGER_TYPE:
ifprintf(fp," type %s is range -2**%d .. (2**%d) - 1;\n",
type->typename,
type->typesize*bits_per_byte-1,
type->typesize*bits_per_byte-1);
ifprintf(fp," for %s'Size use %d;\n",
extended_name, type->typesize*bits_per_byte);
break;
case UNSIGNED_INTEGER_TYPE:
ifprintf(fp," type %s is mod 2**%d;\n",
type->typename,
type->typesize*bits_per_byte);
ifprintf(fp," for %s'Size use %d;\n",
extended_name, type->typesize*bits_per_byte);
break;
case STRUCT_TYPE:
case TYPEDEF_STRUCT_TYPE:
{ component_t * p;
int prev_offset = -1;
ifprintf(fp," type %s is record\n", extended_name);
for (p = type->comps; p && p->typename; p++) {
ifprintf(fp," %s : ", p->compname);
print_ada_type(p->typename);
fprintf(fp,";\n");
if (p->is_volatile) ifprintf(fp," pragma Volatile (%s);\n",
p->compname);
}
ifprintf(fp," end record;\n");
ifprintf(fp," for %s use record\n", extended_name);
for (p = type->comps; p && p->compname; p++) {
/* GNAT isn't able to handle overlapping components, so we add a simple
minded test to prevent the most common cases */
if (p->offset == prev_offset)
ifprintf(fp," -- *** OVERLAPPING component ***\n"
" -- %s at %d range 0 .. %d;\n", p->compname,
p->offset, p->size*bits_per_byte-1);
else
ifprintf(fp," %s at %d range 0 .. %d;\n", p->compname,
p->offset, p->size*bits_per_byte-1);
prev_offset = p->offset;
}
ifprintf(fp," end record;\n");
ifprintf(fp," pragma Convention (C_Pass_By_Copy, %s);\n", extended_name);
ifprintf(fp," for %s'Alignment use ALIGNMENT;\n", extended_name);
ifprintf(fp," pragma Warnings (Off);\n");
ifprintf(fp," -- There may be holes in the record, due to\n");
ifprintf(fp," -- components not defined by POSIX standard.\n");
ifprintf(fp," for %s'Size use %d;\n",
extended_name, type->typesize*bits_per_byte);
ifprintf(fp," pragma Warnings (On);\n");
gptrtp(type->typename, extended_name);
break;
}
case RECURSIVE_STRUCT_TYPE: /* BLH */
{ component_t * p;
int prev_offset = -1;
ifprintf(fp," type %s;\n", extended_name);
gptrtp(type->typename, extended_name);
ifprintf(fp," type %s is record\n", extended_name);
for (p = type->comps; p && p->typename; p++) {
ifprintf(fp," %s : ", p->compname);
print_ada_type(p->typename);
fprintf(fp,";\n");
if (p->is_volatile) ifprintf(fp," pragma Volatile (%s);\n",
p->compname);
}
ifprintf(fp," end record;\n");
ifprintf(fp," for %s use record\n", extended_name);
for (p = type->comps; p && p->compname; p++) {
/* GNAT isn't able to handle overlapping components, so we add a simple
minded test to prevent the most common cases */
if (p->offset == prev_offset)
ifprintf(fp," -- *** OVERLAPPING component ***\n"
" -- %s at %d range 0 .. %d;\n", p->compname,
p->offset, p->size*bits_per_byte-1);
else
ifprintf(fp," %s at %d range 0 .. %d;\n", p->compname,
p->offset, p->size*bits_per_byte-1);
prev_offset = p->offset;
}
ifprintf(fp," end record;\n");
ifprintf(fp," pragma Convention (C_Pass_By_Copy, %s);\n", extended_name);
ifprintf(fp," for %s'Alignment use ALIGNMENT;\n", extended_name);
ifprintf(fp," pragma Warnings (Off);\n");
ifprintf(fp," -- There may be holes in the record, due to\n");
ifprintf(fp," -- components not defined by POSIX standard.\n");
ifprintf(fp," for %s'Size use %d;\n",
extended_name, type->typesize*bits_per_byte);
ifprintf(fp," pragma Warnings (On);\n");
break;
}
case CHAR_ARRAY_TYPE:
ifprintf(fp," type %s is\n", extended_name);
ifprintf(fp," array (1 .. %d) of char;\n", type->typesize);
ifprintf(fp," for %s'Alignment use ALIGNMENT;\n", type->typename);
gptrtp(type->typename,extended_name);
break;
case OPAQUE_TYPE:
ifprintf(fp," type %s is\n", extended_name);
ifprintf(fp," array (1 .. %d) of int;\n", wordsize(type->typesize));
ifprintf(fp," for %s'Alignment use ALIGNMENT;\n", type->typename);
ifprintf(fp," for %s'Size use %d;\n",
extended_name, type->typesize*bits_per_byte);
gptrtp(type->typename,extended_name);
break;
default:
break;
}
}
#define IEEE_Header 1
#define FSU_Header 2
#define LMCo_Header 3
/* gheader
-------
generate standard copyright header for automatically generated
POSIX Ada binding package specification with name *pkgname
*/
void gheader(const char pkgname[], int header_kind) {
int i;
int namelen = strlen(pkgname);
fprintf(fp,"-- DO NOT EDIT THIS FILE.\n");
fprintf(fp,"-- It is generated automatically, by program c-posix.c");
fprintf(fp,"\n");
fprintf(fp,"----------------------------------------");
fprintf(fp,"--------------------------------------\n");
fprintf(fp,"-- ");
fprintf(fp," --\n");
if ((header_kind == FSU_Header || header_kind == LMCo_Header)) {
fprintf(fp,"-- FLORIST (FSU Implementatio");
fprintf(fp,"n of POSIX.5) COMPONENTS --\n");
} else {
fprintf(fp,"-- POSIX Ada95 Bindings for Protocol I");
fprintf(fp,"ndependent Interfaces (P1003.5c) --\n");
}
fprintf(fp,"-- ");
fprintf(fp," --\n");
fprintf(fp,"--");
for (i = 1; i<38-namelen; i++) fprintf(fp," ");
for (i = 0; i<namelen; i++) fprintf(fp," %c", toupper (pkgname[i]));
for (i = 1; i<38-namelen; i++) fprintf(fp," ");
fprintf(fp,"--\n");
fprintf(fp,"-- ");
fprintf(fp," --\n");
fprintf(fp,"-- S p");
fprintf(fp," e c --\n");
fprintf(fp,"-- ");
fprintf(fp," --\n");
fprintf(fp,"-- ");
fprintf(fp," --\n");
if (header_kind == FSU_Header) {
fprintf(fp,"-- Copyright (c) 1996, 1997 Florida S");
fprintf(fp,"tate University (FSU), --\n");
fprintf(fp,"-- All Rights Reserved. ");
fprintf(fp," --\n");
} else if (header_kind == LMCo_Header) {
fprintf(fp,"-- Copyright (c) 1997 Lockheed Martin\n");
fprintf(fp," Corporation, All Rights Reserved. --\n");
fprintf(fp,"-- Modifications copyright(c) 1997 Flor");
fprintf(fp,"ida State University (FSU), --\n");
fprintf(fp,"-- All Rights Reserved. ");
fprintf(fp," --\n");
}
fprintf(fp,"-- ");
fprintf(fp," --\n");
if ((header_kind == FSU_Header) ||
(header_kind == IEEE_Header)) {
fprintf(fp,"-- This file is a component of FLORI");
fprintf(fp,"ST, an Ada application program --\n");
fprintf(fp,"-- interface for operating system servi");
fprintf(fp,"ces for use with the GNAT compiler --\n");
fprintf(fp,"-- and the Gnu Ada Runtime Library ");
fprintf(fp,"(GNARL). FLORIST is intended to --\n");
fprintf(fp,"-- conform to the IEEE POSIX Ada standa");
fprintf(fp,"rds, 1003.5-1992 and 1003.5b-1993. --\n");
fprintf(fp,"-- It also includes support for Draft 1");
fprintf(fp," of IEEE Project 1003.5c. --\n");
} else {
fprintf(fp,"-- This file is part of an implementati");
fprintf(fp,"on of an Ada95 API for the sockets --\n");
fprintf(fp,"-- and network support services found i");
fprintf(fp,"n P1003.1g -- Protocol Independent --\n");
fprintf(fp,"-- Interfaces. It is integrated with t");
fprintf(fp,"he FSU Implementation of POSIX.5b --\n");
fprintf(fp,"-- (FLORIST), an Ada API for POSIX OS ");
fprintf(fp,"services for use with the GNAT Ada --\n");
fprintf(fp,"-- compiler and the FSU Gnu Ada Runtime");
fprintf(fp," Library (GNARL). The interface is --\n");
fprintf(fp,"-- intended to be close to those specif");
fprintf(fp,"ied in IEEE STD 1003.5: 1990, IEEE --\n");
fprintf(fp,"-- STD 1003.5b: 1996, and IEEE Draft ST");
fprintf(fp,"D 1003.5c: 1997. --\n");
}
fprintf(fp,"-- ");
fprintf(fp," --\n");
if (header_kind == IEEE_Header) {
fprintf(fp,"-- This package specification contains ");
fprintf(fp,"some text extracted from IEEE STD --\n");
fprintf(fp,"-- 1003.5: 1990, Information Technology");
fprintf(fp," -- POSIX Ada Language Interfaces --\n");
fprintf(fp,"-- Part 1: Binding for System Applica");
fprintf(fp,"tion Program Interface, as amended --\n");
fprintf(fp,"-- by IEEE STD 1003.5b: 1996, Amendment");
fprintf(fp," 1: Realtime Extensions, copyright --\n");
fprintf(fp,"-- 1996 by the Institute of Electrical ");
fprintf(fp,"and Electronics Engineers, Inc. --\n");
fprintf(fp,"-- ");
fprintf(fp," --\n");
fprintf(fp,"-- The package specifications in the IE");
fprintf(fp,"EE standards cited above represent --\n");
fprintf(fp,"-- only a portion of the documents ");
fprintf(fp," and are not to be interpreteted --\n");
fprintf(fp,"-- outside the context of the documen");
fprintf(fp,"ts. The standards must be used in --\n");
fprintf(fp,"-- conjunction with the package sp");
fprintf(fp,"ecifications in order to claim --\n");
fprintf(fp,"-- conformance. The IEEE takes no res");
fprintf(fp,"ponsibility for and will assume no --\n");
fprintf(fp,"-- liability for damages resulting from");
fprintf(fp," the reader's misinterpretation of --\n");
fprintf(fp,"-- said information resulting from its");
fprintf(fp," out-of-context nature. To order --\n");
fprintf(fp,"-- copies of the IEEE standards, pleas");
fprintf(fp,"e contact the IEEE Service Center --\n");
fprintf(fp,"-- at 445 Hoes Lane, PO Box 1331, Pisca");
fprintf(fp,"taway, NJ 08855-1331; via phone at --\n");
fprintf(fp,"-- 1-800-678-IEEE, 908-981-1393; or via");
fprintf(fp," fax at 908-981-9667. --\n");
fprintf(fp,"-- ");
fprintf(fp," --\n");
fprintf(fp,"-- These package specifications are ");
fprintf(fp,"distributed in the hope that they --\n");
fprintf(fp,"-- will be useful, but WITHOUT ANY ");
fprintf(fp,"WARRANTY; without even the implied --\n");
fprintf(fp,"-- warranty of MERCHANTABILITY or FITNE");
fprintf(fp,"SS FOR A PARTICULAR PURPOSE. --\n");
} else {
fprintf(fp,"-- This is free software; you can redi");
fprintf(fp,"stribute it and/or modify it under --\n");
fprintf(fp,"-- terms of the GNU General Public ");
fprintf(fp,"License as published by the Free --\n");
fprintf(fp,"-- Software Foundation; either version");
fprintf(fp," 2, or (at your option) any later --\n");
fprintf(fp,"-- version. This software is distribut");
fprintf(fp,"ed in the hope that it will be --\n");
fprintf(fp,"-- useful, but WITHOUT ANY WARRANTY; w");
fprintf(fp,"ithout even the implied warranty --\n");
fprintf(fp,"-- of MERCHANTABILITY or FITNESS FOR A ");
fprintf(fp,"PARTICULAR PURPOSE. See the GNU --\n");
fprintf(fp,"-- General Public License for more deta");
fprintf(fp,"ils. You should have received a --\n");
fprintf(fp,"-- copy of the GNU General Public Licen");
fprintf(fp,"se distributed with GNARL; see --\n");
fprintf(fp,"-- file COPYING. If not, write to t");
fprintf(fp,"he Free Software Foundation, 59 --\n");
fprintf(fp,"-- Temple Place - Suite 330, Boston, MA");
fprintf(fp," 02111-1307, USA. --\n");
fprintf(fp,"-- ");
fprintf(fp," --\n");
fprintf(fp,"-- As a special exception, if other fil");
fprintf(fp,"es instantiate generics from this --\n");
fprintf(fp,"-- unit, or you link this unit with oth");
fprintf(fp,"er files to produce an executable, --\n");
fprintf(fp,"-- this unit does not by itself cause ");
fprintf(fp,"the resulting executable to be --\n");
fprintf(fp,"-- covered by the GNU General Publi");
fprintf(fp,"c License. This exception does not --\n");
fprintf(fp,"-- however invalidate any other reason");
fprintf(fp,"s why the executable file might be --\n");
fprintf(fp,"-- covered by the GNU Public License. ");
fprintf(fp," --\n");
}
fprintf(fp,"-- ");
fprintf(fp," --\n");
fprintf(fp,"----------------------------------------");
fprintf(fp,"--------------------------------------\n");
}
/* print_ada_type
--------------
print out short name of Ada type for given C type
*/
void print_ada_type (char const typename[]) {
if (!strcmp (typename, "char *")) fprintf(fp,"char_ptr");
else if (!strcmp (typename, "char **")) fprintf(fp,"char_ptr_ptr");
else if (!strcmp (typename, "char")) fprintf(fp,"POSIX_Character");
else if (!strcmp (typename, "int")) fprintf(fp,"int");
else if (!strcmp (typename, "short")) fprintf(fp,"short");
else if (!strcmp (typename, "long")) fprintf(fp,"long");
else if (!strcmp (typename, "signed char")) fprintf(fp,"unsigned_char");
else if (!strcmp (typename, "unsigned")) fprintf(fp,"unsigned");
else if (!strcmp (typename, "unsigned short")) fprintf(fp,"unsigned_short");
else if (!strcmp (typename, "unsigned int")) fprintf(fp,"unsigned_int");
else if (!strcmp (typename, "unsigned long")) fprintf(fp,"unsigned_long");
else if (!strcmp (typename, "unsigned char")) fprintf(fp,"unsigned_char");
else if (!strcmp (typename, "size_t")) fprintf(fp,"size_t");
else if (!strcmp (typename, "struct in_addr"))
fprintf(fp,"struct_in_addr");
else if (!strcmp (typename, "struct sigevent"))
fprintf(fp,"struct_sigevent");
else if (!strcmp (typename, "struct sockaddr *"))
fprintf(fp,"sockaddr_ptr");
else if (!strcmp (typename, "struct iovec *")) fprintf(fp,"iovec_ptr");
else if (!strcmp (typename, "struct addrinfo *"))
fprintf(fp,"addrinfo_ptr");
else if (!strcmp (typename, "struct timespec"))
fprintf(fp,"struct_timespec");
else if (!strcmp (typename, "struct netbuf")) fprintf(fp,"struct_netbuf");
else if (!strcmp (typename, "union sigval")) fprintf(fp,"sigval");
else if (!strcmp (typename, "pthread_attr_t *"))
fprintf(fp,"System.Address");
else if (!strcmp (typename, "void (*)()")) fprintf(fp,"System.Address");
else if (!strcmp (typename, "volatile void *")) fprintf(fp,"System.Address");
else if (!strcmp (typename, "fd_mask")) {
fprintf(fp,"fd_mask_array (1 .. %d)",
sizeof(fd_set)/sizeof(unsigned int));
} else if (!strncmp (typename, "void (*)(", 9) &&
typename [strlen (typename) - 1] == ')')
/* translate "void (*)(...)" into System.Address */
fprintf(fp,"System.Address");
else fprintf(fp,"%s", typename);
}
/* wordsize
--------
the number of locations of type int required to
hold a value of a type of size n (in bytes)
*/
int wordsize (int n) {
return (n % sizeof (unsigned int)) == 0 ?
n / sizeof (int) :
n / sizeof (int) + 1;
}
/* ghdrcmnt
--------
generate section header comment
*/
void ghdrcmnt(char name[]) {
int len = strlen(name);
int i;
fprintf(fp,"\n");
ifprintf(fp," ");
for (i=0; i<len+8; i++) fprintf(fp,"%s","-");
fprintf(fp,"\n");
ifprintf(fp," -- %s --\n", name);
ifprintf(fp," ");
for (i=0; i<len+8; i++) fprintf(fp,"%s","-");
fprintf(fp,"\n");
}
/* gcmnt
--------
generate comment
*/
void gcmnt(char name[]) {
fprintf(fp,"\n");
ifprintf(fp," -- %s --\n", name);
}
/* gbrg
----
generate declaration of Boolean subtype with
range lb .. ub
*/
void gbrg(char name[], char lb[], char ub[]) {
ifprintf(fp," subtype %s is Boolean range\n",name);
ifprintf(fp," %s .. %s;\n", lb, ub);
}
/* gptrtp
-----
generate variable and constant-pointer types
*/
void gptrtp(char const ptrname[], char const desname[]) {
ifprintf(fp," type %s_ptr is access constant %s;\n", ptrname, desname);
ifprintf(fp," pragma Convention (C, %s_ptr);\n", ptrname);
ifprintf(fp," type %s_var_ptr is access all %s;\n", ptrname, desname);
ifprintf(fp," pragma Convention (C, %s_var_ptr);\n", ptrname);
}
/* gsitp
-----
generate declaration of signed integer type
with specified name and size (in bytes)
*/
void gsitp(char name[], int size) {
save_type(name, size, SIGNED_INTEGER_TYPE, NULL);
print_type_declaration(name,fp);
}
/* gdflsitp
--------
generate declaration of default integer type
with specified name
for C type not supported by the underlying OS
*/
void gdflsitp(char name[]) {
NON_SUPPORT_MESSAGE(name)
gsitp(name, DEFAULTSIZE/bits_per_byte);
}
/* guitp
-----
generate declaration of unsigned integer type
with specified name and size (in bytes)
*/
void guitp(char name[], int size) {
save_type(name, size, UNSIGNED_INTEGER_TYPE, NULL);
print_type_declaration(name,fp);
}
/* gdfluitp
--------
generate declaration of default integer type
with specified name
for C type not supported by the underlying OS
*/
void gdfluitp(char name[]) {
NON_SUPPORT_MESSAGE(name)
guitp(name, DEFAULTSIZE/bits_per_byte);
}
/* gptp
----
generate declaration of opaque (private type completion)
for C type with specified name and size (in bytes)
*/
void gptp(char name[], int size) {
if (size >= sizeof (int))
{
save_type(name, size, OPAQUE_TYPE, NULL);
}
else
{
save_type(name, size, CHAR_ARRAY_TYPE, NULL);
}
print_type_declaration(name,fp);
}
/* gdflptp
-------
generate default completion of private type declaration
for C type not supported by the underlying OS
*/
void gdflptp(char name[]) {
NON_SUPPORT_MESSAGE(name)
gptp(name, DEFAULTSIZE/bits_per_byte);
}
/* GFUNC
------
macro wrapper for function gfunc, for cases where
we are concerned that the function may have been renamed
via a macro.
This came up with DEC UNIX, for the pthread_-names.
It also came up with HP-UX, for the pthread_-names.
The extra layer of macro is to force expansion of name2
if it is a macro, even when we later quote it.
*/
#define GFUNC(name, have_it) GFUNCB(#name, name, have_it)
#define GFUNCB(qname, qxname, have_it) gfunc(qname, #qxname, have_it)
/* gfunc
-----
generate constant for C name of function
that notfies of errors by returning -1 with an error code in errno
This lets us raise an exception for functions
that are not available in the libraries.
*/
void gfunc(char const name[], char const xname[], int have_it) {
if (have_it) {
ifprintf
(fp," HAVE_%s : constant Boolean := True;\n", name);
if (strlen(name) > 20) {
ifprintf(fp," %s_LINKNAME : constant String :=\n", name);
ifprintf(fp," \"%s\";\n", n2ln(name));
} else ifprintf
(fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(name));
} else {
#ifdef TRY_MACRO_LINKNAMES
if (strcmp(name, xname)) {
/* We have a macro masquerading as a function name.
If this code results in problems, #undef TRY_MACRO_LINKNAMES
and recompile c-posix.c.
These functions will then simply be treated as not available.
*/
ifprintf(fp," -- We guessed %s is implemented as a macro that\n",
name);
ifprintf(fp," -- expands to the real function name."
" This is risky...\n");
if (strlen(name) > 20) {
ifprintf(fp," %s_LINKNAME : constant String :=\n", name);
ifprintf(fp," \"%s\";\n", n2ln(xname));
} else ifprintf
(fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(xname));
} else
#endif
{
ifprintf(fp," -- *** MISSING: function %s *** --\n", name);
warn("missing function ", name);
ifprintf
(fp," HAVE_%s : constant Boolean := False;\n", name);
ifprintf
(fp," %s_LINKNAME : constant String := \"nosys_neg_one\";\n", name);
}
}
}
/* gfuncsol
--------
variant of gfunc to work around feature of Solaris header files,
which implement some POSIX functions by locally defined wrappers
that call a real function whose name has the form __posix_XXX.
*/
void gfuncsol(char const name[], char const xname[]) {
ifprintf(fp," -- We guessed %s is implemented as a wrapper\n", name);
ifprintf(fp," -- that calls the real function. This is risky...\n");
ifprintf
(fp," HAVE_%s : constant Boolean := True;\n", name);
if (strlen(name) > 20) {
ifprintf(fp," %s_LINKNAME : constant String :=\n", name);
ifprintf(fp," \"%s\";\n", n2ln(xname));
} else ifprintf
(fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(xname));
}
/* GFUNCNS
------_
like GFUNC, but generates ENOTSUP instead of ENOSYS if the
function is not supported.
*/
#define GFUNCNS(name, have_it) GFUNCNSB(#name, name, have_it)
#define GFUNCNSB(qname, qxname, have_it) gfuncns(qname, #qxname, have_it)
/* gfuncns
-------
like gfunc, except uses ENOTSUP instead of ENOSYS if not supported
*/
void gfuncns(char const name[], char const xname[], int have_it) {
if (have_it) {
ifprintf
(fp," HAVE_%s : constant Boolean := True;\n", name);
if (strlen(name) > 20) {
ifprintf(fp," %s_LINKNAME : constant String :=\n", name);
ifprintf(fp," \"%s\";\n", n2ln(name));
} else ifprintf
(fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(name));
} else {
#ifdef TRY_MACRO_LINKNAMES
if (strcmp(name, xname)) {
/* We have a macro masquerading as a function name.
If this code results in problems, #undef TRY_MACRO_LINKNAMES
and recompile c-posix.c.
These functions will then simply be treated as not available.
*/
ifprintf(fp," -- We guessed %s is implemented as a macro that\n",
name);
ifprintf(fp," -- expands to the real function name."
" This is risky...\n");
if (strlen(name) > 20) {
ifprintf(fp," %s_LINKNAME : constant String :=\n", name);
ifprintf(fp," \"%s\";\n", n2ln(xname));
} else ifprintf
(fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(xname));
} else
#endif
{
ifprintf(fp," -- *** MISSING: function %s *** --\n", name);
warn("missing function ", name);
ifprintf
(fp," HAVE_%s : constant Boolean := False;\n", name);
ifprintf
(fp," %s_LINKNAME : constant String := \"notsup_neg_one\";\n", name);
}
}
}
/* GFUNCD
------
macro wrapper for function gfuncd, for cases where
we are concerned that the function may have been renamed
via a macro.
This came up with DEC UNIX, for the pthread_-names.
The extra layer of macro is to force expansion of name2
if it is a macro, even when we later quote it.
*/
#define GFUNCD(name, have_it) GFUNCDB(#name, name, have_it)
#define GFUNCDB(qname, qxname, have_it) gfuncd(qname, #qxname, have_it)
/* gfuncd
------
same as gfunc, except for function that notifies of
errors by returning an error code directly.
*/
void gfuncd(char const name[], char const xname[], int have_it) {
if (have_it) {
if (strlen(name) > 20) {
ifprintf(fp," %s_LINKNAME : constant String :=\n", name);
ifprintf(fp," \"%s\";\n", n2ln(name));
} else ifprintf
(fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(name));
} else {
#ifdef TRY_MACRO_LINKNAMES
if (strcmp(name, xname)) {
/* We have a macro masquerading as a function name.
If this results in problems, #undef TRY_MACRO_LINKNAMES
and recompile c-posix.c. These functions will then simply
be treated as not available.
*/
ifprintf(fp," -- Apparently this function is actually a macro.\n");
ifprintf(fp," -- We are guessing that"
" the macro expands to a linkable name.\n");
ifprintf(fp," -- This is risky...\n");
if (strlen(name) > 20) {
ifprintf(fp," %s_LINKNAME : constant String :=\n", name);
ifprintf(fp," \"%s\";\n", n2ln(xname));
} else ifprintf
(fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(xname));
} else
#endif
{
ifprintf(fp," -- *** MISSING: function %s *** --\n", name);
warn("missing function ", name);
if (strlen(name) > 20) {
ifprintf(fp," %s_LINKNAME : constant String :=\n", name);
ifprintf(fp," \"nosys_direct\";\n", name);
} else ifprintf
(fp," %s_LINKNAME : constant String := \"nosys_direct\";\n", name);
}
}
}
/* GFUNCDNS
--------
like GFUNCD, except that error code is ENOTSUP if not supported
*/
#define GFUNCDNS(name, have_it) GFUNCDNSB(#name, name, have_it)
#define GFUNCDNSB(qname, qxname, have_it) gfuncdns(qname, #qxname, have_it)
/* gfuncdns
--------
same as gfuncd, except that error code for nonsupport is ENOTSUP
*/
void gfuncdns(char const name[], char const xname[], int have_it) {
if (have_it) {
if (strlen(name) > 20) {
ifprintf(fp," %s_LINKNAME : constant String :=\n", name);
ifprintf(fp," \"%s\";\n", n2ln(name));
} else ifprintf
(fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(name));
} else {
#ifdef TRY_MACRO_LINKNAMES
if (strcmp(name, xname)) {
/* We have a macro masquerading as a function name.
If this results in problems, #undef TRY_MACRO_LINKNAMES
and recompile c-posix.c. These functions will then simply
be treated as not available.
*/
ifprintf(fp," -- Apparently this function is actually a macro.\n");
ifprintf(fp," -- We are guessing that"
" the macro expands to a linkable name.\n");
ifprintf(fp," -- This is risky...\n");
if (strlen(name) > 20) {
ifprintf(fp," %s_LINKNAME : constant String :=\n", name);
ifprintf(fp," \"%s\";\n", n2ln(xname));
} else ifprintf
(fp," %s_LINKNAME : constant String := \"%s\";\n", name, n2ln(xname));
} else
#endif
{
ifprintf(fp," -- *** MISSING: function %s *** --\n", name);
warn("missing function ", name);
if (strlen(name) > 20) {
ifprintf(fp," %s_LINKNAME : constant String :=\n", name);
ifprintf(fp," \"notsup_direct\";\n", name);
} else ifprintf
(fp," %s_LINKNAME : constant String := \"notsup_direct\";\n", name);
}
}
}
/* gmaxn
-----
generate _Maxima subtype of Natural
*/
void gmaxn(char const name[], int lower_bound) {
ifprintf(fp," subtype %s_Maxima is Natural range\n",name);
ifprintf(fp," %d .. Natural'Last;\n",lower_bound);
}
/* gmaxnn
-----
generate _Maxima subtype of Natural with tight bound
*/
void gmaxnn(char const name[], int bound) {
ifprintf(fp," subtype %s_Maxima is Natural range\n",name);
ifprintf(fp," %d .. %d;\n", bound, bound);
}
/* gmaxi
-----
generate _Maxima subtype of IO_Count
*/
void gmaxi(char const name[], int lower_bound) {
ifprintf(fp," subtype %s_Maxima is IO_Count range\n",name);
ifprintf(fp," %d .. IO_Count'Last;\n",lower_bound);
}
/* gmaxi
-----
generate _Maxima subtype of IO_Count with tight range
*/
void gmaxii(char const name[], int bound) {
ifprintf(fp," subtype %s_Maxima is IO_Count range\n",name);
ifprintf(fp," %d .. %d;\n", bound, bound);
}
/* gpmaxi
------
generate portable maximum constant of type IO_Count
with specified value
*/
void gpmaxi(char const name[], int value) {
ifprintf(fp," Portable_%s_Maximum :\n",name);
ifprintf(fp," constant IO_Count := %d;\n",value);
}
/* gpmaxn
------
generate portable maximum constant of type Natural
with specified value
*/
void gpmaxn(char const name[], int value) {
ifprintf(fp," Portable_%s_Maximum :\n",name);
ifprintf(fp," constant Natural := %d;\n",value);
}
/* gpmaxr
------
generate portable maximum constant
of type Natural
as renaming of constant in package POSIX
*/
void gpmaxr(char const name[], char const oname[]) {
ifprintf(fp," Portable_%s_Maximum : Natural\n",name);
ifprintf(fp," renames POSIX.Portable_%s_Maximum;\n",oname);
}
/* gpmaxrioc
---------
generate portable maximum constant
of type IO_Count
as renaming of constant in package POSIX
*/
void gpmaxrioc(char const name[], char const oname[]) {
ifprintf(fp," Portable_%s_Maximum : POSIX.IO_Count\n",name);
ifprintf(fp," renames POSIX.Portable_%s_Maximum;\n",oname);
}
/* grename
-------
*/
void grename (char const name[], char const oname[]) {
ifprintf(fp," subtype %s is\n",name);
ifprintf(fp," POSIX.%s;\n",oname);
}
/* gmacrofunc
----------
*/
void gmacrofunc
(char const funcname[],
char const parmtype[],
char const parmname[]) {
ifprintf(fp," function %s (%s : %s) return int;\n",
funcname, parmname, parmtype);
ifprintf(fp," pragma Import (C, %s, \"%s\");\n", funcname, funcname);
}
/* create_options
--------------
create package POSIX.Options, in file posix-options.ads
*/
void create_options() {
fprintf(stderr,"creating package POSIX_Options\n");
if (! (fp = fopen (GENDIR "/posix-options.ads", "w"))) {
perror ("posix-options.ads");
quit("can't open file to write","");
}
gheader("POSIX.Options", IEEE_Header);
ifprintf(fp,"package POSIX.Options is\n");
#ifdef _POSIX_ASYNCHRONOUS_IO
gbrg("Asynchronous_IO_Support", "True", "True");
#else
#ifdef _POSIX_ASYNC_IO
#if (_POSIX_ASYNC_IO == -1)
gbrg("Asynchronous_IO_Support", "False", "False");
#else
gbrg("Asynchronous_IO_Support", "True", "True");
#endif
#else
gbrg("Asynchronous_IO_Support", "False", "True");
#endif
#endif
grename("Change_Owner_Restriction","Change_Owner_Restriction");
grename("Filename_Truncation","Filename_Truncation");
#ifdef _POSIX_FSYNC
gbrg("File_Synchronization_Support", "True", "True");
#else
gbrg("File_Synchronization_Support", "False", "True");
#endif
grename("Job_Control_Support","Job_Control_Support");
#ifdef _POSIX_MAPPED_FILES
gbrg("Memory_Mapped_Files_Support", "True", "True");
#else
gbrg("Memory_Mapped_Files_Support", "False", "True");
#endif
#ifdef _POSIX_MEMLOCK
gbrg("Memory_Locking_Support", "True", "True");
#else
gbrg("Memory_Locking_Support", "False", "True");
#endif
#ifdef _POSIX_MEMLOCK_RANGE
gbrg("Memory_Range_Locking_Support", "True", "True");
#else
gbrg("Memory_Range_Locking_Support", "False", "True");
#endif
#ifdef _POSIX_MEMORY_PROTECTION
gbrg("Memory_Protection_Support", "True", "True");
#else
gbrg("Memory_Protection_Support", "False", "True");
#endif
#ifdef _POSIX_MESSAGE_PASSING
gbrg("Message_Queues_Support", "True", "True");
#else
gbrg("Message_Queues_Support", "False", "True");
#endif
grename("Saved_IDs_Support","Saved_IDs_Support");
gbrg("Mutexes_Support", "True", "True");
#ifdef _POSIX_PRIORITIZED_IO
gbrg("Prioritized_IO_Support", "True", "True");
#else
#ifdef _POSIX_PRIO_IO
#if (_POSIX_PRIO_IO == -1)
gbrg("Prioritized_IO_Support", "False", "False");
#else
gbrg("Prioritized_IO_Support", "True", "True");
#endif
#else
gbrg("Prioritized_IO_Support", "False", "True");
#endif
#endif
#ifdef _POSIX_PRIORITY_SCHEDULING
gbrg("Priority_Process_Scheduling_Support", "True", "True");
#ifdef _POSIX_THREADS
gbrg("Priority_Task_Scheduling_Support", "True", "True");
#else
gbrg("Priority_Task_Scheduling_Support", "False", "False");
#endif
#else
gbrg("Priority_Process_Scheduling_Support", "False", "True");
gbrg("Priority_Task_Scheduling_Support", "False", "False");
#endif
#ifdef _POSIX_REALTIME_SIGNALS
gbrg("Realtime_Signals_Support", "True", "True");
#else
gbrg("Realtime_Signals_Support", "False", "True");
#endif
#ifdef _POSIX_SEMAPHORES
gbrg("Semaphores_Support", "True", "True");
#else
gbrg("Semaphores_Support", "False", "True");
#endif
#ifdef _POSIX_SHARED_MEMORY_OBJECTS
gbrg("Shared_Memory_Objects_Support", "True", "True");
#else
gbrg("Shared_Memory_Objects_Support", "False", "True");
#endif
gbrg("Signal_Entries_Support", "True", "True");
#ifdef _POSIX_SYNCHRONIZED_IO
gbrg("Synchronized_IO_Support", "True", "True");
#else
#ifdef _POSIX_SYNC_IO
#if (_POSIX_SYNC_IO == -1)
gbrg("Synchronized_IO_Support", "False", "False");
#else
gbrg("Synchronized_IO_Support", "True", "True");
#endif
#else
gbrg("Synchronized_IO_Support", "False", "True");
#endif
#endif
#ifdef _POSIX_THREAD_PRIO_PROTECT
gbrg("Mutex_Priority_Ceiling_Support", "True", "True");
#else
gbrg("Mutex_Priority_Ceiling_Support", "False", "True");
#endif
#ifdef _POSIX_THREAD_PRIO_INHERIT
gbrg("Mutex_Priority_Inheritance_Support", "True", "True");
#else
gbrg("Mutex_Priority_Inheritance_Support", "False", "True");
#endif
#ifdef _POSIX_THREAD_PROCESS_SHARED
gbrg("Process_Shared_Support", "True", "True");
#else
gbrg("Process_Shared_Support", "False", "True");
#endif
#ifdef _POSIX_TIMERS
gbrg("Timers_Support", "True", "True");
#else
gbrg("Timers_Support", "False", "True");
#endif
/* options from POSIX.5c [D2]
*/
/* What does _POSIX_PII map to in Ada?
#ifdef _POSIX_PII
gbrg("????_Support", "True", "True");
#else
gbrg("????_Support", "False", "True");
#endif
*/
#ifdef _POSIX_PII_XTI
gbrg("XTI_DNI_Support", "True", "True");
#else
gbrg("XTI_DNI_Support", "False", "True");
#endif
#ifdef _POSIX_PII_INTERNET_DGRAM
gbrg("Internet_Datagram_Support", "True", "True");
#else
gbrg("Internet_Datagram_Support", "False", "True");
#endif
#ifdef _POSIX_PII_INTERNET
gbrg("Internet_Protocol_Support", "True", "True");
#else
gbrg("Internet_Protocol_Support", "False", "True");
#endif
#ifdef _POSIX_PII_INTERNET_STREAM
gbrg("Internet_Stream_Support", "True", "True");
#else
gbrg("Internet_Stream_Support", "False", "True");
#endif
#ifdef _POSIX_PII_OSI
gbrg("ISO_OSI_Protocol_Support", "True", "True");
#else
gbrg("ISO_OSI_Protocol_Support", "False", "True");
#endif
#ifdef _POSIX_PII_OSI_M
gbrg("OSI_Minimal_Support", "True", "True");
#else
gbrg("OSI_Minimal_Support", "False", "True");
#endif
#ifdef _POSIX_PII_OSI_COTS
gbrg("OSI_Connection_Support", "True", "True");
#else
gbrg("OSI_Connection_Support", "False", "True");
#endif
#ifdef _POSIX_PII_OSI_CLTS
gbrg("OSI_Connectionless_Support", "True", "True");
#else
gbrg("OSI_Connectionless_Support", "False", "True");
#endif
#ifdef _POSIX_POLL
gbrg("Poll_Support", "True", "True");
#else
gbrg("Poll_Support", "False", "True");
#endif
#ifdef _POSIX_SELECT
gbrg("Select_Support", "True", "True");
#else
gbrg("Select_Support", "False", "True");
#endif
#ifdef _POSIX_PII_SOCKET
gbrg("Sockets_DNI_Support", "True", "True");
#else
gbrg("Sockets_DNI_Support", "False", "True");
#endif
#ifdef _POSIX_PII_NET_SUPPORT
gbrg("Network_Management_Support", "True", "True");
#else
gbrg("Network_Management_Support", "False", "True");
#endif
ifprintf(fp,"end POSIX.Options;\n");
fclose (fp);
fprintf(stderr,"done generating posix-options.ads\n");
}
/* create_limits
-------------
create package POSIX.Limits, in file posix-limits.ads
*/
void create_limits() {
fprintf(stderr,"creating package POSIX_Limits\n");
if (! (fp = fopen (GENDIR "/posix-limits.ads", "w"))) {
perror ("posix-limits.ads");
quit("can't open file to write","");
}
gheader("POSIX.Limits", IEEE_Header);
ifprintf(fp,"package POSIX.Limits is\n");
ghdrcmnt("Portable System Limits");
ifprintf(fp," -- .... Change P1003.5b?\n");
ifprintf(fp," -- to allow these constants\n");
ifprintf(fp," -- to be larger than the minimum values specified.\n\n");
gpmaxr("Argument_List","Argument_List");
ifprintf(fp," Portable_Asynchronous_IO_Maximum :\n");
ifprintf(fp," constant Natural := 1;\n");
gpmaxr("Child_Processes","Child_Processes");
ifprintf(fp," Portable_Clock_Resolution_Minimum :\n");
ifprintf(fp," constant := 20_000_000;\n");
/* notice that this is a MINIMUM, so we don't use gpmax */
gpmaxr("Filename","Filename_Limit");
gpmaxr("Groups","Groups");
gpmaxrioc("Input_Line","Input_Line_Limit");
gpmaxrioc("Input_Queue","Input_Queue_Limit");
gpmaxr("Links","Link_Limit");
#ifdef _POSIX_AIO_LISTIO_MAX
gpmaxn("List_IO",_POSIX_AIO_LISTIO_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_AIO_LISTIO_MAX");
gpmaxn("List_IO", 2);
#endif
#ifdef _POSIX_MQ_PRIO_MAX
gpmaxn("Message_Priority",_POSIX_MQ_PRIO_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_MQ_PRIO_MAX");
gpmaxn("Message_Priority", 32);
#endif
gpmaxr("Open_Files","Open_Files");
#ifdef _POSIX_MQ_OPEN_MAX
gpmaxn("Open_Message_Queues",_POSIX_MQ_OPEN_MAX);
#else
gpmaxn("Open_Message_Queues",8);
#endif
gpmaxr("Pathname","Pathname_Limit");
gpmaxrioc("Pipe_Length","Pipe_Limit");
#ifdef _POSIX_SIGQUEUE_MAX
gpmaxn("Queued_Signals",_POSIX_SIGQUEUE_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_SIGQUEUE_MAX");
gpmaxn("Queued_Signals", 32);
#endif
#ifdef _POSIX_RTSIG_MAX
gpmaxn("Realtime_Signals",_POSIX_RTSIG_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_RTSIG_MAX");
gpmaxn("Realtime_Signals",8);
#endif
#ifdef _POSIX_SEM_NSEMS_MAX
gpmaxn("Semaphores",_POSIX_SEM_NSEMS_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_SEM_NSEMS_MAX");
gpmaxn("Semaphores", 256);
#endif
#ifdef _POSIX_SEM_VALUE_MAX
gpmaxn("Semaphores_Value",_POSIX_SEM_VALUE_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_SEM_VALUE_MAX");
gpmaxn("Semaphores_Value", 32767);
#endif
gpmaxr("Streams","Stream");
#ifdef _POSIX_DELAYTIMER_MAX
gpmaxn("Timer_Overruns",_POSIX_DELAYTIMER_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_DELAYTIMER_MAX");
gpmaxn("Timer_Overruns", 32);
#endif
#ifdef _POSIX_TIMER_MAX
gpmaxn("Timers",_POSIX_TIMER_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_NTIMER_MAX")
gpmaxn("Timers", 32);
#endif
gpmaxr("Time_Zone_String","Time_Zone_String");
fprintf(fp,"\n");
ifprintf(fp," -- limits from POSIX.5c [D2]\n\n");
#ifdef _POSIX_FD_SETSIZE
gpmaxn("File_Descriptor_Set", _POSIX_FD_SETSIZE);
#else
gpmaxr("File_Descriptor_Set", "Open_Files");
#endif
#ifdef _POSIX_HIWAT
gpmaxi("Socket_Buffer", _POSIX_HIWAT);
#else
gpmaxrioc("Socket_Buffer", "Pipe_Limit");
#endif
#ifdef _POSIX_UIO_MAXIOV
gpmaxn("Socket_IO_Vector", _POSIX_UIO_MAXIOV);
#else
gpmaxn("Socket_IO_Vector", 16);
#endif
#ifdef _POSIX_QLIMIT
gpmaxn("Socket_Connection", _POSIX_QLIMIT);
#else
gpmaxn("Socket_Connection", 1);
#endif
#ifdef _POSIX_UIO_MAXIOV
gpmaxn("XTI_IO_Vector", _POSIX_UIO_MAXIOV);
#else
gpmaxn("XTI_IO_Vector", 16);
#endif
ghdrcmnt("Configurable Limits");
grename("Argument_List_Maxima","Argument_List_Maxima");
#ifdef AIO_MAX
gmaxnn("Asynchronous_IO",AIO_MAX);
#else
#ifdef _POSIX_AIO_MAX
gmaxn("Asynchronous_IO",_POSIX_AIO_MAX);
#else
gmaxn("Asynchronous_IO", 1);
#endif
#endif
#ifdef AIO_PRIO_DELTA_MAX
gmaxnn("Asynchronous_IO_Priority_Delta",AIO_PRIO_DELTA_MAX);
#else
gmaxn("Asynchronous_IO_Priority_Delta", 0);
#endif
grename("Child_Processes_Maxima","Child_Processes_Maxima");
grename("Filename_Maxima","Filename_Limit_Maxima");
grename("Groups_Maxima","Groups_Maxima");
grename("Input_Line_Maxima","Input_Line_Limit_Maxima");
grename("Input_Queue_Maxima","Input_Queue_Limit_Maxima");
grename("Links_Maxima","Link_Limit_Maxima");
#ifdef AIO_LISTIO_MAX
gmaxnn("List_IO",AIO_LISTIO_MAX);
#else
#ifdef _POSIX_AIO_LISTIO_MAX
gmaxn("List_IO",_POSIX_AIO_LISTIO_MAX);
#else
gmaxn("List_IO", 2);
#endif
#endif
#ifdef MQ_PRIO_MAX
gmaxnn("Message_Priority",MQ_PRIO_MAX);
#else
#ifdef _POSIX_MQ_PRIO_MAX
gmaxn("Message_Priority",_POSIX_MQ_PRIO_MAX);
#else
gmaxn("Message_Priority", 32);
#endif
#endif
#ifdef MQ_OPEN_MAX
gmaxnn("Open_Message_Queues",MQ_OPEN_MAX);
#else
#ifdef _POSIX_MQ_OPEN_MAX
gmaxn("Open_Message_Queues",_POSIX_MQ_OPEN_MAX);
#else
gmaxn("Open_Message_Queues", 8);
#endif
#endif
grename("Open_Files_Maxima","Open_Files_Maxima");
ifprintf(fp," subtype Page_Size_Range ");
#ifdef PAGESIZE
ifprintf(fp," is Natural range %d .. %d;\n", PAGESIZE, PAGESIZE);
#else
#ifdef _SC_PAGESIZE
ifprintf(fp," is Natural range %d .. %d;\n",
sysconf(_SC_PAGESIZE), sysconf(_SC_PAGESIZE));
#else
ifprintf(fp," is Natural range 0 .. -1;\n");
#endif
#endif
grename("Pathname_Maxima","Pathname_Limit_Maxima");
grename("Pipe_Length_Maxima","Pipe_Limit_Maxima");
#ifdef SIGQUEUE_MAX
gmaxnn("Queued_Signals",SIGQUEUE_MAX);
#else
#ifdef _POSIX_SIGQUEUE_MAX
gmaxn("Queued_Signals",_POSIX_SIGQUEUE_MAX);
#else
gmaxn("Queued_Signals", 32);
#endif
#endif
#ifdef RTSIG_MAX
gmaxnn("Realtime_Signals",RTSIG_MAX);
#else
#ifdef _POSIX_RTSIG_MAX
gmaxn("Realtime_Signals",_POSIX_RTSIG_MAX);
#else
gmaxn("Realtime_Signals",8);
#endif
#endif
#ifdef SEM_NSEMS_MAX
gmaxnn("Semaphores",SEM_NSEMS_MAX);
#else
#ifdef _POSIX_SEM_NSEMS_MAX
gmaxn("Semaphores",_POSIX_SEM_NSEMS_MAX);
#else
gmaxn("Semaphores", 256);
#endif
#endif
#ifdef SEM_VALUE_MAX
/* Semaphores_Value bounds are declared as Natural, and thus
cannot exceed INT_MAX. */
if (SEM_VALUE_MAX > INT_MAX)
gmaxnn("Semaphores_Value",INT_MAX);
else
gmaxnn("Semaphores_Value",SEM_VALUE_MAX);
#else
#ifdef _POSIX_SEM_VALUE_MAX
gmaxn("Semaphores_Value",_POSIX_SEM_VALUE_MAX);
#else
gmaxn("Semaphores_Value", 32767);
#endif
#endif
grename("Streams_Maxima","Stream_Maxima");
#ifdef DELAYTIMER_MAX
gmaxnn("Timer_Overruns",DELAYTIMER_MAX);
#else
#ifdef _POSIX_DELAYTIMER_MAX
gmaxn("Timer_Overruns",_POSIX_DELAYTIMER_MAX);
#else
gmaxn("Timer_Overruns", 32);
#endif
#endif
#ifdef TIMER_MAX
gmaxnn("Timers",TIMER_MAX);
#else
#ifdef _POSIX_TIMER_MAX
gmaxn("Timers",_POSIX_TIMER_MAX);
#else
gmaxn("Timers", 32);
#endif
#endif
grename("Time_Zone_String_Maxima","Time_Zone_String_Maxima");
/* limits from POSIX.5c/D4
*/
fprintf(fp,"\n");
fprintf(fp," -- limits from POSIX.5c [D2]\n\n");
#ifdef FD_SETSIZE
gmaxnn("File_Descriptor_Set", FD_SETSIZE);
#else
#ifdef _POSIX_FD_SETSIZE
gmaxn("File_Descriptor_Set", _POSIX_FD_SETSIZE);
#else
#ifdef _POSIX_PIPE_BUF
gmaxn("File_Descriptor_Set", _POSIX_PIPE_BUF);
#else
gmaxn("File_Descriptor_Set", 8);
#endif
#endif
#endif
#ifdef SOCK_MAXBUF
gmaxii("Socket_Buffer", SOCK_MAXBUF);
#else
#ifdef _POSIX_PIPE_BUF
gmaxi("Socket_Buffer", _POSIX_PIPE_BUF);
#else
gmaxi("Socket_Buffer", 8);
#endif
#endif
#ifdef UIO_MAXIOV
gmaxnn ("Socket_IO_Vector", UIO_MAXIOV);
#else
#ifdef _POSIX_UIO_MAXIOV
gmaxn ("Socket_IO_Vector", _POSIX_UIO_MAXIOV);
#else
gmaxn ("Socket_IO_Vector", 16);
#endif
#endif
#ifdef _POSIX_QLIMIT
gmaxn ("Socket_Connection", _POSIX_QLIMIT);
#else
gmaxn ("Socket_Connection", 1);
#endif
#ifdef T_IOV_MAX
gmaxnn ("XTI_IO_Vector", T_IOV_MAX);
#else
#ifdef _POSIX_UIO_MAXIOV
gmaxn("XTI_IO_Vector", _POSIX_UIO_MAXIOV);
#else
gmaxn("XTI_IO_Vector", 16);
#endif
#endif
ifprintf(fp,"end POSIX.Limits;\n");
fclose (fp);
fprintf(stderr,"done generating posix-limits.ads\n");
}
/* create_posix
------------
create package POSIX, in file posix.ads
*/
void create_posix() {
int max_posix_error;
int XTI_Error_First;
int XTI_Error_Last;
int EAI_Error_First;
int EAI_Error_Last;
int count;
/* The Makefile is responsible for defining LIBS correctly */
#ifdef LIBS
char libs[] = LIBS, *s1, *s2;
#endif
fprintf(stderr,"creating package POSIX\n");
if (! (fp = fopen (GENDIR "/posix.ads", "w"))) {
perror ("posix.ads");
quit("can't open file to write","");
}
gheader("POSIX", IEEE_Header);
ifprintf(fp,"with Ada.Streams;\n");
ifprintf(fp,"with Interfaces;\n");
ifprintf(fp,"package POSIX is\n\n");
#ifdef LIBS
/* Generate one pragma Linker_Options per library */
for (s1 = libs; *s1; ) {
for (s2 = s1; *s2 && *s2 != ' '; s2++);
if (*s2) {
*s2 = '\0';
ifprintf(fp," pragma Linker_Options (\"%s\");\n", s1);
s1 = s2 + 1;
} else
s1 = s2;
}
#endif
fprintf(fp,"\n");
ifprintf(fp," -- 2.4.1 Constants and Static Subtypes\n\n");
fprintf(fp," -- Version Identification\n\n");
#ifdef _POSIX_VERSION
GCST("POSIX_Version", _POSIX_VERSION);
#else
GDFLT("POSIX_Version", 0);
#endif
ifprintf(fp," POSIX_Ada_Version : constant := 1995_00;\n\n");
ifprintf(fp," -- Optional Facilities (obsolescent, 0)\n");
ifprintf(fp," -- See package POSIX.Limits for preferred interfaces.\n\n");
#ifdef _POSIX_JOB_CONTROL
gbrg("Job_Control_Support", "True", "True");
#else
gbrg("Job_Control_Support", "False", "True");
#endif
#ifdef _POSIX_SAVED_IDS
gbrg("Saved_IDs_Support", "True", "True");
#else
gbrg("Saved_IDs_Support", "False", "False");
#endif
#ifdef _POSIX_CHOWN_RESTRICTED
#if (_POSIX_CHOWN_RESTRICTED == -1)
gbrg("Change_Owner_Restriction", "False", "False");
#else
gbrg("Change_Owner_Restriction", "True", "True");
#endif
#else
gbrg("Change_Owner_Restriction", "False", "True");
#endif
#ifdef _POSIX_NO_TRUNC
#if (_POSIX_NO_TRUNC == -1)
gbrg("Filename_Truncation", "False", "False");
#else
gbrg("Filename_Truncation", "True", "True");
#endif
#else
gbrg("Filename_Truncation", "False", "True");
#endif
ifprintf(fp," -- Bytes and I/O Counts\n\n");
ifprintf(fp," Byte_Size : constant := %d;\n\n",bits_per_byte);
ifprintf(fp," type IO_Count is range -2**%d .. (2**%d) - 1;\n\n",
sizeof(ssize_t)*bits_per_byte-1,
sizeof(ssize_t)*bits_per_byte-1);
ifprintf(fp," for IO_Count'Size use %d;\n", sizeof(ssize_t)*bits_per_byte);
gmaxi("IO_Count", 32767);
ifprintf(fp," -- System Limits (obsolescent)\n");
ifprintf(fp," -- See package POSIX.Limits for preferred interfaces.\n\n");
/* Run-Time Increasable Values
These must be defined, but
the actual limits, as reported by sysconf(), may be higher.
*/
#ifdef _POSIX_NGROUPS_MAX
gpmaxn("Groups",_POSIX_NGROUPS_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_NGROUPS_MAX");
gpmaxn("Groups", 0);
#endif
#ifdef NGROUPS_MAX
/* run-time increasable value */
gmaxn("Groups",NGROUPS_MAX);
#else
#ifdef _POSIX_NGROUPS_MAX
gmaxn("Groups", _POSIX_NGROUPS_MAX);
#else
gmaxn("Groups", 0);
#endif
#endif
/*
Runtime Invariant Values
These need not be defined.
If defined, these are reliable static bounds,
not to be exceeded by the sysconf() result.
*/
#ifdef _POSIX_ARG_MAX
gpmaxn("Argument_List",_POSIX_ARG_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_ARG_MAX");
gpmaxn("Argument_List",4096);
#endif
#ifdef ARG_MAX
gmaxnn("Argument_List", ARG_MAX);
#else
#ifdef _POSIX_ARG_MAX
gmaxn("Argument_List", _POSIX_ARG_MAX);
#else
gmaxn("Argument_List",4096);
#endif
#endif
#ifdef _POSIX_CHILD_MAX
gpmaxn("Child_Processes",_POSIX_CHILD_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_CHILD_MAX");
gpmaxn("Child_Processes",6);
#endif
#ifdef CHILD_MAX
gmaxnn("Child_Processes", CHILD_MAX);
#else
#ifdef _POSIX_CHILD_MAX
gmaxn("Child_Processes", _POSIX_CHILD_MAX);
#else
gmaxn("Child_Processes",6);
#endif
#endif
#ifdef _POSIX_OPEN_MAX
gpmaxn("Open_Files",_POSIX_OPEN_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_OPEN_MAX");
gpmaxn("Open_Files", 16);
#endif
#ifdef OPEN_MAX
gmaxnn("Open_Files", OPEN_MAX);
#else
#ifdef _POSIX_OPEN_MAX
gmaxn("Open_Files", _POSIX_OPEN_MAX);
#else
gmaxn("Open_Files", 16);
#endif
#endif
#ifdef _POSIX_STREAM_MAX
gpmaxn("Stream",_POSIX_STREAM_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_STREAM_MAX");
gpmaxn("Stream",8);
#endif
#ifdef STREAM_MAX
gmaxnn("Stream", STREAM_MAX);
#else
#ifdef _POSIX_STREAM_MAX
gmaxn("Stream", _POSIX_STREAM_MAX);
#else
gmaxn("Stream",8);
#endif
#endif
#ifdef _POSIX_TZNAME_MAX
gpmaxn("Time_Zone_String",_POSIX_TZNAME_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_TZNAME_MAX");
gpmaxn("Time_Zone_String", 3);
#endif
#ifdef TZNAME_MAX
gmaxnn("Time_Zone_String", TZNAME_MAX);
#else
#ifdef _POSIX_TZNAME_MAX
gmaxn("Time_Zone_String", _POSIX_TZNAME_MAX);
#else
gmaxn("Time_Zone_String", 3);
#endif
#endif
/*
Pathname Variable Values
These need not be defined.
If defined, these are reliable static bounds,
not to be exceeded by pathconf() result.
*/
ifprintf(fp," -- Pathname Variable Values (obsolescent)\n");
ifprintf(fp," -- See package POSIX.Limits for preferred"
" interfaces.\n\n");
#ifdef _POSIX_LINK_MAX
gpmaxn("Link_Limit",_POSIX_LINK_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_LINK_MAX");
gpmaxn("Link_Limit",8);
#endif
#ifdef LINK_MAX
gmaxnn("Link_Limit", LINK_MAX);
#else
#ifdef _POSIX_LINK_MAX
gmaxn("Link_Limit", _POSIX_LINK_MAX);
#else
gmaxn("Link_Limit",8);
#endif
#endif
#ifdef _POSIX_MAX_INPUT
gpmaxi("Input_Line_Limit",_POSIX_MAX_INPUT);
#else
NON_SUPPORT_MESSAGE("_POSIX_MAX_INPUT");
gpmaxi("Input_Line_Limit", 255);
#endif
#ifdef MAX_INPUT
gmaxii("Input_Line_Limit",MAX_INPUT);
#else
#ifdef _POSIX_MAX_INPUT
gmaxi("Input_Line_Limit", _POSIX_MAX_INPUT);
#else
gmaxi("Input_Line_Limit", 255);
#endif
#endif
#ifdef _POSIX_MAX_CANON
gpmaxi("Input_Queue_Limit",_POSIX_MAX_CANON);
#else
NON_SUPPORT_MESSAGE("_POSIX_MAX_CANON");
gpmaxi("Input_Queue_Limit", 255);
#endif
#ifdef MAX_CANON
gmaxii("Input_Queue_Limit", MAX_CANON);
#else
#ifdef _POSIX_MAX_CANON
gmaxi("Input_Queue_Limit", _POSIX_MAX_CANON);
#else
gmaxi("Input_Queue_Limit", 255);
#endif
#endif
#ifdef _POSIX_NAME_MAX
gpmaxn("Filename_Limit",_POSIX_NAME_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_NAME_MAX");
gpmaxn("Filename_Limit", 14);
#endif
#ifdef NAME_MAX
gmaxnn("Filename_Limit", NAME_MAX);
#else
#ifdef _POSIX_NAME_MAX
gmaxn("Filename_Limit", _POSIX_NAME_MAX);
#else
gmaxn("Filename_Limit", 14);
#endif
#endif
#ifdef _POSIX_PATH_MAX
gpmaxn("Pathname_Limit",_POSIX_PATH_MAX);
#else
NON_SUPPORT_MESSAGE("_POSIX_PATH_MAX");
gpmaxn("Pathname_Limit", 255);
#endif
#ifdef PATH_MAX
gmaxnn("Pathname_Limit", PATH_MAX);
#else
#ifdef _POSIX_PATH_MAX
gmaxn("Pathname_Limit", _POSIX_PATH_MAX);
#else
gmaxn("Pathname_Limit", 255);
#endif
#endif
#ifdef _POSIX_PIPE_BUF
gpmaxi("Pipe_Limit",_POSIX_PIPE_BUF);
#else
gpmaxi("Pipe_Limit", 512);
#endif
#ifdef PIPE_BUF
gmaxii("Pipe_Limit", PIPE_BUF);
#else
#ifdef _POSIX_PIPE_BUF
gmaxi("Pipe_Limit", _POSIX_PIPE_BUF);
#else
gmaxi("Pipe_Limit", 512);
#endif
#endif
ifprintf(fp," -- Blocking Behavior Values\n");
ifprintf(fp," type Blocking_Behavior is (Tasks, Program, Special);\n");
ifprintf(fp," subtype Text_IO_Blocking_Behavior is Blocking_Behavior\n");
ifprintf(fp," range Tasks .. Tasks;\n");
ifprintf(fp," IO_Blocking_Behavior :");
ifprintf(fp," constant Blocking_Behavior\n");
ifprintf(fp," := Tasks;\n");
ifprintf(fp," File_Lock_Blocking_Behavior :");
ifprintf(fp," constant Blocking_Behavior\n");
ifprintf(fp," := Tasks;\n");
ifprintf(fp," Wait_For_Child_Blocking_Behavior :");
ifprintf(fp," constant Blocking_Behavior\n");
ifprintf(fp," := Tasks;\n");
ifprintf(fp," subtype Realtime_Blocking_Behavior is Blocking_Behavior\n");
ifprintf(fp," range Tasks .. Program;\n");
ifprintf(fp," -- Signal Masking\n");
ifprintf(fp," type Signal_Masking is ");
ifprintf(fp,"(No_Signals, RTS_Signals, All_Signals);\n");
ifprintf(fp," -- Characters and Strings\n");
ifprintf(fp," type POSIX_Character is new Standard.Character;\n");
ifprintf(fp," -- We rely here on the fact that the GNAT"
" type Character\n");
ifprintf(fp," -- is the same as the GCC type char in C,\n");
ifprintf(fp," -- which in turn must be the same as POSIX_Character.\n\n");
ifprintf(fp," NUL : constant POSIX_Character := POSIX_Character (ASCII.NUL);\n");
ifprintf(fp," SOH : constant POSIX_Character := POSIX_Character (ASCII.SOH);\n");
ifprintf(fp," STX : constant POSIX_Character := POSIX_Character (ASCII.STX);\n");
ifprintf(fp," ETX : constant POSIX_Character := POSIX_Character (ASCII.ETX);\n");
ifprintf(fp," EOT : constant POSIX_Character := POSIX_Character (ASCII.EOT);\n");
ifprintf(fp," ENQ : constant POSIX_Character := POSIX_Character (ASCII.ENQ);\n");
ifprintf(fp," ACK : constant POSIX_Character := POSIX_Character (ASCII.ACK);\n");
ifprintf(fp," BEL : constant POSIX_Character := POSIX_Character (ASCII.BEL);\n");
ifprintf(fp," BS : constant POSIX_Character := POSIX_Character (ASCII.BS);\n");
ifprintf(fp," HT : constant POSIX_Character := POSIX_Character (ASCII.HT);\n");
ifprintf(fp," LF : constant POSIX_Character := POSIX_Character (ASCII.LF);\n");
ifprintf(fp," VT : constant POSIX_Character := POSIX_Character (ASCII.VT);\n");
ifprintf(fp," FF : constant POSIX_Character := POSIX_Character (ASCII.FF);\n");
ifprintf(fp," CR : constant POSIX_Character := POSIX_Character (ASCII.CR);\n");
ifprintf(fp," SO : constant POSIX_Character := POSIX_Character (ASCII.SO);\n");
ifprintf(fp," SI : constant POSIX_Character := POSIX_Character (ASCII.SI);\n");
ifprintf(fp," DLE : constant POSIX_Character := POSIX_Character (ASCII.DLE);\n");
ifprintf(fp," DC1 : constant POSIX_Character := POSIX_Character (ASCII.DC1);\n");
ifprintf(fp," DC2 : constant POSIX_Character := POSIX_Character (ASCII.DC2);\n");
ifprintf(fp," DC3 : constant POSIX_Character := POSIX_Character (ASCII.DC3);\n");
ifprintf(fp," DC4 : constant POSIX_Character := POSIX_Character (ASCII.DC4);\n");
ifprintf(fp," NAK : constant POSIX_Character := POSIX_Character (ASCII.NAK);\n");
ifprintf(fp," SYN : constant POSIX_Character := POSIX_Character (ASCII.SYN);\n");
ifprintf(fp," ETB : constant POSIX_Character := POSIX_Character (ASCII.ETB);\n");
ifprintf(fp," CAN : constant POSIX_Character := POSIX_Character (ASCII.CAN);\n");
ifprintf(fp," EM : constant POSIX_Character := POSIX_Character (ASCII.EM);\n");
ifprintf(fp," SUB : constant POSIX_Character := POSIX_Character (ASCII.SUB);\n");
ifprintf(fp," ESC : constant POSIX_Character := POSIX_Character (ASCII.ESC);\n");
ifprintf(fp," FS : constant POSIX_Character := POSIX_Character (ASCII.FS);\n");
ifprintf(fp," GS : constant POSIX_Character := POSIX_Character (ASCII.GS);\n");
ifprintf(fp," RS : constant POSIX_Character := POSIX_Character (ASCII.RS);\n");
ifprintf(fp," US : constant POSIX_Character := POSIX_Character (ASCII.US);\n\n");
ifprintf(fp," type POSIX_String is array (Positive range <>) ");
ifprintf(fp,"of aliased POSIX_Character;\n");
ifprintf(fp," function To_POSIX_String (Str : String) ");
ifprintf(fp,"return POSIX_String;\n");
ifprintf(fp," function To_POSIX_String (Str : Wide_String) ");
ifprintf(fp,"return POSIX_String;\n");
ifprintf(fp," function To_String (Str : POSIX_String) return String;\n");
ifprintf(fp," function To_Wide_String (Str : POSIX_String) ");
ifprintf(fp,"return Wide_String;\n");
ifprintf(fp," function To_Stream_Element_Array (Buffer : POSIX_String)\n");
ifprintf(fp," return Ada.Streams.Stream_Element_Array;\n");
ifprintf(fp," function To_POSIX_String (Buffer : ");
ifprintf(fp,"Ada.Streams.Stream_Element_Array)\n");
ifprintf(fp," return POSIX_String;\n");
ifprintf(fp," subtype Filename is POSIX_String;\n");
ifprintf(fp," subtype Pathname is POSIX_String;\n");
ifprintf(fp," function Is_Filename (Str : POSIX_String)"
" return Boolean;\n");
ifprintf(fp," function Is_Pathname (Str : POSIX_String)"
" return Boolean;\n");
ifprintf(fp," function Is_Portable_Filename (Str : POSIX_String)");
ifprintf(fp," return Boolean;\n");
ifprintf(fp," function Is_Portable_Pathname (Str : POSIX_String)");
ifprintf(fp," return Boolean;\n");
ifprintf(fp," -- String Lists\n");
ifprintf(fp," type POSIX_String_List is limited private;\n");
ifprintf(fp," Empty_String_List : constant POSIX_String_List;\n");
ifprintf(fp," procedure Make_Empty (List : in out POSIX_String_List);\n");
ifprintf(fp," procedure Append (List : in out POSIX_String_List;\n");
ifprintf(fp," Str : POSIX_String);\n");
ifprintf(fp," generic\n");
ifprintf(fp," with procedure Action\n");
ifprintf(fp," (Item : POSIX_String;\n");
ifprintf(fp," Quit : in out Boolean);\n");
ifprintf(fp," procedure For_Every_Item (List : POSIX_String_List);\n");
ifprintf(fp," function Length (List : POSIX_String_List) ");
ifprintf(fp,"return Natural;\n");
ifprintf(fp," function Value\n");
ifprintf(fp," (List : POSIX_String_List;\n");
ifprintf(fp," Index : Positive) return POSIX_String;\n");
ifprintf(fp," -- option sets\n");
ifprintf(fp," type Option_Set is private;\n");
ifprintf(fp," function Empty_Set return Option_Set;\n");
ifprintf(fp," function \"+\" (L, R : Option_Set) return Option_Set;\n");
ifprintf(fp," function \"-\" (L, R : Option_Set) return Option_Set;\n");
ifprintf(fp," function \"<\" (Left, Right : Option_Set)"
" return Boolean;\n");
ifprintf(fp," function \"<=\"(Left, Right : Option_Set)"
" return Boolean;\n");
ifprintf(fp," function \">\" (Left, Right : Option_Set)"
" return Boolean;\n");
ifprintf(fp," function \">=\"(Left, Right : Option_Set)"
" return Boolean;\n");
{ int i;
for (i =1; i<32; i++) {
ifprintf(fp," Option_%d : constant Option_Set;\n", i);
}
}
ifprintf(fp," -- Exceptions and error codes\n");
ifprintf(fp," POSIX_Error : exception;\n");
gsitp("Error_Code", sizeof(int));
ifprintf(fp," function Get_Error_Code return Error_Code;\n");
ifprintf(fp," procedure Set_Error_Code (Error : Error_Code);\n");
ifprintf(fp," function Is_POSIX_Error (Error : Error_Code) ");
ifprintf(fp,"return Boolean;\n");
ifprintf(fp," function Image (Error : Error_Code) return String;\n");
ifprintf(fp," No_Error : constant Error_Code := 0;\n");
ifprintf(fp," -- Error code constants with negative values ");
ifprintf(fp,"correspond to\n");
ifprintf(fp," -- error codes that are not supported by the ");
ifprintf(fp,"current system.\n");
ifprintf(fp," -- error codes\n");
max_GCST2 = 0;
#ifdef E2BIG
GCST2("E2BIG", "Argument_List_Too_Long", E2BIG);
#else
GDFLT2("E2BIG", "Argument_List_Too_Long");
#endif
#ifdef EACCES
GCST2("EACCES", "Permission_Denied", EACCES);
#else
GDFLT2("EACCES", "Permission_Denied");
#endif
#ifdef EADDRINUSE
GCST2("EADDRINUSE", "Address_In_Use", EADDRINUSE);
#else
GDFLT2("EADDRINUSE", "Address_In_Use");
#endif
#ifdef EADDRNOTAVAIL
GCST2("EADDRNOTAVAIL", "Address_Not_Available", EADDRNOTAVAIL);
#else
GDFLT2("EADDRNOTAVAIL", "Address_Not_Available");
#endif
#ifdef EAFNOSUPPORT
GCST2("EAFNOSUPPORT", "Inappropriate_Family", EAFNOSUPPORT);
#else
GDFLT2("EAFNOSUPPORT", "Inappropriate_Family");
#endif
#ifdef EAGAIN
GCST2("EAGAIN", "Resource_Temporarily_Unavailable", EAGAIN);
#else
GDFLT2("EAGAIN", "Resource_Temporarily_Unavailable");
#endif
#ifdef EALREADY
GCST2("EALREADY", "Already_Awaiting_Connection", EALREADY);
#else
GDFLT2("EALREADY", "Already_Awaiting_Connection");
#endif
#ifdef EBADF
GCST2("EBADF", "Bad_File_Descriptor", EBADF);
#else
GDFLT2("EBADF", "Bad_File_Descriptor");
#endif
#ifdef EBADMSG
GCST2("EBADMSG", "Bad_Message", EBADMSG);
#else
GDFLT2("EBADMSG", "Bad_Message");
#endif
#ifdef EBUSY
GCST2("EBUSY", "Resource_Busy", EBUSY);
#else
GDFLT2("EBUSY", "Resource_Busy");
#endif
#ifdef ECANCELED
GCST2("ECANCELED", "Operation_Canceled", ECANCELED);
#else
GDFLT2("ECANCELED", "Operation_Canceled");
#endif
#ifdef ECHILD
GCST2("ECHILD", "No_Child_Process", ECHILD);
#else
GDFLT2("ECHILD", "No_Child_Process");
#endif
#ifdef ECONNABORTED
GCST2("ECONNABORTED", "Connection_Aborted", ECONNABORTED);
#else
GDFLT2("ECONNABORTED", "Connection_Aborted");
#endif
#ifdef ECONNREFUSED
GCST2("ECONNREFUSED", "Connection_Refused", ECONNREFUSED);
#else
GDFLT2("ECONNREFUSED", "Connection_Refused");
#endif
#ifdef ECONNRESET
GCST2("ECONNRESET", "Connection_Reset", ECONNRESET);
#else
GDFLT2("ECONNRESET", "Connection_Reset");
#endif
#ifdef EDEADLK
GCST2("EDEADLK", "Resource_Deadlock_Avoided", EDEADLK);
#else
GDFLT2("EDEADLK", "Resource_Deadlock_Avoided");
#endif
#ifdef EDOM
GCST2("EDOM", "Domain_Error", EDOM);
#else
GDFLT2("EDOM", "Domain_Error");
#endif
#ifdef EEXIST
GCST2("EEXIST", "File_Exists", EEXIST);
#else
GDFLT2("EEXIST", "File_Exists");
#endif
#ifdef EFAULT
GCST2("EFAULT", "Bad_Address", EFAULT);
#else
GDFLT2("EFAULT", "Bad_Address");
#endif
#ifdef EFBIG
GCST2("EFBIG", "File_Too_Large", EFBIG);
#else
GDFLT2("EFBIG", "File_Too_Large");
#endif
#ifdef EHOSTDOWN
GCST2("EHOSTDOWN", "Host_Down", EHOSTDOWN);
#else
GDFLT2("EHOSTDOWN", "Host_Down");
#endif
#ifdef EHOSTUNREACH
GCST2("EHOSTUNREACH", "Host_Unreachable", EHOSTUNREACH);
#else
GDFLT2("EHOSTUNREACH", "Host_Unreachable");
#endif
#ifdef EINPROGRESS
GCST2("EINPROGRESS", "Operation_In_Progress", EINPROGRESS);
#else
GDFLT2("EINPROGRESS", "Operation_In_Progress");
#endif
#ifdef EINTR
GCST2("EINTR", "Interrupted_Operation", EINTR);
#else
GDFLT2("EINTR", "Interrupted_Operation");
#endif
#ifdef EINVAL
GCST2("EINVAL", "Invalid_Argument", EINVAL);
#else
GDFLT2("EINVAL", "Invalid_Argument");
#endif
#ifdef EIO
GCST2("EIO", "Input_Output_Error", EIO);
#else
GDFLT2("EIO", "Input_Output_Error");
#endif
#ifdef EISCONN
GCST2("EISCONN", "Is_Already_Connected", EISCONN);
#else
GDFLT2("EISCONN", "Is_Already_Connected");
#endif
#ifdef EISDIR
GCST2("EISDIR", "Is_A_Directory", EISDIR);
#else
GDFLT2("EISDIR", "Is_A_Directory");
#endif
#ifdef EMFILE
GCST2("EMFILE", "Too_Many_Open_Files", EMFILE);
#else
GDFLT2("EMFILE", "Too_Many_Open_Files");
#endif
#ifdef EMLINK
GCST2("EMLINK", "Too_Many_Links", EMLINK);
#else
GDFLT2("EMLINK", "Too_Many_Links");
#endif
#ifdef EMSGSIZE
GCST2("EMSGSIZE", "Message_Too_Long", EMSGSIZE);
#else
GDFLT2("EMSGSIZE", "Message_Too_Long");
#endif
#ifdef ENAMETOOLONG
GCST2("ENAMETOOLONG", "Filename_Too_Long", ENAMETOOLONG);
#else
GDFLT2("ENAMETOOLONG", "Filename_Too_Long");
#endif
#ifdef ENETDOWN
GCST2("ENETDOWN", "Network_Down", ENETDOWN);
#else
GDFLT2("ENETDOWN", "Network_Down");
#endif
#ifdef ENETRESET
GCST2("ENETRESET", "Network_Reset", ENETRESET);
#else
GDFLT2("ENETRESET", "Network_Reset");
#endif
#ifdef ENETUNREACH
GCST2("ENETUNREACH", "Network_Unreachable", ENETUNREACH);
#else
GDFLT2("ENETUNREACH", "Network_Unreachable");
#endif
#ifdef ENFILE
GCST2("ENFILE", "Too_Many_Open_Files_In_System", ENFILE);
#else
GDFLT2("ENFILE", "Too_Many_Open_Files_In_System");
#endif
#ifdef ENOBUFS
GCST2("ENOBUFS", "No_Buffer_Space", ENOBUFS);
#else
GDFLT2("ENOBUFS", "No_Buffer_Space");
#endif
#ifdef ENODEV
GCST2("ENODEV", "No_Such_Operation_On_Device", ENODEV);
#else
GDFLT2("ENODEV", "No_Such_Operation_On_Device");
#endif
#ifdef ENOENT
GCST2("ENOENT", "No_Such_File_Or_Directory", ENOENT);
#else
GDFLT2("ENOENT", "No_Such_File_Or_Directory");
#endif
#ifdef ENOPROTOOPT
GCST2("ENOPROTOOPT", "Unknown_Protocol_Option", ENOPROTOOPT);
#else
GDFLT2("ENOPROTOOPT", "Unknown_Protocol_Option");
#endif
#ifdef ENOEXEC
GCST2("ENOEXEC", "Exec_Format_Error", ENOEXEC);
#else
GDFLT2("ENOEXEC", "Exec_Format_Error");
#endif
#ifdef ENOLCK
GCST2("ENOLCK", "No_Locks_Available", ENOLCK);
#else
GDFLT2("ENOLCK", "No_Locks_Available");
#endif
#ifdef ENOMEM
GCST2("ENOMEM", "Not_Enough_Space", ENOMEM);
#else
GDFLT2("ENOMEM", "Not_Enough_Space");
#endif
#ifdef ENOSPC
GCST2("ENOSPC", "No_Space_Left_On_Device", ENOSPC);
#else
GDFLT2("ENOSPC", "No_Space_Left_On_Device");
#endif
#ifdef ENOTCONN
GCST2("ENOTCONN", "Not_Connected", ENOTCONN);
#else
GDFLT2("ENOTCONN", "Not_Connected");
#endif
#ifdef ENOTSOCK
GCST2("ENOTSOCK", "Not_A_Socket", ENOTSOCK);
#else
GDFLT2("ENOTSOCK", "Not_A_Socket");
#endif
#ifdef ENOTSUP
GCST2("ENOTSUP", "Operation_Not_Supported", ENOTSUP);
#else
NON_SUPPORT_MESSAGE("ENOTSUP");
GCST2("ENOTSUP", "Operation_Not_Supported", ENOSYS);
#endif
#ifdef ENOTDIR
GCST2("ENOTDIR", "Not_A_Directory", ENOTDIR);
#else
GDFLT2("ENOTDIR", "Not_A_Directory");
#endif
#ifdef ENOTEMPTY
GCST2("ENOTEMPTY", "Directory_Not_Empty", ENOTEMPTY);
#else
GDFLT2("ENOTEMPTY", "Directory_Not_Empty");
#endif
#ifdef ENOSYS
GCST2("ENOSYS", "Operation_Not_Implemented", ENOSYS);
#else
GDFLT2("ENOSYS", "Operation_Not_Supported");
#endif
#ifdef ENOTTY
GCST2("ENOTTY", "Inappropriate_IO_Control_Operation", ENOTTY);
#else
GDFLT2("ENOTTY", "Inappropriate_IO_Control_Operation");
#endif
#ifdef ENXIO
GCST2("ENXIO", "No_Such_Device_Or_Address", ENXIO);
#else
GDFLT2("ENXIO", "No_Such_Device_Or_Address");
#endif
#ifdef EOPNOTSUPP
GCST2("EOPNOTSUPP", "Option_Not_Supported", EOPNOTSUPP);
#else
GDFLT2("EOPNOTSUPP", "Option_Not_Supported");
#endif
#ifdef EPERM
GCST2("EPERM", "Operation_Not_Permitted", EPERM);
#else
GDFLT2("EPERM", "Operation_Not_Permitted");
#endif
#ifdef EPIPE
GCST2("EPIPE", "Broken_Pipe", EPIPE);
#else
GDFLT2("EPIPE", "Broken_Pipe");
#endif
#ifdef EPROTONOSUPPORT
GCST2("EPROTONOSUPPORT", "Protocol_Not_Supported", EPROTONOSUPPORT);
#else
GDFLT2("EPROTONOSUPPORT", "Protocol_Not_Supported");
#endif
#ifdef EPROTOTYPE
GCST2("EPROTOTYPE", "Wrong_Protocol_Type", EPROTOTYPE);
#else
GDFLT2("EPROTOTYPE", "Wrong_Protocol_Type");
#endif
/* .... what is ERANGE? .... */
#ifdef ERANGE
GCST2("ERANGE", "TBD2", ERANGE);
#else
GDFLT2("ERANGE", "TBD2");
#endif
#ifdef EROFS
GCST2("EROFS", "Read_Only_File_System", EROFS);
#else
GDFLT2("EROFS", "Read_Only_File_System");
#endif
#ifdef ESOCKTNOSUPPORT
GCST2("ESOCKTNOSUPPORT", "Socket_Not_Supported", ESOCKTNOSUPPORT);
#else
GDFLT2("ESOCKTNOSUPPORT", "Socket_Not_Supported");
#endif
#ifdef ESPIPE
GCST2("ESPIPE", "Invalid_Seek", ESPIPE);
#else
GDFLT2("ESPIPE", "Invalid_Seek");
#endif
#ifdef ESRCH
GCST2("ESRCH", "No_Such_Process", ESRCH);
#else
GDFLT2("ESRCH", "No_Such_Process");
#endif
#ifdef ETIMEDOUT
GCST2("ETIMEDOUT", "Timed_Out", ETIMEDOUT);
#else
GDFLT2("ETIMEDOUT", "Timed_Out");
#endif
#ifdef EWOULDBLOCK
GCST2("EWOULDBLOCK", "Would_Block", EWOULDBLOCK);
#else
GDFLT2("EWOULDBLOCK", "Would_Block");
#endif
#ifdef EXDEV
GCST2("EXDEV", "Improper_Link", EXDEV);
#else
GDFLT2("EXDEV", "Improper_Link");
#endif
#ifdef HOST_NOT_FOUND
GCST("Host_Not_Found", HOST_NOT_FOUND);
#else
GDFLT("Host_Not_Found", -1);
#endif
#ifdef NO_DATA
GCST2("NO_DATA", "No_Address_Available", NO_DATA);
#else
GDFLT2("NO_DATA", "No_Address_Available");
#endif
#ifdef NO_RECOVERY
GCST2("NO_RECOVERY", "Unrecoverable_Error", NO_RECOVERY);
#else
GDFLT2("NO_RECOVERY", "Unrecoverable_Error");
#endif
max_posix_error = max_GCST2;
EAI_Error_First = 10000; /* Start with a bias of 10000 */
while (1) {
if (EAI_Error_First > max_posix_error) {
break;
} else {
EAI_Error_First = EAI_Error_First * 10;
} /* end if */
} /* end while */
max_GCST2 = EAI_Error_First;
#ifdef EAI_ADDRFAMILY
GCST2("EAI_ADDRFAMILY", "Unknown_Address_Type",
EAI_ADDRFAMILY+EAI_Error_First);
#else
GDFLT2("EAI_ADDRFAMILY", "Unknown_Address_Type");
#endif
#ifdef EAI_AGAIN
GCST2("EAI_AGAIN", "Try_Again",
EAI_AGAIN+EAI_Error_First);
#else
GDFLT2("EAI_AGAIN", "Try_Again");
#endif
#ifdef EAI_BADFLAGS
GCST2("EAI_BADFLAGS", "Invalid_Flags",
EAI_BADFLAGS+EAI_Error_First);
#else
GDFLT2("EAI_BADFLAGS", "Invalid_Flags");
#endif
#ifdef EAI_FAIL
GCST2("EAI_FAIL", "Name_Failed",
EAI_FAIL+EAI_Error_First);
#else
GDFLT2("EAI_FAIL", "Name_Failed");
#endif
#ifdef EAI_FAMILY
GCST2("EAI_FAMILY", "Unknown_Protocol_Family",
EAI_FAMILY+EAI_Error_First);
#else
GDFLT2("EAI_FAMILY", "Unknown_Protocol_Family");
#endif
#ifdef EAI_MEMORY
GCST2("EAI_MEMORY", "Memory_Allocation_Failed",
EAI_MEMORY+EAI_Error_First);
#else
GDFLT2("EAI_MEMORY", "Memory_Allocation_Failed");
#endif
#ifdef EAI_NODATA
GCST2("EAI_NODATA", "No_Address_For_Name",
EAI_NODATA+EAI_Error_First);
#else
GDFLT2("EAI_NODATA", "No_Address_For_Name");
#endif
#ifdef EAI_NONAME
GCST2("EAI_NONAME", "Name_Not_Known",
EAI_NONAME+EAI_Error_First);
#else
GDFLT2("EAI_NONAME", "Name_Not_Known");
#endif
#ifdef EAI_SERVICE
GCST2("EAI_SERVICE", "Service_Not_Supported",
EAI_SERVICE+EAI_Error_First);
#else
GDFLT2("EAI_SERVICE", "Service_Not_Supported");
#endif
#ifdef EAI_SOCKTYPE
GCST2("EAI_SOCKTYPE", "Unknown_Socket_Type",
EAI_SOCKTYPE+EAI_Error_First);
#else
GDFLT2("EAI_SOCKTYPE", "Unknown_Socket_Type");
#endif
EAI_Error_Last = max_GCST2;
XTI_Error_First = 100000; /* Start with a bias of 100000 */
while (1) {
if (XTI_Error_First > max_posix_error) {
break;
} else {
XTI_Error_First = XTI_Error_First * 10;
} /* end if */
} /* end while */
ifprintf(fp," subtype Addrinfo_Error_Code is Error_Code\n");
ifprintf(fp," range %d .. %d;\n", EAI_Error_First, EAI_Error_Last);
max_GCST2 = XTI_Error_First;
#ifdef TACCES
GCST2("TACCES", "Insufficient_Permission", TACCES+XTI_Error_First);
#else
GDFLT2("TACCES", "Insufficient_Permission");
#endif
#ifdef TADDRBUSY
GCST2("TADDRBUSY", "XTI_Address_In_Use", TADDRBUSY+XTI_Error_First);
#else
GDFLT2("TADDRBUSY", "XTI_Address_In_Use");
#endif
#ifdef TBADADDR
GCST2("TBADADDR", "Incorrect_Address_Format", TBADADDR+XTI_Error_First);
#else
GDFLT2("TBADADDR", "Incorrect_Address_Format");
#endif
#ifdef TBADDATA
GCST2("TBADDATA", "Illegal_Data_Range", TBADDATA+XTI_Error_First);
#else
GDFLT2("TBADDATA", "Illegal_Data_Range");
#endif
#ifdef TBADF
GCST2("TBADF", "Invalid_File_Descriptor", TBADF+XTI_Error_First);
#else
GDFLT2("TBADF", "Invalid_File_Descriptor");
#endif
#ifdef TBADFLAG
GCST2("TBADFLAG", "Invalid_Flag", TBADFLAG+XTI_Error_First);
#else
GDFLT2("TBADFLAG", "Invalid_Flag");
#endif
#ifdef TBADNAME
GCST2("TBADNAME", "Invalid_Communications_Provider",
TBADNAME+XTI_Error_First);
#else
GDFLT2("TBADNAME", "Invalid_Communications_Provider");
#endif
#ifdef TBADOPT
GCST2("TBADOPT", "Incorrect_Or_Illegal_Option", TBADOPT+XTI_Error_First);
#else
GDFLT2("TBADOPT", "Incorrect_Or_Illegal_Option");
#endif
#ifdef TBADQLEN
GCST2("TBADQLEN", "Endpoint_Queue_Length_Is_Zero", TBADQLEN+XTI_Error_First);
#else
GDFLT2("TBADQLEN", "Endpoint_Queue_Length_Is_Zero");
#endif
#ifdef TBADSEQ
GCST2("TBADSEQ", "Invalid_Sequence_Number", TBADSEQ+XTI_Error_First);
#else
GDFLT2("TBADSEQ", "Invalid_Sequence_Number");
#endif
#ifdef TBUFOVFLW
GCST2("TBUFOVFLW", "Buffer_Not_Large_Enough", TBUFOVFLW+XTI_Error_First);
#else
GDFLT2("TBUFOVFLW", "Buffer_Not_Large_Enough");
#endif
#ifdef TFLOW
GCST2("TFLOW", "Flow_Control_Error", TFLOW+XTI_Error_First);
#else
GDFLT2("TFLOW", "Flow_Control_Error");
#endif
#ifdef TINDOUT
GCST2("TINDOUT", "Outstanding_Connection_Indications",
TINDOUT+XTI_Error_First);
#else
GDFLT2("TINDOUT", "Outstanding_Connection_Indications");
#endif
#ifdef TLOOK
GCST2("TLOOK", "Event_Requires_Attention", TLOOK+XTI_Error_First);
#else
GDFLT2("TLOOK", "Event_Requires_Attention");
#endif
#ifdef TNOADDR
GCST2("TNOADDR", "Could_Not_Allocate_Address", TNOADDR+XTI_Error_First);
#else
GDFLT2("TNOADDR", "Could_Not_Allocate_Address");
#endif
#ifdef TNODATA
GCST2("TNODATA", "No_Data_Available", TNODATA+XTI_Error_First);
#else
GDFLT2("TNODATA", "No_Data_Available");
#endif
#ifdef TNODIS
GCST2("TNODIS", "No_Disconnect_Indication_On_Endpoint",
TNODIS+XTI_Error_First);
#else
GDFLT2("TNODIS", "No_Disconnect_Indication_On_Endpoint");
#endif
#ifdef TPROVMISMATCH
GCST2("TPROVMISMATCH", "Communications_Provider_Mismatch",
TPROVMISMATCH+XTI_Error_First);
#else
GDFLT2("TPROVMISMATCH", "Communications_Provider_Mismatch");
#endif
#ifdef TNOREL
GCST2("TNOREL", "No_Orderly_Release_Indication_On_Endpoint",
TNOREL+XTI_Error_First);
#else
GDFLT2("TNOREL", "No_Orderly_Release_Indication_On_Endpoint");
#endif
#ifdef TNOSTRUCTYPE
GCST2("TNOSTRUCTYPE", "Unsupported_Object_Type_Requested",
TNOSTRUCTYPE+XTI_Error_First);
#else
GDFLT2("TNOSTRUCTYPE", "Unsupported_Object_Type_Requested");
#endif
#ifdef TNOTSUPPORT
GCST2("TNOTSUPPORT", "Function_Not_Supported", TNOTSUPPORT+XTI_Error_First);
#else
GDFLT2("TNOTSUPPORT", "Function_Not_Supported");
#endif
#ifdef TNOUDERR
GCST2("TNOUDERR", "No_Unitdata_Error_On_Endpoint",
TNOUDERR+XTI_Error_First);
#else
GDFLT2("TNOUDERR", "No_Unitdata_Error_On_Endpoint");
#endif
#ifdef TOUTSTATE
GCST2("TOUTSTATE", "Function_Not_Valid_For_State",
TOUTSTATE+XTI_Error_First);
#else
GDFLT2("TOUTSTATE", "Function_Not_Valid_For_State");
#endif
#ifdef TPROTO
GCST2("TPROTO", "Protocol_Error", TPROTO+XTI_Error_First);
#else
GDFLT2("TPROTO", "Protocol_Error");
#endif
#ifdef TQFULL
GCST2("TQFULL", "Endpoint_Queue_Full", TQFULL+XTI_Error_First);
#else
GDFLT2("TQFULL", "Endpoint_Queue_Full");
#endif
#ifdef TSTATECHNG
GCST2("TSTATECHNG", "State_Change_In_Progress",
TSTATECHNG+XTI_Error_First);
#else
GDFLT2("TSTATECHNG", "State_Change_In_Progress");
#endif
#ifdef TRESADDR
GCST2("TRESADDR", "Surrogate_File_Descriptor_Mismatch",
TRESADDR+XTI_Error_First);
#else
GDFLT2("TRESADDR", "Surrogate_File_Descriptor_Mismatch");
#endif
#ifdef TRESQLEN
GCST2("TRESQLEN", "Incorrect_Surrogate_Queue_Length",
TRESQLEN+XTI_Error_First);
#else
GDFLT2("TRESQLEN", "Incorrect_Surrogate_Queue_Length");
#endif
XTI_Error_Last = max_GCST2;
ifprintf(fp," subtype XTI_Error_Code is Error_Code\n");
ifprintf(fp," range %d .. %d;\n", XTI_Error_First, XTI_Error_Last);
ifprintf(fp," -- System Identification\n");
ifprintf(fp," function System_Name return POSIX_String;\n");
ifprintf(fp," function Node_Name return POSIX_String;\n");
ifprintf(fp," function Release return POSIX_String;\n");
ifprintf(fp," function Version return POSIX_String;\n");
ifprintf(fp," function Machine return POSIX_String;\n");
ifprintf(fp," type Seconds is new Integer;\n");
ifprintf(fp," type Minutes is new Integer;\n");
ifprintf(fp," type Nanoseconds_Base is new Integer;\n");
ifprintf(fp," subtype Nanoseconds is ");
ifprintf(fp,"Nanoseconds_Base range 0 .. (10**9) - 1;\n");
ifprintf(fp," type Timespec is private;\n");
ifprintf(fp," function Get_Seconds (Time : Timespec) return Seconds;\n");
ifprintf(fp," procedure Set_Seconds\n");
ifprintf(fp," (Time : in out Timespec;\n");
ifprintf(fp," S : Seconds);\n");
ifprintf(fp," function Get_Nanoseconds (Time : Timespec) ");
ifprintf(fp,"return Nanoseconds;\n");
ifprintf(fp," procedure Set_Nanoseconds\n");
ifprintf(fp," (Time : in out Timespec;\n");
ifprintf(fp," NS : Nanoseconds);\n");
ifprintf(fp," procedure Split\n");
ifprintf(fp," (Time : Timespec;\n");
ifprintf(fp," S : out Seconds;\n");
ifprintf(fp," NS : out Nanoseconds);\n");
ifprintf(fp," function To_Timespec\n");
ifprintf(fp," (S : Seconds;\n");
ifprintf(fp," NS : Nanoseconds) return Timespec;\n");
ifprintf(fp," function \"+\" (Left, Right : Timespec) return Timespec;\n");
ifprintf(fp," function \"+\" (Left : Timespec; Right : Nanoseconds)\n");
ifprintf(fp," return Timespec;\n");
ifprintf(fp," function \"-\" (Right : Timespec) return Timespec;\n");
ifprintf(fp," function \"-\" (Left, Right : Timespec) return Timespec;\n");
ifprintf(fp," function \"-\" (Left : Timespec; Right : Nanoseconds)\n");
ifprintf(fp," return Timespec;\n");
ifprintf(fp," function \"*\" (Left : Timespec; Right : Integer)\n");
ifprintf(fp," return Timespec;\n");
ifprintf(fp," function \"*\" (Left : Integer; Right : Timespec)\n");
ifprintf(fp," return Timespec;\n");
ifprintf(fp," function \"/\" (Left : Timespec; Right : Integer)\n");
ifprintf(fp," return Timespec;\n");
ifprintf(fp," function \"/\" (Left, Right : Timespec) return Integer;\n");
ifprintf(fp," function \"<\" (Left, Right : Timespec) return Boolean;\n");
ifprintf(fp," function \"<=\" (Left, Right : Timespec) return Boolean;\n");
ifprintf(fp," function \">\" (Left, Right : Timespec) return Boolean;\n");
ifprintf(fp," function \">=\" (Left, Right : Timespec) return Boolean;\n");
ifprintf(fp," function To_Duration (Time : Timespec) return Duration;\n");
ifprintf(fp," -- pragma Inline (To_Duration);\n");
ifprintf(fp," function To_Timespec (D : Duration) return Timespec;\n");
ifprintf(fp," -- pragma Inline (To_Timespec);\n");
ghdrcmnt("Host-Network Byte Order Conversions");
/* we need 32-bit and a 16-bit unsigned integer types
*/
if (sizeof (unsigned int) == 4) {
if (sizeof (unsigned short) == 2) {
/* uint32_t -> unsigned int
uint16_t -> unsigned int
*/
union {
unsigned int l;
unsigned char c[4];
} x;
x.c[0] = 0; x.c[1] = 1; x.c[2] = 2; x.c[3] = 3;
if (x.l == 0x00010203) {
network_byte_order = 1;
ifprintf(fp," Host_Byte_Order_Is_Net_Byte_Order"
" : Boolean := True;\n\n");
} else {
network_byte_order = 0;
ifprintf(fp," Host_Byte_Order_Is_Net_Byte_Order"
" : Boolean := False;\n\n");
}
} else quit ("short is not 16-bit","");
} else quit ("int is not 32-bit","");
ifprintf(fp," function Host_To_Network_Byte_Order");
ifprintf(fp," (Host_32 : Interfaces.Unsigned_32)\n");
ifprintf(fp," return Interfaces.Unsigned_32;\n");
ifprintf(fp," function Host_To_Network_Byte_Order");
ifprintf(fp," (Host_16 : Interfaces.Unsigned_16)\n");
ifprintf(fp," return Interfaces.Unsigned_16;\n");
ifprintf(fp," function Network_To_Host_Byte_Order");
ifprintf(fp," (Host_32 : Interfaces.Unsigned_32)\n");
ifprintf(fp," return Interfaces.Unsigned_32;\n");
ifprintf(fp," function Network_To_Host_Byte_Order");
ifprintf(fp," (Host_16 : Interfaces.Unsigned_16)\n");
ifprintf(fp," return Interfaces.Unsigned_16;\n");
ifprintf(fp," XTI_Blocking_Behavior : constant Blocking_Behavior\n");
ifprintf(fp," := Tasks;\n");
ifprintf(fp," Sockets_Blocking_Behavior :"
" constant Blocking_Behavior\n");
ifprintf(fp," := Tasks;\n");
ghdrcmnt("Octet declarations");
ifprintf(fp," type Octet is mod 2 ** 8;\n");
ifprintf(fp," type Octet_Array is\n");
ifprintf(fp," array (Integer range <>) of aliased Octet;\n");
ifprintf(fp," type Octet_Array_Pointer is access all Octet_Array;\n");
ifprintf(fp,"private\n");
#ifdef VERSION
ifprintf(fp," Florist_Version : constant String := \""VERSION"\";\n\n");
#endif
ifprintf(fp," type String_List;\n");
ifprintf(fp," -- See package body for comments on String_List.\n");
ifprintf(fp," type POSIX_String_List is access all String_List;\n");
ifprintf(fp," pragma No_Strict_Aliasing (POSIX_String_List);\n");
ifprintf(fp," Empty_String_List : constant POSIX_String_List"
" := null;\n\n");
ifprintf(fp," type Timespec is record\n");
ifprintf(fp," Val : Duration := 0.0;\n");
ifprintf(fp," end record;\n");
ifprintf(fp," -- The value is of type Duration because we can do more\n");
ifprintf(fp," -- efficient arithmetic on that type ");
ifprintf(fp,"than on a two-part C struct.\n");
ifprintf(fp," -- We rely that GNAT implements type ");
ifprintf(fp,"Duration with enough\n");
ifprintf(fp," -- precision (64 bits) to hold a full C timespec value.\n");
ifprintf(fp," -- The enclosing record is to permit ");
ifprintf(fp,"implicit initialization.\n");
guitp("Bits", sizeof(int));
ifprintf(fp," -- Bits and the C int type are always the same size.\n");
ifprintf(fp," -- We don't define int here,"
" since we want to be able to\n");
ifprintf(fp," -- use it in the visible parts of child packages.\n\n");
ifprintf(fp," type Option_Set is\n");
ifprintf(fp," record\n");
ifprintf(fp," Option : Bits := 0;\n");
ifprintf(fp," end record;\n");
{ int i;
for (i=1; i<32; i++) {
ifprintf(fp," Option_%d : constant Option_Set"
" := (Option => 2**%d);\n", i, i-1);
}
}
ifprintf(fp,"end POSIX;\n");
fclose (fp);
fprintf(stderr,"done generating posix.ads\n");
}
/* create_c
--------
create package POSIX.C, in file posix-c.ads
*/
void create_c() {
fprintf(stderr,"creating package POSIX.C\n");
if (! (fp = fopen (GENDIR "/posix-c.ads", "w"))) {
perror ("posix-c.ads");
quit("can't open file to write","");
}
gheader("POSIX.C", FSU_Header);
ifprintf(fp,"with System; use System;\n");
ifprintf(fp,"with Unchecked_Conversion;\n");
ifprintf(fp,"package POSIX.C is\n");
ifprintf(fp," pragma Elaborate_Body;\n");
ifprintf(fp," -- ========= --\n");
ifprintf(fp," -- WARNING --\n");
ifprintf(fp," -- ========= --\n\n");
ifprintf(fp," -- This package should NOT be used directly");
ifprintf(fp," by an application.\n");
ifprintf(fp," -- It is internal to the FLORIST implementation of the");
ifprintf(fp," POSIX.5 API,\n");
ifprintf(fp," -- and may be changed or replaced in future versions");
ifprintf(fp," of FLORIST.\n\n");
ifprintf(fp," ALIGNMENT : constant");
ifprintf(fp," := Natural'Min (Standard'Maximum_Alignment, 8);\n");
ifprintf(fp," -- worst-case alignment requirement\n");
/* numeric types
-------------
*/
ghdrcmnt("basic C types");
gsitp("short", sizeof(short));
gsitp("int", sizeof(int));
gptrtp("int","int");
guitp("unsigned", sizeof(unsigned));
gsitp("long", sizeof(long));
guitp("unsigned_long", sizeof(unsigned long));
guitp("unsigned_int", sizeof(unsigned int));
guitp("unsigned_short", sizeof(unsigned short));
guitp("caddr_t", sizeof(caddr_t));
g_size_t();
g_time_t();
g_clock_t();
gsitp("ptr_as_int", sizeof(char *));
/* char * and char **
------------------
*/
ifprintf(fp," subtype char is POSIX_Character;\n");
gptrtp("char","char");
gen_unchckd_conv("To_Ptr", "Address", "char_ptr");
gen_renaming("function To_char_ptr (Addr : Address) return char_ptr",
"To_Ptr");
gen_unchckd_conv("To_Address", "char_ptr", "Address");
gptrtp("char_ptr","char_ptr");
gen_unchckd_conv("To_Ptr", "Address", "char_ptr_ptr");
gen_unchckd_conv("To_Address", "char_ptr_ptr", "Address");
ifprintf(fp," type char_ptr_array is\n");
ifprintf(fp," array (Positive range <>) of aliased char_ptr;\n");
ifprintf(fp," function malloc (size : size_t) return char_ptr;\n");
ifprintf(fp," function malloc (size : size_t) return char_ptr_ptr;\n");
ifprintf(fp," pragma Import (C, malloc, \"malloc\");\n");
ifprintf(fp," procedure free (object : char_ptr);\n");
ifprintf(fp," procedure free (object : char_ptr_ptr);\n");
ifprintf(fp," pragma Import (C, free, \"free\");\n");
ifprintf(fp," procedure Advance (Ptr : in out char_ptr);\n");
ifprintf(fp," procedure Advance (Ptr : in out char_ptr_ptr);\n");
ifprintf(fp," -- advance Ptr to next location\n");
ifprintf(fp," -- pragma Inline (Advance);\n");
ifprintf(fp," function Form_POSIX_String (Str : char_ptr)\n");
ifprintf(fp," return POSIX_String;\n");
ifprintf(fp," -- makes new copy of string, without null terminator\n");
/* constants
---------
*/
ghdrcmnt("constants");
#ifdef AIO_ALLDONE
GCST("AIO_ALLDONE", AIO_ALLDONE);
#else
GDFLT("AIO_ALLDONE", 0);
#endif
#ifdef AIO_CANCELED
GCST("AIO_CANCELED", AIO_CANCELED);
#else
GDFLT("AIO_CANCELED", 0);
#endif
#ifdef AIO_NOTCANCELED
GCST("AIO_NOTCANCELED", AIO_NOTCANCELED);
#else
GDFLT("AIO_NOTCANCELED", 0);
#endif
#ifdef B0
GCST("B0", B0);
#else
GDFLT("B0", 0);
#endif
#ifdef B110
GCST("B110", B110);
#else
GDFLT("B110", 0);
#endif
#ifdef B115200
GCST("B115200", B115200);
#else
GDFLT("B115200", 0);
#endif
#ifdef B1200
GCST("B1200",B1200);
#else
GDFLT("B1200", 0);
#endif
#ifdef B134
GCST("B134", B134);
#else
GDFLT("B134", 0);
#endif
#ifdef B150
GCST("B150", B150);
#else
GDFLT("B150", 0);
#endif
#ifdef B1800
GCST("B1800", B1800);
#else
GDFLT("B1800", 0);
#endif
#ifdef B19200
GCST("B19200", B19200);
#else
GDFLT("B19200", 0);
#endif
#ifdef B200
GCST("B200", B200);
#else
GDFLT("B200", 0);
#endif
#ifdef B230400
GCST("B230400", B230400);
#else
GDFLT("B230400", 0);
#endif
#ifdef B2400
GCST("B2400", B2400);
#else
GDFLT("B2400", 0);
#endif
#ifdef B300
GCST("B300", B300);
#else
GDFLT("B300", 0);
#endif
#ifdef B38400
GCST("B38400", B38400);
#else
GDFLT("B38400", 0);
#endif
#ifdef B460800
GCST("B460800", B460800);
#else
GDFLT("B460800", 0);
#endif
#ifdef B4800
GCST("B4800", B4800);
#else
GDFLT("B4800", 0);
#endif
#ifdef B50
GCST("B50", B50);
#else
GDFLT("B50", 0);
#endif
#ifdef B57600
GCST("B57600", B57600);
#else
GDFLT("B57600", 0);
#endif
#ifdef B600
GCST("B600", B600);
#else
GDFLT("B600", 0);
#endif
#ifdef B75
GCST("B75", B75);
#else
GDFLT("B75", 0);
#endif
#ifdef B9600
GCST("B9600", B9600);
#else
GDFLT("B9600", 0);
#endif
#ifdef BRKINT
GCST("BRKINT", BRKINT);
#else
GDFLT("BRKINT", 0);
#endif
#ifdef CLK_TCK
GCST("CLK_TCK", CLK_TCK);
#else
GDFLT("CLK_TCK", 0);
#endif
#ifdef CLOCAL
GCST("CLOCAL", CLOCAL);
#else
GDFLT("CLOCAL", 0);
#endif
#ifdef CLOCK_REALTIME
GCST("CLOCK_REALTIME", CLOCK_REALTIME);
#else
GDFLT("CLOCK_REALTIME", 1);
#endif
#ifdef CLOCK_SGI_FAST
GCST("CLOCK_SGI_FAST", CLOCK_SGI_FAST);
#endif
#ifdef CREAD
GCST("CREAD", CREAD);
#else
GDFLT("CREAD", 0);
#endif
#ifdef CSIZE
GCST("CSIZE", CSIZE);
#else
GDFLT("CSIZE", 0);
#endif
#ifdef CSTOPB
GCST("CSTOPB", CSTOPB);
#else
GDFLT("CSTOPB", 0);
#endif
#ifdef CS5
GCST("CS5", CS5);
#else
GDFLT("CS5", 0);
#endif
#ifdef CS6
GCST("CS6", CS6);
#else
GDFLT("CS6", 0);
#endif
#ifdef CS7
GCST("CS7", CS7);
#else
GDFLT("CS7", 0);
#endif
#ifdef CS8
GCST("CS8", CS8);
#else
GDFLT("CS8", 0);
#endif
ifprintf(fp," -- error code constants are in posix.ads\n");
#ifdef ECHO
GCST("ECHO", ECHO);
#else
GDFLT("ECHO", 0);
#endif
#ifdef ECHOE
GCST("ECHOE", ECHOE);
#else
GDFLT("ECHOE", 0);
#endif
#ifdef ECHOK
GCST("ECHOK", ECHOK);
#else
GDFLT("ECHOK", 0);
#endif
#ifdef ECHONL
GCST("ECHONL", ECHONL);
#else
GDFLT("ECHONL", 0);
#endif
#ifdef FD_CLOEXEC
GCST("FD_CLOEXEC", FD_CLOEXEC);
#else
GDFLT("FD_CLOEXEC", 0);
#endif
#ifdef F_DUPFD
GCST("F_DUPFD", F_DUPFD);
#else
GDFLT("F_DUPFD", 0);
#endif
#ifdef F_GETFD
GCST("F_GETFD", F_GETFD);
#else
GDFLT("F_GETFD", 0);
#endif
#ifdef F_GETFL
GCST("F_GETFL", F_GETFL);
#else
GDFLT("F_GETFL", 0);
#endif
#ifdef F_GETLK
GCST("F_GETLK", F_GETLK);
#else
GDFLT("F_GETLK", 0);
#endif
#ifdef F_OK
GCST("F_OK", F_OK);
#else
GDFLT("F_OK", 0);
#endif
#ifdef F_RDLCK
GCST("F_RDLCK", F_RDLCK);
#else
GDFLT("F_RDLCK", 0);
#endif
#ifdef F_SETFD
GCST("F_SETFD", F_SETFD);
#else
GDFLT("F_SETFD", 0);
#endif
#ifdef F_SETFL
GCST("F_SETFL", F_SETFL);
#else
GDFLT("F_SETFL", 0);
#endif
#ifdef F_SETLK
GCST("F_SETLK", F_SETLK);
#else
GDFLT("F_SETLK", 0);
#endif
#ifdef F_SETLKW
GCST("F_SETLKW", F_SETLKW);
#else
GDFLT("F_SETLKW", 0);
#endif
#ifdef F_UNLCK
GCST("F_UNLCK", F_UNLCK);
#else
GDFLT("F_UNLCK", 0);
#endif
#ifdef F_WRLCK
GCST("F_WRLCK", F_WRLCK);
#else
GDFLT("F_WRLCK", 0);
#endif
#ifdef HUPCL
GCST("HUPCL", HUPCL);
#else
GDFLT("HUPCL", 0);
#endif
#ifdef ICANON
GCST("ICANON", ICANON);
#else
GDFLT("ICANON", 0);
#endif
#ifdef ICRNL
GCST("ICRNL", ICRNL);
#else
GDFLT("ICRNL", 0);
#endif
#ifdef IEXTEN
GUCST("IEXTEN", IEXTEN);
#else
GDFLT("IEXTEN", 0);
#endif
#ifdef IGNBRK
GCST("IGNBRK", IGNBRK);
#else
GDFLT("IGNBRK", 0);
#endif
#ifdef IGNCR
GCST("IGNCR", IGNCR);
#else
GDFLT("IGNCR", 0);
#endif
#ifdef IGNPAR
GCST("IGNPAR", IGNPAR);
#else
GDFLT("IGNPAR", 0);
#endif
#ifdef INLCR
GCST("INLCR", INLCR);
#else
GDFLT("INLCR", 0);
#endif
#ifdef INPCK
GCST("INPCK", INPCK);
#else
GDFLT("INPCK", 0);
#endif
#ifdef ISIG
GCST("ISIG", ISIG);
#else
GDFLT("ISIG", 0);
#endif
#ifdef ISTRIP
GCST("ISTRIP", ISTRIP);
#else
GDFLT("ISTRIP", 0);
#endif
#ifdef IXOFF
GCST("IXOFF", IXOFF);
#else
GDFLT("IXOFF", 0);
#endif
#ifdef IXON
GCST("IXON", IXON);
#else
GDFLT("IXON", 0);
#endif
#ifdef L_ctermid
GCST("L_ctermid", L_ctermid);
#else
GDFLT("L_ctermid", 10);
#endif
#ifdef LIO_NOP
GCST("LIO_NOP", LIO_NOP);
#else
GDFLT("LIO_NOP", 0);
#endif
#ifdef LIO_NOWAIT
GCST("LIO_NOWAIT", LIO_NOWAIT);
#else
GDFLT("LIO_NOWAIT", 0);
#endif
#ifdef LIO_READ
GCST("LIO_READ", LIO_READ);
#else
GDFLT("LIO_READ", 0);
#endif
#ifdef LIO_WAIT
GCST("LIO_WAIT", LIO_WAIT);
#else
GDFLT("LIO_WAIT", 0);
#endif
#ifdef LIO_WRITE
GCST("LIO_WRITE", LIO_WRITE);
#else
GDFLT("LIO_WRITE", 0);
#endif
#ifdef MAP_FAILED
GCST("MAP_FAILED", MAP_FAILED);
#else
GDFLT("MAP_FAILED",-1);
#endif
/* Linux wants MAP_FILE flag if we are memory-mapping
a file. We define it to be zero for other systems.
*/
#ifdef MAP_FILE
GCST("MAP_FILE", MAP_FILE);
#else
GDFLT("MAP_FILE", 0);
#endif
#ifdef MAP_FIXED
GCST("MAP_FIXED", MAP_FIXED);
#else
GDFLT("MAP_FIXED", 0);
#endif
#ifdef MAP_VARIABLE
GCST("MAP_VARIABLE", MAP_VARIABLE);
#else
GDFLT("MAP_VARIABLE", 0);
#endif
#ifdef MAP_PRIVATE
GCST("MAP_PRIVATE", MAP_PRIVATE);
#else
GDFLT("MAP_PRIVATE", 0);
#endif
#ifdef MAP_SHARED
GCST("MAP_SHARED", MAP_SHARED);
#else
GDFLT("MAP_SHARED", 0);
#endif
#ifdef MAX_CANON
GCST("MAX_CANON", MAX_CANON);
#else
GDFLT("MAX_CANON", 0);
#endif
#ifdef MAX_INPUT
GCST("MAX_INPUT", MAX_INPUT);
#else
GDFLT("MAX_INPUT", 0);
#endif
#ifdef MCL_CURRENT
GCST("MCL_CURRENT", MCL_CURRENT);
#else
GDFLT("MCL_CURRENT", 0);
#endif
#ifdef MCL_FUTURE
GCST("MCL_FUTURE", MCL_FUTURE);
#else
GDFLT("MCL_FUTURE", 0);
#endif
#ifdef MS_ASYNC
GCST("MS_ASYNC", MS_ASYNC);
#else
GDFLT("MS_ASYNC", 0);
#endif
#ifdef MS_INVALIDATE
GCST("MS_INVALIDATE", MS_INVALIDATE);
#else
GDFLT("MS_INVALIDATE", 0);
#endif
#ifdef MS_SYNC
GCST("MS_SYNC", MS_SYNC);
#else
GDFLT("MS_SYNC", 0);
#endif
#ifdef MS_EINTR
GCST("MS_EINTR", MS_EINTR);
#else
GDFLT("MS_EINTR", 0);
#endif
#ifdef NCCS
GCST("NCCS", NCCS);
#else
GDFLT("NCCS", 0);
#endif
#ifdef NOFLSH
GUCST("NOFLSH", NOFLSH);
#else
GDFLT("NOFLSH", 0);
#endif
#ifdef OPOST
GCST("OPOST", OPOST);
#else
GDFLT("OPOST", 0);
#endif
#ifdef O_ACCMODE
GCST("O_ACCMODE", O_ACCMODE);
#else
GDFLT("O_ACCMODE", 0);
#endif
#ifdef O_APPEND
GCST("O_APPEND", O_APPEND);
#else
GDFLT("O_APPEND", 0);
#endif
#ifdef O_CREAT
GCST("O_CREAT", O_CREAT);
#else
GDFLT("O_CREAT", 0);
#endif
#ifdef O_DSYNC
GCST("O_DSYNC", O_DSYNC);
#else
GDFLT("O_DSYNC", 0);
#endif
#ifdef O_EXCL
GCST("O_EXCL", O_EXCL);
#else
GDFLT("O_EXCL", 0);
#endif
#ifdef O_NOCTTY
GCST("O_NOCTTY", O_NOCTTY);
#else
GDFLT("O_NOCTTY", 0);
#endif
#ifdef O_NONBLOCK
GCST("O_NONBLOCK", O_NONBLOCK);
#else
GDFLT("O_NONBLOCK", 0);
#endif
#ifdef O_RDONLY
GCST("O_RDONLY", O_RDONLY);
#else
GDFLT("O_RDONLY", 0);
#endif
#ifdef O_RDWR
GCST("O_RDWR", O_RDWR);
#else
GDFLT("O_RDWR", 0);
#endif
#ifdef O_RSYNC
GCST("O_RSYNC", O_RSYNC);
#else
GDFLT("O_RSYNC", 0);
#endif
#ifdef O_SYNC
GCST("O_SYNC", O_SYNC);
#else
GDFLT("O_SYNC", 0);
#endif
#ifdef O_TRUNC
GCST("O_TRUNC", O_TRUNC);
#else
GDFLT("O_TRUNC", 0);
#endif
#ifdef O_WRONLY
GCST("O_WRONLY", O_WRONLY);
#else
GDFLT("O_WRONLY", 0);
#endif
#ifdef PAGESIZE
GCST("PAGESIZE", PAGESIZE);
#else
#ifdef PAGE_SIZE
GCST("PAGESIZE", PAGE_SIZE);
#else
GDFLT("PAGESIZE", 0);
#endif
#endif
#ifdef PARENB
GCST("PARENB", PARENB);
#else
GDFLT("PARENB", 0);
#endif
#ifdef PARMRK
GCST("PARMRK", PARMRK);
#else
GDFLT("PARMRK", 0);
#endif
#ifdef PARODD
GCST("PARODD", PARODD);
#else
GDFLT("PARODD", 0);
#endif
#ifdef PROT_EXEC
GCST("PROT_EXEC", PROT_EXEC);
#else
GDFLT("PROT_EXEC", 0);
#endif
#ifdef PROT_NONE
GCST("PROT_NONE", PROT_NONE);
#else
GDFLT("PROT_NONE", 0);
#endif
#ifdef PROT_READ
GCST("PROT_READ", PROT_READ);
#else
GDFLT("PROT_READ", 0);
#endif
#ifdef PROT_WRITE
GCST("PROT_WRITE", PROT_WRITE);
#else
GDFLT("PROT_WRITE", 0);
#endif
#ifdef PTHREAD_DESTRUCTOR_ITERATIONS
GCST("PTHREAD_DESTRUCTOR_ITERATIONS", PTHREAD_DESTRUCTOR_ITERATIONS);
#else
GDFLT("PTHREAD_DESTRUCTOR_ITERATIONS", 0);
#endif
#ifdef PTHREAD_EXPLICIT_SCHED
GCST("PTHREAD_EXPLICIT_SCHED", PTHREAD_EXPLICIT_SCHED);
#else
GDFLT("PTHREAD_EXPLICIT_SCHED", 0);
#endif
#ifdef PTHREAD_INHERIT_SCHED
GCST("PTHREAD_INHERIT_SCHED", PTHREAD_INHERIT_SCHED);
#else
GDFLT("PTHREAD_INHERIT_SCHED", 0);
#endif
#ifdef PTHREAD_PRIO_INHERIT
GCST("PTHREAD_PRIO_INHERIT", PTHREAD_PRIO_INHERIT);
#else
GDFLT("PTHREAD_PRIO_INHERIT", 0);
#endif
#ifdef PTHREAD_PRIO_NONE
GCST("PTHREAD_PRIO_NONE", PTHREAD_PRIO_NONE);
#else
GDFLT("PTHREAD_PRIO_NONE", 0);
#endif
#ifdef PTHREAD_PRIO_PROTECT
GCST("PTHREAD_PRIO_PROTECT", PTHREAD_PRIO_PROTECT);
#else
GDFLT("PTHREAD_PRIO_PROTECT", 0);
#endif
#ifdef PTHREAD_PROCESS_SHARED
GCST("PTHREAD_PROCESS_SHARED", PTHREAD_PROCESS_SHARED);
GCST("PTHREAD_PROCESS_PRIVATE", PTHREAD_PROCESS_PRIVATE);
#else
GDFLT("PTHREAD_PROCESS_SHARED", 1);
GDFLT("PTHREAD_PROCESS_PRIVATE", 0);
#endif
#ifdef PTHREAD_SCOPE_PROCESS
GCST("PTHREAD_SCOPE_PROCESS", PTHREAD_SCOPE_PROCESS);
#else
GDFLT("PTHREAD_SCOPE_PROCESS", 0);
#endif
#ifdef PTHREAD_SCOPE_SYSTEM
GCST("PTHREAD_SCOPE_SYSTEM", PTHREAD_SCOPE_SYSTEM);
#else
GDFLT("PTHREAD_SCOPE_SYSTEM", 0);
#endif
#ifdef R_OK
GCST("R_OK", R_OK);
#else
GDFLT("R_OK", 0);
#endif
#ifdef SA_NOCLDSTOP
GCST("SA_NOCLDSTOP", SA_NOCLDSTOP);
#else
GDFLT("SA_NOCLDSTOP", 0);
#endif
#ifdef SA_SIGINFO
GCST("SA_SIGINFO", SA_SIGINFO);
#else
GDFLT("SA_SIGINFO", 0);
#endif
#ifdef SCHED_FIFO
GCST("SCHED_FIFO", SCHED_FIFO);
#else
GDFLT("SCHED_FIFO", 0);
#endif
#ifdef SCHED_OTHER
GCST("SCHED_OTHER", SCHED_OTHER);
#else
GDFLT("SCHED_OTHER", 0);
#endif
#ifdef SCHED_RR
GCST("SCHED_RR", SCHED_RR);
#else
GDFLT("SCHED_RR", 0);
#endif
#ifdef SEEK_CUR
GCST("SEEK_CUR", SEEK_CUR);
#else
GDFLT("SEEK_CUR", 0);
#endif
#ifdef SEEK_END
GCST("SEEK_END", SEEK_END);
#else
GDFLT("SEEK_END", 0);
#endif
#ifdef SEEK_SET
GCST("SEEK_SET", SEEK_SET);
#else
GDFLT("SEEK_SET", 0);
#endif
#ifdef SIGABRT
GCST("SIGABRT", SIGABRT);
#else
GDFLT("SIGABRT", 0);
#endif
#ifdef SIGALRM
GCST("SIGALRM", SIGALRM);
#else
GDFLT("SIGALRM", 0);
#endif
#ifdef SIGBUS
GCST("SIGBUS", SIGBUS);
#else
GDFLT("SIGBUS", 0);
#endif
#ifdef SIGCHLD
GCST("SIGCHLD", SIGCHLD);
#else
GDFLT("SIGCHLD", 0);
#endif
#ifdef SIGCONT
GCST("SIGCONT", SIGCONT);
#else
GDFLT("SIGCONT", 0);
#endif
#ifdef SIGEV_NONE
GCST("SIGEV_NONE", SIGEV_NONE);
#else
GDFLT("SIGEV_NONE", 100);
#endif
#ifdef SIGEV_SIGNAL
GCST("SIGEV_SIGNAL", SIGEV_SIGNAL);
#else
GDFLT("SIGEV_SIGNAL", 101);
#endif
#ifdef SIGEV_THREAD
GCST("SIGEV_THREAD", SIGEV_THREAD);
#else
GDFLT("SIGEV_THREAD", 102);
#endif
#ifdef SIGFPE
GCST("SIGFPE", SIGFPE);
#else
GDFLT("SIGFPE", 0);
#endif
#ifdef SIGHUP
GCST("SIGHUP", SIGHUP);
#else
GDFLT("SIGHUP", 0);
#endif
#ifdef SIGILL
GCST("SIGILL", SIGILL);
#else
GDFLT("SIGILL", 0);
#endif
#ifdef SIGINT
GCST("SIGINT", SIGINT);
#else
GDFLT("SIGINT", 0);
#endif
#ifdef SIGIO
GCST("SIGIO", SIGIO);
#else
GDFLT("SIGIO", 0);
#endif
#ifdef SIGKILL
GCST("SIGKILL", SIGKILL);
#else
GDFLT("SIGKILL", 0);
#endif
#ifdef SIGPIPE
GCST("SIGPIPE", SIGPIPE);
#else
GDFLT("SIGPIPE", 0);
#endif
#ifdef SIGQUIT
GCST("SIGQUIT", SIGQUIT);
#else
GDFLT("SIGQUIT", 0);
#endif
/* Try to find out the range of valid signals.
We have not yet discovered a portable C way of doing this.
We assume the range starts at 0 and is continuous up to some
limit.
We need this becuase we want to represent sets of signals as
Boolean arrays.
We considered using sigset_t directly, and would have liked
to do so, but had two problems:
(1) sigset_t apparently allows the use of dynamically allocated memory
(2) we could not figure out how to check for signal validity;
in particular, we needed a way to check for whether a given signal
is reserved by the Ada runtime system.
*/
#if defined(__APPLE__)
# define BADSIG 0
#else
# define BADSIG (-1)
#endif
{sigset_t set;
int sig;
int result;
int last_good = -1;
int first_bad = -1;
sigfillset (&set);
for (sig = 0; sig < 1024; sig++) {
result = sigismember (&set, sig);
if (result == 1) last_good = sig;
else if ((result == BADSIG) && (first_bad = -1)) first_bad = sig;
}
if (last_good == 1023)
printf("c-posix: WARNING: signal range estimate probably too small\n");
if (first_bad < last_good) {
printf("c-posix: WARNING: signal range estimate may be invalid\n");
last_good = first_bad - 1;
}
#if defined(__APPLE__)
/* On Darwin, the above mechanism fails to make a reasonable guess
as to the number of available signals. In the test loop
sigismember returns true for every value of sig, including zero,
and no first_bad is ever set. For now, hard code a reasonable
value. */
last_good = 31;
#endif
#ifdef SIGRTMAX
#ifdef SIGRTMIN
if ((SIGRTMAX >= 0) && (SIGRTMIN >= 0)) {
if ((SIGRTMAX > last_good)) {
GCST("SIGRTMAX", last_good);
} else {
GCST("SIGRTMAX", SIGRTMAX);
}
GCST("SIGRTMIN", SIGRTMIN);
} else {
GDFLT("SIGRTMAX", 0);
GDFLT("SIGRTMIN", 1);
}
#else
GDFLT("SIGRTMAX", 0);
GDFLT("SIGRTMIN", 1);
#endif
#else
GDFLT("SIGRTMAX", 0);
GDFLT("SIGRTMIN", 1);
#endif
GCST("NSIGS", last_good);
}
#ifdef SIGSEGV
GCST("SIGSEGV", SIGSEGV);
#else
GDFLT("SIGSEGV", 0);
#endif
#ifdef SIGSTOP
GCST("SIGSTOP", SIGSTOP);
#else
GDFLT("SIGSTOP", 0);
#endif
#ifdef SIGTERM
GCST("SIGTERM", SIGTERM);
#else
GDFLT("SIGTERM", 0);
#endif
#ifdef SIGTRAP
GCST("SIGTRAP", SIGTRAP);
#else
GDFLT("SIGTRAP", 0);
#endif
#ifdef SIGTSTP
GCST("SIGTSTP", SIGTSTP);
#else
GDFLT("SIGTSTP", 0);
#endif
#ifdef SIGTTIN
GCST("SIGTTIN", SIGTTIN);
#else
GDFLT("SIGTTIN", 0);
#endif
#ifdef SIGTTOU
GCST("SIGTTOU", SIGTTOU);
#else
GDFLT("SIGTTOU", 0);
#endif
#ifdef SIGURG
GCST("SIGURG", SIGURG);
#else
GDFLT("SIGURG", 0);
#endif
#ifdef SIGUSR1
GCST("SIGUSR1", SIGUSR1);
#else
GDFLT("SIGUSR1", 0);
#endif
#ifdef SIGUSR2
GCST("SIGUSR2", SIGUSR2);
#else
GDFLT("SIGUSR2", 0);
#endif
#ifdef SIG_BLOCK
GCST("SIG_BLOCK", SIG_BLOCK);
#else
GDFLT("SIG_BLOCK", 0);
#endif
/* .... hope that nobody is really using a pointer
or a nontrivial macro for SIG_IGN or SIG_DFL
*/
#ifdef SIG_DFL
GCST("SIG_DFL", (int) SIG_DFL);
#else
GDFLT("SIG_DFL", 0);
#endif
#ifdef SIG_IGN
GCST("SIG_IGN", (int) SIG_IGN);
#else
GDFLT("SIG_IGN", 0);
#endif
#ifdef SIG_SETMASK
GCST("SIG_SETMASK", SIG_SETMASK);
#else
GDFLT("SIG_SETMASK", 0);
#endif
#ifdef SIG_UNBLOCK
GCST("SIG_UNBLOCK", SIG_UNBLOCK);
#else
GDFLT("SIG_UNBLOCK", 0);
#endif
#ifdef SI_ASYNCIO
GCST("SI_ASYNCIO", SI_ASYNCIO);
#else
GDFLT("SI_ASYNCIO", 101);
#endif
#ifdef SI_MESGQ
GCST("SI_MESGQ", SI_MESGQ);
#else
GDFLT("SI_MESGQ", 102);
#endif
#ifdef SI_QUEUE
GCST("SI_QUEUE", SI_QUEUE);
#else
GDFLT("SI_QUEUE", 103);
#endif
#ifdef SI_TIMER
GCST("SI_TIMER", SI_TIMER);
#else
GDFLT("SI_TIMER", 104);
#endif
#ifdef SI_USER
GCST("SI_USER", SI_USER);
#else
GDFLT("SI_USER", 105);
#endif
#ifdef S_IFSOCK
GCST("S_IFSOCK", S_IFSOCK);
#else
GDFLT("S_IFSOCK", 0);
#endif
#ifdef S_IRGRP
GCST("S_IRGRP", S_IRGRP);
#else
GDFLT("S_IRGRP", 0);
#endif
#ifdef S_IROTH
GCST("S_IROTH", S_IROTH);
#else
GDFLT("S_IROTH", 0);
#endif
#ifdef S_IRUSR
GCST("S_IRUSR", S_IRUSR);
#else
GDFLT("S_IRUSR", 0);
#endif
#ifdef S_IRWXG
GCST("S_IRWXG", S_IRWXG);
#else
GDFLT("S_IRWXG", 0);
#endif
#ifdef S_IRWXO
GCST("S_IRWXO", S_IRWXO);
#else
GDFLT("S_IRWXO", 0);
#endif
#ifdef S_IRWXU
GCST("S_IRWXU", S_IRWXU);
#else
GDFLT("S_IRWXU", 0);
#endif
#ifdef S_ISGID
GCST("S_ISGID", S_ISGID);
#else
GDFLT("S_ISGID", 0);
#endif
#ifdef S_ISUID
GCST("S_ISUID", S_ISUID);
#else
GDFLT("S_ISUID", 0);
#endif
#ifdef S_IWGRP
GCST("S_IWGRP", S_IWGRP);
#else
GDFLT("S_IWGRP", 0);
#endif
#ifdef S_IWOTH
GCST("S_IWOTH", S_IWOTH);
#else
GDFLT("S_IWOTH", 0);
#endif
#ifdef S_IWUSR
GCST("S_IWUSR", S_IWUSR);
#else
GDFLT("S_IWUSR", 0);
#endif
#ifdef S_IXGRP
GCST("S_IXGRP", S_IXGRP);
#else
GDFLT("S_IXGRP", 0);
#endif
#ifdef S_IXOTH
GCST("S_IXOTH", S_IXOTH);
#else
GDFLT("S_IXOTH", 0);
#endif
#ifdef S_IXUSR
GCST("S_IXUSR", S_IXUSR);
#else
GDFLT("S_IXUSR", 0);
#endif
#ifdef TCIFLUSH
GCST("TCIFLUSH", TCIFLUSH);
#else
GDFLT("TCIFLUSH", 0);
#endif
#ifdef TCIOFF
GCST("TCIOFF", TCIOFF);
#else
GDFLT("TCIOFF", 0);
#endif
#ifdef TCIOFLUSH
GCST("TCIOFLUSH", TCIOFLUSH);
#else
GDFLT("TCIOFLUSH", 0);
#endif
#ifdef TCION
GCST("TCION", TCION);
#else
GDFLT("TCION", 0);
#endif
#ifdef TCOFLUSH
GCST("TCOFLUSH", TCOFLUSH);
#else
GDFLT("TCOFLUSH", 0);
#endif
#ifdef TCOOFF
GCST("TCOOFF", TCOOFF);
#else
GDFLT("TCOOFF", 0);
#endif
#ifdef TCOON
GCST("TCOON", TCOON);
#else
GDFLT("TCOON", 0);
#endif
#ifdef TCSADRAIN
GCST("TCSADRAIN", TCSADRAIN);
#else
GDFLT("TCSADRAIN", 0);
#endif
#ifdef TCSAFLUSH
GCST("TCSAFLUSH", TCSAFLUSH);
#else
GDFLT("TCSAFLUSH", 0);
#endif
#ifdef TCSANOW
GCST("TCSANOW", TCSANOW);
#else
GDFLT("TCSANOW", 0);
#endif
#ifdef TIMER_ABSTIME
GCST("TIMER_ABSTIME", TIMER_ABSTIME);
#else
GDFLT("TIMER_ABSTIME", 1);
#endif
/* TIMER_RELTIME is not defined by the POSIX.1b standard,
but seems to be used by at least Solaris; letting the value
default to 0 if undefined gives us the same effect as the
POSIX.1c specification.
*/
#ifdef TIMER_RELTIME
GCST("TIMER_RELTIME", TIMER_RELTIME);
#else
GDFLT("TIMER_RELTIME", 0);
#endif
#ifdef TOSTOP
GCST("TOSTOP", TOSTOP);
#else
GDFLT("TOSTOP", 0);
#endif
#ifdef VEOF
GCST("VEOF", VEOF);
#else
GDFLT("VEOF", 0);
#endif
#ifdef VEOL
GCST("VEOL", VEOL);
#else
GDFLT("VEOL", 0);
#endif
#ifdef VERASE
GCST("VERASE", VERASE);
#else
GDFLT("VERASE", 0);
#endif
#ifdef VINTR
GCST("VINTR", VINTR);
#else
GDFLT("VINTR", 0);
#endif
#ifdef VKILL
GCST("VKILL", VKILL);
#else
GDFLT("VKILL", 0);
#endif
#ifdef VMIN
GCST("VMIN", VMIN);
#else
GDFLT("VMIN", 0);
#endif
#ifdef VQUIT
GCST("VQUIT", VQUIT);
#else
GDFLT("VQUIT", 0);
#endif
#ifdef VSTART
GCST("VSTART", VSTART);
#else
GDFLT("VSTART", 0);
#endif
#ifdef VSTOP
GCST("VSTOP", VSTOP);
#else
GDFLT("VSTOP", 0);
#endif
#ifdef VSUSP
GCST("VSUSP", VSUSP);
#else
GDFLT("VSUSP", 0);
#endif
#ifdef VTIME
GCST("VTIME", VTIME);
#else
GDFLT("VTIME", 0);
#endif
#ifdef WNOHANG
GCST("WNOHANG", WNOHANG);
#else
GDFLT("WNOHANG", 0);
#endif
#ifdef WUNTRACED
GCST("WUNTRACED", WUNTRACED);
#else
GDFLT("WUNTRACED", 0);
#endif
#ifdef W_OK
GCST("W_OK", W_OK);
#else
GDFLT("W_OK", 0);
#endif
#ifdef X_OK
GCST("X_OK", X_OK);
#else
GDFLT("X_OK", 0);
#endif
#ifdef _PC_ASYNC_IO
GCST("PC_ASYNC_IO", _PC_ASYNC_IO);
#else
GDFLT("PC_ASYNC_IO", 0);
#endif
#ifdef _PC_CHOWN_RESTRICTED
GCST("PC_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED);
#else
GDFLT("PC_CHOWN_RESTRICTED", 0);
#endif
#ifdef _PC_LINK_MAX
GCST("PC_LINK_MAX", _PC_LINK_MAX);
#else
GDFLT("PC_LINK_MAX", 0);
#endif
#ifdef _PC_MAX_CANON
GCST("PC_MAX_CANON", _PC_MAX_CANON);
#else
GDFLT("PC_MAX_CANON", 0);
#endif
#ifdef _PC_MAX_INPUT
GCST("PC_MAX_INPUT", _PC_MAX_INPUT);
#else
GDFLT("PC_MAX_INPUT", 0);
#endif
#ifdef _PC_NAME_MAX
GCST("PC_NAME_MAX", _PC_NAME_MAX);
#else
GDFLT("PC_NAME_MAX", 0);
#endif
#ifdef _PC_NO_TRUNC
GCST("PC_NO_TRUNC", _PC_NO_TRUNC);
#else
GDFLT("PC_NO_TRUNC", 0);
#endif
#ifdef _PC_PATH_MAX
GCST("PC_PATH_MAX", _PC_PATH_MAX);
#else
GDFLT("PC_PATH_MAX", 0);
#endif
#ifdef _PC_PIPE_BUF
GCST("PC_PIPE_BUF", _PC_PIPE_BUF);
#else
GDFLT("PC_PIPE_BUF", 0);
#endif
#ifdef _PC_PRIO_IO
GCST("PC_PRIO_IO", _PC_PRIO_IO);
#else
GDFLT("PC_PRIO_IO", 0);
#endif
#ifdef _PC_SYNC_IO
GCST("PC_SYNC_IO", _PC_SYNC_IO);
#else
GDFLT("PC_SYNC_IO", 0);
#endif
#ifdef _PC_SOCK_MAXBUF
GCST("PC_SOCK_MAXBUF", _PC_SOCK_MAXBUF);
#else
GDFLT("PC_SOCK_MAXBUF", 0);
#endif
#ifdef _SC_AIO_LISTIO_MAX
GCST("SC_AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX);
#else
GDFLT("SC_AIO_LISTIO_MAX", 0);
#endif
#ifdef _SC_AIO_MAX
GCST("SC_AIO_MAX", _SC_AIO_MAX);
#else
GDFLT("SC_AIO_MAX", 0);
#endif
#ifdef _SC_AIO_PRIO_DELTA_MAX
GCST("SC_AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX);
#else
GDFLT("SC_AIO_PRIO_DELTA_MAX", 0);
#endif
#ifdef _SC_ARG_MAX
GCST("SC_ARG_MAX", _SC_ARG_MAX);
#else
GDFLT("SC_ARG_MAX", 0);
#endif
#ifdef _SC_ASYNCHRONOUS_IO
GCST("SC_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO);
#else
GDFLT("SC_ASYNCHRONOUS_IO", 0);
#endif
#ifdef _SC_CHILD_MAX
GCST("SC_CHILD_MAX", _SC_CHILD_MAX);
#else
GDFLT("SC_CHILD_MAX", 0);
#endif
#ifdef _SC_CLK_TCK
GCST("SC_CLK_TCK", _SC_CLK_TCK);
#else
GDFLT("SC_CLK_TCK", 0);
#endif
#ifdef _SC_DELAYTIMER_MAX
GCST("SC_DELAYTIMER_MAX", _SC_DELAYTIMER_MAX);
#else
GDFLT("SC_DELAYTIMER_MAX", 0);
#endif
#ifdef _SC_FSYNC
GCST("SC_FSYNC", _SC_FSYNC);
#else
GDFLT("SC_FSYNC", 0);
#endif
#ifdef _SC_JOB_CONTROL
GCST("SC_JOB_CONTROL", _SC_JOB_CONTROL);
#else
GDFLT("SC_JOB_CONTROL", 0);
#endif
#ifdef _SC_MAPPED_FILES
GCST("SC_MAPPED_FILES", _SC_MAPPED_FILES);
#else
GDFLT("SC_MAPPED_FILES", 0);
#endif
#ifdef _SC_MEMLOCK
GCST("SC_MEMLOCK", _SC_MEMLOCK);
#else
GDFLT("SC_MEMLOCK", 0);
#endif
#ifdef _SC_MEMLOCK_RANGE
GCST("SC_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE);
#else
GDFLT("SC_MEMLOCK_RANGE", 0);
#endif
#ifdef _SC_MEMORY_PROTECTION
GCST("SC_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION);
#else
GDFLT("SC_MEMORY_PROTECTION", 0);
#endif
#ifdef _SC_MESSAGE_PASSING
GCST("SC_MESSAGE_PASSING", _SC_MESSAGE_PASSING);
#else
GDFLT("SC_MESSAGE_PASSING", 0);
#endif
#ifdef _SC_MQ_OPEN_MAX
GCST("SC_MQ_OPEN_MAX", _SC_MQ_OPEN_MAX);
#else
GDFLT("SC_MQ_OPEN_MAX", 0);
#endif
#ifdef _SC_MQ_PRIO_MAX
GCST("SC_MQ_PRIO_MAX", _SC_MQ_PRIO_MAX);
#else
GDFLT("SC_MQ_PRIO_MAX", 0);
#endif
#ifdef _SC_NGROUPS_MAX
GCST("SC_NGROUPS_MAX", _SC_NGROUPS_MAX);
#else
GDFLT("SC_NGROUPS_MAX", 0);
#endif
#ifdef _SC_OPEN_MAX
GCST("SC_OPEN_MAX", _SC_OPEN_MAX);
#else
GDFLT("SC_OPEN_MAX", 0);
#endif
#ifdef _SC_PAGESIZE
GCST("SC_PAGESIZE", _SC_PAGESIZE);
#else
GDFLT("SC_PAGESIZE", 0);
#endif
#ifdef _SC_PII
GCST("SC_PII", _SC_PII);
#else
GDFLT("SC_PII", 0);
#endif
#ifdef _SC_PII_XTI
GCST("SC_PII_XTI", _SC_PII_XTI);
#else
GDFLT("SC_PII_XTI", 0);
#endif
#ifdef _SC_PII_SOCKET
GCST("SC_PII_SOCKET", _SC_PII_SOCKET);
#else
GDFLT("SC_PII_SOCKET", 0);
#endif
#ifdef _SC_PII_INTERNET
GCST("SC_PII_INTERNET", _SC_PII_INTERNET);
#else
GDFLT("SC_PII_INTERNET", 0);
#endif
#ifdef _SC_PII_INTERNET_STREAM
GCST("SC_PII_INTERNET_STREAM", _SC_PII_INTERNET_STREAM);
#else
GDFLT("SC_PII_INTERNET_STREAM", 0);
#endif
#ifdef _SC_PII_INTERNET_DGRAM
GCST("SC_PII_INTERNET_DGRAM", _SC_PII_INTERNET_DGRAM);
#else
GDFLT("SC_PII_INTERNET_DGRAM", 0);
#endif
#ifdef _SC_PII_OSI
GCST("SC_PII_OSI", _SC_PII_OSI);
#else
GDFLT("SC_PII_OSI", 0);
#endif
#ifdef _SC_PII_OSI_M
GCST("SC_PII_OSI_M", _SC_PII_OSI_M);
#else
GDFLT("SC_PII_OSI_M", 0);
#endif
#ifdef _SC_PII_OSI_COTS
GCST("SC_PII_OSI_COTS", _SC_PII_OSI_COTS);
#else
GDFLT("SC_PII_OSI_COTS", 0);
#endif
#ifdef _SC_PII_OSI_CLTS
GCST("SC_PII_OSI_CLTS", _SC_PII_OSI_CLTS);
#else
GDFLT("SC_PII_OSI_CLTS", 0);
#endif
#ifdef _SC_PII_NET_SUPPORT
GCST("SC_PII_NET_SUPPORT", _SC_PII_NET_SUPPORT);
#else
GDFLT("SC_PII_NET_SUPPORT", 0);
#endif
#ifdef _SC_POLL
GCST("SC_POLL", _SC_POLL);
#else
GDFLT("SC_POLL", 0);
#endif
#ifdef _SC_POSIX_PII_NET_SUPPORT
GCST("SC_POSIX_PII_NET_SUPPORT", _SC_POSIX_PII_NET_SUPPORT);
#else
GDFLT("SC_POSIX_PII_NET_SUPPORT", 0);
#endif
#ifdef _SC_PRIORITIZED_IO
GCST("SC_PRIORITIZED_IO", _SC_PRIORITIZED_IO);
#else
GDFLT("SC_PRIORITIZED_IO", 0);
#endif
#ifdef _SC_PRIORITY_SCHEDULING
GCST("SC_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING);
#else
GDFLT("SC_PRIORITY_SCHEDULING", 0);
#endif
#ifdef _SC_SELECT
GCST("SC_SELECT", _SC_SELECT);
#else
GDFLT("SC_SELECT", 0);
#endif
#ifdef _SC_THREAD_PROCESS_SHARED
GCST("SC_THREAD_PROCESS_SHARED", _SC_THREAD_PROCESS_SHARED);
#else
GDFLT("SC_THREAD_PROCESS_SHARED", 0);
#endif
#ifdef _SC_REALTIME_SIGNALS
GCST("SC_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS);
#else
GDFLT("SC_REALTIME_SIGNALS", 0);
#endif
#ifdef _SC_RTSIG_MAX
GCST("SC_RTSIG_MAX", _SC_RTSIG_MAX);
#else
GDFLT("SC_RTSIG_MAX", 0);
#endif
#ifdef _SC_SAVED_IDS
GCST("SC_SAVED_IDS", _SC_SAVED_IDS);
#else
GDFLT("SC_SAVED_IDS", 0);
#endif
#ifdef _SC_SEMAPHORES
GCST("SC_SEMAPHORES", _SC_SEMAPHORES);
#else
GDFLT("SC_SEMAPHORES", 0);
#endif
#ifdef _SC_SEM_NSEMS_MAX
GCST("SC_SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX);
#else
GDFLT("SC_SEM_NSEMS_MAX", 0);
#endif
#ifdef _SC_SEM_VALUE_MAX
GCST("SC_SEM_VALUE_MAX", _SC_SEM_VALUE_MAX);
#else
GDFLT("SC_SEM_VALUE_MAX", 0);
#endif
#ifdef _SC_SHARED_MEMORY_OBJECTS
GCST("SC_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS);
#else
GDFLT("SC_SHARED_MEMORY_OBJECTS", 0);
#endif
#ifdef _SC_SIGQUEUE_MAX
GCST("SC_SIGQUEUE_MAX", _SC_SIGQUEUE_MAX);
#else
GDFLT("SC_SIGQUEUE_MAX", 0);
#endif
#ifdef _SC_STREAM_MAX
GCST("SC_STREAM_MAX", _SC_STREAM_MAX);
#else
GDFLT("SC_STREAM_MAX", 0);
#endif
#ifdef _SC_SYNCHRONIZED_IO
GCST("SC_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO);
#else
GDFLT("SC_SYNCHRONIZED_IO", 0);
#endif
#ifdef _SC_THREAD_PRIORITY_SCHEDULING
GCST("SC_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING);
#else
GDFLT("SC_THREAD_PRIORITY_SCHEDULING", 0);
#endif
#ifdef _SC_THREAD_PRIO_INHERIT
GCST("SC_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT);
#else
GDFLT("SC_THREAD_PRIO_INHERIT", 0);
#endif
#ifdef _SC_THREAD_PRIO_PROTECT
GCST("SC_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT);
#else
GDFLT("SC_THREAD_PRIO_PROTECT", 0);
#endif
#ifdef _SC_TIMERS
GCST("SC_TIMERS", _SC_TIMERS);
#else
GDFLT("SC_TIMERS", 0);
#endif
#ifdef _SC_TIMER_MAX
GCST("SC_TIMER_MAX", _SC_TIMER_MAX);
#else
GDFLT("SC_TIMER_MAX", 0);
#endif
#ifdef _SC_TZNAME_MAX
GCST("SC_TZNAME_MAX", _SC_TZNAME_MAX);
#else
GDFLT("SC_TZNAME_MAX", 0);
#endif
#ifdef _SC_T_IOV_MAX
GCST("SC_T_IOV_MAX", _SC_T_IOV_MAX);
#else
GDFLT("SC_T_IOV_MAX", 0);
#endif
#ifdef _SC_UIO_MAXIOV
GCST("SC_UIO_MAXIOV", _SC_UIO_MAXIOV);
#else
GDFLT("SC_UIO_MAXIOV", 0);
#endif
#ifdef _SC_VERSION
GCST("SC_VERSION", _SC_VERSION);
#else
GDFLT("SC_VERSION", 0);
#endif
/* type declarations
-----------------
If you make any changes here, also make changes
where procedures are declared, above. (***)
*/
ghdrcmnt("type definitions");
g_off_t();
g_pid_t();
g_gid_t();
g_uid_t();
g_mode_t();
g_suseconds_t();
g_ssize_t();
g_DIR();
g_ino_t();
g_dev_t();
g_cc_t();
g_nlink_t();
g_blksize_t();
g_blkcnt_t();
g_tcflag_t();
g_clockid_t();
g_mqd_t();
g_pthread_attr_t();
g_pthread_cond_t();
g_pthread_condattr_t();
g_pthread_key_t();
g_pthread_mutex_t();
g_pthread_mutexattr_t();
g_pthread_once_t();
g_pthread_t();
g_sem_t();
g_sigset_t();
g_speed_t();
g_socklen_t();
g_timer_t();
g_sigval(); /* must precede siginfo_t and struct_sigevent */
g_siginfo_t(); /* is typedef of a struct type */
ghdrcmnt("structure types");
g_struct_sigevent(); /* must precede aiocb */
g_struct_aiocb();
g_struct_dirent();
g_struct_flock();
g_struct_group();
g_struct_mq_attr();
g_struct_passwd();
g_struct_sigaction();
g_struct_sched_param();
ifprintf(fp," type cc_t_array is array (0 .. NCCS - 1) of cc_t;\n");
g_struct_stat();
gen_unchckd_conv ("To_Stat_Ptr", "Address", "stat_ptr");
g_struct_termios();
gcmnt("timeval structure");
g_struct_timeval();
g_struct_timespec();
g_struct_itimerspec();
g_struct_tm();
g_struct_tms();
g_struct_utimbuf();
{ struct utsname DUMMY;
ifprintf(fp," subtype utsname_sysname_string is\n"
" POSIX_String (1 .. %d);\n", sizeof (DUMMY.sysname));
ifprintf(fp," subtype utsname_nodename_string is\n"
" POSIX_String (1 .. %d);\n", sizeof (DUMMY.nodename));
ifprintf(fp," subtype utsname_release_string is\n"
" POSIX_String (1 .. %d);\n", sizeof (DUMMY.release));
ifprintf(fp," subtype utsname_version_string is\n"
" POSIX_String (1 .. %d);\n", sizeof (DUMMY.version));
ifprintf(fp," subtype utsname_machine_string is\n"
" POSIX_String (1 .. %d);\n", sizeof (DUMMY.machine));
}
g_struct_utsname();
/* ......need to figure what to do with functions, next..... */
ghdrcmnt("link names for C functions");
GFUNC(access,HAVE_access);
GFUNC(aio_cancel,HAVE_aio_cancel);
GFUNC(aio_error,HAVE_aio_error);
GFUNC(aio_fsync,HAVE_aio_fsync);
GFUNC(aio_read,HAVE_aio_read);
GFUNC(aio_return,HAVE_aio_return);
GFUNC(aio_suspend,HAVE_aio_suspend);
GFUNC(aio_write,HAVE_aio_write);
/* GFUNC(alarm,HAVE_alarm); */
/* GFUNC(asctime,HAVE_asctime); */
GFUNC(cfgetispeed,HAVE_cfgetispeed);
GFUNC(cfgetospeed,HAVE_cfgetospeed);
GFUNC(cfsetispeed,HAVE_cfsetispeed);
GFUNC(cfsetospeed,HAVE_cfsetospeed);
GFUNC(chdir,HAVE_chdir);
GFUNC(chmod,HAVE_chmod);
GFUNC(chown,HAVE_chown);
GFUNC(clock_getres,HAVE_clock_getres);
GFUNC(clock_gettime,HAVE_clock_gettime);
GFUNC(clock_settime,HAVE_clock_settime);
GFUNC(close,HAVE_close);
GFUNC(closedir,HAVE_closedir);
/* GFUNC(creat,HAVE_creat); */
GFUNC(ctermid,HAVE_ctermid);
GFUNC(ctime,HAVE_ctime);
#if defined(SOLARIS_HACK)
if (HAVE___posix_ctime_r == 1) {
gfuncsol("ctime_r","__posix_ctime_r");
} else {
GFUNC(ctime_r,HAVE_ctime_r);
}
#else
GFUNC(ctime_r,HAVE_ctime_r);
#endif
GFUNC(dup,HAVE_dup);
GFUNC(dup2,HAVE_dup2);
/* .... still need to check all the following functions, to
verify how they return errors, and arrange for the correct kind of
stub link-name to be generated if the function is not supported
*/
/*
The execl* version of execl should not be used directly, since
wrappers must be provided for all variadic functions.
GFUNC(execl,HAVE_execl);
GFUNC(execle,HAVE_execle);
GFUNC(execlp,HAVE_execlp);
*/
GFUNC(execv,HAVE_execv);
GFUNC(execve,HAVE_execve);
GFUNC(execvp,HAVE_execvp);
GFUNC(fchmod,HAVE_fchmod);
GFUNC(fcntl,HAVE_fcntl);
GFUNC(fdatasync,HAVE_fdatasync);
/* GFUNC(fdopen,HAVE_fdopen); */
/* GFUNC(fileno,HAVE_fileno); */
/* GFUNC(flockfile,HAVE_flockfile); */
GFUNC(fork,HAVE_fork);
GFUNC(fpathconf,HAVE_fpathconf);
GFUNC(fstat,HAVE_fstat);
GFUNC(fsync,HAVE_fsync);
GFUNC(ftruncate,HAVE_ftruncate);
/* GFUNC(funlockfile,HAVE_funlockfile); */
/* GFUNC(getc_unlocked,HAVE_getc_unlocked); */
/* GFUNC(getchar_unlocked,HAVE_getchar_unlocked); */
GFUNC(getcwd,HAVE_getcwd);
GFUNC(getegid,HAVE_getegid);
GFUNC(getenv,HAVE_getenv);
GFUNC(geteuid,HAVE_geteuid);
GFUNC(getgid,HAVE_getgid);
GFUNC(getgrgid,HAVE_getgrgid);
GFUNC(getgrnam,HAVE_getgrnam);
GFUNC(getgroups,HAVE_getgroups);
GFUNC(getlogin,HAVE_getlogin);
GFUNC(getpgrp,HAVE_getpgrp);
GFUNC(getpid,HAVE_getpid);
GFUNC(getppid,HAVE_getppid);
GFUNC(getpwnam,HAVE_getpwnam);
GFUNC(getpwuid,HAVE_getpwuid);
GFUNC(gettimeofday,HAVE_gettimeofday);
GFUNC(getuid,HAVE_getuid);
GFUNC(gmtime_r,HAVE_gmtime_r);
GFUNC(isatty,HAVE_isatty);
GFUNC(kill,HAVE_kill);
GFUNC(link,HAVE_link);
GFUNC(lio_listio,HAVE_lio_listio);
GFUNC(lstat, HAVE_lstat);
/* GFUNC(localtime_r,HAVE_localtime_r); */
GFUNC(lseek,HAVE_lseek);
GFUNC(mkdir,HAVE_mkdir);
GFUNC(mkfifo,HAVE_mkfifo);
GFUNC(mlock,HAVE_mlock);
GFUNC(mlockall,HAVE_mlockall);
GFUNC(mmap,HAVE_mmap);
GFUNC(mprotect,HAVE_mprotect);
GFUNC(mq_close,HAVE_mq_close);
GFUNC(mq_getattr,HAVE_mq_getattr);
GFUNC(mq_notify,HAVE_mq_notify);
GFUNC(mq_open,HAVE_mq_open);
GFUNC(mq_receive,HAVE_mq_receive);
GFUNC(mq_send,HAVE_mq_send);
GFUNC(mq_setattr,HAVE_mq_setattr);
GFUNC(mq_unlink,HAVE_mq_unlink);
GFUNC(msync,HAVE_msync);
GFUNC(munlock,HAVE_munlock);
GFUNC(munlockall,HAVE_munlockall);
GFUNC(munmap,HAVE_munmap);
/* GFUNC(nanosleep,HAVE_nanosleep); */
GFUNC(open,HAVE_open);
GFUNC(opendir,HAVE_opendir);
GFUNC(pathconf,HAVE_pathconf);
/* GFUNC(pause,HAVE_pause); */
/* GFUNC(perror,HAVE_perror); */
GFUNC(pipe,HAVE_pipe);
/* GFUNCD(pthread_atfork,HAVE_pthread_atfork); */
/* GFUNCD(pthread_attr_destroy,HAVE_pthread_attr_destroy); */
/* GFUNCD(pthread_attr_getdetachstate,HAVE_pthread_attr_getdetachstate); */
/* GFUNCD(pthread_attr_getinheritsched,HAVE_pthread_attr_getinheritsched);
*/
/* GFUNCD(pthread_attr_getschedparam,HAVE_pthread_attr_getschedparam); */
/* GFUNCD(pthread_attr_getschedpolicy,HAVE_pthread_attr_getschedpolicy); */
/* GFUNCD(pthread_attr_getscope,HAVE_pthread_attr_getscope); */
/* GFUNCD(pthread_attr_getstackaddr,HAVE_pthread_attr_getstackaddr); */
/* GFUNCD(pthread_attr_getstacksize,HAVE_pthread_attr_getstacksize); */
/* GFUNCD(pthread_attr_init,HAVE_pthread_attr_init); */
/* GFUNCD(pthread_attr_setdetachstate,HAVE_pthread_attr_setdetachstate); */
/* GFUNCD(pthread_attr_setinheritsched,HAVE_pthread_attr_setinheritsched);
*/
/* GFUNCD(pthread_attr_setschedparam,HAVE_pthread_attr_setschedparam); */
/* GFUNCD(pthread_attr_setschedpolicy,HAVE_pthread_attr_setschedpolicy); */
/* GFUNCD(pthread_attr_setscope,HAVE_pthread_attr_setscope); */
/* GFUNCD(pthread_attr_setstackaddr,HAVE_pthread_attr_setstackaddr); */
/* GFUNCD(pthread_attr_setstacksize,HAVE_pthread_attr_setstacksize); */
/* GFUNCD(pthread_cancel,HAVE_pthread_cancel); */
/* GFUNCD(pthread_cleanup_pop,HAVE_pthread_cleanup_pop); */
/* GFUNCD(pthread_cleanup_push,HAVE_pthread_cleanup_push); */
GFUNCD(pthread_cond_broadcast,HAVE_pthread_cond_broadcast);
GFUNCD(pthread_cond_destroy,HAVE_pthread_cond_destroy);
GFUNCD(pthread_cond_init,HAVE_pthread_cond_init);
GFUNCD(pthread_cond_signal,HAVE_pthread_cond_signal);
GFUNCD(pthread_cond_timedwait,HAVE_pthread_cond_timedwait);
GFUNCD(pthread_cond_wait,HAVE_pthread_cond_wait);
GFUNCD(pthread_condattr_destroy,HAVE_pthread_condattr_destroy);
GFUNCD(pthread_condattr_getpshared,HAVE_pthread_condattr_getpshared);
GFUNCD(pthread_condattr_init,HAVE_pthread_condattr_init);
GFUNCD(pthread_condattr_setpshared,HAVE_pthread_condattr_setpshared);
/* GFUNCD(pthread_create,HAVE_pthread_create); */
/* GFUNCD(pthread_equal,HAVE_pthread_equal); */
/* GFUNCD(pthread_exit,HAVE_pthread_exit); */
/* GFUNCD(pthread_getschedparam,HAVE_pthread_getschedparam); */
/* GFUNCD(pthread_getspecific,HAVE_pthread_getspecific); */
/* GFUNCD(pthread_join,HAVE_pthread_join); */
/* GFUNCD(pthread_key_create,HAVE_pthread_key_create); */
/* GFUNCD(pthread_key_delete,HAVE_pthread_key_delete); */
/* GFUNCD(pthread_kill,HAVE_pthread_kill); */
GFUNCD(pthread_mutex_destroy,HAVE_pthread_mutex_destroy);
GFUNCD(pthread_mutex_getprioceiling,HAVE_pthread_mutex_getprioceiling);
GFUNCD(pthread_mutex_init,HAVE_pthread_mutex_init);
GFUNCD(pthread_mutex_lock,HAVE_pthread_mutex_lock);
GFUNCD(pthread_mutex_setprioceiling,HAVE_pthread_mutex_setprioceiling);
GFUNCD(pthread_mutex_trylock,HAVE_pthread_mutex_trylock);
GFUNCD(pthread_mutex_unlock,HAVE_pthread_mutex_unlock);
GFUNCD(pthread_mutexattr_destroy,HAVE_pthread_mutexattr_destroy);
GFUNCD(pthread_mutexattr_getprioceiling,
HAVE_pthread_mutexattr_getprioceiling);
GFUNCD(pthread_mutexattr_getprotocol,HAVE_pthread_mutexattr_getprotocol);
GFUNCD(pthread_mutexattr_getpshared,HAVE_pthread_mutexattr_getpshared);
GFUNCD(pthread_mutexattr_init,HAVE_pthread_mutexattr_init);
GFUNCD(pthread_mutexattr_setprioceiling,
HAVE_pthread_mutexattr_setprioceiling);
GFUNCD(pthread_mutexattr_setprotocol,HAVE_pthread_mutexattr_setprotocol);
/* if not supported, the error code is Operation_Not_Implemented,
i.e., ENOSYS */
GFUNCD(pthread_mutexattr_setpshared,HAVE_pthread_mutexattr_setpshared);
/* GFUNCD(pthread_once,HAVE_pthread_once); */
/* GFUNCD(pthread_self,HAVE_pthread_self); */
/* GFUNCD(pthread_setcancelstate,HAVE_pthread_setcancelstate); */
/* GFUNCD(pthread_setcanceltype,HAVE_pthread_setcanceltype); */
/* GFUNCD(pthread_setschedparam,HAVE_pthread_setschedparam); */
/* GFUNCD(pthread_setspecific,HAVE_pthread_setspecific); */
GFUNCD(pthread_sigmask,HAVE_pthread_sigmask);
/* GFUNCD(pthread_testcancel,HAVE_pthread_testcancel); */
/* GFUNC(putc_unlocked,HAVE_putc_unlocked); */
/* GFUNC(putchar_unlocked,HAVE_putchar_unlocked); */
GFUNC(putenv,HAVE_putenv);
/* GFUNC(rand_r,HAVE_rand_r); */
GFUNC(read,HAVE_read);
GFUNC(readdir,HAVE_readdir);
#if defined(SOLARIS_HACK) && (_FILE_OFFSET_BITS != 64)
if (HAVE___posix_readdir_r == 1) {
gfuncsol("readdir_r","__posix_readdir_r");
} else {
GFUNC(readdir_r,HAVE_readdir_r);
}
#else
GFUNC(readdir_r,HAVE_readdir_r);
#endif
GFUNC(rename,HAVE_rename);
/* GFUNC(rewinddir,HAVE_rewinddir); */
/* GFUNC(rewinddir_r,HAVE_rewinddir_r); */
GFUNC(rmdir,HAVE_rmdir);
GFUNC(sched_get_priority_max,HAVE_sched_get_priority_max);
GFUNC(sched_get_priority_min,HAVE_sched_get_priority_min);
GFUNC(sched_rr_get_interval,HAVE_sched_rr_get_interval);
GFUNC(sched_getparam,HAVE_sched_getparam);
GFUNC(sched_getscheduler,HAVE_sched_getscheduler);
GFUNC(sched_setparam,HAVE_sched_setparam);
GFUNC(sched_setscheduler,HAVE_sched_setscheduler);
GFUNC(sched_yield,HAVE_sched_yield);
GFUNC(sem_close,HAVE_sem_close);
GFUNC(sem_destroy,HAVE_sem_destroy);
GFUNC(sem_getvalue,HAVE_sem_getvalue);
GFUNC(sem_init,HAVE_sem_init);
GFUNC(sem_open,HAVE_sem_open);
GFUNC(sem_post,HAVE_sem_post);
GFUNC(sem_trywait,HAVE_sem_trywait);
GFUNC(sem_unlink,HAVE_sem_unlink);
GFUNC(sem_wait,HAVE_sem_wait);
GFUNC(setenv,HAVE_setenv);
GFUNC(setgid,HAVE_setgid);
GFUNC(setpgid,HAVE_setpgid);
GFUNC(setsid,HAVE_setsid);
GFUNC(setuid,HAVE_setuid);
GFUNC(shm_open,HAVE_shm_open);
GFUNC(shm_unlink,HAVE_shm_unlink);
GFUNC(sigaction,HAVE_sigaction);
GFUNC(sigaddset,HAVE_sigaddset);
GFUNC(sigdelset,HAVE_sigdelset);
GFUNC(sigemptyset,HAVE_sigemptyset);
GFUNC(sigfillset,HAVE_sigfillset);
GFUNC(sigismember,HAVE_sigismember);
#ifdef siglongjmp
/* ifprintf(fp," -- *** WARNING: %s is a macro *** --\n",
"siglongjmp"); */
#endif
/* GFUNC(siglongjmp,HAVE_siglongjmp); */
GFUNC(sigpending,HAVE_sigpending);
GFUNC(sigprocmask,HAVE_sigprocmask);
GFUNC(sigqueue,HAVE_sigqueue);
#ifdef sigsetjmp
/* ifprintf(fp," -- *** WARNING: %s is a macro *** --\n",
"sigsetjmp"); */
#endif
/* GFUNC(sigsetjmp,HAVE_sigsetjmp); */
/* GFUNC(sigsuspend,HAVE_sigsuspend); */
GFUNC(sigtimedwait,HAVE_sigtimedwait);
#if defined(SOLARIS_HACK)
if (HAVE___posix_sigwait == 1) {
gfuncsol("sigwait","__posix_sigwait");
} else {
GFUNC(sigwait,HAVE_sigwait);
}
#else
GFUNC(sigwait,HAVE_sigwait);
#endif
GFUNC(sigwaitinfo,HAVE_sigwaitinfo);
/* GFUNC(sleep,HAVE_sleep); */
GFUNC(stat,HAVE_stat);
/* GFUNC(strtok_r,HAVE_strtok_r); */
GFUNC(sysconf,HAVE_sysconf);
GFUNC(tcdrain,HAVE_tcdrain);
GFUNC(tcflow,HAVE_tcflow);
GFUNC(tcflush,HAVE_tcflush);
GFUNC(tcgetattr,HAVE_tcgetattr);
GFUNC(tcgetpgrp,HAVE_tcgetpgrp);
GFUNC(tcsendbreak,HAVE_tcsendbreak);
GFUNC(tcsetattr,HAVE_tcsetattr);
GFUNC(tcsetpgrp,HAVE_tcsetpgrp);
GFUNC(time,HAVE_time);
GFUNC(timer_create,HAVE_timer_create);
/* POSIX.5b erroneously specifies OPERATION_NOT_SUPPORTED for
Create/Delete_Timer.
That is inconsistent with POSIX.1b.
Therefore, we follow POSIX.1b instead.
*/
GFUNC(timer_delete,HAVE_timer_delete);
GFUNC(timer_getoverrun,HAVE_timer_getoverrun);
GFUNC(timer_gettime,HAVE_timer_gettime);
GFUNC(timer_settime,HAVE_timer_settime);
GFUNC(times,HAVE_times);
GFUNC(ttyname,HAVE_ttyname);
/* GFUNC(tzset,HAVE_tzset); */
GFUNC(umask,HAVE_umask);
GFUNC(uname,HAVE_uname);
GFUNC(unlink,HAVE_unlink);
GFUNC(unsetenv,HAVE_unsetenv);
GFUNC(utime,HAVE_utime);
/* GFUNC(wait,HAVE_wait); */
GFUNC(waitpid,HAVE_waitpid);
GFUNC(write,HAVE_write);
ghdrcmnt("C functions for macros");
gmacrofunc("s_isdir","mode_t","mode");
gmacrofunc("s_ischr","mode_t","mode");
gmacrofunc("s_isblk","mode_t","mode");
gmacrofunc("s_islnk","mode_t","mode");
gmacrofunc("s_isreg","mode_t","mode");
gmacrofunc("s_isfifo","mode_t","mode");
gmacrofunc("s_ismsg","mode_t","mode");
gmacrofunc("s_issem","mode_t","mode");
gmacrofunc("s_isshm","mode_t","mode");
gmacrofunc("s_issock","mode_t","mode");
gmacrofunc("s_typeismq","stat_ptr","stat");
gmacrofunc("s_typeissem","stat_ptr","stat");
gmacrofunc("s_typeisshm","stat_ptr","stat");
gmacrofunc("wifexited","int","stat_val");
gmacrofunc("wifexitstatus","int","stat_val");
gmacrofunc("wifsignaled","int","stat_val");
gmacrofunc("wiftermsig","int","stat_val");
gmacrofunc("wifstopped","int","stat_val");
gmacrofunc("wifstopsig","int","stat_val");
/* c_sockets
----------------
*/
indent++;
ifprintf(fp,"package Sockets is\n");
ghdrcmnt("socket.h");
#ifdef HAVE_sa_family_t
guitp("sa_family_t", sizeof(sa_family_t));
#else
NON_SUPPORT_MESSAGE("sa_family_t")
guitp("sa_family_t", sizeof(short));
#endif
#ifdef HAVE_in_port_t
guitp("in_port_t", sizeof(in_port_t));
#else
NON_SUPPORT_MESSAGE("in_port_t")
guitp("in_port_t", sizeof(in_port_t));
#endif
ghdrcmnt("constants");
#ifdef HOST_NOT_FOUND
GCST("HOST_NOT_FOUND", HOST_NOT_FOUND);
#else
GDFLT("HOST_NOT_FOUND", 0);
#endif
#ifdef NO_DATA
GCST("NO_DATA", NO_DATA);
#else
GDFLT("NO_DATA", 0);
#endif
#ifdef NO_RECOVERY
GCST("NO_RECOVERY", NO_RECOVERY);
#else
GDFLT("NO_RECOVERY", 0);
#endif
#ifdef TRY_AGAIN
GCST("TRY_AGAIN", TRY_AGAIN);
#else
GDFLT("TRY_AGAIN", 0);
#endif
#ifdef MAX_SOCKADDR_EXT
GCST("MAX_SOCKADDR_EXT", MAX_SOCKADDR_EXT);
#else
GDFLT("MAX_SOCKADDR_EXT", 108);
#endif
gcmnt("sockets protocol level");
#ifdef SOL_SOCKET
GCST("SOL_SOCKET", SOL_SOCKET);
#else
GDFLT("SOL_SOCKET", 0);
#endif
gcmnt("socket types");
#ifdef SOCK_STREAM
GCST("SOCK_STREAM", SOCK_STREAM);
#else
GDFLT("SOCK_STREAM", 0);
#endif
#ifdef SOCK_DGRAM
GCST("SOCK_DGRAM", SOCK_DGRAM);
#else
GDFLT("SOCK_DGRAM", 0);
#endif
#ifdef SOCK_RAW
GCST("SOCK_RAW", SOCK_RAW);
#else
GDFLT("SOCK_RAW", 0);
#endif
#ifdef SOCK_SEQPACKET
GCST("SOCK_SEQPACKET", SOCK_SEQPACKET);
#else
GDFLT("SOCK_SEQPACKET", 0);
#endif
gcmnt("address families");
#ifdef AF_MAX
GCST("AF_MAX", AF_MAX);
#else
GDFLT("AF_MAX", 0);
#endif
#ifdef AF_UNSPEC
GCST("AF_UNSPEC", AF_UNSPEC);
#else
GDFLT("AF_UNSPEC", 0);
#endif
#ifdef AF_UNIX
GCST("AF_UNIX", AF_UNIX);
#else
GDFLT("AF_UNIX", 0);
#endif
#ifdef AF_LOCAL
GCST("AF_LOCAL", AF_LOCAL);
#else
#ifdef AF_UNIX
GCST("AF_LOCAL", AF_UNIX);
#else
GDFLT("AF_LOCAL", 0);
#endif
#endif
#ifdef AF_INET
GCST("AF_INET", AF_INET);
#else
GDFLT("AF_INET", 0);
#endif
#ifdef AF_OSI
GCST("AF_OSI", AF_OSI);
#else
GDFLT("AF_OSI", 0);
#endif
#ifdef AF_ISO
GCST("AF_ISO", AF_ISO);
#else
GDFLT("AF_ISO", 0);
#endif
gcmnt("protocol families");
#ifdef PF_MAX
GCST("PF_MAX", PF_MAX);
#else
GDFLT("PF_MAX", 0);
#endif
#ifdef PF_UNSPEC
GCST("PF_UNSPEC", PF_UNSPEC);
#else
GDFLT("PF_UNSPEC", 0);
#endif
#ifdef PF_LOCAL
GCST("PF_LOCAL", PF_LOCAL);
#else
#ifdef PF_UNIX
GCST("PF_LOCAL", PF_UNIX);
#else
GDFLT("PF_LOCAL", 0);
#endif
#endif
#ifdef PF_UNIX
GCST("PF_UNIX", PF_UNIX);
#else
GDFLT("PF_UNIX", 0);
#endif
#ifdef PF_INET
GCST("PF_INET", PF_INET);
#else
GDFLT("PF_INET", 0);
#endif
#ifdef PF_OSI
GCST("PF_OSI", PF_OSI);
#else
GDFLT("PF_OSI", 0);
#endif
#ifdef PF_ISO
GCST("PF_ISO", PF_ISO);
#else
GDFLT("PF_ISO", 0);
#endif
gcmnt("socket options");
#ifdef SO_BROADCAST
GUCST("SO_BROADCAST", SO_BROADCAST);
#else
GDFLT("SO_BROADCAST", 0);
#endif
#ifdef SO_DEBUG
GCST("SO_DEBUG", SO_DEBUG);
#else
GDFLT("SO_DEBUG", 0);
#endif
#ifdef SO_DONTROUTE
GCST("SO_DONTROUTE", SO_DONTROUTE);
#else
GDFLT("SO_DONTROUTE", 0);
#endif
#ifdef SO_ERROR
GCST("SO_ERROR", SO_ERROR);
#else
GDFLT("SO_ERROR", 0);
#endif
#ifdef SO_KEEPALIVE
GCST("SO_KEEPALIVE", SO_KEEPALIVE);
#else
GDFLT("SO_KEEPALIVE", 0);
#endif
#ifdef SO_LINGER
GCST("SO_LINGER", SO_LINGER);
#else
GDFLT("SO_LINGER", 0);
#endif
#ifdef SO_OOBINLINE
GCST("SO_OOBINLINE", SO_OOBINLINE);
#else
GDFLT("SO_OOBINLINE", 0);
#endif
#ifdef SO_RCVBUF
GCST("SO_RCVBUF", SO_RCVBUF);
#else
GDFLT("SO_RCVBUF", 0);
#endif
#ifdef SO_RCVLOWAT
GCST("SO_RCVLOWAT", SO_RCVLOWAT);
#else
GDFLT("SO_RCVLOWAT", 0);
#endif
#ifdef SO_RCVTIMEO
GCST("SO_RCVTIMEO", SO_RCVTIMEO);
#else
GDFLT("SO_RCVTIMEO", 0);
#endif
#ifdef SO_REUSEADDR
GCST("SO_REUSEADDR", SO_REUSEADDR);
#else
GDFLT("SO_REUSEADDR", 0);
#endif
#ifdef SO_SNDBUF
GCST("SO_SNDBUF", SO_SNDBUF);
#else
GDFLT("SO_SNDBUF", 0);
#endif
#ifdef SO_SNDLOWAT
GCST("SO_SNDLOWAT", SO_SNDLOWAT);
#else
GDFLT("SO_SNDLOWAT", 0);
#endif
#ifdef SO_SNDTIMEO
GCST("SO_SNDTIMEO", SO_SNDTIMEO);
#else
GDFLT("SO_SNDTIMEO", 0);
#endif
#ifdef SO_TYPE
GCST("SO_TYPE", SO_TYPE);
#else
GDFLT("SO_TYPE", 0);
#endif
gcmnt("max queued connections");
#ifdef SOMAXCONN
GCST("SOMAXCONN", SOMAXCONN);
#else
GDFLT("SOMAXCONN", 0);
#endif
gcmnt("send & receive option flag bits");
#ifdef MSG_OOB
GCST("MSG_OOB", MSG_OOB);
#else
GDFLT("MSG_OOB", 0);
#endif
#ifdef MSG_PEEK
GCST("MSG_PEEK", MSG_PEEK);
#else
GDFLT("MSG_PEEK", 0);
#endif
#ifdef MSG_DONTROUTE
GCST("MSG_DONTROUTE", MSG_DONTROUTE);
#else
GDFLT("MSG_DONTROUTE", 0);
#endif
#ifdef MSG_EOR
GCST("MSG_EOR", MSG_EOR);
#else
GDFLT("MSG_EOR", 0);
#endif
#ifdef MSG_TRUNC
GCST("MSG_TRUNC", MSG_TRUNC);
#else
GDFLT("MSG_TRUNC", 0);
#endif
#ifdef MSG_CTRUNC
GCST("MSG_CTRUNC", MSG_CTRUNC);
#else
GDFLT("MSG_CTRUNC", 0);
#endif
#ifdef MSG_WAITALL
GCST("MSG_WAITALL", MSG_WAITALL);
#else
GDFLT("MSG_WAITALL", 0);
#endif
#ifdef MSG_MAXIOVLEN
GCST("MSG_MAXIOVLEN", MSG_MAXIOVLEN);
#else
GDFLT("MSG_MAXIOVLEN", 0);
#endif
gcmnt("socket address information option flag bits");
#ifdef AI_PASSIVE
GCST("AI_PASSIVE", AI_PASSIVE);
#else
GDFLT("AI_PASSIVE", 0);
#endif
#ifdef AI_CANONNAME
GCST("AI_CANONNAME", AI_CANONNAME);
#else
GDFLT("AI_CANONNAME", 0);
#endif
gcmnt("scoket shutdown mode flag bits");
#ifdef SHUT_RD
GCST("SHUT_RD", SHUT_RD);
#else
GDFLT("SHUT_RD", 0);
#endif
#ifdef SHUT_WR
GCST("SHUT_WR", SHUT_WR);
#else
GDFLT("SHUT_WR", 1);
#endif
#ifdef SHUT_RDWR
GCST("SHUT_RDWR", SHUT_RDWR);
#else
GDFLT("SHUT_RDWR", 2);
#endif
ghdrcmnt("structures");
/* can't follow alphabetic ordering; e.g.
sockaddr needs to come early, to avoid forward references
*/
gcmnt("generic socket address");
g_struct_sockaddr();
gcmnt("struct addrinfo...");
g_struct_addrinfo();
gcmnt("message option header");
g_struct_cmsghdr();
gcmnt("host database entry");
g_struct_hostent();
gcmnt("internet address");
#ifdef HAVE_in_addr_t
guitp("in_addr_t", sizeof(in_addr_t));
#else
NON_SUPPORT_MESSAGE("in_addr_t")
guitp("in_addr_t", sizeof(long));
#endif
g_struct_in_addr();
gcmnt("linger option structure");
g_struct_linger();
gcmnt("I/O vector");
g_struct_iovec();
gcmnt("message header");
g_struct_msghdr();
gcmnt("local socket address");
{ struct sockaddr_un DUMMY;
ifprintf(fp," subtype sun_path_string is POSIX_String (1 .. %d);\n",
sizeof (DUMMY.sun_path));
}
g_struct_sockaddr_un();
gcmnt("internet socket address");
g_struct_sockaddr_in();
gcmnt("IP Level ip_opts structure");
g_struct_ip_opts();
ghdrcmnt("link names for functions");
GFUNC(accept, HAVE_accept);
GFUNC(bind, HAVE_bind);
GFUNC(connect, HAVE_connect);
GFUNC(getsockname, HAVE_getsockname);
GFUNC(getsockopt, HAVE_getsockopt);
GFUNC(isfdtype, HAVE_isfdtype);
GFUNC(listen, HAVE_listen);
GFUNC(recv, HAVE_recv);
GFUNC(recvfrom, HAVE_recvfrom);
GFUNC(recvmsg, HAVE_recvmsg);
GFUNC(send, HAVE_send);
GFUNC(sendto, HAVE_sendto);
GFUNC(sendmsg, HAVE_sendmsg);
GFUNC(setsockopt, HAVE_setsockopt);
GFUNC(shutdown, HAVE_shutdown);
GFUNC(socket, HAVE_socket);
GFUNC(sockatmark, HAVE_sockatmark);
GFUNC(socketpair, HAVE_socketpair);
fprintf(fp,"\n");
ifprintf(fp,"end Sockets;\n\n");
indent--;
/* c_xti
----------------
*/
indent++;
ifprintf(fp,"package XTI is\n");
ghdrcmnt("XTI structures");
/* can't follow alphabetic ordering; e.g.
*/
gcmnt("netbuf structure");
g_struct_netbuf();
gcmnt("t_info structure");
g_struct_t_info();
gcmnt("t_opthdr structure");
g_struct_t_opthdr();
gcmnt("t_bind structure");
g_struct_t_bind();
gcmnt("t_optmgmt structure");
g_struct_t_optmgmt();
gcmnt("t_discon structure");
g_struct_t_discon();
gcmnt("t_call structure");
g_struct_t_call();
gcmnt("t_unitdata structure");
g_struct_t_unitdata();
gcmnt("t_uderr structure");
g_struct_t_uderr();
gcmnt("t_iovec structure");
g_struct_t_iovec();
gcmnt("t_kpalive structure");
g_struct_t_kpalive();
/*
* The following are the events returned from t_look()
*/
gcmnt("The following are the events returned from t_look()");
#ifdef T_LISTEN
GCST("T_LISTEN", T_LISTEN );
#else
GDFLT("T_LISTEN", 0);
#endif
#ifdef T_CONNECT
GCST("T_CONNECT", T_CONNECT );
#else
GDFLT("T_CONNECT", 0);
#endif
#ifdef T_DATA
GCST("T_DATA", T_DATA );
#else
GDFLT("T_DATA", 0);
#endif
#ifdef T_EXDATA
GCST("T_EXDATA", T_EXDATA );
#else
GDFLT("T_EXDATA", 0);
#endif
#ifdef T_DISCONNECT
GCST("T_DISCONNECT", T_DISCONNECT );
#else
GDFLT("T_DISCONNECT", 0);
#endif
#ifdef T_UDERR
GCST("T_UDERR", T_UDERR );
#else
GDFLT("T_UDERR", 0);
#endif
#ifdef T_ORDREL
GCST("T_ORDREL", T_ORDREL );
#else
GDFLT("T_ORDREL", 0);
#endif
#ifdef T_GODATA
GCST("T_GODATA", T_GODATA );
#else
GDFLT("T_GODATA", 0);
#endif
#ifdef T_GOEXDATA
GCST("T_GOEXDATA", T_GOEXDATA );
#else
GDFLT("T_GOEXDATA", 0);
#endif
#ifdef T_EVENTS
GCST("T_EVENTS", T_EVENTS );
#else
GDFLT("T_EVENTS", 0);
#endif
/*
* The following are the flag definitions needed by the
* user level library routines.
*/
#ifdef T_MORE
GCST("T_MORE", T_MORE );
#else
GDFLT("T_MORE", 0);
#endif
#ifdef T_EXPEDITED
GCST("T_EXPEDITED", T_EXPEDITED );
#else
GDFLT("T_EXPEDITED", 0);
#endif
#ifdef T_PUSH
GCST("T_PUSH", T_PUSH );
#else
GDFLT("T_PUSH", 0);
#endif
#ifdef T_NEGOTIATE
GCST("T_NEGOTIATE", T_NEGOTIATE );
#else
GDFLT("T_NEGOTIATE", 0);
#endif
#ifdef T_CHECK
GCST("T_CHECK", T_CHECK );
#else
GDFLT("T_CHECK", 0);
#endif
#ifdef T_DEFAULT
GCST("T_DEFAULT", T_DEFAULT );
#else
GDFLT("T_DEFAULT", 0);
#endif
#ifdef T_SUCCESS
GCST("T_SUCCESS", T_SUCCESS );
#else
GDFLT("T_SUCCESS", 0);
#endif
#ifdef T_FAILURE
GCST("T_FAILURE", T_FAILURE );
#else
GDFLT("T_FAILURE", 0);
#endif
#ifdef T_CURRENT
GCST("T_CURRENT", T_CURRENT );
#else
GDFLT("T_CURRENT", 0);
#endif
#ifdef T_PARTSUCCESS
GCST("T_PARTSUCCESS", T_PARTSUCCESS );
#else
GDFLT("T_PARTSUCCESS", 0);
#endif
#ifdef T_READONLY
GCST("T_READONLY", T_READONLY );
#else
GDFLT("T_READONLY", 0);
#endif
#ifdef T_NOTSUPPORT
GCST("T_NOTSUPPORT", T_NOTSUPPORT );
#else
GDFLT("T_NOTSUPPORT", 0);
#endif
#ifdef T_RAW
GCST("T_RAW", T_RAW );
#else
GDFLT("T_RAW", 0);
#endif
/*
* Service types defines
*/
gcmnt("Service types defines");
#ifdef T_COTS
GCST("T_COTS", T_COTS );
#else
GDFLT("T_COTS", 0);
#endif
#ifdef T_COTS_ORD
GCST("T_COTS_ORD", T_COTS_ORD );
#else
GDFLT("T_COTS_ORD", 0);
#endif
#ifdef T_CLTS
GCST("T_CLTS", T_CLTS );
#else
GDFLT("T_CLTS", 0);
#endif
/*
* Flags defines (other info about the transport provider).
*/
#ifdef T_SENDZERO
GCST("T_SENDZERO", T_SENDZERO );
#else
GDFLT("T_SENDZERO", 0);
#endif
#ifdef SENDZERO
GCST("SENDZERO", SENDZERO );
#else
GDFLT("SENDZERO", 0);
#endif
#ifdef T_XPG4_1
GCST("T_XPG4_1", T_XPG4_1 );
#else
GDFLT("T_XPG4_1", 0);
#endif
#ifdef XPG4_1
GCST("XPG4_1", XPG4_1 );
#else
GDFLT("XPG4_1", 0);
#endif
/*
* The following are structure types used when dynamically
* allocating the above structure via alloc().
*/
#ifdef T_BIND
GCST("T_BIND", T_BIND );
#else
GDFLT("T_BIND", 0);
#endif
#ifdef T_OPTMGMT
GCST("T_OPTMGMT", T_OPTMGMT );
#else
GDFLT("T_OPTMGMT", 0);
#endif
#ifdef T_CALL
GCST("T_CALL", T_CALL );
#else
GDFLT("T_CALL", 0);
#endif
#ifdef T_DIS
GCST("T_DIS", T_DIS );
#else
GDFLT("T_DIS", 0);
#endif
#ifdef T_UNITDATA
GCST("T_UNITDATA", T_UNITDATA );
#else
GDFLT("T_UNITDATA", 0);
#endif
#ifdef T_UDERROR
GCST("T_UDERROR", T_UDERROR );
#else
GDFLT("T_UDERROR", 0);
#endif
#ifdef T_INFO
GCST("T_INFO", T_INFO );
#else
GDFLT("T_INFO", 0);
#endif
#ifdef T_KUNITDATA
GCST("T_KUNITDATA", T_KUNITDATA );
#else
GDFLT("T_KUNITDATA", 0);
#endif
/*
* The following bits specify which fields of the above
* structures should be allocated by t_alloc().
*/
#ifdef T_ADDR
GCST("T_ADDR", T_ADDR );
#else
GDFLT("T_ADDR", 0);
#endif
#ifdef T_OPT
GCST("T_OPT", T_OPT );
#else
GDFLT("T_OPT", 0);
#endif
#ifdef T_UDATA
GCST("T_UDATA", T_UDATA );
#else
GDFLT("T_UDATA", 0);
#endif
#ifdef T_ALL
GCST("T_ALL", T_ALL );
#else
GDFLT("T_ALL", 0);
#endif
/*
* The following are the states for the user.
*/
#ifdef T_UNINIT
GCST("T_UNINIT", T_UNINIT );
#else
GDFLT("T_UNINIT", 0);
#endif
#ifdef T_UNBND
GCST("T_UNBND", T_UNBND );
#else
GDFLT("T_UNBND", 0);
#endif
#ifdef T_IDLE
GCST("T_IDLE", T_IDLE );
#else
GDFLT("T_IDLE", 0);
#endif
#ifdef T_OUTCON
GCST("T_OUTCON", T_OUTCON );
#else
GDFLT("T_OUTCON", 0);
#endif
#ifdef T_INCON
GCST("T_INCON", T_INCON );
#else
GDFLT("T_INCON", 0);
#endif
#ifdef T_DATAXFER
GCST("T_DATAXFER", T_DATAXFER );
#else
GDFLT("T_DATAXFER", 0);
#endif
#ifdef T_OUTREL
GCST("T_OUTREL", T_OUTREL );
#else
GDFLT("T_OUTREL", 0);
#endif
#ifdef T_INREL
GCST("T_INREL", T_INREL );
#else
GDFLT("T_INREL", 0);
#endif
/* General purpose defines */
#ifdef T_YES
GCST("T_YES", T_YES );
#else
# if defined(_TLI_)
GCST("T_YES", 1);
# else
GDFLT("T_YES", 0);
# endif
#endif
#ifdef T_NO
GCST("T_NO", T_NO );
#else
# if defined(_TLI_)
GCST("T_NO", 0);
# else
GDFLT("T_NO", 0);
# endif
#endif
#ifdef T_UNUSED
GCST("T_UNUSED", T_UNUSED );
#else
# if defined(_TLI_)
GCST("T_UNUSED", -1);
# else
GDFLT("T_UNUSED", 0);
# endif
#endif
#ifdef T_NULL
GCST("T_NULL", T_NULL );
#else
# if defined(_TLI_)
GCST("T_NULL", 0);
# else
GDFLT("T_NULL", 0);
# endif
#endif
#ifdef T_ABSREQ
GCST("T_ABSREQ", T_ABSREQ );
#else
# if defined(_TLI_)
GCST("T_ABSREQ", 0x8000);
# else
GDFLT("T_ABSREQ", 0);
# endif
#endif
#ifdef T_INFINITE
GCST("T_INFINITE", T_INFINITE );
#else
# if defined(_TLI_)
GCST("T_INFINITE", -1);
# else
GDFLT("T_INFINITE", 0);
# endif
#endif
#ifdef T_INVALID
GCST("T_INVALID", T_INVALID );
#else
# if defined(_TLI_)
GCST("T_INVALID", -2);
# else
GDFLT("T_INVALID", 0);
# endif
#endif
/* XTI-level Options */
gcmnt ("XTI-level Options");
#ifdef XTI_GENERIC
GCST("XTI_GENERIC", XTI_GENERIC );
#else
# if defined(_TLI_)
GCST("XTI_GENERIC", 0xffff);
# else
GDFLT("XTI_GENERIC", 0);
# endif
#endif
#ifdef XTI_DEBUG
GCST("XTI_DEBUG", XTI_DEBUG );
#else
# if defined(_TLI_) && defined(SO_DEBUG)
GCST("XTI_DEBUG", SO_DEBUG);
# else
GDFLT("XTI_DEBUG", 0);
# endif
#endif
#ifdef XTI_LINGER
GCST("XTI_LINGER", XTI_LINGER );
#else
# if defined(_TLI_) && defined(SO_LINGER)
GCST("XTI_LINGER", SO_LINGER);
# else
GDFLT("XTI_LINGER", 0);
# endif
#endif
#ifdef XTI_RCVBUF
GCST("XTI_RCVBUF", XTI_RCVBUF );
#else
# if defined(_TLI_) && defined(SO_RCVBUF)
GCST("XTI_RCVBUF", SO_RCVBUF);
# else
GDFLT("XTI_RCVBUF", 0);
# endif
#endif
#ifdef XTI_RCVLOWAT
GCST("XTI_RCVLOWAT", XTI_RCVLOWAT );
#else
# if defined(_TLI_) && defined(SO_RCVLOWAT)
GCST("XTI_RCVLOWAT", SO_RCVLOWAT);
# else
GDFLT("XTI_RCVLOWAT", 0);
# endif
#endif
#ifdef XTI_SNDBUF
GCST("XTI_SNDBUF", XTI_SNDBUF );
#else
# if defined(_TLI_) && defined(SO_SNDBUF)
GCST("XTI_SNDBUF", SO_SNDBUF);
# else
GDFLT("XTI_SNDBUF", 0);
# endif
#endif
#ifdef XTI_SNDLOWAT
GCST("XTI_SNDLOWAT", XTI_SNDLOWAT );
#else
# if defined(_TLI_) && defined(SO_SNDLOWAT)
GCST("XTI_SNDLOWAT", SO_SNDLOWAT);
# else
GDFLT("XTI_SNDLOWAT", 0);
# endif
#endif
gcmnt("t_linger structure");
g_struct_t_linger();
gcmnt("General definitions for option management");
#ifdef T_UNSPEC
GCST("T_UNSPEC", T_UNSPEC );
#else
# if defined(_TLI_)
GCST("T_UNSPEC", (~0-2));
# else
GDFLT("T_UNSPEC", 0);
# endif
#endif
#ifdef T_ALLOPT
GCST("T_ALLOPT", T_ALLOPT );
#else
# if defined(_TLI_)
GCST("T_ALLOPT", 0);
# else
GDFLT("T_ALLOPT", 0);
# endif
#endif
gmacrofunc("c_T_ALIGN", "char_ptr", "p");
/* TCP Level and options */
gcmnt("TCP Level and Options");
#ifdef INET_TCP
GCST("INET_TCP", INET_TCP);
#else
GDFLT("INET_TCP",0);
#endif
#ifdef TCP_NODELAY
GCST("TCP_NODELAY", TCP_NODELAY);
#else
GDFLT("TCP_NODELAY",0);
#endif
#ifdef TCP_MAXSEG
GCST("TCP_MAXSEG", TCP_MAXSEG);
#else
GDFLT("TCP_MAXSEG",0);
#endif
#ifdef TCP_KEEPALIVE
GCST("TCP_KEEPALIVE", TCP_KEEPALIVE);
#else
# if defined(_TLI_) && defined (SO_KEEPALIVE)
GCST("TCP_KEEPALIVE", SO_KEEPALIVE);
# else
GDFLT("TCP_KEEPALIVE",0);
# endif
#endif
#ifdef T_GARBAGE
GCST("T_GARBAGE", T_GARBAGE);
#else
# if defined(_TLI_)
GCST("T_GARBAGE", 2);
# else
GDFLT("T_GARBAGE",0);
# endif
#endif
/* UDP Level and options */
gcmnt("UDP Level and Options");
#ifdef INET_UDP
GCST("INET_UDP", INET_UDP);
#else
GDFLT("INET_UDP",0);
#endif
#ifdef UDP_CHECKSUM
GCST("UDP_CHECKSUM", UDP_CHECKSUM);
#else
GDFLT("UDP_CHECKSUM",0);
#endif
/* IP Level and Options */
gcmnt("IP Level and Options");
#ifdef INET_IP
GCST("INET_IP", INET_IP);
#else
GDFLT("INET_IP",0);
#endif
#ifdef IP_OPTIONS
GCST("IP_OPTIONS", IP_OPTIONS);
#else
GDFLT("IP_OPTIONS",0);
#endif
#ifdef IP_TOS
GCST("IP_TOS", IP_TOS);
#else
GDFLT("IP_TOS",0);
#endif
#ifdef IP_TTL
GCST("IP_TTL", IP_TTL);
#else
GDFLT("IP_TTL",0);
#endif
#ifdef IP_REUSEADDR
GCST("IP_REUSEADDR", IP_REUSEADDR);
#else
# if defined(_TLI_)
GCST("IP_REUSEADDR", SO_REUSEADDR);
# else
GDFLT("IP_REUSEADDR",0);
# endif
#endif
#ifdef IP_DONTROUTE
GCST("IP_DONTROUTE", IP_DONTROUTE);
#else
# if defined(_TLI_)
GCST("IP_DONTROUTE", SO_DONTROUTE);
# else
GDFLT("IP_DONTROUTE",0);
# endif
#endif
#ifdef IP_BROADCAST
GCST("IP_BROADCAST", IP_BROADCAST);
#else
# if defined(_TLI_)
GCST("IP_BROADCAST", SO_BROADCAST);
# else
GDFLT("IP_BROADCAST",0);
# endif
#endif
gcmnt("IP_TOS precedence levels");
#ifdef T_ROUTINE
GCST("T_ROUTINE", T_ROUTINE);
#else
GDFLT("T_ROUTINE",0);
#endif
#ifdef T_PRIORITY
GCST("T_PRIORITY", T_PRIORITY);
#else
GDFLT("T_PRIORITY",0);
#endif
#ifdef T_IMMEDIATE
GCST("T_IMMEDIATE", T_IMMEDIATE);
#else
GDFLT("T_IMMEDIATE",0);
#endif
#ifdef T_FLASH
GCST("T_FLASH", T_FLASH);
#else
GDFLT("T_FLASH",0);
#endif
#ifdef T_OVERRIDEFLASH
GCST("T_OVERRIDEFLASH", T_OVERRIDEFLASH);
#else
GDFLT("T_OVERRIDEFLASH",0);
#endif
#ifdef T_CRITIC_ECP
GCST("T_CRITIC_ECP", T_CRITIC_ECP);
#else
GDFLT("T_CRITIC_ECP",0);
#endif
#ifdef T_INETCONTROL
GCST("T_INETCONTROL", T_INETCONTROL);
#else
GDFLT("T_INETCONTROL",0);
#endif
#ifdef T_NETCONTROL
GCST("T_NETCONTROL", T_NETCONTROL);
#else
GDFLT("T_NETCONTROL",0);
#endif
gcmnt("IP_TOS type of service");
#ifdef T_NOTOS
GCST("T_NOTOS", T_NOTOS);
#else
GDFLT("T_NOTOS",0);
#endif
#ifdef T_LDELAY
GCST("T_LDELAY", T_LDELAY);
#else
GDFLT("T_LDELAY",0);
#endif
#ifdef T_HITHRPT
GCST("T_HITHRPT", T_HITHRPT);
#else
GDFLT("T_HITHRPT",0);
#endif
#ifdef T_HIREL
GCST("T_HIREL", T_HIREL);
#else
GDFLT("T_HIREL",0);
#endif
ghdrcmnt("link names for functions");
GFUNC(t_accept, HAVE_t_accept);
GFUNC(t_alloc, HAVE_t_accept);
GFUNC(t_bind, HAVE_t_bind);
GFUNC(t_blocking, HAVE_t_blocking);
GFUNC(t_close, HAVE_t_close);
GFUNC(t_connect, HAVE_t_connect);
GFUNC(t_error, HAVE_t_error);
GFUNC(t_free, HAVE_t_free);
GFUNC(t_getinfo, HAVE_t_getinfo);
GFUNC(t_getprotaddr, HAVE_t_getprotaddr);
GFUNC(t_getstate, HAVE_t_getstate);
GFUNC(t_listen, HAVE_t_listen);
GFUNC(t_look, HAVE_t_look);
GFUNC(t_nonblocking, HAVE_t_nonblocking);
GFUNC(t_open, HAVE_t_open);
GFUNC(t_optmgmt, HAVE_t_optmgmt);
GFUNC(t_rcv, HAVE_t_rcv);
GFUNC(t_rcvconnect, HAVE_t_rcvconnect);
GFUNC(t_rcvdis, HAVE_t_rcvdis);
GFUNC(t_rcvrel, HAVE_t_rcvrel);
GFUNC(t_rcvreldata, HAVE_t_rcvreldata);
GFUNC(t_rcvudata, HAVE_t_rcvudata);
GFUNC(t_rcvuderr, HAVE_t_rcvuderr);
GFUNC(t_rcvv, HAVE_t_rcvv);
GFUNC(t_rcvvudata, HAVE_t_rcvvudata);
GFUNC(t_snd, HAVE_t_snd);
GFUNC(t_snddis, HAVE_t_snddis);
GFUNC(t_sndudata, HAVE_t_sndudata);
GFUNC(t_sndrel, HAVE_t_sndrel);
GFUNC(t_sndreldata, HAVE_t_sndreldata);
GFUNC(t_sndv, HAVE_t_sndv);
GFUNC(t_sndvudata, HAVE_t_sndvudata);
GFUNC(t_strerror, HAVE_t_strerror);
GFUNC(t_sync, HAVE_t_sync);
GFUNC(t_unbind, HAVE_t_unbind);
fprintf(fp,"\n");
ifprintf(fp,"end XTI;\n");
indent--;
/* netinet/in.h
----------------
*/
indent++;
ifprintf(fp,"package Netinet is\n");
ghdrcmnt("From netinet/in.h");
#ifdef IPPROTO_IP
GUCST("IPPROTO_IP", IPPROTO_IP);
#else
GDFLT("IPPROTO_IP", 0);
#endif
#ifdef IPPROTO_ICMP
GUCST("IPPROTO_ICMP", IPPROTO_ICMP);
#else
GDFLT("IPPROTO_ICMP", 0);
#endif
#ifdef IPPROTO_TCP
GUCST("IPPROTO_TCP", IPPROTO_TCP);
#else
GDFLT("IPPROTO_TCP", 0);
#endif
#ifdef IPPROTO_UDP
GUCST("IPPROTO_UDP", IPPROTO_UDP);
#else
GDFLT("IPPROTO_UDP", 0);
#endif
#ifdef IPPROTO_RAW
GUCST("IPPROTO_RAW", IPPROTO_RAW);
#else
GDFLT("IPPROTO_RAW", 0);
#endif
#ifdef IP_OPTIONS
GUCST("IP_OPTIONS", IP_OPTIONS);
#else
GDFLT("IP_OPTIONS", 0);
#endif
#ifdef IP_HDRINCL
GUCST("IP_HDRINCL", IP_HDRINCL);
#else
GDFLT("IP_HDRINCL", 0);
#endif
#ifdef IP_TOS
GUCST("IP_TOS", IP_TOS);
#else
GDFLT("IP_TOS", 0);
#endif
#ifdef IP_TTL
GUCST("IP_TTL", IP_TTL);
#else
GDFLT("IP_TTL", 0);
#endif
#ifdef IP_RECVDSTADDR
GUCST("IP_RECVDSTADDR", IP_RECVDSTADDR);
#else
GDFLT("IP_RECVDSTADDR", 0);
#endif
#ifdef INADDR_NONE
GUCST("INADDR_NONE", INADDR_NONE);
#else
GUFLT("INADDR_NONE", 0xffffffff);
#endif
#ifdef INADDR_ANY
GUCST("INADDR_ANY",INADDR_ANY);
#else
GDFLT("INADDR_ANY",0);
#endif
#ifdef INADDR_BROADCAST
GUCST("INADDR_BROADCAST",INADDR_BROADCAST);
#else
GDFLT("INADDR_BROADCAST",0);
#endif
#ifdef INADDR_LOOPBACK
GUCST("INADDR_LOOPBACK",INADDR_LOOPBACK);
#else
GDFLT("INADDR_LOOPBACK",0);
#endif
#ifdef INADDR_UNSPEC_GROUP
GUCST("INADDR_UNSPEC_GROUP",INADDR_UNSPEC_GROUP);
#else
GDFLT("INADDR_UNSPEC_GROUP",0);
#endif
#ifdef INADDR_ALLHOSTS_GROUP
GUCST("INADDR_ALLHOSTS_GROUP",INADDR_ALLHOSTS_GROUP);
#else
GDFLT("INADDR_ALLHOSTS_GROUP",0);
#endif
#ifdef INADDR_MAX_LOCAL_GROUP
GUCST("INADDR_MAX_LOCAL_GROUP",INADDR_MAX_LOCAL_GROUP);
#else
GDFLT("INADDR_MAX_LOCAL_GROUP",0);
#endif
GFUNC(inet_addr, HAVE_inet_addr);
GFUNC(inet_makeaddr, HAVE_inet_makeaddr);
GFUNC(inet_network, HAVE_inet_network);
GFUNC(inet_lnaof, HAVE_inet_lnaof);
GFUNC(inet_netof, HAVE_inet_netof);
GFUNC(inet_ntoa, HAVE_inet_ntoa);
ghdrcmnt("From netinet/tcp.h");
#ifdef TCP_NODELAY
GCST("TCP_NODELAY", TCP_NODELAY);
#else
GDFLT("TCP_NODELAY",0);
#endif
#ifdef TCP_MAXSEG
GCST("TCP_MAXSEG", TCP_MAXSEG);
#else
GDFLT("TCP_MAXSEG",0);
#endif
#ifdef TCP_KEEPALIVE
GCST("TCP_KEEPALIVE", TCP_KEEPALIVE);
#else
GDFLT("TCP_KEEPALIVE",0);
#endif
#ifdef TCP_MAXRXT
GCST("TCP_MAXRXT", TCP_MAXRXT);
#else
GDFLT("TCP_MAXRXT",0);
#endif
#ifdef TCP_STDURG
GCST("TCP_STDURG", TCP_STDURG);
#else
GDFLT("TCP_STDURG",0);
#endif
ghdrcmnt("From netinet/ip.h");
#ifdef IPTOS_LOWDELAY
GCST("IPTOS_LOWDELAY", IPTOS_LOWDELAY);
#else
GDFLT("IPTOS_LOWDELAY",0);
#endif
#ifdef IPTOS_THROUGHPUT
GCST("IPTOS_THROUGHPUT", IPTOS_THROUGHPUT);
#else
GDFLT("IPTOS_THROUGHPUT",0);
#endif
#ifdef IPTOS_RELIABILITY
GCST("IPTOS_RELIABILITY", IPTOS_RELIABILITY);
#else
GDFLT("IPTOS_RELIABILITY",0);
#endif
fprintf(fp,"\n");
ifprintf(fp,"end Netinet;\n");
indent--;
/* netdb.h
----------------
*/
indent++;
ifprintf(fp,"package NetDB is\n");
ifprintf(fp," use Sockets;\n");
g_struct_netent();
gcmnt("protocol database entry");
g_struct_protoent();
gcmnt("local socket address");
GFUNC(endhostent, HAVE_endhostent);
GFUNC(endnetent, HAVE_endnetent);
GFUNC(endprotoent, HAVE_endprotoent);
GFUNC(endservent, HAVE_endservent);
/* Assume the following three are always there, since
if getaddrinfo is not implemented we will provide our
own freeware version.
*/
GFUNC(getaddrinfo, 1);
GFUNC(freeaddrinfo, 1);
GFUNC(getnameinfo, 1);
GFUNC(gethostbyaddr, HAVE_gethostbyaddr);
GFUNC(gethostbyaddr_r, HAVE_gethostbyaddr_r);
GFUNC(gethostbyname, HAVE_gethostbyname);
GFUNC(gethostbyname_r, HAVE_gethostbyname_r);
GFUNC(gethostname, HAVE_gethostname);
GFUNC(getnetbyaddr, HAVE_getnetbyaddr);
GFUNC(getnetbyaddr_r, HAVE_getnetbyaddr_r);
GFUNC(getnetbyname, HAVE_getnetbyname);
GFUNC(getnetbyname_r, HAVE_getnetbyname_r);
GFUNC(getpeername, HAVE_getpeername);
GFUNC(getprotobyname, HAVE_getprotobyname);
GFUNC(getprotobyname_r, HAVE_getprotobyname_r);
GFUNC(getprotobynumber, HAVE_getprotobynumber);
GFUNC(getprotobynumber_r, HAVE_getprotobynumber_r);
GFUNC(getservbyname, HAVE_getservbyname);
GFUNC(getservbyname_r, HAVE_getservbyname_r);
GFUNC(getservbyport, HAVE_getservbyport);
GFUNC(getservbyport_r, HAVE_getservbyport_r);
GFUNC(sethostent, HAVE_sethostent);
GFUNC(setnetent, HAVE_setnetent);
GFUNC(setprotoent, HAVE_setprotoent);
GFUNC(setservent, HAVE_setservent);
fprintf(fp,"\n");
ifprintf(fp,"end NetDB;\n");
indent--;
/*
* Poll/Select
*/
gcmnt("pollfd structure");
g_struct_pollfd();
ifprintf(fp,
" type fd_mask_array is array (Integer range <>) of unsigned_int;\n");
gcmnt("fd_set structure");
g_fd_set();
#ifdef FD_SETSIZE
GCST("FD_SETSIZE", FD_SETSIZE);
#else
GDFLT("FD_SETSIZE",0);
#endif
#ifdef INFTIM
GCST("INFTIM", INFTIM);
#else
GDFLT("INFTIM",0);
#endif
#ifdef POLLIN
GCST("POLLIN", POLLIN);
#else
GDFLT("POLLIN",0);
#endif
#ifdef POLLRDNORM
GCST("POLLRDNORM", POLLRDNORM);
#else
GDFLT("POLLRDNORM",0);
#endif
#ifdef POLLRDBAND
GCST("POLLRDBAND", POLLRDBAND);
#else
GDFLT("POLLRDBAND",0);
#endif
#ifdef POLLPRI
GCST("POLLPRI", POLLPRI);
#else
GDFLT("POLLPRI",0);
#endif
#ifdef POLLWRNORM
GCST("POLLWRNORM", POLLWRNORM);
#else
GDFLT("POLLWRNORM",0);
#endif
#ifdef POLLWRBAND
GCST("POLLWRBAND", POLLWRBAND);
#else
GDFLT("POLLWRBAND",0);
#endif
#ifdef POLLERR
GCST("POLLERR", POLLERR);
#else
GDFLT("POLLERR",0);
#endif
#ifdef POLLNVAL
GCST("POLLNVAL", POLLNVAL);
#else
GDFLT("POLLNVAL",0);
#endif
GFUNC(poll, HAVE_poll);
GFUNC(select, HAVE_select);
fprintf(fp,"\n");
ifprintf(fp,"end POSIX.C;\n");
fclose(fp);
fprintf(stderr,"done generating posix-c.ads\n");
} /* end create_c */
/*
main
----
*/
int main() {
/* Figure out the number of bits in a byte.
*/
{ unsigned char b;
bits_per_byte = 0;
b = 1;
while (b) {
bits_per_byte++;
b = b << 1;
}
}
if (bits_per_byte != 8) {
quit("byte-size is not equal to 8\n","");
}
create_options();
create_limits();
create_posix();
create_c();
return 0;
}
|