diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | awkgram.c | 246 | ||||
-rw-r--r-- | awkgram.y | 6 | ||||
-rw-r--r-- | doc/ChangeLog | 8 | ||||
-rw-r--r-- | doc/awkcard.in | 12 | ||||
-rw-r--r-- | doc/gawk.1 | 24 | ||||
-rw-r--r-- | doc/gawk.info | 1158 | ||||
-rw-r--r-- | doc/gawk.texi | 25 | ||||
-rw-r--r-- | doc/gawktexi.in | 25 | ||||
-rw-r--r-- | main.c | 12 | ||||
-rw-r--r-- | test/ChangeLog | 4 | ||||
-rw-r--r-- | test/badargs.ok | 1 |
13 files changed, 832 insertions, 707 deletions
@@ -1,3 +1,16 @@ +2016-02-05 Arnold D. Robbins <arnold@skeeve.com> + + Make optimization (constant folding and tail call recursion) + be on by default. + + * awkgram.y (common_exp): Only do concatenation of two strings(!) + * main.c (do_optimize): Init to true. + (optab): Add new -s/--no-optimize option. + (usage): Update message to include it. + (parse_args): Parse it. Set do_optimize to false if pretty + printing or profiling. + * NEWS: Updated. + 2016-01-28 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (SUBDIRS): Include extras. Otherwise dist does @@ -69,6 +69,11 @@ Changes from 4.1.x to 4.2.0 17. Support for GNU/Linux on Alpha systems has been removed. +18. Optimizations are now enabled by default. Use the new -s/--no-optimize + option(s) to disable them. Pretty printing and profiling automatically + disable optimizations so that the output program is the same as the + original input program. + Changes from 4.1.3 to 4.1.x --------------------------- @@ -679,13 +679,13 @@ static const yytype_uint16 yyrline[] = 1355, 1363, 1368, 1377, 1378, 1383, 1385, 1390, 1392, 1400, 1405, 1413, 1414, 1419, 1426, 1430, 1432, 1434, 1447, 1464, 1474, 1481, 1483, 1488, 1490, 1492, 1500, 1502, 1507, 1509, - 1514, 1516, 1518, 1568, 1570, 1572, 1574, 1576, 1578, 1580, - 1582, 1596, 1601, 1606, 1631, 1637, 1639, 1641, 1643, 1645, - 1647, 1652, 1656, 1688, 1690, 1696, 1702, 1715, 1716, 1717, - 1722, 1727, 1731, 1735, 1750, 1763, 1768, 1805, 1834, 1835, - 1841, 1842, 1847, 1849, 1856, 1873, 1890, 1892, 1899, 1904, - 1912, 1922, 1934, 1943, 1947, 1951, 1955, 1959, 1963, 1966, - 1968, 1972, 1976, 1980 + 1514, 1516, 1518, 1574, 1576, 1578, 1580, 1582, 1584, 1586, + 1588, 1602, 1607, 1612, 1637, 1643, 1645, 1647, 1649, 1651, + 1653, 1658, 1662, 1694, 1696, 1702, 1708, 1721, 1722, 1723, + 1728, 1733, 1737, 1741, 1756, 1769, 1774, 1811, 1840, 1841, + 1847, 1848, 1853, 1855, 1862, 1879, 1896, 1898, 1905, 1910, + 1918, 1928, 1940, 1949, 1953, 1957, 1961, 1965, 1969, 1972, + 1974, 1978, 1982, 1986 }; #endif @@ -3579,6 +3579,11 @@ regular_print: NODE *n2 = (yyvsp[0])->nexti->memory; size_t nlen; + // 1.5 "" # can't fold this if program mucks with CONVFMT. + // See test #12 in test/posix.awk. + if ((n1->flags & (NUMBER|NUMINT)) != 0 || (n2->flags & (NUMBER|NUMINT)) != 0) + goto plain_concat; + n1 = force_string(n1); n2 = force_string(n2); nlen = n1->stlen + n2->stlen; @@ -3593,6 +3598,7 @@ regular_print: bcfree((yyvsp[0])); (yyval) = (yyvsp[-1]); } else { + plain_concat: (yyval) = list_append(list_merge((yyvsp[-1]), (yyvsp[0])), instruction(Op_concat)); (yyval)->lasti->concat_flag = (is_simple_var ? CSVAR : 0); (yyval)->lasti->expr_count = count; @@ -3600,47 +3606,47 @@ regular_print: max_args = count; } } -#line 3604 "awkgram.c" /* yacc.c:1646 */ +#line 3610 "awkgram.c" /* yacc.c:1646 */ break; case 144: -#line 1571 "awkgram.y" /* yacc.c:1646 */ +#line 1577 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3610 "awkgram.c" /* yacc.c:1646 */ +#line 3616 "awkgram.c" /* yacc.c:1646 */ break; case 145: -#line 1573 "awkgram.y" /* yacc.c:1646 */ +#line 1579 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3616 "awkgram.c" /* yacc.c:1646 */ +#line 3622 "awkgram.c" /* yacc.c:1646 */ break; case 146: -#line 1575 "awkgram.y" /* yacc.c:1646 */ +#line 1581 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3622 "awkgram.c" /* yacc.c:1646 */ +#line 3628 "awkgram.c" /* yacc.c:1646 */ break; case 147: -#line 1577 "awkgram.y" /* yacc.c:1646 */ +#line 1583 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3628 "awkgram.c" /* yacc.c:1646 */ +#line 3634 "awkgram.c" /* yacc.c:1646 */ break; case 148: -#line 1579 "awkgram.y" /* yacc.c:1646 */ +#line 1585 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3634 "awkgram.c" /* yacc.c:1646 */ +#line 3640 "awkgram.c" /* yacc.c:1646 */ break; case 149: -#line 1581 "awkgram.y" /* yacc.c:1646 */ +#line 1587 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3640 "awkgram.c" /* yacc.c:1646 */ +#line 3646 "awkgram.c" /* yacc.c:1646 */ break; case 150: -#line 1583 "awkgram.y" /* yacc.c:1646 */ +#line 1589 "awkgram.y" /* yacc.c:1646 */ { /* * In BEGINFILE/ENDFILE, allow `getline [var] < file' @@ -3654,29 +3660,29 @@ regular_print: _("non-redirected `getline' undefined inside END action")); (yyval) = mk_getline((yyvsp[-2]), (yyvsp[-1]), (yyvsp[0]), redirect_input); } -#line 3658 "awkgram.c" /* yacc.c:1646 */ +#line 3664 "awkgram.c" /* yacc.c:1646 */ break; case 151: -#line 1597 "awkgram.y" /* yacc.c:1646 */ +#line 1603 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[0])->opcode = Op_postincrement; (yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0])); } -#line 3667 "awkgram.c" /* yacc.c:1646 */ +#line 3673 "awkgram.c" /* yacc.c:1646 */ break; case 152: -#line 1602 "awkgram.y" /* yacc.c:1646 */ +#line 1608 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[0])->opcode = Op_postdecrement; (yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0])); } -#line 3676 "awkgram.c" /* yacc.c:1646 */ +#line 3682 "awkgram.c" /* yacc.c:1646 */ break; case 153: -#line 1607 "awkgram.y" /* yacc.c:1646 */ +#line 1613 "awkgram.y" /* yacc.c:1646 */ { if (do_lint_old) { warning_ln((yyvsp[-1])->source_line, @@ -3696,64 +3702,64 @@ regular_print: (yyval) = list_append(list_merge(t, (yyvsp[0])), (yyvsp[-1])); } } -#line 3700 "awkgram.c" /* yacc.c:1646 */ +#line 3706 "awkgram.c" /* yacc.c:1646 */ break; case 154: -#line 1632 "awkgram.y" /* yacc.c:1646 */ +#line 1638 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_getline((yyvsp[-1]), (yyvsp[0]), (yyvsp[-3]), (yyvsp[-2])->redir_type); bcfree((yyvsp[-2])); } -#line 3709 "awkgram.c" /* yacc.c:1646 */ +#line 3715 "awkgram.c" /* yacc.c:1646 */ break; case 155: -#line 1638 "awkgram.y" /* yacc.c:1646 */ +#line 1644 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3715 "awkgram.c" /* yacc.c:1646 */ +#line 3721 "awkgram.c" /* yacc.c:1646 */ break; case 156: -#line 1640 "awkgram.y" /* yacc.c:1646 */ +#line 1646 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3721 "awkgram.c" /* yacc.c:1646 */ +#line 3727 "awkgram.c" /* yacc.c:1646 */ break; case 157: -#line 1642 "awkgram.y" /* yacc.c:1646 */ +#line 1648 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3727 "awkgram.c" /* yacc.c:1646 */ +#line 3733 "awkgram.c" /* yacc.c:1646 */ break; case 158: -#line 1644 "awkgram.y" /* yacc.c:1646 */ +#line 1650 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3733 "awkgram.c" /* yacc.c:1646 */ +#line 3739 "awkgram.c" /* yacc.c:1646 */ break; case 159: -#line 1646 "awkgram.y" /* yacc.c:1646 */ +#line 1652 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3739 "awkgram.c" /* yacc.c:1646 */ +#line 3745 "awkgram.c" /* yacc.c:1646 */ break; case 160: -#line 1648 "awkgram.y" /* yacc.c:1646 */ +#line 1654 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3745 "awkgram.c" /* yacc.c:1646 */ +#line 3751 "awkgram.c" /* yacc.c:1646 */ break; case 161: -#line 1653 "awkgram.y" /* yacc.c:1646 */ +#line 1659 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_create((yyvsp[0])); } -#line 3753 "awkgram.c" /* yacc.c:1646 */ +#line 3759 "awkgram.c" /* yacc.c:1646 */ break; case 162: -#line 1657 "awkgram.y" /* yacc.c:1646 */ +#line 1663 "awkgram.y" /* yacc.c:1646 */ { if ((yyvsp[0])->opcode == Op_match_rec) { (yyvsp[0])->opcode = Op_nomatch; @@ -3785,37 +3791,37 @@ regular_print: } } } -#line 3789 "awkgram.c" /* yacc.c:1646 */ +#line 3795 "awkgram.c" /* yacc.c:1646 */ break; case 163: -#line 1689 "awkgram.y" /* yacc.c:1646 */ +#line 1695 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[-1]); } -#line 3795 "awkgram.c" /* yacc.c:1646 */ +#line 3801 "awkgram.c" /* yacc.c:1646 */ break; case 164: -#line 1691 "awkgram.y" /* yacc.c:1646 */ +#line 1697 "awkgram.y" /* yacc.c:1646 */ { (yyval) = snode((yyvsp[-1]), (yyvsp[-3])); if ((yyval) == NULL) YYABORT; } -#line 3805 "awkgram.c" /* yacc.c:1646 */ +#line 3811 "awkgram.c" /* yacc.c:1646 */ break; case 165: -#line 1697 "awkgram.y" /* yacc.c:1646 */ +#line 1703 "awkgram.y" /* yacc.c:1646 */ { (yyval) = snode((yyvsp[-1]), (yyvsp[-3])); if ((yyval) == NULL) YYABORT; } -#line 3815 "awkgram.c" /* yacc.c:1646 */ +#line 3821 "awkgram.c" /* yacc.c:1646 */ break; case 166: -#line 1703 "awkgram.y" /* yacc.c:1646 */ +#line 1709 "awkgram.y" /* yacc.c:1646 */ { static bool warned = false; @@ -3828,45 +3834,45 @@ regular_print: if ((yyval) == NULL) YYABORT; } -#line 3832 "awkgram.c" /* yacc.c:1646 */ +#line 3838 "awkgram.c" /* yacc.c:1646 */ break; case 169: -#line 1718 "awkgram.y" /* yacc.c:1646 */ +#line 1724 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[-1])->opcode = Op_preincrement; (yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1])); } -#line 3841 "awkgram.c" /* yacc.c:1646 */ +#line 3847 "awkgram.c" /* yacc.c:1646 */ break; case 170: -#line 1723 "awkgram.y" /* yacc.c:1646 */ +#line 1729 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[-1])->opcode = Op_predecrement; (yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1])); } -#line 3850 "awkgram.c" /* yacc.c:1646 */ +#line 3856 "awkgram.c" /* yacc.c:1646 */ break; case 171: -#line 1728 "awkgram.y" /* yacc.c:1646 */ +#line 1734 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_create((yyvsp[0])); } -#line 3858 "awkgram.c" /* yacc.c:1646 */ +#line 3864 "awkgram.c" /* yacc.c:1646 */ break; case 172: -#line 1732 "awkgram.y" /* yacc.c:1646 */ +#line 1738 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_create((yyvsp[0])); } -#line 3866 "awkgram.c" /* yacc.c:1646 */ +#line 3872 "awkgram.c" /* yacc.c:1646 */ break; case 173: -#line 1736 "awkgram.y" /* yacc.c:1646 */ +#line 1742 "awkgram.y" /* yacc.c:1646 */ { if ((yyvsp[0])->lasti->opcode == Op_push_i && ((yyvsp[0])->lasti->memory->flags & (STRCUR|STRING)) == 0 @@ -3881,11 +3887,11 @@ regular_print: (yyval) = list_append((yyvsp[0]), (yyvsp[-1])); } } -#line 3885 "awkgram.c" /* yacc.c:1646 */ +#line 3891 "awkgram.c" /* yacc.c:1646 */ break; case 174: -#line 1751 "awkgram.y" /* yacc.c:1646 */ +#line 1757 "awkgram.y" /* yacc.c:1646 */ { /* * was: $$ = $2 @@ -3895,20 +3901,20 @@ regular_print: (yyvsp[-1])->memory = make_number(0.0); (yyval) = list_append((yyvsp[0]), (yyvsp[-1])); } -#line 3899 "awkgram.c" /* yacc.c:1646 */ +#line 3905 "awkgram.c" /* yacc.c:1646 */ break; case 175: -#line 1764 "awkgram.y" /* yacc.c:1646 */ +#line 1770 "awkgram.y" /* yacc.c:1646 */ { func_use((yyvsp[0])->lasti->func_name, FUNC_USE); (yyval) = (yyvsp[0]); } -#line 3908 "awkgram.c" /* yacc.c:1646 */ +#line 3914 "awkgram.c" /* yacc.c:1646 */ break; case 176: -#line 1769 "awkgram.y" /* yacc.c:1646 */ +#line 1775 "awkgram.y" /* yacc.c:1646 */ { /* indirect function call */ INSTRUCTION *f, *t; @@ -3942,11 +3948,11 @@ regular_print: (yyval) = list_prepend((yyvsp[0]), t); at_seen = false; } -#line 3946 "awkgram.c" /* yacc.c:1646 */ +#line 3952 "awkgram.c" /* yacc.c:1646 */ break; case 177: -#line 1806 "awkgram.y" /* yacc.c:1646 */ +#line 1812 "awkgram.y" /* yacc.c:1646 */ { NODE *n; @@ -3971,49 +3977,49 @@ regular_print: (yyval) = list_append(t, (yyvsp[-3])); } } -#line 3975 "awkgram.c" /* yacc.c:1646 */ +#line 3981 "awkgram.c" /* yacc.c:1646 */ break; case 178: -#line 1834 "awkgram.y" /* yacc.c:1646 */ +#line 1840 "awkgram.y" /* yacc.c:1646 */ { (yyval) = NULL; } -#line 3981 "awkgram.c" /* yacc.c:1646 */ +#line 3987 "awkgram.c" /* yacc.c:1646 */ break; case 179: -#line 1836 "awkgram.y" /* yacc.c:1646 */ +#line 1842 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[0]); } -#line 3987 "awkgram.c" /* yacc.c:1646 */ +#line 3993 "awkgram.c" /* yacc.c:1646 */ break; case 180: -#line 1841 "awkgram.y" /* yacc.c:1646 */ +#line 1847 "awkgram.y" /* yacc.c:1646 */ { (yyval) = NULL; } -#line 3993 "awkgram.c" /* yacc.c:1646 */ +#line 3999 "awkgram.c" /* yacc.c:1646 */ break; case 181: -#line 1843 "awkgram.y" /* yacc.c:1646 */ +#line 1849 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[-1]); } -#line 3999 "awkgram.c" /* yacc.c:1646 */ +#line 4005 "awkgram.c" /* yacc.c:1646 */ break; case 182: -#line 1848 "awkgram.y" /* yacc.c:1646 */ +#line 1854 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[0]); } -#line 4005 "awkgram.c" /* yacc.c:1646 */ +#line 4011 "awkgram.c" /* yacc.c:1646 */ break; case 183: -#line 1850 "awkgram.y" /* yacc.c:1646 */ +#line 1856 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_merge((yyvsp[-1]), (yyvsp[0])); } -#line 4013 "awkgram.c" /* yacc.c:1646 */ +#line 4019 "awkgram.c" /* yacc.c:1646 */ break; case 184: -#line 1857 "awkgram.y" /* yacc.c:1646 */ +#line 1863 "awkgram.y" /* yacc.c:1646 */ { INSTRUCTION *ip = (yyvsp[0])->lasti; int count = ip->sub_count; /* # of SUBSEP-seperated expressions */ @@ -4027,11 +4033,11 @@ regular_print: sub_counter++; /* count # of dimensions */ (yyval) = (yyvsp[0]); } -#line 4031 "awkgram.c" /* yacc.c:1646 */ +#line 4037 "awkgram.c" /* yacc.c:1646 */ break; case 185: -#line 1874 "awkgram.y" /* yacc.c:1646 */ +#line 1880 "awkgram.y" /* yacc.c:1646 */ { INSTRUCTION *t = (yyvsp[-1]); if ((yyvsp[-1]) == NULL) { @@ -4045,31 +4051,31 @@ regular_print: (yyvsp[0])->sub_count = count_expressions(&t, false); (yyval) = list_append(t, (yyvsp[0])); } -#line 4049 "awkgram.c" /* yacc.c:1646 */ +#line 4055 "awkgram.c" /* yacc.c:1646 */ break; case 186: -#line 1891 "awkgram.y" /* yacc.c:1646 */ +#line 1897 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[0]); } -#line 4055 "awkgram.c" /* yacc.c:1646 */ +#line 4061 "awkgram.c" /* yacc.c:1646 */ break; case 187: -#line 1893 "awkgram.y" /* yacc.c:1646 */ +#line 1899 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_merge((yyvsp[-1]), (yyvsp[0])); } -#line 4063 "awkgram.c" /* yacc.c:1646 */ +#line 4069 "awkgram.c" /* yacc.c:1646 */ break; case 188: -#line 1900 "awkgram.y" /* yacc.c:1646 */ +#line 1906 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[-1]); } -#line 4069 "awkgram.c" /* yacc.c:1646 */ +#line 4075 "awkgram.c" /* yacc.c:1646 */ break; case 189: -#line 1905 "awkgram.y" /* yacc.c:1646 */ +#line 1911 "awkgram.y" /* yacc.c:1646 */ { char *var_name = (yyvsp[0])->lextok; @@ -4077,22 +4083,22 @@ regular_print: (yyvsp[0])->memory = variable((yyvsp[0])->source_line, var_name, Node_var_new); (yyval) = list_create((yyvsp[0])); } -#line 4081 "awkgram.c" /* yacc.c:1646 */ +#line 4087 "awkgram.c" /* yacc.c:1646 */ break; case 190: -#line 1913 "awkgram.y" /* yacc.c:1646 */ +#line 1919 "awkgram.y" /* yacc.c:1646 */ { char *arr = (yyvsp[-1])->lextok; (yyvsp[-1])->memory = variable((yyvsp[-1])->source_line, arr, Node_var_new); (yyvsp[-1])->opcode = Op_push_array; (yyval) = list_prepend((yyvsp[0]), (yyvsp[-1])); } -#line 4092 "awkgram.c" /* yacc.c:1646 */ +#line 4098 "awkgram.c" /* yacc.c:1646 */ break; case 191: -#line 1923 "awkgram.y" /* yacc.c:1646 */ +#line 1929 "awkgram.y" /* yacc.c:1646 */ { INSTRUCTION *ip = (yyvsp[0])->nexti; if (ip->opcode == Op_push @@ -4104,73 +4110,73 @@ regular_print: } else (yyval) = (yyvsp[0]); } -#line 4108 "awkgram.c" /* yacc.c:1646 */ +#line 4114 "awkgram.c" /* yacc.c:1646 */ break; case 192: -#line 1935 "awkgram.y" /* yacc.c:1646 */ +#line 1941 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_append((yyvsp[-1]), (yyvsp[-2])); if ((yyvsp[0]) != NULL) mk_assignment((yyvsp[-1]), NULL, (yyvsp[0])); } -#line 4118 "awkgram.c" /* yacc.c:1646 */ +#line 4124 "awkgram.c" /* yacc.c:1646 */ break; case 193: -#line 1944 "awkgram.y" /* yacc.c:1646 */ +#line 1950 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[0])->opcode = Op_postincrement; } -#line 4126 "awkgram.c" /* yacc.c:1646 */ +#line 4132 "awkgram.c" /* yacc.c:1646 */ break; case 194: -#line 1948 "awkgram.y" /* yacc.c:1646 */ +#line 1954 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[0])->opcode = Op_postdecrement; } -#line 4134 "awkgram.c" /* yacc.c:1646 */ +#line 4140 "awkgram.c" /* yacc.c:1646 */ break; case 195: -#line 1951 "awkgram.y" /* yacc.c:1646 */ +#line 1957 "awkgram.y" /* yacc.c:1646 */ { (yyval) = NULL; } -#line 4140 "awkgram.c" /* yacc.c:1646 */ +#line 4146 "awkgram.c" /* yacc.c:1646 */ break; case 197: -#line 1959 "awkgram.y" /* yacc.c:1646 */ +#line 1965 "awkgram.y" /* yacc.c:1646 */ { yyerrok; } -#line 4146 "awkgram.c" /* yacc.c:1646 */ +#line 4152 "awkgram.c" /* yacc.c:1646 */ break; case 198: -#line 1963 "awkgram.y" /* yacc.c:1646 */ +#line 1969 "awkgram.y" /* yacc.c:1646 */ { yyerrok; } -#line 4152 "awkgram.c" /* yacc.c:1646 */ +#line 4158 "awkgram.c" /* yacc.c:1646 */ break; case 201: -#line 1972 "awkgram.y" /* yacc.c:1646 */ +#line 1978 "awkgram.y" /* yacc.c:1646 */ { yyerrok; } -#line 4158 "awkgram.c" /* yacc.c:1646 */ +#line 4164 "awkgram.c" /* yacc.c:1646 */ break; case 202: -#line 1976 "awkgram.y" /* yacc.c:1646 */ +#line 1982 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[0]); yyerrok; } -#line 4164 "awkgram.c" /* yacc.c:1646 */ +#line 4170 "awkgram.c" /* yacc.c:1646 */ break; case 203: -#line 1980 "awkgram.y" /* yacc.c:1646 */ +#line 1986 "awkgram.y" /* yacc.c:1646 */ { yyerrok; } -#line 4170 "awkgram.c" /* yacc.c:1646 */ +#line 4176 "awkgram.c" /* yacc.c:1646 */ break; -#line 4174 "awkgram.c" /* yacc.c:1646 */ +#line 4180 "awkgram.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -4398,7 +4404,7 @@ yyreturn: #endif return yyresult; } -#line 1982 "awkgram.y" /* yacc.c:1906 */ +#line 1988 "awkgram.y" /* yacc.c:1906 */ struct token { @@ -1541,6 +1541,11 @@ common_exp NODE *n2 = $2->nexti->memory; size_t nlen; + // 1.5 "" # can't fold this if program mucks with CONVFMT. + // See test #12 in test/posix.awk. + if ((n1->flags & (NUMBER|NUMINT)) != 0 || (n2->flags & (NUMBER|NUMINT)) != 0) + goto plain_concat; + n1 = force_string(n1); n2 = force_string(n2); nlen = n1->stlen + n2->stlen; @@ -1555,6 +1560,7 @@ common_exp bcfree($2); $$ = $1; } else { + plain_concat: $$ = list_append(list_merge($1, $2), instruction(Op_concat)); $$->lasti->concat_flag = (is_simple_var ? CSVAR : 0); $$->lasti->expr_count = count; diff --git a/doc/ChangeLog b/doc/ChangeLog index 30ecbe58..221bf40b 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,11 @@ +2016-02-05 Arnold D. Robbins <arnold@skeeve.com> + + * gawk.texi: Document that optimization in now the default, + there are new -s/--no-optimize options and that + pretty-printing and profiling disable optimization. + * gawk.1: Ditto. + * awkcard.in: Ditto. + 2016-02-03 Andrew J. Schorr <aschorr@telemetry-investments.com> * gawktexi.in (Command-Line Options): Change wording of -M description diff --git a/doc/awkcard.in b/doc/awkcard.in index c2ae8a74..06085343 100644 --- a/doc/awkcard.in +++ b/doc/awkcard.in @@ -244,7 +244,7 @@ Overridden by \*(FC\-\^\-posix\*(FR. .TI "\*(FC\-c\*(FR, \*(FC\-\^\-traditional\*(FR Disable \*(GK-specific extensions. .TI "\*(FC\-C\*(FR, \*(FC\-\^\-copyright\*(FR -Print the short version of the GNU +Print the short GNU copyright information on \*(FCstdout\*(FR. .TI "\*(FC\-d\*(FR[\*(FIfile\*(FR], \*(FC\-\^\-dump-variables\*(FR[\*(FC=\*(FIfile\*(FR] Print a sorted list of global variables, @@ -292,7 +292,7 @@ Force use of the locale's decimal point character when parsing input data. Output a pretty printed version of the program to \*(FIfile\*(FR (default: \*(FCawkprof.out\*(FR). .TI "\*(FC\-O\*(FR, \*(FC\-\^\-optimize\*(FR -Enable some internal optimizations. +Enable internal optimizations (default is on). .TI "\*(FC\-p\*(FR[\*(FC\*(FIfile\*(FR], \*(FC\-\^\-profile\*(FR[\*(FC=\*(FIfile\*(FR] Send profiling data to \*(FIfile\*(FR (default: \*(FCawkprof.out\*(FR). @@ -300,6 +300,9 @@ The profile contains execution counts in the left margin of each statement in the program. .TI "\*(FC\-P\*(FR, \*(FC\-\^\-posix\*(FR Disable common and GNU extensions.\*(CB +.TI "\*(FC\-r\*(FR, \*(FC\-\^\-re\-interval\*(FR +Enable \*(FIinterval expressions\*(FR. +(Needed with \*(FC\-c\*(FR.) .in -4n .EB "\s+2\f(HBCOMMAND LINE ARGUMENTS (\*(GK\f(HB)\*(FR\s0" @@ -311,9 +314,8 @@ Disable common and GNU extensions.\*(CB .ES .fi .in +4n -.TI "\*(FC\-r\*(FR, \*(FC\-\^\-re\-interval\*(FR -Enable \*(FIinterval expressions\*(FR. -(Needed with \*(FC\-c\*(FR.) +.TI "\*(FC\-s\*(FR, \*(FC\-\^\-no\-optimize\*(FR +Disable internal optimizations. .TI "\*(FC\-S\*(FR, \*(FC\-\^\-sandbox\*(FR Disable the \*(FCsystem()\*(FR function, input redirection with \*(FCgetline\*(FR, @@ -13,7 +13,7 @@ . if \w'\(rq' .ds rq "\(rq . \} .\} -.TH GAWK 1 "Jan 14 2016" "Free Software Foundation" "Utility Commands" +.TH GAWK 1 "Feb 04 2016" "Free Software Foundation" "Utility Commands" .SH NAME gawk \- pattern scanning and processing language .SH SYNOPSIS @@ -405,17 +405,20 @@ is provided, uses a file named .B awkprof.out in the current directory. +Implies +.BR \-\^\-no\-optimize . .TP .PD 0 .B \-O .TP .PD .B \-\^\-optimize -Enable optimizations upon the internal representation of the program. +Enable +.IR gawk 's +default optimizations upon the internal representation of the program. Currently, this includes simple constant-folding, and tail call -elimination for recursive functions. The -.I gawk -maintainer hopes to add additional optimizations over time. +elimination for recursive functions. +This option is on by default. .TP .PD 0 \fB\-p\fR[\fIprof-file\fR] @@ -428,6 +431,8 @@ The default is .BR awkprof.out . The profile contains execution counts of each statement in the program in the left margin and function call counts for each user-defined function. +Implies +.BR \-\^\-no\-optimize . .TP .PD 0 .B \-P @@ -488,6 +493,15 @@ They are enabled by default, but this option remains for use with .BR \-\^\-traditional . .TP .PD 0 +.B \-s +.TP +.PD +.B \-\^\-no\-optimize +Disable +.IR gawk 's +default optimizations upon the internal representation of the program. +.TP +.PD 0 .BI \-S .TP .PD diff --git a/doc/gawk.info b/doc/gawk.info index 8afb1e11..16c76d2e 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -2630,28 +2630,33 @@ The following list describes options mandated by the POSIX standard: '-o'[FILE] '--pretty-print'['='FILE] - Enable pretty-printing of 'awk' programs. By default, the output - program is created in a file named 'awkprof.out' (*note - Profiling::). The optional FILE argument allows you to specify a - different file name for the output. No space is allowed between - the '-o' and FILE, if FILE is supplied. + Enable pretty-printing of 'awk' programs. Implies '--no-optimize'. + By default, the output program is created in a file named + 'awkprof.out' (*note Profiling::). The optional FILE argument + allows you to specify a different file name for the output. No + space is allowed between the '-o' and FILE, if FILE is supplied. NOTE: In the past, this option would also execute your program. This is no longer the case. '-O' '--optimize' - Enable some optimizations on the internal representation of the - program. At the moment, this includes just simple constant - folding. + Enable 'gawk''s default optimizations on the internal + representation of the program. At the moment, this includes simple + constant folding and tail recursion elimination in function calls. + + These optimizations are enabled by default. This option remains + primarily for backwards compatibilty. However, it may be used to + cancel the effect of an earlier '-s' option (see later in this + list). '-p'[FILE] '--profile'['='FILE] - Enable profiling of 'awk' programs (*note Profiling::). By - default, profiles are created in a file named 'awkprof.out'. The - optional FILE argument allows you to specify a different file name - for the profile file. No space is allowed between the '-p' and - FILE, if FILE is supplied. + Enable profiling of 'awk' programs (*note Profiling::). Implies + '--no-optimize'. By default, profiles are created in a file named + 'awkprof.out'. The optional FILE argument allows you to specify a + different file name for the profile file. No space is allowed + between the '-p' and FILE, if FILE is supplied. The profile contains execution counts for each statement in the program in the left margin, and function call counts for each @@ -2685,6 +2690,11 @@ The following list describes options mandated by the POSIX standard: remains (both for backward compatibility and for use in combination with '--traditional'). +'-s' +'--no-optimize' + Disable 'gawk''s default optimizations on the internal + representation of the program. + '-S' '--sandbox' Disable the 'system()' function, input redirections with 'getline', @@ -20224,6 +20234,10 @@ indentation that the profiling output does. This makes it easy to pretty-print your code once development is completed, and then use the result as the final version of your program. + Because the internal representation of your program is formatted to +recreate an 'awk' program, profiling and pretty-printing automatically +disable 'gawk''s default optimizations. + File: gawk.info, Node: Advanced Features Summary, Prev: Profiling, Up: Advanced Features @@ -26914,16 +26928,16 @@ current version of 'gawk'. - The '-b', '-c', '-C', '-d', '-D', '-e', '-E', '-g', '-h', '-i', '-l', '-L', '-M', '-n', '-N', '-o', '-O', '-p', '-P', - '-r', '-S', '-t', and '-V' short options. Also, the ability - to use GNU-style long-named options that start with '--', and - the '--assign', '--bignum', '--characters-as-bytes', + '-r', '-s', '-S', '-t', and '-V' short options. Also, the + ability to use GNU-style long-named options that start with + '--', and the '--assign', '--bignum', '--characters-as-bytes', '--copyright', '--debug', '--dump-variables', '--exec', '--field-separator', '--file', '--gen-pot', '--help', '--include', '--lint', '--lint-old', '--load', - '--non-decimal-data', '--optimize', '--posix', - '--pretty-print', '--profile', '--re-interval', '--sandbox', - '--source', '--traditional', '--use-lc-numeric', and - '--version' long options (*note Options::). + '--non-decimal-data', '--optimize', '--no-optimize', + '--posix', '--pretty-print', '--profile', '--re-interval', + '--sandbox', '--source', '--traditional', '--use-lc-numeric', + and '--version' long options (*note Options::). * Support for the following obsolete systems was removed from the code and the documentation for 'gawk' version 4.0: @@ -32119,20 +32133,21 @@ Index * --include option: Options. (line 159) * --lint option: Command Line. (line 20) * --lint option <1>: Options. (line 184) -* --lint-old option: Options. (line 289) +* --lint-old option: Options. (line 299) * --load option: Options. (line 172) +* --no-optimize option: Options. (line 285) * --non-decimal-data option: Options. (line 209) * --non-decimal-data option <1>: Nondecimal Data. (line 6) * --non-decimal-data option, strtonum() function and: Nondecimal Data. (line 35) * --optimize option: Options. (line 234) -* --posix option: Options. (line 252) -* --posix option, --traditional option and: Options. (line 267) +* --posix option: Options. (line 257) +* --posix option, --traditional option and: Options. (line 272) * --pretty-print option: Options. (line 223) -* --profile option: Options. (line 240) +* --profile option: Options. (line 245) * --profile option <1>: Profiling. (line 12) -* --re-interval option: Options. (line 273) -* --sandbox option: Options. (line 280) +* --re-interval option: Options. (line 278) +* --sandbox option: Options. (line 290) * --sandbox option, disabling system() function: I/O Functions. (line 129) * --sandbox option, input redirection with getline: Getline. (line 19) @@ -32140,9 +32155,9 @@ Index (line 6) * --source option: Options. (line 117) * --traditional option: Options. (line 82) -* --traditional option, --posix option and: Options. (line 267) +* --traditional option, --posix option and: Options. (line 272) * --use-lc-numeric option: Options. (line 218) -* --version option: Options. (line 294) +* --version option: Options. (line 304) * --with-whiny-user-strftime configuration option: Additional Configuration Options. (line 37) * -b option: Options. (line 69) @@ -32152,31 +32167,32 @@ Index * -D option: Options. (line 108) * -e option: Options. (line 117) * -E option: Options. (line 125) -* -e option <1>: Options. (line 330) +* -e option <1>: Options. (line 340) * -f option: Long. (line 12) * -F option: Options. (line 21) * -f option <1>: Options. (line 25) -* -F option, -Ft sets FS to TAB: Options. (line 302) +* -F option, -Ft sets FS to TAB: Options. (line 312) * -F option, command-line: Command Line Field Separator. (line 6) -* -f option, multiple uses: Options. (line 307) +* -f option, multiple uses: Options. (line 317) * -g option: Options. (line 147) * -h option: Options. (line 154) * -i option: Options. (line 159) * -l option: Options. (line 172) * -l option <1>: Options. (line 184) -* -L option: Options. (line 289) +* -L option: Options. (line 299) * -M option: Options. (line 203) * -n option: Options. (line 209) * -N option: Options. (line 218) * -o option: Options. (line 223) * -O option: Options. (line 234) -* -p option: Options. (line 240) -* -P option: Options. (line 252) -* -r option: Options. (line 273) -* -S option: Options. (line 280) +* -p option: Options. (line 245) +* -P option: Options. (line 257) +* -r option: Options. (line 278) +* -s option: Options. (line 285) +* -S option: Options. (line 290) * -v option: Options. (line 32) -* -V option: Options. (line 294) +* -V option: Options. (line 304) * -v option <1>: Assignment Options. (line 12) * -W option: Options. (line 47) * . (period), regexp operator: Regexp Operators. (line 44) @@ -32475,7 +32491,7 @@ Index * awf (amazingly workable formatter) program: Glossary. (line 24) * awk debugging, enabling: Options. (line 108) * awk language, POSIX version: Assignment Ops. (line 138) -* awk profiling, enabling: Options. (line 240) +* awk profiling, enabling: Options. (line 245) * awk programs: Getting Started. (line 12) * awk programs <1>: Executable Scripts. (line 6) * awk programs <2>: Two Rules. (line 6) @@ -32882,7 +32898,7 @@ Index * cosine: Numeric Functions. (line 16) * counting: Wc Program. (line 6) * csh utility: Statements/Lines. (line 43) -* csh utility, POSIXLY_CORRECT environment variable: Options. (line 348) +* csh utility, POSIXLY_CORRECT environment variable: Options. (line 358) * csh utility, |& operator, comparison with: Two-way I/O. (line 27) * ctime() user-defined function: Function Example. (line 74) * currency symbols, localization: Explaining gettext. (line 104) @@ -33071,7 +33087,7 @@ Index * debugger, read commands from a file: Debugger Info. (line 97) * debugging awk programs: Debugger. (line 6) * debugging gawk, bug reports: Bugs. (line 9) -* decimal point character, locale specific: Options. (line 264) +* decimal point character, locale specific: Options. (line 269) * decrement operators: Increment Ops. (line 35) * default keyword: Switch Statement. (line 6) * Deifik, Scott: Acknowledgments. (line 60) @@ -33512,7 +33528,7 @@ Index * FS variable, --field-separator option and: Options. (line 21) * FS variable, as null string: Single Character Fields. (line 20) -* FS variable, as TAB character: Options. (line 261) +* FS variable, as TAB character: Options. (line 266) * FS variable, changing value of: Field Separators. (line 34) * FS variable, running awk programs and: Cut Program. (line 63) * FS variable, setting from command line: Command Line Field Separator. @@ -33602,7 +33618,7 @@ Index * gawk, ERRNO variable in <3>: Auto-set. (line 87) * gawk, ERRNO variable in <4>: TCP/IP Networking. (line 54) * gawk, escape sequences: Escape Sequences. (line 121) -* gawk, extensions, disabling: Options. (line 252) +* gawk, extensions, disabling: Options. (line 257) * gawk, features, adding: Adding Code. (line 6) * gawk, features, advanced: Advanced Features. (line 6) * gawk, field separators and: User-modified. (line 71) @@ -33665,7 +33681,7 @@ Index * gawk, TEXTDOMAIN variable in: User-modified. (line 152) * gawk, timestamps: Time Functions. (line 6) * gawk, uses for: Preface. (line 34) -* gawk, versions of, information about, printing: Options. (line 294) +* gawk, versions of, information about, printing: Options. (line 304) * gawk, VMS version of: VMS Installation. (line 6) * gawk, word-boundary operator: GNU Regexp Operators. (line 66) @@ -33992,7 +34008,7 @@ Index * lint checking, empty programs: Command Line. (line 16) * lint checking, issuing warnings: Options. (line 184) * lint checking, POSIXLY_CORRECT environment variable: Options. - (line 333) + (line 343) * lint checking, undefined functions: Pass By Value/Reference. (line 85) * LINT variable: User-modified. (line 87) @@ -34008,7 +34024,7 @@ Index * loading, extensions: Options. (line 172) * local variables, in a function: Variable Scope. (line 6) * locale categories: Explaining gettext. (line 81) -* locale decimal point character: Options. (line 264) +* locale decimal point character: Options. (line 269) * locale, definition of: Locales. (line 6) * localization: I18N and L10N. (line 6) * localization, See internationalization, localization: I18N and L10N. @@ -34090,7 +34106,7 @@ Index * networks, programming: TCP/IP Networking. (line 6) * networks, support for: Special Network. (line 6) * newlines: Statements/Lines. (line 6) -* newlines <1>: Options. (line 258) +* newlines <1>: Options. (line 263) * newlines <2>: Boolean Ops. (line 69) * newlines, as record separators: awk split records. (line 12) * newlines, in dynamic regexps: Computed Regexps. (line 60) @@ -34317,7 +34333,7 @@ Index * portability, NF variable, decrementing: Changing Fields. (line 115) * portability, operators: Increment Ops. (line 60) * portability, operators, not in POSIX awk: Precedence. (line 97) -* portability, POSIXLY_CORRECT environment variable: Options. (line 353) +* portability, POSIXLY_CORRECT environment variable: Options. (line 363) * portability, substr() function: String Functions. (line 513) * portable object files: Explaining gettext. (line 37) * portable object files <1>: Translator i18n. (line 6) @@ -34365,12 +34381,12 @@ Index * POSIX awk, regular expressions and: Regexp Operators. (line 161) * POSIX awk, timestamps and: Time Functions. (line 6) * POSIX awk, | I/O operator and: Getline/Pipe. (line 56) -* POSIX mode: Options. (line 252) -* POSIX mode <1>: Options. (line 333) +* POSIX mode: Options. (line 257) +* POSIX mode <1>: Options. (line 343) * POSIX, awk and: Preface. (line 21) * POSIX, gawk extensions not included in: POSIX/GNU. (line 6) * POSIX, programs, implementing in awk: Clones. (line 6) -* POSIXLY_CORRECT environment variable: Options. (line 333) +* POSIXLY_CORRECT environment variable: Options. (line 343) * PREC variable: User-modified. (line 124) * precedence: Increment Ops. (line 60) * precedence <1>: Precedence. (line 6) @@ -34553,7 +34569,7 @@ Index (line 60) * regular expressions, gawk, command-line options: GNU Regexp Operators. (line 73) -* regular expressions, interval expressions and: Options. (line 273) +* regular expressions, interval expressions and: Options. (line 278) * regular expressions, leftmost longest match: Leftmost Longest. (line 6) * regular expressions, operators: Regexp Usage. (line 19) @@ -34635,7 +34651,7 @@ Index (line 68) * sample debugging session: Sample Debugging Session. (line 6) -* sandbox mode: Options. (line 280) +* sandbox mode: Options. (line 290) * save debugger options: Debugger Info. (line 85) * scalar or array: Type Functions. (line 11) * scalar values: Basic Data Typing. (line 13) @@ -35115,7 +35131,7 @@ Index * whitespace, as field separators: Default Field Splitting. (line 6) * whitespace, functions, calling: Calling Built-in. (line 10) -* whitespace, newlines as: Options. (line 258) +* whitespace, newlines as: Options. (line 263) * Williams, Kent: Contributors. (line 35) * Woehlke, Matthew: Contributors. (line 80) * Woods, John: Contributors. (line 28) @@ -35185,523 +35201,523 @@ Node: Intro Summary113234 Node: Invoking Gawk114118 Node: Command Line115632 Node: Options116430 -Ref: Options-Footnote-1132082 -Ref: Options-Footnote-2132312 -Node: Other Arguments132337 -Node: Naming Standard Input135284 -Node: Environment Variables136377 -Node: AWKPATH Variable136935 -Ref: AWKPATH Variable-Footnote-1140346 -Ref: AWKPATH Variable-Footnote-2140391 -Node: AWKLIBPATH Variable140652 -Node: Other Environment Variables141909 -Node: Exit Status145547 -Node: Include Files146224 -Node: Loading Shared Libraries149819 -Node: Obsolete151247 -Node: Undocumented151939 -Node: Invoking Summary152236 -Node: Regexp153896 -Node: Regexp Usage155415 -Node: Escape Sequences157452 -Node: Regexp Operators163685 -Ref: Regexp Operators-Footnote-1171102 -Ref: Regexp Operators-Footnote-2171249 -Node: Bracket Expressions171347 -Ref: table-char-classes173370 -Node: Leftmost Longest176507 -Node: Computed Regexps177810 -Node: GNU Regexp Operators181237 -Node: Case-sensitivity184916 -Ref: Case-sensitivity-Footnote-1187812 -Ref: Case-sensitivity-Footnote-2188047 -Node: Strong Regexp Constants188155 -Node: Regexp Summary191097 -Node: Reading Files192703 -Node: Records194866 -Node: awk split records195599 -Node: gawk split records200531 -Ref: gawk split records-Footnote-1205075 -Node: Fields205112 -Node: Nonconstant Fields207853 -Ref: Nonconstant Fields-Footnote-1210089 -Node: Changing Fields210293 -Node: Field Separators216223 -Node: Default Field Splitting218921 -Node: Regexp Field Splitting220039 -Node: Single Character Fields223392 -Node: Command Line Field Separator224452 -Node: Full Line Fields227670 -Ref: Full Line Fields-Footnote-1229192 -Ref: Full Line Fields-Footnote-2229238 -Node: Field Splitting Summary229339 -Node: Constant Size231413 -Node: Splitting By Content235992 -Ref: Splitting By Content-Footnote-1239963 -Node: Multiple Line240126 -Ref: Multiple Line-Footnote-1246009 -Node: Getline246188 -Node: Plain Getline248655 -Node: Getline/Variable251294 -Node: Getline/File252443 -Node: Getline/Variable/File253829 -Ref: Getline/Variable/File-Footnote-1255433 -Node: Getline/Pipe255521 -Node: Getline/Variable/Pipe258226 -Node: Getline/Coprocess259359 -Node: Getline/Variable/Coprocess260624 -Node: Getline Notes261364 -Node: Getline Summary264159 -Ref: table-getline-variants264581 -Node: Read Timeout265329 -Ref: Read Timeout-Footnote-1269236 -Node: Retrying Input269294 -Node: Command-line directories270493 -Node: Input Summary271400 -Node: Input Exercises274572 -Node: Printing275300 -Node: Print277135 -Node: Print Examples278592 -Node: Output Separators281372 -Node: OFMT283389 -Node: Printf284745 -Node: Basic Printf285530 -Node: Control Letters287104 -Node: Format Modifiers291092 -Node: Printf Examples297107 -Node: Redirection299593 -Node: Special FD306436 -Ref: Special FD-Footnote-1309604 -Node: Special Files309678 -Node: Other Inherited Files310295 -Node: Special Network311296 -Node: Special Caveats312156 -Node: Close Files And Pipes313105 -Ref: Close Files And Pipes-Footnote-1320292 -Ref: Close Files And Pipes-Footnote-2320440 -Node: Nonfatal320591 -Node: Output Summary322916 -Node: Output Exercises324138 -Node: Expressions324817 -Node: Values326005 -Node: Constants326683 -Node: Scalar Constants327374 -Ref: Scalar Constants-Footnote-1328238 -Node: Nondecimal-numbers328488 -Node: Regexp Constants331502 -Node: Using Constant Regexps332028 -Node: Variables335191 -Node: Using Variables335848 -Node: Assignment Options337759 -Node: Conversion339633 -Node: Strings And Numbers340157 -Ref: Strings And Numbers-Footnote-1343221 -Node: Locale influences conversions343330 -Ref: table-locale-affects346088 -Node: All Operators346706 -Node: Arithmetic Ops347335 -Node: Concatenation349841 -Ref: Concatenation-Footnote-1352688 -Node: Assignment Ops352795 -Ref: table-assign-ops357787 -Node: Increment Ops359100 -Node: Truth Values and Conditions362560 -Node: Truth Values363634 -Node: Typing and Comparison364682 -Node: Variable Typing365502 -Node: Comparison Operators369126 -Ref: table-relational-ops369545 -Node: POSIX String Comparison373040 -Ref: POSIX String Comparison-Footnote-1374114 -Node: Boolean Ops374253 -Ref: Boolean Ops-Footnote-1378735 -Node: Conditional Exp378827 -Node: Function Calls380563 -Node: Precedence384443 -Node: Locales388102 -Node: Expressions Summary389734 -Node: Patterns and Actions392307 -Node: Pattern Overview393427 -Node: Regexp Patterns395104 -Node: Expression Patterns395646 -Node: Ranges399427 -Node: BEGIN/END402535 -Node: Using BEGIN/END403296 -Ref: Using BEGIN/END-Footnote-1406033 -Node: I/O And BEGIN/END406139 -Node: BEGINFILE/ENDFILE408455 -Node: Empty411362 -Node: Using Shell Variables411679 -Node: Action Overview413953 -Node: Statements416278 -Node: If Statement418126 -Node: While Statement419621 -Node: Do Statement421649 -Node: For Statement422797 -Node: Switch Statement425956 -Node: Break Statement428342 -Node: Continue Statement430434 -Node: Next Statement432261 -Node: Nextfile Statement434644 -Node: Exit Statement437296 -Node: Built-in Variables439701 -Node: User-modified440834 -Node: Auto-set448422 -Ref: Auto-set-Footnote-1462815 -Ref: Auto-set-Footnote-2463021 -Node: ARGC and ARGV463077 -Node: Pattern Action Summary467296 -Node: Arrays469726 -Node: Array Basics471055 -Node: Array Intro471899 -Ref: figure-array-elements473874 -Ref: Array Intro-Footnote-1476578 -Node: Reference to Elements476706 -Node: Assigning Elements479170 -Node: Array Example479661 -Node: Scanning an Array481420 -Node: Controlling Scanning484444 -Ref: Controlling Scanning-Footnote-1489843 -Node: Numeric Array Subscripts490159 -Node: Uninitialized Subscripts492343 -Node: Delete493962 -Ref: Delete-Footnote-1496714 -Node: Multidimensional496771 -Node: Multiscanning499866 -Node: Arrays of Arrays501457 -Node: Arrays Summary506225 -Node: Functions508318 -Node: Built-in509356 -Node: Calling Built-in510434 -Node: Numeric Functions512430 -Ref: Numeric Functions-Footnote-1517263 -Ref: Numeric Functions-Footnote-2517620 -Ref: Numeric Functions-Footnote-3517668 -Node: String Functions517940 -Ref: String Functions-Footnote-1541448 -Ref: String Functions-Footnote-2541577 -Ref: String Functions-Footnote-3541825 -Node: Gory Details541912 -Ref: table-sub-escapes543703 -Ref: table-sub-proposed545222 -Ref: table-posix-sub546585 -Ref: table-gensub-escapes548126 -Ref: Gory Details-Footnote-1548949 -Node: I/O Functions549100 -Ref: I/O Functions-Footnote-1556321 -Node: Time Functions556469 -Ref: Time Functions-Footnote-1566974 -Ref: Time Functions-Footnote-2567042 -Ref: Time Functions-Footnote-3567200 -Ref: Time Functions-Footnote-4567311 -Ref: Time Functions-Footnote-5567423 -Ref: Time Functions-Footnote-6567650 -Node: Bitwise Functions567916 -Ref: table-bitwise-ops568510 -Ref: Bitwise Functions-Footnote-1572848 -Node: Type Functions573021 -Node: I18N Functions575682 -Node: User-defined577333 -Node: Definition Syntax578138 -Ref: Definition Syntax-Footnote-1583825 -Node: Function Example583896 -Ref: Function Example-Footnote-1586818 -Node: Function Caveats586840 -Node: Calling A Function587358 -Node: Variable Scope588316 -Node: Pass By Value/Reference591310 -Node: Return Statement594809 -Node: Dynamic Typing597788 -Node: Indirect Calls598718 -Ref: Indirect Calls-Footnote-1608969 -Node: Functions Summary609097 -Node: Library Functions611802 -Ref: Library Functions-Footnote-1615411 -Ref: Library Functions-Footnote-2615554 -Node: Library Names615725 -Ref: Library Names-Footnote-1619186 -Ref: Library Names-Footnote-2619409 -Node: General Functions619495 -Node: Strtonum Function620598 -Node: Assert Function623620 -Node: Round Function626946 -Node: Cliff Random Function628487 -Node: Ordinal Functions629503 -Ref: Ordinal Functions-Footnote-1632566 -Ref: Ordinal Functions-Footnote-2632818 -Node: Join Function633028 -Ref: Join Function-Footnote-1634798 -Node: Getlocaltime Function634998 -Node: Readfile Function638742 -Node: Shell Quoting640716 -Node: Data File Management642117 -Node: Filetrans Function642749 -Node: Rewind Function646846 -Node: File Checking648232 -Ref: File Checking-Footnote-1649566 -Node: Empty Files649767 -Node: Ignoring Assigns651746 -Node: Getopt Function653296 -Ref: Getopt Function-Footnote-1664766 -Node: Passwd Functions664966 -Ref: Passwd Functions-Footnote-1673807 -Node: Group Functions673895 -Ref: Group Functions-Footnote-1681794 -Node: Walking Arrays682001 -Node: Library Functions Summary685011 -Node: Library Exercises686417 -Node: Sample Programs686882 -Node: Running Examples687652 -Node: Clones688380 -Node: Cut Program689604 -Node: Egrep Program699325 -Ref: Egrep Program-Footnote-1706837 -Node: Id Program706947 -Node: Split Program710627 -Ref: Split Program-Footnote-1714086 -Node: Tee Program714215 -Node: Uniq Program717005 -Node: Wc Program724431 -Ref: Wc Program-Footnote-1728686 -Node: Miscellaneous Programs728780 -Node: Dupword Program729993 -Node: Alarm Program732023 -Node: Translate Program736878 -Ref: Translate Program-Footnote-1741443 -Node: Labels Program741713 -Ref: Labels Program-Footnote-1745064 -Node: Word Sorting745148 -Node: History Sorting749220 -Node: Extract Program751055 -Node: Simple Sed758584 -Node: Igawk Program761658 -Ref: Igawk Program-Footnote-1775989 -Ref: Igawk Program-Footnote-2776191 -Ref: Igawk Program-Footnote-3776313 -Node: Anagram Program776428 -Node: Signature Program779490 -Node: Programs Summary780737 -Node: Programs Exercises781952 -Ref: Programs Exercises-Footnote-1786081 -Node: Advanced Features786172 -Node: Nondecimal Data788162 -Node: Array Sorting789753 -Node: Controlling Array Traversal790453 -Ref: Controlling Array Traversal-Footnote-1798822 -Node: Array Sorting Functions798940 -Ref: Array Sorting Functions-Footnote-1804031 -Node: Two-way I/O804227 -Ref: Two-way I/O-Footnote-1810047 -Ref: Two-way I/O-Footnote-2810234 -Node: TCP/IP Networking810316 -Node: Profiling813434 -Node: Advanced Features Summary821705 -Node: Internationalization823549 -Node: I18N and L10N825029 -Node: Explaining gettext825716 -Ref: Explaining gettext-Footnote-1830739 -Ref: Explaining gettext-Footnote-2830924 -Node: Programmer i18n831089 -Ref: Programmer i18n-Footnote-1835945 -Node: Translator i18n835994 -Node: String Extraction836788 -Ref: String Extraction-Footnote-1837921 -Node: Printf Ordering838007 -Ref: Printf Ordering-Footnote-1840793 -Node: I18N Portability840857 -Ref: I18N Portability-Footnote-1843313 -Node: I18N Example843376 -Ref: I18N Example-Footnote-1846182 -Node: Gawk I18N846255 -Node: I18N Summary846900 -Node: Debugger848241 -Node: Debugging849263 -Node: Debugging Concepts849704 -Node: Debugging Terms851513 -Node: Awk Debugging854088 -Node: Sample Debugging Session854994 -Node: Debugger Invocation855528 -Node: Finding The Bug856914 -Node: List of Debugger Commands863392 -Node: Breakpoint Control864725 -Node: Debugger Execution Control868419 -Node: Viewing And Changing Data871781 -Node: Execution Stack875155 -Node: Debugger Info876792 -Node: Miscellaneous Debugger Commands880863 -Node: Readline Support885951 -Node: Limitations886847 -Ref: Limitations-Footnote-1891078 -Node: Debugging Summary891129 -Node: Arbitrary Precision Arithmetic892408 -Node: Computer Arithmetic893824 -Ref: table-numeric-ranges897415 -Ref: Computer Arithmetic-Footnote-1898137 -Node: Math Definitions898194 -Ref: table-ieee-formats901508 -Ref: Math Definitions-Footnote-1902111 -Node: MPFR features902216 -Node: FP Math Caution903935 -Ref: FP Math Caution-Footnote-1905007 -Node: Inexactness of computations905376 -Node: Inexact representation906336 -Node: Comparing FP Values907696 -Node: Errors accumulate908778 -Node: Getting Accuracy910211 -Node: Try To Round912921 -Node: Setting precision913820 -Ref: table-predefined-precision-strings914517 -Node: Setting the rounding mode916347 -Ref: table-gawk-rounding-modes916721 -Ref: Setting the rounding mode-Footnote-1920129 -Node: Arbitrary Precision Integers920308 -Ref: Arbitrary Precision Integers-Footnote-1925225 -Node: POSIX Floating Point Problems925374 -Ref: POSIX Floating Point Problems-Footnote-1929256 -Node: Floating point summary929294 -Node: Dynamic Extensions931484 -Node: Extension Intro933037 -Node: Plugin License934303 -Node: Extension Mechanism Outline935100 -Ref: figure-load-extension935539 -Ref: figure-register-new-function937104 -Ref: figure-call-new-function938196 -Node: Extension API Description940259 -Node: Extension API Functions Introduction941791 -Node: General Data Types946650 -Ref: General Data Types-Footnote-1952605 -Node: Memory Allocation Functions952904 -Ref: Memory Allocation Functions-Footnote-1955749 -Node: Constructor Functions955848 -Node: Registration Functions957593 -Node: Extension Functions958278 -Node: Exit Callback Functions960577 -Node: Extension Version String961827 -Node: Input Parsers962490 -Node: Output Wrappers972375 -Node: Two-way processors976887 -Node: Printing Messages979151 -Ref: Printing Messages-Footnote-1980225 -Node: Updating ERRNO980378 -Node: Requesting Values981117 -Ref: table-value-types-returned981854 -Node: Accessing Parameters982737 -Node: Symbol Table Access983973 -Node: Symbol table by name984485 -Node: Symbol table by cookie986506 -Ref: Symbol table by cookie-Footnote-1990655 -Node: Cached values990719 -Ref: Cached values-Footnote-1994220 -Node: Array Manipulation994311 -Ref: Array Manipulation-Footnote-1995402 -Node: Array Data Types995439 -Ref: Array Data Types-Footnote-1998097 -Node: Array Functions998189 -Node: Flattening Arrays1002048 -Node: Creating Arrays1008956 -Node: Redirection API1013728 -Node: Extension API Variables1016559 -Node: Extension Versioning1017192 -Node: Extension API Informational Variables1019083 -Node: Extension API Boilerplate1020147 -Node: Finding Extensions1023961 -Node: Extension Example1024521 -Node: Internal File Description1025319 -Node: Internal File Ops1029399 -Ref: Internal File Ops-Footnote-11041161 -Node: Using Internal File Ops1041301 -Ref: Using Internal File Ops-Footnote-11043684 -Node: Extension Samples1043959 -Node: Extension Sample File Functions1045488 -Node: Extension Sample Fnmatch1053137 -Node: Extension Sample Fork1054624 -Node: Extension Sample Inplace1055842 -Node: Extension Sample Ord1059052 -Node: Extension Sample Readdir1059888 -Ref: table-readdir-file-types1060777 -Node: Extension Sample Revout1061582 -Node: Extension Sample Rev2way1062171 -Node: Extension Sample Read write array1062911 -Node: Extension Sample Readfile1064853 -Node: Extension Sample Time1065948 -Node: Extension Sample API Tests1067296 -Node: gawkextlib1067788 -Node: Extension summary1070235 -Node: Extension Exercises1073927 -Node: Language History1075424 -Node: V7/SVR3.11077080 -Node: SVR41079232 -Node: POSIX1080666 -Node: BTL1082046 -Node: POSIX/GNU1082776 -Node: Feature History1088615 -Node: Common Extensions1102985 -Node: Ranges and Locales1104268 -Ref: Ranges and Locales-Footnote-11108884 -Ref: Ranges and Locales-Footnote-21108911 -Ref: Ranges and Locales-Footnote-31109146 -Node: Contributors1109367 -Node: History summary1114936 -Node: Installation1116316 -Node: Gawk Distribution1117261 -Node: Getting1117745 -Node: Extracting1118706 -Node: Distribution contents1120344 -Node: Unix Installation1126440 -Node: Quick Installation1127122 -Node: Shell Startup Files1129536 -Node: Additional Configuration Options1130614 -Node: Configuration Philosophy1132419 -Node: Non-Unix Installation1134789 -Node: PC Installation1135247 -Node: PC Binary Installation1136567 -Node: PC Compiling1138419 -Ref: PC Compiling-Footnote-11141443 -Node: PC Testing1141552 -Node: PC Using1142732 -Node: Cygwin1146846 -Node: MSYS1147616 -Node: VMS Installation1148117 -Node: VMS Compilation1148908 -Ref: VMS Compilation-Footnote-11150138 -Node: VMS Dynamic Extensions1150196 -Node: VMS Installation Details1151881 -Node: VMS Running1154134 -Node: VMS GNV1158413 -Node: VMS Old Gawk1159148 -Node: Bugs1159619 -Node: Other Versions1163816 -Node: Installation summary1170402 -Node: Notes1171460 -Node: Compatibility Mode1172325 -Node: Additions1173107 -Node: Accessing The Source1174032 -Node: Adding Code1175468 -Node: New Ports1181687 -Node: Derived Files1186175 -Ref: Derived Files-Footnote-11191660 -Ref: Derived Files-Footnote-21191695 -Ref: Derived Files-Footnote-31192293 -Node: Future Extensions1192407 -Node: Implementation Limitations1193065 -Node: Extension Design1194248 -Node: Old Extension Problems1195402 -Ref: Old Extension Problems-Footnote-11196920 -Node: Extension New Mechanism Goals1196977 -Ref: Extension New Mechanism Goals-Footnote-11200341 -Node: Extension Other Design Decisions1200530 -Node: Extension Future Growth1202643 -Node: Old Extension Mechanism1203479 -Node: Notes summary1205242 -Node: Basic Concepts1206424 -Node: Basic High Level1207105 -Ref: figure-general-flow1207387 -Ref: figure-process-flow1208072 -Ref: Basic High Level-Footnote-11211373 -Node: Basic Data Typing1211558 -Node: Glossary1214886 -Node: Copying1246832 -Node: GNU Free Documentation License1284371 -Node: Index1309489 +Ref: Options-Footnote-1132529 +Ref: Options-Footnote-2132759 +Node: Other Arguments132784 +Node: Naming Standard Input135731 +Node: Environment Variables136824 +Node: AWKPATH Variable137382 +Ref: AWKPATH Variable-Footnote-1140793 +Ref: AWKPATH Variable-Footnote-2140838 +Node: AWKLIBPATH Variable141099 +Node: Other Environment Variables142356 +Node: Exit Status145994 +Node: Include Files146671 +Node: Loading Shared Libraries150266 +Node: Obsolete151694 +Node: Undocumented152386 +Node: Invoking Summary152683 +Node: Regexp154343 +Node: Regexp Usage155862 +Node: Escape Sequences157899 +Node: Regexp Operators164132 +Ref: Regexp Operators-Footnote-1171549 +Ref: Regexp Operators-Footnote-2171696 +Node: Bracket Expressions171794 +Ref: table-char-classes173817 +Node: Leftmost Longest176954 +Node: Computed Regexps178257 +Node: GNU Regexp Operators181684 +Node: Case-sensitivity185363 +Ref: Case-sensitivity-Footnote-1188259 +Ref: Case-sensitivity-Footnote-2188494 +Node: Strong Regexp Constants188602 +Node: Regexp Summary191544 +Node: Reading Files193150 +Node: Records195313 +Node: awk split records196046 +Node: gawk split records200978 +Ref: gawk split records-Footnote-1205522 +Node: Fields205559 +Node: Nonconstant Fields208300 +Ref: Nonconstant Fields-Footnote-1210536 +Node: Changing Fields210740 +Node: Field Separators216670 +Node: Default Field Splitting219368 +Node: Regexp Field Splitting220486 +Node: Single Character Fields223839 +Node: Command Line Field Separator224899 +Node: Full Line Fields228117 +Ref: Full Line Fields-Footnote-1229639 +Ref: Full Line Fields-Footnote-2229685 +Node: Field Splitting Summary229786 +Node: Constant Size231860 +Node: Splitting By Content236439 +Ref: Splitting By Content-Footnote-1240410 +Node: Multiple Line240573 +Ref: Multiple Line-Footnote-1246456 +Node: Getline246635 +Node: Plain Getline249102 +Node: Getline/Variable251741 +Node: Getline/File252890 +Node: Getline/Variable/File254276 +Ref: Getline/Variable/File-Footnote-1255880 +Node: Getline/Pipe255968 +Node: Getline/Variable/Pipe258673 +Node: Getline/Coprocess259806 +Node: Getline/Variable/Coprocess261071 +Node: Getline Notes261811 +Node: Getline Summary264606 +Ref: table-getline-variants265028 +Node: Read Timeout265776 +Ref: Read Timeout-Footnote-1269683 +Node: Retrying Input269741 +Node: Command-line directories270940 +Node: Input Summary271847 +Node: Input Exercises275019 +Node: Printing275747 +Node: Print277582 +Node: Print Examples279039 +Node: Output Separators281819 +Node: OFMT283836 +Node: Printf285192 +Node: Basic Printf285977 +Node: Control Letters287551 +Node: Format Modifiers291539 +Node: Printf Examples297554 +Node: Redirection300040 +Node: Special FD306883 +Ref: Special FD-Footnote-1310051 +Node: Special Files310125 +Node: Other Inherited Files310742 +Node: Special Network311743 +Node: Special Caveats312603 +Node: Close Files And Pipes313552 +Ref: Close Files And Pipes-Footnote-1320739 +Ref: Close Files And Pipes-Footnote-2320887 +Node: Nonfatal321038 +Node: Output Summary323363 +Node: Output Exercises324585 +Node: Expressions325264 +Node: Values326452 +Node: Constants327130 +Node: Scalar Constants327821 +Ref: Scalar Constants-Footnote-1328685 +Node: Nondecimal-numbers328935 +Node: Regexp Constants331949 +Node: Using Constant Regexps332475 +Node: Variables335638 +Node: Using Variables336295 +Node: Assignment Options338206 +Node: Conversion340080 +Node: Strings And Numbers340604 +Ref: Strings And Numbers-Footnote-1343668 +Node: Locale influences conversions343777 +Ref: table-locale-affects346535 +Node: All Operators347153 +Node: Arithmetic Ops347782 +Node: Concatenation350288 +Ref: Concatenation-Footnote-1353135 +Node: Assignment Ops353242 +Ref: table-assign-ops358234 +Node: Increment Ops359547 +Node: Truth Values and Conditions363007 +Node: Truth Values364081 +Node: Typing and Comparison365129 +Node: Variable Typing365949 +Node: Comparison Operators369573 +Ref: table-relational-ops369992 +Node: POSIX String Comparison373487 +Ref: POSIX String Comparison-Footnote-1374561 +Node: Boolean Ops374700 +Ref: Boolean Ops-Footnote-1379182 +Node: Conditional Exp379274 +Node: Function Calls381010 +Node: Precedence384890 +Node: Locales388549 +Node: Expressions Summary390181 +Node: Patterns and Actions392754 +Node: Pattern Overview393874 +Node: Regexp Patterns395551 +Node: Expression Patterns396093 +Node: Ranges399874 +Node: BEGIN/END402982 +Node: Using BEGIN/END403743 +Ref: Using BEGIN/END-Footnote-1406480 +Node: I/O And BEGIN/END406586 +Node: BEGINFILE/ENDFILE408902 +Node: Empty411809 +Node: Using Shell Variables412126 +Node: Action Overview414400 +Node: Statements416725 +Node: If Statement418573 +Node: While Statement420068 +Node: Do Statement422096 +Node: For Statement423244 +Node: Switch Statement426403 +Node: Break Statement428789 +Node: Continue Statement430881 +Node: Next Statement432708 +Node: Nextfile Statement435091 +Node: Exit Statement437743 +Node: Built-in Variables440148 +Node: User-modified441281 +Node: Auto-set448869 +Ref: Auto-set-Footnote-1463262 +Ref: Auto-set-Footnote-2463468 +Node: ARGC and ARGV463524 +Node: Pattern Action Summary467743 +Node: Arrays470173 +Node: Array Basics471502 +Node: Array Intro472346 +Ref: figure-array-elements474321 +Ref: Array Intro-Footnote-1477025 +Node: Reference to Elements477153 +Node: Assigning Elements479617 +Node: Array Example480108 +Node: Scanning an Array481867 +Node: Controlling Scanning484891 +Ref: Controlling Scanning-Footnote-1490290 +Node: Numeric Array Subscripts490606 +Node: Uninitialized Subscripts492790 +Node: Delete494409 +Ref: Delete-Footnote-1497161 +Node: Multidimensional497218 +Node: Multiscanning500313 +Node: Arrays of Arrays501904 +Node: Arrays Summary506672 +Node: Functions508765 +Node: Built-in509803 +Node: Calling Built-in510881 +Node: Numeric Functions512877 +Ref: Numeric Functions-Footnote-1517710 +Ref: Numeric Functions-Footnote-2518067 +Ref: Numeric Functions-Footnote-3518115 +Node: String Functions518387 +Ref: String Functions-Footnote-1541895 +Ref: String Functions-Footnote-2542024 +Ref: String Functions-Footnote-3542272 +Node: Gory Details542359 +Ref: table-sub-escapes544150 +Ref: table-sub-proposed545669 +Ref: table-posix-sub547032 +Ref: table-gensub-escapes548573 +Ref: Gory Details-Footnote-1549396 +Node: I/O Functions549547 +Ref: I/O Functions-Footnote-1556768 +Node: Time Functions556916 +Ref: Time Functions-Footnote-1567421 +Ref: Time Functions-Footnote-2567489 +Ref: Time Functions-Footnote-3567647 +Ref: Time Functions-Footnote-4567758 +Ref: Time Functions-Footnote-5567870 +Ref: Time Functions-Footnote-6568097 +Node: Bitwise Functions568363 +Ref: table-bitwise-ops568957 +Ref: Bitwise Functions-Footnote-1573295 +Node: Type Functions573468 +Node: I18N Functions576129 +Node: User-defined577780 +Node: Definition Syntax578585 +Ref: Definition Syntax-Footnote-1584272 +Node: Function Example584343 +Ref: Function Example-Footnote-1587265 +Node: Function Caveats587287 +Node: Calling A Function587805 +Node: Variable Scope588763 +Node: Pass By Value/Reference591757 +Node: Return Statement595256 +Node: Dynamic Typing598235 +Node: Indirect Calls599165 +Ref: Indirect Calls-Footnote-1609416 +Node: Functions Summary609544 +Node: Library Functions612249 +Ref: Library Functions-Footnote-1615858 +Ref: Library Functions-Footnote-2616001 +Node: Library Names616172 +Ref: Library Names-Footnote-1619633 +Ref: Library Names-Footnote-2619856 +Node: General Functions619942 +Node: Strtonum Function621045 +Node: Assert Function624067 +Node: Round Function627393 +Node: Cliff Random Function628934 +Node: Ordinal Functions629950 +Ref: Ordinal Functions-Footnote-1633013 +Ref: Ordinal Functions-Footnote-2633265 +Node: Join Function633475 +Ref: Join Function-Footnote-1635245 +Node: Getlocaltime Function635445 +Node: Readfile Function639189 +Node: Shell Quoting641163 +Node: Data File Management642564 +Node: Filetrans Function643196 +Node: Rewind Function647293 +Node: File Checking648679 +Ref: File Checking-Footnote-1650013 +Node: Empty Files650214 +Node: Ignoring Assigns652193 +Node: Getopt Function653743 +Ref: Getopt Function-Footnote-1665213 +Node: Passwd Functions665413 +Ref: Passwd Functions-Footnote-1674254 +Node: Group Functions674342 +Ref: Group Functions-Footnote-1682241 +Node: Walking Arrays682448 +Node: Library Functions Summary685458 +Node: Library Exercises686864 +Node: Sample Programs687329 +Node: Running Examples688099 +Node: Clones688827 +Node: Cut Program690051 +Node: Egrep Program699772 +Ref: Egrep Program-Footnote-1707284 +Node: Id Program707394 +Node: Split Program711074 +Ref: Split Program-Footnote-1714533 +Node: Tee Program714662 +Node: Uniq Program717452 +Node: Wc Program724878 +Ref: Wc Program-Footnote-1729133 +Node: Miscellaneous Programs729227 +Node: Dupword Program730440 +Node: Alarm Program732470 +Node: Translate Program737325 +Ref: Translate Program-Footnote-1741890 +Node: Labels Program742160 +Ref: Labels Program-Footnote-1745511 +Node: Word Sorting745595 +Node: History Sorting749667 +Node: Extract Program751502 +Node: Simple Sed759031 +Node: Igawk Program762105 +Ref: Igawk Program-Footnote-1776436 +Ref: Igawk Program-Footnote-2776638 +Ref: Igawk Program-Footnote-3776760 +Node: Anagram Program776875 +Node: Signature Program779937 +Node: Programs Summary781184 +Node: Programs Exercises782399 +Ref: Programs Exercises-Footnote-1786528 +Node: Advanced Features786619 +Node: Nondecimal Data788609 +Node: Array Sorting790200 +Node: Controlling Array Traversal790900 +Ref: Controlling Array Traversal-Footnote-1799269 +Node: Array Sorting Functions799387 +Ref: Array Sorting Functions-Footnote-1804478 +Node: Two-way I/O804674 +Ref: Two-way I/O-Footnote-1810494 +Ref: Two-way I/O-Footnote-2810681 +Node: TCP/IP Networking810763 +Node: Profiling813881 +Node: Advanced Features Summary822335 +Node: Internationalization824179 +Node: I18N and L10N825659 +Node: Explaining gettext826346 +Ref: Explaining gettext-Footnote-1831369 +Ref: Explaining gettext-Footnote-2831554 +Node: Programmer i18n831719 +Ref: Programmer i18n-Footnote-1836575 +Node: Translator i18n836624 +Node: String Extraction837418 +Ref: String Extraction-Footnote-1838551 +Node: Printf Ordering838637 +Ref: Printf Ordering-Footnote-1841423 +Node: I18N Portability841487 +Ref: I18N Portability-Footnote-1843943 +Node: I18N Example844006 +Ref: I18N Example-Footnote-1846812 +Node: Gawk I18N846885 +Node: I18N Summary847530 +Node: Debugger848871 +Node: Debugging849893 +Node: Debugging Concepts850334 +Node: Debugging Terms852143 +Node: Awk Debugging854718 +Node: Sample Debugging Session855624 +Node: Debugger Invocation856158 +Node: Finding The Bug857544 +Node: List of Debugger Commands864022 +Node: Breakpoint Control865355 +Node: Debugger Execution Control869049 +Node: Viewing And Changing Data872411 +Node: Execution Stack875785 +Node: Debugger Info877422 +Node: Miscellaneous Debugger Commands881493 +Node: Readline Support886581 +Node: Limitations887477 +Ref: Limitations-Footnote-1891708 +Node: Debugging Summary891759 +Node: Arbitrary Precision Arithmetic893038 +Node: Computer Arithmetic894454 +Ref: table-numeric-ranges898045 +Ref: Computer Arithmetic-Footnote-1898767 +Node: Math Definitions898824 +Ref: table-ieee-formats902138 +Ref: Math Definitions-Footnote-1902741 +Node: MPFR features902846 +Node: FP Math Caution904565 +Ref: FP Math Caution-Footnote-1905637 +Node: Inexactness of computations906006 +Node: Inexact representation906966 +Node: Comparing FP Values908326 +Node: Errors accumulate909408 +Node: Getting Accuracy910841 +Node: Try To Round913551 +Node: Setting precision914450 +Ref: table-predefined-precision-strings915147 +Node: Setting the rounding mode916977 +Ref: table-gawk-rounding-modes917351 +Ref: Setting the rounding mode-Footnote-1920759 +Node: Arbitrary Precision Integers920938 +Ref: Arbitrary Precision Integers-Footnote-1925855 +Node: POSIX Floating Point Problems926004 +Ref: POSIX Floating Point Problems-Footnote-1929886 +Node: Floating point summary929924 +Node: Dynamic Extensions932114 +Node: Extension Intro933667 +Node: Plugin License934933 +Node: Extension Mechanism Outline935730 +Ref: figure-load-extension936169 +Ref: figure-register-new-function937734 +Ref: figure-call-new-function938826 +Node: Extension API Description940889 +Node: Extension API Functions Introduction942421 +Node: General Data Types947280 +Ref: General Data Types-Footnote-1953235 +Node: Memory Allocation Functions953534 +Ref: Memory Allocation Functions-Footnote-1956379 +Node: Constructor Functions956478 +Node: Registration Functions958223 +Node: Extension Functions958908 +Node: Exit Callback Functions961207 +Node: Extension Version String962457 +Node: Input Parsers963120 +Node: Output Wrappers973005 +Node: Two-way processors977517 +Node: Printing Messages979781 +Ref: Printing Messages-Footnote-1980855 +Node: Updating ERRNO981008 +Node: Requesting Values981747 +Ref: table-value-types-returned982484 +Node: Accessing Parameters983367 +Node: Symbol Table Access984603 +Node: Symbol table by name985115 +Node: Symbol table by cookie987136 +Ref: Symbol table by cookie-Footnote-1991285 +Node: Cached values991349 +Ref: Cached values-Footnote-1994850 +Node: Array Manipulation994941 +Ref: Array Manipulation-Footnote-1996032 +Node: Array Data Types996069 +Ref: Array Data Types-Footnote-1998727 +Node: Array Functions998819 +Node: Flattening Arrays1002678 +Node: Creating Arrays1009586 +Node: Redirection API1014358 +Node: Extension API Variables1017189 +Node: Extension Versioning1017822 +Node: Extension API Informational Variables1019713 +Node: Extension API Boilerplate1020777 +Node: Finding Extensions1024591 +Node: Extension Example1025151 +Node: Internal File Description1025949 +Node: Internal File Ops1030029 +Ref: Internal File Ops-Footnote-11041791 +Node: Using Internal File Ops1041931 +Ref: Using Internal File Ops-Footnote-11044314 +Node: Extension Samples1044589 +Node: Extension Sample File Functions1046118 +Node: Extension Sample Fnmatch1053767 +Node: Extension Sample Fork1055254 +Node: Extension Sample Inplace1056472 +Node: Extension Sample Ord1059682 +Node: Extension Sample Readdir1060518 +Ref: table-readdir-file-types1061407 +Node: Extension Sample Revout1062212 +Node: Extension Sample Rev2way1062801 +Node: Extension Sample Read write array1063541 +Node: Extension Sample Readfile1065483 +Node: Extension Sample Time1066578 +Node: Extension Sample API Tests1067926 +Node: gawkextlib1068418 +Node: Extension summary1070865 +Node: Extension Exercises1074557 +Node: Language History1076054 +Node: V7/SVR3.11077710 +Node: SVR41079862 +Node: POSIX1081296 +Node: BTL1082676 +Node: POSIX/GNU1083406 +Node: Feature History1089268 +Node: Common Extensions1103638 +Node: Ranges and Locales1104921 +Ref: Ranges and Locales-Footnote-11109537 +Ref: Ranges and Locales-Footnote-21109564 +Ref: Ranges and Locales-Footnote-31109799 +Node: Contributors1110020 +Node: History summary1115589 +Node: Installation1116969 +Node: Gawk Distribution1117914 +Node: Getting1118398 +Node: Extracting1119359 +Node: Distribution contents1120997 +Node: Unix Installation1127093 +Node: Quick Installation1127775 +Node: Shell Startup Files1130189 +Node: Additional Configuration Options1131267 +Node: Configuration Philosophy1133072 +Node: Non-Unix Installation1135442 +Node: PC Installation1135900 +Node: PC Binary Installation1137220 +Node: PC Compiling1139072 +Ref: PC Compiling-Footnote-11142096 +Node: PC Testing1142205 +Node: PC Using1143385 +Node: Cygwin1147499 +Node: MSYS1148269 +Node: VMS Installation1148770 +Node: VMS Compilation1149561 +Ref: VMS Compilation-Footnote-11150791 +Node: VMS Dynamic Extensions1150849 +Node: VMS Installation Details1152534 +Node: VMS Running1154787 +Node: VMS GNV1159066 +Node: VMS Old Gawk1159801 +Node: Bugs1160272 +Node: Other Versions1164469 +Node: Installation summary1171055 +Node: Notes1172113 +Node: Compatibility Mode1172978 +Node: Additions1173760 +Node: Accessing The Source1174685 +Node: Adding Code1176121 +Node: New Ports1182340 +Node: Derived Files1186828 +Ref: Derived Files-Footnote-11192313 +Ref: Derived Files-Footnote-21192348 +Ref: Derived Files-Footnote-31192946 +Node: Future Extensions1193060 +Node: Implementation Limitations1193718 +Node: Extension Design1194901 +Node: Old Extension Problems1196055 +Ref: Old Extension Problems-Footnote-11197573 +Node: Extension New Mechanism Goals1197630 +Ref: Extension New Mechanism Goals-Footnote-11200994 +Node: Extension Other Design Decisions1201183 +Node: Extension Future Growth1203296 +Node: Old Extension Mechanism1204132 +Node: Notes summary1205895 +Node: Basic Concepts1207077 +Node: Basic High Level1207758 +Ref: figure-general-flow1208040 +Ref: figure-process-flow1208725 +Ref: Basic High Level-Footnote-11212026 +Node: Basic Data Typing1212211 +Node: Glossary1215539 +Node: Copying1247485 +Node: GNU Free Documentation License1285024 +Node: Index1310142 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index fab29487..fe5c5698 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -4081,6 +4081,7 @@ when parsing numeric input data (@pxref{Locales}). @cindex @option{-o} option @cindex @option{--pretty-print} option Enable pretty-printing of @command{awk} programs. +Implies @option{--no-optimize}. By default, the output program is created in a file named @file{awkprof.out} (@pxref{Profiling}). The optional @var{file} argument allows you to specify a different @@ -4097,8 +4098,14 @@ This is no longer the case. @itemx @option{--optimize} @cindex @option{--optimize} option @cindex @option{-O} option -Enable some optimizations on the internal representation of the program. -At the moment, this includes just simple constant folding. +Enable @command{gawk}'s default optimizations on the internal +representation of the program. At the moment, this includes simple +constant folding and tail recursion elimination in function calls. + +These optimizations are enabled by default. +This option remains primarily for backwards compatibilty. However, it may +be used to cancel the effect of an earlier @option{-s} option +(see later in this list). @item @option{-p}[@var{file}] @itemx @option{--profile}[@code{=}@var{file}] @@ -4107,6 +4114,7 @@ At the moment, this includes just simple constant folding. @cindex @command{awk} profiling, enabling Enable profiling of @command{awk} programs (@pxref{Profiling}). +Implies @option{--no-optimize}. By default, profiles are created in a file named @file{awkprof.out}. The optional @var{file} argument allows you to specify a different @value{FN} for the profile file. @@ -4173,6 +4181,13 @@ This is now @command{gawk}'s default behavior. Nevertheless, this option remains (both for backward compatibility and for use in combination with @option{--traditional}). +@item @option{-s} +@itemx @option{--no-optimize} +@cindex @option{--no-optimize} option +@cindex @option{-s} option +Disable @command{gawk}'s default optimizations on the internal +representation of the program. + @item @option{-S} @itemx @option{--sandbox} @cindex @option{-S} option @@ -28286,6 +28301,10 @@ that the profiling output does. This makes it easy to pretty-print your code once development is completed, and then use the result as the final version of your program. +Because the internal representation of your program is formatted to +recreate an @command{awk} program, profiling and pretty-printing +automatically disable @command{gawk}'s default optimizations. + @node Advanced Features Summary @section Summary @@ -36403,6 +36422,7 @@ The @option{-p}, @option{-P}, @option{-r}, +@option{-s}, @option{-S}, @option{-t}, and @@ -36427,6 +36447,7 @@ and the @option{--load}, @option{--non-decimal-data}, @option{--optimize}, +@option{--no-optimize}, @option{--posix}, @option{--pretty-print}, @option{--profile}, diff --git a/doc/gawktexi.in b/doc/gawktexi.in index e15d6323..8218dd63 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -3992,6 +3992,7 @@ when parsing numeric input data (@pxref{Locales}). @cindex @option{-o} option @cindex @option{--pretty-print} option Enable pretty-printing of @command{awk} programs. +Implies @option{--no-optimize}. By default, the output program is created in a file named @file{awkprof.out} (@pxref{Profiling}). The optional @var{file} argument allows you to specify a different @@ -4008,8 +4009,14 @@ This is no longer the case. @itemx @option{--optimize} @cindex @option{--optimize} option @cindex @option{-O} option -Enable some optimizations on the internal representation of the program. -At the moment, this includes just simple constant folding. +Enable @command{gawk}'s default optimizations on the internal +representation of the program. At the moment, this includes simple +constant folding and tail recursion elimination in function calls. + +These optimizations are enabled by default. +This option remains primarily for backwards compatibilty. However, it may +be used to cancel the effect of an earlier @option{-s} option +(see later in this list). @item @option{-p}[@var{file}] @itemx @option{--profile}[@code{=}@var{file}] @@ -4018,6 +4025,7 @@ At the moment, this includes just simple constant folding. @cindex @command{awk} profiling, enabling Enable profiling of @command{awk} programs (@pxref{Profiling}). +Implies @option{--no-optimize}. By default, profiles are created in a file named @file{awkprof.out}. The optional @var{file} argument allows you to specify a different @value{FN} for the profile file. @@ -4084,6 +4092,13 @@ This is now @command{gawk}'s default behavior. Nevertheless, this option remains (both for backward compatibility and for use in combination with @option{--traditional}). +@item @option{-s} +@itemx @option{--no-optimize} +@cindex @option{--no-optimize} option +@cindex @option{-s} option +Disable @command{gawk}'s default optimizations on the internal +representation of the program. + @item @option{-S} @itemx @option{--sandbox} @cindex @option{-S} option @@ -27377,6 +27392,10 @@ that the profiling output does. This makes it easy to pretty-print your code once development is completed, and then use the result as the final version of your program. +Because the internal representation of your program is formatted to +recreate an @command{awk} program, profiling and pretty-printing +automatically disable @command{gawk}'s default optimizations. + @node Advanced Features Summary @section Summary @@ -35494,6 +35513,7 @@ The @option{-p}, @option{-P}, @option{-r}, +@option{-s}, @option{-S}, @option{-t}, and @@ -35518,6 +35538,7 @@ and the @option{--load}, @option{--non-decimal-data}, @option{--optimize}, +@option{--no-optimize}, @option{--posix}, @option{--pretty-print}, @option{--profile}, @@ -147,7 +147,7 @@ static void set_locale_stuff(void); static bool stopped_early = false; int do_flags = false; -bool do_optimize = false; /* apply default optimizations */ +bool do_optimize = true; /* apply default optimizations */ static int do_nostalgia = false; /* provide a blast from the past */ static int do_binary = false; /* hands off my data! */ static int do_version = false; /* print version info */ @@ -193,6 +193,7 @@ static const struct option optab[] = { { "locale", required_argument, NULL, 'Z' }, #endif { "non-decimal-data", no_argument, NULL, 'n' }, + { "no-optimize", no_argument, NULL, 's' }, { "nostalgia", no_argument, & do_nostalgia, 1 }, { "optimize", no_argument, NULL, 'O' }, #if defined(YYDEBUG) || defined(GAWKDEBUG) @@ -583,6 +584,7 @@ usage(int exitval, FILE *fp) fputs(_("\t-p[file]\t\t--profile[=file]\n"), fp); fputs(_("\t-P\t\t\t--posix\n"), fp); fputs(_("\t-r\t\t\t--re-interval\n"), fp); + fputs(_("\t-s\t\t\t--no-optimize\n"), fp); fputs(_("\t-S\t\t\t--sandbox\n"), fp); fputs(_("\t-t\t\t\t--lint-old\n"), fp); fputs(_("\t-V\t\t\t--version\n"), fp); @@ -1428,7 +1430,7 @@ parse_args(int argc, char **argv) /* * The + on the front tells GNU getopt not to rearrange argv. */ - const char *optlist = "+F:f:v:W;bcCd::D::e:E:ghi:l:L:nNo::Op::MPrStVYZ:"; + const char *optlist = "+F:f:v:W;bcCd::D::e:E:ghi:l:L:nNo::Op::MPrSstVYZ:"; int old_optind; int c; char *scan; @@ -1588,6 +1590,10 @@ parse_args(int argc, char **argv) do_flags |= DO_INTERVALS; break; + case 's': + do_optimize = false; + break; + case 'S': do_flags |= DO_SANDBOX; break; @@ -1662,6 +1668,8 @@ parse_args(int argc, char **argv) break; } out: + do_optimize = (do_optimize && ! do_pretty_print); + return; } diff --git a/test/ChangeLog b/test/ChangeLog index e7bddcd3..cc8b93e4 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2016-02-05 Arnold D. Robbins <arnold@skeeve.com> + + * badargs.ok: Update after adding Yet Another Command Line Option. + 2016-01-28 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (EXTRA_DIST): Add profile9.awk and profile9.ok. diff --git a/test/badargs.ok b/test/badargs.ok index 1664ec1c..cd66dda0 100644 --- a/test/badargs.ok +++ b/test/badargs.ok @@ -26,6 +26,7 @@ Short options: GNU long options: (extensions) -p[file] --profile[=file] -P --posix -r --re-interval + -s --no-optimize -S --sandbox -t --lint-old -V --version |