/usr/share/doc/autogen/html/autogen_8.html is in autogen 1:5.18-2ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
<html>
<!-- This manual is for GNU AutoGen version 5.18, updated July 2013.
Copyright C 1992-2013 by Bruce Korb.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
-->
<!-- Created on December 14, 2013 by texi2html 1.82
texi2html was written by:
Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>
-->
<head>
<title>GNU AutoGen - The Automated Program Generator: 8. Add-on packages for AutoGen</title>
<meta name="description" content="GNU AutoGen - The Automated Program Generator: 8. Add-on packages for AutoGen">
<meta name="keywords" content="GNU AutoGen - The Automated Program Generator: 8. Add-on packages for AutoGen">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 1.82">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.roman {font-family:serif; font-weight:normal;}
span.sansserif {font-family:sans-serif; font-weight:normal;}
ul.toc {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Add_002dOns"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="autogen_7.html#Option-Define-Names" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#AutoFSM" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Add_002don-packages-for-AutoGen"></a>
<h1 class="chapter">8. Add-on packages for AutoGen</h1>
<p>This chapter includes several programs that either work closely
with AutoGen (extracting definitions or providing special formatting
functions), or leverage off of AutoGen technology. There is also
a formatting library that helps make AutoGen possible.
</p>
<p>AutoOpts ought to appear in this list as well, but since it is
the primary reason why many people would even look into AutoGen
at all, I decided to leave it in the list of chapters.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#AutoFSM">8.1 Automated Finite State Machine</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#AutoXDR">8.2 Combined RPC Marshalling</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#AutoEvents">8.3 Automated Event Management</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#Bit-Maps">8.4 Bit Maps and Enumerations</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#columns-Invocation">8.5 Invoking columns</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#getdefs-Invocation">8.6 Invoking getdefs</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#xml2ag-Invocation">8.7 Invoking xml2ag</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#snprintfv">8.8 Replacement for Stdio Formatting Library</a></td><td> </td><td align="left" valign="top"> The extensible format printing library.
</td></tr>
</table>
<hr size="6">
<a name="AutoFSM"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Add_002dOns" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#AutoXDR" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Automated-Finite-State-Machine"></a>
<h2 class="section">8.1 Automated Finite State Machine</h2>
<a name="index-AutoFSM"></a>
<a name="index-finite-state-machine"></a>
<p>The templates to generate a finite state machine in C or C++ is included
with AutoGen. The documentation is not. The documentation is in HTML
format for <a href="http://www.gnu.org/software/autogen/autofsm.html">viewing</a>,
or you can <a href="http://download.sourceforge.net/autogen/">download FSM</a>.
</p>
<hr size="6">
<a name="AutoXDR"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#AutoFSM" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#AutoEvents" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Combined-RPC-Marshalling"></a>
<h2 class="section">8.2 Combined RPC Marshalling</h2>
<a name="index-RPC"></a>
<a name="index-rpcgen"></a>
<a name="index-remote-procedure-call"></a>
<a name="index-AutoXDR"></a>
<a name="index-XDR"></a>
<p>The templates and NFSv4 definitions are not included with AutoGen in any way.
The folks that designed NFSv4 noticed that much time and bandwidth was
wasted sending queries and responses when many of them could be bundled.
The protocol bundles the data, but there is no support for it in rpcgen.
That means you have to write your own code to do that. Until now.
Download this and you will have a large, complex example of how to use
<code>AutoXDR</code> for generating the marshaling and unmarshaling of combined
RPC calls. There is a brief example
<a href="http://www.gnu.org/software/autogen/xdr/index.html">on the web</a>, but
you should <a href="http://download.sourceforge.net/autogen/">download AutoXDR</a>.
</p>
<hr size="6">
<a name="AutoEvents"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#AutoXDR" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Bit-Maps" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Automated-Event-Management"></a>
<h2 class="section">8.3 Automated Event Management</h2>
<a name="index-AutoEvents"></a>
<p>Large software development projects invariably have a need to manage
the distribution and display of state information and state changes.
In other words, they need to manage their software events. Generally,
each such project invents its own way of accomplishing this and then
struggles to get all of its components to play the same way. It is a
difficult process and not always completely successful. This project
helps with that.
</p>
<p>AutoEvents completely separates the tasks of supplying the data
needed for a particular event from the methods used to manage the
distribution and display of that event. Consequently, the programmer
writing the code no longer has to worry about that part of the
problem. Likewise the persons responsible for designing the event
management and distribution no longer have to worry about getting
programmers to write conforming code.
</p>
<p>This is a work in progress. See my
<a href="http://www.gnu.org/software/autogen/autoevents.html">web page</a>
on the subject, if you are interested.
I have some useful things put together, but it is not ready
to call a product.
</p>
<hr size="6">
<a name="Bit-Maps"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#AutoEvents" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#enums" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Bit-Maps-and-Enumerations"></a>
<h2 class="section">8.4 Bit Maps and Enumerations</h2>
<p>AutoGen provides two templates for managing enumerations and bit maps
(flag words). They produce an enumeration of the enum or <code>#define</code>s
for the bit maps, plus conversion functions for converting a string into
one of these values or converting one of these values into a human readable
string. Finally, for enumerations, you may specify one or more sets of
dispatching functions that will be selected by identifying a keyword
prefix of a string (see section <a href="#enum_002dcode">the <i>dispatch</i> attribute in Strings to Enums and Back</a>).
</p>
<p>There is a separate project that produces a GDB add-on that
will add these capabilities into GDB for bit masks. (GDB does just fine
with enumerations.)
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#enums">8.4.1 Enumerations</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#enum_002dcode">8.4.2 Strings to Enums and Back</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#masks">8.4.3 Bit Maps and Masks</a></td><td> </td><td align="left" valign="top"></td></tr>
</table>
<hr size="6">
<a name="enums"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Bit-Maps" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#enum_002dcode" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Bit-Maps" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Enumerations"></a>
<h3 class="subsection">8.4.1 Enumerations</h3>
<p>‘<tt>str2enum.tpl</tt>’
</p>
<p>Produce an enumeration for a list of input “cmd”s (names).
Optionally, produce functions to:
</p>
<ul>
<li>
convert a string to an enumeration
</li><li>
convert an enumeration value into a string
</li><li>
invoke a function based on the first token name found in a string
</li></ul>
<p>The header file produced will contain the enumeration and declarations
for the optional procedures. The code (‘<tt>.c</tt>’) file will contain
these optional procedures, but can be omitted if the <code>no-code</code>
attribute is specified.
</p>
<p>The following attributes are recognized with the <code>str2enum</code> template:
</p>
<dl compact="compact">
<dt> ‘<samp>cmd</samp>’</dt>
<dd><p>You must provide a series of these attributes: they specify the list of
names used in the enumeration. Specific values for the names may be
specified by specifying a numeric index for these attributes.
e.g. <code>cmd[5] = mumble;</code> will cause
</p><table><tr><td> </td><td><pre class="example">FOO_CMD_MUMBLE = 5
</pre></td></tr></table>
<p>to be inserted into the enumeration.
Do not specify a value of “<tt>invalid</tt>”, unless you specify the
<code>invalid-name</code> attribute. (In that case, do not specify a
<code>cmd</code> value that matches the <code>invalid-name</code> value.)
</p>
</dd>
<dt> ‘<samp>prefix</samp>’</dt>
<dd><p>This specifies the first segment of each enumeration name.
If not specified, the first segment of the enumeration definition file name
will be used. e.g. ‘<tt>foo-bar.def</tt>’ will default to a <code>FOO</code> prefix.
</p>
</dd>
<dt> ‘<samp>type</samp>’</dt>
<dd><p>Normally, there is a second constant segment following the prefix. If not
specified, it will be <code>CMD</code>, so if both <code>prefix</code> and <code>type</code>
were to default from ‘<tt>foo-bar.def</tt>’, you will have enumeration values
prefixed with <code>FOO_CMD_</code>. If specified as the empty string, there will
be no “type” component to the name and the default constant prefix will
thus be <code>FOO_</code>.
</p>
</dd>
<dt> ‘<samp>base-name</samp>’</dt>
<dd><p>This specifies the base name of the output files, enumeration type and the
translation functions. The default is to use the <code>basename(3)</code> of
the definition file. e.g. ‘<tt>foo-bar.def</tt>’ results in a <code>base-name</code>
of <code>foo-bar</code>.
</p>
</dd>
<dt> ‘<samp>invalid-val</samp>’</dt>
<dd><p>The default invalid value is zero. Sometimes, it is useful for zero to be
valid. If so, you can specify <tt>~0</tt> or the empty string to be invalid.
The empty string will cause the enumeration count (maximum value plus 1) to
be the invalid value.
</p>
</dd>
<dt> ‘<samp>invalid-name</samp>’</dt>
<dd><p>By default, the invalid value is emitted into the enumeration as
<code>FOO_INVALID_CMD</code>. Specifying this attribute will replace
<code>INVALID</code> with whatever you place in this attribute.
</p>
</dd>
<dt> ‘<samp>add-on-text</samp>’</dt>
<dd><p>Additional text to insert into the code or header file.
</p>
<dl compact="compact">
<dt> ‘<samp>ao-file</samp>’</dt>
<dd><p>Which file to insert the text into. There are four choices,
only two of which are relevant for the ‘<tt>str2enum</tt>’ template:
“<tt>enum-header</tt>”, “<tt>enum-code</tt>”, “<tt>mask-header</tt>” or “<tt>mask-code</tt>”.
</p>
</dd>
<dt> ‘<samp>ao-text</samp>’</dt>
<dd><p>The text to insert.
</p></dd>
</dl>
</dd>
</dl>
<hr size="6">
<a name="enum_002dcode"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#enums" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#masks" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Bit-Maps" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Strings-to-Enums-and-Back"></a>
<h3 class="subsection">8.4.2 Strings to Enums and Back</h3>
<p>A continuation of the attributes for the ‘<tt>str2enum.tpl</tt>’ template.
</p>
<dl compact="compact">
<dt> ‘<samp>no-code</samp>’</dt>
<dd><p>Do not emit any string to enumeration or enumeration to string code at all.
If this is specified, the remainder of the attributes have no effect.
</p>
</dd>
<dt> ‘<samp>no-name</samp>’</dt>
<dd><p>Do not emit the enumeration to name function.
</p>
</dd>
<dt> ‘<samp>no-case</samp>’</dt>
<dd><p>When looking up a string, the case of the input string is ignored.
</p>
</dd>
<dt> ‘<samp>alias</samp>’</dt>
<dd><p>A single punctuation character can be interpreted as a command. The first
character of this attribute is the aliased character and the remainder the
aliased-to command. e.g. “<tt>#comment</tt>” makes ’<tt>#</tt>’ an alias for the
<code>comment</code> command. “<tt>#comment</tt>” must still be listed in the
<code>cmd</code> attributes.
</p>
</dd>
<dt> ‘<samp>length</samp>’</dt>
<dd><p>Specify how lengths are to be handled. Under the covers, <code>gperf(1)</code>
is used to map a string to an enumeration value. The code it produces
requires the string length to be passed in. You may pass in the length
yourself, or the generated code may figure it out, or you may ask for that
length to be returned back after being figured out.
</p>
<p>You have four choices with the <code>length</code> attribute:
</p>
<ul>
<li>
Do not specify it. You will need to provide the length.
</li><li>
Specify “<tt>provided</tt>”. You will need to provide the length.
</li><li>
Specify “<tt>returned</tt>”. You must pass a pointer to a <tt>size_t</tt> object.
If the name is found, the length will be put there.
</li><li>
Specify an empty string. The generated code will compute the length and
that computed length will not be returned. The length parameter may be
omitted. If the input strings contain only enumeration names, then this
would be sufficient.
</li><li>
Specifying anything else is undefined.
</li></ul>
</dd>
<dt> ‘<samp>partial</samp>’</dt>
<dd><p>Normally, a name must fully match to be found successfully. This attribute
causes the generated code to look for partial matches if the full match
<code>gperf</code> function fails. Partial matches must be at least two
characters long.
</p>
</dd>
<dt> ‘<samp>undef-str</samp>’</dt>
<dd><p>by default, the display string for an undefined value is
“<tt>* UNDEFINED *</tt>”. Use this to change that.
</p>
</dd>
<dt> ‘<samp>equate</samp>’</dt>
<dd><p>A series of punctuation characters considered equivalent.
Typically, “<tt>-_</tt>” but sometimes (Tandem) “<tt>-_^</tt>”.
Do not use ’<tt>#</tt>’ in the list of characters.
</p>
</dd>
<dt> ‘<samp>dispatch</samp>’</dt>
<dd><p>A lookup procedure will call a dispatch function for the procedure named
after the keyword identified at the start of a string. Other than as
specially noted below, for every named “cmd”, must have a handling
function, plus another function to handle errors, with “invalid” (or the
<code>invalid-name</code> value) as the <code>cmd</code> name. Multiple <code>dispatch</code>
definitions will produce multiple dispatching functions, each with
(potentially) unique argument lists and return types.
</p>
<p>You may also use <code>add-on-text</code> to “<tt>#define</tt>” one function to
another, thus allowing one function to handle multiple keywords or commands.
The <code>d-nam</code> and <code>d-ret</code> attributes are required. The <code>d-arg</code>,
<code>d-omit</code> and <code>d-only</code> attributes are optional:
</p>
<dl compact="compact">
<dt> ‘<samp>d-nam</samp>’</dt>
<dd><p>This must be a printf format string with one formatting element: <code>%s</code>.
The <code>%s</code> will be replaced by each <code>cmd</code> name. The <code>%s</code> will
be stripped and the result will be combined with the base name to construct
the dispatch procedure name.
</p>
</dd>
<dt> ‘<samp>d-ret</samp>’</dt>
<dd><p>The return type of the dispatched function, even if “<tt>void</tt>”.
</p>
</dd>
<dt> ‘<samp>d-arg</samp>’</dt>
<dd><p>If there are additional arguments that are to be passed through to the
dispatched function, specify this as though it were part of the procedure
header. (It will be glued into the dispatching function as is and sedded
into what is needed for the dispatched function.)
</p>
</dd>
<dt> ‘<samp>d-omit</samp>’</dt>
<dd><p>Instead of providing handling functions for all of the <code>cmd</code> names,
the invalid function will be called for omitted command codes.
</p>
</dd>
<dt> ‘<samp>d-only</samp>’</dt>
<dd><p>You need only provide functions for the names listed by <code>d-only</code>, plus
the “invalid” name. All other command values will trigger calls to
the invalid handling function. Note that the invalid call can distinguish
from a command that could not be found by examining the value of its
first (<code>id</code>) argument.
</p></dd>
</dl>
<p>The handler functions will have the command enumeration as its first first
argument, a pointer to a constant string that will be the character
<i>after</i> the parsed command (keyword) name, plus any <code>d-arg</code> arguments
that follow that.
</p>
<p>As an example, a file ‘<tt>samp-chk.def</tt>’ containing this:
</p><table><tr><td> </td><td><pre class="example">AutoGen Definitions str2enum;
cmd = one, two; invalid-name = oops;
dispatch = { d-nam = 'hdl_%s_cmd'; d-ret = void; };
</pre></td></tr></table>
<p>will produce a header containing:
</p><table><tr><td> </td><td><pre class="example">typedef enum {
SAMP_OOPS_CMD = 0,
SAMP_CMD_ONE = 1,
SAMP_CMD_TWO = 2,
SAMP_COUNT_CMD
} samp_chk_enum_t;
extern samp_chk_enum_t
find_samp_chk_cmd(char const * str, size_t len);
typedef void(samp_chk_handler_t)(
samp_chk_enum_t id, char const * str);
samp_chk_handler_t
hdl_oops_cmd, hdl_one_cmd, hdl_two_cmd;
extern void
disp_samp_chk(char * str, size_t len);
extern char const *
samp_chk_name(samp_chk_enum_t id);
</pre></td></tr></table>
<ul>
<li>
<code>find_samp_chk_cmd</code> will look up a <code>len</code> byte <code>str</code> and
return the corresponding <code>samp_chk_enum_t</code> value. That value is
<code>SAMP_OOPS_CMD</code> if the string is not “one” or “two”.
</li><li>
<code>samp_chk_handler_t</code> is the type of the callback procedures.
Three must be provided for the dispatching function to call:
<code>hdl_oops_cmd</code>, <code>hdl_one_cmd</code> and <code>hdl_two_cmd</code>.
<code>hdl_oops_cmd</code> will receive calls when the string does not match.
</li><li>
<code>disp_samp_chk</code> this function will call the handler function
and return whatever the handler returns. In this case, it is void.
</li><li>
<code>samp_chk_name</code> will return a string corresponding to the enumeration
value argument. If the value is not valid, “* UNDEFINED *” (or the
value of <code>undef-str</code>) is used.
</li></ul>
</dd>
</dl>
<hr size="6">
<a name="masks"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#enum_002dcode" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#columns-Invocation" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Bit-Maps" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Bit-Maps-and-Masks"></a>
<h3 class="subsection">8.4.3 Bit Maps and Masks</h3>
<p>‘<tt>str2mask.tpl</tt>’
</p>
<p>This template leverages highly off of enumerations (see section <a href="#enums">Enumerations</a>). It will
produce a header file with bit masks defined for each bit specified with a
<code>cmd</code> attribute. 63 is the highest legal bit number because this
template has not been extended to cope with multiple word masks. (Patches
would be welcome.)
</p>
<p>There are a few constraints on the names allowed:
</p>
<ul>
<li>
names are constrained to alphanumerics and the underscore
</li><li>
aliases are not allowed
</li><li>
dispatch procedures are not allowed
</li></ul>
<p><code>no-code</code> and <code>no-name</code> are honored. <code>dispatch</code> is not. The
lookup function will examine each token in an input string, determine which
bit is specified and add it into a result. The names may be prefixed with a
hyphen (<tt>-</tt>) or tilde (<tt>~</tt>) to remove the bit(s) from the cumulative
result. If the string begins with a plus (<tt>+</tt>), hyphen or tilde, a “base
value” parameter is used for the starting mask, otherwise the conversion
starts with zero.
</p>
<p>Beyond the enumeration attributes that are used (or ignored), the
‘<tt>str2mask</tt>’ template accepts a <code>mask</code> attribute. It takes a few
“subattributes”:
</p>
<dl compact="compact">
<dt> ‘<samp>m-name</samp>’</dt>
<dd><p>a special name for a sub-collection of the mask bits
</p>
</dd>
<dt> ‘<samp>m-bit</samp>’</dt>
<dd><p>The name of each previously defined bit(s). If the desired previously
defined value is a mask, that <code>m-name</code> must be suffixed with “<tt>-mask</tt>”.
</p>
</dd>
<dt> ‘<samp>m-invert</samp>’</dt>
<dd><p>When all done collecting the bits, x-or the value with the mask
of all the bits in the collection.
</p></dd>
</dl>
<p>A mask of all bits in the collection is always generated.
</p>
<hr size="6">
<a name="columns-Invocation"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#masks" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#columns-usage" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Invoking-columns"></a>
<h2 class="section">8.5 Invoking columns</h2>
<a name="index-columns"></a>
<a name="index-Columnize-Input-Text"></a>
<p>This program was designed for the purpose of generating compact,
columnized tables. It will read a list of text items from standard
in or a specified input file and produce a columnized listing of
all the non-blank lines. Leading white space on each line is
preserved, but trailing white space is stripped. Methods of
applying per-entry and per-line embellishments are provided.
See the formatting and separation arguments below.
</p>
<p>This program is used by AutoGen to help clean up and organize
its output.
</p>
<p>See ‘<tt>autogen/agen5/fsm.tpl</tt>’ and the generated output
‘<tt>pseudo-fsm.h</tt>’.
</p>
<p>This function was not implemented as an expression function because
either it would have to be many expression functions, or a provision
would have to be added to provide options to expression functions.
Maybe not a bad idea, but it is not being implemented at the moment.
</p>
<p>A side benefit is that you can use it outside of <code>autogen</code> to
columnize input, a la the <code>ls</code> command.
</p>
<p>This section was generated by <strong>AutoGen</strong>,
using the <code>agtexi-cmd</code> template and the option descriptions for the <code>columns</code> program.
This software is released under the GNU General Public License, version 3 or later.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#columns-usage">8.5.1 columns help/usage (‘<samp>--help</samp>’)</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#columns-dimensions">8.5.2 dimensions options</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#columns-treatment">8.5.3 treatment options</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#columns-ordering">8.5.4 ordering options</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#columns-input_002dtext">8.5.5 input-text options</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#columns-config">8.5.6 presetting/configuring columns</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#columns-exit-status">8.5.7 columns exit status</a></td><td> </td><td align="left" valign="top"> exit status
</td></tr>
<tr><td align="left" valign="top"><a href="#columns-See-Also">8.5.8 columns See Also</a></td><td> </td><td align="left" valign="top"> See Also
</td></tr>
</table>
<hr size="6">
<a name="columns-usage"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#columns-Invocation" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#columns-dimensions" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#columns-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="columns-help_002fusage-_0028_002d_002dhelp_0029"></a>
<h3 class="subsection">8.5.1 columns help/usage (‘<samp>--help</samp>’)</h3>
<a name="index-columns-help"></a>
<p>This is the automatically generated usage text for columns.
</p>
<p>The text printed is the same whether selected with the <code>help</code> option
(‘<samp>--help</samp>’) or the <code>more-help</code> option (‘<samp>--more-help</samp>’). <code>more-help</code> will print
the usage text by passing it through a pager program.
<code>more-help</code> is disabled on platforms without a working
<code>fork(2)</code> function. The <code>PAGER</code> environment variable is
used to select the program, defaulting to ‘<tt>more</tt>’. Both will exit
with a status code of 0.
</p>
<table><tr><td> </td><td><pre class="example">columns (GNU AutoGen) - Columnize Input Text - Ver. 1.2
Usage: columns [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
Specify the output dimensions:
Flg Arg Option-Name Description
-W Num width Maximum Line Width
- it must be in the range:
16 to 4095
-c Num columns Desired number of columns
- it must be in the range:
1 to 2048
-w Num col-width Set width of each column
- it must be in the range:
1 to 2048
Num tab-width tab width
Specify how to lay out the text:
Flg Arg Option-Name Description
Num spread maximum spread added to column width
- it must be in the range:
1 to 1024
no fill Fill lines with input
- prohibits these options:
spread
col-width
by-columns
-I Str indent Line prefix or indentation
Str first-indent First line prefix
- requires the option 'indent'
-f Str format Formatting string for each input
-S Str separation Separation string - follows all but last
Str line-separation string at end of all lines but last
Str ending string at end of last line
Specify the ordering of the entries:
Flg Arg Option-Name Description
no by-columns Print entries in column order
-s opt sort Sort input text
Redirecting stdin to an alternate file:
Flg Arg Option-Name Description
-i Str input Input file (if not stdin)
Version, usage and configuration options:
Flg Arg Option-Name Description
-v opt version output version information and exit
-? no help display extended usage information and exit
-! no more-help extended usage information passed thru pager
-> opt save-opts save the option state to a config file
-< Str load-opts load options from a config file
- disabled as '--no-load-opts'
- may appear multiple times
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
The following option preset mechanisms are supported:
- reading file ./.columnsrc
- reading file $HOME/.columnsrc
- examining environment variables named COLUMNS_*
Packaged by Bruce (2013-07-14)
Report columns bugs to bkorb@gnu.org
</pre></td></tr></table>
<hr size="6">
<a name="columns-dimensions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#columns-usage" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#columns-treatment" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#columns-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="dimensions-options"></a>
<h3 class="subsection">8.5.2 dimensions options</h3>
<p>Specify the output dimensions.
<a name="width-option-_0028_002dW_0029_002e"></a>
<h4 class="subsubheading">width option (-W).</h4>
<a name="columns-width"></a>
<a name="index-columns_002dwidth"></a>
</p>
<p>This is the “maximum line width” option.
This option takes an argument number ‘<tt>num</tt>’.
This option specifies the full width of the output line,
including any start-of-line indentation. The output will fill
each line as completely as possible, unless the column width has
been explicitly specified. If the maximum width is less than
the length of the widest input, you will get a single column
of output.
<a name="columns-option-_0028_002dc_0029_002e"></a>
<h4 class="subsubheading">columns option (-c).</h4>
<a name="columns-columns"></a>
<a name="index-columns_002dcolumns"></a>
</p>
<p>This is the “desired number of columns” option.
This option takes an argument number ‘<tt>count</tt>’.
Use this option to specify exactly how many columns to produce.
If that many columns will not fit within <var>line_width</var>, then
the count will be reduced to the number that fit.
<a name="col_002dwidth-option-_0028_002dw_0029_002e"></a>
<h4 class="subsubheading">col-width option (-w).</h4>
<a name="columns-col_002dwidth"></a>
<a name="index-columns_002dcol_002dwidth"></a>
</p>
<p>This is the “set width of each column” option.
This option takes an argument number ‘<tt>num</tt>’.
Use this option to specify exactly how many characters are to be
allocated for each column. If it is narrower than the widest entry,
it will be over-ridden with the required width.
<a name="tab_002dwidth-option_002e"></a>
<h4 class="subsubheading">tab-width option.</h4>
<a name="columns-tab_002dwidth"></a>
<a name="index-columns_002dtab_002dwidth"></a>
</p>
<p>This is the “tab width” option.
This option takes an argument number ‘<tt>num</tt>’.
If an indentation string contains tabs, then this value is used to
compute the ending column of the prefix string.
</p><hr size="6">
<a name="columns-treatment"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#columns-dimensions" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#columns-ordering" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#columns-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="treatment-options"></a>
<h3 class="subsection">8.5.3 treatment options</h3>
<p>Specify how to lay out the text.
<a name="spread-option_002e"></a>
<h4 class="subsubheading">spread option.</h4>
<a name="columns-spread"></a>
<a name="index-columns_002dspread"></a>
</p>
<p>This is the “maximum spread added to column width” option.
This option takes an argument number ‘<tt>num</tt>’.
Use this option to specify exactly how many characters may be
added to each column. It allows you to prevent columns from
becoming too far apart. Without this option, ‘<tt>columns</tt>’
will attempt to widen columns to fill the full width.
<a name="fill-option_002e"></a>
<h4 class="subsubheading">fill option.</h4>
<a name="columns-fill"></a>
<a name="index-columns_002dfill"></a>
</p>
<p>This is the “fill lines with input” option.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
must not appear in combination with any of the following options:
spread, col_width, by_columns.
</li></ul>
<p>Instead of columnizing the input text, fill the output lines
with the input lines. Blank lines on input will cause a
blank line in the output, unless the output is sorted.
With sorted output, blank lines are ignored.
<a name="indent-option-_0028_002dI_0029_002e"></a>
<h4 class="subsubheading">indent option (-I).</h4>
<a name="columns-indent"></a>
<a name="index-columns_002dindent"></a>
</p>
<p>This is the “line prefix or indentation” option.
This option takes an argument string ‘<tt>l-pfx</tt>’.
If a number, then this many spaces will be inserted at the start of
every line. Otherwise, it is a line prefix that will be inserted
at the start of every line.
<a name="first_002dindent-option_002e"></a>
<h4 class="subsubheading">first-indent option.</h4>
<a name="columns-first_002dindent"></a>
<a name="index-columns_002dfirst_002dindent"></a>
</p>
<p>This is the “first line prefix” option.
This option takes an argument string ‘<tt>l-pfx</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
must appear in combination with the following options:
indent.
</li></ul>
<p>If a number, then this many spaces will be inserted at the start of
the first line. Otherwise, it is a line prefix that will be inserted
at the start of that line. If its length exceeds "indent", then it
will be emitted on a line by itself, suffixed by any line separation
string. For example:
</p>
<table><tr><td> </td><td><pre class="example">$ columns --first='#define TABLE' -c 2 -I4 --line=' \' <<_EOF_
one
two
three
four
_EOF_
#define TABLE \
one two \
three four
</pre></td></tr></table>
<a name="format-option-_0028_002df_0029_002e"></a>
<h4 class="subsubheading">format option (-f).</h4>
<p><a name="columns-format"></a>
<a name="index-columns_002dformat"></a>
</p>
<p>This is the “formatting string for each input” option.
This option takes an argument string ‘<tt>fmt-str</tt>’.
If you need to reformat each input text, the argument to this
option is interpreted as an <code>sprintf(3)</code> format that is used
to produce each output entry.
<a name="separation-option-_0028_002dS_0029_002e"></a>
<h4 class="subsubheading">separation option (-S).</h4>
<a name="columns-separation"></a>
<a name="index-columns_002dseparation"></a>
</p>
<p>This is the “separation string - follows all but last” option.
This option takes an argument string ‘<tt>sep-str</tt>’.
Use this option if, for example, you wish a comma to appear after
each entry except the last.
<a name="line_002dseparation-option_002e"></a>
<h4 class="subsubheading">line-separation option.</h4>
<a name="columns-line_002dseparation"></a>
<a name="index-columns_002dline_002dseparation"></a>
</p>
<p>This is the “string at end of all lines but last” option.
This option takes an argument string ‘<tt>sep-str</tt>’.
Use this option if, for example, you wish a backslash to appear at
the end of every line, except the last.
<a name="ending-option_002e"></a>
<h4 class="subsubheading">ending option.</h4>
<a name="columns-ending"></a>
<a name="index-columns_002dending"></a>
</p>
<p>This is the “string at end of last line” option.
This option takes an argument string ‘<tt>end-str</tt>’.
This option puts the specified string at the end of the output.
</p><hr size="6">
<a name="columns-ordering"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#columns-treatment" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#columns-input_002dtext" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#columns-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="ordering-options"></a>
<h3 class="subsection">8.5.4 ordering options</h3>
<p>Specify the ordering of the entries.
<a name="by_002dcolumns-option_002e"></a>
<h4 class="subsubheading">by-columns option.</h4>
<a name="columns-by_002dcolumns"></a>
<a name="index-columns_002dby_002dcolumns"></a>
</p>
<p>This is the “print entries in column order” option.
Normally, the entries are printed out in order by rows and then columns.
This option will cause the entries to be ordered within columns.
The final column, instead of the final row, may be shorter than the
others.
<a name="sort-option-_0028_002ds_0029_002e"></a>
<h4 class="subsubheading">sort option (-s).</h4>
<a name="columns-sort"></a>
<a name="index-columns_002dsort"></a>
</p>
<p>This is the “sort input text” option.
This option takes an optional argument string ‘<tt>key-pat</tt>’.
Causes the input text to be sorted. If an argument is supplied,
it is presumed to be a pattern and the sort is based upon the
matched text. If the pattern starts with or consists of
an asterisk (<code>*</code>), then the sort is case insensitive.
</p><hr size="6">
<a name="columns-input_002dtext"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#columns-ordering" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#columns-config" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#columns-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="input_002dtext-options"></a>
<h3 class="subsection">8.5.5 input-text options</h3>
<p>Redirecting stdin to an alternate file.
<a name="input-option-_0028_002di_0029_002e"></a>
<h4 class="subsubheading">input option (-i).</h4>
<a name="columns-input"></a>
<a name="index-columns_002dinput"></a>
</p>
<p>This is the “input file (if not stdin)” option.
This option takes an argument string ‘<tt>file</tt>’.
This program normally runs as a <code>filter</code>, reading from standard
input, columnizing and writing to standard out. This option redirects
input to a file.
</p>
<hr size="6">
<a name="columns-config"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#columns-input_002dtext" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#columns-exit-status" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#columns-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="presetting_002fconfiguring-columns"></a>
<h3 class="subsection">8.5.6 presetting/configuring columns</h3>
<p>Any option that is not marked as <i>not presettable</i> may be preset by
loading values from configuration ("rc" or "ini") files, and values from environment variables named <code>COLUMNS</code> and <code>COLUMNS_<OPTION_NAME></code>. <code><OPTION_NAME></code> must be one of
the options listed above in upper case and segmented with underscores.
The <code>COLUMNS</code> variable will be tokenized and parsed like
the command line. The remaining variables are tested for existence and their
values are treated like option arguments.
</p>
<p><code>libopts</code> will search in 2 places for configuration files:
</p><ul>
<li>
$PWD
</li><li>
$HOME
</li></ul>
<p>The environment variables <code>PWD</code>, and <code>HOME</code>
are expanded and replaced when ‘<tt>columns</tt>’ runs.
For any of these that are plain files, they are simply processed.
For any that are directories, then a file named ‘<tt>.columnsrc</tt>’ is searched for
within that directory and processed.
</p>
<p>Configuration files may be in a wide variety of formats.
The basic format is an option name followed by a value (argument) on the
same line. Values may be separated from the option name with a colon,
equal sign or simply white space. Values may be continued across multiple
lines by escaping the newline with a backslash.
</p>
<p>Multiple programs may also share the same initialization file.
Common options are collected at the top, followed by program specific
segments. The segments are separated by lines like:
</p><table><tr><td> </td><td><pre class="example">[COLUMNS]
</pre></td></tr></table>
<p>or by
</p><table><tr><td> </td><td><pre class="example"><?program columns>
</pre></td></tr></table>
<p>Do not mix these styles within one configuration file.
</p>
<p>Compound values and carefully constructed string values may also be
specified using XML syntax:
</p><table><tr><td> </td><td><pre class="example"><option-name>
<sub-opt>...&lt;...&gt;...</sub-opt>
</option-name>
</pre></td></tr></table>
<p>yielding an <code>option-name.sub-opt</code> string value of
</p><table><tr><td> </td><td><pre class="example">"...<...>..."
</pre></td></tr></table>
<p><code>AutoOpts</code> does not track suboptions. You simply note that it is a
hierarchicly valued option. <code>AutoOpts</code> does provide a means for searching
the associated name/value pair list (see: optionFindValue).
</p>
<p>The command line options relating to configuration and/or usage help are:
</p>
<a name="version-_0028_002dv_0029"></a>
<h4 class="subsubheading">version (-v)</h4>
<p>Print the program version to standard out, optionally with licensing
information, then exit 0. The optional argument specifies how much licensing
detail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument.
Only the first letter of the argument is examined:
</p>
<dl compact="compact">
<dt> ‘<samp>version</samp>’</dt>
<dd><p>Only print the version. This is the default.
</p></dd>
<dt> ‘<samp>copyright</samp>’</dt>
<dd><p>Name the copyright usage licensing terms.
</p></dd>
<dt> ‘<samp>verbose</samp>’</dt>
<dd><p>Print the full copyright usage licensing terms.
</p></dd>
</dl>
<hr size="6">
<a name="columns-exit-status"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#columns-config" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#columns-See-Also" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#columns-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="columns-exit-status-1"></a>
<h3 class="subsection">8.5.7 columns exit status</h3>
<p>One of the following exit values will be returned:
</p><dl compact="compact">
<dt> ‘<samp>0 (EXIT_SUCCESS)</samp>’</dt>
<dd><p>Successful program execution.
</p></dd>
<dt> ‘<samp>1 (EXIT_FAILURE)</samp>’</dt>
<dd><p>The operation failed or the command syntax was not valid.
</p></dd>
<dt> ‘<samp>66 (EX_NOINPUT)</samp>’</dt>
<dd><p>A specified configuration file could not be loaded.
</p></dd>
<dt> ‘<samp>70 (EX_SOFTWARE)</samp>’</dt>
<dd><p>libopts had an internal operational error. Please report
it to autogen-users@lists.sourceforge.net. Thank you.
</p></dd>
</dl>
<hr size="6">
<a name="columns-See-Also"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#columns-exit-status" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-Invocation" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#columns-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="columns-See-Also-1"></a>
<h3 class="subsection">8.5.8 columns See Also</h3>
<p>This program is documented more fully in the Columns section
of the Add-On chapter in the <code>AutoGen</code> Info system documentation.
</p>
<hr size="6">
<a name="getdefs-Invocation"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#columns-See-Also" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-usage" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Invoking-getdefs"></a>
<h2 class="section">8.6 Invoking getdefs</h2>
<a name="index-getdefs"></a>
<a name="index-AutoGen-Definition-Extraction-Tool"></a>
<p>If no <code>input</code> argument is provided or is set to simply "-", and if
<code>stdin</code> is not a <code>tty</code>, then the list of input files will be
read from <code>stdin</code>.
This program extracts AutoGen definitions from a list of source files.
Definitions are delimited by <code>/*=<entry-type> <entry-name>\n</code> and
<code>=*/\n</code>. From that, this program creates a definition of the following
form:
</p>
<table><tr><td> </td><td><pre class="example"> #line nnn "source-file-name"
entry_type = {
name = entry_name;
...
};
</pre></td></tr></table>
<ol>
<li>
The ellipsis <code>...</code> is filled in by text found between the two
delimiters. Each line of text is stripped of anything before the first
asterisk, then leading asterisks, then any leading or trailing white space.
</li><li>
If what is left starts with what looks like a name followed by a colon, then
it is interpreted as a name followed by a value.
</li><li>
If the first character of the value is either a single or double quote, then
you are responsible for quoting the text as it gets inserted into the output
definitions. So, if you want whitespace at the beginnings of the lines of
text, you must do something like this:
<table><tr><td> </td><td><pre class="example"> * mumble:
* " this is some\n"
* " indented text."
</pre></td></tr></table>
</li><li>
If the <code><entry-name></code> is followed by a comma, the word <code>ifdef</code> (or
<code>ifndef</code>) and a name <code>if_name</code>, then the above entry will be under
<code>ifdef</code> control.
<table><tr><td> </td><td><pre class="example">/*=group entry_name, ifdef FOO
* attr: attribute value
=*/
</pre></td></tr></table>
<p>Will produce the following:
</p>
<table><tr><td> </td><td><pre class="example">#ifdef FOO
#line nnn "source-file-name"
group = {
name = entry_name;
attr = 'attribute value';
};
#endif
</pre></td></tr></table>
</li><li>
If you use of the <code>subblock</code> option, you can specify a nested
value, See <a href="#getdefs-subblock">getdefs subblock</a>. That is, this text:
<table><tr><td> </td><td><pre class="example"> * arg: int, this, what-it-is
</pre></td></tr></table>
<p>with the <code>--subblock=arg=type,name,doc</code> option would yield:
</p>
<table><tr><td> </td><td><pre class="example">arg = { type = int; name = this; doc = what-it-is; };
</pre></td></tr></table>
</li></ol>
<p>This section was generated by <strong>AutoGen</strong>,
using the <code>agtexi-cmd</code> template and the option descriptions for the <code>getdefs</code> program.
This software is released under the GNU General Public License, version 3 or later.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#getdefs-usage">8.6.1 getdefs help/usage (‘<samp>help</samp>’)</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#getdefs-def_002dselection">8.6.2 def-selection options</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#getdefs-enumerating">8.6.3 enumerating options</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#getdefs-doc_002dinsert">8.6.4 doc-insert options</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#getdefs-input_002dfiles">8.6.5 input-files options</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#getdefs-doc_002doutput">8.6.6 doc-output options</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#getdefs-config">8.6.7 presetting/configuring getdefs</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#getdefs-exit-status">8.6.8 getdefs exit status</a></td><td> </td><td align="left" valign="top"> exit status
</td></tr>
<tr><td align="left" valign="top"><a href="#getdefs-See-Also">8.6.9 getdefs See Also</a></td><td> </td><td align="left" valign="top"> See Also
</td></tr>
</table>
<hr size="6">
<a name="getdefs-usage"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#getdefs-Invocation" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-def_002dselection" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="getdefs-help_002fusage-_0028help_0029"></a>
<h3 class="subsection">8.6.1 getdefs help/usage (‘<samp>help</samp>’)</h3>
<a name="index-getdefs-help"></a>
<p>This is the automatically generated usage text for getdefs.
</p>
<p>The text printed is the same whether selected with the <code>help</code> option
(‘<samp>help</samp>’) or the <code>more-help</code> option (‘<samp>more-help</samp>’). <code>more-help</code> will print
the usage text by passing it through a pager program.
<code>more-help</code> is disabled on platforms without a working
<code>fork(2)</code> function. The <code>PAGER</code> environment variable is
used to select the program, defaulting to ‘<tt>more</tt>’. Both will exit
with a status code of 0.
</p>
<table><tr><td> </td><td><pre class="example">getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
Usage: getdefs [ <option-name>[{=| }<val>] ]...
Specify which definitions are of interest and what to say about them:
Arg Option-Name Description
Str defs-to-get Regexp to look for after the "/*="
Str subblock subblock definition names
- may appear multiple times
Str listattr attribute with list of values
- may appear multiple times
specify how to number the definitions:
Arg Option-Name Description
opt ordering Alphabetize or use named file
- disabled as '--no-ordering'
- enabled by default
Num first-index The first index to apply to groups
Definition insertion options:
Arg Option-Name Description
opt filelist Insert source file names into defs
Str assign Global assignments
- may appear multiple times
Str common-assign Assignments common to all blocks
- may appear multiple times
Str copy File(s) to copy into definitions
- may appear multiple times
opt srcfile Insert source file name into each def
opt linenum Insert source line number into each def
specify which files to search for markers:
Arg Option-Name Description
Str input Input file to search for defs
- may appear multiple times
- default option for unnamed options
Definition output disposition options::
Arg Option-Name Description
Str output Output file to open
- an alternate for 'autogen'
opt autogen Invoke AutoGen with defs
- disabled as '--no-autogen'
- enabled by default
Str template Template Name
Str agarg AutoGen Argument
- prohibits the option 'output'
- may appear multiple times
Str base-name Base name for output file(s)
- prohibits the option 'output'
Version, usage and configuration options:
Arg Option-Name Description
opt version output version information and exit
no help display extended usage information and exit
no more-help extended usage information passed thru pager
opt save-opts save the option state to a config file
Str load-opts load options from a config file
- disabled as '--no-load-opts'
- may appear multiple times
All arguments are named options.
If no 'input' argument is provided or is set to simply "-", and if 'stdin'
is not a 'tty', then the list of input files will be read from 'stdin'.
The following option preset mechanisms are supported:
- reading file /dev/null
This program extracts AutoGen definitions from a list of source files.
Definitions are delimited by '/*=<entry-type> <entry-name>\n' and '=*/\n'.
Packaged by Bruce (2013-07-14)
Report getdefs bugs to bkorb@gnu.org
</pre></td></tr></table>
<hr size="6">
<a name="getdefs-def_002dselection"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#getdefs-usage" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-enumerating" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="def_002dselection-options"></a>
<h3 class="subsection">8.6.2 def-selection options</h3>
<p>Specify which definitions are of interest and what to say about them.
<a name="defs_002dto_002dget-option_002e"></a>
<h4 class="subsubheading">defs-to-get option.</h4>
<a name="getdefs-defs_002dto_002dget"></a>
<a name="index-getdefs_002ddefs_002dto_002dget"></a>
</p>
<p>This is the “regexp to look for after the "/*="” option.
This option takes an argument string ‘<tt>reg-ex</tt>’.
If you want definitions only from a particular category, or even
with names matching particular patterns, then specify this regular
expression for the text that must follow the <code>/*=</code>.
<a name="subblock-option_002e"></a>
<h4 class="subsubheading">subblock option.</h4>
<a name="getdefs-subblock"></a>
<a name="index-getdefs_002dsubblock"></a>
</p>
<p>This is the “subblock definition names” option.
This option takes an argument string ‘<tt>sub-def</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
may appear an unlimited number of times.
</li></ul>
<p>This option is used to create shorthand entries for nested definitions.
For example, with:
</p><dl compact="compact">
<dt> <span class="roman">using subblock thus</span></dt>
<dd><p><code>--subblock=arg=argname,type,null</code>
</p></dd>
<dt> <span class="roman">and defining an <code>arg</code> thus</span></dt>
<dd><p><code>arg: this, char *</code>
</p></dd>
<dt> <span class="roman">will then expand to:</span></dt>
<dd><p><code>arg = { argname = this; type = "char *"; };</code>
</p></dd>
</dl>
<p>The "this, char *" string is separated at the commas, with the
white space removed. You may use characters other than commas by
starting the value string with a punctuation character other than
a single or double quote character. You may also omit intermediate
values by placing the commas next to each other with no intervening
white space. For example, "+mumble++yes+" will expand to:
<br>
<code>arg = { argname = mumble; null = "yes"; };</code>.
<a name="listattr-option_002e"></a>
<h4 class="subsubheading">listattr option.</h4>
<a name="getdefs-listattr"></a>
<a name="index-getdefs_002dlistattr"></a>
</p>
<p>This is the “attribute with list of values” option.
This option takes an argument string ‘<tt>def</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
may appear an unlimited number of times.
</li></ul>
<p>This option is used to create shorthand entries for definitions
that generally appear several times. That is, they tend to be
a list of values. For example, with:
<br>
<code>listattr=foo</code> defined, the text:
<br>
<code>foo: this, is, a, multi-list</code> will then expand to:
<br>
<code>foo = 'this', 'is', 'a', 'multi-list';</code>
<br>
The texts are separated by the commas, with the
white space removed. You may use characters other than commas by
starting the value string with a punctuation character other than
a single or double quote character.
</p><hr size="6">
<a name="getdefs-enumerating"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#getdefs-def_002dselection" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-doc_002dinsert" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="enumerating-options"></a>
<h3 class="subsection">8.6.3 enumerating options</h3>
<p>specify how to number the definitions.
<a name="ordering-option_002e"></a>
<h4 class="subsubheading">ordering option.</h4>
<a name="getdefs-ordering"></a>
<a name="index-getdefs_002dordering"></a>
</p>
<p>This is the “alphabetize or use named file” option.
This option takes an optional argument string ‘<tt>file-name</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
is enabled by default.
</li></ul>
<p>By default, ordering is alphabetical by the entry name. Use,
<code>no-ordering</code> if order is unimportant. Use <code>ordering</code>
with no argument to order without case sensitivity. Use
<code>ordering=<file-name></code> if chronological order is important.
getdefs will maintain the text content of <code>file-name</code>.
<code>file-name</code> need not exist.
<a name="first_002dindex-option_002e"></a>
<h4 class="subsubheading">first-index option.</h4>
<a name="getdefs-first_002dindex"></a>
<a name="index-getdefs_002dfirst_002dindex"></a>
</p>
<p>This is the “the first index to apply to groups” option.
This option takes an argument number ‘<tt>first-index</tt>’.
By default, the first occurrence of a named definition will have an
index of zero. Sometimes, that needs to be a reserved value. Provide
this option to specify a different starting point.
</p><hr size="6">
<a name="getdefs-doc_002dinsert"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#getdefs-enumerating" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-input_002dfiles" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="doc_002dinsert-options"></a>
<h3 class="subsection">8.6.4 doc-insert options</h3>
<p>Definition insertion options.
<a name="filelist-option_002e"></a>
<h4 class="subsubheading">filelist option.</h4>
<a name="getdefs-filelist"></a>
<a name="index-getdefs_002dfilelist"></a>
</p>
<p>This is the “insert source file names into defs” option.
This option takes an optional argument string ‘<tt>file</tt>’.
Inserts the name of each input file into the output definitions.
If no argument is supplied, the format will be:
</p><table><tr><td> </td><td><pre class="example">infile = '%s';
</pre></td></tr></table>
<p>If an argument is supplied, that string will be used for the entry
name instead of <var>infile</var>.
<a name="assign-option_002e"></a>
<h4 class="subsubheading">assign option.</h4>
<a name="getdefs-assign"></a>
<a name="index-getdefs_002dassign"></a>
</p>
<p>This is the “global assignments” option.
This option takes an argument string ‘<tt>ag-def</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
may appear an unlimited number of times.
</li></ul>
<p>The argument to each copy of this option will be inserted into
the output definitions, with only a semicolon attached.
<a name="common_002dassign-option_002e"></a>
<h4 class="subsubheading">common-assign option.</h4>
<a name="getdefs-common_002dassign"></a>
<a name="index-getdefs_002dcommon_002dassign"></a>
</p>
<p>This is the “assignments common to all blocks” option.
This option takes an argument string ‘<tt>ag-def</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
may appear an unlimited number of times.
</li></ul>
<p>The argument to each copy of this option will be inserted into
each output definition, with only a semicolon attached.
<a name="copy-option_002e"></a>
<h4 class="subsubheading">copy option.</h4>
<a name="getdefs-copy"></a>
<a name="index-getdefs_002dcopy"></a>
</p>
<p>This is the “file(s) to copy into definitions” option.
This option takes an argument string ‘<tt>file</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
may appear an unlimited number of times.
</li></ul>
<p>The content of each file named by these options will be inserted into
the output definitions.
<a name="srcfile-option_002e"></a>
<h4 class="subsubheading">srcfile option.</h4>
<a name="getdefs-srcfile"></a>
<a name="index-getdefs_002dsrcfile"></a>
</p>
<p>This is the “insert source file name into each def” option.
This option takes an optional argument string ‘<tt>file</tt>’.
Inserts the name of the input file where a definition was found
into the output definition.
If no argument is supplied, the format will be:
</p><table><tr><td> </td><td><pre class="example">srcfile = '%s';
</pre></td></tr></table>
<p>If an argument is supplied, that string will be used for the entry
name instead of <var>srcfile</var>.
<a name="linenum-option_002e"></a>
<h4 class="subsubheading">linenum option.</h4>
<a name="getdefs-linenum"></a>
<a name="index-getdefs_002dlinenum"></a>
</p>
<p>This is the “insert source line number into each def” option.
This option takes an optional argument string ‘<tt>def-name</tt>’.
Inserts the line number in the input file where a definition
was found into the output definition.
If no argument is supplied, the format will be:
</p><table><tr><td> </td><td><pre class="example">linenum = '%s';
</pre></td></tr></table>
<p>If an argument is supplied, that string will be used for the entry
name instead of <var>linenum</var>.
</p><hr size="6">
<a name="getdefs-input_002dfiles"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#getdefs-doc_002dinsert" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-doc_002doutput" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="input_002dfiles-options"></a>
<h3 class="subsection">8.6.5 input-files options</h3>
<p>specify which files to search for markers.
<a name="input-option_002e"></a>
<h4 class="subsubheading">input option.</h4>
<a name="getdefs-input"></a>
<a name="index-getdefs_002dinput"></a>
</p>
<p>This is the “input file to search for defs” option.
This option takes an argument string ‘<tt>src-file</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
may appear an unlimited number of times.
</li></ul>
<p>All files that are to be searched for definitions must be named on
the command line or read from <code>stdin</code>. If there is only one
<code>input</code> option and it is the string, "-", then the input file
list is read from <code>stdin</code>. If a command line argument is not
an option name and does not contain an assignment operator
(<code>=</code>), then it defaults to being an input file name.
At least one input file must be specified.
</p><hr size="6">
<a name="getdefs-doc_002doutput"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#getdefs-input_002dfiles" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-config" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="doc_002doutput-options"></a>
<h3 class="subsection">8.6.6 doc-output options</h3>
<p>Definition output disposition options:.
<a name="output-option_002e"></a>
<h4 class="subsubheading">output option.</h4>
<a name="getdefs-output"></a>
<a name="index-getdefs_002doutput"></a>
</p>
<p>This is the “output file to open” option.
This option takes an argument string ‘<tt>file</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
is a member of the autogen class of options.
</li></ul>
<p>If you are not sending the output to an AutoGen process,
you may name an output file instead.
<a name="autogen-option_002e"></a>
<h4 class="subsubheading">autogen option.</h4>
<a name="getdefs-autogen"></a>
<a name="index-getdefs_002dautogen"></a>
</p>
<p>This is the “invoke autogen with defs” option.
This option takes an optional argument string ‘<tt>ag-cmd</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
is enabled by default.
</li><li>
is a member of the autogen class of options.
</li></ul>
<p>This is the default output mode. Specifying <code>no-autogen</code> is
equivalent to <code>output=-</code>. If you supply an argument to this
option, that program will be started as if it were AutoGen and
its standard in will be set to the output definitions of this program.
<a name="template-option_002e"></a>
<h4 class="subsubheading">template option.</h4>
<a name="getdefs-template"></a>
<a name="index-getdefs_002dtemplate"></a>
</p>
<p>This is the “template name” option.
This option takes an argument string ‘<tt>file</tt>’.
Specifies the template name to be used for generating the final output.
<a name="agarg-option_002e"></a>
<h4 class="subsubheading">agarg option.</h4>
<a name="getdefs-agarg"></a>
<a name="index-getdefs_002dagarg"></a>
</p>
<p>This is the “autogen argument” option.
This option takes an argument string ‘<tt>ag-opt</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
may appear an unlimited number of times.
</li><li>
must not appear in combination with any of the following options:
output.
</li></ul>
<p>This is a pass-through argument. It allows you to specify any
arbitrary argument to be passed to AutoGen.
<a name="base_002dname-option_002e"></a>
<h4 class="subsubheading">base-name option.</h4>
<a name="getdefs-base_002dname"></a>
<a name="index-getdefs_002dbase_002dname"></a>
</p>
<p>This is the “base name for output file(s)” option.
This option takes an argument string ‘<tt>name</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
must not appear in combination with any of the following options:
output.
</li></ul>
<p>When output is going to AutoGen, a base name must either be supplied
or derived. If this option is not supplied, then it is taken from
the <code>template</code> option. If that is not provided either, then
it is set to the base name of the current directory.
</p>
<hr size="6">
<a name="getdefs-config"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#getdefs-doc_002doutput" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-exit-status" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="presetting_002fconfiguring-getdefs"></a>
<h3 class="subsection">8.6.7 presetting/configuring getdefs</h3>
<p>Any option that is not marked as <i>not presettable</i> may be preset by
loading values from configuration ("rc" or "ini") files.
</p>
<p><code>libopts</code> will search in ‘<tt>/dev/null</tt>’ for configuration (option) data.
If this is a plain file, it is simply processed.
If it is a directory, then a file named ‘<tt>.getdefsrc</tt>’ is searched for within that directory.
</p>
<p>Configuration files may be in a wide variety of formats.
The basic format is an option name followed by a value (argument) on the
same line. Values may be separated from the option name with a colon,
equal sign or simply white space. Values may be continued across multiple
lines by escaping the newline with a backslash.
</p>
<p>Multiple programs may also share the same initialization file.
Common options are collected at the top, followed by program specific
segments. The segments are separated by lines like:
</p><table><tr><td> </td><td><pre class="example">[GETDEFS]
</pre></td></tr></table>
<p>or by
</p><table><tr><td> </td><td><pre class="example"><?program getdefs>
</pre></td></tr></table>
<p>Do not mix these styles within one configuration file.
</p>
<p>Compound values and carefully constructed string values may also be
specified using XML syntax:
</p><table><tr><td> </td><td><pre class="example"><option-name>
<sub-opt>...&lt;...&gt;...</sub-opt>
</option-name>
</pre></td></tr></table>
<p>yielding an <code>option-name.sub-opt</code> string value of
</p><table><tr><td> </td><td><pre class="example">"...<...>..."
</pre></td></tr></table>
<p><code>AutoOpts</code> does not track suboptions. You simply note that it is a
hierarchicly valued option. <code>AutoOpts</code> does provide a means for searching
the associated name/value pair list (see: optionFindValue).
</p>
<p>The command line options relating to configuration and/or usage help are:
</p>
<a name="version"></a>
<h4 class="subsubheading">version</h4>
<p>Print the program version to standard out, optionally with licensing
information, then exit 0. The optional argument specifies how much licensing
detail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument.
Only the first letter of the argument is examined:
</p>
<dl compact="compact">
<dt> ‘<samp>version</samp>’</dt>
<dd><p>Only print the version. This is the default.
</p></dd>
<dt> ‘<samp>copyright</samp>’</dt>
<dd><p>Name the copyright usage licensing terms.
</p></dd>
<dt> ‘<samp>verbose</samp>’</dt>
<dd><p>Print the full copyright usage licensing terms.
</p></dd>
</dl>
<hr size="6">
<a name="getdefs-exit-status"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#getdefs-config" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-See-Also" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="getdefs-exit-status-1"></a>
<h3 class="subsection">8.6.8 getdefs exit status</h3>
<p>One of the following exit values will be returned:
</p><dl compact="compact">
<dt> ‘<samp>0 (EXIT_SUCCESS)</samp>’</dt>
<dd><p>Successful program execution.
</p></dd>
<dt> ‘<samp>1 (EXIT_FAILURE)</samp>’</dt>
<dd><p>The operation failed or the command syntax was not valid.
</p></dd>
<dt> ‘<samp>66 (EX_NOINPUT)</samp>’</dt>
<dd><p>A specified configuration file could not be loaded.
</p></dd>
<dt> ‘<samp>70 (EX_SOFTWARE)</samp>’</dt>
<dd><p>libopts had an internal operational error. Please report
it to autogen-users@lists.sourceforge.net. Thank you.
</p></dd>
</dl>
<hr size="6">
<a name="getdefs-See-Also"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#getdefs-exit-status" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#xml2ag-Invocation" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#getdefs-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="getdefs-See-Also-1"></a>
<h3 class="subsection">8.6.9 getdefs See Also</h3>
<p>This program is documented more fully in the Getdefs section
of the Add-On chapter in the <code>AutoGen</code> Info system documentation.
</p>
<hr size="6">
<a name="xml2ag-Invocation"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#getdefs-See-Also" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#xml2ag-usage" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Invoking-xml2ag"></a>
<h2 class="section">8.7 Invoking xml2ag</h2>
<a name="index-xml2ag"></a>
<a name="index-XML-to-AutoGen-Definiton-Converter"></a>
<p>This program will convert any arbitrary XML file into equivalent
AutoGen definitions, and invoke AutoGen.
The template used will be derived from either:
</p><ul>
<li>
The <strong>–override-tpl</strong> command line option
</li><li>
A top level XML attribute named, "<code>template</code>"
</li></ul>
<p>One or the other <strong>must</strong> be provided, or the program will
exit with a failure message.
</p>
<p>The <em>base-name</em> for the output will similarly be either:
</p><ul>
<li>
The <strong>–base-name</strong> command line option.
</li><li>
The base name of the ‘<tt>.xml</tt>’ file.
</li></ul>
<p>The definitions derived from XML generally have an extra layer
of definition. Specifically, this XML input:
</p><table><tr><td> </td><td><pre class="example"><mumble attr="foo">
mumble-1
<grumble>
grumble, grumble, grumble.
</grumble>mumble, mumble
</mumble>
</pre></td></tr></table>
<p>Will get converted into this:
</p><table><tr><td> </td><td><pre class="example">mumble = {
grumble = {
text = 'grumble, grumble, grumble';
};
text = 'mumble-1';
text = 'mumble, mumble';
};
</pre></td></tr></table>
<p>Please notice that some information is lost. AutoGen cannot tell that
"grumble" used to lie between the mumble texts. Also please note that
you cannot assign:
</p><table><tr><td> </td><td><pre class="example">grumble = 'grumble, grumble, grumble.';
</pre></td></tr></table>
<p>because if another "grumble" has an attribute or multiple texts,
it becomes impossible to have the definitions be the same type
(compound or text values).
</p>
<p>This section was generated by <strong>AutoGen</strong>,
using the <code>agtexi-cmd</code> template and the option descriptions for the <code>xml2ag</code> program.
This software is released under the GNU General Public License, version 3 or later.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#xml2ag-usage">8.7.1 xml2ag help/usage (‘<samp>--help</samp>’)</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#xml2ag-the_002dxml2ag_002doption">8.7.2 the-xml2ag-option options</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#xml2ag-autogen_002doptions">8.7.3 autogen-options options</a></td><td> </td><td align="left" valign="top"></td></tr>
<tr><td align="left" valign="top"><a href="#xml2ag-exit-status">8.7.4 xml2ag exit status</a></td><td> </td><td align="left" valign="top"> exit status
</td></tr>
</table>
<hr size="6">
<a name="xml2ag-usage"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#xml2ag-Invocation" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#xml2ag-the_002dxml2ag_002doption" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#xml2ag-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="xml2ag-help_002fusage-_0028_002d_002dhelp_0029"></a>
<h3 class="subsection">8.7.1 xml2ag help/usage (‘<samp>--help</samp>’)</h3>
<a name="index-xml2ag-help"></a>
<p>This is the automatically generated usage text for xml2ag.
</p>
<p>The text printed is the same whether selected with the <code>help</code> option
(‘<samp>--help</samp>’) or the <code>more-help</code> option (‘<samp>--more-help</samp>’). <code>more-help</code> will print
the usage text by passing it through a pager program.
<code>more-help</code> is disabled on platforms without a working
<code>fork(2)</code> function. The <code>PAGER</code> environment variable is
used to select the program, defaulting to ‘<tt>more</tt>’. Both will exit
with a status code of 0.
</p>
<table><tr><td> </td><td><pre class="example">xml2ag (GNU AutoGen) - XML to AutoGen Definiton Converter - Ver. 5.18
Usage: xml2ag [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ <def-file> ]
All other options are derived from autogen:
Flg Arg Option-Name Description
-O Str output Output file in lieu of AutoGen processing
All other options:
Flg Arg Option-Name Description
-L Str templ-dirs Search for templates in DIR
- may appear multiple times
-T Str override-tpl Use TPL-FILE for the template
Str definitions Read definitions from FILE
Str shell name or path name of shell to use
-m no no-fmemopen Do not use in-mem streams
Str equate characters considered equivalent
-b Str base-name Specify NAME as the base name for output
no source-time set mod times to latest source
no writable Allow output files to be writable
- disabled as '--not-writable'
Num loop-limit Limit on increment loops
- is scalable with a suffix: k/K/m/M/g/G/t/T
- it must lie in one of the ranges:
-1 exactly, or
1 to 16777216
-t Num timeout Limit server shell operations to SECONDS
- it must be in the range:
0 to 3600
KWd trace tracing level of detail
Str trace-out tracing output file or filter
no show-defs Show the definition tree
no used-defines Show the definitions used
-C no core Leave a core dump on a failure exit
-s Str skip-suffix Skip the file with this SUFFIX
- prohibits the option 'select-suffix'
- may appear multiple times
-o Str select-suffix specify this output suffix
- may appear multiple times
-D Str define name to add to definition list
- may appear multiple times
-U Str undefine definition list removal pattern
- an alternate for 'define'
-M opt make-dep emit make dependency file
- may appear multiple times
Version, usage and configuration options:
Flg Arg Option-Name Description
-v opt version output version information and exit
-? no help display extended usage information and exit
-! no more-help extended usage information passed thru pager
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
This program will convert any arbitrary XML file into equivalent AutoGen
definitions, and invoke AutoGen.
The valid "trace" option keywords are:
nothing debug-message server-shell templates block-macros
expressions everything
or an integer from 0 through 6
The template will be derived from either: * the ``--override-tpl'' command
line option * a top level XML attribute named, "template"
The ``base-name'' for the output will similarly be either: * the
``--base-name'' command line option * the base name of the .xml file
Packaged by Bruce (2013-07-14)
Report xml2ag bugs to bkorb@gnu.org
</pre></td></tr></table>
<hr size="6">
<a name="xml2ag-the_002dxml2ag_002doption"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#xml2ag-usage" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#xml2ag-autogen_002doptions" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#xml2ag-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="the_002dxml2ag_002doption-options"></a>
<h3 class="subsection">8.7.2 the-xml2ag-option options</h3>
<p>All other options are derived from autogen.
<a name="output-option-_0028_002dO_0029_002e"></a>
<h4 class="subsubheading">output option (-O).</h4>
<a name="xml2ag-output"></a>
<a name="index-xml2ag_002doutput"></a>
</p>
<p>This is the “output file in lieu of autogen processing” option.
This option takes an argument string ‘<tt>file</tt>’.
By default, the output is handed to an AutoGen for processing.
However, you may save the definitions to a file instead.
</p><hr size="6">
<a name="xml2ag-autogen_002doptions"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#xml2ag-the_002dxml2ag_002doption" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#xml2ag-exit-status" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#xml2ag-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="autogen_002doptions-options"></a>
<h3 class="subsection">8.7.3 autogen-options options</h3>
<p>All other options.
These options are <i>mostly</i> just passed throug to <code>autogen</code>.
The one exception is <code>--override-tpl</code> which replaces the
default template in the output definitions. It does not get passed
through on the command line.
<a name="templ_002ddirs-option-_0028_002dL_0029_002e-1"></a>
<h4 class="subsubheading">templ-dirs option (-L).</h4>
<a name="xml2ag-templ_002ddirs"></a>
<a name="index-xml2ag_002dtempl_002ddirs"></a>
</p>
<p>This is the “search for templates in ‘<tt>dir</tt>’” option.
This option takes an argument string ‘<tt>DIR</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
may appear an unlimited number of times.
</li></ul>
<p>Pass-through AutoGen argument
<a name="override_002dtpl-option-_0028_002dT_0029_002e"></a>
<h4 class="subsubheading">override-tpl option (-T).</h4>
<a name="xml2ag-override_002dtpl"></a>
<a name="index-xml2ag_002doverride_002dtpl"></a>
</p>
<p>This is the “use ‘<tt>tpl-file</tt>’ for the template” option.
This option takes an argument string ‘<tt>TPL-FILE</tt>’.
Pass-through AutoGen argument
<a name="lib_002dtemplate-option-_0028_002dl_0029_002e"></a>
<h4 class="subsubheading">lib-template option (-l).</h4>
<a name="xml2ag-lib_002dtemplate"></a>
<a name="index-xml2ag_002dlib_002dtemplate"></a>
</p>
<p>This is the “load autogen macros from ‘<tt>tpl-file</tt>’” option.
This option takes an argument string ‘<tt>TPL-FILE</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
may appear an unlimited number of times.
</li></ul>
<p>Pass-through AutoGen argument
</p>
<p><strong>NOTE</strong><strong>: THIS OPTION IS DEPRECATED</strong>
<a name="definitions-option_002e-1"></a>
<h4 class="subsubheading">definitions option.</h4>
<a name="xml2ag-definitions"></a>
<a name="index-xml2ag_002ddefinitions"></a>
</p>
<p>This is the “read definitions from ‘<tt>file</tt>’” option.
This option takes an argument string ‘<tt>FILE</tt>’.
Pass-through AutoGen argument
<a name="shell-option_002e"></a>
<h4 class="subsubheading">shell option.</h4>
<a name="xml2ag-shell"></a>
<a name="index-xml2ag_002dshell"></a>
</p>
<p>This is the “name or path name of shell to use” option.
This option takes an argument string ‘<tt>shell</tt>’.
Pass-through AutoGen argument
<a name="no_002dfmemopen-option-_0028_002dm_0029_002e-1"></a>
<h4 class="subsubheading">no-fmemopen option (-m).</h4>
<a name="xml2ag-no_002dfmemopen"></a>
<a name="index-xml2ag_002dno_002dfmemopen"></a>
</p>
<p>This is the “do not use in-mem streams” option.
Pass-through AutoGen argument
<a name="equate-option_002e"></a>
<h4 class="subsubheading">equate option.</h4>
<a name="xml2ag-equate"></a>
<a name="index-xml2ag_002dequate"></a>
</p>
<p>This is the “characters considered equivalent” option.
This option takes an argument string ‘<tt>char-list</tt>’.
Pass-through AutoGen argument
<a name="base_002dname-option-_0028_002db_0029_002e"></a>
<h4 class="subsubheading">base-name option (-b).</h4>
<a name="xml2ag-base_002dname"></a>
<a name="index-xml2ag_002dbase_002dname"></a>
</p>
<p>This is the “specify <code>name</code> as the base name for output” option.
This option takes an argument string ‘<tt>NAME</tt>’.
Pass-through AutoGen argument
<a name="source_002dtime-option_002e"></a>
<h4 class="subsubheading">source-time option.</h4>
<a name="xml2ag-source_002dtime"></a>
<a name="index-xml2ag_002dsource_002dtime"></a>
</p>
<p>This is the “set mod times to latest source” option.
Pass-through AutoGen argument
<a name="writable-option_002e-1"></a>
<h4 class="subsubheading">writable option.</h4>
<a name="xml2ag-writable"></a>
<a name="index-xml2ag_002dwritable"></a>
</p>
<p>This is the “allow output files to be writable” option.
Pass-through AutoGen argument
<a name="loop_002dlimit-option_002e"></a>
<h4 class="subsubheading">loop-limit option.</h4>
<a name="xml2ag-loop_002dlimit"></a>
<a name="index-xml2ag_002dloop_002dlimit"></a>
</p>
<p>This is the “limit on increment loops” option.
This option takes an argument number ‘<tt>lim</tt>’.
Pass-through AutoGen argument
<a name="timeout-option-_0028_002dt_0029_002e-1"></a>
<h4 class="subsubheading">timeout option (-t).</h4>
<a name="xml2ag-timeout"></a>
<a name="index-xml2ag_002dtimeout"></a>
</p>
<p>This is the “limit server shell operations to <code>seconds</code>” option.
This option takes an argument number ‘<tt>SECONDS</tt>’.
Pass-through AutoGen argument
<a name="trace-option_002e-1"></a>
<h4 class="subsubheading">trace option.</h4>
<a name="xml2ag-trace"></a>
<a name="index-xml2ag_002dtrace"></a>
</p>
<p>This is the “tracing level of detail” option.
This option takes an argument keyword ‘<tt>level</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
This option takes a keyword as its argument.
The argument sets an enumeration value that can be tested by comparing the option value macro (OPT_VALUE_TRACE).
The available keywords are:
<table><tr><td> </td><td><pre class="example"> nothing debug-message server-shell
templates block-macros expressions
everything
</pre></td></tr></table>
<p>or their numeric equivalent.</p></li></ul>
<p>Pass-through AutoGen argument
<a name="trace_002dout-option_002e"></a>
<h4 class="subsubheading">trace-out option.</h4>
<a name="xml2ag-trace_002dout"></a>
<a name="index-xml2ag_002dtrace_002dout"></a>
</p>
<p>This is the “tracing output file or filter” option.
This option takes an argument string ‘<tt>file</tt>’.
Pass-through AutoGen argument
<a name="show_002ddefs-option_002e-1"></a>
<h4 class="subsubheading">show-defs option.</h4>
<a name="xml2ag-show_002ddefs"></a>
<a name="index-xml2ag_002dshow_002ddefs"></a>
</p>
<p>This is the “show the definition tree” option.
Pass-through AutoGen argument
<a name="used_002ddefines-option_002e-1"></a>
<h4 class="subsubheading">used-defines option.</h4>
<a name="xml2ag-used_002ddefines"></a>
<a name="index-xml2ag_002dused_002ddefines"></a>
</p>
<p>This is the “show the definitions used” option.
Pass-through AutoGen argument
<a name="core-option-_0028_002dC_0029_002e-1"></a>
<h4 class="subsubheading">core option (-C).</h4>
<a name="xml2ag-core"></a>
<a name="index-xml2ag_002dcore"></a>
</p>
<p>This is the “leave a core dump on a failure exit” option.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
must be compiled in by defining <code>HAVE_SYS_RESOURCE_H</code> during the compilation.
</li></ul>
<p>Many systems default to a zero sized core limit. If the system
has the sys/resource.h header and if this option is supplied,
then in the failure exit path, autogen will attempt to set the
soft core limit to whatever the hard core limit is. If that
does not work, then an administrator must raise the hard core
size limit.
<a name="skip_002dsuffix-option-_0028_002ds_0029_002e-1"></a>
<h4 class="subsubheading">skip-suffix option (-s).</h4>
<a name="xml2ag-skip_002dsuffix"></a>
<a name="index-xml2ag_002dskip_002dsuffix"></a>
</p>
<p>This is the “skip the file with this ‘<tt>suffix</tt>’” option.
This option takes an argument string ‘<tt>SUFFIX</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
may appear an unlimited number of times.
</li><li>
must not appear in combination with any of the following options:
select-suffix.
</li></ul>
<p>Pass-through AutoGen argument
<a name="select_002dsuffix-option-_0028_002do_0029_002e"></a>
<h4 class="subsubheading">select-suffix option (-o).</h4>
<a name="xml2ag-select_002dsuffix"></a>
<a name="index-xml2ag_002dselect_002dsuffix"></a>
</p>
<p>This is the “specify this output suffix” option.
This option takes an argument string ‘<tt>SUFFIX</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
may appear an unlimited number of times.
</li></ul>
<p>Pass-through AutoGen argument
<a name="define-option-_0028_002dD_0029_002e-1"></a>
<h4 class="subsubheading">define option (-D).</h4>
<a name="xml2ag-define"></a>
<a name="index-xml2ag_002ddefine"></a>
</p>
<p>This is the “name to add to definition list” option.
This option takes an argument string ‘<tt>value</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
may appear an unlimited number of times.
</li></ul>
<p>Pass-through AutoGen argument
<a name="undefine-option-_0028_002dU_0029_002e-1"></a>
<h4 class="subsubheading">undefine option (-U).</h4>
<a name="xml2ag-undefine"></a>
<a name="index-xml2ag_002dundefine"></a>
</p>
<p>This is the “definition list removal pattern” option.
This option takes an argument string ‘<tt>name-pat</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
may appear an unlimited number of times.
</li></ul>
<p>Pass-through AutoGen argument
<a name="make_002ddep-option-_0028_002dM_0029_002e"></a>
<h4 class="subsubheading">make-dep option (-M).</h4>
<a name="xml2ag-make_002ddep"></a>
<a name="index-xml2ag_002dmake_002ddep"></a>
</p>
<p>This is the “emit make dependency file” option.
This option takes an optional argument string ‘<tt>type</tt>’.
</p>
<p>This option has some usage constraints. It:
</p><ul>
<li>
may appear an unlimited number of times.
</li></ul>
<p>Pass-through AutoGen argument
</p><hr size="6">
<a name="xml2ag-exit-status"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#xml2ag-autogen_002doptions" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#snprintfv" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#xml2ag-Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="xml2ag-exit-status-1"></a>
<h3 class="subsection">8.7.4 xml2ag exit status</h3>
<p>One of the following exit values will be returned:
</p><dl compact="compact">
<dt> ‘<samp>0 (EXIT_SUCCESS)</samp>’</dt>
<dd><p>Successful program execution.
</p></dd>
<dt> ‘<samp>1 (EXIT_FAILURE)</samp>’</dt>
<dd><p>The operation failed or the command syntax was not valid.
</p></dd>
</dl>
<hr size="6">
<a name="snprintfv"></a>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#xml2ag-exit-status" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Add_002dOns" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Replacement-for-Stdio-Formatting-Library"></a>
<h2 class="section">8.8 Replacement for Stdio Formatting Library</h2>
<p> Using the ‘printf’ formatting routines in a portable fashion has
always been a pain, and this package has been way more pain than anyone
ever imagined. Hopefully, with this release of snprintfv, the pain is
now over for all time.
</p>
<p> The issues with portable usage are these:
</p>
<ol>
<li>
Argument number specifiers are often either not implemented or are
buggy. Even GNU libc, version 1 got it wrong.
</li><li>
ANSI/ISO "forgot" to provide a mechanism for computing argument
lists for vararg procedures.
</li><li>
The argument array version of printf (‘printfv()’) is not
generally available, does not work with the native printf, and
does not have a working argument number specifier in the format
specification. (Last I knew, anyway.)
</li><li>
You cannot fake varargs by calling ‘vprintf()’ with an array of
arguments, because ANSI does not require such an implementation
and some vendors play funny tricks because they are allowed to.
</li></ol>
<p> These four issues made it impossible for AutoGen to ship without its
own implementation of the ‘printf’ formatting routines. Since we were
forced to do this, we decided to make the formatting routines both
better and more complete :-). We addressed these issues and added the
following features to the common printf API:
</p>
<ol>
<li>
The formatted output can be written to
<ul>
<li>
a string allocated by the formatting function (‘asprintf()’).
</li><li>
a file descriptor instead of a file stream (‘dprintf()’).
</li><li>
a user specified stream (‘stream_printf()’).
</li></ul>
</li><li>
The formatting functions can be augmented with your own functions.
These functions are allowed to consume more than one character
from the format, but must commence with a unique character. For
example,
<table><tr><td> </td><td><pre class="example">"%{struct stat}\n"
</pre></td></tr></table>
<p>might be used with ’{’ registered to a procedure that would look
up "struct stat" in a symbol table and do appropriate things,
consuming the format string through the ’}’ character.
</p></li></ol>
<p> Gary V. Vaughan was generous enough to supply this implementation.
Many thanks!!
</p>
<p> For further details, the reader is referred to the snprintfv
documentation. These functions are also available in the template
processing as ‘sprintf’ (see section <a href="autogen_3.html#SCM-sprintf">‘<tt>sprintf</tt>’ - format a string</a>), ‘printf’
(see section <a href="autogen_3.html#SCM-printf">‘<tt>printf</tt>’ - format to stdout</a>), ‘fprintf’ (see section <a href="autogen_3.html#SCM-fprintf">‘<tt>fprintf</tt>’ - format to a file</a>), and ‘shellf’
(see section <a href="autogen_3.html#SCM-shellf">‘<tt>shellf</tt>’ - format a string, run shell</a>).
</p>
<hr size="6">
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Add_002dOns" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="autogen_9.html#Future" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="autogen_7.html#AutoOpts" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
<font size="-1">
This document was generated by <em>Build Daemon user</em> on <em>December 14, 2013</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
</font>
<br>
</p>
</body>
</html>
|