aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2016-04-02 22:35:33 +0300
committerArnold D. Robbins <arnold@skeeve.com>2016-04-02 22:35:33 +0300
commit2ca6fd0026a03da5ac6a658fd744f90dde374ce5 (patch)
tree46bd99d83e7a071e345e4a660ba22391c1bbccd6
parente03ebf24e322d0aa14bfc0f8b427861a80b71b64 (diff)
parent80841bfbe180589bfc3d66d15792994d28490702 (diff)
downloadegawk-2ca6fd0026a03da5ac6a658fd744f90dde374ce5.tar.gz
egawk-2ca6fd0026a03da5ac6a658fd744f90dde374ce5.tar.bz2
egawk-2ca6fd0026a03da5ac6a658fd744f90dde374ce5.zip
Merge branch 'master' into feature/cmake
-rw-r--r--ChangeLog33
-rw-r--r--awkgram.c914
-rw-r--r--awkgram.y132
-rw-r--r--doc/ChangeLog5
-rw-r--r--doc/gawk.info427
-rw-r--r--doc/gawk.texi7
-rw-r--r--doc/gawktexi.in7
-rw-r--r--profile.c108
-rw-r--r--test/ChangeLog14
-rw-r--r--test/Makefile.am9
-rw-r--r--test/Makefile.in9
-rw-r--r--test/profile10.awk42
-rw-r--r--test/profile10.ok40
-rw-r--r--test/profile5.ok702
14 files changed, 1378 insertions, 1071 deletions
diff --git a/ChangeLog b/ChangeLog
index 52965d59..3149d73f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2016-03-27 Stephen Davies <sdavies@sdc.com.au>
+
+ * awkgram.y (get_comment): Strip CRs from comment. Strip
+ off trailing newlines.
+
+2016-03-21 Arnold D. Robbins <arnold@skeeve.com>
+
+ * profile.c (pprint): Improve handling of comment after
+ and if statement without an else.
+
+2016-03-19 Arnold D. Robbins <arnold@skeeve.com>
+
+ Considerable improvements to handling of comments when pretty
+ printing, particularly for end-of-line comments.
+
+ * awkgram.y (prior_comment, comment_to_save): New variables.
+ (add_pending_comment): New function.
+ (grammar): Jump through lots more hoops to capture comments.
+ Due to shift-reduce parsing, there can be up to two comments
+ captured and waiting to be saved; be sure to get them both and
+ at the right times. This is difficult since comments have no
+ real syntactic exisitence. Call add_pending_comment on most of
+ the simple statements.
+ (get_comment): Save a pre-existing comment in prior_comment.
+ (split_comment): Use comment_to_save instead of `comment'.
+ * profile.c (end_line): Change to return the instruction after
+ the comment that gets printed; adjust return type.
+ (pprint): Add skip_comment static variable. Adjust logic for
+ skipping an end-of-line comment; only do it if skip_comment is
+ true. This is set to true in places where we can't use the
+ return value from end_line(). Call end_line() in many more places.
+ (pp_func): Handle end-of-line comments after a function header.
+
2016-03-17 Arnold D. Robbins <arnold@skeeve.com>
* debug.c (print_instruction): For Op_comment, improve notation as
diff --git a/awkgram.c b/awkgram.c
index d50040b3..bd531efb 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -191,6 +191,8 @@ static INSTRUCTION *ip_beginfile;
INSTRUCTION *main_beginfile;
static INSTRUCTION *comment = NULL;
+static INSTRUCTION *prior_comment = NULL;
+static INSTRUCTION *comment_to_save = NULL;
static INSTRUCTION *program_comment = NULL;
static INSTRUCTION *function_comment = NULL;
static INSTRUCTION *block_comment = NULL;
@@ -202,12 +204,13 @@ static inline INSTRUCTION *list_create(INSTRUCTION *x);
static inline INSTRUCTION *list_append(INSTRUCTION *l, INSTRUCTION *x);
static inline INSTRUCTION *list_prepend(INSTRUCTION *l, INSTRUCTION *x);
static inline INSTRUCTION *list_merge(INSTRUCTION *l1, INSTRUCTION *l2);
+static inline INSTRUCTION *add_pending_comment(INSTRUCTION *stmt);
extern double fmod(double x, double y);
#define YYSTYPE INSTRUCTION *
-#line 211 "awkgram.c" /* yacc.c:339 */
+#line 214 "awkgram.c" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
@@ -363,7 +366,7 @@ int yyparse (void);
/* Copy the second part of user declarations. */
-#line 367 "awkgram.c" /* yacc.c:358 */
+#line 370 "awkgram.c" /* yacc.c:358 */
#ifdef short
# undef short
@@ -665,27 +668,27 @@ static const yytype_uint8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 210, 210, 212, 217, 218, 222, 234, 239, 250,
- 257, 263, 272, 280, 282, 287, 295, 297, 303, 311,
- 321, 351, 365, 379, 387, 398, 410, 412, 414, 420,
- 428, 429, 433, 433, 469, 468, 502, 524, 526, 531,
- 537, 565, 570, 571, 575, 577, 579, 586, 676, 718,
- 760, 873, 880, 887, 897, 906, 915, 924, 935, 951,
- 950, 974, 986, 986, 1084, 1084, 1117, 1147, 1153, 1154,
- 1160, 1161, 1168, 1173, 1185, 1199, 1201, 1209, 1214, 1216,
- 1224, 1233, 1235, 1244, 1245, 1253, 1258, 1258, 1269, 1273,
- 1281, 1282, 1285, 1287, 1292, 1293, 1302, 1303, 1308, 1313,
- 1322, 1324, 1326, 1333, 1334, 1340, 1341, 1346, 1348, 1353,
- 1355, 1363, 1368, 1377, 1378, 1383, 1385, 1390, 1392, 1400,
- 1405, 1413, 1414, 1419, 1426, 1430, 1432, 1434, 1447, 1464,
- 1474, 1481, 1483, 1488, 1490, 1492, 1500, 1502, 1507, 1509,
- 1514, 1516, 1518, 1574, 1576, 1578, 1580, 1582, 1584, 1586,
- 1588, 1602, 1607, 1612, 1637, 1643, 1645, 1647, 1649, 1651,
- 1653, 1658, 1662, 1694, 1696, 1702, 1708, 1721, 1722, 1723,
- 1728, 1733, 1737, 1741, 1756, 1769, 1774, 1811, 1840, 1841,
- 1847, 1848, 1853, 1855, 1862, 1879, 1896, 1898, 1905, 1910,
- 1918, 1928, 1940, 1949, 1953, 1957, 1961, 1965, 1969, 1972,
- 1974, 1978, 1982, 1986
+ 0, 213, 213, 215, 220, 221, 225, 237, 242, 253,
+ 260, 266, 275, 283, 285, 290, 298, 300, 306, 314,
+ 324, 354, 368, 382, 390, 401, 413, 415, 417, 423,
+ 431, 432, 436, 436, 482, 481, 515, 537, 539, 544,
+ 554, 601, 606, 607, 611, 613, 615, 622, 712, 754,
+ 796, 909, 916, 923, 934, 944, 954, 964, 976, 993,
+ 992, 1017, 1029, 1029, 1128, 1128, 1162, 1193, 1202, 1203,
+ 1209, 1210, 1217, 1222, 1234, 1248, 1250, 1258, 1263, 1265,
+ 1273, 1282, 1284, 1293, 1294, 1302, 1307, 1307, 1318, 1322,
+ 1330, 1331, 1334, 1336, 1341, 1342, 1351, 1352, 1357, 1362,
+ 1371, 1373, 1375, 1382, 1383, 1389, 1390, 1395, 1397, 1402,
+ 1404, 1412, 1417, 1426, 1427, 1432, 1434, 1439, 1441, 1449,
+ 1454, 1462, 1463, 1468, 1475, 1479, 1481, 1483, 1496, 1513,
+ 1523, 1530, 1532, 1537, 1539, 1541, 1549, 1551, 1556, 1558,
+ 1563, 1565, 1567, 1623, 1625, 1627, 1629, 1631, 1633, 1635,
+ 1637, 1651, 1656, 1661, 1686, 1692, 1694, 1696, 1698, 1700,
+ 1702, 1707, 1711, 1743, 1745, 1751, 1757, 1770, 1771, 1772,
+ 1777, 1782, 1786, 1790, 1805, 1818, 1823, 1860, 1889, 1890,
+ 1896, 1897, 1902, 1904, 1911, 1928, 1945, 1947, 1954, 1959,
+ 1967, 1977, 1989, 1998, 2002, 2006, 2010, 2014, 2018, 2021,
+ 2023, 2027, 2031, 2035
};
#endif
@@ -1883,24 +1886,24 @@ yyreduce:
switch (yyn)
{
case 3:
-#line 213 "awkgram.y" /* yacc.c:1646 */
+#line 216 "awkgram.y" /* yacc.c:1646 */
{
rule = 0;
yyerrok;
}
-#line 1892 "awkgram.c" /* yacc.c:1646 */
+#line 1895 "awkgram.c" /* yacc.c:1646 */
break;
case 5:
-#line 219 "awkgram.y" /* yacc.c:1646 */
+#line 222 "awkgram.y" /* yacc.c:1646 */
{
next_sourcefile();
}
-#line 1900 "awkgram.c" /* yacc.c:1646 */
+#line 1903 "awkgram.c" /* yacc.c:1646 */
break;
case 6:
-#line 223 "awkgram.y" /* yacc.c:1646 */
+#line 226 "awkgram.y" /* yacc.c:1646 */
{
rule = 0;
/*
@@ -1909,20 +1912,20 @@ yyreduce:
*/
/* yyerrok; */
}
-#line 1913 "awkgram.c" /* yacc.c:1646 */
+#line 1916 "awkgram.c" /* yacc.c:1646 */
break;
case 7:
-#line 235 "awkgram.y" /* yacc.c:1646 */
+#line 238 "awkgram.y" /* yacc.c:1646 */
{
(void) append_rule((yyvsp[-1]), (yyvsp[0]));
first_rule = false;
}
-#line 1922 "awkgram.c" /* yacc.c:1646 */
+#line 1925 "awkgram.c" /* yacc.c:1646 */
break;
case 8:
-#line 240 "awkgram.y" /* yacc.c:1646 */
+#line 243 "awkgram.y" /* yacc.c:1646 */
{
if (rule != Rule) {
msg(_("%s blocks must have an action part"), ruletab[rule]);
@@ -1933,42 +1936,42 @@ yyreduce:
} else /* pattern rule with non-empty pattern */
(void) append_rule((yyvsp[-1]), NULL);
}
-#line 1937 "awkgram.c" /* yacc.c:1646 */
+#line 1940 "awkgram.c" /* yacc.c:1646 */
break;
case 9:
-#line 251 "awkgram.y" /* yacc.c:1646 */
+#line 254 "awkgram.y" /* yacc.c:1646 */
{
in_function = NULL;
(void) mk_function((yyvsp[-1]), (yyvsp[0]));
want_param_names = DONT_CHECK;
yyerrok;
}
-#line 1948 "awkgram.c" /* yacc.c:1646 */
+#line 1951 "awkgram.c" /* yacc.c:1646 */
break;
case 10:
-#line 258 "awkgram.y" /* yacc.c:1646 */
+#line 261 "awkgram.y" /* yacc.c:1646 */
{
want_source = false;
at_seen = false;
yyerrok;
}
-#line 1958 "awkgram.c" /* yacc.c:1646 */
+#line 1961 "awkgram.c" /* yacc.c:1646 */
break;
case 11:
-#line 264 "awkgram.y" /* yacc.c:1646 */
+#line 267 "awkgram.y" /* yacc.c:1646 */
{
want_source = false;
at_seen = false;
yyerrok;
}
-#line 1968 "awkgram.c" /* yacc.c:1646 */
+#line 1971 "awkgram.c" /* yacc.c:1646 */
break;
case 12:
-#line 273 "awkgram.y" /* yacc.c:1646 */
+#line 276 "awkgram.y" /* yacc.c:1646 */
{
if (include_source((yyvsp[0])) < 0)
YYABORT;
@@ -1976,23 +1979,23 @@ yyreduce:
bcfree((yyvsp[0]));
(yyval) = NULL;
}
-#line 1980 "awkgram.c" /* yacc.c:1646 */
+#line 1983 "awkgram.c" /* yacc.c:1646 */
break;
case 13:
-#line 281 "awkgram.y" /* yacc.c:1646 */
+#line 284 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 1986 "awkgram.c" /* yacc.c:1646 */
+#line 1989 "awkgram.c" /* yacc.c:1646 */
break;
case 14:
-#line 283 "awkgram.y" /* yacc.c:1646 */
+#line 286 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 1992 "awkgram.c" /* yacc.c:1646 */
+#line 1995 "awkgram.c" /* yacc.c:1646 */
break;
case 15:
-#line 288 "awkgram.y" /* yacc.c:1646 */
+#line 291 "awkgram.y" /* yacc.c:1646 */
{
if (load_library((yyvsp[0])) < 0)
YYABORT;
@@ -2000,23 +2003,23 @@ yyreduce:
bcfree((yyvsp[0]));
(yyval) = NULL;
}
-#line 2004 "awkgram.c" /* yacc.c:1646 */
+#line 2007 "awkgram.c" /* yacc.c:1646 */
break;
case 16:
-#line 296 "awkgram.y" /* yacc.c:1646 */
+#line 299 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2010 "awkgram.c" /* yacc.c:1646 */
+#line 2013 "awkgram.c" /* yacc.c:1646 */
break;
case 17:
-#line 298 "awkgram.y" /* yacc.c:1646 */
+#line 301 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2016 "awkgram.c" /* yacc.c:1646 */
+#line 2019 "awkgram.c" /* yacc.c:1646 */
break;
case 18:
-#line 303 "awkgram.y" /* yacc.c:1646 */
+#line 306 "awkgram.y" /* yacc.c:1646 */
{
rule = Rule;
if (comment != NULL) {
@@ -2025,11 +2028,11 @@ yyreduce:
} else
(yyval) = NULL;
}
-#line 2029 "awkgram.c" /* yacc.c:1646 */
+#line 2032 "awkgram.c" /* yacc.c:1646 */
break;
case 19:
-#line 312 "awkgram.y" /* yacc.c:1646 */
+#line 315 "awkgram.y" /* yacc.c:1646 */
{
rule = Rule;
if (comment != NULL) {
@@ -2038,11 +2041,11 @@ yyreduce:
} else
(yyval) = (yyvsp[0]);
}
-#line 2042 "awkgram.c" /* yacc.c:1646 */
+#line 2045 "awkgram.c" /* yacc.c:1646 */
break;
case 20:
-#line 322 "awkgram.y" /* yacc.c:1646 */
+#line 325 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *tp;
@@ -2072,11 +2075,11 @@ yyreduce:
(yyval) = list_append(list_merge((yyvsp[-3]), (yyvsp[0])), tp);
rule = Rule;
}
-#line 2076 "awkgram.c" /* yacc.c:1646 */
+#line 2079 "awkgram.c" /* yacc.c:1646 */
break;
case 21:
-#line 352 "awkgram.y" /* yacc.c:1646 */
+#line 355 "awkgram.y" /* yacc.c:1646 */
{
static int begin_seen = 0;
@@ -2090,11 +2093,11 @@ yyreduce:
check_comment();
(yyval) = (yyvsp[0]);
}
-#line 2094 "awkgram.c" /* yacc.c:1646 */
+#line 2097 "awkgram.c" /* yacc.c:1646 */
break;
case 22:
-#line 366 "awkgram.y" /* yacc.c:1646 */
+#line 369 "awkgram.y" /* yacc.c:1646 */
{
static int end_seen = 0;
@@ -2108,11 +2111,11 @@ yyreduce:
check_comment();
(yyval) = (yyvsp[0]);
}
-#line 2112 "awkgram.c" /* yacc.c:1646 */
+#line 2115 "awkgram.c" /* yacc.c:1646 */
break;
case 23:
-#line 380 "awkgram.y" /* yacc.c:1646 */
+#line 383 "awkgram.y" /* yacc.c:1646 */
{
func_first = false;
(yyvsp[0])->in_rule = rule = BEGINFILE;
@@ -2120,11 +2123,11 @@ yyreduce:
check_comment();
(yyval) = (yyvsp[0]);
}
-#line 2124 "awkgram.c" /* yacc.c:1646 */
+#line 2127 "awkgram.c" /* yacc.c:1646 */
break;
case 24:
-#line 388 "awkgram.y" /* yacc.c:1646 */
+#line 391 "awkgram.y" /* yacc.c:1646 */
{
func_first = false;
(yyvsp[0])->in_rule = rule = ENDFILE;
@@ -2132,11 +2135,11 @@ yyreduce:
check_comment();
(yyval) = (yyvsp[0]);
}
-#line 2136 "awkgram.c" /* yacc.c:1646 */
+#line 2139 "awkgram.c" /* yacc.c:1646 */
break;
case 25:
-#line 399 "awkgram.y" /* yacc.c:1646 */
+#line 402 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip;
if ((yyvsp[-3]) == NULL)
@@ -2145,48 +2148,48 @@ yyreduce:
ip = (yyvsp[-3]);
(yyval) = ip;
}
-#line 2149 "awkgram.c" /* yacc.c:1646 */
+#line 2152 "awkgram.c" /* yacc.c:1646 */
break;
case 26:
-#line 411 "awkgram.y" /* yacc.c:1646 */
+#line 414 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2155 "awkgram.c" /* yacc.c:1646 */
+#line 2158 "awkgram.c" /* yacc.c:1646 */
break;
case 27:
-#line 413 "awkgram.y" /* yacc.c:1646 */
+#line 416 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2161 "awkgram.c" /* yacc.c:1646 */
+#line 2164 "awkgram.c" /* yacc.c:1646 */
break;
case 28:
-#line 415 "awkgram.y" /* yacc.c:1646 */
+#line 418 "awkgram.y" /* yacc.c:1646 */
{
yyerror(_("`%s' is a built-in function, it cannot be redefined"),
tokstart);
YYABORT;
}
-#line 2171 "awkgram.c" /* yacc.c:1646 */
+#line 2174 "awkgram.c" /* yacc.c:1646 */
break;
case 29:
-#line 421 "awkgram.y" /* yacc.c:1646 */
+#line 424 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = (yyvsp[0]);
at_seen = false;
}
-#line 2180 "awkgram.c" /* yacc.c:1646 */
+#line 2183 "awkgram.c" /* yacc.c:1646 */
break;
case 32:
-#line 433 "awkgram.y" /* yacc.c:1646 */
+#line 436 "awkgram.y" /* yacc.c:1646 */
{ want_param_names = FUNC_HEADER; }
-#line 2186 "awkgram.c" /* yacc.c:1646 */
+#line 2189 "awkgram.c" /* yacc.c:1646 */
break;
case 33:
-#line 434 "awkgram.y" /* yacc.c:1646 */
+#line 437 "awkgram.y" /* yacc.c:1646 */
{
/*
* treat any comments between BOF and the first function
@@ -2195,13 +2198,23 @@ yyreduce:
* than one such comments, treat the last as a function
* comment.
*/
- if (comment != NULL && func_first
- && strstr(comment->memory->stptr, "\n\n") != NULL)
+ if (prior_comment != NULL) {
+ comment_to_save = prior_comment;
+ prior_comment = NULL;
+ } else if (comment != NULL) {
+ comment_to_save = comment;
+ comment = NULL;
+ } else
+ comment_to_save = NULL;
+
+ if (comment_to_save != NULL && func_first
+ && strstr(comment_to_save->memory->stptr, "\n\n") != NULL)
split_comment();
+
/* save any other pre-function comment as function comment */
- if (comment != NULL) {
- function_comment = comment;
- comment = NULL;
+ if (comment_to_save != NULL) {
+ function_comment = comment_to_save;
+ comment_to_save = NULL;
}
func_first = false;
(yyvsp[-6])->source_file = source;
@@ -2214,17 +2227,17 @@ yyreduce:
(yyval) = (yyvsp[-6]);
want_param_names = FUNC_BODY;
}
-#line 2218 "awkgram.c" /* yacc.c:1646 */
+#line 2231 "awkgram.c" /* yacc.c:1646 */
break;
case 34:
-#line 469 "awkgram.y" /* yacc.c:1646 */
+#line 482 "awkgram.y" /* yacc.c:1646 */
{ want_regexp = true; }
-#line 2224 "awkgram.c" /* yacc.c:1646 */
+#line 2237 "awkgram.c" /* yacc.c:1646 */
break;
case 35:
-#line 471 "awkgram.y" /* yacc.c:1646 */
+#line 484 "awkgram.y" /* yacc.c:1646 */
{
NODE *n, *exp;
char *re;
@@ -2253,11 +2266,11 @@ yyreduce:
(yyval)->opcode = Op_match_rec;
(yyval)->memory = n;
}
-#line 2257 "awkgram.c" /* yacc.c:1646 */
+#line 2270 "awkgram.c" /* yacc.c:1646 */
break;
case 36:
-#line 503 "awkgram.y" /* yacc.c:1646 */
+#line 516 "awkgram.y" /* yacc.c:1646 */
{
NODE *n, *exp;
char *re;
@@ -2277,47 +2290,70 @@ yyreduce:
(yyval)->opcode = Op_push_re;
(yyval)->memory = n;
}
-#line 2281 "awkgram.c" /* yacc.c:1646 */
+#line 2294 "awkgram.c" /* yacc.c:1646 */
break;
case 37:
-#line 525 "awkgram.y" /* yacc.c:1646 */
+#line 538 "awkgram.y" /* yacc.c:1646 */
{ bcfree((yyvsp[0])); }
-#line 2287 "awkgram.c" /* yacc.c:1646 */
+#line 2300 "awkgram.c" /* yacc.c:1646 */
break;
case 39:
-#line 531 "awkgram.y" /* yacc.c:1646 */
+#line 544 "awkgram.y" /* yacc.c:1646 */
{
- if (comment != NULL) {
+ if (prior_comment != NULL) {
+ (yyval) = list_create(prior_comment);
+ prior_comment = NULL;
+ } else if (comment != NULL) {
(yyval) = list_create(comment);
comment = NULL;
- } else (yyval) = NULL;
+ } else
+ (yyval) = NULL;
}
-#line 2298 "awkgram.c" /* yacc.c:1646 */
+#line 2315 "awkgram.c" /* yacc.c:1646 */
break;
case 40:
-#line 538 "awkgram.y" /* yacc.c:1646 */
+#line 555 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0]) == NULL) {
- if (comment == NULL)
- (yyval) = (yyvsp[-1]);
- else {
+ if (prior_comment != NULL) {
+ (yyval) = list_append((yyvsp[-1]), prior_comment);
+ prior_comment = NULL;
+ if (comment != NULL) {
+ (yyval) = list_append((yyval), comment);
+ comment = NULL;
+ }
+ } else if (comment != NULL) {
(yyval) = list_append((yyvsp[-1]), comment);
comment = NULL;
- }
+ } else
+ (yyval) = (yyvsp[-1]);
} else {
add_lint((yyvsp[0]), LINT_no_effect);
if ((yyvsp[-1]) == NULL) {
- if (comment == NULL)
- (yyval) = (yyvsp[0]);
- else {
+ if (prior_comment != NULL) {
+ (yyval) = list_append((yyvsp[0]), prior_comment);
+ prior_comment = NULL;
+ if (comment != NULL) {
+ (yyval) = list_append((yyval), comment);
+ comment = NULL;
+ }
+ } else if (comment != NULL) {
(yyval) = list_append((yyvsp[0]), comment);
comment = NULL;
- }
+ } else
+ (yyval) = (yyvsp[0]);
} else {
- if (comment != NULL) {
+ if (prior_comment != NULL) {
+ list_append((yyvsp[0]), prior_comment);
+ prior_comment = NULL;
+ if (comment != NULL) {
+ list_append((yyvsp[0]), comment);
+ comment = NULL;
+ }
+ } else if (comment != NULL) {
list_append((yyvsp[0]), comment);
comment = NULL;
}
@@ -2326,40 +2362,40 @@ yyreduce:
}
yyerrok;
}
-#line 2330 "awkgram.c" /* yacc.c:1646 */
+#line 2366 "awkgram.c" /* yacc.c:1646 */
break;
case 41:
-#line 566 "awkgram.y" /* yacc.c:1646 */
+#line 602 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2336 "awkgram.c" /* yacc.c:1646 */
+#line 2372 "awkgram.c" /* yacc.c:1646 */
break;
case 44:
-#line 576 "awkgram.y" /* yacc.c:1646 */
+#line 612 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2342 "awkgram.c" /* yacc.c:1646 */
+#line 2378 "awkgram.c" /* yacc.c:1646 */
break;
case 45:
-#line 578 "awkgram.y" /* yacc.c:1646 */
+#line 614 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 2348 "awkgram.c" /* yacc.c:1646 */
+#line 2384 "awkgram.c" /* yacc.c:1646 */
break;
case 46:
-#line 580 "awkgram.y" /* yacc.c:1646 */
+#line 616 "awkgram.y" /* yacc.c:1646 */
{
if (do_pretty_print)
(yyval) = list_prepend((yyvsp[0]), instruction(Op_exec_count));
else
(yyval) = (yyvsp[0]);
}
-#line 2359 "awkgram.c" /* yacc.c:1646 */
+#line 2395 "awkgram.c" /* yacc.c:1646 */
break;
case 47:
-#line 587 "awkgram.y" /* yacc.c:1646 */
+#line 623 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
INSTRUCTION *ip, *nextc, *tbreak;
@@ -2449,11 +2485,11 @@ yyreduce:
break_allowed--;
fix_break_continue(ip, tbreak, NULL);
}
-#line 2453 "awkgram.c" /* yacc.c:1646 */
+#line 2489 "awkgram.c" /* yacc.c:1646 */
break;
case 48:
-#line 677 "awkgram.y" /* yacc.c:1646 */
+#line 713 "awkgram.y" /* yacc.c:1646 */
{
/*
* -----------------
@@ -2495,11 +2531,11 @@ yyreduce:
continue_allowed--;
fix_break_continue(ip, tbreak, tcont);
}
-#line 2499 "awkgram.c" /* yacc.c:1646 */
+#line 2535 "awkgram.c" /* yacc.c:1646 */
break;
case 49:
-#line 719 "awkgram.y" /* yacc.c:1646 */
+#line 755 "awkgram.y" /* yacc.c:1646 */
{
/*
* -----------------
@@ -2541,11 +2577,11 @@ yyreduce:
} /* else
$1 and $4 are NULLs */
}
-#line 2545 "awkgram.c" /* yacc.c:1646 */
+#line 2581 "awkgram.c" /* yacc.c:1646 */
break;
case 50:
-#line 761 "awkgram.y" /* yacc.c:1646 */
+#line 797 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip;
char *var_name = (yyvsp[-5])->lextok;
@@ -2658,70 +2694,73 @@ regular_loop:
break_allowed--;
continue_allowed--;
}
-#line 2662 "awkgram.c" /* yacc.c:1646 */
+#line 2698 "awkgram.c" /* yacc.c:1646 */
break;
case 51:
-#line 874 "awkgram.y" /* yacc.c:1646 */
+#line 910 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_for_loop((yyvsp[-11]), (yyvsp[-9]), (yyvsp[-6]), (yyvsp[-3]), (yyvsp[0]));
break_allowed--;
continue_allowed--;
}
-#line 2673 "awkgram.c" /* yacc.c:1646 */
+#line 2709 "awkgram.c" /* yacc.c:1646 */
break;
case 52:
-#line 881 "awkgram.y" /* yacc.c:1646 */
+#line 917 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_for_loop((yyvsp[-10]), (yyvsp[-8]), (INSTRUCTION *) NULL, (yyvsp[-3]), (yyvsp[0]));
break_allowed--;
continue_allowed--;
}
-#line 2684 "awkgram.c" /* yacc.c:1646 */
+#line 2720 "awkgram.c" /* yacc.c:1646 */
break;
case 53:
-#line 888 "awkgram.y" /* yacc.c:1646 */
+#line 924 "awkgram.y" /* yacc.c:1646 */
{
if (do_pretty_print)
(yyval) = list_prepend((yyvsp[0]), instruction(Op_exec_count));
else
(yyval) = (yyvsp[0]);
+ (yyval) = add_pending_comment((yyval));
}
-#line 2695 "awkgram.c" /* yacc.c:1646 */
+#line 2732 "awkgram.c" /* yacc.c:1646 */
break;
case 54:
-#line 898 "awkgram.y" /* yacc.c:1646 */
+#line 935 "awkgram.y" /* yacc.c:1646 */
{
if (! break_allowed)
error_ln((yyvsp[-1])->source_line,
_("`break' is not allowed outside a loop or switch"));
(yyvsp[-1])->target_jmp = NULL;
(yyval) = list_create((yyvsp[-1]));
+ (yyval) = add_pending_comment((yyval));
}
-#line 2708 "awkgram.c" /* yacc.c:1646 */
+#line 2746 "awkgram.c" /* yacc.c:1646 */
break;
case 55:
-#line 907 "awkgram.y" /* yacc.c:1646 */
+#line 945 "awkgram.y" /* yacc.c:1646 */
{
if (! continue_allowed)
error_ln((yyvsp[-1])->source_line,
_("`continue' is not allowed outside a loop"));
(yyvsp[-1])->target_jmp = NULL;
(yyval) = list_create((yyvsp[-1]));
+ (yyval) = add_pending_comment((yyval));
}
-#line 2721 "awkgram.c" /* yacc.c:1646 */
+#line 2760 "awkgram.c" /* yacc.c:1646 */
break;
case 56:
-#line 916 "awkgram.y" /* yacc.c:1646 */
+#line 955 "awkgram.y" /* yacc.c:1646 */
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule && rule != Rule)
@@ -2729,12 +2768,13 @@ regular_loop:
_("`next' used in %s action"), ruletab[rule]);
(yyvsp[-1])->target_jmp = ip_rec;
(yyval) = list_create((yyvsp[-1]));
+ (yyval) = add_pending_comment((yyval));
}
-#line 2734 "awkgram.c" /* yacc.c:1646 */
+#line 2774 "awkgram.c" /* yacc.c:1646 */
break;
case 57:
-#line 925 "awkgram.y" /* yacc.c:1646 */
+#line 965 "awkgram.y" /* yacc.c:1646 */
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule == BEGIN || rule == END || rule == ENDFILE)
@@ -2744,12 +2784,13 @@ regular_loop:
(yyvsp[-1])->target_newfile = ip_newfile;
(yyvsp[-1])->target_endfile = ip_endfile;
(yyval) = list_create((yyvsp[-1]));
+ (yyval) = add_pending_comment((yyval));
}
-#line 2749 "awkgram.c" /* yacc.c:1646 */
+#line 2790 "awkgram.c" /* yacc.c:1646 */
break;
case 58:
-#line 936 "awkgram.y" /* yacc.c:1646 */
+#line 977 "awkgram.y" /* yacc.c:1646 */
{
/* Initialize the two possible jump targets, the actual target
* is resolved at run-time.
@@ -2763,21 +2804,22 @@ regular_loop:
(yyval)->nexti->memory = dupnode(Nnull_string);
} else
(yyval) = list_append((yyvsp[-1]), (yyvsp[-2]));
+ (yyval) = add_pending_comment((yyval));
}
-#line 2768 "awkgram.c" /* yacc.c:1646 */
+#line 2810 "awkgram.c" /* yacc.c:1646 */
break;
case 59:
-#line 951 "awkgram.y" /* yacc.c:1646 */
+#line 993 "awkgram.y" /* yacc.c:1646 */
{
if (! in_function)
yyerror(_("`return' used outside function context"));
}
-#line 2777 "awkgram.c" /* yacc.c:1646 */
+#line 2819 "awkgram.c" /* yacc.c:1646 */
break;
case 60:
-#line 954 "awkgram.y" /* yacc.c:1646 */
+#line 996 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-1]) == NULL) {
(yyval) = list_create((yyvsp[-3]));
@@ -2797,18 +2839,19 @@ regular_loop:
(yyval) = list_append((yyvsp[-1]), (yyvsp[-3]));
}
+ (yyval) = add_pending_comment((yyval));
}
-#line 2802 "awkgram.c" /* yacc.c:1646 */
+#line 2845 "awkgram.c" /* yacc.c:1646 */
break;
case 62:
-#line 986 "awkgram.y" /* yacc.c:1646 */
+#line 1029 "awkgram.y" /* yacc.c:1646 */
{ in_print = true; in_parens = 0; }
-#line 2808 "awkgram.c" /* yacc.c:1646 */
+#line 2851 "awkgram.c" /* yacc.c:1646 */
break;
case 63:
-#line 987 "awkgram.y" /* yacc.c:1646 */
+#line 1030 "awkgram.y" /* yacc.c:1646 */
{
/*
* Optimization: plain `print' has no expression list, so $3 is null.
@@ -2904,18 +2947,19 @@ regular_print:
}
}
}
+ (yyval) = add_pending_comment((yyval));
}
-#line 2909 "awkgram.c" /* yacc.c:1646 */
+#line 2953 "awkgram.c" /* yacc.c:1646 */
break;
case 64:
-#line 1084 "awkgram.y" /* yacc.c:1646 */
+#line 1128 "awkgram.y" /* yacc.c:1646 */
{ sub_counter = 0; }
-#line 2915 "awkgram.c" /* yacc.c:1646 */
+#line 2959 "awkgram.c" /* yacc.c:1646 */
break;
case 65:
-#line 1085 "awkgram.y" /* yacc.c:1646 */
+#line 1129 "awkgram.y" /* yacc.c:1646 */
{
char *arr = (yyvsp[-2])->lextok;
@@ -2947,12 +2991,13 @@ regular_print:
(yyvsp[-3])->expr_count = sub_counter;
(yyval) = list_append(list_append((yyvsp[0]), (yyvsp[-2])), (yyvsp[-3]));
}
+ (yyval) = add_pending_comment((yyval));
}
-#line 2952 "awkgram.c" /* yacc.c:1646 */
+#line 2997 "awkgram.c" /* yacc.c:1646 */
break;
case 66:
-#line 1122 "awkgram.y" /* yacc.c:1646 */
+#line 1167 "awkgram.y" /* yacc.c:1646 */
{
static bool warned = false;
char *arr = (yyvsp[-1])->lextok;
@@ -2977,53 +3022,57 @@ regular_print:
else if ((yyvsp[-1])->memory == func_table)
fatal(_("`delete' is not allowed with FUNCTAB"));
}
+ (yyval) = add_pending_comment((yyval));
}
-#line 2982 "awkgram.c" /* yacc.c:1646 */
+#line 3028 "awkgram.c" /* yacc.c:1646 */
break;
case 67:
-#line 1148 "awkgram.y" /* yacc.c:1646 */
- { (yyval) = optimize_assignment((yyvsp[0])); }
-#line 2988 "awkgram.c" /* yacc.c:1646 */
+#line 1194 "awkgram.y" /* yacc.c:1646 */
+ {
+ (yyval) = optimize_assignment((yyvsp[0]));
+ (yyval) = add_pending_comment((yyval));
+ }
+#line 3037 "awkgram.c" /* yacc.c:1646 */
break;
case 68:
-#line 1153 "awkgram.y" /* yacc.c:1646 */
+#line 1202 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2994 "awkgram.c" /* yacc.c:1646 */
+#line 3043 "awkgram.c" /* yacc.c:1646 */
break;
case 69:
-#line 1155 "awkgram.y" /* yacc.c:1646 */
+#line 1204 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3000 "awkgram.c" /* yacc.c:1646 */
+#line 3049 "awkgram.c" /* yacc.c:1646 */
break;
case 70:
-#line 1160 "awkgram.y" /* yacc.c:1646 */
+#line 1209 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3006 "awkgram.c" /* yacc.c:1646 */
+#line 3055 "awkgram.c" /* yacc.c:1646 */
break;
case 71:
-#line 1162 "awkgram.y" /* yacc.c:1646 */
+#line 1211 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-1]) == NULL)
(yyval) = list_create((yyvsp[0]));
else
(yyval) = list_prepend((yyvsp[-1]), (yyvsp[0]));
}
-#line 3017 "awkgram.c" /* yacc.c:1646 */
+#line 3066 "awkgram.c" /* yacc.c:1646 */
break;
case 72:
-#line 1169 "awkgram.y" /* yacc.c:1646 */
+#line 1218 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3023 "awkgram.c" /* yacc.c:1646 */
+#line 3072 "awkgram.c" /* yacc.c:1646 */
break;
case 73:
-#line 1174 "awkgram.y" /* yacc.c:1646 */
+#line 1223 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *casestmt = (yyvsp[0]);
if ((yyvsp[0]) == NULL)
@@ -3035,11 +3084,11 @@ regular_print:
bcfree((yyvsp[-2]));
(yyval) = (yyvsp[-4]);
}
-#line 3039 "awkgram.c" /* yacc.c:1646 */
+#line 3088 "awkgram.c" /* yacc.c:1646 */
break;
case 74:
-#line 1186 "awkgram.y" /* yacc.c:1646 */
+#line 1235 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *casestmt = (yyvsp[0]);
if ((yyvsp[0]) == NULL)
@@ -3050,17 +3099,17 @@ regular_print:
(yyvsp[-3])->case_stmt = casestmt;
(yyval) = (yyvsp[-3]);
}
-#line 3054 "awkgram.c" /* yacc.c:1646 */
+#line 3103 "awkgram.c" /* yacc.c:1646 */
break;
case 75:
-#line 1200 "awkgram.y" /* yacc.c:1646 */
+#line 1249 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3060 "awkgram.c" /* yacc.c:1646 */
+#line 3109 "awkgram.c" /* yacc.c:1646 */
break;
case 76:
-#line 1202 "awkgram.y" /* yacc.c:1646 */
+#line 1251 "awkgram.y" /* yacc.c:1646 */
{
NODE *n = (yyvsp[0])->memory;
(void) force_number(n);
@@ -3068,26 +3117,26 @@ regular_print:
bcfree((yyvsp[-1]));
(yyval) = (yyvsp[0]);
}
-#line 3072 "awkgram.c" /* yacc.c:1646 */
+#line 3121 "awkgram.c" /* yacc.c:1646 */
break;
case 77:
-#line 1210 "awkgram.y" /* yacc.c:1646 */
+#line 1259 "awkgram.y" /* yacc.c:1646 */
{
bcfree((yyvsp[-1]));
(yyval) = (yyvsp[0]);
}
-#line 3081 "awkgram.c" /* yacc.c:1646 */
+#line 3130 "awkgram.c" /* yacc.c:1646 */
break;
case 78:
-#line 1215 "awkgram.y" /* yacc.c:1646 */
+#line 1264 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3087 "awkgram.c" /* yacc.c:1646 */
+#line 3136 "awkgram.c" /* yacc.c:1646 */
break;
case 79:
-#line 1217 "awkgram.y" /* yacc.c:1646 */
+#line 1266 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0])->memory->type == Node_regex)
(yyvsp[0])->opcode = Op_push_re;
@@ -3095,57 +3144,57 @@ regular_print:
(yyvsp[0])->opcode = Op_push;
(yyval) = (yyvsp[0]);
}
-#line 3099 "awkgram.c" /* yacc.c:1646 */
+#line 3148 "awkgram.c" /* yacc.c:1646 */
break;
case 80:
-#line 1225 "awkgram.y" /* yacc.c:1646 */
+#line 1274 "awkgram.y" /* yacc.c:1646 */
{
assert((yyvsp[0])->memory->type == Node_typedregex);
(yyvsp[0])->opcode = Op_push_re;
(yyval) = (yyvsp[0]);
}
-#line 3109 "awkgram.c" /* yacc.c:1646 */
+#line 3158 "awkgram.c" /* yacc.c:1646 */
break;
case 81:
-#line 1234 "awkgram.y" /* yacc.c:1646 */
+#line 1283 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3115 "awkgram.c" /* yacc.c:1646 */
+#line 3164 "awkgram.c" /* yacc.c:1646 */
break;
case 82:
-#line 1236 "awkgram.y" /* yacc.c:1646 */
+#line 1285 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3121 "awkgram.c" /* yacc.c:1646 */
+#line 3170 "awkgram.c" /* yacc.c:1646 */
break;
case 84:
-#line 1246 "awkgram.y" /* yacc.c:1646 */
+#line 1295 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = (yyvsp[-1]);
}
-#line 3129 "awkgram.c" /* yacc.c:1646 */
+#line 3178 "awkgram.c" /* yacc.c:1646 */
break;
case 85:
-#line 1253 "awkgram.y" /* yacc.c:1646 */
+#line 1302 "awkgram.y" /* yacc.c:1646 */
{
in_print = false;
in_parens = 0;
(yyval) = NULL;
}
-#line 3139 "awkgram.c" /* yacc.c:1646 */
+#line 3188 "awkgram.c" /* yacc.c:1646 */
break;
case 86:
-#line 1258 "awkgram.y" /* yacc.c:1646 */
+#line 1307 "awkgram.y" /* yacc.c:1646 */
{ in_print = false; in_parens = 0; }
-#line 3145 "awkgram.c" /* yacc.c:1646 */
+#line 3194 "awkgram.c" /* yacc.c:1646 */
break;
case 87:
-#line 1259 "awkgram.y" /* yacc.c:1646 */
+#line 1308 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2])->redir_type == redirect_twoway
&& (yyvsp[0])->lasti->opcode == Op_K_getline_redir
@@ -3153,63 +3202,63 @@ regular_print:
yyerror(_("multistage two-way pipelines don't work"));
(yyval) = list_prepend((yyvsp[0]), (yyvsp[-2]));
}
-#line 3157 "awkgram.c" /* yacc.c:1646 */
+#line 3206 "awkgram.c" /* yacc.c:1646 */
break;
case 88:
-#line 1270 "awkgram.y" /* yacc.c:1646 */
+#line 1319 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_condition((yyvsp[-3]), (yyvsp[-5]), (yyvsp[0]), NULL, NULL);
}
-#line 3165 "awkgram.c" /* yacc.c:1646 */
+#line 3214 "awkgram.c" /* yacc.c:1646 */
break;
case 89:
-#line 1275 "awkgram.y" /* yacc.c:1646 */
+#line 1324 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_condition((yyvsp[-6]), (yyvsp[-8]), (yyvsp[-3]), (yyvsp[-2]), (yyvsp[0]));
}
-#line 3173 "awkgram.c" /* yacc.c:1646 */
+#line 3222 "awkgram.c" /* yacc.c:1646 */
break;
case 94:
-#line 1292 "awkgram.y" /* yacc.c:1646 */
+#line 1341 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3179 "awkgram.c" /* yacc.c:1646 */
+#line 3228 "awkgram.c" /* yacc.c:1646 */
break;
case 95:
-#line 1294 "awkgram.y" /* yacc.c:1646 */
+#line 1343 "awkgram.y" /* yacc.c:1646 */
{
bcfree((yyvsp[-1]));
(yyval) = (yyvsp[0]);
}
-#line 3188 "awkgram.c" /* yacc.c:1646 */
+#line 3237 "awkgram.c" /* yacc.c:1646 */
break;
case 96:
-#line 1302 "awkgram.y" /* yacc.c:1646 */
+#line 1351 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3194 "awkgram.c" /* yacc.c:1646 */
+#line 3243 "awkgram.c" /* yacc.c:1646 */
break;
case 97:
-#line 1304 "awkgram.y" /* yacc.c:1646 */
+#line 1353 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3200 "awkgram.c" /* yacc.c:1646 */
+#line 3249 "awkgram.c" /* yacc.c:1646 */
break;
case 98:
-#line 1309 "awkgram.y" /* yacc.c:1646 */
+#line 1358 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->param_count = 0;
(yyval) = list_create((yyvsp[0]));
}
-#line 3209 "awkgram.c" /* yacc.c:1646 */
+#line 3258 "awkgram.c" /* yacc.c:1646 */
break;
case 99:
-#line 1314 "awkgram.y" /* yacc.c:1646 */
+#line 1363 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2]) != NULL && (yyvsp[0]) != NULL) {
(yyvsp[0])->param_count = (yyvsp[-2])->lasti->param_count + 1;
@@ -3218,74 +3267,74 @@ regular_print:
} else
(yyval) = NULL;
}
-#line 3222 "awkgram.c" /* yacc.c:1646 */
+#line 3271 "awkgram.c" /* yacc.c:1646 */
break;
case 100:
-#line 1323 "awkgram.y" /* yacc.c:1646 */
+#line 1372 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3228 "awkgram.c" /* yacc.c:1646 */
+#line 3277 "awkgram.c" /* yacc.c:1646 */
break;
case 101:
-#line 1325 "awkgram.y" /* yacc.c:1646 */
+#line 1374 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3234 "awkgram.c" /* yacc.c:1646 */
+#line 3283 "awkgram.c" /* yacc.c:1646 */
break;
case 102:
-#line 1327 "awkgram.y" /* yacc.c:1646 */
+#line 1376 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-2]); }
-#line 3240 "awkgram.c" /* yacc.c:1646 */
+#line 3289 "awkgram.c" /* yacc.c:1646 */
break;
case 103:
-#line 1333 "awkgram.y" /* yacc.c:1646 */
+#line 1382 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3246 "awkgram.c" /* yacc.c:1646 */
+#line 3295 "awkgram.c" /* yacc.c:1646 */
break;
case 104:
-#line 1335 "awkgram.y" /* yacc.c:1646 */
+#line 1384 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3252 "awkgram.c" /* yacc.c:1646 */
+#line 3301 "awkgram.c" /* yacc.c:1646 */
break;
case 105:
-#line 1340 "awkgram.y" /* yacc.c:1646 */
+#line 1389 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3258 "awkgram.c" /* yacc.c:1646 */
+#line 3307 "awkgram.c" /* yacc.c:1646 */
break;
case 106:
-#line 1342 "awkgram.y" /* yacc.c:1646 */
+#line 1391 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3264 "awkgram.c" /* yacc.c:1646 */
+#line 3313 "awkgram.c" /* yacc.c:1646 */
break;
case 107:
-#line 1347 "awkgram.y" /* yacc.c:1646 */
+#line 1396 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_expression_list(NULL, (yyvsp[0])); }
-#line 3270 "awkgram.c" /* yacc.c:1646 */
+#line 3319 "awkgram.c" /* yacc.c:1646 */
break;
case 108:
-#line 1349 "awkgram.y" /* yacc.c:1646 */
+#line 1398 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
yyerrok;
}
-#line 3279 "awkgram.c" /* yacc.c:1646 */
+#line 3328 "awkgram.c" /* yacc.c:1646 */
break;
case 109:
-#line 1354 "awkgram.y" /* yacc.c:1646 */
+#line 1403 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3285 "awkgram.c" /* yacc.c:1646 */
+#line 3334 "awkgram.c" /* yacc.c:1646 */
break;
case 110:
-#line 1356 "awkgram.y" /* yacc.c:1646 */
+#line 1405 "awkgram.y" /* yacc.c:1646 */
{
/*
* Returning the expression list instead of NULL lets
@@ -3293,62 +3342,62 @@ regular_print:
*/
(yyval) = (yyvsp[-1]);
}
-#line 3297 "awkgram.c" /* yacc.c:1646 */
+#line 3346 "awkgram.c" /* yacc.c:1646 */
break;
case 111:
-#line 1364 "awkgram.y" /* yacc.c:1646 */
+#line 1413 "awkgram.y" /* yacc.c:1646 */
{
/* Ditto */
(yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
}
-#line 3306 "awkgram.c" /* yacc.c:1646 */
+#line 3355 "awkgram.c" /* yacc.c:1646 */
break;
case 112:
-#line 1369 "awkgram.y" /* yacc.c:1646 */
+#line 1418 "awkgram.y" /* yacc.c:1646 */
{
/* Ditto */
(yyval) = (yyvsp[-2]);
}
-#line 3315 "awkgram.c" /* yacc.c:1646 */
+#line 3364 "awkgram.c" /* yacc.c:1646 */
break;
case 113:
-#line 1377 "awkgram.y" /* yacc.c:1646 */
+#line 1426 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3321 "awkgram.c" /* yacc.c:1646 */
+#line 3370 "awkgram.c" /* yacc.c:1646 */
break;
case 114:
-#line 1379 "awkgram.y" /* yacc.c:1646 */
+#line 1428 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3327 "awkgram.c" /* yacc.c:1646 */
+#line 3376 "awkgram.c" /* yacc.c:1646 */
break;
case 115:
-#line 1384 "awkgram.y" /* yacc.c:1646 */
+#line 1433 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_expression_list(NULL, (yyvsp[0])); }
-#line 3333 "awkgram.c" /* yacc.c:1646 */
+#line 3382 "awkgram.c" /* yacc.c:1646 */
break;
case 116:
-#line 1386 "awkgram.y" /* yacc.c:1646 */
+#line 1435 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
yyerrok;
}
-#line 3342 "awkgram.c" /* yacc.c:1646 */
+#line 3391 "awkgram.c" /* yacc.c:1646 */
break;
case 117:
-#line 1391 "awkgram.y" /* yacc.c:1646 */
+#line 1440 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3348 "awkgram.c" /* yacc.c:1646 */
+#line 3397 "awkgram.c" /* yacc.c:1646 */
break;
case 118:
-#line 1393 "awkgram.y" /* yacc.c:1646 */
+#line 1442 "awkgram.y" /* yacc.c:1646 */
{
/*
* Returning the expression list instead of NULL lets
@@ -3356,72 +3405,72 @@ regular_print:
*/
(yyval) = (yyvsp[-1]);
}
-#line 3360 "awkgram.c" /* yacc.c:1646 */
+#line 3409 "awkgram.c" /* yacc.c:1646 */
break;
case 119:
-#line 1401 "awkgram.y" /* yacc.c:1646 */
+#line 1450 "awkgram.y" /* yacc.c:1646 */
{
/* Ditto */
(yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
}
-#line 3369 "awkgram.c" /* yacc.c:1646 */
+#line 3418 "awkgram.c" /* yacc.c:1646 */
break;
case 120:
-#line 1406 "awkgram.y" /* yacc.c:1646 */
+#line 1455 "awkgram.y" /* yacc.c:1646 */
{
/* Ditto */
(yyval) = (yyvsp[-2]);
}
-#line 3378 "awkgram.c" /* yacc.c:1646 */
+#line 3427 "awkgram.c" /* yacc.c:1646 */
break;
case 121:
-#line 1413 "awkgram.y" /* yacc.c:1646 */
+#line 1462 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3384 "awkgram.c" /* yacc.c:1646 */
+#line 3433 "awkgram.c" /* yacc.c:1646 */
break;
case 122:
-#line 1414 "awkgram.y" /* yacc.c:1646 */
+#line 1463 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = list_create((yyvsp[0])); }
-#line 3390 "awkgram.c" /* yacc.c:1646 */
+#line 3439 "awkgram.c" /* yacc.c:1646 */
break;
case 123:
-#line 1420 "awkgram.y" /* yacc.c:1646 */
+#line 1469 "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 3401 "awkgram.c" /* yacc.c:1646 */
+#line 3450 "awkgram.c" /* yacc.c:1646 */
break;
case 124:
-#line 1427 "awkgram.y" /* yacc.c:1646 */
+#line 1476 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_assignment((yyvsp[-2]), list_create((yyvsp[0])), (yyvsp[-1]));
}
-#line 3409 "awkgram.c" /* yacc.c:1646 */
+#line 3458 "awkgram.c" /* yacc.c:1646 */
break;
case 125:
-#line 1431 "awkgram.y" /* yacc.c:1646 */
+#line 1480 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_boolean((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3415 "awkgram.c" /* yacc.c:1646 */
+#line 3464 "awkgram.c" /* yacc.c:1646 */
break;
case 126:
-#line 1433 "awkgram.y" /* yacc.c:1646 */
+#line 1482 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_boolean((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3421 "awkgram.c" /* yacc.c:1646 */
+#line 3470 "awkgram.c" /* yacc.c:1646 */
break;
case 127:
-#line 1435 "awkgram.y" /* yacc.c:1646 */
+#line 1484 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2])->lasti->opcode == Op_match_rec)
warning_ln((yyvsp[-1])->source_line,
@@ -3434,11 +3483,11 @@ regular_print:
bcfree((yyvsp[0]));
(yyval) = list_append((yyvsp[-2]), (yyvsp[-1]));
}
-#line 3438 "awkgram.c" /* yacc.c:1646 */
+#line 3487 "awkgram.c" /* yacc.c:1646 */
break;
case 128:
-#line 1448 "awkgram.y" /* yacc.c:1646 */
+#line 1497 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2])->lasti->opcode == Op_match_rec)
warning_ln((yyvsp[-1])->source_line,
@@ -3455,11 +3504,11 @@ regular_print:
(yyval) = list_append(list_merge((yyvsp[-2]), (yyvsp[0])), (yyvsp[-1]));
}
}
-#line 3459 "awkgram.c" /* yacc.c:1646 */
+#line 3508 "awkgram.c" /* yacc.c:1646 */
break;
case 129:
-#line 1465 "awkgram.y" /* yacc.c:1646 */
+#line 1514 "awkgram.y" /* yacc.c:1646 */
{
if (do_lint_old)
warning_ln((yyvsp[-1])->source_line,
@@ -3469,91 +3518,91 @@ regular_print:
(yyvsp[-1])->expr_count = 1;
(yyval) = list_append(list_merge((yyvsp[-2]), (yyvsp[0])), (yyvsp[-1]));
}
-#line 3473 "awkgram.c" /* yacc.c:1646 */
+#line 3522 "awkgram.c" /* yacc.c:1646 */
break;
case 130:
-#line 1475 "awkgram.y" /* yacc.c:1646 */
+#line 1524 "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 3484 "awkgram.c" /* yacc.c:1646 */
+#line 3533 "awkgram.c" /* yacc.c:1646 */
break;
case 131:
-#line 1482 "awkgram.y" /* yacc.c:1646 */
+#line 1531 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_condition((yyvsp[-4]), (yyvsp[-3]), (yyvsp[-2]), (yyvsp[-1]), (yyvsp[0])); }
-#line 3490 "awkgram.c" /* yacc.c:1646 */
+#line 3539 "awkgram.c" /* yacc.c:1646 */
break;
case 132:
-#line 1484 "awkgram.y" /* yacc.c:1646 */
+#line 1533 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3496 "awkgram.c" /* yacc.c:1646 */
+#line 3545 "awkgram.c" /* yacc.c:1646 */
break;
case 133:
-#line 1489 "awkgram.y" /* yacc.c:1646 */
+#line 1538 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3502 "awkgram.c" /* yacc.c:1646 */
+#line 3551 "awkgram.c" /* yacc.c:1646 */
break;
case 134:
-#line 1491 "awkgram.y" /* yacc.c:1646 */
+#line 1540 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3508 "awkgram.c" /* yacc.c:1646 */
+#line 3557 "awkgram.c" /* yacc.c:1646 */
break;
case 135:
-#line 1493 "awkgram.y" /* yacc.c:1646 */
+#line 1542 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_assign_quotient;
(yyval) = (yyvsp[0]);
}
-#line 3517 "awkgram.c" /* yacc.c:1646 */
+#line 3566 "awkgram.c" /* yacc.c:1646 */
break;
case 136:
-#line 1501 "awkgram.y" /* yacc.c:1646 */
+#line 1550 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3523 "awkgram.c" /* yacc.c:1646 */
+#line 3572 "awkgram.c" /* yacc.c:1646 */
break;
case 137:
-#line 1503 "awkgram.y" /* yacc.c:1646 */
+#line 1552 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3529 "awkgram.c" /* yacc.c:1646 */
+#line 3578 "awkgram.c" /* yacc.c:1646 */
break;
case 138:
-#line 1508 "awkgram.y" /* yacc.c:1646 */
+#line 1557 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3535 "awkgram.c" /* yacc.c:1646 */
+#line 3584 "awkgram.c" /* yacc.c:1646 */
break;
case 139:
-#line 1510 "awkgram.y" /* yacc.c:1646 */
+#line 1559 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3541 "awkgram.c" /* yacc.c:1646 */
+#line 3590 "awkgram.c" /* yacc.c:1646 */
break;
case 140:
-#line 1515 "awkgram.y" /* yacc.c:1646 */
+#line 1564 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3547 "awkgram.c" /* yacc.c:1646 */
+#line 3596 "awkgram.c" /* yacc.c:1646 */
break;
case 141:
-#line 1517 "awkgram.y" /* yacc.c:1646 */
+#line 1566 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3553 "awkgram.c" /* yacc.c:1646 */
+#line 3602 "awkgram.c" /* yacc.c:1646 */
break;
case 142:
-#line 1519 "awkgram.y" /* yacc.c:1646 */
+#line 1568 "awkgram.y" /* yacc.c:1646 */
{
int count = 2;
bool is_simple_var = false;
@@ -3606,47 +3655,47 @@ regular_print:
max_args = count;
}
}
-#line 3610 "awkgram.c" /* yacc.c:1646 */
+#line 3659 "awkgram.c" /* yacc.c:1646 */
break;
case 144:
-#line 1577 "awkgram.y" /* yacc.c:1646 */
+#line 1626 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3616 "awkgram.c" /* yacc.c:1646 */
+#line 3665 "awkgram.c" /* yacc.c:1646 */
break;
case 145:
-#line 1579 "awkgram.y" /* yacc.c:1646 */
+#line 1628 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3622 "awkgram.c" /* yacc.c:1646 */
+#line 3671 "awkgram.c" /* yacc.c:1646 */
break;
case 146:
-#line 1581 "awkgram.y" /* yacc.c:1646 */
+#line 1630 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3628 "awkgram.c" /* yacc.c:1646 */
+#line 3677 "awkgram.c" /* yacc.c:1646 */
break;
case 147:
-#line 1583 "awkgram.y" /* yacc.c:1646 */
+#line 1632 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3634 "awkgram.c" /* yacc.c:1646 */
+#line 3683 "awkgram.c" /* yacc.c:1646 */
break;
case 148:
-#line 1585 "awkgram.y" /* yacc.c:1646 */
+#line 1634 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3640 "awkgram.c" /* yacc.c:1646 */
+#line 3689 "awkgram.c" /* yacc.c:1646 */
break;
case 149:
-#line 1587 "awkgram.y" /* yacc.c:1646 */
+#line 1636 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3646 "awkgram.c" /* yacc.c:1646 */
+#line 3695 "awkgram.c" /* yacc.c:1646 */
break;
case 150:
-#line 1589 "awkgram.y" /* yacc.c:1646 */
+#line 1638 "awkgram.y" /* yacc.c:1646 */
{
/*
* In BEGINFILE/ENDFILE, allow `getline [var] < file'
@@ -3660,29 +3709,29 @@ regular_print:
_("non-redirected `getline' undefined inside END action"));
(yyval) = mk_getline((yyvsp[-2]), (yyvsp[-1]), (yyvsp[0]), redirect_input);
}
-#line 3664 "awkgram.c" /* yacc.c:1646 */
+#line 3713 "awkgram.c" /* yacc.c:1646 */
break;
case 151:
-#line 1603 "awkgram.y" /* yacc.c:1646 */
+#line 1652 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postincrement;
(yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
}
-#line 3673 "awkgram.c" /* yacc.c:1646 */
+#line 3722 "awkgram.c" /* yacc.c:1646 */
break;
case 152:
-#line 1608 "awkgram.y" /* yacc.c:1646 */
+#line 1657 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postdecrement;
(yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
}
-#line 3682 "awkgram.c" /* yacc.c:1646 */
+#line 3731 "awkgram.c" /* yacc.c:1646 */
break;
case 153:
-#line 1613 "awkgram.y" /* yacc.c:1646 */
+#line 1662 "awkgram.y" /* yacc.c:1646 */
{
if (do_lint_old) {
warning_ln((yyvsp[-1])->source_line,
@@ -3702,64 +3751,64 @@ regular_print:
(yyval) = list_append(list_merge(t, (yyvsp[0])), (yyvsp[-1]));
}
}
-#line 3706 "awkgram.c" /* yacc.c:1646 */
+#line 3755 "awkgram.c" /* yacc.c:1646 */
break;
case 154:
-#line 1638 "awkgram.y" /* yacc.c:1646 */
+#line 1687 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_getline((yyvsp[-1]), (yyvsp[0]), (yyvsp[-3]), (yyvsp[-2])->redir_type);
bcfree((yyvsp[-2]));
}
-#line 3715 "awkgram.c" /* yacc.c:1646 */
+#line 3764 "awkgram.c" /* yacc.c:1646 */
break;
case 155:
-#line 1644 "awkgram.y" /* yacc.c:1646 */
+#line 1693 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3721 "awkgram.c" /* yacc.c:1646 */
+#line 3770 "awkgram.c" /* yacc.c:1646 */
break;
case 156:
-#line 1646 "awkgram.y" /* yacc.c:1646 */
+#line 1695 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3727 "awkgram.c" /* yacc.c:1646 */
+#line 3776 "awkgram.c" /* yacc.c:1646 */
break;
case 157:
-#line 1648 "awkgram.y" /* yacc.c:1646 */
+#line 1697 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3733 "awkgram.c" /* yacc.c:1646 */
+#line 3782 "awkgram.c" /* yacc.c:1646 */
break;
case 158:
-#line 1650 "awkgram.y" /* yacc.c:1646 */
+#line 1699 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3739 "awkgram.c" /* yacc.c:1646 */
+#line 3788 "awkgram.c" /* yacc.c:1646 */
break;
case 159:
-#line 1652 "awkgram.y" /* yacc.c:1646 */
+#line 1701 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3745 "awkgram.c" /* yacc.c:1646 */
+#line 3794 "awkgram.c" /* yacc.c:1646 */
break;
case 160:
-#line 1654 "awkgram.y" /* yacc.c:1646 */
+#line 1703 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3751 "awkgram.c" /* yacc.c:1646 */
+#line 3800 "awkgram.c" /* yacc.c:1646 */
break;
case 161:
-#line 1659 "awkgram.y" /* yacc.c:1646 */
+#line 1708 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_create((yyvsp[0]));
}
-#line 3759 "awkgram.c" /* yacc.c:1646 */
+#line 3808 "awkgram.c" /* yacc.c:1646 */
break;
case 162:
-#line 1663 "awkgram.y" /* yacc.c:1646 */
+#line 1712 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0])->opcode == Op_match_rec) {
(yyvsp[0])->opcode = Op_nomatch;
@@ -3791,37 +3840,37 @@ regular_print:
}
}
}
-#line 3795 "awkgram.c" /* yacc.c:1646 */
+#line 3844 "awkgram.c" /* yacc.c:1646 */
break;
case 163:
-#line 1695 "awkgram.y" /* yacc.c:1646 */
+#line 1744 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3801 "awkgram.c" /* yacc.c:1646 */
+#line 3850 "awkgram.c" /* yacc.c:1646 */
break;
case 164:
-#line 1697 "awkgram.y" /* yacc.c:1646 */
+#line 1746 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = snode((yyvsp[-1]), (yyvsp[-3]));
if ((yyval) == NULL)
YYABORT;
}
-#line 3811 "awkgram.c" /* yacc.c:1646 */
+#line 3860 "awkgram.c" /* yacc.c:1646 */
break;
case 165:
-#line 1703 "awkgram.y" /* yacc.c:1646 */
+#line 1752 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = snode((yyvsp[-1]), (yyvsp[-3]));
if ((yyval) == NULL)
YYABORT;
}
-#line 3821 "awkgram.c" /* yacc.c:1646 */
+#line 3870 "awkgram.c" /* yacc.c:1646 */
break;
case 166:
-#line 1709 "awkgram.y" /* yacc.c:1646 */
+#line 1758 "awkgram.y" /* yacc.c:1646 */
{
static bool warned = false;
@@ -3834,45 +3883,45 @@ regular_print:
if ((yyval) == NULL)
YYABORT;
}
-#line 3838 "awkgram.c" /* yacc.c:1646 */
+#line 3887 "awkgram.c" /* yacc.c:1646 */
break;
case 169:
-#line 1724 "awkgram.y" /* yacc.c:1646 */
+#line 1773 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[-1])->opcode = Op_preincrement;
(yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1]));
}
-#line 3847 "awkgram.c" /* yacc.c:1646 */
+#line 3896 "awkgram.c" /* yacc.c:1646 */
break;
case 170:
-#line 1729 "awkgram.y" /* yacc.c:1646 */
+#line 1778 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[-1])->opcode = Op_predecrement;
(yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1]));
}
-#line 3856 "awkgram.c" /* yacc.c:1646 */
+#line 3905 "awkgram.c" /* yacc.c:1646 */
break;
case 171:
-#line 1734 "awkgram.y" /* yacc.c:1646 */
+#line 1783 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_create((yyvsp[0]));
}
-#line 3864 "awkgram.c" /* yacc.c:1646 */
+#line 3913 "awkgram.c" /* yacc.c:1646 */
break;
case 172:
-#line 1738 "awkgram.y" /* yacc.c:1646 */
+#line 1787 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_create((yyvsp[0]));
}
-#line 3872 "awkgram.c" /* yacc.c:1646 */
+#line 3921 "awkgram.c" /* yacc.c:1646 */
break;
case 173:
-#line 1742 "awkgram.y" /* yacc.c:1646 */
+#line 1791 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0])->lasti->opcode == Op_push_i
&& ((yyvsp[0])->lasti->memory->flags & (STRCUR|STRING)) == 0
@@ -3887,11 +3936,11 @@ regular_print:
(yyval) = list_append((yyvsp[0]), (yyvsp[-1]));
}
}
-#line 3891 "awkgram.c" /* yacc.c:1646 */
+#line 3940 "awkgram.c" /* yacc.c:1646 */
break;
case 174:
-#line 1757 "awkgram.y" /* yacc.c:1646 */
+#line 1806 "awkgram.y" /* yacc.c:1646 */
{
/*
* was: $$ = $2
@@ -3901,20 +3950,20 @@ regular_print:
(yyvsp[-1])->memory = make_number(0.0);
(yyval) = list_append((yyvsp[0]), (yyvsp[-1]));
}
-#line 3905 "awkgram.c" /* yacc.c:1646 */
+#line 3954 "awkgram.c" /* yacc.c:1646 */
break;
case 175:
-#line 1770 "awkgram.y" /* yacc.c:1646 */
+#line 1819 "awkgram.y" /* yacc.c:1646 */
{
func_use((yyvsp[0])->lasti->func_name, FUNC_USE);
(yyval) = (yyvsp[0]);
}
-#line 3914 "awkgram.c" /* yacc.c:1646 */
+#line 3963 "awkgram.c" /* yacc.c:1646 */
break;
case 176:
-#line 1775 "awkgram.y" /* yacc.c:1646 */
+#line 1824 "awkgram.y" /* yacc.c:1646 */
{
/* indirect function call */
INSTRUCTION *f, *t;
@@ -3948,11 +3997,11 @@ regular_print:
(yyval) = list_prepend((yyvsp[0]), t);
at_seen = false;
}
-#line 3952 "awkgram.c" /* yacc.c:1646 */
+#line 4001 "awkgram.c" /* yacc.c:1646 */
break;
case 177:
-#line 1812 "awkgram.y" /* yacc.c:1646 */
+#line 1861 "awkgram.y" /* yacc.c:1646 */
{
NODE *n;
@@ -3977,49 +4026,49 @@ regular_print:
(yyval) = list_append(t, (yyvsp[-3]));
}
}
-#line 3981 "awkgram.c" /* yacc.c:1646 */
+#line 4030 "awkgram.c" /* yacc.c:1646 */
break;
case 178:
-#line 1840 "awkgram.y" /* yacc.c:1646 */
+#line 1889 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3987 "awkgram.c" /* yacc.c:1646 */
+#line 4036 "awkgram.c" /* yacc.c:1646 */
break;
case 179:
-#line 1842 "awkgram.y" /* yacc.c:1646 */
+#line 1891 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3993 "awkgram.c" /* yacc.c:1646 */
+#line 4042 "awkgram.c" /* yacc.c:1646 */
break;
case 180:
-#line 1847 "awkgram.y" /* yacc.c:1646 */
+#line 1896 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3999 "awkgram.c" /* yacc.c:1646 */
+#line 4048 "awkgram.c" /* yacc.c:1646 */
break;
case 181:
-#line 1849 "awkgram.y" /* yacc.c:1646 */
+#line 1898 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 4005 "awkgram.c" /* yacc.c:1646 */
+#line 4054 "awkgram.c" /* yacc.c:1646 */
break;
case 182:
-#line 1854 "awkgram.y" /* yacc.c:1646 */
+#line 1903 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 4011 "awkgram.c" /* yacc.c:1646 */
+#line 4060 "awkgram.c" /* yacc.c:1646 */
break;
case 183:
-#line 1856 "awkgram.y" /* yacc.c:1646 */
+#line 1905 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
}
-#line 4019 "awkgram.c" /* yacc.c:1646 */
+#line 4068 "awkgram.c" /* yacc.c:1646 */
break;
case 184:
-#line 1863 "awkgram.y" /* yacc.c:1646 */
+#line 1912 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip = (yyvsp[0])->lasti;
int count = ip->sub_count; /* # of SUBSEP-seperated expressions */
@@ -4033,11 +4082,11 @@ regular_print:
sub_counter++; /* count # of dimensions */
(yyval) = (yyvsp[0]);
}
-#line 4037 "awkgram.c" /* yacc.c:1646 */
+#line 4086 "awkgram.c" /* yacc.c:1646 */
break;
case 185:
-#line 1880 "awkgram.y" /* yacc.c:1646 */
+#line 1929 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *t = (yyvsp[-1]);
if ((yyvsp[-1]) == NULL) {
@@ -4051,31 +4100,31 @@ regular_print:
(yyvsp[0])->sub_count = count_expressions(&t, false);
(yyval) = list_append(t, (yyvsp[0]));
}
-#line 4055 "awkgram.c" /* yacc.c:1646 */
+#line 4104 "awkgram.c" /* yacc.c:1646 */
break;
case 186:
-#line 1897 "awkgram.y" /* yacc.c:1646 */
+#line 1946 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 4061 "awkgram.c" /* yacc.c:1646 */
+#line 4110 "awkgram.c" /* yacc.c:1646 */
break;
case 187:
-#line 1899 "awkgram.y" /* yacc.c:1646 */
+#line 1948 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
}
-#line 4069 "awkgram.c" /* yacc.c:1646 */
+#line 4118 "awkgram.c" /* yacc.c:1646 */
break;
case 188:
-#line 1906 "awkgram.y" /* yacc.c:1646 */
+#line 1955 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 4075 "awkgram.c" /* yacc.c:1646 */
+#line 4124 "awkgram.c" /* yacc.c:1646 */
break;
case 189:
-#line 1911 "awkgram.y" /* yacc.c:1646 */
+#line 1960 "awkgram.y" /* yacc.c:1646 */
{
char *var_name = (yyvsp[0])->lextok;
@@ -4083,22 +4132,22 @@ regular_print:
(yyvsp[0])->memory = variable((yyvsp[0])->source_line, var_name, Node_var_new);
(yyval) = list_create((yyvsp[0]));
}
-#line 4087 "awkgram.c" /* yacc.c:1646 */
+#line 4136 "awkgram.c" /* yacc.c:1646 */
break;
case 190:
-#line 1919 "awkgram.y" /* yacc.c:1646 */
+#line 1968 "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 4098 "awkgram.c" /* yacc.c:1646 */
+#line 4147 "awkgram.c" /* yacc.c:1646 */
break;
case 191:
-#line 1929 "awkgram.y" /* yacc.c:1646 */
+#line 1978 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip = (yyvsp[0])->nexti;
if (ip->opcode == Op_push
@@ -4110,73 +4159,73 @@ regular_print:
} else
(yyval) = (yyvsp[0]);
}
-#line 4114 "awkgram.c" /* yacc.c:1646 */
+#line 4163 "awkgram.c" /* yacc.c:1646 */
break;
case 192:
-#line 1941 "awkgram.y" /* yacc.c:1646 */
+#line 1990 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_append((yyvsp[-1]), (yyvsp[-2]));
if ((yyvsp[0]) != NULL)
mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
}
-#line 4124 "awkgram.c" /* yacc.c:1646 */
+#line 4173 "awkgram.c" /* yacc.c:1646 */
break;
case 193:
-#line 1950 "awkgram.y" /* yacc.c:1646 */
+#line 1999 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postincrement;
}
-#line 4132 "awkgram.c" /* yacc.c:1646 */
+#line 4181 "awkgram.c" /* yacc.c:1646 */
break;
case 194:
-#line 1954 "awkgram.y" /* yacc.c:1646 */
+#line 2003 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postdecrement;
}
-#line 4140 "awkgram.c" /* yacc.c:1646 */
+#line 4189 "awkgram.c" /* yacc.c:1646 */
break;
case 195:
-#line 1957 "awkgram.y" /* yacc.c:1646 */
+#line 2006 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 4146 "awkgram.c" /* yacc.c:1646 */
+#line 4195 "awkgram.c" /* yacc.c:1646 */
break;
case 197:
-#line 1965 "awkgram.y" /* yacc.c:1646 */
+#line 2014 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 4152 "awkgram.c" /* yacc.c:1646 */
+#line 4201 "awkgram.c" /* yacc.c:1646 */
break;
case 198:
-#line 1969 "awkgram.y" /* yacc.c:1646 */
+#line 2018 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 4158 "awkgram.c" /* yacc.c:1646 */
+#line 4207 "awkgram.c" /* yacc.c:1646 */
break;
case 201:
-#line 1978 "awkgram.y" /* yacc.c:1646 */
+#line 2027 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 4164 "awkgram.c" /* yacc.c:1646 */
+#line 4213 "awkgram.c" /* yacc.c:1646 */
break;
case 202:
-#line 1982 "awkgram.y" /* yacc.c:1646 */
+#line 2031 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); yyerrok; }
-#line 4170 "awkgram.c" /* yacc.c:1646 */
+#line 4219 "awkgram.c" /* yacc.c:1646 */
break;
case 203:
-#line 1986 "awkgram.y" /* yacc.c:1646 */
+#line 2035 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 4176 "awkgram.c" /* yacc.c:1646 */
+#line 4225 "awkgram.c" /* yacc.c:1646 */
break;
-#line 4180 "awkgram.c" /* yacc.c:1646 */
+#line 4229 "awkgram.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -4404,7 +4453,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 1988 "awkgram.y" /* yacc.c:1906 */
+#line 2037 "awkgram.y" /* yacc.c:1906 */
struct token {
@@ -5553,10 +5602,14 @@ get_comment(int flag)
tok = tokstart;
tokadd('#');
sl = sourceline;
+ char *p1;
+ char *p2;
while (true) {
while ((c = nextc(false)) != '\n' && c != END_FILE) {
- tokadd(c);
+ /* ignore \r characters */
+ if (c != '\r')
+ tokadd(c);
}
if (flag == EOL_COMMENT) {
/* comment at end of line. */
@@ -5585,6 +5638,19 @@ get_comment(int flag)
} else
break;
}
+
+ if (comment != NULL)
+ prior_comment = comment;
+
+ /* remove any trailing blank lines (consecutive \n) from comment */
+ p1 = tok - 1;
+ p2 = tok - 2;
+ while (*p1 == '\n' && *p2 == '\n') {
+ p1--;
+ p2--;
+ tok--;
+ }
+
comment = bcalloc(Op_comment, 1, sl);
comment->source_file = source;
comment->memory = make_str_node(tokstart, tok - tokstart, 0);
@@ -5602,20 +5668,20 @@ split_comment(void)
int l;
NODE *n;
- p = comment->memory->stptr;
- l = comment->memory->stlen - 3;
+ p = comment_to_save->memory->stptr;
+ l = comment_to_save->memory->stlen - 3;
/* have at least two comments so split at last blank line (\n\n) */
while (l >= 0) {
if (p[l] == '\n' && p[l+1] == '\n') {
- function_comment = comment;
+ function_comment = comment_to_save;
n = function_comment->memory;
function_comment->memory = make_str_node(p + l + 2, n->stlen - l - 2, 0);
/* create program comment */
program_comment = bcalloc(Op_comment, 1, sourceline);
- program_comment->source_file = comment->source_file;
+ program_comment->source_file = comment_to_save->source_file;
p[l + 2] = 0;
program_comment->memory = make_str_node(p, l + 2, 0);
- comment = NULL;
+ comment_to_save = NULL;
freenode(n);
break;
}
@@ -8393,6 +8459,26 @@ list_merge(INSTRUCTION *l1, INSTRUCTION *l2)
return l1;
}
+/* add_pending_comment --- add a pending comment to a statement */
+
+static inline INSTRUCTION *
+add_pending_comment(INSTRUCTION *stmt)
+{
+ INSTRUCTION *ret = stmt;
+
+ if (prior_comment != NULL) {
+ if (function_comment != prior_comment)
+ ret = list_append(stmt, prior_comment);
+ prior_comment = NULL;
+ } else if (comment != NULL && comment->memory->comment_type == EOL_COMMENT) {
+ if (function_comment != comment)
+ ret = list_append(stmt, comment);
+ comment = NULL;
+ }
+
+ return ret;
+}
+
/* See if name is a special token. */
int
diff --git a/awkgram.y b/awkgram.y
index 593eddd8..946edce7 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -151,6 +151,8 @@ static INSTRUCTION *ip_beginfile;
INSTRUCTION *main_beginfile;
static INSTRUCTION *comment = NULL;
+static INSTRUCTION *prior_comment = NULL;
+static INSTRUCTION *comment_to_save = NULL;
static INSTRUCTION *program_comment = NULL;
static INSTRUCTION *function_comment = NULL;
static INSTRUCTION *block_comment = NULL;
@@ -162,6 +164,7 @@ static inline INSTRUCTION *list_create(INSTRUCTION *x);
static inline INSTRUCTION *list_append(INSTRUCTION *l, INSTRUCTION *x);
static inline INSTRUCTION *list_prepend(INSTRUCTION *l, INSTRUCTION *x);
static inline INSTRUCTION *list_merge(INSTRUCTION *l1, INSTRUCTION *l2);
+static inline INSTRUCTION *add_pending_comment(INSTRUCTION *stmt);
extern double fmod(double x, double y);
@@ -439,13 +442,23 @@ function_prologue
* than one such comments, treat the last as a function
* comment.
*/
- if (comment != NULL && func_first
- && strstr(comment->memory->stptr, "\n\n") != NULL)
+ if (prior_comment != NULL) {
+ comment_to_save = prior_comment;
+ prior_comment = NULL;
+ } else if (comment != NULL) {
+ comment_to_save = comment;
+ comment = NULL;
+ } else
+ comment_to_save = NULL;
+
+ if (comment_to_save != NULL && func_first
+ && strstr(comment_to_save->memory->stptr, "\n\n") != NULL)
split_comment();
+
/* save any other pre-function comment as function comment */
- if (comment != NULL) {
- function_comment = comment;
- comment = NULL;
+ if (comment_to_save != NULL) {
+ function_comment = comment_to_save;
+ comment_to_save = NULL;
}
func_first = false;
$1->source_file = source;
@@ -529,31 +542,54 @@ a_slash
statements
: /* empty */
{
- if (comment != NULL) {
+ if (prior_comment != NULL) {
+ $$ = list_create(prior_comment);
+ prior_comment = NULL;
+ } else if (comment != NULL) {
$$ = list_create(comment);
comment = NULL;
- } else $$ = NULL;
+ } else
+ $$ = NULL;
}
| statements statement
{
if ($2 == NULL) {
- if (comment == NULL)
- $$ = $1;
- else {
+ if (prior_comment != NULL) {
+ $$ = list_append($1, prior_comment);
+ prior_comment = NULL;
+ if (comment != NULL) {
+ $$ = list_append($$, comment);
+ comment = NULL;
+ }
+ } else if (comment != NULL) {
$$ = list_append($1, comment);
comment = NULL;
- }
+ } else
+ $$ = $1;
} else {
add_lint($2, LINT_no_effect);
if ($1 == NULL) {
- if (comment == NULL)
- $$ = $2;
- else {
+ if (prior_comment != NULL) {
+ $$ = list_append($2, prior_comment);
+ prior_comment = NULL;
+ if (comment != NULL) {
+ $$ = list_append($$, comment);
+ comment = NULL;
+ }
+ } else if (comment != NULL) {
$$ = list_append($2, comment);
comment = NULL;
- }
+ } else
+ $$ = $2;
} else {
- if (comment != NULL) {
+ if (prior_comment != NULL) {
+ list_append($2, prior_comment);
+ prior_comment = NULL;
+ if (comment != NULL) {
+ list_append($2, comment);
+ comment = NULL;
+ }
+ } else if (comment != NULL) {
list_append($2, comment);
comment = NULL;
}
@@ -890,6 +926,7 @@ regular_loop:
$$ = list_prepend($1, instruction(Op_exec_count));
else
$$ = $1;
+ $$ = add_pending_comment($$);
}
;
@@ -901,6 +938,7 @@ non_compound_stmt
_("`break' is not allowed outside a loop or switch"));
$1->target_jmp = NULL;
$$ = list_create($1);
+ $$ = add_pending_comment($$);
}
| LEX_CONTINUE statement_term
@@ -910,6 +948,7 @@ non_compound_stmt
_("`continue' is not allowed outside a loop"));
$1->target_jmp = NULL;
$$ = list_create($1);
+ $$ = add_pending_comment($$);
}
| LEX_NEXT statement_term
@@ -920,6 +959,7 @@ non_compound_stmt
_("`next' used in %s action"), ruletab[rule]);
$1->target_jmp = ip_rec;
$$ = list_create($1);
+ $$ = add_pending_comment($$);
}
| LEX_NEXTFILE statement_term
{
@@ -931,6 +971,7 @@ non_compound_stmt
$1->target_newfile = ip_newfile;
$1->target_endfile = ip_endfile;
$$ = list_create($1);
+ $$ = add_pending_comment($$);
}
| LEX_EXIT opt_exp statement_term
{
@@ -946,6 +987,7 @@ non_compound_stmt
$$->nexti->memory = dupnode(Nnull_string);
} else
$$ = list_append($2, $1);
+ $$ = add_pending_comment($$);
}
| LEX_RETURN
{
@@ -970,6 +1012,7 @@ non_compound_stmt
$$ = list_append($3, $1);
}
+ $$ = add_pending_comment($$);
}
| simple_stmt statement_term
;
@@ -1079,6 +1122,7 @@ regular_print:
}
}
}
+ $$ = add_pending_comment($$);
}
| LEX_DELETE NAME { sub_counter = 0; } delete_subscript_list
@@ -1113,6 +1157,7 @@ regular_print:
$1->expr_count = sub_counter;
$$ = list_append(list_append($4, $2), $1);
}
+ $$ = add_pending_comment($$);
}
| LEX_DELETE '(' NAME ')'
/*
@@ -1143,9 +1188,13 @@ regular_print:
else if ($3->memory == func_table)
fatal(_("`delete' is not allowed with FUNCTAB"));
}
+ $$ = add_pending_comment($$);
}
| exp
- { $$ = optimize_assignment($1); }
+ {
+ $$ = optimize_assignment($1);
+ $$ = add_pending_comment($$);
+ }
;
opt_simple_stmt
@@ -3133,10 +3182,14 @@ get_comment(int flag)
tok = tokstart;
tokadd('#');
sl = sourceline;
+ char *p1;
+ char *p2;
while (true) {
while ((c = nextc(false)) != '\n' && c != END_FILE) {
- tokadd(c);
+ /* ignore \r characters */
+ if (c != '\r')
+ tokadd(c);
}
if (flag == EOL_COMMENT) {
/* comment at end of line. */
@@ -3165,6 +3218,19 @@ get_comment(int flag)
} else
break;
}
+
+ if (comment != NULL)
+ prior_comment = comment;
+
+ /* remove any trailing blank lines (consecutive \n) from comment */
+ p1 = tok - 1;
+ p2 = tok - 2;
+ while (*p1 == '\n' && *p2 == '\n') {
+ p1--;
+ p2--;
+ tok--;
+ }
+
comment = bcalloc(Op_comment, 1, sl);
comment->source_file = source;
comment->memory = make_str_node(tokstart, tok - tokstart, 0);
@@ -3182,20 +3248,20 @@ split_comment(void)
int l;
NODE *n;
- p = comment->memory->stptr;
- l = comment->memory->stlen - 3;
+ p = comment_to_save->memory->stptr;
+ l = comment_to_save->memory->stlen - 3;
/* have at least two comments so split at last blank line (\n\n) */
while (l >= 0) {
if (p[l] == '\n' && p[l+1] == '\n') {
- function_comment = comment;
+ function_comment = comment_to_save;
n = function_comment->memory;
function_comment->memory = make_str_node(p + l + 2, n->stlen - l - 2, 0);
/* create program comment */
program_comment = bcalloc(Op_comment, 1, sourceline);
- program_comment->source_file = comment->source_file;
+ program_comment->source_file = comment_to_save->source_file;
p[l + 2] = 0;
program_comment->memory = make_str_node(p, l + 2, 0);
- comment = NULL;
+ comment_to_save = NULL;
freenode(n);
break;
}
@@ -5973,6 +6039,26 @@ list_merge(INSTRUCTION *l1, INSTRUCTION *l2)
return l1;
}
+/* add_pending_comment --- add a pending comment to a statement */
+
+static inline INSTRUCTION *
+add_pending_comment(INSTRUCTION *stmt)
+{
+ INSTRUCTION *ret = stmt;
+
+ if (prior_comment != NULL) {
+ if (function_comment != prior_comment)
+ ret = list_append(stmt, prior_comment);
+ prior_comment = NULL;
+ } else if (comment != NULL && comment->memory->comment_type == EOL_COMMENT) {
+ if (function_comment != comment)
+ ret = list_append(stmt, comment);
+ comment = NULL;
+ }
+
+ return ret;
+}
+
/* See if name is a special token. */
int
diff --git a/doc/ChangeLog b/doc/ChangeLog
index f7400d1f..68f06300 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawkinet.texi: Small update about end of line vs full
+ comments when pretty printing.
+
2016-03-21 Arnold D. Robbins <arnold@skeeve.com>
* gawkinet.texi: Update UDP client and discussion, update
diff --git a/doc/gawk.info b/doc/gawk.info
index 4e1608df..c1e44de8 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -20290,7 +20290,7 @@ without any execution counts.
profiling, and that created when pretty-printing. Pretty-printed output
preserves the original comments that were in the program, although their
placement may not correspond exactly to their original locations in the
-source code.
+source code.(1)
However, as a deliberate design decision, profiling output _omits_
the original program's comments. This allows you to focus on the
@@ -20306,6 +20306,14 @@ result as the final version of your program.
recreate an 'awk' program, profiling and pretty-printing automatically
disable 'gawk''s default optimizations.
+ ---------- Footnotes ----------
+
+ (1) 'gawk' does the best it can to preserve the distinction between
+comments at the end of a statement and comments on lines by themselves.
+Due to implementation constraints, it does not always do so correctly,
+particularly for 'switch' statements. The 'gawk' maintainers hope to
+improve this in a subsequent release.
+

