[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-571
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-571-g1bd1b88 |
Date: |
Fri, 30 Jan 2015 08:06:57 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk-4.1-stable has been updated
via 1bd1b885c7dd16b5e4ab78c040312f6f7d742784 (commit)
from 5153d0f04b7ad460b23ae5a011061f7b93a122ef (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=1bd1b885c7dd16b5e4ab78c040312f6f7d742784
commit 1bd1b885c7dd16b5e4ab78c040312f6f7d742784
Author: Arnold D. Robbins <address@hidden>
Date: Fri Jan 30 10:06:16 2015 +0200
Disallow calling a function parameter. Check params are not function names.
diff --git a/ChangeLog b/ChangeLog
index d192854..e5c7c09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2015-01-30 Arnold D. Robbins <address@hidden>
+
+ Don't allow function parameter names to be the same as function
+ names - required by POSIX. Bug first reported in comp.lang.awk.
+
+ In addition, don't allow use of a parameter as a function name
+ in a call (but it's ok in indirect calls).
+
+ * NEWS: Updated.
+ * awk.h (check_param_names): Add declaration.
+ * awkgram.y (at_seen): New variable. Communicates between
+ yylex() and the parser.
+ (FUNC_CALL production): Check at_seen and check that the identifier
+ is a function name.
+ (parse_program): Call check_param_names() and set errcount.
+ (yylex): Set at_seen after seeing an at-sign.
+ * symbol.c (check_param_names): New function.
+
2015-01-24 Arnold D. Robbins <address@hidden>
Infrastructure updates.
diff --git a/NEWS b/NEWS
index f708cfd..21568ea 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Changes from 4.1.1 to 4.1.2
- Chapter 15 on MPFR reworked.
- Summary sections added to all chapters.
- Exercises added in several chapters.
+ - Heavily proof-read and copyedited.
2. The debugger's "restart" command now works again.
@@ -25,9 +26,10 @@ Changes from 4.1.1 to 4.1.2
6. Built-in functions are now included in FUNCTAB.
-7. In non-English locales, it was accidentally possible to use "letters"
- beside those of the English alphabet in identifiers. This has
- been fixed. (isalpha and isalnum are NOT our friends.)
+7. POSIX and historical practice require the exclusive use of the English
+ alphabet in identifiers. In non-English locales, it was accidentally
+ possible to use "letters" beside those of the English alphabet. This
+ has been fixed. (isalpha and isalnum are NOT our friends.)
If you feel that you must have this misfeature, use `configure --help'
to see what option to use when configuring gawk to reenable it.
@@ -44,6 +46,11 @@ Changes from 4.1.1 to 4.1.2
10. Infrastructure upgrades: Automake 1.15, Gettext 0.19.4, Libtool 2.4.5,
Bison 3.0.4.
+11. POSIX requires that the names of function parameters not be the
+ same as any of the special built-in variables and also not conflict
+ with the names of any functions. Gawk has checked for the former
+ since 3.1.7. It now also checks for the latter.
+
XX. A number of bugs have been fixed. See the ChangeLog.
Changes from 4.1.0 to 4.1.1
diff --git a/awk.h b/awk.h
index 92baa7a..cdac139 100644
--- a/awk.h
+++ b/awk.h
@@ -1607,6 +1607,7 @@ extern void free_context(AWK_CONTEXT *ctxt, bool
keep_globals);
extern NODE **variable_list();
extern NODE **function_list(bool sort);
extern void print_vars(NODE **table, Func_print print_func, FILE *fp);
+extern bool check_param_names(void);
/* floatcomp.c */
#ifdef HAVE_UINTMAX_T
diff --git a/awkgram.c b/awkgram.c
index 53e35d2..9a9ca13 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -125,6 +125,7 @@ static void check_funcs(void);
static ssize_t read_one_line(int fd, void *buffer, size_t count);
static int one_line_close(int fd);
+static bool at_seen = false;
static bool want_source = false;
static bool want_regexp = false; /* lexical scanning kludge */
static char *in_function; /* parsing kludge */
@@ -191,7 +192,7 @@ extern double fmod(double x, double y);
#define YYSTYPE INSTRUCTION *
-#line 195 "awkgram.c" /* yacc.c:339 */
+#line 196 "awkgram.c" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
@@ -345,7 +346,7 @@ int yyparse (void);
/* Copy the second part of user declarations. */
-#line 349 "awkgram.c" /* yacc.c:358 */
+#line 350 "awkgram.c" /* yacc.c:358 */
#ifdef short
# undef short
@@ -647,25 +648,25 @@ static const yytype_uint8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 194, 194, 196, 201, 202, 206, 218, 222, 233,
- 239, 244, 252, 260, 262, 267, 275, 277, 283, 284,
- 286, 312, 323, 334, 340, 349, 359, 361, 363, 369,
- 374, 375, 379, 398, 397, 431, 433, 438, 439, 452,
- 457, 458, 462, 464, 466, 473, 563, 605, 647, 760,
- 767, 774, 784, 793, 802, 811, 822, 838, 837, 861,
- 873, 873, 971, 971, 1004, 1034, 1040, 1041, 1047, 1048,
- 1055, 1060, 1072, 1086, 1088, 1096, 1101, 1103, 1111, 1113,
- 1122, 1123, 1131, 1136, 1136, 1147, 1151, 1159, 1160, 1163,
- 1165, 1170, 1171, 1180, 1181, 1186, 1191, 1197, 1199, 1201,
- 1208, 1209, 1215, 1216, 1221, 1223, 1228, 1230, 1238, 1243,
- 1252, 1259, 1261, 1263, 1279, 1289, 1296, 1298, 1303, 1305,
- 1307, 1315, 1317, 1322, 1324, 1329, 1331, 1333, 1383, 1385,
- 1387, 1389, 1391, 1393, 1395, 1397, 1411, 1416, 1421, 1446,
- 1452, 1454, 1456, 1458, 1460, 1462, 1467, 1471, 1503, 1505,
- 1511, 1517, 1530, 1531, 1532, 1537, 1542, 1546, 1550, 1565,
- 1578, 1583, 1619, 1637, 1638, 1644, 1645, 1650, 1652, 1659,
- 1676, 1693, 1695, 1702, 1707, 1715, 1725, 1737, 1746, 1750,
- 1754, 1758, 1762, 1766, 1769, 1771, 1775, 1779, 1783
+ 0, 195, 195, 197, 202, 203, 207, 219, 223, 234,
+ 240, 246, 255, 263, 265, 270, 278, 280, 286, 287,
+ 289, 315, 326, 337, 343, 352, 362, 364, 366, 372,
+ 380, 381, 385, 404, 403, 437, 439, 444, 445, 458,
+ 463, 464, 468, 470, 472, 479, 569, 611, 653, 766,
+ 773, 780, 790, 799, 808, 817, 828, 844, 843, 867,
+ 879, 879, 977, 977, 1010, 1040, 1046, 1047, 1053, 1054,
+ 1061, 1066, 1078, 1092, 1094, 1102, 1107, 1109, 1117, 1119,
+ 1128, 1129, 1137, 1142, 1142, 1153, 1157, 1165, 1166, 1169,
+ 1171, 1176, 1177, 1186, 1187, 1192, 1197, 1203, 1205, 1207,
+ 1214, 1215, 1221, 1222, 1227, 1229, 1234, 1236, 1244, 1249,
+ 1258, 1265, 1267, 1269, 1285, 1295, 1302, 1304, 1309, 1311,
+ 1313, 1321, 1323, 1328, 1330, 1335, 1337, 1339, 1389, 1391,
+ 1393, 1395, 1397, 1399, 1401, 1403, 1417, 1422, 1427, 1452,
+ 1458, 1460, 1462, 1464, 1466, 1468, 1473, 1477, 1509, 1511,
+ 1517, 1523, 1536, 1537, 1538, 1543, 1548, 1552, 1556, 1571,
+ 1584, 1589, 1626, 1655, 1656, 1662, 1663, 1668, 1670, 1677,
+ 1694, 1711, 1713, 1720, 1725, 1733, 1743, 1755, 1764, 1768,
+ 1772, 1776, 1780, 1784, 1787, 1789, 1793, 1797, 1801
};
#endif
@@ -1838,24 +1839,24 @@ yyreduce:
switch (yyn)
{
case 3:
-#line 197 "awkgram.y" /* yacc.c:1646 */
+#line 198 "awkgram.y" /* yacc.c:1646 */
{
rule = 0;
yyerrok;
}
-#line 1847 "awkgram.c" /* yacc.c:1646 */
+#line 1848 "awkgram.c" /* yacc.c:1646 */
break;
case 5:
-#line 203 "awkgram.y" /* yacc.c:1646 */
+#line 204 "awkgram.y" /* yacc.c:1646 */
{
next_sourcefile();
}
-#line 1855 "awkgram.c" /* yacc.c:1646 */
+#line 1856 "awkgram.c" /* yacc.c:1646 */
break;
case 6:
-#line 207 "awkgram.y" /* yacc.c:1646 */
+#line 208 "awkgram.y" /* yacc.c:1646 */
{
rule = 0;
/*
@@ -1864,19 +1865,19 @@ yyreduce:
*/
/* yyerrok; */
}
-#line 1868 "awkgram.c" /* yacc.c:1646 */
+#line 1869 "awkgram.c" /* yacc.c:1646 */
break;
case 7:
-#line 219 "awkgram.y" /* yacc.c:1646 */
+#line 220 "awkgram.y" /* yacc.c:1646 */
{
(void) append_rule((yyvsp[-1]), (yyvsp[0]));
}
-#line 1876 "awkgram.c" /* yacc.c:1646 */
+#line 1877 "awkgram.c" /* yacc.c:1646 */
break;
case 8:
-#line 223 "awkgram.y" /* yacc.c:1646 */
+#line 224 "awkgram.y" /* yacc.c:1646 */
{
if (rule != Rule) {
msg(_("%s blocks must have an action part"),
ruletab[rule]);
@@ -1887,39 +1888,41 @@ yyreduce:
} else /* pattern rule with non-empty pattern */
(void) append_rule((yyvsp[-1]), NULL);
}
-#line 1891 "awkgram.c" /* yacc.c:1646 */
+#line 1892 "awkgram.c" /* yacc.c:1646 */
break;
case 9:
-#line 234 "awkgram.y" /* yacc.c:1646 */
+#line 235 "awkgram.y" /* yacc.c:1646 */
{
in_function = NULL;
(void) mk_function((yyvsp[-1]), (yyvsp[0]));
yyerrok;
}
-#line 1901 "awkgram.c" /* yacc.c:1646 */
+#line 1902 "awkgram.c" /* yacc.c:1646 */
break;
case 10:
-#line 240 "awkgram.y" /* yacc.c:1646 */
+#line 241 "awkgram.y" /* yacc.c:1646 */
{
want_source = false;
+ at_seen = false;
yyerrok;
}
-#line 1910 "awkgram.c" /* yacc.c:1646 */
+#line 1912 "awkgram.c" /* yacc.c:1646 */
break;
case 11:
-#line 245 "awkgram.y" /* yacc.c:1646 */
+#line 247 "awkgram.y" /* yacc.c:1646 */
{
want_source = false;
+ at_seen = false;
yyerrok;
}
-#line 1919 "awkgram.c" /* yacc.c:1646 */
+#line 1922 "awkgram.c" /* yacc.c:1646 */
break;
case 12:
-#line 253 "awkgram.y" /* yacc.c:1646 */
+#line 256 "awkgram.y" /* yacc.c:1646 */
{
if (include_source((yyvsp[0])) < 0)
YYABORT;
@@ -1927,23 +1930,23 @@ yyreduce:
bcfree((yyvsp[0]));
(yyval) = NULL;
}
-#line 1931 "awkgram.c" /* yacc.c:1646 */
+#line 1934 "awkgram.c" /* yacc.c:1646 */
break;
case 13:
-#line 261 "awkgram.y" /* yacc.c:1646 */
+#line 264 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 1937 "awkgram.c" /* yacc.c:1646 */
+#line 1940 "awkgram.c" /* yacc.c:1646 */
break;
case 14:
-#line 263 "awkgram.y" /* yacc.c:1646 */
+#line 266 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 1943 "awkgram.c" /* yacc.c:1646 */
+#line 1946 "awkgram.c" /* yacc.c:1646 */
break;
case 15:
-#line 268 "awkgram.y" /* yacc.c:1646 */
+#line 271 "awkgram.y" /* yacc.c:1646 */
{
if (load_library((yyvsp[0])) < 0)
YYABORT;
@@ -1951,35 +1954,35 @@ yyreduce:
bcfree((yyvsp[0]));
(yyval) = NULL;
}
-#line 1955 "awkgram.c" /* yacc.c:1646 */
+#line 1958 "awkgram.c" /* yacc.c:1646 */
break;
case 16:
-#line 276 "awkgram.y" /* yacc.c:1646 */
+#line 279 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 1961 "awkgram.c" /* yacc.c:1646 */
+#line 1964 "awkgram.c" /* yacc.c:1646 */
break;
case 17:
-#line 278 "awkgram.y" /* yacc.c:1646 */
+#line 281 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 1967 "awkgram.c" /* yacc.c:1646 */
+#line 1970 "awkgram.c" /* yacc.c:1646 */
break;
case 18:
-#line 283 "awkgram.y" /* yacc.c:1646 */
+#line 286 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; rule = Rule; }
-#line 1973 "awkgram.c" /* yacc.c:1646 */
+#line 1976 "awkgram.c" /* yacc.c:1646 */
break;
case 19:
-#line 285 "awkgram.y" /* yacc.c:1646 */
+#line 288 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); rule = Rule; }
-#line 1979 "awkgram.c" /* yacc.c:1646 */
+#line 1982 "awkgram.c" /* yacc.c:1646 */
break;
case 20:
-#line 287 "awkgram.y" /* yacc.c:1646 */
+#line 290 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *tp;
@@ -2005,11 +2008,11 @@ yyreduce:
(yyval) = list_append(list_merge((yyvsp[-3]), (yyvsp[0])), tp);
rule = Rule;
}
-#line 2009 "awkgram.c" /* yacc.c:1646 */
+#line 2012 "awkgram.c" /* yacc.c:1646 */
break;
case 21:
-#line 313 "awkgram.y" /* yacc.c:1646 */
+#line 316 "awkgram.y" /* yacc.c:1646 */
{
static int begin_seen = 0;
if (do_lint_old && ++begin_seen == 2)
@@ -2020,11 +2023,11 @@ yyreduce:
(yyvsp[0])->source_file = source;
(yyval) = (yyvsp[0]);
}
-#line 2024 "awkgram.c" /* yacc.c:1646 */
+#line 2027 "awkgram.c" /* yacc.c:1646 */
break;
case 22:
-#line 324 "awkgram.y" /* yacc.c:1646 */
+#line 327 "awkgram.y" /* yacc.c:1646 */
{
static int end_seen = 0;
if (do_lint_old && ++end_seen == 2)
@@ -2035,70 +2038,73 @@ yyreduce:
(yyvsp[0])->source_file = source;
(yyval) = (yyvsp[0]);
}
-#line 2039 "awkgram.c" /* yacc.c:1646 */
+#line 2042 "awkgram.c" /* yacc.c:1646 */
break;
case 23:
-#line 335 "awkgram.y" /* yacc.c:1646 */
+#line 338 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->in_rule = rule = BEGINFILE;
(yyvsp[0])->source_file = source;
(yyval) = (yyvsp[0]);
}
-#line 2049 "awkgram.c" /* yacc.c:1646 */
+#line 2052 "awkgram.c" /* yacc.c:1646 */
break;
case 24:
-#line 341 "awkgram.y" /* yacc.c:1646 */
+#line 344 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->in_rule = rule = ENDFILE;
(yyvsp[0])->source_file = source;
(yyval) = (yyvsp[0]);
}
-#line 2059 "awkgram.c" /* yacc.c:1646 */
+#line 2062 "awkgram.c" /* yacc.c:1646 */
break;
case 25:
-#line 350 "awkgram.y" /* yacc.c:1646 */
+#line 353 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-3]) == NULL)
(yyval) = list_create(instruction(Op_no_op));
else
(yyval) = (yyvsp[-3]);
}
-#line 2070 "awkgram.c" /* yacc.c:1646 */
+#line 2073 "awkgram.c" /* yacc.c:1646 */
break;
case 26:
-#line 360 "awkgram.y" /* yacc.c:1646 */
+#line 363 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2076 "awkgram.c" /* yacc.c:1646 */
+#line 2079 "awkgram.c" /* yacc.c:1646 */
break;
case 27:
-#line 362 "awkgram.y" /* yacc.c:1646 */
+#line 365 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2082 "awkgram.c" /* yacc.c:1646 */
+#line 2085 "awkgram.c" /* yacc.c:1646 */
break;
case 28:
-#line 364 "awkgram.y" /* yacc.c:1646 */
+#line 367 "awkgram.y" /* yacc.c:1646 */
{
yyerror(_("`%s' is a built-in function, it cannot be
redefined"),
tokstart);
YYABORT;
}
-#line 2092 "awkgram.c" /* yacc.c:1646 */
+#line 2095 "awkgram.c" /* yacc.c:1646 */
break;
case 29:
-#line 370 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2098 "awkgram.c" /* yacc.c:1646 */
+#line 373 "awkgram.y" /* yacc.c:1646 */
+ {
+ (yyval) = (yyvsp[0]);
+ at_seen = false;
+ }
+#line 2104 "awkgram.c" /* yacc.c:1646 */
break;
case 32:
-#line 380 "awkgram.y" /* yacc.c:1646 */
+#line 386 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[-5])->source_file = source;
if (install_function((yyvsp[-4])->lextok, (yyvsp[-5]),
(yyvsp[-2])) < 0)
@@ -2109,17 +2115,17 @@ yyreduce:
/* $4 already free'd in install_function */
(yyval) = (yyvsp[-5]);
}
-#line 2113 "awkgram.c" /* yacc.c:1646 */
+#line 2119 "awkgram.c" /* yacc.c:1646 */
break;
case 33:
-#line 398 "awkgram.y" /* yacc.c:1646 */
+#line 404 "awkgram.y" /* yacc.c:1646 */
{ want_regexp = true; }
-#line 2119 "awkgram.c" /* yacc.c:1646 */
+#line 2125 "awkgram.c" /* yacc.c:1646 */
break;
case 34:
-#line 400 "awkgram.y" /* yacc.c:1646 */
+#line 406 "awkgram.y" /* yacc.c:1646 */
{
NODE *n, *exp;
char *re;
@@ -2148,23 +2154,23 @@ yyreduce:
(yyval)->opcode = Op_match_rec;
(yyval)->memory = n;
}
-#line 2152 "awkgram.c" /* yacc.c:1646 */
+#line 2158 "awkgram.c" /* yacc.c:1646 */
break;
case 35:
-#line 432 "awkgram.y" /* yacc.c:1646 */
+#line 438 "awkgram.y" /* yacc.c:1646 */
{ bcfree((yyvsp[0])); }
-#line 2158 "awkgram.c" /* yacc.c:1646 */
+#line 2164 "awkgram.c" /* yacc.c:1646 */
break;
case 37:
-#line 438 "awkgram.y" /* yacc.c:1646 */
+#line 444 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2164 "awkgram.c" /* yacc.c:1646 */
+#line 2170 "awkgram.c" /* yacc.c:1646 */
break;
case 38:
-#line 440 "awkgram.y" /* yacc.c:1646 */
+#line 446 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0]) == NULL)
(yyval) = (yyvsp[-1]);
@@ -2177,40 +2183,40 @@ yyreduce:
}
yyerrok;
}
-#line 2181 "awkgram.c" /* yacc.c:1646 */
+#line 2187 "awkgram.c" /* yacc.c:1646 */
break;
case 39:
-#line 453 "awkgram.y" /* yacc.c:1646 */
+#line 459 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2187 "awkgram.c" /* yacc.c:1646 */
+#line 2193 "awkgram.c" /* yacc.c:1646 */
break;
case 42:
-#line 463 "awkgram.y" /* yacc.c:1646 */
+#line 469 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2193 "awkgram.c" /* yacc.c:1646 */
+#line 2199 "awkgram.c" /* yacc.c:1646 */
break;
case 43:
-#line 465 "awkgram.y" /* yacc.c:1646 */
+#line 471 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 2199 "awkgram.c" /* yacc.c:1646 */
+#line 2205 "awkgram.c" /* yacc.c:1646 */
break;
case 44:
-#line 467 "awkgram.y" /* yacc.c:1646 */
+#line 473 "awkgram.y" /* yacc.c:1646 */
{
if (do_pretty_print)
(yyval) = list_prepend((yyvsp[0]),
instruction(Op_exec_count));
else
(yyval) = (yyvsp[0]);
}
-#line 2210 "awkgram.c" /* yacc.c:1646 */
+#line 2216 "awkgram.c" /* yacc.c:1646 */
break;
case 45:
-#line 474 "awkgram.y" /* yacc.c:1646 */
+#line 480 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
INSTRUCTION *ip, *nextc, *tbreak;
@@ -2300,11 +2306,11 @@ yyreduce:
break_allowed--;
fix_break_continue(ip, tbreak, NULL);
}
-#line 2304 "awkgram.c" /* yacc.c:1646 */
+#line 2310 "awkgram.c" /* yacc.c:1646 */
break;
case 46:
-#line 564 "awkgram.y" /* yacc.c:1646 */
+#line 570 "awkgram.y" /* yacc.c:1646 */
{
/*
* -----------------
@@ -2346,11 +2352,11 @@ yyreduce:
continue_allowed--;
fix_break_continue(ip, tbreak, tcont);
}
-#line 2350 "awkgram.c" /* yacc.c:1646 */
+#line 2356 "awkgram.c" /* yacc.c:1646 */
break;
case 47:
-#line 606 "awkgram.y" /* yacc.c:1646 */
+#line 612 "awkgram.y" /* yacc.c:1646 */
{
/*
* -----------------
@@ -2392,11 +2398,11 @@ yyreduce:
} /* else
$1 and $4 are NULLs */
}
-#line 2396 "awkgram.c" /* yacc.c:1646 */
+#line 2402 "awkgram.c" /* yacc.c:1646 */
break;
case 48:
-#line 648 "awkgram.y" /* yacc.c:1646 */
+#line 654 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip;
char *var_name = (yyvsp[-5])->lextok;
@@ -2509,44 +2515,44 @@ regular_loop:
break_allowed--;
continue_allowed--;
}
-#line 2513 "awkgram.c" /* yacc.c:1646 */
+#line 2519 "awkgram.c" /* yacc.c:1646 */
break;
case 49:
-#line 761 "awkgram.y" /* yacc.c:1646 */
+#line 767 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_for_loop((yyvsp[-11]), (yyvsp[-9]), (yyvsp[-6]),
(yyvsp[-3]), (yyvsp[0]));
break_allowed--;
continue_allowed--;
}
-#line 2524 "awkgram.c" /* yacc.c:1646 */
+#line 2530 "awkgram.c" /* yacc.c:1646 */
break;
case 50:
-#line 768 "awkgram.y" /* yacc.c:1646 */
+#line 774 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_for_loop((yyvsp[-10]), (yyvsp[-8]), (INSTRUCTION
*) NULL, (yyvsp[-3]), (yyvsp[0]));
break_allowed--;
continue_allowed--;
}
-#line 2535 "awkgram.c" /* yacc.c:1646 */
+#line 2541 "awkgram.c" /* yacc.c:1646 */
break;
case 51:
-#line 775 "awkgram.y" /* yacc.c:1646 */
+#line 781 "awkgram.y" /* yacc.c:1646 */
{
if (do_pretty_print)
(yyval) = list_prepend((yyvsp[0]),
instruction(Op_exec_count));
else
(yyval) = (yyvsp[0]);
}
-#line 2546 "awkgram.c" /* yacc.c:1646 */
+#line 2552 "awkgram.c" /* yacc.c:1646 */
break;
case 52:
-#line 785 "awkgram.y" /* yacc.c:1646 */
+#line 791 "awkgram.y" /* yacc.c:1646 */
{
if (! break_allowed)
error_ln((yyvsp[-1])->source_line,
@@ -2555,11 +2561,11 @@ regular_loop:
(yyval) = list_create((yyvsp[-1]));
}
-#line 2559 "awkgram.c" /* yacc.c:1646 */
+#line 2565 "awkgram.c" /* yacc.c:1646 */
break;
case 53:
-#line 794 "awkgram.y" /* yacc.c:1646 */
+#line 800 "awkgram.y" /* yacc.c:1646 */
{
if (! continue_allowed)
error_ln((yyvsp[-1])->source_line,
@@ -2568,11 +2574,11 @@ regular_loop:
(yyval) = list_create((yyvsp[-1]));
}
-#line 2572 "awkgram.c" /* yacc.c:1646 */
+#line 2578 "awkgram.c" /* yacc.c:1646 */
break;
case 54:
-#line 803 "awkgram.y" /* yacc.c:1646 */
+#line 809 "awkgram.y" /* yacc.c:1646 */
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule && rule != Rule)
@@ -2581,11 +2587,11 @@ regular_loop:
(yyvsp[-1])->target_jmp = ip_rec;
(yyval) = list_create((yyvsp[-1]));
}
-#line 2585 "awkgram.c" /* yacc.c:1646 */
+#line 2591 "awkgram.c" /* yacc.c:1646 */
break;
case 55:
-#line 812 "awkgram.y" /* yacc.c:1646 */
+#line 818 "awkgram.y" /* yacc.c:1646 */
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule == BEGIN || rule == END || rule == ENDFILE)
@@ -2596,11 +2602,11 @@ regular_loop:
(yyvsp[-1])->target_endfile = ip_endfile;
(yyval) = list_create((yyvsp[-1]));
}
-#line 2600 "awkgram.c" /* yacc.c:1646 */
+#line 2606 "awkgram.c" /* yacc.c:1646 */
break;
case 56:
-#line 823 "awkgram.y" /* yacc.c:1646 */
+#line 829 "awkgram.y" /* yacc.c:1646 */
{
/* Initialize the two possible jump targets, the actual target
* is resolved at run-time.
@@ -2615,20 +2621,20 @@ regular_loop:
} else
(yyval) = list_append((yyvsp[-1]), (yyvsp[-2]));
}
-#line 2619 "awkgram.c" /* yacc.c:1646 */
+#line 2625 "awkgram.c" /* yacc.c:1646 */
break;
case 57:
-#line 838 "awkgram.y" /* yacc.c:1646 */
+#line 844 "awkgram.y" /* yacc.c:1646 */
{
if (! in_function)
yyerror(_("`return' used outside function context"));
}
-#line 2628 "awkgram.c" /* yacc.c:1646 */
+#line 2634 "awkgram.c" /* yacc.c:1646 */
break;
case 58:
-#line 841 "awkgram.y" /* yacc.c:1646 */
+#line 847 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-1]) == NULL) {
(yyval) = list_create((yyvsp[-3]));
@@ -2649,17 +2655,17 @@ regular_loop:
(yyval) = list_append((yyvsp[-1]), (yyvsp[-3]));
}
}
-#line 2653 "awkgram.c" /* yacc.c:1646 */
+#line 2659 "awkgram.c" /* yacc.c:1646 */
break;
case 60:
-#line 873 "awkgram.y" /* yacc.c:1646 */
+#line 879 "awkgram.y" /* yacc.c:1646 */
{ in_print = true; in_parens = 0; }
-#line 2659 "awkgram.c" /* yacc.c:1646 */
+#line 2665 "awkgram.c" /* yacc.c:1646 */
break;
case 61:
-#line 874 "awkgram.y" /* yacc.c:1646 */
+#line 880 "awkgram.y" /* yacc.c:1646 */
{
/*
* Optimization: plain `print' has no expression list, so $3 is
null.
@@ -2756,17 +2762,17 @@ regular_print:
}
}
}
-#line 2760 "awkgram.c" /* yacc.c:1646 */
+#line 2766 "awkgram.c" /* yacc.c:1646 */
break;
case 62:
-#line 971 "awkgram.y" /* yacc.c:1646 */
+#line 977 "awkgram.y" /* yacc.c:1646 */
{ sub_counter = 0; }
-#line 2766 "awkgram.c" /* yacc.c:1646 */
+#line 2772 "awkgram.c" /* yacc.c:1646 */
break;
case 63:
-#line 972 "awkgram.y" /* yacc.c:1646 */
+#line 978 "awkgram.y" /* yacc.c:1646 */
{
char *arr = (yyvsp[-2])->lextok;
@@ -2799,11 +2805,11 @@ regular_print:
(yyval) = list_append(list_append((yyvsp[0]),
(yyvsp[-2])), (yyvsp[-3]));
}
}
-#line 2803 "awkgram.c" /* yacc.c:1646 */
+#line 2809 "awkgram.c" /* yacc.c:1646 */
break;
case 64:
-#line 1009 "awkgram.y" /* yacc.c:1646 */
+#line 1015 "awkgram.y" /* yacc.c:1646 */
{
static bool warned = false;
char *arr = (yyvsp[-1])->lextok;
@@ -2829,52 +2835,52 @@ regular_print:
fatal(_("`delete' is not allowed with
FUNCTAB"));
}
}
-#line 2833 "awkgram.c" /* yacc.c:1646 */
+#line 2839 "awkgram.c" /* yacc.c:1646 */
break;
case 65:
-#line 1035 "awkgram.y" /* yacc.c:1646 */
+#line 1041 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = optimize_assignment((yyvsp[0])); }
-#line 2839 "awkgram.c" /* yacc.c:1646 */
+#line 2845 "awkgram.c" /* yacc.c:1646 */
break;
case 66:
-#line 1040 "awkgram.y" /* yacc.c:1646 */
+#line 1046 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2845 "awkgram.c" /* yacc.c:1646 */
+#line 2851 "awkgram.c" /* yacc.c:1646 */
break;
case 67:
-#line 1042 "awkgram.y" /* yacc.c:1646 */
+#line 1048 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2851 "awkgram.c" /* yacc.c:1646 */
+#line 2857 "awkgram.c" /* yacc.c:1646 */
break;
case 68:
-#line 1047 "awkgram.y" /* yacc.c:1646 */
+#line 1053 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2857 "awkgram.c" /* yacc.c:1646 */
+#line 2863 "awkgram.c" /* yacc.c:1646 */
break;
case 69:
-#line 1049 "awkgram.y" /* yacc.c:1646 */
+#line 1055 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-1]) == NULL)
(yyval) = list_create((yyvsp[0]));
else
(yyval) = list_prepend((yyvsp[-1]), (yyvsp[0]));
}
-#line 2868 "awkgram.c" /* yacc.c:1646 */
+#line 2874 "awkgram.c" /* yacc.c:1646 */
break;
case 70:
-#line 1056 "awkgram.y" /* yacc.c:1646 */
+#line 1062 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2874 "awkgram.c" /* yacc.c:1646 */
+#line 2880 "awkgram.c" /* yacc.c:1646 */
break;
case 71:
-#line 1061 "awkgram.y" /* yacc.c:1646 */
+#line 1067 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *casestmt = (yyvsp[0]);
if ((yyvsp[0]) == NULL)
@@ -2886,11 +2892,11 @@ regular_print:
bcfree((yyvsp[-2]));
(yyval) = (yyvsp[-4]);
}
-#line 2890 "awkgram.c" /* yacc.c:1646 */
+#line 2896 "awkgram.c" /* yacc.c:1646 */
break;
case 72:
-#line 1073 "awkgram.y" /* yacc.c:1646 */
+#line 1079 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *casestmt = (yyvsp[0]);
if ((yyvsp[0]) == NULL)
@@ -2901,17 +2907,17 @@ regular_print:
(yyvsp[-3])->case_stmt = casestmt;
(yyval) = (yyvsp[-3]);
}
-#line 2905 "awkgram.c" /* yacc.c:1646 */
+#line 2911 "awkgram.c" /* yacc.c:1646 */
break;
case 73:
-#line 1087 "awkgram.y" /* yacc.c:1646 */
+#line 1093 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2911 "awkgram.c" /* yacc.c:1646 */
+#line 2917 "awkgram.c" /* yacc.c:1646 */
break;
case 74:
-#line 1089 "awkgram.y" /* yacc.c:1646 */
+#line 1095 "awkgram.y" /* yacc.c:1646 */
{
NODE *n = (yyvsp[0])->memory;
(void) force_number(n);
@@ -2919,71 +2925,71 @@ regular_print:
bcfree((yyvsp[-1]));
(yyval) = (yyvsp[0]);
}
-#line 2923 "awkgram.c" /* yacc.c:1646 */
+#line 2929 "awkgram.c" /* yacc.c:1646 */
break;
case 75:
-#line 1097 "awkgram.y" /* yacc.c:1646 */
+#line 1103 "awkgram.y" /* yacc.c:1646 */
{
bcfree((yyvsp[-1]));
(yyval) = (yyvsp[0]);
}
-#line 2932 "awkgram.c" /* yacc.c:1646 */
+#line 2938 "awkgram.c" /* yacc.c:1646 */
break;
case 76:
-#line 1102 "awkgram.y" /* yacc.c:1646 */
+#line 1108 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2938 "awkgram.c" /* yacc.c:1646 */
+#line 2944 "awkgram.c" /* yacc.c:1646 */
break;
case 77:
-#line 1104 "awkgram.y" /* yacc.c:1646 */
+#line 1110 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_push_re;
(yyval) = (yyvsp[0]);
}
-#line 2947 "awkgram.c" /* yacc.c:1646 */
+#line 2953 "awkgram.c" /* yacc.c:1646 */
break;
case 78:
-#line 1112 "awkgram.y" /* yacc.c:1646 */
+#line 1118 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2953 "awkgram.c" /* yacc.c:1646 */
+#line 2959 "awkgram.c" /* yacc.c:1646 */
break;
case 79:
-#line 1114 "awkgram.y" /* yacc.c:1646 */
+#line 1120 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2959 "awkgram.c" /* yacc.c:1646 */
+#line 2965 "awkgram.c" /* yacc.c:1646 */
break;
case 81:
-#line 1124 "awkgram.y" /* yacc.c:1646 */
+#line 1130 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = (yyvsp[-1]);
}
-#line 2967 "awkgram.c" /* yacc.c:1646 */
+#line 2973 "awkgram.c" /* yacc.c:1646 */
break;
case 82:
-#line 1131 "awkgram.y" /* yacc.c:1646 */
+#line 1137 "awkgram.y" /* yacc.c:1646 */
{
in_print = false;
in_parens = 0;
(yyval) = NULL;
}
-#line 2977 "awkgram.c" /* yacc.c:1646 */
+#line 2983 "awkgram.c" /* yacc.c:1646 */
break;
case 83:
-#line 1136 "awkgram.y" /* yacc.c:1646 */
+#line 1142 "awkgram.y" /* yacc.c:1646 */
{ in_print = false; in_parens = 0; }
-#line 2983 "awkgram.c" /* yacc.c:1646 */
+#line 2989 "awkgram.c" /* yacc.c:1646 */
break;
case 84:
-#line 1137 "awkgram.y" /* yacc.c:1646 */
+#line 1143 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2])->redir_type == redirect_twoway
&& (yyvsp[0])->lasti->opcode == Op_K_getline_redir
@@ -2991,136 +2997,136 @@ regular_print:
yyerror(_("multistage two-way pipelines don't work"));
(yyval) = list_prepend((yyvsp[0]), (yyvsp[-2]));
}
-#line 2995 "awkgram.c" /* yacc.c:1646 */
+#line 3001 "awkgram.c" /* yacc.c:1646 */
break;
case 85:
-#line 1148 "awkgram.y" /* yacc.c:1646 */
+#line 1154 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_condition((yyvsp[-3]), (yyvsp[-5]), (yyvsp[0]),
NULL, NULL);
}
-#line 3003 "awkgram.c" /* yacc.c:1646 */
+#line 3009 "awkgram.c" /* yacc.c:1646 */
break;
case 86:
-#line 1153 "awkgram.y" /* yacc.c:1646 */
+#line 1159 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_condition((yyvsp[-6]), (yyvsp[-8]), (yyvsp[-3]),
(yyvsp[-2]), (yyvsp[0]));
}
-#line 3011 "awkgram.c" /* yacc.c:1646 */
+#line 3017 "awkgram.c" /* yacc.c:1646 */
break;
case 91:
-#line 1170 "awkgram.y" /* yacc.c:1646 */
+#line 1176 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3017 "awkgram.c" /* yacc.c:1646 */
+#line 3023 "awkgram.c" /* yacc.c:1646 */
break;
case 92:
-#line 1172 "awkgram.y" /* yacc.c:1646 */
+#line 1178 "awkgram.y" /* yacc.c:1646 */
{
bcfree((yyvsp[-1]));
(yyval) = (yyvsp[0]);
}
-#line 3026 "awkgram.c" /* yacc.c:1646 */
+#line 3032 "awkgram.c" /* yacc.c:1646 */
break;
case 93:
-#line 1180 "awkgram.y" /* yacc.c:1646 */
+#line 1186 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3032 "awkgram.c" /* yacc.c:1646 */
+#line 3038 "awkgram.c" /* yacc.c:1646 */
break;
case 94:
-#line 1182 "awkgram.y" /* yacc.c:1646 */
+#line 1188 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]) ; }
-#line 3038 "awkgram.c" /* yacc.c:1646 */
+#line 3044 "awkgram.c" /* yacc.c:1646 */
break;
case 95:
-#line 1187 "awkgram.y" /* yacc.c:1646 */
+#line 1193 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->param_count = 0;
(yyval) = list_create((yyvsp[0]));
}
-#line 3047 "awkgram.c" /* yacc.c:1646 */
+#line 3053 "awkgram.c" /* yacc.c:1646 */
break;
case 96:
-#line 1192 "awkgram.y" /* yacc.c:1646 */
+#line 1198 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->param_count = (yyvsp[-2])->lasti->param_count + 1;
(yyval) = list_append((yyvsp[-2]), (yyvsp[0]));
yyerrok;
}
-#line 3057 "awkgram.c" /* yacc.c:1646 */
+#line 3063 "awkgram.c" /* yacc.c:1646 */
break;
case 97:
-#line 1198 "awkgram.y" /* yacc.c:1646 */
+#line 1204 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3063 "awkgram.c" /* yacc.c:1646 */
+#line 3069 "awkgram.c" /* yacc.c:1646 */
break;
case 98:
-#line 1200 "awkgram.y" /* yacc.c:1646 */
+#line 1206 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3069 "awkgram.c" /* yacc.c:1646 */
+#line 3075 "awkgram.c" /* yacc.c:1646 */
break;
case 99:
-#line 1202 "awkgram.y" /* yacc.c:1646 */
+#line 1208 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-2]); }
-#line 3075 "awkgram.c" /* yacc.c:1646 */
+#line 3081 "awkgram.c" /* yacc.c:1646 */
break;
case 100:
-#line 1208 "awkgram.y" /* yacc.c:1646 */
+#line 1214 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3081 "awkgram.c" /* yacc.c:1646 */
+#line 3087 "awkgram.c" /* yacc.c:1646 */
break;
case 101:
-#line 1210 "awkgram.y" /* yacc.c:1646 */
+#line 1216 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3087 "awkgram.c" /* yacc.c:1646 */
+#line 3093 "awkgram.c" /* yacc.c:1646 */
break;
case 102:
-#line 1215 "awkgram.y" /* yacc.c:1646 */
+#line 1221 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3093 "awkgram.c" /* yacc.c:1646 */
+#line 3099 "awkgram.c" /* yacc.c:1646 */
break;
case 103:
-#line 1217 "awkgram.y" /* yacc.c:1646 */
+#line 1223 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3099 "awkgram.c" /* yacc.c:1646 */
+#line 3105 "awkgram.c" /* yacc.c:1646 */
break;
case 104:
-#line 1222 "awkgram.y" /* yacc.c:1646 */
+#line 1228 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_expression_list(NULL, (yyvsp[0])); }
-#line 3105 "awkgram.c" /* yacc.c:1646 */
+#line 3111 "awkgram.c" /* yacc.c:1646 */
break;
case 105:
-#line 1224 "awkgram.y" /* yacc.c:1646 */
+#line 1230 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
yyerrok;
}
-#line 3114 "awkgram.c" /* yacc.c:1646 */
+#line 3120 "awkgram.c" /* yacc.c:1646 */
break;
case 106:
-#line 1229 "awkgram.y" /* yacc.c:1646 */
+#line 1235 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3120 "awkgram.c" /* yacc.c:1646 */
+#line 3126 "awkgram.c" /* yacc.c:1646 */
break;
case 107:
-#line 1231 "awkgram.y" /* yacc.c:1646 */
+#line 1237 "awkgram.y" /* yacc.c:1646 */
{
/*
* Returning the expression list instead of NULL lets
@@ -3128,52 +3134,52 @@ regular_print:
*/
(yyval) = (yyvsp[-1]);
}
-#line 3132 "awkgram.c" /* yacc.c:1646 */
+#line 3138 "awkgram.c" /* yacc.c:1646 */
break;
case 108:
-#line 1239 "awkgram.y" /* yacc.c:1646 */
+#line 1245 "awkgram.y" /* yacc.c:1646 */
{
/* Ditto */
(yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
}
-#line 3141 "awkgram.c" /* yacc.c:1646 */
+#line 3147 "awkgram.c" /* yacc.c:1646 */
break;
case 109:
-#line 1244 "awkgram.y" /* yacc.c:1646 */
+#line 1250 "awkgram.y" /* yacc.c:1646 */
{
/* Ditto */
(yyval) = (yyvsp[-2]);
}
-#line 3150 "awkgram.c" /* yacc.c:1646 */
+#line 3156 "awkgram.c" /* yacc.c:1646 */
break;
case 110:
-#line 1253 "awkgram.y" /* yacc.c:1646 */
+#line 1259 "awkgram.y" /* yacc.c:1646 */
{
if (do_lint && (yyvsp[0])->lasti->opcode == Op_match_rec)
lintwarn_ln((yyvsp[-1])->source_line,
_("regular expression on right of assignment"));
(yyval) = mk_assignment((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1]));
}
-#line 3161 "awkgram.c" /* yacc.c:1646 */
+#line 3167 "awkgram.c" /* yacc.c:1646 */
break;
case 111:
-#line 1260 "awkgram.y" /* yacc.c:1646 */
+#line 1266 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_boolean((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3167 "awkgram.c" /* yacc.c:1646 */
+#line 3173 "awkgram.c" /* yacc.c:1646 */
break;
case 112:
-#line 1262 "awkgram.y" /* yacc.c:1646 */
+#line 1268 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_boolean((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3173 "awkgram.c" /* yacc.c:1646 */
+#line 3179 "awkgram.c" /* yacc.c:1646 */
break;
case 113:
-#line 1264 "awkgram.y" /* yacc.c:1646 */
+#line 1270 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2])->lasti->opcode == Op_match_rec)
warning_ln((yyvsp[-1])->source_line,
@@ -3189,11 +3195,11 @@ regular_print:
(yyval) = list_append(list_merge((yyvsp[-2]),
(yyvsp[0])), (yyvsp[-1]));
}
}
-#line 3193 "awkgram.c" /* yacc.c:1646 */
+#line 3199 "awkgram.c" /* yacc.c:1646 */
break;
case 114:
-#line 1280 "awkgram.y" /* yacc.c:1646 */
+#line 1286 "awkgram.y" /* yacc.c:1646 */
{
if (do_lint_old)
warning_ln((yyvsp[-1])->source_line,
@@ -3203,91 +3209,91 @@ regular_print:
(yyvsp[-1])->expr_count = 1;
(yyval) = list_append(list_merge((yyvsp[-2]), (yyvsp[0])),
(yyvsp[-1]));
}
-#line 3207 "awkgram.c" /* yacc.c:1646 */
+#line 3213 "awkgram.c" /* yacc.c:1646 */
break;
case 115:
-#line 1290 "awkgram.y" /* yacc.c:1646 */
+#line 1296 "awkgram.y" /* yacc.c:1646 */
{
if (do_lint && (yyvsp[0])->lasti->opcode == Op_match_rec)
lintwarn_ln((yyvsp[-1])->source_line,
_("regular expression on right of comparison"));
(yyval) = list_append(list_merge((yyvsp[-2]), (yyvsp[0])),
(yyvsp[-1]));
}
-#line 3218 "awkgram.c" /* yacc.c:1646 */
+#line 3224 "awkgram.c" /* yacc.c:1646 */
break;
case 116:
-#line 1297 "awkgram.y" /* yacc.c:1646 */
+#line 1303 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_condition((yyvsp[-4]), (yyvsp[-3]), (yyvsp[-2]),
(yyvsp[-1]), (yyvsp[0])); }
-#line 3224 "awkgram.c" /* yacc.c:1646 */
+#line 3230 "awkgram.c" /* yacc.c:1646 */
break;
case 117:
-#line 1299 "awkgram.y" /* yacc.c:1646 */
+#line 1305 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3230 "awkgram.c" /* yacc.c:1646 */
+#line 3236 "awkgram.c" /* yacc.c:1646 */
break;
case 118:
-#line 1304 "awkgram.y" /* yacc.c:1646 */
+#line 1310 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3236 "awkgram.c" /* yacc.c:1646 */
+#line 3242 "awkgram.c" /* yacc.c:1646 */
break;
case 119:
-#line 1306 "awkgram.y" /* yacc.c:1646 */
+#line 1312 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3242 "awkgram.c" /* yacc.c:1646 */
+#line 3248 "awkgram.c" /* yacc.c:1646 */
break;
case 120:
-#line 1308 "awkgram.y" /* yacc.c:1646 */
+#line 1314 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_assign_quotient;
(yyval) = (yyvsp[0]);
}
-#line 3251 "awkgram.c" /* yacc.c:1646 */
+#line 3257 "awkgram.c" /* yacc.c:1646 */
break;
case 121:
-#line 1316 "awkgram.y" /* yacc.c:1646 */
+#line 1322 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3257 "awkgram.c" /* yacc.c:1646 */
+#line 3263 "awkgram.c" /* yacc.c:1646 */
break;
case 122:
-#line 1318 "awkgram.y" /* yacc.c:1646 */
+#line 1324 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3263 "awkgram.c" /* yacc.c:1646 */
+#line 3269 "awkgram.c" /* yacc.c:1646 */
break;
case 123:
-#line 1323 "awkgram.y" /* yacc.c:1646 */
+#line 1329 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3269 "awkgram.c" /* yacc.c:1646 */
+#line 3275 "awkgram.c" /* yacc.c:1646 */
break;
case 124:
-#line 1325 "awkgram.y" /* yacc.c:1646 */
+#line 1331 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3275 "awkgram.c" /* yacc.c:1646 */
+#line 3281 "awkgram.c" /* yacc.c:1646 */
break;
case 125:
-#line 1330 "awkgram.y" /* yacc.c:1646 */
+#line 1336 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3281 "awkgram.c" /* yacc.c:1646 */
+#line 3287 "awkgram.c" /* yacc.c:1646 */
break;
case 126:
-#line 1332 "awkgram.y" /* yacc.c:1646 */
+#line 1338 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3287 "awkgram.c" /* yacc.c:1646 */
+#line 3293 "awkgram.c" /* yacc.c:1646 */
break;
case 127:
-#line 1334 "awkgram.y" /* yacc.c:1646 */
+#line 1340 "awkgram.y" /* yacc.c:1646 */
{
int count = 2;
bool is_simple_var = false;
@@ -3334,47 +3340,47 @@ regular_print:
max_args = count;
}
}
-#line 3338 "awkgram.c" /* yacc.c:1646 */
+#line 3344 "awkgram.c" /* yacc.c:1646 */
break;
case 129:
-#line 1386 "awkgram.y" /* yacc.c:1646 */
+#line 1392 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3344 "awkgram.c" /* yacc.c:1646 */
+#line 3350 "awkgram.c" /* yacc.c:1646 */
break;
case 130:
-#line 1388 "awkgram.y" /* yacc.c:1646 */
+#line 1394 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3350 "awkgram.c" /* yacc.c:1646 */
+#line 3356 "awkgram.c" /* yacc.c:1646 */
break;
case 131:
-#line 1390 "awkgram.y" /* yacc.c:1646 */
+#line 1396 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3356 "awkgram.c" /* yacc.c:1646 */
+#line 3362 "awkgram.c" /* yacc.c:1646 */
break;
case 132:
-#line 1392 "awkgram.y" /* yacc.c:1646 */
+#line 1398 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3362 "awkgram.c" /* yacc.c:1646 */
+#line 3368 "awkgram.c" /* yacc.c:1646 */
break;
case 133:
-#line 1394 "awkgram.y" /* yacc.c:1646 */
+#line 1400 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3368 "awkgram.c" /* yacc.c:1646 */
+#line 3374 "awkgram.c" /* yacc.c:1646 */
break;
case 134:
-#line 1396 "awkgram.y" /* yacc.c:1646 */
+#line 1402 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3374 "awkgram.c" /* yacc.c:1646 */
+#line 3380 "awkgram.c" /* yacc.c:1646 */
break;
case 135:
-#line 1398 "awkgram.y" /* yacc.c:1646 */
+#line 1404 "awkgram.y" /* yacc.c:1646 */
{
/*
* In BEGINFILE/ENDFILE, allow `getline [var] < file'
@@ -3388,29 +3394,29 @@ regular_print:
_("non-redirected `getline' undefined inside
END action"));
(yyval) = mk_getline((yyvsp[-2]), (yyvsp[-1]), (yyvsp[0]),
redirect_input);
}
-#line 3392 "awkgram.c" /* yacc.c:1646 */
+#line 3398 "awkgram.c" /* yacc.c:1646 */
break;
case 136:
-#line 1412 "awkgram.y" /* yacc.c:1646 */
+#line 1418 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postincrement;
(yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
}
-#line 3401 "awkgram.c" /* yacc.c:1646 */
+#line 3407 "awkgram.c" /* yacc.c:1646 */
break;
case 137:
-#line 1417 "awkgram.y" /* yacc.c:1646 */
+#line 1423 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postdecrement;
(yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
}
-#line 3410 "awkgram.c" /* yacc.c:1646 */
+#line 3416 "awkgram.c" /* yacc.c:1646 */
break;
case 138:
-#line 1422 "awkgram.y" /* yacc.c:1646 */
+#line 1428 "awkgram.y" /* yacc.c:1646 */
{
if (do_lint_old) {
warning_ln((yyvsp[-1])->source_line,
@@ -3430,64 +3436,64 @@ regular_print:
(yyval) = list_append(list_merge(t, (yyvsp[0])),
(yyvsp[-1]));
}
}
-#line 3434 "awkgram.c" /* yacc.c:1646 */
+#line 3440 "awkgram.c" /* yacc.c:1646 */
break;
case 139:
-#line 1447 "awkgram.y" /* yacc.c:1646 */
+#line 1453 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_getline((yyvsp[-1]), (yyvsp[0]), (yyvsp[-3]),
(yyvsp[-2])->redir_type);
bcfree((yyvsp[-2]));
}
-#line 3443 "awkgram.c" /* yacc.c:1646 */
+#line 3449 "awkgram.c" /* yacc.c:1646 */
break;
case 140:
-#line 1453 "awkgram.y" /* yacc.c:1646 */
+#line 1459 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3449 "awkgram.c" /* yacc.c:1646 */
+#line 3455 "awkgram.c" /* yacc.c:1646 */
break;
case 141:
-#line 1455 "awkgram.y" /* yacc.c:1646 */
+#line 1461 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3455 "awkgram.c" /* yacc.c:1646 */
+#line 3461 "awkgram.c" /* yacc.c:1646 */
break;
case 142:
-#line 1457 "awkgram.y" /* yacc.c:1646 */
+#line 1463 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3461 "awkgram.c" /* yacc.c:1646 */
+#line 3467 "awkgram.c" /* yacc.c:1646 */
break;
case 143:
-#line 1459 "awkgram.y" /* yacc.c:1646 */
+#line 1465 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3467 "awkgram.c" /* yacc.c:1646 */
+#line 3473 "awkgram.c" /* yacc.c:1646 */
break;
case 144:
-#line 1461 "awkgram.y" /* yacc.c:1646 */
+#line 1467 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3473 "awkgram.c" /* yacc.c:1646 */
+#line 3479 "awkgram.c" /* yacc.c:1646 */
break;
case 145:
-#line 1463 "awkgram.y" /* yacc.c:1646 */
+#line 1469 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3479 "awkgram.c" /* yacc.c:1646 */
+#line 3485 "awkgram.c" /* yacc.c:1646 */
break;
case 146:
-#line 1468 "awkgram.y" /* yacc.c:1646 */
+#line 1474 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_create((yyvsp[0]));
}
-#line 3487 "awkgram.c" /* yacc.c:1646 */
+#line 3493 "awkgram.c" /* yacc.c:1646 */
break;
case 147:
-#line 1472 "awkgram.y" /* yacc.c:1646 */
+#line 1478 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0])->opcode == Op_match_rec) {
(yyvsp[0])->opcode = Op_nomatch;
@@ -3519,37 +3525,37 @@ regular_print:
}
}
}
-#line 3523 "awkgram.c" /* yacc.c:1646 */
+#line 3529 "awkgram.c" /* yacc.c:1646 */
break;
case 148:
-#line 1504 "awkgram.y" /* yacc.c:1646 */
+#line 1510 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3529 "awkgram.c" /* yacc.c:1646 */
+#line 3535 "awkgram.c" /* yacc.c:1646 */
break;
case 149:
-#line 1506 "awkgram.y" /* yacc.c:1646 */
+#line 1512 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = snode((yyvsp[-1]), (yyvsp[-3]));
if ((yyval) == NULL)
YYABORT;
}
-#line 3539 "awkgram.c" /* yacc.c:1646 */
+#line 3545 "awkgram.c" /* yacc.c:1646 */
break;
case 150:
-#line 1512 "awkgram.y" /* yacc.c:1646 */
+#line 1518 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = snode((yyvsp[-1]), (yyvsp[-3]));
if ((yyval) == NULL)
YYABORT;
}
-#line 3549 "awkgram.c" /* yacc.c:1646 */
+#line 3555 "awkgram.c" /* yacc.c:1646 */
break;
case 151:
-#line 1518 "awkgram.y" /* yacc.c:1646 */
+#line 1524 "awkgram.y" /* yacc.c:1646 */
{
static bool warned = false;
@@ -3562,45 +3568,45 @@ regular_print:
if ((yyval) == NULL)
YYABORT;
}
-#line 3566 "awkgram.c" /* yacc.c:1646 */
+#line 3572 "awkgram.c" /* yacc.c:1646 */
break;
case 154:
-#line 1533 "awkgram.y" /* yacc.c:1646 */
+#line 1539 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[-1])->opcode = Op_preincrement;
(yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1]));
}
-#line 3575 "awkgram.c" /* yacc.c:1646 */
+#line 3581 "awkgram.c" /* yacc.c:1646 */
break;
case 155:
-#line 1538 "awkgram.y" /* yacc.c:1646 */
+#line 1544 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[-1])->opcode = Op_predecrement;
(yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1]));
}
-#line 3584 "awkgram.c" /* yacc.c:1646 */
+#line 3590 "awkgram.c" /* yacc.c:1646 */
break;
case 156:
-#line 1543 "awkgram.y" /* yacc.c:1646 */
+#line 1549 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_create((yyvsp[0]));
}
-#line 3592 "awkgram.c" /* yacc.c:1646 */
+#line 3598 "awkgram.c" /* yacc.c:1646 */
break;
case 157:
-#line 1547 "awkgram.y" /* yacc.c:1646 */
+#line 1553 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_create((yyvsp[0]));
}
-#line 3600 "awkgram.c" /* yacc.c:1646 */
+#line 3606 "awkgram.c" /* yacc.c:1646 */
break;
case 158:
-#line 1551 "awkgram.y" /* yacc.c:1646 */
+#line 1557 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0])->lasti->opcode == Op_push_i
&& ((yyvsp[0])->lasti->memory->flags & (STRCUR|STRING))
== 0
@@ -3615,11 +3621,11 @@ regular_print:
(yyval) = list_append((yyvsp[0]), (yyvsp[-1]));
}
}
-#line 3619 "awkgram.c" /* yacc.c:1646 */
+#line 3625 "awkgram.c" /* yacc.c:1646 */
break;
case 159:
-#line 1566 "awkgram.y" /* yacc.c:1646 */
+#line 1572 "awkgram.y" /* yacc.c:1646 */
{
/*
* was: $$ = $2
@@ -3629,20 +3635,20 @@ regular_print:
(yyvsp[-1])->memory = make_number(0.0);
(yyval) = list_append((yyvsp[0]), (yyvsp[-1]));
}
-#line 3633 "awkgram.c" /* yacc.c:1646 */
+#line 3639 "awkgram.c" /* yacc.c:1646 */
break;
case 160:
-#line 1579 "awkgram.y" /* yacc.c:1646 */
+#line 1585 "awkgram.y" /* yacc.c:1646 */
{
func_use((yyvsp[0])->lasti->func_name, FUNC_USE);
(yyval) = (yyvsp[0]);
}
-#line 3642 "awkgram.c" /* yacc.c:1646 */
+#line 3648 "awkgram.c" /* yacc.c:1646 */
break;
case 161:
-#line 1584 "awkgram.y" /* yacc.c:1646 */
+#line 1590 "awkgram.y" /* yacc.c:1646 */
{
/* indirect function call */
INSTRUCTION *f, *t;
@@ -3674,13 +3680,25 @@ regular_print:
*/
(yyval) = list_prepend((yyvsp[0]), t);
+ at_seen = false;
}
-#line 3679 "awkgram.c" /* yacc.c:1646 */
+#line 3686 "awkgram.c" /* yacc.c:1646 */
break;
case 162:
-#line 1620 "awkgram.y" /* yacc.c:1646 */
+#line 1627 "awkgram.y" /* yacc.c:1646 */
{
+ NODE *n;
+
+ if (! at_seen) {
+ n = lookup((yyvsp[-3])->func_name);
+ if (n != NULL && n->type != Node_func
+ && n->type != Node_ext_func && n->type !=
Node_old_ext_func) {
+ error_ln((yyvsp[-3])->source_line,
+ _("attempt to use non-function `%s' in
function call"),
+ (yyvsp[-3])->func_name);
+ }
+ }
param_sanity((yyvsp[-1]));
(yyvsp[-3])->opcode = Op_func_call;
(yyvsp[-3])->func_body = NULL;
@@ -3693,49 +3711,49 @@ regular_print:
(yyval) = list_append(t, (yyvsp[-3]));
}
}
-#line 3697 "awkgram.c" /* yacc.c:1646 */
+#line 3715 "awkgram.c" /* yacc.c:1646 */
break;
case 163:
-#line 1637 "awkgram.y" /* yacc.c:1646 */
+#line 1655 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3703 "awkgram.c" /* yacc.c:1646 */
+#line 3721 "awkgram.c" /* yacc.c:1646 */
break;
case 164:
-#line 1639 "awkgram.y" /* yacc.c:1646 */
+#line 1657 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3709 "awkgram.c" /* yacc.c:1646 */
+#line 3727 "awkgram.c" /* yacc.c:1646 */
break;
case 165:
-#line 1644 "awkgram.y" /* yacc.c:1646 */
+#line 1662 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3715 "awkgram.c" /* yacc.c:1646 */
+#line 3733 "awkgram.c" /* yacc.c:1646 */
break;
case 166:
-#line 1646 "awkgram.y" /* yacc.c:1646 */
+#line 1664 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3721 "awkgram.c" /* yacc.c:1646 */
+#line 3739 "awkgram.c" /* yacc.c:1646 */
break;
case 167:
-#line 1651 "awkgram.y" /* yacc.c:1646 */
+#line 1669 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3727 "awkgram.c" /* yacc.c:1646 */
+#line 3745 "awkgram.c" /* yacc.c:1646 */
break;
case 168:
-#line 1653 "awkgram.y" /* yacc.c:1646 */
+#line 1671 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
}
-#line 3735 "awkgram.c" /* yacc.c:1646 */
+#line 3753 "awkgram.c" /* yacc.c:1646 */
break;
case 169:
-#line 1660 "awkgram.y" /* yacc.c:1646 */
+#line 1678 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip = (yyvsp[0])->lasti;
int count = ip->sub_count; /* # of SUBSEP-seperated
expressions */
@@ -3749,11 +3767,11 @@ regular_print:
sub_counter++; /* count # of dimensions */
(yyval) = (yyvsp[0]);
}
-#line 3753 "awkgram.c" /* yacc.c:1646 */
+#line 3771 "awkgram.c" /* yacc.c:1646 */
break;
case 170:
-#line 1677 "awkgram.y" /* yacc.c:1646 */
+#line 1695 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *t = (yyvsp[-1]);
if ((yyvsp[-1]) == NULL) {
@@ -3767,31 +3785,31 @@ regular_print:
(yyvsp[0])->sub_count = count_expressions(&t, false);
(yyval) = list_append(t, (yyvsp[0]));
}
-#line 3771 "awkgram.c" /* yacc.c:1646 */
+#line 3789 "awkgram.c" /* yacc.c:1646 */
break;
case 171:
-#line 1694 "awkgram.y" /* yacc.c:1646 */
+#line 1712 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3777 "awkgram.c" /* yacc.c:1646 */
+#line 3795 "awkgram.c" /* yacc.c:1646 */
break;
case 172:
-#line 1696 "awkgram.y" /* yacc.c:1646 */
+#line 1714 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
}
-#line 3785 "awkgram.c" /* yacc.c:1646 */
+#line 3803 "awkgram.c" /* yacc.c:1646 */
break;
case 173:
-#line 1703 "awkgram.y" /* yacc.c:1646 */
+#line 1721 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3791 "awkgram.c" /* yacc.c:1646 */
+#line 3809 "awkgram.c" /* yacc.c:1646 */
break;
case 174:
-#line 1708 "awkgram.y" /* yacc.c:1646 */
+#line 1726 "awkgram.y" /* yacc.c:1646 */
{
char *var_name = (yyvsp[0])->lextok;
@@ -3799,22 +3817,22 @@ regular_print:
(yyvsp[0])->memory = variable((yyvsp[0])->source_line,
var_name, Node_var_new);
(yyval) = list_create((yyvsp[0]));
}
-#line 3803 "awkgram.c" /* yacc.c:1646 */
+#line 3821 "awkgram.c" /* yacc.c:1646 */
break;
case 175:
-#line 1716 "awkgram.y" /* yacc.c:1646 */
+#line 1734 "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 3814 "awkgram.c" /* yacc.c:1646 */
+#line 3832 "awkgram.c" /* yacc.c:1646 */
break;
case 176:
-#line 1726 "awkgram.y" /* yacc.c:1646 */
+#line 1744 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip = (yyvsp[0])->nexti;
if (ip->opcode == Op_push
@@ -3826,73 +3844,73 @@ regular_print:
} else
(yyval) = (yyvsp[0]);
}
-#line 3830 "awkgram.c" /* yacc.c:1646 */
+#line 3848 "awkgram.c" /* yacc.c:1646 */
break;
case 177:
-#line 1738 "awkgram.y" /* yacc.c:1646 */
+#line 1756 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_append((yyvsp[-1]), (yyvsp[-2]));
if ((yyvsp[0]) != NULL)
mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
}
-#line 3840 "awkgram.c" /* yacc.c:1646 */
+#line 3858 "awkgram.c" /* yacc.c:1646 */
break;
case 178:
-#line 1747 "awkgram.y" /* yacc.c:1646 */
+#line 1765 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postincrement;
}
-#line 3848 "awkgram.c" /* yacc.c:1646 */
+#line 3866 "awkgram.c" /* yacc.c:1646 */
break;
case 179:
-#line 1751 "awkgram.y" /* yacc.c:1646 */
+#line 1769 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postdecrement;
}
-#line 3856 "awkgram.c" /* yacc.c:1646 */
+#line 3874 "awkgram.c" /* yacc.c:1646 */
break;
case 180:
-#line 1754 "awkgram.y" /* yacc.c:1646 */
+#line 1772 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3862 "awkgram.c" /* yacc.c:1646 */
+#line 3880 "awkgram.c" /* yacc.c:1646 */
break;
case 182:
-#line 1762 "awkgram.y" /* yacc.c:1646 */
+#line 1780 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 3868 "awkgram.c" /* yacc.c:1646 */
+#line 3886 "awkgram.c" /* yacc.c:1646 */
break;
case 183:
-#line 1766 "awkgram.y" /* yacc.c:1646 */
+#line 1784 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 3874 "awkgram.c" /* yacc.c:1646 */
+#line 3892 "awkgram.c" /* yacc.c:1646 */
break;
case 186:
-#line 1775 "awkgram.y" /* yacc.c:1646 */
+#line 1793 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 3880 "awkgram.c" /* yacc.c:1646 */
+#line 3898 "awkgram.c" /* yacc.c:1646 */
break;
case 187:
-#line 1779 "awkgram.y" /* yacc.c:1646 */
+#line 1797 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); yyerrok; }
-#line 3886 "awkgram.c" /* yacc.c:1646 */
+#line 3904 "awkgram.c" /* yacc.c:1646 */
break;
case 188:
-#line 1783 "awkgram.y" /* yacc.c:1646 */
+#line 1801 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 3892 "awkgram.c" /* yacc.c:1646 */
+#line 3910 "awkgram.c" /* yacc.c:1646 */
break;
-#line 3896 "awkgram.c" /* yacc.c:1646 */
+#line 3914 "awkgram.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -4120,7 +4138,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 1785 "awkgram.y" /* yacc.c:1906 */
+#line 1803 "awkgram.y" /* yacc.c:1906 */
struct token {
@@ -4643,6 +4661,9 @@ parse_program(INSTRUCTION **pcode)
if (ret == 0) /* avoid spurious warning if parser aborted with
YYABORT */
check_funcs();
+ if (! check_param_names())
+ errcount++;
+
if (args_array == NULL)
emalloc(args_array, NODE **, (max_args + 2) * sizeof(NODE *),
"parse_program");
else
@@ -5453,6 +5474,7 @@ retry:
return lasttok = NEWLINE;
case '@':
+ at_seen = true;
return lasttok = '@';
case '\\':
diff --git a/awkgram.y b/awkgram.y
index 7b2e2a6..55615c1 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -85,6 +85,7 @@ static void check_funcs(void);
static ssize_t read_one_line(int fd, void *buffer, size_t count);
static int one_line_close(int fd);
+static bool at_seen = false;
static bool want_source = false;
static bool want_regexp = false; /* lexical scanning kludge */
static char *in_function; /* parsing kludge */
@@ -239,11 +240,13 @@ rule
| '@' LEX_INCLUDE source statement_term
{
want_source = false;
+ at_seen = false;
yyerrok;
}
| '@' LEX_LOAD library statement_term
{
want_source = false;
+ at_seen = false;
yyerrok;
}
;
@@ -367,7 +370,10 @@ func_name
YYABORT;
}
| '@' LEX_EVAL
- { $$ = $2; }
+ {
+ $$ = $2;
+ at_seen = false;
+ }
;
lex_builtin
@@ -1612,12 +1618,24 @@ func_call
*/
$$ = list_prepend($2, t);
+ at_seen = false;
}
;
direct_func_call
: FUNC_CALL '(' opt_expression_list r_paren
{
+ NODE *n;
+
+ if (! at_seen) {
+ n = lookup($1->func_name);
+ if (n != NULL && n->type != Node_func
+ && n->type != Node_ext_func && n->type !=
Node_old_ext_func) {
+ error_ln($1->source_line,
+ _("attempt to use non-function `%s' in
function call"),
+ $1->func_name);
+ }
+ }
param_sanity($3);
$1->opcode = Op_func_call;
$1->func_body = NULL;
@@ -2304,6 +2322,9 @@ parse_program(INSTRUCTION **pcode)
if (ret == 0) /* avoid spurious warning if parser aborted with
YYABORT */
check_funcs();
+ if (! check_param_names())
+ errcount++;
+
if (args_array == NULL)
emalloc(args_array, NODE **, (max_args + 2) * sizeof(NODE *),
"parse_program");
else
@@ -3114,6 +3135,7 @@ retry:
return lasttok = NEWLINE;
case '@':
+ at_seen = true;
return lasttok = '@';
case '\\':
diff --git a/doc/ChangeLog b/doc/ChangeLog
index ecf05de..61caac6 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-30 Arnold D. Robbins <address@hidden>
+
+ * gawktexi.in: Document POSIX requirement that function parameters
+ cannot have the same name as a function. Fix indirectcall example.
+
2015-01-27 Arnold D. Robbins <address@hidden>
* gawktexi.in: O'Reilly fixes.
diff --git a/doc/gawk.info b/doc/gawk.info
index 6a107df..4e975b1 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -13459,11 +13459,13 @@ the argument names are used to hold the argument
values given in the
call.
A function cannot have two parameters with the same name, nor may it
-have a parameter with the same name as the function itself. In
-addition, according to the POSIX standard, function parameters cannot
-have the same name as one of the special predefined variables (*note
-Built-in Variables::). Not all versions of `awk' enforce this
-restriction.
+have a parameter with the same name as the function itself.
+
+ CAUTION: According to the POSIX standard, function parameters
+ cannot have the same name as one of the special predefined
+ variables (*note Built-in Variables::), nor may a function
+ parameter have the same name as another function. Not all
+ versions of `awk' enforce these restrictions.
Local variables act like the empty string if referenced where a
string value is required, and like zero if referenced where a numeric
@@ -14065,13 +14067,13 @@ using indirect function calls:
# average --- return the average of the values in fields $first - $last
- function average(first, last, sum, i)
+ function average(first, last, the_sum, i)
{
- sum = 0;
+ the_sum = 0;
for (i = first; i <= last; i++)
- sum += $i
+ the_sum += $i
- return sum / (last - first + 1)
+ return the_sum / (last - first + 1)
}
# sum --- return the sum of the values in fields $first - $last
@@ -32157,7 +32159,7 @@ Index
* common extensions, \x escape sequence: Escape Sequences. (line 61)
* common extensions, BINMODE variable: PC Using. (line 33)
* common extensions, delete to delete entire arrays: Delete. (line 39)
-* common extensions, func keyword: Definition Syntax. (line 93)
+* common extensions, func keyword: Definition Syntax. (line 95)
* common extensions, length() applied to an array: String Functions.
(line 201)
* common extensions, RS as a regexp: gawk split records. (line 6)
@@ -32678,7 +32680,7 @@ Index
* extensions, common, BINMODE variable: PC Using. (line 33)
* extensions, common, delete to delete entire arrays: Delete. (line 39)
* extensions, common, fflush() function: I/O Functions. (line 43)
-* extensions, common, func keyword: Definition Syntax. (line 93)
+* extensions, common, func keyword: Definition Syntax. (line 95)
* extensions, common, length() applied to an array: String Functions.
(line 201)
* extensions, common, RS as a regexp: gawk split records. (line 6)
@@ -32895,7 +32897,7 @@ Index
* functions, library, user database, reading: Passwd Functions.
(line 6)
* functions, names of: Definition Syntax. (line 23)
-* functions, recursive: Definition Syntax. (line 83)
+* functions, recursive: Definition Syntax. (line 85)
* functions, string-translation: I18N Functions. (line 6)
* functions, undefined: Pass By Value/Reference.
(line 68)
@@ -33616,7 +33618,7 @@ Index
(line 65)
* portability, deleting array elements: Delete. (line 56)
* portability, example programs: Library Functions. (line 42)
-* portability, functions, defining: Definition Syntax. (line 109)
+* portability, functions, defining: Definition Syntax. (line 111)
* portability, gawk: New Ports. (line 6)
* portability, gettext library and: Explaining gettext. (line 11)
* portability, internationalization and: I18N Portability. (line 6)
@@ -33661,7 +33663,7 @@ Index
* POSIX awk, field separators and <1>: Full Line Fields. (line 16)
* POSIX awk, field separators and: Fields. (line 6)
* POSIX awk, FS variable and: User-modified. (line 60)
-* POSIX awk, function keyword in: Definition Syntax. (line 93)
+* POSIX awk, function keyword in: Definition Syntax. (line 95)
* POSIX awk, functions and, gsub()/sub(): Gory Details. (line 90)
* POSIX awk, functions and, length(): String Functions. (line 180)
* POSIX awk, GNU long options and: Options. (line 15)
@@ -33754,7 +33756,7 @@ Index
* programming conventions, functions, calling: Calling Built-in.
(line 10)
* programming conventions, functions, writing: Definition Syntax.
- (line 65)
+ (line 67)
* programming conventions, gawk extensions: Internal File Ops.
(line 45)
* programming conventions, private variable names: Library Names.
@@ -33823,7 +33825,7 @@ Index
* records, splitting input into: Records. (line 6)
* records, terminating: awk split records. (line 125)
* records, treating files as: gawk split records. (line 93)
-* recursive functions: Definition Syntax. (line 83)
+* recursive functions: Definition Syntax. (line 85)
* redirect gawk output, in debugger: Debugger Info. (line 72)
* redirection of input: Getline/File. (line 6)
* redirection of output: Redirection. (line 6)
@@ -33992,7 +33994,7 @@ Index
* set directory of message catalogs: I18N Functions. (line 12)
* set watchpoint: Viewing And Changing Data.
(line 67)
-* shadowing of variable values: Definition Syntax. (line 71)
+* shadowing of variable values: Definition Syntax. (line 73)
* shell quoting, rules for: Quoting. (line 6)
* shells, piping commands into: Redirection. (line 136)
* shells, quoting: Using Shell Variables.
@@ -34366,7 +34368,7 @@ Index
* variables, predefined conveying information: Auto-set. (line 6)
* variables, private: Library Names. (line 11)
* variables, setting: Options. (line 32)
-* variables, shadowing: Definition Syntax. (line 71)
+* variables, shadowing: Definition Syntax. (line 73)
* variables, types of: Assignment Ops. (line 40)
* variables, types of, comparison expressions and: Typing and Comparison.
(line 9)
@@ -34723,302 +34725,302 @@ Node: Type Functions562811
Node: I18N Functions563962
Node: User-defined565607
Node: Definition Syntax566412
-Ref: Definition Syntax-Footnote-1571819
-Node: Function Example571890
-Ref: Function Example-Footnote-1574809
-Node: Function Caveats574831
-Node: Calling A Function575349
-Node: Variable Scope576307
-Node: Pass By Value/Reference579295
-Node: Return Statement582790
-Node: Dynamic Typing585771
-Node: Indirect Calls586700
-Ref: Indirect Calls-Footnote-1598002
-Node: Functions Summary598130
-Node: Library Functions600832
-Ref: Library Functions-Footnote-1604441
-Ref: Library Functions-Footnote-2604584
-Node: Library Names604755
-Ref: Library Names-Footnote-1608209
-Ref: Library Names-Footnote-2608432
-Node: General Functions608518
-Node: Strtonum Function609621
-Node: Assert Function612643
-Node: Round Function615967
-Node: Cliff Random Function617508
-Node: Ordinal Functions618524
-Ref: Ordinal Functions-Footnote-1621587
-Ref: Ordinal Functions-Footnote-2621839
-Node: Join Function622050
-Ref: Join Function-Footnote-1623819
-Node: Getlocaltime Function624019
-Node: Readfile Function627763
-Node: Shell Quoting629733
-Node: Data File Management631134
-Node: Filetrans Function631766
-Node: Rewind Function635822
-Node: File Checking637209
-Ref: File Checking-Footnote-1638541
-Node: Empty Files638742
-Node: Ignoring Assigns640721
-Node: Getopt Function642272
-Ref: Getopt Function-Footnote-1653734
-Node: Passwd Functions653934
-Ref: Passwd Functions-Footnote-1662771
-Node: Group Functions662859
-Ref: Group Functions-Footnote-1670753
-Node: Walking Arrays670966
-Node: Library Functions Summary672569
-Node: Library Exercises673970
-Node: Sample Programs675250
-Node: Running Examples676020
-Node: Clones676748
-Node: Cut Program677972
-Node: Egrep Program687691
-Ref: Egrep Program-Footnote-1695189
-Node: Id Program695299
-Node: Split Program698944
-Ref: Split Program-Footnote-1702392
-Node: Tee Program702520
-Node: Uniq Program705309
-Node: Wc Program712728
-Ref: Wc Program-Footnote-1716978
-Node: Miscellaneous Programs717072
-Node: Dupword Program718285
-Node: Alarm Program720316
-Node: Translate Program725120
-Ref: Translate Program-Footnote-1729685
-Node: Labels Program729955
-Ref: Labels Program-Footnote-1733306
-Node: Word Sorting733390
-Node: History Sorting737461
-Node: Extract Program739297
-Node: Simple Sed746822
-Node: Igawk Program749890
-Ref: Igawk Program-Footnote-1764214
-Ref: Igawk Program-Footnote-2764415
-Ref: Igawk Program-Footnote-3764537
-Node: Anagram Program764652
-Node: Signature Program767709
-Node: Programs Summary768956
-Node: Programs Exercises770149
-Ref: Programs Exercises-Footnote-1774280
-Node: Advanced Features774371
-Node: Nondecimal Data776319
-Node: Array Sorting777909
-Node: Controlling Array Traversal778606
-Ref: Controlling Array Traversal-Footnote-1786939
-Node: Array Sorting Functions787057
-Ref: Array Sorting Functions-Footnote-1790946
-Node: Two-way I/O791142
-Ref: Two-way I/O-Footnote-1796087
-Ref: Two-way I/O-Footnote-2796273
-Node: TCP/IP Networking796355
-Node: Profiling799228
-Node: Advanced Features Summary806775
-Node: Internationalization808708
-Node: I18N and L10N810188
-Node: Explaining gettext810874
-Ref: Explaining gettext-Footnote-1815899
-Ref: Explaining gettext-Footnote-2816083
-Node: Programmer i18n816248
-Ref: Programmer i18n-Footnote-1821114
-Node: Translator i18n821163
-Node: String Extraction821957
-Ref: String Extraction-Footnote-1823088
-Node: Printf Ordering823174
-Ref: Printf Ordering-Footnote-1825960
-Node: I18N Portability826024
-Ref: I18N Portability-Footnote-1828479
-Node: I18N Example828542
-Ref: I18N Example-Footnote-1831345
-Node: Gawk I18N831417
-Node: I18N Summary832055
-Node: Debugger833394
-Node: Debugging834416
-Node: Debugging Concepts834857
-Node: Debugging Terms836710
-Node: Awk Debugging839282
-Node: Sample Debugging Session840176
-Node: Debugger Invocation840696
-Node: Finding The Bug842080
-Node: List of Debugger Commands848555
-Node: Breakpoint Control849888
-Node: Debugger Execution Control853584
-Node: Viewing And Changing Data856948
-Node: Execution Stack860326
-Node: Debugger Info861963
-Node: Miscellaneous Debugger Commands865980
-Node: Readline Support871009
-Node: Limitations871901
-Node: Debugging Summary874015
-Node: Arbitrary Precision Arithmetic875183
-Node: Computer Arithmetic876599
-Ref: table-numeric-ranges880197
-Ref: Computer Arithmetic-Footnote-1881056
-Node: Math Definitions881113
-Ref: table-ieee-formats884401
-Ref: Math Definitions-Footnote-1885005
-Node: MPFR features885110
-Node: FP Math Caution886781
-Ref: FP Math Caution-Footnote-1887831
-Node: Inexactness of computations888200
-Node: Inexact representation889159
-Node: Comparing FP Values890516
-Node: Errors accumulate891598
-Node: Getting Accuracy893031
-Node: Try To Round895693
-Node: Setting precision896592
-Ref: table-predefined-precision-strings897276
-Node: Setting the rounding mode899065
-Ref: table-gawk-rounding-modes899429
-Ref: Setting the rounding mode-Footnote-1902884
-Node: Arbitrary Precision Integers903063
-Ref: Arbitrary Precision Integers-Footnote-1906049
-Node: POSIX Floating Point Problems906198
-Ref: POSIX Floating Point Problems-Footnote-1910071
-Node: Floating point summary910109
-Node: Dynamic Extensions912303
-Node: Extension Intro913855
-Node: Plugin License915121
-Node: Extension Mechanism Outline915918
-Ref: figure-load-extension916346
-Ref: figure-register-new-function917826
-Ref: figure-call-new-function918830
-Node: Extension API Description920816
-Node: Extension API Functions Introduction922266
-Node: General Data Types927090
-Ref: General Data Types-Footnote-1932829
-Node: Memory Allocation Functions933128
-Ref: Memory Allocation Functions-Footnote-1935967
-Node: Constructor Functions936063
-Node: Registration Functions937797
-Node: Extension Functions938482
-Node: Exit Callback Functions940779
-Node: Extension Version String942027
-Node: Input Parsers942692
-Node: Output Wrappers952571
-Node: Two-way processors957086
-Node: Printing Messages959290
-Ref: Printing Messages-Footnote-1960366
-Node: Updating `ERRNO'960518
-Node: Requesting Values961258
-Ref: table-value-types-returned961986
-Node: Accessing Parameters962943
-Node: Symbol Table Access964174
-Node: Symbol table by name964688
-Node: Symbol table by cookie966669
-Ref: Symbol table by cookie-Footnote-1970813
-Node: Cached values970876
-Ref: Cached values-Footnote-1974375
-Node: Array Manipulation974466
-Ref: Array Manipulation-Footnote-1975564
-Node: Array Data Types975601
-Ref: Array Data Types-Footnote-1978256
-Node: Array Functions978348
-Node: Flattening Arrays982202
-Node: Creating Arrays989094
-Node: Extension API Variables993865
-Node: Extension Versioning994501
-Node: Extension API Informational Variables996402
-Node: Extension API Boilerplate997467
-Node: Finding Extensions1001276
-Node: Extension Example1001836
-Node: Internal File Description1002608
-Node: Internal File Ops1006675
-Ref: Internal File Ops-Footnote-11018345
-Node: Using Internal File Ops1018485
-Ref: Using Internal File Ops-Footnote-11020868
-Node: Extension Samples1021141
-Node: Extension Sample File Functions1022667
-Node: Extension Sample Fnmatch1030305
-Node: Extension Sample Fork1031796
-Node: Extension Sample Inplace1033011
-Node: Extension Sample Ord1034686
-Node: Extension Sample Readdir1035522
-Ref: table-readdir-file-types1036398
-Node: Extension Sample Revout1037209
-Node: Extension Sample Rev2way1037799
-Node: Extension Sample Read write array1038539
-Node: Extension Sample Readfile1040479
-Node: Extension Sample Time1041574
-Node: Extension Sample API Tests1042923
-Node: gawkextlib1043414
-Node: Extension summary1046072
-Node: Extension Exercises1049761
-Node: Language History1050483
-Node: V7/SVR3.11052139
-Node: SVR41054320
-Node: POSIX1055765
-Node: BTL1057154
-Node: POSIX/GNU1057888
-Node: Feature History1063452
-Node: Common Extensions1076550
-Node: Ranges and Locales1077874
-Ref: Ranges and Locales-Footnote-11082492
-Ref: Ranges and Locales-Footnote-21082519
-Ref: Ranges and Locales-Footnote-31082753
-Node: Contributors1082974
-Node: History summary1088515
-Node: Installation1089885
-Node: Gawk Distribution1090831
-Node: Getting1091315
-Node: Extracting1092138
-Node: Distribution contents1093773
-Node: Unix Installation1099490
-Node: Quick Installation1100107
-Node: Additional Configuration Options1102531
-Node: Configuration Philosophy1104269
-Node: Non-Unix Installation1106638
-Node: PC Installation1107096
-Node: PC Binary Installation1108415
-Node: PC Compiling1110263
-Ref: PC Compiling-Footnote-11113284
-Node: PC Testing1113393
-Node: PC Using1114569
-Node: Cygwin1118684
-Node: MSYS1119507
-Node: VMS Installation1120007
-Node: VMS Compilation1120799
-Ref: VMS Compilation-Footnote-11122021
-Node: VMS Dynamic Extensions1122079
-Node: VMS Installation Details1123763
-Node: VMS Running1126015
-Node: VMS GNV1128851
-Node: VMS Old Gawk1129585
-Node: Bugs1130055
-Node: Other Versions1133938
-Node: Installation summary1140362
-Node: Notes1141418
-Node: Compatibility Mode1142283
-Node: Additions1143065
-Node: Accessing The Source1143990
-Node: Adding Code1145425
-Node: New Ports1151582
-Node: Derived Files1156064
-Ref: Derived Files-Footnote-11161539
-Ref: Derived Files-Footnote-21161573
-Ref: Derived Files-Footnote-31162169
-Node: Future Extensions1162283
-Node: Implementation Limitations1162889
-Node: Extension Design1164137
-Node: Old Extension Problems1165291
-Ref: Old Extension Problems-Footnote-11166808
-Node: Extension New Mechanism Goals1166865
-Ref: Extension New Mechanism Goals-Footnote-11170225
-Node: Extension Other Design Decisions1170414
-Node: Extension Future Growth1172522
-Node: Old Extension Mechanism1173358
-Node: Notes summary1175120
-Node: Basic Concepts1176306
-Node: Basic High Level1176987
-Ref: figure-general-flow1177259
-Ref: figure-process-flow1177858
-Ref: Basic High Level-Footnote-11181087
-Node: Basic Data Typing1181272
-Node: Glossary1184600
-Node: Copying1216529
-Node: GNU Free Documentation License1254085
-Node: Index1279221
+Ref: Definition Syntax-Footnote-1571911
+Node: Function Example571982
+Ref: Function Example-Footnote-1574901
+Node: Function Caveats574923
+Node: Calling A Function575441
+Node: Variable Scope576399
+Node: Pass By Value/Reference579387
+Node: Return Statement582882
+Node: Dynamic Typing585863
+Node: Indirect Calls586792
+Ref: Indirect Calls-Footnote-1598110
+Node: Functions Summary598238
+Node: Library Functions600940
+Ref: Library Functions-Footnote-1604549
+Ref: Library Functions-Footnote-2604692
+Node: Library Names604863
+Ref: Library Names-Footnote-1608317
+Ref: Library Names-Footnote-2608540
+Node: General Functions608626
+Node: Strtonum Function609729
+Node: Assert Function612751
+Node: Round Function616075
+Node: Cliff Random Function617616
+Node: Ordinal Functions618632
+Ref: Ordinal Functions-Footnote-1621695
+Ref: Ordinal Functions-Footnote-2621947
+Node: Join Function622158
+Ref: Join Function-Footnote-1623927
+Node: Getlocaltime Function624127
+Node: Readfile Function627871
+Node: Shell Quoting629841
+Node: Data File Management631242
+Node: Filetrans Function631874
+Node: Rewind Function635930
+Node: File Checking637317
+Ref: File Checking-Footnote-1638649
+Node: Empty Files638850
+Node: Ignoring Assigns640829
+Node: Getopt Function642380
+Ref: Getopt Function-Footnote-1653842
+Node: Passwd Functions654042
+Ref: Passwd Functions-Footnote-1662879
+Node: Group Functions662967
+Ref: Group Functions-Footnote-1670861
+Node: Walking Arrays671074
+Node: Library Functions Summary672677
+Node: Library Exercises674078
+Node: Sample Programs675358
+Node: Running Examples676128
+Node: Clones676856
+Node: Cut Program678080
+Node: Egrep Program687799
+Ref: Egrep Program-Footnote-1695297
+Node: Id Program695407
+Node: Split Program699052
+Ref: Split Program-Footnote-1702500
+Node: Tee Program702628
+Node: Uniq Program705417
+Node: Wc Program712836
+Ref: Wc Program-Footnote-1717086
+Node: Miscellaneous Programs717180
+Node: Dupword Program718393
+Node: Alarm Program720424
+Node: Translate Program725228
+Ref: Translate Program-Footnote-1729793
+Node: Labels Program730063
+Ref: Labels Program-Footnote-1733414
+Node: Word Sorting733498
+Node: History Sorting737569
+Node: Extract Program739405
+Node: Simple Sed746930
+Node: Igawk Program749998
+Ref: Igawk Program-Footnote-1764322
+Ref: Igawk Program-Footnote-2764523
+Ref: Igawk Program-Footnote-3764645
+Node: Anagram Program764760
+Node: Signature Program767817
+Node: Programs Summary769064
+Node: Programs Exercises770257
+Ref: Programs Exercises-Footnote-1774388
+Node: Advanced Features774479
+Node: Nondecimal Data776427
+Node: Array Sorting778017
+Node: Controlling Array Traversal778714
+Ref: Controlling Array Traversal-Footnote-1787047
+Node: Array Sorting Functions787165
+Ref: Array Sorting Functions-Footnote-1791054
+Node: Two-way I/O791250
+Ref: Two-way I/O-Footnote-1796195
+Ref: Two-way I/O-Footnote-2796381
+Node: TCP/IP Networking796463
+Node: Profiling799336
+Node: Advanced Features Summary806883
+Node: Internationalization808816
+Node: I18N and L10N810296
+Node: Explaining gettext810982
+Ref: Explaining gettext-Footnote-1816007
+Ref: Explaining gettext-Footnote-2816191
+Node: Programmer i18n816356
+Ref: Programmer i18n-Footnote-1821222
+Node: Translator i18n821271
+Node: String Extraction822065
+Ref: String Extraction-Footnote-1823196
+Node: Printf Ordering823282
+Ref: Printf Ordering-Footnote-1826068
+Node: I18N Portability826132
+Ref: I18N Portability-Footnote-1828587
+Node: I18N Example828650
+Ref: I18N Example-Footnote-1831453
+Node: Gawk I18N831525
+Node: I18N Summary832163
+Node: Debugger833502
+Node: Debugging834524
+Node: Debugging Concepts834965
+Node: Debugging Terms836818
+Node: Awk Debugging839390
+Node: Sample Debugging Session840284
+Node: Debugger Invocation840804
+Node: Finding The Bug842188
+Node: List of Debugger Commands848663
+Node: Breakpoint Control849996
+Node: Debugger Execution Control853692
+Node: Viewing And Changing Data857056
+Node: Execution Stack860434
+Node: Debugger Info862071
+Node: Miscellaneous Debugger Commands866088
+Node: Readline Support871117
+Node: Limitations872009
+Node: Debugging Summary874123
+Node: Arbitrary Precision Arithmetic875291
+Node: Computer Arithmetic876707
+Ref: table-numeric-ranges880305
+Ref: Computer Arithmetic-Footnote-1881164
+Node: Math Definitions881221
+Ref: table-ieee-formats884509
+Ref: Math Definitions-Footnote-1885113
+Node: MPFR features885218
+Node: FP Math Caution886889
+Ref: FP Math Caution-Footnote-1887939
+Node: Inexactness of computations888308
+Node: Inexact representation889267
+Node: Comparing FP Values890624
+Node: Errors accumulate891706
+Node: Getting Accuracy893139
+Node: Try To Round895801
+Node: Setting precision896700
+Ref: table-predefined-precision-strings897384
+Node: Setting the rounding mode899173
+Ref: table-gawk-rounding-modes899537
+Ref: Setting the rounding mode-Footnote-1902992
+Node: Arbitrary Precision Integers903171
+Ref: Arbitrary Precision Integers-Footnote-1906157
+Node: POSIX Floating Point Problems906306
+Ref: POSIX Floating Point Problems-Footnote-1910179
+Node: Floating point summary910217
+Node: Dynamic Extensions912411
+Node: Extension Intro913963
+Node: Plugin License915229
+Node: Extension Mechanism Outline916026
+Ref: figure-load-extension916454
+Ref: figure-register-new-function917934
+Ref: figure-call-new-function918938
+Node: Extension API Description920924
+Node: Extension API Functions Introduction922374
+Node: General Data Types927198
+Ref: General Data Types-Footnote-1932937
+Node: Memory Allocation Functions933236
+Ref: Memory Allocation Functions-Footnote-1936075
+Node: Constructor Functions936171
+Node: Registration Functions937905
+Node: Extension Functions938590
+Node: Exit Callback Functions940887
+Node: Extension Version String942135
+Node: Input Parsers942800
+Node: Output Wrappers952679
+Node: Two-way processors957194
+Node: Printing Messages959398
+Ref: Printing Messages-Footnote-1960474
+Node: Updating `ERRNO'960626
+Node: Requesting Values961366
+Ref: table-value-types-returned962094
+Node: Accessing Parameters963051
+Node: Symbol Table Access964282
+Node: Symbol table by name964796
+Node: Symbol table by cookie966777
+Ref: Symbol table by cookie-Footnote-1970921
+Node: Cached values970984
+Ref: Cached values-Footnote-1974483
+Node: Array Manipulation974574
+Ref: Array Manipulation-Footnote-1975672
+Node: Array Data Types975709
+Ref: Array Data Types-Footnote-1978364
+Node: Array Functions978456
+Node: Flattening Arrays982310
+Node: Creating Arrays989202
+Node: Extension API Variables993973
+Node: Extension Versioning994609
+Node: Extension API Informational Variables996510
+Node: Extension API Boilerplate997575
+Node: Finding Extensions1001384
+Node: Extension Example1001944
+Node: Internal File Description1002716
+Node: Internal File Ops1006783
+Ref: Internal File Ops-Footnote-11018453
+Node: Using Internal File Ops1018593
+Ref: Using Internal File Ops-Footnote-11020976
+Node: Extension Samples1021249
+Node: Extension Sample File Functions1022775
+Node: Extension Sample Fnmatch1030413
+Node: Extension Sample Fork1031904
+Node: Extension Sample Inplace1033119
+Node: Extension Sample Ord1034794
+Node: Extension Sample Readdir1035630
+Ref: table-readdir-file-types1036506
+Node: Extension Sample Revout1037317
+Node: Extension Sample Rev2way1037907
+Node: Extension Sample Read write array1038647
+Node: Extension Sample Readfile1040587
+Node: Extension Sample Time1041682
+Node: Extension Sample API Tests1043031
+Node: gawkextlib1043522
+Node: Extension summary1046180
+Node: Extension Exercises1049869
+Node: Language History1050591
+Node: V7/SVR3.11052247
+Node: SVR41054428
+Node: POSIX1055873
+Node: BTL1057262
+Node: POSIX/GNU1057996
+Node: Feature History1063560
+Node: Common Extensions1076658
+Node: Ranges and Locales1077982
+Ref: Ranges and Locales-Footnote-11082600
+Ref: Ranges and Locales-Footnote-21082627
+Ref: Ranges and Locales-Footnote-31082861
+Node: Contributors1083082
+Node: History summary1088623
+Node: Installation1089993
+Node: Gawk Distribution1090939
+Node: Getting1091423
+Node: Extracting1092246
+Node: Distribution contents1093881
+Node: Unix Installation1099598
+Node: Quick Installation1100215
+Node: Additional Configuration Options1102639
+Node: Configuration Philosophy1104377
+Node: Non-Unix Installation1106746
+Node: PC Installation1107204
+Node: PC Binary Installation1108523
+Node: PC Compiling1110371
+Ref: PC Compiling-Footnote-11113392
+Node: PC Testing1113501
+Node: PC Using1114677
+Node: Cygwin1118792
+Node: MSYS1119615
+Node: VMS Installation1120115
+Node: VMS Compilation1120907
+Ref: VMS Compilation-Footnote-11122129
+Node: VMS Dynamic Extensions1122187
+Node: VMS Installation Details1123871
+Node: VMS Running1126123
+Node: VMS GNV1128959
+Node: VMS Old Gawk1129693
+Node: Bugs1130163
+Node: Other Versions1134046
+Node: Installation summary1140470
+Node: Notes1141526
+Node: Compatibility Mode1142391
+Node: Additions1143173
+Node: Accessing The Source1144098
+Node: Adding Code1145533
+Node: New Ports1151690
+Node: Derived Files1156172
+Ref: Derived Files-Footnote-11161647
+Ref: Derived Files-Footnote-21161681
+Ref: Derived Files-Footnote-31162277
+Node: Future Extensions1162391
+Node: Implementation Limitations1162997
+Node: Extension Design1164245
+Node: Old Extension Problems1165399
+Ref: Old Extension Problems-Footnote-11166916
+Node: Extension New Mechanism Goals1166973
+Ref: Extension New Mechanism Goals-Footnote-11170333
+Node: Extension Other Design Decisions1170522
+Node: Extension Future Growth1172630
+Node: Old Extension Mechanism1173466
+Node: Notes summary1175228
+Node: Basic Concepts1176414
+Node: Basic High Level1177095
+Ref: figure-general-flow1177367
+Ref: figure-process-flow1177966
+Ref: Basic High Level-Footnote-11181195
+Node: Basic Data Typing1181380
+Node: Glossary1184708
+Node: Copying1216637
+Node: GNU Free Documentation License1254193
+Node: Index1279329
End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 266b389..df5afc6 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -19336,10 +19336,15 @@ the call.
A function cannot have two parameters with the same name, nor may it
have a parameter with the same name as the function itself.
-In addition, according to the POSIX standard, function parameters
+
address@hidden CAUTION
+According to the POSIX standard, function parameters
cannot have the same name as one of the special predefined variables
-(@pxref{Built-in Variables}). Not all versions of @command{awk} enforce
-this restriction.
+(@pxref{Built-in Variables}), nor may a function parameter have the
+same name as another function.
+Not all versions of @command{awk} enforce
+these restrictions.
address@hidden quotation
Local variables act like the empty string if referenced where a string
value is required, and like zero if referenced where a numeric value
@@ -20056,13 +20061,13 @@ using indirect function calls:
@c file eg/prog/indirectcall.awk
# average --- return the average of the values in fields $first - $last
-function average(first, last, sum, i)
+function average(first, last, the_sum, i)
@{
- sum = 0;
+ the_sum = 0;
for (i = first; i <= last; i++)
- sum += $i
+ the_sum += $i
- return sum / (last - first + 1)
+ return the_sum / (last - first + 1)
@}
# sum --- return the sum of the values in fields $first - $last
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 7fd947a..0723a4c 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -18457,10 +18457,15 @@ the call.
A function cannot have two parameters with the same name, nor may it
have a parameter with the same name as the function itself.
-In addition, according to the POSIX standard, function parameters
+
address@hidden CAUTION
+According to the POSIX standard, function parameters
cannot have the same name as one of the special predefined variables
-(@pxref{Built-in Variables}). Not all versions of @command{awk} enforce
-this restriction.
+(@pxref{Built-in Variables}), nor may a function parameter have the
+same name as another function.
+Not all versions of @command{awk} enforce
+these restrictions.
address@hidden quotation
Local variables act like the empty string if referenced where a string
value is required, and like zero if referenced where a numeric value
@@ -19177,13 +19182,13 @@ using indirect function calls:
@c file eg/prog/indirectcall.awk
# average --- return the average of the values in fields $first - $last
-function average(first, last, sum, i)
+function average(first, last, the_sum, i)
@{
- sum = 0;
+ the_sum = 0;
for (i = first; i <= last; i++)
- sum += $i
+ the_sum += $i
- return sum / (last - first + 1)
+ return the_sum / (last - first + 1)
@}
# sum --- return the sum of the values in fields $first - $last
diff --git a/symbol.c b/symbol.c
index 23e04c0..552c111 100644
--- a/symbol.c
+++ b/symbol.c
@@ -625,6 +625,61 @@ load_symbols()
unref(array);
}
+/* check_param_names --- make sure no parameter is the name of a function */
+
+bool
+check_param_names(void)
+{
+ int i, j, k;
+ NODE **list;
+ NODE *f;
+ long max;
+ bool result = true;
+
+ max = func_table->table_size * 2;
+
+ /*
+ * assoc_list() returns an array with two elements per awk array
+ * element. Elements i and i+1 in the C array represent the key
+ * and value of element j in the awk array. Thus the loops use += 2
+ * to go through the awk array.
+ *
+ * In this case, the name is in list[i], and the function is
+ * in list[i+1]. Just what we need.
+ */
+
+ list = assoc_list(func_table, "@unsorted", ASORTI);
+
+ /*
+ * You want linear searches?
+ * Have we got linear searches!
+ */
+ for (i = 0; i < max; i += 2) {
+ f = list[i+1];
+ if (f->type == Node_builtin_func || f->param_cnt == 0)
+ continue;
+
+ /* loop over each param in function i */
+ for (j = 0; j < f->param_cnt; j++) {
+ /* compare to function names */
+ for (k = 0; k < max; k += 2) {
+ if (k == i)
+ continue;
+ if (strcmp(f->fparms[j].param, list[k]->stptr)
== 0) {
+ error(
+ _("function `%s': can't use function `%s' as a
parameter name"),
+ list[i]->stptr,
+ list[k]->stptr);
+ result = false;
+ }
+ }
+ }
+ }
+
+ efree(list);
+ return result;
+}
+
#define pool_size d.dl
#define freei x.xi
static INSTRUCTION *pool_list;
diff --git a/test/ChangeLog b/test/ChangeLog
index 04e65b5..97b3d40 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,11 @@
+2015-01-30 Arnold D. Robbins <address@hidden>
+
+ * Makefile.in (callparam, paramasfunc1, paramasfunc2): New tests.
+ * callparam.awk, callparam.ok: New files.
+ * paramasfunc1.awk, paramasfunc1.ok: New files.
+ * paramasfunc2.awk, paramasfunc2.ok: New files.
+ * exit.sh, indirectcall.awk: Update after code change.
+
2015-01-14 Arnold D. Robbins <address@hidden>
* Makefile.am (dumpvars): Grep out ENVIRON and PROCINFO since
diff --git a/test/Makefile.am b/test/Makefile.am
index bd2903a..4a90beb 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -132,6 +132,8 @@ EXTRA_DIST = \
beginfile2.ok \
beginfile2.sh \
binmode1.ok \
+ callparam.awk \
+ callparam.ok \
charasbytes.awk \
charasbytes.in \
charasbytes.ok \
@@ -642,6 +644,10 @@ EXTRA_DIST = \
out1.ok \
out2.ok \
out3.ok \
+ paramasfunc1.awk \
+ paramasfunc1.ok \
+ paramasfunc2.awk \
+ paramasfunc2.ok \
paramdup.awk \
paramdup.ok \
paramres.awk \
@@ -983,7 +989,7 @@ BASIC_TESTS = \
arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \
aryprm8 arysubnm asgext awkpath \
back89 backgsub badassign1 badbuild \
- childin clobber closebad clsflnam compare compare2 concat1 concat2 \
+ callparam childin clobber closebad clsflnam compare compare2 concat1
concat2 \
concat3 concat4 convfmt \
datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress
dynlj \
eofsplit exit2 exitval1 exitval2 \
@@ -1001,6 +1007,7 @@ BASIC_TESTS = \
nlinstr nlstrina noeffect nofile nofmtch noloop1 noloop2 nonl \
noparms nors nulrsend numindex numsubstr \
octsub ofmt ofmta ofmtbig ofmtfidl ofmts ofs1 onlynl opasnidx opasnslf \
+ paramasfunc1 paramasfunc2 \
paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \
pcntplus posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \
prt1eval prtoeval \
diff --git a/test/Makefile.in b/test/Makefile.in
index 215ba89..9717172 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -389,6 +389,8 @@ EXTRA_DIST = \
beginfile2.ok \
beginfile2.sh \
binmode1.ok \
+ callparam.awk \
+ callparam.ok \
charasbytes.awk \
charasbytes.in \
charasbytes.ok \
@@ -899,6 +901,10 @@ EXTRA_DIST = \
out1.ok \
out2.ok \
out3.ok \
+ paramasfunc1.awk \
+ paramasfunc1.ok \
+ paramasfunc2.awk \
+ paramasfunc2.ok \
paramdup.awk \
paramdup.ok \
paramres.awk \
@@ -1239,7 +1245,7 @@ BASIC_TESTS = \
arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \
aryprm8 arysubnm asgext awkpath \
back89 backgsub badassign1 badbuild \
- childin clobber closebad clsflnam compare compare2 concat1 concat2 \
+ callparam childin clobber closebad clsflnam compare compare2 concat1
concat2 \
concat3 concat4 convfmt \
datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress
dynlj \
eofsplit exit2 exitval1 exitval2 \
@@ -1257,6 +1263,7 @@ BASIC_TESTS = \
nlinstr nlstrina noeffect nofile nofmtch noloop1 noloop2 nonl \
noparms nors nulrsend numindex numsubstr \
octsub ofmt ofmta ofmtbig ofmtfidl ofmts ofs1 onlynl opasnidx opasnslf \
+ paramasfunc1 paramasfunc2 \
paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \
pcntplus posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \
prt1eval prtoeval \
@@ -2572,6 +2579,11 @@ badbuild:
@AWKPATH="$(srcdir)" $(AWK) -f address@hidden <
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+callparam:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f address@hidden >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
childin:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f address@hidden <
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -3042,6 +3054,16 @@ opasnslf:
@AWKPATH="$(srcdir)" $(AWK) -f address@hidden >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+paramasfunc1:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f address@hidden >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
+paramasfunc2:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f address@hidden >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
paramdup:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f address@hidden >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 5c4c40f..41c85c0 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -130,6 +130,11 @@ badbuild:
@AWKPATH="$(srcdir)" $(AWK) -f address@hidden <
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+callparam:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f address@hidden >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
childin:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f address@hidden <
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -600,6 +605,16 @@ opasnslf:
@AWKPATH="$(srcdir)" $(AWK) -f address@hidden >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+paramasfunc1:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f address@hidden >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
+paramasfunc2:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f address@hidden >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
paramdup:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f address@hidden >_$@ 2>&1 || echo EXIT
CODE: $$? >>_$@
diff --git a/test/callparam.awk b/test/callparam.awk
new file mode 100644
index 0000000..b925db0
--- /dev/null
+++ b/test/callparam.awk
@@ -0,0 +1,6 @@
+BEGIN { f() }
+
+function f( a, b)
+{
+ a = b()
+}
diff --git a/test/callparam.ok b/test/callparam.ok
new file mode 100644
index 0000000..00a027e
--- /dev/null
+++ b/test/callparam.ok
@@ -0,0 +1,2 @@
+gawk: callparam.awk:5: error: attempt to use non-function `b' in function call
+EXIT CODE: 1
diff --git a/test/exit.sh b/test/exit.sh
index 9510dcd..3922f83 100755
--- a/test/exit.sh
+++ b/test/exit.sh
@@ -30,7 +30,7 @@ x='function f(){ exit}; BEGINFILE {f()}; NR>1{ f()};
END{print NR}'
$AWK 'BEGIN { print "a\nb" }' | $AWK "$x"
echo "-- 5"
-y='function strip(f) { sub(/.*\//, "", f); return f };'
+y='function strip(val) { sub(/.*\//, "", val); return val };'
x='BEGINFILE{if(++i==1) exit;}; END{print i, strip(FILENAME)}'
$AWK "$y$x" /dev/null $0
diff --git a/test/indirectcall.awk b/test/indirectcall.awk
index 5cfdd23..7429097 100644
--- a/test/indirectcall.awk
+++ b/test/indirectcall.awk
@@ -5,13 +5,13 @@
# average --- return the average of the values in fields $first - $last
-function average(first, last, sum, i)
+function average(first, last, the_sum, i)
{
- sum = 0;
+ the_sum = 0;
for (i = first; i <= last; i++)
- sum += $i
+ the_sum += $i
- return sum / (last - first + 1)
+ return the_sum / (last - first + 1)
}
# sum --- return the average of the values in fields $first - $last
diff --git a/test/paramasfunc1.awk b/test/paramasfunc1.awk
new file mode 100644
index 0000000..b0d0684
--- /dev/null
+++ b/test/paramasfunc1.awk
@@ -0,0 +1,9 @@
+BEGIN{ X() }
+
+function X( abc)
+{
+ abc = "stamp out "
+ print abc abc()
+}
+
+function abc() { return "dark corners" }
diff --git a/test/paramasfunc1.ok b/test/paramasfunc1.ok
new file mode 100644
index 0000000..9ee9511
--- /dev/null
+++ b/test/paramasfunc1.ok
@@ -0,0 +1,3 @@
+gawk: paramasfunc1.awk:6: error: attempt to use non-function `abc' in function
call
+gawk: error: function `X': can't use function `abc' as a parameter name
+EXIT CODE: 1
diff --git a/test/paramasfunc2.awk b/test/paramasfunc2.awk
new file mode 100644
index 0000000..849b3d1
--- /dev/null
+++ b/test/paramasfunc2.awk
@@ -0,0 +1,10 @@
+BEGIN{ X() }
+
+function abc() { return "dark corners" }
+
+function X( abc)
+{
+ abc = "stamp out "
+ print abc abc()
+}
+
diff --git a/test/paramasfunc2.ok b/test/paramasfunc2.ok
new file mode 100644
index 0000000..2cdf4f6
--- /dev/null
+++ b/test/paramasfunc2.ok
@@ -0,0 +1,3 @@
+gawk: paramasfunc2.awk:8: error: attempt to use non-function `abc' in function
call
+gawk: error: function `X': can't use function `abc' as a parameter name
+EXIT CODE: 1
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 18 ++
NEWS | 13 +-
awk.h | 1 +
awkgram.c | 742 +++++++++++++++++++++++++------------------------
awkgram.y | 24 ++-
doc/ChangeLog | 5 +
doc/gawk.info | 632 +++++++++++++++++++++---------------------
doc/gawk.texi | 19 +-
doc/gawktexi.in | 19 +-
symbol.c | 55 ++++
test/ChangeLog | 8 +
test/Makefile.am | 9 +-
test/Makefile.in | 24 ++-
test/Maketests | 15 +
test/callparam.awk | 6 +
test/callparam.ok | 2 +
test/exit.sh | 2 +-
test/indirectcall.awk | 8 +-
test/paramasfunc1.awk | 9 +
test/paramasfunc1.ok | 3 +
test/paramasfunc2.awk | 10 +
test/paramasfunc2.ok | 3 +
22 files changed, 927 insertions(+), 700 deletions(-)
create mode 100644 test/callparam.awk
create mode 100644 test/callparam.ok
create mode 100644 test/paramasfunc1.awk
create mode 100644 test/paramasfunc1.ok
create mode 100644 test/paramasfunc2.awk
create mode 100644 test/paramasfunc2.ok
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-571-g1bd1b88,
Arnold Robbins <=