File: gawk.info, Node: Advanced Features Summary, Prev: Profiling, Up: Advanced Features
@@ -35581,213 +35589,214 @@ Ref: Two-way I/O-Footnote-1813052
Ref: Two-way I/O-Footnote-2813239
Node: TCP/IP Networking813321
Node: Profiling816439
-Node: Advanced Features Summary824893
-Node: Internationalization826737
-Node: I18N and L10N828217
-Node: Explaining gettext828904
-Ref: Explaining gettext-Footnote-1833927
-Ref: Explaining gettext-Footnote-2834112
-Node: Programmer i18n834277
-Ref: Programmer i18n-Footnote-1839132
-Node: Translator i18n839181
-Node: String Extraction839975
-Ref: String Extraction-Footnote-1841107
-Node: Printf Ordering841193
-Ref: Printf Ordering-Footnote-1843979
-Node: I18N Portability844043
-Ref: I18N Portability-Footnote-1846499
-Node: I18N Example846562
-Ref: I18N Example-Footnote-1849368
-Node: Gawk I18N849441
-Node: I18N Summary850086
-Node: Debugger851427
-Node: Debugging852449
-Node: Debugging Concepts852890
-Node: Debugging Terms854699
-Node: Awk Debugging857274
-Node: Sample Debugging Session858180
-Node: Debugger Invocation858714
-Node: Finding The Bug860100
-Node: List of Debugger Commands866578
-Node: Breakpoint Control867911
-Node: Debugger Execution Control871605
-Node: Viewing And Changing Data874967
-Node: Execution Stack878341
-Node: Debugger Info879978
-Node: Miscellaneous Debugger Commands884049
-Node: Readline Support889137
-Node: Limitations890033
-Ref: Limitations-Footnote-1894264
-Node: Debugging Summary894315
-Node: Arbitrary Precision Arithmetic895594
-Node: Computer Arithmetic897010
-Ref: table-numeric-ranges900601
-Ref: Computer Arithmetic-Footnote-1901323
-Node: Math Definitions901380
-Ref: table-ieee-formats904694
-Ref: Math Definitions-Footnote-1905297
-Node: MPFR features905402
-Node: FP Math Caution907119
-Ref: FP Math Caution-Footnote-1908191
-Node: Inexactness of computations908560
-Node: Inexact representation909520
-Node: Comparing FP Values910880
-Node: Errors accumulate911962
-Node: Getting Accuracy913395
-Node: Try To Round916105
-Node: Setting precision917004
-Ref: table-predefined-precision-strings917701
-Node: Setting the rounding mode919531
-Ref: table-gawk-rounding-modes919905
-Ref: Setting the rounding mode-Footnote-1923313
-Node: Arbitrary Precision Integers923492
-Ref: Arbitrary Precision Integers-Footnote-1928409
-Node: POSIX Floating Point Problems928558
-Ref: POSIX Floating Point Problems-Footnote-1932440
-Node: Floating point summary932478
-Node: Dynamic Extensions934668
-Node: Extension Intro936221
-Node: Plugin License937487
-Node: Extension Mechanism Outline938284
-Ref: figure-load-extension938723
-Ref: figure-register-new-function940288
-Ref: figure-call-new-function941380
-Node: Extension API Description943442
-Node: Extension API Functions Introduction944974
-Node: General Data Types949833
-Ref: General Data Types-Footnote-1955788
-Node: Memory Allocation Functions956087
-Ref: Memory Allocation Functions-Footnote-1958932
-Node: Constructor Functions959031
-Node: Registration Functions960776
-Node: Extension Functions961461
-Node: Exit Callback Functions963760
-Node: Extension Version String965010
-Node: Input Parsers965673
-Node: Output Wrappers975558
-Node: Two-way processors980070
-Node: Printing Messages982334
-Ref: Printing Messages-Footnote-1983408
-Node: Updating ERRNO983561
-Node: Requesting Values984300
-Ref: table-value-types-returned985037
-Node: Accessing Parameters985920
-Node: Symbol Table Access987155
-Node: Symbol table by name987667
-Node: Symbol table by cookie989688
-Ref: Symbol table by cookie-Footnote-1993837
-Node: Cached values993901
-Ref: Cached values-Footnote-1997402
-Node: Array Manipulation997493
-Ref: Array Manipulation-Footnote-1998584
-Node: Array Data Types998621
-Ref: Array Data Types-Footnote-11001279
-Node: Array Functions1001371
-Node: Flattening Arrays1005229
-Node: Creating Arrays1012137
-Node: Redirection API1016908
-Node: Extension API Variables1019739
-Node: Extension Versioning1020372
-Node: Extension API Informational Variables1022263
-Node: Extension API Boilerplate1023327
-Node: Finding Extensions1027141
-Node: Extension Example1027700
-Node: Internal File Description1028498
-Node: Internal File Ops1032578
-Ref: Internal File Ops-Footnote-11044340
-Node: Using Internal File Ops1044480
-Ref: Using Internal File Ops-Footnote-11046863
-Node: Extension Samples1047137
-Node: Extension Sample File Functions1048666
-Node: Extension Sample Fnmatch1056315
-Node: Extension Sample Fork1057802
-Node: Extension Sample Inplace1059020
-Node: Extension Sample Ord1062230
-Node: Extension Sample Readdir1063066
-Ref: table-readdir-file-types1063955
-Node: Extension Sample Revout1064760
-Node: Extension Sample Rev2way1065349
-Node: Extension Sample Read write array1066089
-Node: Extension Sample Readfile1068031
-Node: Extension Sample Time1069126
-Node: Extension Sample API Tests1070474
-Node: gawkextlib1070966
-Node: Extension summary1073413
-Node: Extension Exercises1077105
-Node: Language History1078602
-Node: V7/SVR3.11080258
-Node: SVR41082410
-Node: POSIX1083844
-Node: BTL1085223
-Node: POSIX/GNU1085952
-Node: Feature History1091814
-Node: Common Extensions1106184
-Node: Ranges and Locales1107467
-Ref: Ranges and Locales-Footnote-11112083
-Ref: Ranges and Locales-Footnote-21112110
-Ref: Ranges and Locales-Footnote-31112345
-Node: Contributors1112566
-Node: History summary1118135
-Node: Installation1119515
-Node: Gawk Distribution1120459
-Node: Getting1120943
-Node: Extracting1121904
-Node: Distribution contents1123542
-Node: Unix Installation1129636
-Node: Quick Installation1130318
-Node: Shell Startup Files1132732
-Node: Additional Configuration Options1133810
-Node: Configuration Philosophy1135615
-Node: Non-Unix Installation1137984
-Node: PC Installation1138442
-Node: PC Binary Installation1139762
-Node: PC Compiling1141614
-Ref: PC Compiling-Footnote-11144638
-Node: PC Testing1144747
-Node: PC Using1145927
-Node: Cygwin1150041
-Node: MSYS1150811
-Node: VMS Installation1151312
-Node: VMS Compilation1152103
-Ref: VMS Compilation-Footnote-11153332
-Node: VMS Dynamic Extensions1153390
-Node: VMS Installation Details1155075
-Node: VMS Running1157328
-Node: VMS GNV1161607
-Node: VMS Old Gawk1162342
-Node: Bugs1162813
-Node: Other Versions1167010
-Node: Installation summary1173594
-Node: Notes1174652
-Node: Compatibility Mode1175517
-Node: Additions1176299
-Node: Accessing The Source1177224
-Node: Adding Code1178659
-Node: New Ports1184878
-Node: Derived Files1189366
-Ref: Derived Files-Footnote-11194851
-Ref: Derived Files-Footnote-21194886
-Ref: Derived Files-Footnote-31195484
-Node: Future Extensions1195598
-Node: Implementation Limitations1196256
-Node: Extension Design1197439
-Node: Old Extension Problems1198593
-Ref: Old Extension Problems-Footnote-11200111
-Node: Extension New Mechanism Goals1200168
-Ref: Extension New Mechanism Goals-Footnote-11203532
-Node: Extension Other Design Decisions1203721
-Node: Extension Future Growth1205834
-Node: Old Extension Mechanism1206670
-Node: Notes summary1208433
-Node: Basic Concepts1209615
-Node: Basic High Level1210296
-Ref: figure-general-flow1210578
-Ref: figure-process-flow1211263
-Ref: Basic High Level-Footnote-11214564
-Node: Basic Data Typing1214749
-Node: Glossary1218077
-Node: Copying1250023
-Node: GNU Free Documentation License1287562
-Node: Index1312680
+Ref: Profiling-Footnote-1824932
+Node: Advanced Features Summary825255
+Node: Internationalization827099
+Node: I18N and L10N828579
+Node: Explaining gettext829266
+Ref: Explaining gettext-Footnote-1834289
+Ref: Explaining gettext-Footnote-2834474
+Node: Programmer i18n834639
+Ref: Programmer i18n-Footnote-1839494
+Node: Translator i18n839543
+Node: String Extraction840337
+Ref: String Extraction-Footnote-1841469
+Node: Printf Ordering841555
+Ref: Printf Ordering-Footnote-1844341
+Node: I18N Portability844405
+Ref: I18N Portability-Footnote-1846861
+Node: I18N Example846924
+Ref: I18N Example-Footnote-1849730
+Node: Gawk I18N849803
+Node: I18N Summary850448
+Node: Debugger851789
+Node: Debugging852811
+Node: Debugging Concepts853252
+Node: Debugging Terms855061
+Node: Awk Debugging857636
+Node: Sample Debugging Session858542
+Node: Debugger Invocation859076
+Node: Finding The Bug860462
+Node: List of Debugger Commands866940
+Node: Breakpoint Control868273
+Node: Debugger Execution Control871967
+Node: Viewing And Changing Data875329
+Node: Execution Stack878703
+Node: Debugger Info880340
+Node: Miscellaneous Debugger Commands884411
+Node: Readline Support889499
+Node: Limitations890395
+Ref: Limitations-Footnote-1894626
+Node: Debugging Summary894677
+Node: Arbitrary Precision Arithmetic895956
+Node: Computer Arithmetic897372
+Ref: table-numeric-ranges900963
+Ref: Computer Arithmetic-Footnote-1901685
+Node: Math Definitions901742
+Ref: table-ieee-formats905056
+Ref: Math Definitions-Footnote-1905659
+Node: MPFR features905764
+Node: FP Math Caution907481
+Ref: FP Math Caution-Footnote-1908553
+Node: Inexactness of computations908922
+Node: Inexact representation909882
+Node: Comparing FP Values911242
+Node: Errors accumulate912324
+Node: Getting Accuracy913757
+Node: Try To Round916467
+Node: Setting precision917366
+Ref: table-predefined-precision-strings918063
+Node: Setting the rounding mode919893
+Ref: table-gawk-rounding-modes920267
+Ref: Setting the rounding mode-Footnote-1923675
+Node: Arbitrary Precision Integers923854
+Ref: Arbitrary Precision Integers-Footnote-1928771
+Node: POSIX Floating Point Problems928920
+Ref: POSIX Floating Point Problems-Footnote-1932802
+Node: Floating point summary932840
+Node: Dynamic Extensions935030
+Node: Extension Intro936583
+Node: Plugin License937849
+Node: Extension Mechanism Outline938646
+Ref: figure-load-extension939085
+Ref: figure-register-new-function940650
+Ref: figure-call-new-function941742
+Node: Extension API Description943804
+Node: Extension API Functions Introduction945336
+Node: General Data Types950195
+Ref: General Data Types-Footnote-1956150
+Node: Memory Allocation Functions956449
+Ref: Memory Allocation Functions-Footnote-1959294
+Node: Constructor Functions959393
+Node: Registration Functions961138
+Node: Extension Functions961823
+Node: Exit Callback Functions964122
+Node: Extension Version String965372
+Node: Input Parsers966035
+Node: Output Wrappers975920
+Node: Two-way processors980432
+Node: Printing Messages982696
+Ref: Printing Messages-Footnote-1983770
+Node: Updating ERRNO983923
+Node: Requesting Values984662
+Ref: table-value-types-returned985399
+Node: Accessing Parameters986282
+Node: Symbol Table Access987517
+Node: Symbol table by name988029
+Node: Symbol table by cookie990050
+Ref: Symbol table by cookie-Footnote-1994199
+Node: Cached values994263
+Ref: Cached values-Footnote-1997764
+Node: Array Manipulation997855
+Ref: Array Manipulation-Footnote-1998946
+Node: Array Data Types998983
+Ref: Array Data Types-Footnote-11001641
+Node: Array Functions1001733
+Node: Flattening Arrays1005591
+Node: Creating Arrays1012499
+Node: Redirection API1017270
+Node: Extension API Variables1020101
+Node: Extension Versioning1020734
+Node: Extension API Informational Variables1022625
+Node: Extension API Boilerplate1023689
+Node: Finding Extensions1027503
+Node: Extension Example1028062
+Node: Internal File Description1028860
+Node: Internal File Ops1032940
+Ref: Internal File Ops-Footnote-11044702
+Node: Using Internal File Ops1044842
+Ref: Using Internal File Ops-Footnote-11047225
+Node: Extension Samples1047499
+Node: Extension Sample File Functions1049028
+Node: Extension Sample Fnmatch1056677
+Node: Extension Sample Fork1058164
+Node: Extension Sample Inplace1059382
+Node: Extension Sample Ord1062592
+Node: Extension Sample Readdir1063428
+Ref: table-readdir-file-types1064317
+Node: Extension Sample Revout1065122
+Node: Extension Sample Rev2way1065711
+Node: Extension Sample Read write array1066451
+Node: Extension Sample Readfile1068393
+Node: Extension Sample Time1069488
+Node: Extension Sample API Tests1070836
+Node: gawkextlib1071328
+Node: Extension summary1073775
+Node: Extension Exercises1077467
+Node: Language History1078964
+Node: V7/SVR3.11080620
+Node: SVR41082772
+Node: POSIX1084206
+Node: BTL1085585
+Node: POSIX/GNU1086314
+Node: Feature History1092176
+Node: Common Extensions1106546
+Node: Ranges and Locales1107829
+Ref: Ranges and Locales-Footnote-11112445
+Ref: Ranges and Locales-Footnote-21112472
+Ref: Ranges and Locales-Footnote-31112707
+Node: Contributors1112928
+Node: History summary1118497
+Node: Installation1119877
+Node: Gawk Distribution1120821
+Node: Getting1121305
+Node: Extracting1122266
+Node: Distribution contents1123904
+Node: Unix Installation1129998
+Node: Quick Installation1130680
+Node: Shell Startup Files1133094
+Node: Additional Configuration Options1134172
+Node: Configuration Philosophy1135977
+Node: Non-Unix Installation1138346
+Node: PC Installation1138804
+Node: PC Binary Installation1140124
+Node: PC Compiling1141976
+Ref: PC Compiling-Footnote-11145000
+Node: PC Testing1145109
+Node: PC Using1146289
+Node: Cygwin1150403
+Node: MSYS1151173
+Node: VMS Installation1151674
+Node: VMS Compilation1152465
+Ref: VMS Compilation-Footnote-11153694
+Node: VMS Dynamic Extensions1153752
+Node: VMS Installation Details1155437
+Node: VMS Running1157690
+Node: VMS GNV1161969
+Node: VMS Old Gawk1162704
+Node: Bugs1163175
+Node: Other Versions1167372
+Node: Installation summary1173956
+Node: Notes1175014
+Node: Compatibility Mode1175879
+Node: Additions1176661
+Node: Accessing The Source1177586
+Node: Adding Code1179021
+Node: New Ports1185240
+Node: Derived Files1189728
+Ref: Derived Files-Footnote-11195213
+Ref: Derived Files-Footnote-21195248
+Ref: Derived Files-Footnote-31195846
+Node: Future Extensions1195960
+Node: Implementation Limitations1196618
+Node: Extension Design1197801
+Node: Old Extension Problems1198955
+Ref: Old Extension Problems-Footnote-11200473
+Node: Extension New Mechanism Goals1200530
+Ref: Extension New Mechanism Goals-Footnote-11203894
+Node: Extension Other Design Decisions1204083
+Node: Extension Future Growth1206196
+Node: Old Extension Mechanism1207032
+Node: Notes summary1208795
+Node: Basic Concepts1209977
+Node: Basic High Level1210658
+Ref: figure-general-flow1210940
+Ref: figure-process-flow1211625
+Ref: Basic High Level-Footnote-11214926
+Node: Basic Data Typing1215111
+Node: Glossary1218439
+Node: Copying1250385
+Node: GNU Free Documentation License1287924
+Node: Index1313042

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index fb05d522..8c515a32 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -28331,7 +28331,12 @@ There is a significant difference between the output created when
profiling, and that created when pretty-printing. Pretty-printed output
preserves the original comments that were in the program, although their
placement may not correspond exactly to their original locations in the
-source code.
+source code.@footnote{@command{gawk} does the best it can to preserve
+the distinction between comments at the end of a statement and comments
+on lines by themselves. Due to implementation constraints, it does not
+always do so correctly, particularly for @code{switch} statements. The
+@command{gawk} maintainers hope to improve this in a subsequent
+release.}
However, as a deliberate design decision, profiling output @emph{omits}
the original program's comments. This allows you to focus on the
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index d420ad68..3e0f6bba 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -27422,7 +27422,12 @@ There is a significant difference between the output created when
profiling, and that created when pretty-printing. Pretty-printed output
preserves the original comments that were in the program, although their
placement may not correspond exactly to their original locations in the
-source code.
+source code.@footnote{@command{gawk} does the best it can to preserve
+the distinction between comments at the end of a statement and comments
+on lines by themselves. Due to implementation constraints, it does not
+always do so correctly, particularly for @code{switch} statements. The
+@command{gawk} maintainers hope to improve this in a subsequent
+release.}
However, as a deliberate design decision, profiling output @emph{omits}
the original program's comments. This allows you to focus on the
diff --git a/profile.c b/profile.c
index 43875600..3eca03bd 100644
--- a/profile.c
+++ b/profile.c
@@ -26,7 +26,7 @@
#include "awk.h"
static void pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags);
-static void end_line(INSTRUCTION *ip);
+static INSTRUCTION *end_line(INSTRUCTION *ip);
static void pp_parenthesize(NODE *n);
static void parenthesize(int type, NODE *left, NODE *right);
static char *pp_list(int nargs, const char *paren, const char *delim);
@@ -207,6 +207,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags)
char *tmp;
int rule;
static int rule_count[MAXRULE];
+ static bool skip_comment = false;
for (pc = startp; pc != endp; pc = pc->nexti) {
if (pc->source_line > 0)
@@ -214,8 +215,13 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags)
/* skip leading EOL comment as it has already been printed */
if (pc->opcode == Op_comment
- && pc->memory->comment_type == EOL_COMMENT)
+ && pc->memory->comment_type == EOL_COMMENT
+ && skip_comment) {
+ skip_comment = false;
continue;
+ }
+ skip_comment = false;
+
switch (pc->opcode) {
case Op_rule:
/*
@@ -246,6 +252,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags)
}
fprintf(prof_fp, "%s {", ruletab[rule]);
end_line(pc);
+ skip_comment = true;
} else {
if (do_profile && ! rule_count[rule]++)
fprintf(prof_fp, _("\t# Rule(s)\n\n"));
@@ -268,6 +275,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags)
fprintf(prof_fp, " # %ld", ip1->exec_count);
end_line(ip1);
+ skip_comment = true;
} else {
fprintf(prof_fp, "{\n");
ip1 = (pc + 1)->firsti;
@@ -366,7 +374,7 @@ cleanup:
pp_free(t2);
pp_free(t1);
if ((flags & IN_FOR_HEADER) == 0)
- end_line(pc);
+ pc = end_line(pc);
break;
default:
@@ -492,7 +500,7 @@ cleanup:
pp_free(t2);
pp_free(t1);
if ((flags & IN_FOR_HEADER) == 0)
- end_line(pc);
+ pc = end_line(pc);
break;
case Op_concat:
@@ -513,7 +521,7 @@ cleanup:
} else
fprintf(prof_fp, "%s %s", op2str(Op_K_delete), array);
if ((flags & IN_FOR_HEADER) == 0)
- end_line(pc);
+ pc = end_line(pc);
pp_free(t1);
}
break;
@@ -625,7 +633,7 @@ cleanup:
fprintf(prof_fp, "%s%s", op2str(pc->opcode), tmp);
efree(tmp);
if ((flags & IN_FOR_HEADER) == 0)
- end_line(pc);
+ pc = end_line(pc);
break;
case Op_push_re:
@@ -734,7 +742,8 @@ cleanup:
case Op_K_break:
case Op_K_nextfile:
case Op_K_next:
- fprintf(prof_fp, "%s\n", op2str(pc->opcode));
+ fprintf(prof_fp, "%s", op2str(pc->opcode));
+ pc = end_line(pc);
break;
case Op_K_return:
@@ -742,8 +751,10 @@ cleanup:
t1 = pp_pop();
if (is_binary(t1->type))
pp_parenthesize(t1);
- if (pc->source_line > 0) /* don't print implicit 'return' at end of function */
- fprintf(prof_fp, "%s %s\n", op2str(pc->opcode), t1->pp_str);
+ if (pc->source_line > 0) { /* don't print implicit 'return' at end of function */
+ fprintf(prof_fp, "%s %s", op2str(pc->opcode), t1->pp_str);
+ pc = end_line(pc);
+ }
pp_free(t1);
break;
@@ -751,7 +762,7 @@ cleanup:
t1 = pp_pop();
fprintf(prof_fp, "%s", t1->pp_str);
if ((flags & IN_FOR_HEADER) == 0)
- end_line(pc);
+ pc = end_line(pc);
pp_free(t1);
break;
@@ -774,28 +785,33 @@ cleanup:
fprintf(prof_fp, "%s (", op2str(pc->opcode));
pprint(pc->nexti, ip1->while_body, NO_PPRINT_FLAGS);
t1 = pp_pop();
- fprintf(prof_fp, "%s) {\n", t1->pp_str);
+ fprintf(prof_fp, "%s) {", t1->pp_str);
pp_free(t1);
+ ip1->while_body = end_line(ip1->while_body);
indent_in();
pprint(ip1->while_body->nexti, pc->target_break, NO_PPRINT_FLAGS);
indent_out();
indent(SPACEOVER);
- fprintf(prof_fp, "}\n");
- pc = pc->target_break;
+ fprintf(prof_fp, "}");
+ pc = end_line(pc->target_break);
break;
case Op_K_do:
ip1 = pc + 1;
indent(pc->nexti->exec_count);
- fprintf(prof_fp, "%s {\n", op2str(pc->opcode));
+ fprintf(prof_fp, "%s {", op2str(pc->opcode));
+ end_line(pc->nexti);
+ skip_comment = true;
indent_in();
pprint(pc->nexti->nexti, ip1->doloop_cond, NO_PPRINT_FLAGS);
indent_out();
pprint(ip1->doloop_cond, pc->target_break, NO_PPRINT_FLAGS);
indent(SPACEOVER);
t1 = pp_pop();
- fprintf(prof_fp, "} %s (%s)\n", op2str(Op_K_while), t1->pp_str);
+ fprintf(prof_fp, "} %s (%s)", op2str(Op_K_while), t1->pp_str);
pp_free(t1);
+ end_line(pc->target_break);
+ skip_comment = true;
pc = pc->target_break;
break;
@@ -825,12 +841,16 @@ cleanup:
pprint(pc->target_continue, pc->target_break, IN_FOR_HEADER);
}
- fprintf(prof_fp, ") {\n");
+ fprintf(prof_fp, ") {");
+ end_line(ip1->forloop_body);
+ skip_comment = true;
indent_in();
pprint(ip1->forloop_body->nexti, pc->target_continue, NO_PPRINT_FLAGS);
indent_out();
indent(SPACEOVER);
- fprintf(prof_fp, "}\n");
+ fprintf(prof_fp, "}");
+ end_line(pc->target_break);
+ skip_comment = true;
pc = pc->target_break;
break;
@@ -848,14 +868,18 @@ cleanup:
else
item = m->vname;
indent(ip1->forloop_body->exec_count);
- fprintf(prof_fp, "%s (%s%s%s) {\n", op2str(Op_K_arrayfor),
+ fprintf(prof_fp, "%s (%s%s%s) {", op2str(Op_K_arrayfor),
item, op2str(Op_in_array), array);
+ end_line(ip1->forloop_body);
+ skip_comment = true;
indent_in();
pp_free(t1);
pprint(ip1->forloop_body->nexti, pc->target_break, NO_PPRINT_FLAGS);
indent_out();
indent(SPACEOVER);
- fprintf(prof_fp, "}\n");
+ fprintf(prof_fp, "}");
+ end_line(pc->target_break);
+ skip_comment = true;
pc = pc->target_break;
}
break;
@@ -878,10 +902,13 @@ cleanup:
indent(pc->stmt_start->exec_count);
if (pc->opcode == Op_K_case) {
t1 = pp_pop();
- fprintf(prof_fp, "%s %s:\n", op2str(pc->opcode), t1->pp_str);
+ fprintf(prof_fp, "%s %s:", op2str(pc->opcode), t1->pp_str);
+ pc = end_line(pc);
pp_free(t1);
- } else
- fprintf(prof_fp, "%s:\n", op2str(pc->opcode));
+ } else {
+ fprintf(prof_fp, "%s:", op2str(pc->opcode));
+ pc = end_line(pc);
+ }
indent_in();
pprint(pc->stmt_start->nexti, pc->stmt_end->nexti, NO_PPRINT_FLAGS);
indent_out();
@@ -897,14 +924,19 @@ cleanup:
ip1 = pc->branch_if;
if (ip1->exec_count > 0)
fprintf(prof_fp, " # %ld", ip1->exec_count);
- end_line(pc);
+ ip1 = end_line(ip1);
indent_in();
pprint(ip1->nexti, pc->branch_else, NO_PPRINT_FLAGS);
indent_out();
pc = pc->branch_else;
if (pc->nexti->opcode == Op_no_op) { /* no following else */
indent(SPACEOVER);
- fprintf(prof_fp, "}\n");
+ fprintf(prof_fp, "}");
+ if (pc->nexti->nexti->opcode != Op_comment
+ || pc->nexti->nexti->memory->comment_type == FULL_COMMENT)
+ fprintf(prof_fp, "\n");
+ /* else
+ It will be printed at the top. */
}
/*
* See next case; turn off the flag so that the
@@ -933,13 +965,22 @@ cleanup:
&& pc->branch_end == pc->nexti->nexti->branch_else->lasti) {
pprint(pc->nexti, pc->branch_end, IN_ELSE_IF);
} else {
- fprintf(prof_fp, "{\n");
+ fprintf(prof_fp, "{");
+ end_line(pc);
+ skip_comment = true;
indent_in();
pprint(pc->nexti, pc->branch_end, NO_PPRINT_FLAGS);
indent_out();
indent(SPACEOVER);
- fprintf(prof_fp, "}\n");
+ fprintf(prof_fp, "}");
+ end_line(pc->branch_end);
+ skip_comment = true;
}
+ /*
+ * Don't do end_line() here, we get multiple blank lines after
+ * the final else in a chain of else-ifs since they all point
+ * to the same branch_end.
+ */
pc = pc->branch_end;
break;
@@ -996,17 +1037,21 @@ cleanup:
/* end_line --- end pretty print line with new line or on-line comment */
-void
+INSTRUCTION *
end_line(INSTRUCTION *ip)
{
+ INSTRUCTION *ret = ip;
+
if (ip->nexti->opcode == Op_comment
&& ip->nexti->memory->comment_type == EOL_COMMENT) {
fprintf(prof_fp, "\t");
print_comment(ip->nexti, -1);
- ip = ip->nexti->nexti;
+ ret = ip->nexti;
}
else
fprintf(prof_fp, "\n");
+
+ return ret;
}
/* pp_string_fp --- printy print a string to the fp */
@@ -1736,7 +1781,12 @@ pp_func(INSTRUCTION *pc, void *data ATTRIBUTE_UNUSED)
if (j < pcount - 1)
fprintf(prof_fp, ", ");
}
- fprintf(prof_fp, ")\n");
+ if (fp->opcode == Op_comment
+ && fp->memory->comment_type == EOL_COMMENT) {
+ fprintf(prof_fp, ")");
+ fp = end_line(fp);
+ } else
+ fprintf(prof_fp, ")\n");
if (do_profile)
indent(0);
fprintf(prof_fp, "{\n");
diff --git a/test/ChangeLog b/test/ChangeLog
index 66bed645..2b44b4b5 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,17 @@
+2016-03-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * profile5.ok: Adjust after code changes.
+
+2016-03-21 Arnold D. Robbins <arnold@skeeve.com>
+
+ * profile5.ok, profile10.awk, profile10.ok: Adjust after code changes.
+
+2016-03-19 Arnold D. Robbins <arnold@skeeve.com>
+
+ * profile5.ok: Adjust after code changes.
+ * Makefile.am (profile10): New test.
+ * profile10.awk, profile10.ok: New files.
+
2016-02-18 Arnold D. Robbins <arnold@skeeve.com>
* profile2.ok, profile5.ok: Adjust after code changes.
diff --git a/test/Makefile.am b/test/Makefile.am
index 2147d34b..776dfbd0 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -778,6 +778,8 @@ EXTRA_DIST = \
profile8.ok \
profile9.awk \
profile9.ok \
+ profile10.awk \
+ profile10.ok \
prt1eval.awk \
prt1eval.ok \
prtoeval.awk \
@@ -1134,7 +1136,7 @@ GAWK_EXT_TESTS = \
nonfatal1 nonfatal2 nonfatal3 \
patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \
profile0 profile1 profile2 profile3 profile4 profile5 profile6 profile7 \
- profile8 profile9 pty1 \
+ profile8 profile9 profile10 pty1 \
rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin rsstart1 \
rsstart2 rsstart3 rstest6 shadow shadowbuiltin \
sortfor sortu split_after_fpat \
@@ -1869,6 +1871,11 @@ profile9:
@$(AWK) --pretty-print=_$@ -f "$(srcdir)"/$@.awk > /dev/null
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+profile10:
+ @echo $@
+ @$(AWK) --pretty-print=_$@ -f "$(srcdir)"/$@.awk > /dev/null
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
posix2008sub:
@echo $@
@$(AWK) --posix -f "$(srcdir)"/$@.awk > _$@ 2>&1
diff --git a/test/Makefile.in b/test/Makefile.in
index 927be043..7c3a5a00 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1035,6 +1035,8 @@ EXTRA_DIST = \
profile8.ok \
profile9.awk \
profile9.ok \
+ profile10.awk \
+ profile10.ok \
prt1eval.awk \
prt1eval.ok \
prtoeval.awk \
@@ -1390,7 +1392,7 @@ GAWK_EXT_TESTS = \
nonfatal1 nonfatal2 nonfatal3 \
patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \
profile0 profile1 profile2 profile3 profile4 profile5 profile6 profile7 \
- profile8 profile9 pty1 \
+ profile8 profile9 profile10 pty1 \
rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin rsstart1 \
rsstart2 rsstart3 rstest6 shadow shadowbuiltin \
sortfor sortu split_after_fpat \
@@ -2308,6 +2310,11 @@ profile9:
@$(AWK) --pretty-print=_$@ -f "$(srcdir)"/$@.awk > /dev/null
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+profile10:
+ @echo $@
+ @$(AWK) --pretty-print=_$@ -f "$(srcdir)"/$@.awk > /dev/null
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
posix2008sub:
@echo $@
@$(AWK) --posix -f "$(srcdir)"/$@.awk > _$@ 2>&1
diff --git a/test/profile10.awk b/test/profile10.awk
new file mode 100644
index 00000000..b78ae447
--- /dev/null
+++ b/test/profile10.awk
@@ -0,0 +1,42 @@
+BEGIN { # Comment 0
+ if (1) { # Comment 1
+ print "ABC" # Comment2
+ } else { # Comment 3
+ print "XYZ" # Comment 4
+ } # Comment 5
+
+ while (c == d) { # Comment 6
+ print "DEF" # Comment 7
+ } # Comment 8
+
+ do { # Comment 9
+ print "GHI" # Comment 10
+ } while (e == f) # Comment 11
+
+ for (i in data) { # Comment 12
+ print "JKL" # Comment 13
+ } # Comment 14
+
+ for (z = 1; z <= 10; z++) { # Comment 15
+ print "MNO" # Comment 16
+ } # Comment 17
+
+ switch (q) { # Comment 18
+ case "a": # Comment 19
+ case "b":
+ # Comment 20
+ break # Comment 21
+ default: # Comment 22
+ break # Comment 23
+ } # Comment 24
+
+ if (1) {
+ print "foo"
+ } # Comment 25
+
+ if (2) {
+ print "bar"
+ }
+ # Comment 26
+}
+# Comment 27
diff --git a/test/profile10.ok b/test/profile10.ok
new file mode 100644
index 00000000..13f0b67b
--- /dev/null
+++ b/test/profile10.ok
@@ -0,0 +1,40 @@
+BEGIN { # Comment 0
+ if (1) { # Comment 1
+ print "ABC" # Comment2
+ } else { # Comment 3
+ print "XYZ" # Comment 4
+ } # Comment 5
+ while (c == d) { # Comment 6
+ print "DEF" # Comment 7
+ } # Comment 8
+ do { # Comment 9
+ print "GHI" # Comment 10
+ } while (e == f) # Comment 11
+ for (i in data) { # Comment 12
+ print "JKL" # Comment 13
+ } # Comment 14
+ for (z = 1; z <= 10; z++) { # Comment 15
+ print "MNO" # Comment 16
+ } # Comment 17
+ switch (q) {
+ case "a":
+ # Comment 18
+ case "b":
+ # Comment 19
+ break # Comment 20
+ # Comment 21
+ default:
+ # Comment 22
+ break # Comment 23
+ }
+ # Comment 24
+ if (1) {
+ print "foo"
+ } # Comment 25
+ if (2) {
+ print "bar"
+ }
+ # Comment 26
+}
+
+# Comment 27
diff --git a/test/profile5.ok b/test/profile5.ok
index 95c77401..0fb8589e 100644
--- a/test/profile5.ok
+++ b/test/profile5.ok
@@ -52,12 +52,10 @@ BEGIN {
_XCHR[_CHR[i]] = sprintf("%c", (i < 128 ? i + 128 : i - 128))
}
#_____________________________________________________________________________
-
for (i = 0; i < 256; i++) {
_QSTRQ[_CHR[i]] = "\\" sprintf("%.3o", i)
}
#_______________________________________________________________________
-
for (i = 0; i < 32; i++) {
_QSTR[_CHR[i]] = _QSTRQ[_CHR[i]]
}
@@ -67,15 +65,13 @@ BEGIN {
for (; i < 256; i++) {
_QSTR[_CHR[i]] = _QSTRQ[_CHR[i]]
}
- _QSTR["\\"] = "\\\\"
+ _QSTR["\\"] = "\\\\" #; _QSTR["\""]="\\\""
#_____________________________________________________________________________
-
_CHR["CR"] = "\r"
_CHR["EOL"] = "\r\n"
_CHR["EOF"] = "\032"
_QSTR[_CHR["EOL"]] = "\\015\\012"
#_______________________________________________________________________
-
_CHR["MONTH"][_CHR["MONTH"]["Jan"] = "01"] = "Jan"
_CHR["MONTH"][_CHR["MONTH"]["Feb"] = "02"] = "Feb"
_CHR["MONTH"][_CHR["MONTH"]["Mar"] = "03"] = "Mar"
@@ -89,10 +85,8 @@ BEGIN {
_CHR["MONTH"][_CHR["MONTH"]["Nov"] = "11"] = "Nov"
_CHR["MONTH"][_CHR["MONTH"]["Dec"] = "12"] = "Dec"
#_____________________________________________________________________________
-
_TAB_STEP_DEFAULT = 8
#_____________________________________________________________________________
-
for (i = 0; i < 32; i++) {
_REXPSTR[_CHR[i]] = _QSTRQ[_CHR[i]]
}
@@ -288,19 +282,6 @@ BEGIN {
#BootDevice BuildNumber BuildType Caption CodeSet CountryCode CreationClassName CSCreationClassName CSDVersion CSName CurrentTimeZone DataExecutionPrevention_32BitApplications DataExecutionPrevention_Available DataExecutionPrevention_Drivers DataExecutionPrevention_SupportPolicy Debug Description Distributed EncryptionLevel ForegroundApplicationBoost FreePhysicalMemory FreeSpaceInPagingFiles FreeVirtualMemory InstallDate LargeSystemCache LastBootUpTime LocalDateTime Locale Manufacturer MaxNumberOfProcesses MaxProcessMemorySize MUILanguages Name NumberOfLicensedUsers NumberOfProcesses NumberOfUsers OperatingSystemSKU Organization OSArchitecture OSLanguage OSProductSuite OSType OtherTypeDescription PAEEnabled PlusProductID PlusVersionNumber Primary ProductType RegisteredUser SerialNumber ServicePackMajorVersion ServicePackMinorVersion SizeStoredInPagingFiles Status SuiteMask SystemDevice SystemDirectory SystemDrive TotalSwapSpaceSize TotalVirtualMemorySize TotalVisibleMemorySize Version WindowsDirectory
#\Device\HarddiskVolume1 7601 Multiprocessor Free Microsoft Windows Server 2008 R2 Enterprise 1252 1 Win32_OperatingSystem Win32_ComputerSystem Service Pack 1 CPU 180 TRUE TRUE TRUE 3 FALSE FALSE 256 0 6925316 33518716 41134632 20110502192745.000000+180 20130426120425.497469+180 20130510134606.932000+180 0409 Microsoft Corporation -1 8589934464 {"en-US"} Microsoft Windows Server 2008 R2 Enterprise |C:\Windows|\Device\Harddisk0\Partition2 0 116 2 10 64-bit 1033 274 18 TRUE 3 Windows User 55041-507-2389175-84833 1 0 33554432 OK 274 \Device\HarddiskVolume2 C:\Windows\system32 C: 50311020 16758448 6.1.7601 C:\Windows
-
-
-
-
-
-
-
-
-
-
-
-
-
BEGIN {
a = ENVIRON["EGAWK_CMDLINE"]
gsub(/^[ \t]*/, "", a)
@@ -327,37 +308,6 @@ END {
#_______________________________________________________________________
########################################################################
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
END {
if (_gawk_scriptlevel < 1) {
close(_errlog_file)
@@ -700,10 +650,10 @@ END {
# try different key combinations
# add lib-specified to all libs
-
#_______________________________________________________________________
function W(p, p0, p1)
{
+ #####################################################
if (isarray(p0)) {
delete p0[p]
if (isarray(p1)) {
@@ -743,23 +693,18 @@ function _ARR(c, t, P)
case "_lib_CMDLN":
return t
#___________________________________________________________
-
case "_lib_APPLY":
return
#___________________________________________________________
-
case "_lib_HELP":
return
#___________________________________________________________
-
case "_lib_NAMEVER":
return _ln("_ARR 1.0")
#___________________________________________________________
-
case "_lib_BEGIN":
return
#___________________________________________________________
-
case "_lib_END":
return
}
@@ -781,7 +726,6 @@ function _BASE(c, t, P, A)
}
return t
#___________________________________________________________
-
case "_lib_APPLY":
if (_cmdln_help) {
match(_fbaccr(_LIBAPI, "_lib_HELP"), /^([^\x00]*)\x00([^\x01]*)\x01(.*)/, A)
@@ -794,19 +738,15 @@ function _BASE(c, t, P, A)
}
return
#___________________________________________________________
-
case "_lib_HELP":
return ("\000" _ln(_PRODUCT_NAME " v" _PRODUCT_VERSION) _ln(_PRODUCT_COPYRIGHT) _ln() _ln(" Usage:") _ln() _ln(" " _PRODUCT_FILENAME " [/key1 /key2...] [-- cmdline]") _ln() _ln(" keys:") _ln() "\001" _ln(" -v -V --version - output product version and (if /V) all modules") _ln(" ? -? --help - output this help page") _ln(" -- - command line string edge"))
#___________________________________________________________
-
case "_lib_NAMEVER":
return _ln("_BASE 3.0")
#___________________________________________________________
-
case "_lib_BEGIN":
return
#___________________________________________________________
-
case "_lib_END":
return
}
@@ -815,6 +755,7 @@ function _BASE(c, t, P, A)
#____________________________________________________________________________
function _DS(c, t, P, a, A)
{
+ ######################################################
switch (c) {
case "_lib_CMDLN":
#___________________________________________________________
@@ -840,6 +781,7 @@ function _DS(c, t, P, a, A)
#______________________________________________________________________________________________
function _END()
{
+ #################################################################################
}
########################################################
@@ -853,7 +795,6 @@ function _ERRLOG(c, t, P, a, b, A)
}
return t
#_______________________________________________________________________
-
case "_lib_APPLY":
if (_errlog_errflkey) {
split(_errlog_errflkey, A, "")
@@ -890,15 +831,12 @@ function _ERRLOG(c, t, P, a, b, A)
}
return
#_______________________________________________________________________
-
case "_lib_HELP":
return (_ln(" -L:TtVvIiWwEeFf - enable(upcase: TVIWEF) or disable(lowcase: tviwef) allowable type of") _ln(" log messages. Trace/Verbose/Informational/Warning/Error/Fatal.") _ln())
#_______________________________________________________________________
-
case "_lib_NAMEVER":
return _ln("_ERRLOG 1.0")
#_______________________________________________________________________
-
case "_lib_BEGIN":
P["_ERRLOG_TF"] = _ERRLOG_TF
P["_ERRLOG_VF"] = _ERRLOG_VF
@@ -914,6 +852,7 @@ function _ERRLOG(c, t, P, a, b, A)
#______________________________________________________________________________________________
function _EXIT()
{
+ ################################################################################
}
########################################################
@@ -923,23 +862,18 @@ function _EXTFN(c, t, P)
case "_lib_CMDLN":
return t
#___________________________________________________________
-
case "_lib_APPLY":
return
#___________________________________________________________
-
case "_lib_HELP":
return
#___________________________________________________________
-
case "_lib_NAMEVER":
return _ln("_EXTFN 1.0")
#___________________________________________________________
-
case "_lib_BEGIN":
return
#___________________________________________________________
-
case "_lib_END":
return
}
@@ -960,22 +894,18 @@ function _FILEIO(c, t, P, A)
}
return t
#___________________________________________________________
-
case "_lib_APPLY":
if (_fileio_notdeltmpflag) {
_info("Temporary objects deletion DISABLED (inherited)")
}
return
#___________________________________________________________
-
case "_lib_HELP":
return (_ln(" -[Tt][+-] - inherited: +enable\\-disable temporary files\\dirs deletion") _ln())
#___________________________________________________________
-
case "_lib_NAMEVER":
return _ln("_FILEIO 2.1")
#___________________________________________________________
-
case "_lib_BEGIN":
P["ENVIRON"]["CD"] = ENVIRON["CD"]
P["_FILEIO_RD"] = _FILEIO_RD
@@ -986,19 +916,20 @@ function _FILEIO(c, t, P, A)
}
return
#___________________________________________________________
-
case "_lib_END":
return
}
}
-#_____________________________________________________________________________
+############################################################
function _FILEVER(c, t, P, a, A)
{
+ #_____________________________________________________________________________
switch (c) {
case "_lib_CMDLN":
- #___________________________________________________________
+ #################################################
return t
+ #___________________________________________________________
#_____________________________________________________
case "_lib_APPLY":
return
@@ -1031,6 +962,7 @@ function _INIT(f)
#___________________________________________________________________________________
function _INITBASE()
{
+ ################################################################
_egawk_utilpath = ENVIRON["EGAWK_PATH"] "BIN\\UTIL\\"
}
@@ -1041,23 +973,18 @@ function _INSTRUC(c, t, P)
case "_lib_CMDLN":
return t
#___________________________________________________________
-
case "_lib_APPLY":
return
#___________________________________________________________
-
case "_lib_HELP":
return
#___________________________________________________________
-
case "_lib_NAMEVER":
return _ln("_INSTRUC 1.0")
#___________________________________________________________
-
case "_lib_BEGIN":
return
#___________________________________________________________
-
case "_lib_END":
return
}
@@ -1072,6 +999,7 @@ function _INSTRUC(c, t, P)
#_____________________________________________________________________________
function _N(F, v, p)
{
+ ###########################################################
for (p in _UIDS) {
delete _UIDS[p]
return _nN_i0(p, F, v)
@@ -1086,23 +1014,18 @@ function _SHORTCUT(c, t, P)
case "_lib_CMDLN":
return t
#___________________________________________________________
-
case "_lib_APPLY":
return
#___________________________________________________________
-
case "_lib_HELP":
return
#___________________________________________________________
-
case "_lib_NAMEVER":
return _ln("_shortcut 1.0")
#___________________________________________________________
-
case "_lib_BEGIN":
return
#___________________________________________________________
-
case "_lib_END":
return
}
@@ -1111,6 +1034,7 @@ function _SHORTCUT(c, t, P)
#______________________________________________________________________________________________
function _START(t, i, A)
{
+ #########################################################################
_torexp_init()
test_uid()
return
@@ -1173,7 +1097,6 @@ function _START(t, i, A)
_wrfile("rego.txt", _dumparr(_REG))
_conl("fF")
#_______________________________________________________________________
-
c = _getreg_i1(DDD, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\Altiris Agent\\Plugin Objects\\\204~.*\224Install path", _REG)
#_________________________________________________________________________________________
pp = _n("NAME", "NS")
@@ -1211,10 +1134,8 @@ function _START(t, i, A)
_defreg(p, "Deployment Automation reg.File", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\AutoUtil\\File.XSZ", "autoutil.exe")
_defreg(p, "Deployment Automation reg.Path", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Altiris\\AutoUtil\\Path.XSZ", "%systemdrive%\\boot\\altiris\\iso")
#_________________________________________________________________________________________
-
_check(pp)
#_________________________________________________________________________________________
-
_conl(_report(pp))
_wrfile("report.txt", _report(pp))
}
@@ -1226,23 +1147,18 @@ function _SYSIO(c, t, P)
case "_lib_CMDLN":
return t
#___________________________________________________________
-
case "_lib_APPLY":
return
#___________________________________________________________
-
case "_lib_HELP":
return
#___________________________________________________________
-
case "_lib_NAMEVER":
return _ln("_SYSIO 1.0")
#___________________________________________________________
-
case "_lib_BEGIN":
return
#___________________________________________________________
-
case "_lib_END":
return
}
@@ -1250,8 +1166,6 @@ function _SYSIO(c, t, P)
#_______________________________________________________________________
########################################################################
-
-
function _W(p, A, v)
{
if (isarray(v)) {
@@ -1273,6 +1187,7 @@ function _W(p, A, v)
#_______________________________________________________________________
function _Zexparr(S, s, t, i)
{
+ ##############################################
t = ""
if (isarray(S)) {
for (i in S) {
@@ -1324,6 +1239,7 @@ function _Zexparr_i3(t)
#_______________________________________________________________________
function _Zimparr(D, t, A, B)
{
+ ##############################################
if (isarray(D)) {
split(t, A, /\x10/, B)
t = _Zimparr_i0(A, B, _Zimparr_i1(D, A, B, 1))
@@ -1374,6 +1290,7 @@ function _Zimparr_i2(t)
#_____________________________________________________________________________
function _Zimport(t, p, A, c, i, n, B)
{
+ ##############################################
if (p) {
c = split(t, B, /\x0A/)
for (i = 1; i <= c; i++) {
@@ -1446,6 +1363,7 @@ function _accmpu(A, a, n)
#_______________________________________________________________________
function _add(S, sf, D, df)
{
+ ################################################
if (sf in S) {
if (isarray(S[sf])) {
if (df in D) {
@@ -1469,6 +1387,7 @@ function _add(S, sf, D, df)
#_________________________________________________________________
function _addarr(D, S)
{
+ #############################################
if (isarray(S)) {
_addarr_i0(D, S)
}
@@ -1493,6 +1412,7 @@ function _addarr_i0(D, S, i)
#_______________________________________________________________________
function _addarrmask(D, S, M)
{
+ #############################################
for (_addarrmaski0 in M) {
if (_addarrmaski0 in S) {
if (isarray(S[_addarrmaski0])) {
@@ -1525,12 +1445,14 @@ function _addarrmask(D, S, M)
#_______________________________________________________________________
function _addf(A, f)
{
+ #####################################################
A["B"][""] = A["F"][A["B"][f] = A["B"][""]] = f
}
#___________________________________________________________
function _addfile(f, d, a, b)
{
+ ##################################
if ((f = _wfilerdnehnd(f)) == "" || _filene(f) == "") {
ERRNO = "Filename error"
return
@@ -1556,6 +1478,7 @@ function _addfile(f, d, a, b)
#_____________________________________________________________________________
function _addlib(f)
{
+ ###########################################################
_addf(_LIBAPI, f)
}
@@ -1566,20 +1489,23 @@ function _addlib(f)
#_______________________________________________________________________
function _addlist(A, v)
{
+ ##################################################
A[++A[0]] = v
}
-#_______________________________________________________________________
+############################################
function _bearray(A)
{
+ #_______________________________________________________________________
if (isarray(A) || A == 0 && A == "") {
- return 1
+ return 1 ####################################################
}
}
#_________________________________________________________________
function _bframe(A, t, p)
{
+ ###########################################
return _bframe_i0(A, t, p, A[""])
}
@@ -1611,6 +1537,7 @@ function _bframe_i0(A, t, p, f)
#_______________________________________________________________________
function _cfguid(p, optr, pfx, sfx, hstrcnt, lstrchr)
{
+ #################### 0 #
delete _UIDOBL[p]
if (_isptr(optr)) {
if (optr == p) {
@@ -1677,6 +1604,7 @@ function _cfguidl(p, H, L, hi, h, hl, li)
#____________________________________________________________________________________________________
function _check(p)
{
+ ####################################################################################
_dll_check(p)
_file_check(p)
_serv_check(p)
@@ -1686,12 +1614,14 @@ function _check(p)
#_______________________________________________________________________
function _chrline(t, ts, w, s)
{
+ #############################################
return ((t = " " _tabtospc(t, ts) ((t ? (t ~ /[ \t]$/ ? "" : " ") : ""))) _getchrln((s ? s : "_"), ((w ? w : _CON_WIDTH - 1)) - length(t)) _CHR["EOL"])
}
#_____________________________________________________________________________
function _cmd(c, i, A)
{
+ #######################################################
_fio_cmda = RS
RS = ".{1,}"
_fio_cmdb = BINMODE
@@ -1709,6 +1639,7 @@ function _cmd(c, i, A)
#_______________________________________________________________________
function _cmparr(A0, A1, R, a, i)
{
+ ##########################################
a = 0
delete R
for (i in A0) {
@@ -1732,6 +1663,7 @@ function _cmparr(A0, A1, R, a, i)
#_____________________________________________________________________________
function _con(t, ts, a, b, c, d, i, r, A, B)
{
+ ##########################################
d = RLENGTH
if ((c = split(r = t, A, /\x0D?\x0A/, B)) > 0) {
a = BINMODE
@@ -1773,6 +1705,7 @@ function _con(t, ts, a, b, c, d, i, r, A, B)
#_______________________________________________________________________
function _conin(t, a, b)
{
+ #################################################
_constatpush()
_constat()
a = BINMODE
@@ -1794,20 +1727,19 @@ function _conin(t, a, b)
#_______________________________________________________________________
function _conl(t, ts)
{
+ ####################################################
return _con(t ((t ~ /\x0A$/ ? "" : _CHR["EOL"])), ts)
}
#_______________________________________________________________________
function _conline(t, ts)
{
+ #################################################
return _con(_chrline(t, ts))
}
#___________________________________________________________________________________
####################################################################################
-
-
-
function _conlq(t, ts)
{
return _conl("`" t "'", ts)
@@ -1816,6 +1748,7 @@ function _conlq(t, ts)
#_______________________________________________________________________
function _constat(t, ts, ln, a)
{
+ ###########################################
if (_constatstrln > (ln = length(t = _constatgtstr(_constatstr = _tabtospc(t, ts), _CON_WIDTH - 1 - _conlastrln)))) {
t = t _getchrln(" ", _constatstrln - ln)
}
@@ -1852,6 +1785,7 @@ function _constatgtstr(t, ln, a, b)
#_______________________________________________________________________
function _constatpop()
{
+ ##################################################
if (_CONSTATPUSH[0] > 0) {
return _constat(_CONSTATPUSH[_CONSTATPUSH[0]--])
}
@@ -1861,6 +1795,7 @@ function _constatpop()
#_______________________________________________________________________
function _constatpush(t, ts)
{
+ #############################################
_CONSTATPUSH[++_CONSTATPUSH[0]] = _constatstr
if (t) {
_constat(t, ts)
@@ -1877,6 +1812,7 @@ function _creport(p, t, f, z)
#_________________________________________________________________________________________
function _defdir(pp, n, f, v, p)
{
+ #############################################################
_[p = _wLCHLD(pp, _n("TYPE", "defdir"))]["NAME"] = n
_[p]["DIR"] = f
return p
@@ -1885,6 +1821,7 @@ function _defdir(pp, n, f, v, p)
#_________________________________________________________________________________________
function _defdll(pp, n, rn, p)
{
+ ##############################################################
_[p = _wLCHLD(pp, _n("TYPE", "defdll"))]["NAME"] = n
_[p]["REGPATH"] = _[pp]["REGPATH"] rn
_[p]["ERRHOST"] = pp
@@ -1921,6 +1858,7 @@ function _defescarr(D, r, S, i, c, t)
#_________________________________________________________________________________________
function _defile(pp, n, f, v, p)
{
+ #############################################################
_[p = _wLCHLD(pp, _n("TYPE", "defile"))]["NAME"] = n
_[p]["FILE"] = f
if (! (v == 0 && v == "")) {
@@ -1932,12 +1870,14 @@ function _defile(pp, n, f, v, p)
#_______________________________________________________________________
function _defn(f, c, v)
{
+ ###################################################
FUNCTAB[c f] = v
}
#_________________________________________________________________________________________
function _defreg(pp, n, f, v, p)
{
+ #############################################################
_[p = _wLCHLD(pp, _n("TYPE", "defreg"))]["NAME"] = n
_[p]["REGPATH"] = f
if (! (v == 0 && v == "")) {
@@ -1948,6 +1888,7 @@ function _defreg(pp, n, f, v, p)
#_______________________________________________________________________________________________
function _defsolution(pp, n, rn, p)
{
+ ###############################################################
_[p = _wLCHLD(pp, _n("TYPE", "solution"))]["NAME"] = n
_[p]["REGPATH"] = rn
_[p]["ERRHOST"] = pp
@@ -1957,6 +1898,7 @@ function _defsolution(pp, n, rn, p)
#_________________________________________________________________________________________
function _defsrv(pp, n, f, v, p)
{
+ #############################################################
_[p = _wLCHLD(pp, _n("TYPE", "defsrv"))]["NAME"] = n
_[p]["SERVNAME"] = f
return p
@@ -1965,6 +1907,7 @@ function _defsrv(pp, n, f, v, p)
#_______________________________________________________________________
function _del(f, c, a, A)
{
+ #################################################
if (match(f, /\\[ \t]*$/)) {
if ((c = toupper(_filerd(f))) && length(f) == FLENGTH) {
_cmd("rd " c " /S /Q 2>NUL")
@@ -1993,6 +1936,7 @@ function _del(f, c, a, A)
#_______________________________________________________________________
function _delay(t, a)
{
+ ###################################################
for (a = 1; a <= t; a++) {
_delayms()
}
@@ -2001,6 +1945,7 @@ function _delay(t, a)
#_________________________________________________________________
function _delayms(a)
{
+ #############################################
for (a = 1; a <= _delay_perfmsdelay; a++) {
}
}
@@ -2008,6 +1953,7 @@ function _delayms(a)
#_______________________________________________________________________
function _deletepfx(A, f, B, le, i)
{
+ ########################################
le = length(f)
for (i in A) {
if (substr(toupper(i), 1, le) == f) {
@@ -2020,6 +1966,7 @@ function _deletepfx(A, f, B, le, i)
#_________________________________________________________________
function _delf(A, f)
{
+ ###############################################
A["B"][A["F"][A["B"][f]] = A["F"][f]] = A["B"][f]
delete A["F"][f]
delete A["B"][f]
@@ -2028,6 +1975,7 @@ function _delf(A, f)
#_______________________________________________________________________
function _deluid(p)
{
+ ################################################# 1 #
if (p in _CLASSPTR) {
_deluida0 = _CLASSPTR[p]
if (_deluida0 in _UIDOBL) {
@@ -2041,6 +1989,7 @@ function _deluid(p)
#_______________________________________________________________________
function _dir(A, rd, i, r, f, ds, pf, B, C)
{
+ ####################################
delete A
gsub(/(^[ \t]*)|([ \t]*$)/, "", rd)
if (rd == "") {
@@ -2070,6 +2019,7 @@ function _dir(A, rd, i, r, f, ds, pf, B, C)
#_________________________________________________________________
function _dirtree(A, f, B)
{
+ #########################################
gsub(/(^[ \t]*)|([ \t]*$)/, "", f)
delete A
A[""]
@@ -2136,7 +2086,7 @@ function _dll_check_i0(p, R, pp, p2, i, i2, r, f, v, rs, d, tv, tf)
}
}
}
- }
+ } #{ rs=_missfl=1; _[p]["." gensub(/^([^\\]+\\)+(.*)\..../,"\\2","G",i)]=R[i] } }
if (rs) {
if ((i = ".Install Path") in _[p] && (i = ".Product Version") in _[p]) {
_[p]["STATUS"] = "PRESENT"
@@ -2228,6 +2178,7 @@ function _drawuid(p, cn, ch, o)
#_______________________________________________________________________
function _dumparr(A, t, lv, a)
{
+ ############################################
b = PROCINFO["sorted_in"]
PROCINFO["sorted_in"] = "_lengthsort"
if (isarray(A)) {
@@ -2292,6 +2243,7 @@ function _dumparr_i1(A, lv, ls, ln, t, t2, i, a, f)
#_____________________________________________________________________________
function _dumpobj(p, f, t, s)
{
+ ###################################################
s = _dumpobj_i0(p, f, t = t "." p "{")
if (p = _rFCHLD(p)) {
return (s = s _dumpobjm(p, f, (s ? _getchrln(" ", length(t) - 1) : t " ")))
@@ -2359,12 +2311,14 @@ function _dumpobj_i4(t)
#_________________________________________________________________
function _dumpobj_nc(p, f, t)
{
+ #######################################
return _dumpobj_i0(p, f, t "." p "{ ")
}
#_________________________________________________________________
function _dumpobjm(p, f, t, s, t2)
{
+ ###################################
t2 = _getchrln(" ", length(t))
do {
s = s _dumpobj(p, f, t)
@@ -2376,6 +2330,7 @@ function _dumpobjm(p, f, t, s, t2)
#_________________________________________________________________
function _dumpobjm_nc(p, f, t, s, t2)
{
+ ################################
t2 = _getchrln(" ", length(t))
do {
s = s _dumpobj_nc(p, f, t)
@@ -2421,23 +2376,18 @@ function _eXTFN(c, t, P)
case "_lib_CMDLN":
return t
#___________________________________________________________
-
case "_lib_APPLY":
return
#___________________________________________________________
-
case "_lib_HELP":
return
#___________________________________________________________
-
case "_lib_NAMEVER":
return _ln("_extfn 1.0")
#___________________________________________________________
-
case "_lib_BEGIN":
return
#___________________________________________________________
-
case "_lib_END":
return
}
@@ -2452,6 +2402,7 @@ function _endpass(t)
#_______________________________________________________________________
function _err(t, a, b)
{
+ ###################################################
a = BINMODE
b = ORS
BINMODE = "rw"
@@ -2466,12 +2417,14 @@ function _err(t, a, b)
#_________________________________________________________________
function _errnl(t)
{
+ ################################################
return _err(t ((t ~ /\x0A$/ ? "" : _CHR["EOL"])))
}
#_______________________________________________________________________
function _error(t, d, A)
{
+ #################################################
if (_ERRLOG_EF) {
A["TYPE"] = "ERROR"
A["TEXT"] = t
@@ -2482,12 +2435,14 @@ function _error(t, d, A)
#_______________________________________________________________________
function _exit(c)
{
+ #######################################################
exit c
}
#_____________________________________________________________________________
function _export_data(t, i, A)
{
+ #################################################
A["DATA"] = t
A["ID"] = i
_expout("_DATA: " _Zexparr(A) "\n")
@@ -2499,6 +2454,7 @@ function _export_data(t, i, A)
#_____________________________________________________________________________
function _expout(t, d, a, b)
{
+ ####################################################
a = BINMODE
b = ORS
BINMODE = "rw"
@@ -2511,16 +2467,9 @@ function _expout(t, d, a, b)
#_________________________________________________________________________________________
##########################################################################################
-
-
-
-
-
-
-
-
function _extfn_init()
{
+ ##############################################################
_formatstrs_init()
_formatstrd_init()
_formatrexp_init()
@@ -2553,6 +2502,7 @@ function _faccr_i0(A, t, p, P, f, r)
#_______________________________________________________________________
function _fatal(t, d, A)
{
+ #################################################
if (_ERRLOG_FF) {
A["TYPE"] = "FATAL"
A["TEXT"] = t
@@ -2583,10 +2533,11 @@ function _ffaccr(A, t, p, P)
return _faccr_i0(A["F"], t, p, P)
}
-#_______________________________________________________________________
+##################
function _fframe(A, t, p)
{
- return _fframe_i0(A, t, p, A[""])
+ #_______________________________________________________________________
+ return _fframe_i0(A, t, p, A[""]) #################################################
}
#___________________________________________________________
@@ -2598,6 +2549,7 @@ function _fframe_i0(A, t, p, f)
#_________________________________________________________________
function _file(f)
{
+ #################################################
if ((f = _filerdnehnd(f)) == "") {
return ""
}
@@ -2644,6 +2596,7 @@ function _file_check_i0(p, pp, p1, p2, f, v)
#_________________________________________________________________
function _filed(f, dd, d)
{
+ ##########################################
if ((f = _filerdnehnd(f)) == "") {
return ""
}
@@ -2668,6 +2621,7 @@ function _filed(f, dd, d)
#_________________________________________________________________
function _filen(f)
{
+ ################################################
if ((f = _filerdnehnd(f)) == "") {
return ""
}
@@ -2677,6 +2631,7 @@ function _filen(f)
#_________________________________________________________________
function _filene(f)
{
+ ###############################################
if ((f = _filerdnehnd(f)) == "") {
return ""
}
@@ -2686,6 +2641,7 @@ function _filene(f)
#_________________________________________________________________
function _filenotexist(f, a)
{
+ ######################################
if (f == "") {
return ""
}
@@ -2703,6 +2659,7 @@ function _filenotexist(f, a)
#_______________________________________________________________________
function _filepath(f, dd)
{
+ ################################################
if ((f = _filerdnehnd(f)) == "") {
return ""
}
@@ -2712,6 +2669,7 @@ function _filepath(f, dd)
#_________________________________________________________________
function _filer(f, dd)
{
+ #############################################
if ((f = _filerdnehnd(f)) == "") {
return ""
}
@@ -2727,6 +2685,7 @@ function _filer(f, dd)
#_________________________________________________________________
function _filerd(f, dd)
{
+ ############################################
if ((f = _filerdnehnd(f)) == "") {
return ""
}
@@ -2736,6 +2695,7 @@ function _filerd(f, dd)
#_________________________________________________________________
function _filerdn(f, dd)
{
+ ###########################################
if ((f = _filerdnehnd(f)) == "") {
return ""
}
@@ -2745,6 +2705,7 @@ function _filerdn(f, dd)
#_________________________________________________________________
function _filerdne(f, dd)
{
+ ##########################################
if ((f = _filerdnehnd(f)) == "") {
return ""
}
@@ -2815,6 +2776,7 @@ function _filerdnehnd(st, c, r, d, n, A)
#_______________________________________________________________________
function _filexist(f, a)
{
+ ################################################
if (f == "") {
return ""
}
@@ -2833,6 +2795,7 @@ function _filexist(f, a)
#_______________________________________________________________________
function _fn(f, p0, p1, p2)
{
+ ################################################
if (f in FUNCTAB) {
return @f(p0, p1, p2)
}
@@ -2841,6 +2804,7 @@ function _fn(f, p0, p1, p2)
#_______________________________________________________________________
function _foreach(A, f, r, p0, p1, p2, i, p)
{
+ ####################################
if (isarray(A)) {
_TMP0[p = _n()]["."] = 1
_foreach_i0(A, f, _TMP0[p], p0, p1, p2)
@@ -2909,14 +2873,15 @@ function _formatstrd_init()
_FORMATSTRDESC["\t"] = "\\t"
}
-####################################################################################
-
-
-
-
-#___________________________________________________________________________________
+#__________________________________________________________________________________
function _formatstrs(t)
{
+ ####################################################################################
+
+
+
+
+ #___________________________________________________________________________________
_formatstrq0 = split(t, _FORMATSTRA, /['\x00-\x1F\x80-\xFF]/, _FORMATSTRB)
_formatstrs0 = ""
for (t = 1; t < _formatstrq0; t++) {
@@ -2948,15 +2913,6 @@ function _fpp(q, D, S)
#_______________________________________________________________________
########################################################################
-
-
-
-
-
-
-
-
-
function _fthru(A, c, p, B)
{
return _fthru_i0(A, c, p, B, A[""])
@@ -2978,6 +2934,7 @@ function _gen(D, t)
#_____________________________________________________________________________
function _gensubfn(t, r, f, p0, A)
{
+ ###############################################
if (match(t, r, A)) {
return (substr(t, 1, RSTART - 1) (@f(_th0(substr(t, RSTART, RLENGTH), t = substr(t, RSTART + RLENGTH)), A, p0)) _gensubfn(t, r, f, p0))
}
@@ -2987,6 +2944,7 @@ function _gensubfn(t, r, f, p0, A)
#_____________________________________________________________________________
function _get_errout(p)
{
+ #######################################################
return _tframe("_get_errout_i0", p)
}
@@ -3041,6 +2999,7 @@ function _get_errout_i3(p, t, ts, cl, cp, cr, a, b)
#_____________________________________________________________________________
function _get_logout(p)
{
+ #######################################################
return _tframe("_get_logout_i0", p)
}
@@ -3064,6 +3023,7 @@ function _get_logout_i0(p, t, n, a)
#_______________________________________________________________________
function _getchrln(s, w)
{
+ #################################################
if (s == "") {
return
}
@@ -3089,12 +3049,14 @@ function _getchrln(s, w)
#_______________________________________________________________________
function _getdate()
{
+ #####################################################
return strftime("%F")
}
#_____________________________________________________________________________
function _getfilepath(t, f, al, b, A)
{
+ ############################################
ERRNO = ""
if (match(t, /^[ \t]*(("([^"]*)"[ \t]*)|([`']([^']*)'[ \t]*)|(([^ \t]+)[ \t]*))/, A)) {
al = RLENGTH
@@ -3113,6 +3075,7 @@ function _getfilepath(t, f, al, b, A)
function _getfilever(f)
{
+ #############################################################
split(_cmd(_fileverpath " \"" f "\""), _GETFILEVERA0, /[ \t]+/)
if (_GETFILEVERA0[5]) {
return _GETFILEVERA0[5]
@@ -3122,12 +3085,14 @@ function _getfilever(f)
#_________________________________________________________________
function _getime()
{
+ ################################################
return strftime("%H:%M:%S")
}
#_________________________________________________________________
function _getmpdir(f, dd)
{
+ ##########################################
if (! dd || ! (dd = _filerd(dd))) {
dd = _FILEIO_TMPRD
}
@@ -3140,6 +3105,7 @@ function _getmpdir(f, dd)
#_________________________________________________________________
function _getmpfile(f, dd)
{
+ #########################################
if (! dd || ! (dd = _filerd(dd))) {
dd = _FILEIO_TMPRD
}
@@ -3152,6 +3118,7 @@ function _getmpfile(f, dd)
#_______________________________________________________________________
function _getperf(o, t, a)
{
+ ###############################################
(o == "" ? ++_getperf_opcurr : _getperf_opcurr = o)
if ((a = _getsecond()) != _getperf_last) {
_getperf_opsec = (_getperf_opcurr - _getperf_opstart) / ((_getperf_last = a) - _getperf_start)
@@ -3199,27 +3166,6 @@ function _getperf_not(o, t, a)
#_________________________________________________________________________________________
##########################################################################################
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function _getreg_i1(D, r, R, a, i, il, ir, rc, B)
{
a = IGNORECASE
@@ -3247,12 +3193,14 @@ function _getreg_i1(D, r, R, a, i, il, ir, rc, B)
#_________________________________________________________________
function _getsecond()
{
+ #############################################
return systime()
}
#___________________________________________________________
function _getsecondsync(a, c, b, c2)
{
+ ##########################
a = systime()
while (a == systime()) {
++c
@@ -3263,6 +3211,7 @@ function _getsecondsync(a, c, b, c2)
#_______________________________________________________________________
function _getuid(p)
{
+ ################################################# 1 #
if (p in _UIDOBL) {
for (_tptr in _UIDOBLV[_getuida0 = _UIDOBL[p]]) {
delete _UIDOBLV[_getuida0][_tptr]
@@ -3295,6 +3244,7 @@ function _handle8494(t)
#_____________________________________________________________________________
function _hexnum(n, l)
{
+ #########################################################
if (l + 0 < 1) {
l = 2
}
@@ -3304,6 +3254,7 @@ function _hexnum(n, l)
#_________________________________________________________________
function _igetperf(t, s, o)
{
+ ######################################### # t-test period in seconds(==0 ? no period; s(=true/false)-output/not output status; o-qnt of ops before test start
if (t == 0 && t == "" && s == 0 && s == "" && o == 0 && o == "") {
if (_getperf_fn !~ /not$/ && _constatstr == _getperf_stat) {
_constat(_getperf_statstr)
@@ -3334,6 +3285,7 @@ function _import_data(t, p, p2, a)
#_______________________________________________________________________
function _info(t, d, A)
{
+ ##################################################
if (_ERRLOG_IF) {
A["TYPE"] = "INFO"
A["TEXT"] = t
@@ -3343,7 +3295,6 @@ function _info(t, d, A)
# test with the different path types
# _conl(_ln("SRC:") _dumparr(S)); _conl();
-
function _ini(p, cs, dptr, pfx, sfx, hstr, lstr)
{
return _inituid(p, cs, dptr, pfx, sfx, hstr, lstr, A)
@@ -3405,6 +3356,7 @@ function _initsys()
#_______________________________________________________________________
function _inituid(p, cs, dptr, pfx, sfx, hstr, lstr, A)
{
+ ################### 1 #
if (cs == 0 && cs == "") {
cs = p
p = _getuid()
@@ -3464,6 +3416,7 @@ function _inituidefault(h, l, H, L)
#_______________________________________________________________________
function _ins(S, sf, D, df)
{
+ ################################################
if (sf in S) {
if (isarray(S[sf])) {
if (df in D) {
@@ -3487,19 +3440,22 @@ function _ins(S, sf, D, df)
#_________________________________________________________________
function _insf(A, f)
{
+ ###############################################
A["F"][""] = A["B"][A["F"][f] = A["F"][""]] = f
}
#_________________________________________________________________
function _insframe(A, f)
{
+ ###########################################
A[f] = A[""]
A[""] = f
}
-#_________________________________________________________________
+########################
function _inspass(A, f)
{
+ #_________________________________________________________________
A[f] = A[""]
A[""] = f
}
@@ -3509,6 +3465,7 @@ function _inspass(A, f)
#_______________________________________________________________________
function _isptr(p)
{
+ ################################################## 1 #
if (isarray(p)) {
is = _NOP
it = "A"
@@ -3529,6 +3486,7 @@ function _isptr(p)
#_______________________________________________________________________
function _istr(p)
{
+ ################################################### 1 #
if (isarray(p)) {
is = _NOP
it = "A"
@@ -3545,6 +3503,7 @@ function _istr(p)
#_________________________________________________________________
function _lengthsort(i1, v1, i2, v2)
{
+ ##############################
return ((length(i1) < length(i2) ? -1 : (length(i1) > length(i2) ? 1 : (i1 < i2 ? -1 : 1))))
}
@@ -3587,12 +3546,14 @@ function _lib_NAMEVER()
#_____________________________________________________________________________
function _ln(t)
{
+ ###############################################################
return ((t ~ /\x0A$/ ? t : t _CHR["EOL"]))
}
#_________________________________________________________________
function _log(A, p, a, B)
{
+ ###########################################
if (isarray(A)) {
A["TIME"] = _getime()
A["DATE"] = _getdate()
@@ -3613,6 +3574,7 @@ function _log(A, p, a, B)
#_________________________________________________________________
function _lspctab(t, ts, l, l1, l2, A)
{
+ ################################
while (match(t, /^(\t*)( *)((\t*)(.*))$/, A)) {
if (A[1, "length"] >= l) {
return substr(t, l + 1)
@@ -3654,6 +3616,7 @@ function _macsfx94(F, D, C, p1, p2, p3)
#_______________________________________________________________________
function _movarr(D, S)
{
+ ###################################################
delete D
D[""]
delete D[""]
@@ -3682,40 +3645,6 @@ function _mpu(t, F, p1, p2, p3, D, C)
# (\x00\t\+)* -> 28 00 09 5B 2B 29
#
# unesc all non-rexp characters: replace unesc of rexp-characters but do not remove it: \* -> \*, \x2A -> \*, \052 -> \*, \\ -> \#
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function _mpudefaulthnd(F, D, C, p1, p2, p3)
{
_mpuretsub(D, _mpucc0)
@@ -3771,6 +3700,7 @@ function _mpusub(F, D, C, d, p1, p2, p3, q)
#_______________________________________________________________________
function _n(F, v, p)
{
+ #####################################################
for (p in _UIDSDEL) {
delete _UIDSDEL[p]
delete _ptr[p]
@@ -3827,6 +3757,7 @@ function _nN_i0(p, F, v)
#_________________________________________________________________
function _newclrdir(f)
{
+ ############################################
if ((f = _filerd(f)) == "") {
return
}
@@ -3839,6 +3770,7 @@ function _newclrdir(f)
#_______________________________________________________________________
function _newdir(f)
{
+ #####################################################
if ((f = _filerd(f)) == "") {
return
}
@@ -3849,9 +3781,10 @@ function _newdir(f)
return f
}
-#_______________________________________________________________________
+##############################
function _nop(p0, p1, p2, p3)
{
+ #_______________________________________________________________________
}
#_____________________________________________________
@@ -3872,6 +3805,7 @@ function _nop(p0, p1, p2, p3)
#_________________________________________________________________
function _nretarr(A, i, v, r, q)
{
+ #####################################
if ((i = (i == "" ? 1 : i + 0)) <= (q = A[_ARRLEN])) {
if (i <= (r = q - 16)) {
_ARRSTR = A[i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i]
@@ -3891,6 +3825,7 @@ function _nretarr(A, i, v, r, q)
#___________________________________________________________
function _nretarrd(A, i, v, r, q)
{
+ ##############################
if ((i = (i == "" ? 1 : i + 0)) <= (q = A[_ARRLEN])) {
if (i <= (r = q - 16)) {
_ARRSTR = A[i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i] A[++i]
@@ -3915,6 +3850,7 @@ function _nretarrd(A, i, v, r, q)
#___________________________________________________________________________________
function _out(t, a, b)
{
+ ###############################################################
a = BINMODE
b = ORS
BINMODE = "rw"
@@ -3929,6 +3865,7 @@ function _out(t, a, b)
#_________________________________________________________________
function _outnl(t)
{
+ ################################################
return _out(t ((t ~ /\x0A$/ ? "" : _CHR["EOL"])))
}
@@ -3983,6 +3920,7 @@ function _p8(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
#_______________________________________________________________________
function _pass(A, f, t, p2, i, a)
{
+ ###########################################
a = _endpass_v0
_endpass_v0 = ""
i = 1
@@ -4005,6 +3943,7 @@ function _pass(A, f, t, p2, i, a)
#_____________________________________________________________________________
function _patharr0(D, q, i, h, A, B)
{
+ ##############################################
delete D
if (0 < (q = split(gensub(/\\/, "/", "G", gensub(/ *([:$\\\/]) */, "\\1", "G", gensub(/(^[ \t]+)|([ \t]+$)/, "", "G", q))), A, /\/+/, B))) {
if (2 > (h = length(B[1]))) {
@@ -4145,6 +4084,7 @@ function _pr8(s1, s2, s3, s4, s5, s6, s7, s8, p1, p2, p3, p4, p5, p6, p7, p8)
#_________________________________________________________________
function _printarr(A, t, lv, r, a)
{
+ ####################################
a = PROCINFO["sorted_in"]
PROCINFO["sorted_in"] = "_lengthsort"
_printarrexp = (r ? r : "")
@@ -4244,6 +4184,7 @@ function _qparam_i0(p0, p1, p2, p3, p4, p5, p6, p7)
#_______________________________________________________________________
function _qstr(t, c, A, B)
{
+ ################################################
c = ""
for (t = split(t, A, /[\x00-\x1F\\"]/, B); t >= 0; t--) {
c = _QSTR[B[t]] A[t + 1] c
@@ -4254,18 +4195,21 @@ function _qstr(t, c, A, B)
#_________________________________________________________________
function _qstrq(t)
{
+ ################################################
gsub(/\\/, "\\\\", t)
gsub(/"/, "\\\"", t)
return t
}
-#_____________________________________________________________________________
+################################################################
function _rEG(c, t, P, a, A)
{
+ #_____________________________________________________________________________
switch (c) {
case "_lib_CMDLN":
- #___________________________________________________________
+ #####################################################
return t
+ #___________________________________________________________
#_____________________________________________________
case "_lib_APPLY":
return
@@ -4287,6 +4231,7 @@ function _rEG(c, t, P, a, A)
#_______________________________________________________________________
function _rFBRO(p)
{
+ ######################################################
if (p) {
if (p in _tPARENT) {
return _tFCHLD[_tPARENT[p]]
@@ -4302,16 +4247,18 @@ function _rFBRO(p)
#_______________________________________________________________________
function _rFCHLD(p)
{
+ #####################################################
if (p && p in _tFCHLD) {
return _tFCHLD[p]
}
return ""
}
-#_______________________________________________________________________
+######################## p="", !v
function _rLBRO(p)
{
- if (p) {
+ #_______________________________________________________________________
+ if (p) { ######################################################
if (p in _tPARENT) {
return _tLCHLD[_tPARENT[p]]
}
@@ -4323,10 +4270,11 @@ function _rLBRO(p)
return p
}
-#_______________________________________________________________________
+######################## p=""
function _rLCHLD(p)
{
- if (p && p in _tLCHLD) {
+ #_______________________________________________________________________
+ if (p && p in _tLCHLD) { #####################################################
return _tLCHLD[p]
}
return ""
@@ -4335,40 +4283,45 @@ function _rLCHLD(p)
#_______________________________________________________________________
function _rLINK(p)
{
+ ######################################################
return ((p in _tLINK ? _tLINK[p] : ""))
}
-#_______________________________________________________________________
+######################## p=""
function _rNEXT(p)
{
- if (p && p in _tNEXT) {
+ #_______________________________________________________________________
+ if (p && p in _tNEXT) { ######################################################
return _tNEXT[p]
}
return ""
}
-#_______________________________________________________________________
+######################## p=""
function _rPARENT(p)
{
- if (p && p in _tPARENT) {
+ #_______________________________________________________________________
+ if (p && p in _tPARENT) { ####################################################
return _tPARENT[p]
}
return ""
}
-#_______________________________________________________________________
+######################## p=""
function _rPREV(p)
{
- if (p && p in _tPREV) {
+ #_______________________________________________________________________
+ if (p && p in _tPREV) { ######################################################
return _tPREV[p]
}
return ""
}
-#_______________________________________________________________________
+######################## p=""
function _rQBRO(p, c, p1)
{
- if (p) {
+ #_______________________________________________________________________
+ if (p) { ################################################
if (p in _tPARENT) {
return _tQCHLD[_tPARENT[p]]
}
@@ -4387,10 +4340,11 @@ function _rQBRO(p, c, p1)
return p
}
-#_______________________________________________________________________
+######################## p=""
function _rQCHLD(p)
{
- if (p && p in _tQCHLD) {
+ #_______________________________________________________________________
+ if (p && p in _tQCHLD) { #####################################################
return _tQCHLD[p]
}
return ""
@@ -4402,6 +4356,7 @@ function _rQCHLD(p)
#_____________________________________________________________________________
function _rSQFIRST(g, p, A)
{
+ #####################################################
if (isarray(A)) {
return _rSQFIRSTA(g, p, A)
}
@@ -4413,6 +4368,7 @@ function _rSQFIRST(g, p, A)
#_________________________________________________________________
function _rSQFIRSTA(g, p, A)
{
+ ########################################
_SQTOPTR[g] = p
_SQSTACK[g][0] = 0
if ((p = _rsqgetptr(g, p)) in A) {
@@ -4424,6 +4380,7 @@ function _rSQFIRSTA(g, p, A)
#_______________________________________________________________________
function _rSQNEXT(g, p, A)
{
+ ################################################
if (isarray(A)) {
return _rSQNEXTA(g, p, A)
}
@@ -4433,6 +4390,7 @@ function _rSQNEXT(g, p, A)
#_________________________________________________________________
function _rSQNEXTA(g, p, A)
{
+ #########################################
if (p == _SQTOPTR[g]) {
if (_SQSTACK[g][0] > 0) {
_SQTOPTR[g] = _SQSTACK[g][_SQSTACK[g][0]--]
@@ -4478,6 +4436,7 @@ function _rd_shortcut(D, f)
#_______________________________________________________________________
function _rdfile(f, i, A)
{
+ ################################################
if ((f = _filerdne(f)) == "" || _filene(f) == "") {
ERRNO = "Filename error"
return
@@ -4530,6 +4489,7 @@ function _rdfile(f, i, A)
# fn _getsecondsync()
function _rdreg(D, p)
{
+ ################################################################
_rdregp0 = "reg query \"" p "\" /S /reg:64 2>NUL"
_rdregfld = _rdregkey = 0
_rdregq0 = split(gensub(/[\x0D?\x0A]{2,}/, _CHR["EOL"], "G", _cmd(_rdregp0)), _RDREGA0, /\x0D?\x0A/)
@@ -4561,62 +4521,6 @@ function _rdreg_i0(D, A)
#_____________________________________________________________________________________________________
######################################################################################################
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function _rdsafe(A, i, d)
{
if (i in A) {
@@ -4664,6 +4568,7 @@ function _registryinit()
#_____________________________________________________________________________
function _regpath0(D, i, s, q, S)
{
+ ############################################ 0 #
if (i = _patharr0(S, i)) {
if ("name" in S) {
D["name"] = S["name"]
@@ -4687,6 +4592,7 @@ function _regpath0(D, i, s, q, S)
#_________________________________________________________________________________________
function _report(p)
{
+ #######################################################################
_report_t0 = _reportparnt = ""
_report_i0(p)
_tframe("_report_i0", p)
@@ -4784,6 +4690,7 @@ function _reporterr(p, t3, pp, t, t2)
#_____________________________________________________________________________
function _retarr(A, i, p, a, q)
{
+ ##################################################
if (isarray(A)) {
i = (i == "" ? 0 : i + 0)
q = A[_ARRLEN] + 0
@@ -4807,6 +4714,7 @@ function _retarr_i0(A, q, i, a)
#_________________________________________________________________
function _retarrd(A, v, i)
{
+ #########################################
if (1 in A) {
return (A[1] A[2] A[3] A[4] A[5] A[6] A[7] A[8] A[9] A[10] A[11] A[12] A[13] A[14] A[15] A[16] (((i = 17) in A ? _retarrd_i0(A, i) v : v)))
}
@@ -4826,7 +4734,6 @@ function _retarrd_i0(A, i)
#_______________________________________________________________________
########################################################################
#EXPERIMENTAL
-
function _rexpfn(R, t, p)
{
_REXPFN[""] = ""
@@ -4844,6 +4751,7 @@ function _rexpfnend(t)
#_____________________________________________________________________________
function _rexpstr(r, i, c, A)
{
+ ###################################################
c = split(r, A, "")
r = ""
for (i = 1; i <= c; i++) {
@@ -4876,7 +4784,6 @@ function _rpp(q, D, S)
_conl()
_regpath0(D, q)
#_conl(_dumparr(D))
-
_conl(_ln("DEST:") _dumparr(D))
_conl()
return q
@@ -4885,6 +4792,7 @@ function _rpp(q, D, S)
#_________________________________________________________________________________________
function _rrdreg(DD, p, k, t, v, c, i, q, tT, A, B, C, D)
{
+ ############################################# old; regedit
if (! _registrytmpfile) {
_registryinit()
}
@@ -5000,13 +4908,15 @@ function _rxpfn(R, t, p, i, f, A)
return _rexpfnend(t)
}
-#_____________________________________________________________________________
+##############################################################
function _sHARE(c, t, P, a, A)
{
+ #_____________________________________________________________________________
switch (c) {
case "_lib_CMDLN":
- #___________________________________________________________
+ ###################################################
return t
+ #___________________________________________________________
#_____________________________________________________
case "_lib_APPLY":
return
@@ -5025,13 +4935,15 @@ function _sHARE(c, t, P, a, A)
}
}
-#_____________________________________________________________________________
+################################################################
function _sYS(c, t, P, a, A)
{
+ #_____________________________________________________________________________
switch (c) {
case "_lib_CMDLN":
- #___________________________________________________________
+ #####################################################
return t
+ #___________________________________________________________
#_____________________________________________________
case "_lib_APPLY":
return
@@ -5074,6 +4986,7 @@ function _serv_check_i0(p, p0, p1, p2, p3, i, q, c)
#_______________________________________________________________________
function _setarrsort(f, a)
{
+ ##############################################
a = PROCINFO["sorted_in"]
if (! f) {
delete PROCINFO["sorted_in"]
@@ -5086,6 +4999,7 @@ function _setarrsort(f, a)
#_______________________________________________________________________
function _setmpath(p, a)
{
+ ################################################
ERRNO = ""
if (p && (a = _filerd(p))) {
if (_FILEIO_TMPRD) {
@@ -5101,28 +5015,9 @@ function _setmpath(p, a)
#_________________________________________________________________________________________
##########################################################################################
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function _sharelist(D, h, q, c, l, A, B)
{
+ #################################################
delete D
c = _sharextool " \\\\" ((h == "" ? h = ENVIRON["COMPUTERNAME"] : h)) " 2>&1"
if (match(c = _cmd(c), /\x0AShare[^\x0A]*Remark/)) {
@@ -5142,6 +5037,7 @@ function _sharelist(D, h, q, c, l, A, B)
#_____________________________________________________________________________
function _sharepath(h, s, A)
{
+ ###################################################
s = _sharextool " \\\\" ((h == "" ? h = ENVIRON["COMPUTERNAME"] : h)) "\\\"" s "\" 2>&1"
if (match(s = _cmd(s), /\x0APath[ \t]+([^\x0D\x0A]+)/, _SHAREPATHA0)) {
return gensub(/[ \t\\\/]*$/, "\\\\", 1, _SHAREPATHA0[1])
@@ -5151,39 +5047,40 @@ function _sharepath(h, s, A)
function _shortcut(D, S)
{
+ #############################################################
if (isarray(D)) {
if (isarray(S)) {
_addarrmask(D, S, _SHORTCUTWSTRUC)
- } else if (S == 0 && S == "") {
+ } else if (S == 0 && S == "") { # array,array2* - copy from array2 to array shorcut-specific elements
_addarrmask(D, _SHORTCUTDEFAULT, _SHORTCUTWSTRUC)
- } else if (_isnotfileptr(S)) {
+ } else if (_isnotfileptr(S)) { # array* - define shortcut-specific elements in array by default values
_addarrmask(D, _[S], _SHORTCUTWSTRUC)
} else if (_rd_shortcut(D, S)) {
- return
+ return # array,ptr* - copy from array _[ptr] to array shorcut-specific elements
}
} else if (D == 0 && D == "") {
- return _NOP
+ return _NOP # array,filepath* - define in array shortcut-specific elements by reading its from shortcut file filepath(load shortcut)
+ # -* - no action(return -)
} else if (_isnotfileptr(D)) {
if (isarray(S)) {
_addarrmask(_[D], S, _SHORTCUTWSTRUC)
- } else if (S == 0 && S == "") {
+ } else if (S == 0 && S == "") { # ptr,array* - copy from array to array _[ptr] shorcut-specific elements
_addarrmask(_[D], _SHORTCUTDEFAULT, _SHORTCUTWSTRUC)
- } else if (_isnotfileptr(S)) {
+ } else if (_isnotfileptr(S)) { # ptr* - define shortcut-specifc elements in array _[ptr] by default values
_addarrmask(_[D], _[S], _SHORTCUTWSTRUC)
} else if (_rd_shortcut(_[D], S)) {
- return
+ return # ptr,ptr2* - copy from array _[ptr2] to array _[ptr] shorcut-specific elements
}
- } else {
+ } else { # ptr,filepath* - define in array _[ptr] shortcut-specific elements by reading its from shortcut file filepath(load shortcut)
if (isarray(S) && _wr_shortcut(D, S)) {
- return
+ return # filepath,array* - [over]write shorcut file filepath; shortcut parameters will be defined by shortcut-specific elements in array(save shortcut)
} else if (S == 0 && S == "" && _wr_shortcut(D, _SHORTCUTDEFAULT)) {
- return
+ return # filepath* - [over]write shorcut file filepath; shortcut parameters will be defined by default values
} else if (_isnotfileptr(S) && _wr_shortcut(D, _[S])) {
- return
+ return # filepath,ptr* - [over]write shorcut file filepath; shortcut parameters will be defined by shortcut-specific elements in array _[ptr](save shortcut)
} else if (_rd_shortcut(_SHRTCUTA1, S) || _wr_shortcut(D, _SHRTCUTA1)) {
return
- }
- }
+ } } # filepath,filepath2* - [over]write shorcut file filepath; shortcut parameters will be defined from shortcut file filepath2(copy shortcut)
return 1
}
@@ -5367,6 +5264,7 @@ function _splitpath_test()
#_______________________________________________________________________
function _splitstr(A, t, r)
{
+ ########################################### 1 #
if (_istr(t)) {
if (_splitstr_i0(A, t) > 0) {
return _splitstrp0
@@ -5517,31 +5415,9 @@ function _subseqon(B, r, F, f, s, e, q, i, A)
#___________________________________________________________________________________
####################################################################################
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
function _sysinfo(D, h)
{
+ ##############################################################
h = "wmic /NODE: \"" h "\" OS 2>NUL"
if (split(_cmd(h), _SYSINFOA0, /[\x0D\x0A]+/) == 3) {
_sysinfol0 = length(h = _SYSINFOA0[2]) + 1
@@ -5584,6 +5460,7 @@ function _tOBJ(c, t, P)
#_______________________________________________________________________
function _tOBJ_CLEANUP(p)
{
+ ##############################################
for (p in UIDSDEL) {
delete _ptr[p]
delete _tPREV[p]
@@ -5602,6 +5479,7 @@ function _tOBJ_CLEANUP(p)
#_______________________________________________________________________
function _tabtospc(t, ts, xc, a, c, n, A, B)
{
+ ##################################
if (! ts) {
ts = _TAB_STEP_DEFAULT
}
@@ -5616,13 +5494,6 @@ function _tabtospc(t, ts, xc, a, c, n, A, B)
#___________________________________________________________________________________
####################################################################################
-
-
-
-
-
-
-
function _tapi(p, f, p0, p1, p2, p3, c)
{
c = p
@@ -5638,6 +5509,7 @@ function _tapi(p, f, p0, p1, p2, p3, c)
#_____________________________________________________________________________
function _tbframe(f, p, p0, p1)
{
+ ##################################################
delete _t_ENDF[++_t_ENDF[0]]
f = (p ? _tbframe_i0(f, p, p0, p1) : "")
--_t_ENDF[0]
@@ -5656,6 +5528,7 @@ function _tbframe_i0(f, p, p0, p1, a)
#_______________________________________________________________________
function _tbframex(f, p, p0, p1)
{
+ ###########################################
delete _t_ENDF[++_t_ENDF[0]]
f = (p ? _tbframex_i0(f, p, p0, p1) : "")
--_t_ENDF[0]
@@ -5674,6 +5547,7 @@ function _tbframex_i0(f, p, p0, p1)
#_____________________________________________________________________________
function _tbpass(f, p, p0, p1)
{
+ ###################################################
delete _t_ENDF[++_t_ENDF[0]]
f = (p ? _tbpass_i0(f, p, p0, p1) : "")
--_t_ENDF[0]
@@ -5692,6 +5566,7 @@ function _tbpass_i0(f, p, p0, p1, a)
#_____________________________________________________________________________
function _tbpassx(f, p, p0, p1)
{
+ ##################################################
delete _t_ENDF[++_t_ENDF[0]]
f = (p ? _tbpassx_i0(f, p, p0, p1) : "")
--_t_ENDF[0]
@@ -5710,6 +5585,7 @@ function _tbpassx_i0(f, p, p0, p1)
#_____________________________________________________________________________
function _tbrochld(p, f, pp)
{
+ ################################################### # TEST!!!
if (p) {
if (p in _tFCHLD) {
f = _tFCHLD[p]
@@ -5793,30 +5669,35 @@ function _tbrochld(p, f, pp)
#_________________________________________________________________
function _tbrunframe(f, p, p0, p1)
{
+ ###################################
return _tbframe((f ? f : "_trunframe_i0"), p, p0, p1)
}
#_________________________________________________________________
function _tbrunframex(f, p, p0, p1)
{
+ ##################################
return _tbframex((f ? f : "_trunframe_i0"), p, p0, p1)
}
#_________________________________________________________________
function _tbrunpass(f, p, p0, p1)
{
+ ####################################
return _tbpass((f ? f : "_trunframe_i0"), p, p0, p1)
}
#_________________________________________________________________
function _tbrunpassx(f, p, p0, p1)
{
+ ###################################
return _tbpassx((f ? f : "_trunframe_i0"), p, p0, p1)
}
#_____________________________________________________________________________
function _tdel(p, i)
{
+ ##########################################################
if (p in _) {
_texclude(p)
for (i in _ptr[p]) {
@@ -5872,6 +5753,7 @@ function _tdel_i1(A, i)
#_____________________________________________________________________________
function _tdelete(p, v)
{
+ ####################################################### # REMAKE EXCLUDE
if (p) {
_wLCHLD(_tDELPTR, p)
}
@@ -5881,6 +5763,7 @@ function _tdelete(p, v)
#_________________________________________________________________
function _tdelitem(p)
{
+ #############################################
if (p) {
if ("HOST" in _PTR[p] && "ITEMNAME" in _[p]) {
return _wLCHLD(_PTR[_PTR[p]["HOST"]]["ITEM"][_[p]["ITEMNAME"]], p)
@@ -5893,6 +5776,7 @@ function _tdelitem(p)
#_______________________________________________________________________
function _tend(a, b)
{
+ #####################################################
if (b == "") {
return (_t_ENDF[_t_ENDF[0]] = a)
} else {
@@ -5903,6 +5787,7 @@ function _tend(a, b)
#_____________________________________________________________________________
function _texclude(p, v, pp)
{
+ ################################################### # TEST!!!
if (p in _) {
if (p in _tPARENT) {
pp = _tPARENT[p]
@@ -5945,6 +5830,7 @@ function _texclude(p, v, pp)
#_____________________________________________________________________________
function _tframe(fF, p, p0, p1, p2)
{
+ ###############################################
delete _t_ENDF[++_t_ENDF[0]]
p = (_isptr(p) ? (isarray(fF) ? _tframe_i1(fF, p, p0, p1, p2) : _tframe_i0(fF, p, p0, p1, p2)) : "")
--_t_ENDF[0]
@@ -5954,6 +5840,7 @@ function _tframe(fF, p, p0, p1, p2)
#_____________________________________________________________________________
function _tframe0(f, p, p0, p1, p2, p3, A)
{
+ #########################################
if (_isptr(p)) {
if (isarray(f)) {
return _tframe0_i0(f, p)
@@ -6020,6 +5907,7 @@ function _tframe0_i2(A, m, p)
#_________________________________________________________________
function _tframe1(f, p, p0, p1, p2, p3, A)
{
+ #############################
if (_isptr(p)) {
if (isarray(f)) {
return _tframe1_i0(f, p, p0)
@@ -6075,6 +5963,7 @@ function _tframe1_i2(A, m, p, p0)
#_________________________________________________________________
function _tframe2(f, p, p0, p1, p2, p3, A)
{
+ #############################
if (_isptr(p)) {
if (isarray(f)) {
return _tframe2_i0(f, p, p0, p1)
@@ -6130,6 +6019,7 @@ function _tframe2_i2(A, m, p, p0, p1)
#_________________________________________________________________
function _tframe3(f, p, p0, p1, p2, p3, A)
{
+ #############################
if (_isptr(p)) {
if (isarray(f)) {
return _tframe3_i0(f, p, p0, p1, p2)
@@ -6185,6 +6075,7 @@ function _tframe3_i2(A, m, p, p0, p1, p2)
#_________________________________________________________________
function _tframe4(f, p, p0, p1, p2, p3, A)
{
+ #############################
if (_isptr(p)) {
if (isarray(f)) {
return _tframe4_i0(f, p, p0, p1, p2, p3)
@@ -6258,6 +6149,7 @@ function _tframe_i1(F, p, p0, p1, p2, a)
#_______________________________________________________________________
function _tframex(f, p, p0, p1)
{
+ ############################################
delete _t_ENDF[++_t_ENDF[0]]
f = (p ? _tframex_i0(f, p, p0, p1) : "")
--_t_ENDF[0]
@@ -6367,6 +6259,7 @@ function _tgenuid_init(a, b, A)
#_______________________________________________________________________
function _tgetitem(p, n, a, b)
{
+ ############################################
if (p) {
if (isarray(_PTR[p]["ITEM"]) && n in _PTR[p]["ITEM"]) {
a = _PTR[p]["ITEM"][n]
@@ -6385,6 +6278,7 @@ function _tgetitem(p, n, a, b)
#_________________________________________________________________
function _tgetsp(p)
{
+ ###############################################
return _tSTACK[p][0]
}
@@ -6396,33 +6290,38 @@ function _th0(p, p1, p2, p3)
return p
}
-#_________________________________________________________________
+##########################################
function _th1(p0, p, p2, p3)
{
+ #_________________________________________________________________
return p
}
-#_________________________________________________________________
+##############################
function _th10(p0, p1)
{
+ #_________________________________________________________________
return (p1 p0)
}
-#_________________________________________________________________
+##############################
function _th2(p0, p1, r, p3)
{
+ #_________________________________________________________________
return p
}
-#_________________________________________________________________
+##############################
function _th3(p0, p1, p2, r)
{
+ #_________________________________________________________________
return p
}
#_________________________________________________________________
function _tifend(l)
{
+ ###############################################
return ((_t_ENDF[0] + l in _t_ENDF ? (_t_ENDF[_t_ENDF[0] + l] ? _t_ENDF[_t_ENDF[0] + l] : 1) : ""))
}
@@ -6518,17 +6417,6 @@ function _tinit_i0(D, S, i)
# modify everywhere checking ptr not by `if ( ptr )...', but by `if ( ptr in _ )...'
# _TMP0, _TMP1 name change to something like _DATA name ???
# think about redesigning routines for not depending if ptr is exist in tsysarrs: reason: performance\light code
-
-
-
-
-
-
-
-
-
-
-
function _tlist(L, p, f)
{
_tlisti1 = _tlisti0 = L[_ARRLEN] + 0
@@ -6592,6 +6480,7 @@ function _tlist_i1(L, p)
#_________________________________________________________________
function _tmbframe(f, p, p0, p1, t)
{
+ ##################################
while (p && ! (_t_ENDF[0] in _t_ENDF)) {
t = t _tbframe_i0(f, p, p0, p1, p = (p in _tPREV ? _tPREV[p] : ""))
}
@@ -6601,6 +6490,7 @@ function _tmbframe(f, p, p0, p1, t)
#_________________________________________________________________
function _tmbframex(f, p, p0, p1, t)
{
+ #################################
while (p && ! (_t_ENDF[0] in _t_ENDF)) {
t = t _tbframex_i0(f, p, p0, p1)
p = (p in _tPREV ? _tPREV[p] : "")
@@ -6611,6 +6501,7 @@ function _tmbframex(f, p, p0, p1, t)
#_________________________________________________________________
function _tmbpass(f, p, p0, p1)
{
+ ######################################
while (p && ! (_t_ENDF[0] in _t_ENDF)) {
p0 = _tbpass_i0(f, p, p0, p1, p = (p in _tPREV ? _tPREV[p] : ""))
}
@@ -6620,6 +6511,7 @@ function _tmbpass(f, p, p0, p1)
#_________________________________________________________________
function _tmbpassx(f, p, p0, p1)
{
+ #####################################
while (p && ! (_t_ENDF[0] in _t_ENDF)) {
p0 = _tbpassx_i0(f, p, p0, p1)
p = (p in _tPREV ? _tPREV[p] : "")
@@ -6630,6 +6522,7 @@ function _tmbpassx(f, p, p0, p1)
#_________________________________________________________________
function _tmframe(f, p, p0, p1, p2)
{
+ ###################################
delete _t_ENDF[++_t_ENDF[0]]
f = (p ? _tmframe_i0(f, p, p0, p1, p2) : "")
--_t_ENDF[0]
@@ -6657,6 +6550,7 @@ function _tmframe_i1(F, p, p0, p1, p2, t)
#_________________________________________________________________
function _tmframex(f, p, p0, p1, t)
{
+ ##################################
while (p && ! (_t_ENDF[0] in _t_ENDF)) {
t = t _tframex_i0(f, p, p0, p1)
p = (p in _tNEXT ? _tNEXT[p] : "")
@@ -6667,6 +6561,7 @@ function _tmframex(f, p, p0, p1, t)
#_________________________________________________________________
function _tmpass(f, p, p0, p1)
{
+ #######################################
while (p && ! (_t_ENDF[0] in _t_ENDF)) {
p0 = _tbpass_i0(f, p, p0, p1, p = (p in _tNEXT ? _tNEXT[p] : ""))
}
@@ -6676,6 +6571,7 @@ function _tmpass(f, p, p0, p1)
#_________________________________________________________________
function _tmpassx(f, p, p0, p1)
{
+ ######################################
while (p && ! (_t_ENDF[0] in _t_ENDF)) {
p0 = _tbpassx_i0(f, p, p0, p1)
p = (p in _tNEXT ? _tNEXT[p] : "")
@@ -6719,6 +6615,7 @@ function _torexp_rexp(t)
#_____________________________________________________________________________
function _tpass(f, p, p0, p1)
{
+ ####################################################
delete _t_ENDF[++_t_ENDF[0]]
f = (p ? _tpass_i0(f, p, p0, p1) : "")
--_t_ENDF[0]
@@ -6737,6 +6634,7 @@ function _tpass_i0(f, p, p0, p1, a)
#_____________________________________________________________________________
function _tpassx(f, p, p0, p1)
{
+ ###################################################
delete _t_ENDF[++_t_ENDF[0]]
f = (p ? _tpassx_i0(f, p, p0, p1) : "")
--_t_ENDF[0]
@@ -6755,6 +6653,7 @@ function _tpassx_i0(f, p, p0, p1)
#_________________________________________________________________
function _tpop(p, aA, a)
{
+ ###########################################
if ((a = _tSTACK[p][0]) > 0) {
_tSTACK[p][0]--
if (isarray(_tSTACK[p][a])) {
@@ -6770,6 +6669,7 @@ function _tpop(p, aA, a)
#_____________________________________________________________________________
function _tpush(p, aA, a)
{
+ ######################################################
if (isarray(aA)) {
delete _tSTACK[p][a = ++_tSTACK[p][0]]
_tSTACK[p][a][""]
@@ -6786,7 +6686,6 @@ function _tpush(p, aA, a)
# sechr - aware character `.' as the first char of sechr, and character `}'
# suffix - aware character `]'
# cntptr - aware character `]'
-
function _tr(n, cs, H)
{
#_tuidinitcs[p]=cs
@@ -6808,6 +6707,7 @@ function _tr(n, cs, H)
#_______________________________________________________________________
function _trace(t, d, A)
{
+ #################################################
if (_ERRLOG_TF) {
A["TYPE"] = "TRACE"
A["TEXT"] = t
@@ -6818,6 +6718,7 @@ function _trace(t, d, A)
#_________________________________________________________________
function _trunframe(f, p, p0, p1, p2)
{
+ #################################
return _tframe((f ? f : "_trunframe_i0"), p, p0, p1, p2)
}
@@ -6833,24 +6734,28 @@ function _trunframe_i0(p, p0, p1, p2, f)
#_________________________________________________________________
function _trunframex(f, p, p0, p1)
{
+ ###################################
return _tframex((f ? f : "_trunframe_i0"), p, p0, p1)
}
#_________________________________________________________________
function _trunpass(f, p, p0, p1)
{
+ #####################################
return _tpass((f ? f : "_trunframe_i0"), p, p0, p1)
}
#_________________________________________________________________
function _trunpassx(f, p, p0, p1)
{
+ ####################################
return _tpassx((f ? f : "_trunframe_i0"), p, p0, p1)
}
#_________________________________________________________________
function _tsetsp(p, v)
{
+ #############################################
return (_tSTACK[p][0] = v)
}
@@ -6914,9 +6819,6 @@ function _tsetsp(p, v)
# _tUIDCHRH
# create default class basic `new' and `del' functions
-
-
-
function _tstini()
{
_ini("uidel:pfx'hstr|lstr'sfx")
@@ -7031,6 +6933,7 @@ function _typa(p, A)
#_______________________________________________________________________
function _tzend(a, b)
{
+ #####################################################
if (b == 0 && b == "") {
return (_TEND[_TEND[_ARRLEN]] = a)
} else {
@@ -7160,8 +7063,6 @@ function _uninit_del(A, i, p0)
#_______________________________________________________________________
# var _constatstr
####################################################################################
-
-
function _unstr(t)
{
return gensub(/\\(.)/, "\\1", "G", t)
@@ -7170,6 +7071,7 @@ function _unstr(t)
#_________________________________________________________________
function _untmp(f, a)
{
+ #############################################
if (f = filepath(f)) {
if (match(f, /\\$/)) {
_deletepfx(_FILEIO_RDTMP, a = toupper(f))
@@ -7221,6 +7123,7 @@ function _var(v, t)
#_______________________________________________________________________
function _verb(t, d, A)
{
+ ##################################################
if (_ERRLOG_VF) {
A["TYPE"] = "VERB"
A["TEXT"] = t
@@ -7231,13 +7134,14 @@ function _verb(t, d, A)
#_________________________________________________________________
function _wFBRO(p, v, a)
{
+ ###########################################
if (p) {
if (v) {
for (a = p; a in _tPARENT; ) {
if ((a = _tPARENT[a]) == v) {
return v
}
- }
+ } ######################## v is parentesis of p
if (p in _tPARENT) {
p = _tPARENT[p]
if (v in _tNEXT) {
@@ -7327,15 +7231,15 @@ function _wFBRO(p, v, a)
} else {
if (v == 0) {
return v
- }
+ } ######################## p=ptr, v=0
return v
}
- } else {
+ } else { ######################## p=ptr, v=""
if (p == 0) {
- return v
+ return v ######################## p=0
}
if (v) {
- return _texclude(v)
+ return _texclude(v) ######################## p="", v=ptr - exclude v
}
return v
}
@@ -7344,16 +7248,17 @@ function _wFBRO(p, v, a)
#_________________________________________________________________
function _wFCHLD(p, v, a)
{
+ ##########################################
if (p) {
if (v) {
if (p == v) {
return v
- }
+ } ######################## p=v=ptr
for (a = p; a in _tPARENT; ) {
if ((a = _tPARENT[a]) == v) {
return v
}
- }
+ } ######################## v is parentesis of p
if (v in _tNEXT) {
if (v in _tPREV) {
_tPREV[_tNEXT[a] = _tNEXT[v]] = a = _tPREV[v]
@@ -7408,7 +7313,7 @@ function _wFCHLD(p, v, a)
return (_tFCHLD[_tPARENT[v] = p] = _tLCHLD[p] = v)
} else {
if (v == 0) {
- if (p in _tFCHLD) {
+ if (p in _tFCHLD) { ######################## p=ptr, v=0 > delete all chld
v = _tFCHLD[p]
delete _tFCHLD[p]
delete _tLCHLD[p]
@@ -7420,9 +7325,9 @@ function _wFCHLD(p, v, a)
}
return v
}
- } else {
+ } else { ######################## p=ptr, v="" > ignore action
if (p == 0) {
- return v
+ return v ######################## p=0
}
return v
}
@@ -7431,13 +7336,14 @@ function _wFCHLD(p, v, a)
#_________________________________________________________________
function _wLBRO(p, v, a)
{
+ ###########################################
if (p) {
if (v) {
for (a = p; a in _tPARENT; ) {
if ((a = _tPARENT[a]) == v) {
return v
}
- }
+ } ######################## v is parentesis of p
if (p in _tPARENT) {
p = _tPARENT[p]
if (v in _tPREV) {
@@ -7527,15 +7433,15 @@ function _wLBRO(p, v, a)
} else {
if (v == 0) {
return v
- }
+ } ######################## p=ptr, v=0
return v
}
- } else {
+ } else { ######################## p=ptr, v=""
if (p == 0) {
- return v
+ return v ######################## p=0
}
if (v) {
- return _texclude(v)
+ return _texclude(v) ######################## p="", v=ptr - exclude v
}
return v
}
@@ -7544,16 +7450,17 @@ function _wLBRO(p, v, a)
#_________________________________________________________________
function _wLCHLD(p, v, a)
{
+ ##########################################
if (p) {
if (v) {
if (p == v) {
return v
- }
+ } ######################## p=v=ptr
for (a = p; a in _tPARENT; ) {
if ((a = _tPARENT[a]) == v) {
return v
}
- }
+ } ######################## v is parentesis of p
if (v in _tPREV) {
if (v in _tNEXT) {
_tNEXT[_tPREV[a] = _tPREV[v]] = a = _tNEXT[v]
@@ -7608,7 +7515,7 @@ function _wLCHLD(p, v, a)
return (_tLCHLD[_tPARENT[v] = p] = _tFCHLD[p] = v)
} else {
if (v == 0) {
- if (p in _tFCHLD) {
+ if (p in _tFCHLD) { ######################## p=ptr, v=0 > delete all chld
v = _tFCHLD[p]
delete _tFCHLD[p]
delete _tLCHLD[p]
@@ -7620,9 +7527,9 @@ function _wLCHLD(p, v, a)
}
return v
}
- } else {
+ } else { ######################## p=ptr, v="" > ignore action
if (p == 0) {
- return v
+ return v ######################## p=0
}
return v
}
@@ -7631,22 +7538,24 @@ function _wLCHLD(p, v, a)
#_________________________________________________________________
function _wLINK(p, v)
{
+ ##############################################
return (_tLINK[p] = v)
}
#_________________________________________________________________
function _wNEXT(p, v, a, b)
{
+ #########################################
if (p) {
if (v) {
if (p == v) {
return v
- }
+ } ######################## p=v=ptr
for (a = p; a in _tPARENT; ) {
if ((a = _tPARENT[a]) == v) {
return v
}
- }
+ } ######################## v is parentesis of p
if (v in _tPREV) {
if (p == (a = _tPREV[v])) {
return v
@@ -7694,15 +7603,15 @@ function _wNEXT(p, v, a, b)
} else {
if (v == 0) {
return v
- }
+ } ######################## p=ptr, v=0
return v
}
- } else {
+ } else { ######################## p=ptr, v=""
if (p == 0) {
- return v
+ return v ######################## p=0
}
if (v) {
- return _texclude(v)
+ return _texclude(v) ######################## p="", v=ptr - exclude v
}
return v
}
@@ -7711,22 +7620,24 @@ function _wNEXT(p, v, a, b)
#_________________________________________________________________
function _wPARENT(p, v)
{
+ ############################################
return v
}
#_________________________________________________________________
function _wPREV(p, v, a, b)
{
+ #########################################
if (p) {
if (v) {
if (p == v) {
return v
- }
+ } ######################## p=v=ptr
for (a = p; a in _tPARENT; ) {
if ((a = _tPARENT[a]) == v) {
return v
}
- }
+ } ######################## v is parentesis of p
if (v in _tNEXT) {
if (p == (a = _tNEXT[v])) {
return v
@@ -7774,15 +7685,15 @@ function _wPREV(p, v, a, b)
} else {
if (v == 0) {
return v
- }
+ } ######################## p=ptr, v=0
return v
}
- } else {
+ } else { ######################## p=ptr, v=""
if (p == 0) {
- return v
+ return v ######################## p=0
}
if (v) {
- return _texclude(v)
+ return _texclude(v) ######################## p="", v=ptr - exclude v
}
return v
}
@@ -7791,17 +7702,19 @@ function _wPREV(p, v, a, b)
#_________________________________________________________________
function _wQBRO(p, v)
{
+ ##############################################
return v
}
#_________________________________________________________________
function _wQCHLD(p, v)
{
+ #############################################
if (p) {
if (v) {
- } else {
+ } else { ######################## p=ptr, v=ptr
if (v == 0) {
- if (p in _tFCHLD) {
+ if (p in _tFCHLD) { ######################## p=ptr, v=0 > delete all chld
v = _tFCHLD[p]
delete _tFCHLD[p]
delete _tLCHLD[p]
@@ -7813,10 +7726,10 @@ function _wQCHLD(p, v)
}
return v
}
- } else {
+ } else { ######################## p=ptr, v="" > ignore action
if (p == 0) {
return v
- }
+ } ######################## p=0
return v
}
}
@@ -7824,6 +7737,7 @@ function _wQCHLD(p, v)
#_______________________________________________________________________
function _warning(t, d, A)
{
+ ###############################################
if (_ERRLOG_WF) {
A["TYPE"] = "WARNING"
A["TEXT"] = t
@@ -7875,6 +7789,7 @@ function _wr_shortcut(f, S)
#_________________________________________________________________
function _wrfile(f, d, a, b)
{
+ #########################################
if ((f = _wfilerdnehnd(f)) == "" || _filene(f) == "") {
ERRNO = "Filename error"
return
@@ -7900,6 +7815,7 @@ function _wrfile(f, d, a, b)
#___________________________________________________________
function _wrfile1(f, d, a, b)
{
+ ##################################
if ((f = _wfilerdnehnd(f)) == "" || _filene(f) == "") {
ERRNO = "Filename error"
return
@@ -7925,6 +7841,7 @@ function _wrfile1(f, d, a, b)
#_______________________________________________________________________
function _yexport(p)
{
+ #####################################################
return _tframe("_yexport_i0", p)
}
@@ -7945,6 +7862,7 @@ function _yexport_i0(p, p0, p1, p2)
#_________________________________________________________________
function cmp_str_idx(i1, v1, i2, v2)
{
+ ##############################
return ((i1 < i2 ? -1 : 1))
}
@@ -8099,6 +8017,7 @@ function hujf(a, b, c)
#___________________________________________________________
function ncmp_str_idx(i1, v1, i2, v2)
{
+ #######################
return ((i1 < i2 ? 1 : -1))
}
@@ -8159,7 +8078,6 @@ function test_uid(p, i)
{
#test_cfg()
#return
-
_fclass = _cfguid(p = _getuid(_classys), p, "pfx", "sfx", "abc")
#_fclass=_cfguid(p=_getuid(_classys),_NOP,_NOP,_NOP,"",_classys)
_conl("_fclass uid: " _getuid(_fclass))
@@ -8207,7 +8125,6 @@ function tts(p, uidel, psfx, cnt, chr, p5, p6, p7, im)
# ptr _typ(p)=="`" _typ(p)<"`" ?
# ptr/arr _typ(p)+0!=_t0
# arr _typ(p)=="#" _typ(p)>"#" ?
-
function zorr(A, i, r)
{
if (i in A) {
@@ -8225,4 +8142,5 @@ function zorr(A, i, r)
#_____________________________________________________________________________
function zzer()
{
+ ################################################################
}