aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-06-19 12:42:37 +0300
committerArnold D. Robbins <arnold@skeeve.com>2015-06-19 12:42:37 +0300
commitec58524cb5a671c18c4af1b893e599eb04c7760a (patch)
tree1d1c3d298ec82caa03c0cf5caeb0dd14b08ce247
parent76e1f5bfee032dbcb5c19b3e4e92f96aa05731c3 (diff)
parentf7cd8a03c09a00c4cb520f881bbe838cf76e718f (diff)
downloadegawk-ec58524cb5a671c18c4af1b893e599eb04c7760a.tar.gz
egawk-ec58524cb5a671c18c4af1b893e599eb04c7760a.tar.bz2
egawk-ec58524cb5a671c18c4af1b893e599eb04c7760a.zip
Merge branch 'master' into feature/cmake
-rw-r--r--ChangeLog71
-rw-r--r--NEWS11
-rw-r--r--awk.h8
-rw-r--r--awkgram.c2129
-rw-r--r--awkgram.y125
-rw-r--r--awklib/ChangeLog5
-rw-r--r--awklib/eg/lib/inplace.awk18
-rw-r--r--awklib/eg/network/coreserv.awk2
-rw-r--r--awklib/extract.awk21
-rw-r--r--builtin.c56
-rw-r--r--doc/ChangeLog24
-rw-r--r--doc/gawk.info1262
-rw-r--r--doc/gawk.texi156
-rw-r--r--doc/gawkinet.info2563
-rw-r--r--doc/gawkinet.texi2
-rw-r--r--doc/gawktexi.in156
-rw-r--r--eval.c6
-rw-r--r--extension/ChangeLog11
-rw-r--r--extension/inplace.3am14
-rw-r--r--hardregex.txt24
-rw-r--r--profile.c38
-rw-r--r--re.c15
-rw-r--r--test/ChangeLog12
-rw-r--r--test/Makefile.am9
-rw-r--r--test/Makefile.in23
-rw-r--r--test/Maketests12
-rw-r--r--test/gsubind.awk9
-rw-r--r--test/gsubind.ok3
-rw-r--r--test/id.ok1
-rw-r--r--test/inplace1.ok2
-rw-r--r--test/inplace2.ok2
-rw-r--r--test/inplace3.ok4
-rw-r--r--test/typedregex1.awk296
-rw-r--r--test/typedregex1.ok37
-rw-r--r--test/typeof1.awk9
-rw-r--r--test/typeof1.ok7
36 files changed, 4267 insertions, 2876 deletions
diff --git a/ChangeLog b/ChangeLog
index bdfca3a0..220a8c44 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-06-19 Arnold D. Robbins <arnold@skeeve.com>
+
+ * builtin.c (do_isarray): Minor edit to lint warning.
+
2015-06-14 Arnold D. Robbins <arnold@skeeve.com>
* regcomp.c, regex_internal.h, regexec.c: Sync with GLIBC.
@@ -11,6 +15,10 @@
* regex_internal.h: Clean up defines for non-GCC for attribute;
essentially sync it with GLIBC.
+2015-06-12 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y: Finish converting "hard" regex to "typed" regex.
+
2015-05-31 Arnold D. Robbins <arnold@skeeve.com>
* field.c (posix_def_parse_field): Removed. It's no longer
@@ -47,6 +55,11 @@
in PROCINFO["argv"][0..argc-1].
(load_procinfo): Call load_procinfo_argv.
+2015-05-11 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h, awkgram.y, builtin.c, eval.c profile.c, re.c:
+ Change Node_hardregex to Node_typedregex everywhere.
+
2015-05-05 Arnold D. Robbins <arnold@skeeve.com>
* awkgram.y (yylex): Yet Another Fix for parsing bracket
@@ -57,6 +70,14 @@
* config.guess, config.sub: Get latest versions.
+ Make profiling for hard regexes work.
+
+ * profile.c (pp_string_or_hard_regex): Renamed from pp_string.
+ Add bool param for hard regex and add @ if so.
+ (pp_string): New function, calls pp_string_or_hard_regex.
+ (pp_hard_regex): New function, calls pp_string_or_hard_regex.
+ (pprint): Adjust to print a hard regex correctly.
+
2015-05-01 Arnold D. Robbins <arnold@skeeve.com>
* awkgram.y: Make sure values are not null in param list.
@@ -81,6 +102,11 @@
2015-04-28 Arnold D. Robbins <arnold@skeeve.com>
+ * builtin.c (isarray): Add lint warning that isarray()
+ is deprecated.
+
+2015-04-28 Arnold D. Robbins <arnold@skeeve.com>
+
* awkgram.y (yylex): Rework the bracket handling from zero.
Thanks to Michal Jaegermann for yet another test case.
@@ -167,6 +193,11 @@
* builtin.c (do_sub): Improve some variable names for readability
and add / expand some comments.
+ Unrelated:
+
+ * builtin.c (call_sub, call_match, call_split_func): Allow for
+ regex to be Node_hardregex.
+
2015-04-14 Andrew J. Schorr <aschorr@telemetry-investments.com>
Arnold D. Robbins <arnold@skeeve.com>
@@ -245,6 +276,14 @@
Thanks to Andrew Schorr for finding the problem and supplying
initial code; I did it slightly differently.
+2015-04-03 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (force_string): If hard_regex, return string text of the regex.
+ (force_string, force_number): If hard_regex, return Nnull_string.
+ * awkgram.y: Fix ~ and !~ with @/.../.
+ * eval.c (setup_frame): Handle a hard regex.
+ * re.c (avoid_dfa): Ditto.
+
2015-04-02 Andrew J. Schorr <aschorr@telemetry-investments.com>
* NEWS: Rename div to intdiv.
@@ -309,6 +348,24 @@
* interpret.h (r_interpret): If calling do_sub, do it through
call_sub_func().
+2015-03-19 Arnold D. Robbins <arnold@skeeve.com>
+
+ * re.c (re_update): Handle hard regex - for sub/gsub/gensub.
+ * awkgram.y (grammar): Add support for hard_regex with ~ and !~;
+ allowed only on the right hand side.
+ (mk_rexp): Handle a hard regex.
+
+2015-03-18 Arnold D. Robbins <arnold@skeeve.com>
+
+ * builtin.c (do_typeof): Be smarter about checking for uninitialized
+ values; can now detect and return "untyped" for such values.
+ * awkgram.y (yylex): Collect @/.../ entirely in the lexer and return
+ a new terminal (HARD_REGEX).
+ (regexp): Reverted to just a regular awk regexp constant.
+ (hard_regexp): New nonterminal, can be used only in direct
+ assignment and as an argument in function call. New set of nonterminals
+ for function call expression lists. More work still to do.
+
2015-03-18 Arnold D. Robbins <arnold@skeeve.com>
* config.guess, config.sub: Updated, from libtool 2.4.6.
@@ -350,6 +407,20 @@
a long-standing problem where `-lm' was used twice in the final
compilation line.
+2015-02-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ Start on making regexp a real type.
+
+ * awk.h (Node_hardregex): New node type.
+ (do_typeof): Add declaration.
+ * awkgram.y: Make @/.../ a hard regex.
+ (tokentab): New entry for typeof() function.
+ (snode): Try to handle typeof().
+ (make_regnode): Handle Node_hardregex.
+ * builtin.c (do_typeof): New function.
+ * eval.c (nodetypes): Add Node_hardregex.
+ * re.c (re_update): Check for hardregex too in assert.
+
2015-02-24 Arnold D. Robbins <arnold@skeeve.com>
* POSIX.STD: Update copyright year.
diff --git a/NEWS b/NEWS
index aee92c13..92a30139 100644
--- a/NEWS
+++ b/NEWS
@@ -48,13 +48,22 @@ Changes from 4.1.x to 4.2.0
11. Gawk now supports retryable I/O via PROCINFO[input-file, "RETRY"]; see
the manual.
-12. The API minor version has been increased to two; the get_file()
+12. The API minor version has been increased to 2; the get_file()
API provides access to open redirections. Also see the manual.
13. Revisions in the POSIX standard remove the special case for POSIX
mode when FS = " " where newline was not a field separator. The code
and doc have been updated.
+14. Gawk now supports strongly typed regexp constants. Such constants
+ look like @/.../. You can assign them to variables, pass them to
+ functions, use them in ~, !~ and the case part of a switch statement.
+ More details are provided in the manual.
+
+15. The new typeof() function can be used to indicate if a variable or
+ array element is an array, regexp, string or number. The isarray()
+ function is deprecated in favor of typeof().
+
Changes from 4.1.2 to 4.1.3
---------------------------
diff --git a/awk.h b/awk.h
index b81a99b9..5acd33d8 100644
--- a/awk.h
+++ b/awk.h
@@ -277,6 +277,7 @@ typedef enum nodevals {
Node_val, /* node is a value - type in flags */
Node_regex, /* a regexp, text, compiled, flags, etc */
Node_dynregex, /* a dynamic regexp */
+ Node_typedregex, /* like Node_regex, but is a real type */
/* symbol table values */
Node_var, /* scalar variable, lnode is value */
@@ -1384,6 +1385,7 @@ extern NODE *do_dcgettext(int nargs);
extern NODE *do_dcngettext(int nargs);
extern NODE *do_bindtextdomain(int nargs);
extern NODE *do_intdiv(int nargs);
+extern NODE *do_typeof(int nargs);
extern int strncasecmpmbs(const unsigned char *,
const unsigned char *, size_t);
/* eval.c */
@@ -1763,6 +1765,9 @@ dupnode(NODE *n)
static inline NODE *
force_string(NODE *s)
{
+ if (s->type == Node_typedregex)
+ return s->re_exp;
+
if ((s->flags & STRCUR) != 0
&& (s->stfmt == -1 || s->stfmt == CONVFMTidx)
)
@@ -1785,6 +1790,9 @@ unref(NODE *r)
static inline NODE *
force_number(NODE *n)
{
+ if (n->type == Node_typedregex)
+ return Nnull_string;
+
return (n->flags & NUMCUR) != 0 ? n : str2number(n);
}
diff --git a/awkgram.c b/awkgram.c
index c7fb30a8..12f648ed 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -245,51 +245,52 @@ extern int yydebug;
FILENAME = 261,
YNUMBER = 262,
YSTRING = 263,
- RELOP = 264,
- IO_OUT = 265,
- IO_IN = 266,
- ASSIGNOP = 267,
- ASSIGN = 268,
- MATCHOP = 269,
- CONCAT_OP = 270,
- SUBSCRIPT = 271,
- LEX_BEGIN = 272,
- LEX_END = 273,
- LEX_IF = 274,
- LEX_ELSE = 275,
- LEX_RETURN = 276,
- LEX_DELETE = 277,
- LEX_SWITCH = 278,
- LEX_CASE = 279,
- LEX_DEFAULT = 280,
- LEX_WHILE = 281,
- LEX_DO = 282,
- LEX_FOR = 283,
- LEX_BREAK = 284,
- LEX_CONTINUE = 285,
- LEX_PRINT = 286,
- LEX_PRINTF = 287,
- LEX_NEXT = 288,
- LEX_EXIT = 289,
- LEX_FUNCTION = 290,
- LEX_BEGINFILE = 291,
- LEX_ENDFILE = 292,
- LEX_GETLINE = 293,
- LEX_NEXTFILE = 294,
- LEX_IN = 295,
- LEX_AND = 296,
- LEX_OR = 297,
- INCREMENT = 298,
- DECREMENT = 299,
- LEX_BUILTIN = 300,
- LEX_LENGTH = 301,
- LEX_EOF = 302,
- LEX_INCLUDE = 303,
- LEX_EVAL = 304,
- LEX_LOAD = 305,
- NEWLINE = 306,
- SLASH_BEFORE_EQUAL = 307,
- UNARY = 308
+ TYPED_REGEXP = 264,
+ RELOP = 265,
+ IO_OUT = 266,
+ IO_IN = 267,
+ ASSIGNOP = 268,
+ ASSIGN = 269,
+ MATCHOP = 270,
+ CONCAT_OP = 271,
+ SUBSCRIPT = 272,
+ LEX_BEGIN = 273,
+ LEX_END = 274,
+ LEX_IF = 275,
+ LEX_ELSE = 276,
+ LEX_RETURN = 277,
+ LEX_DELETE = 278,
+ LEX_SWITCH = 279,
+ LEX_CASE = 280,
+ LEX_DEFAULT = 281,
+ LEX_WHILE = 282,
+ LEX_DO = 283,
+ LEX_FOR = 284,
+ LEX_BREAK = 285,
+ LEX_CONTINUE = 286,
+ LEX_PRINT = 287,
+ LEX_PRINTF = 288,
+ LEX_NEXT = 289,
+ LEX_EXIT = 290,
+ LEX_FUNCTION = 291,
+ LEX_BEGINFILE = 292,
+ LEX_ENDFILE = 293,
+ LEX_GETLINE = 294,
+ LEX_NEXTFILE = 295,
+ LEX_IN = 296,
+ LEX_AND = 297,
+ LEX_OR = 298,
+ INCREMENT = 299,
+ DECREMENT = 300,
+ LEX_BUILTIN = 301,
+ LEX_LENGTH = 302,
+ LEX_EOF = 303,
+ LEX_INCLUDE = 304,
+ LEX_EVAL = 305,
+ LEX_LOAD = 306,
+ NEWLINE = 307,
+ SLASH_BEFORE_EQUAL = 308,
+ UNARY = 309
};
#endif
/* Tokens. */
@@ -299,51 +300,52 @@ extern int yydebug;
#define FILENAME 261
#define YNUMBER 262
#define YSTRING 263
-#define RELOP 264
-#define IO_OUT 265
-#define IO_IN 266
-#define ASSIGNOP 267
-#define ASSIGN 268
-#define MATCHOP 269
-#define CONCAT_OP 270
-#define SUBSCRIPT 271
-#define LEX_BEGIN 272
-#define LEX_END 273
-#define LEX_IF 274
-#define LEX_ELSE 275
-#define LEX_RETURN 276
-#define LEX_DELETE 277
-#define LEX_SWITCH 278
-#define LEX_CASE 279
-#define LEX_DEFAULT 280
-#define LEX_WHILE 281
-#define LEX_DO 282
-#define LEX_FOR 283
-#define LEX_BREAK 284
-#define LEX_CONTINUE 285
-#define LEX_PRINT 286
-#define LEX_PRINTF 287
-#define LEX_NEXT 288
-#define LEX_EXIT 289
-#define LEX_FUNCTION 290
-#define LEX_BEGINFILE 291
-#define LEX_ENDFILE 292
-#define LEX_GETLINE 293
-#define LEX_NEXTFILE 294
-#define LEX_IN 295
-#define LEX_AND 296
-#define LEX_OR 297
-#define INCREMENT 298
-#define DECREMENT 299
-#define LEX_BUILTIN 300
-#define LEX_LENGTH 301
-#define LEX_EOF 302
-#define LEX_INCLUDE 303
-#define LEX_EVAL 304
-#define LEX_LOAD 305
-#define NEWLINE 306
-#define SLASH_BEFORE_EQUAL 307
-#define UNARY 308
+#define TYPED_REGEXP 264
+#define RELOP 265
+#define IO_OUT 266
+#define IO_IN 267
+#define ASSIGNOP 268
+#define ASSIGN 269
+#define MATCHOP 270
+#define CONCAT_OP 271
+#define SUBSCRIPT 272
+#define LEX_BEGIN 273
+#define LEX_END 274
+#define LEX_IF 275
+#define LEX_ELSE 276
+#define LEX_RETURN 277
+#define LEX_DELETE 278
+#define LEX_SWITCH 279
+#define LEX_CASE 280
+#define LEX_DEFAULT 281
+#define LEX_WHILE 282
+#define LEX_DO 283
+#define LEX_FOR 284
+#define LEX_BREAK 285
+#define LEX_CONTINUE 286
+#define LEX_PRINT 287
+#define LEX_PRINTF 288
+#define LEX_NEXT 289
+#define LEX_EXIT 290
+#define LEX_FUNCTION 291
+#define LEX_BEGINFILE 292
+#define LEX_ENDFILE 293
+#define LEX_GETLINE 294
+#define LEX_NEXTFILE 295
+#define LEX_IN 296
+#define LEX_AND 297
+#define LEX_OR 298
+#define INCREMENT 299
+#define DECREMENT 300
+#define LEX_BUILTIN 301
+#define LEX_LENGTH 302
+#define LEX_EOF 303
+#define LEX_INCLUDE 304
+#define LEX_EVAL 305
+#define LEX_LOAD 306
+#define NEWLINE 307
+#define SLASH_BEFORE_EQUAL 308
+#define UNARY 309
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
@@ -361,7 +363,7 @@ int yyparse (void);
/* Copy the second part of user declarations. */
-#line 365 "awkgram.c" /* yacc.c:358 */
+#line 367 "awkgram.c" /* yacc.c:358 */
#ifdef short
# undef short
@@ -603,21 +605,21 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 1098
+#define YYLAST 1236
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 75
+#define YYNTOKENS 76
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 66
+#define YYNNTS 70
/* YYNRULES -- Number of rules. */
-#define YYNRULES 189
+#define YYNRULES 203
/* YYNSTATES -- Number of states. */
-#define YYNSTATES 336
+#define YYNSTATES 350
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 308
+#define YYMAXUTOK 309
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -629,16 +631,16 @@ static const yytype_uint8 yytranslate[] =
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 63, 2, 2, 66, 62, 2, 2,
- 67, 68, 60, 58, 55, 59, 2, 61, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 54, 74,
- 56, 2, 57, 53, 69, 2, 2, 2, 2, 2,
+ 2, 2, 2, 64, 2, 2, 67, 63, 2, 2,
+ 68, 69, 61, 59, 56, 60, 2, 62, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 55, 75,
+ 57, 2, 58, 54, 70, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 70, 2, 71, 65, 2, 2, 2, 2, 2,
+ 2, 71, 2, 72, 66, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 72, 2, 73, 2, 2, 2, 2,
+ 2, 2, 2, 73, 2, 74, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -656,7 +658,7 @@ static const yytype_uint8 yytranslate[] =
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 64
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 65
};
#if YYDEBUG
@@ -666,22 +668,24 @@ 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, 504, 509, 515,
- 543, 548, 549, 553, 555, 557, 564, 654, 696, 738,
- 851, 858, 865, 875, 884, 893, 902, 913, 929, 928,
- 952, 964, 964, 1062, 1062, 1095, 1125, 1131, 1132, 1138,
- 1139, 1146, 1151, 1163, 1177, 1179, 1187, 1192, 1194, 1202,
- 1204, 1213, 1214, 1222, 1227, 1227, 1238, 1242, 1250, 1251,
- 1254, 1256, 1261, 1262, 1271, 1272, 1277, 1282, 1291, 1293,
- 1295, 1302, 1303, 1309, 1310, 1315, 1317, 1322, 1324, 1332,
- 1337, 1346, 1353, 1355, 1357, 1373, 1383, 1390, 1392, 1397,
- 1399, 1401, 1409, 1411, 1416, 1418, 1423, 1425, 1427, 1477,
- 1479, 1481, 1483, 1485, 1487, 1489, 1491, 1505, 1510, 1515,
- 1540, 1546, 1548, 1550, 1552, 1554, 1556, 1561, 1565, 1597,
- 1599, 1605, 1611, 1624, 1625, 1626, 1631, 1636, 1640, 1644,
- 1659, 1672, 1677, 1714, 1743, 1744, 1750, 1751, 1756, 1758,
- 1765, 1782, 1799, 1801, 1808, 1813, 1821, 1831, 1843, 1852,
- 1856, 1860, 1864, 1868, 1872, 1875, 1877, 1881, 1885, 1889
+ 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, 1568, 1570, 1572, 1574, 1576, 1578, 1580,
+ 1582, 1596, 1601, 1606, 1631, 1637, 1639, 1641, 1643, 1645,
+ 1647, 1652, 1656, 1688, 1690, 1696, 1702, 1715, 1716, 1717,
+ 1722, 1727, 1731, 1735, 1750, 1763, 1768, 1805, 1834, 1835,
+ 1841, 1842, 1847, 1849, 1856, 1873, 1890, 1892, 1899, 1904,
+ 1912, 1922, 1934, 1943, 1947, 1951, 1955, 1959, 1963, 1966,
+ 1968, 1972, 1976, 1980
};
#endif
@@ -691,30 +695,32 @@ static const yytype_uint16 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "FUNC_CALL", "NAME", "REGEXP",
- "FILENAME", "YNUMBER", "YSTRING", "RELOP", "IO_OUT", "IO_IN", "ASSIGNOP",
- "ASSIGN", "MATCHOP", "CONCAT_OP", "SUBSCRIPT", "LEX_BEGIN", "LEX_END",
- "LEX_IF", "LEX_ELSE", "LEX_RETURN", "LEX_DELETE", "LEX_SWITCH",
- "LEX_CASE", "LEX_DEFAULT", "LEX_WHILE", "LEX_DO", "LEX_FOR", "LEX_BREAK",
- "LEX_CONTINUE", "LEX_PRINT", "LEX_PRINTF", "LEX_NEXT", "LEX_EXIT",
- "LEX_FUNCTION", "LEX_BEGINFILE", "LEX_ENDFILE", "LEX_GETLINE",
- "LEX_NEXTFILE", "LEX_IN", "LEX_AND", "LEX_OR", "INCREMENT", "DECREMENT",
- "LEX_BUILTIN", "LEX_LENGTH", "LEX_EOF", "LEX_INCLUDE", "LEX_EVAL",
- "LEX_LOAD", "NEWLINE", "SLASH_BEFORE_EQUAL", "'?'", "':'", "','", "'<'",
- "'>'", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "UNARY", "'^'", "'$'",
- "'('", "')'", "'@'", "'['", "']'", "'{'", "'}'", "';'", "$accept",
- "program", "rule", "source", "library", "pattern", "action", "func_name",
- "lex_builtin", "function_prologue", "$@1", "regexp", "$@2", "a_slash",
- "statements", "statement_term", "statement", "non_compound_stmt", "$@3",
- "simple_stmt", "$@4", "$@5", "opt_simple_stmt", "case_statements",
- "case_statement", "case_value", "print", "print_expression_list",
- "output_redir", "$@6", "if_statement", "nls", "opt_nls", "input_redir",
- "opt_param_list", "param_list", "opt_exp", "opt_expression_list",
- "expression_list", "exp", "assign_operator", "relop_or_less", "a_relop",
- "common_exp", "simp_exp", "simp_exp_nc", "non_post_simp_exp",
- "func_call", "direct_func_call", "opt_variable", "delete_subscript_list",
- "delete_subscript", "delete_exp_list", "bracketed_exp_list", "subscript",
- "subscript_list", "simple_variable", "variable", "opt_incdec", "l_brace",
- "r_brace", "r_paren", "opt_semi", "semi", "colon", "comma", YY_NULLPTR
+ "FILENAME", "YNUMBER", "YSTRING", "TYPED_REGEXP", "RELOP", "IO_OUT",
+ "IO_IN", "ASSIGNOP", "ASSIGN", "MATCHOP", "CONCAT_OP", "SUBSCRIPT",
+ "LEX_BEGIN", "LEX_END", "LEX_IF", "LEX_ELSE", "LEX_RETURN", "LEX_DELETE",
+ "LEX_SWITCH", "LEX_CASE", "LEX_DEFAULT", "LEX_WHILE", "LEX_DO",
+ "LEX_FOR", "LEX_BREAK", "LEX_CONTINUE", "LEX_PRINT", "LEX_PRINTF",
+ "LEX_NEXT", "LEX_EXIT", "LEX_FUNCTION", "LEX_BEGINFILE", "LEX_ENDFILE",
+ "LEX_GETLINE", "LEX_NEXTFILE", "LEX_IN", "LEX_AND", "LEX_OR",
+ "INCREMENT", "DECREMENT", "LEX_BUILTIN", "LEX_LENGTH", "LEX_EOF",
+ "LEX_INCLUDE", "LEX_EVAL", "LEX_LOAD", "NEWLINE", "SLASH_BEFORE_EQUAL",
+ "'?'", "':'", "','", "'<'", "'>'", "'+'", "'-'", "'*'", "'/'", "'%'",
+ "'!'", "UNARY", "'^'", "'$'", "'('", "')'", "'@'", "'['", "']'", "'{'",
+ "'}'", "';'", "$accept", "program", "rule", "source", "library",
+ "pattern", "action", "func_name", "lex_builtin", "function_prologue",
+ "$@1", "regexp", "$@2", "typed_regexp", "a_slash", "statements",
+ "statement_term", "statement", "non_compound_stmt", "$@3", "simple_stmt",
+ "$@4", "$@5", "opt_simple_stmt", "case_statements", "case_statement",
+ "case_value", "print", "print_expression_list", "output_redir", "$@6",
+ "if_statement", "nls", "opt_nls", "input_redir", "opt_param_list",
+ "param_list", "opt_exp", "opt_expression_list", "expression_list",
+ "opt_fcall_expression_list", "fcall_expression_list", "fcall_exp", "exp",
+ "assign_operator", "relop_or_less", "a_relop", "common_exp", "simp_exp",
+ "simp_exp_nc", "non_post_simp_exp", "func_call", "direct_func_call",
+ "opt_variable", "delete_subscript_list", "delete_subscript",
+ "delete_exp_list", "bracketed_exp_list", "subscript", "subscript_list",
+ "simple_variable", "variable", "opt_incdec", "l_brace", "r_brace",
+ "r_paren", "opt_semi", "semi", "colon", "comma", YY_NULLPTR
};
#endif
@@ -728,60 +734,61 @@ static const yytype_uint16 yytoknum[] =
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 63, 58, 44, 60, 62, 43, 45,
- 42, 47, 37, 33, 308, 94, 36, 40, 41, 64,
- 91, 93, 123, 125, 59
+ 305, 306, 307, 308, 63, 58, 44, 60, 62, 43,
+ 45, 42, 47, 37, 33, 309, 94, 36, 40, 41,
+ 64, 91, 93, 123, 125, 59
};
# endif
-#define YYPACT_NINF -271
+#define YYPACT_NINF -275
#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-271)))
+ (!!((Yystate) == (-275)))
-#define YYTABLE_NINF -105
+#define YYTABLE_NINF -115
#define yytable_value_is_error(Yytable_value) \
- (!!((Yytable_value) == (-105)))
+ (!!((Yytable_value) == (-115)))
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
static const yytype_int16 yypact[] =
{
- -271, 359, -271, -271, -35, 3, -271, -271, -271, -271,
- 241, -271, -271, 42, 42, 42, 9, 50, -271, -271,
- -271, 1002, 1002, -271, 1002, 287, 804, 31, -271, 83,
- 5, -271, -271, 72, 219, 975, 426, 456, -271, -271,
- -271, -271, 162, 772, 804, -271, 14, -271, -271, -271,
- -271, -271, 77, 66, -271, 80, -271, -271, -271, 772,
- 772, 168, 93, -6, 93, 93, 1002, 10, -271, -271,
- 27, 333, 44, 124, -271, 114, -271, -271, -271, 72,
- -271, 114, -271, 173, -271, -271, 1002, 169, 1002, 1002,
- 1002, 114, -271, -271, -271, 1002, 142, 426, 1002, 1002,
- 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002,
- -271, -271, -271, -271, 172, 1002, 119, 158, 741, 15,
- -271, -271, -271, -271, 1002, -271, 119, 119, 333, -271,
- -271, -271, 1002, 114, -271, 151, 850, -271, -271, 4,
- -10, -271, 17, -10, 72, -271, 579, -271, -271, 62,
- -271, 249, 373, 1041, 1002, 104, 42, -13, -13, 93,
- 93, 93, 93, -13, -13, 93, 93, 93, 93, -271,
- 741, -271, -271, 25, 426, -271, -271, 741, -271, 169,
- -271, 741, -271, -271, -271, -271, -271, 125, -271, 23,
- 127, 133, 114, 134, -10, -10, -271, -271, -10, 1002,
- -10, 114, -271, -271, -10, -271, -271, 741, -271, 130,
- 114, 1002, 741, -271, -271, -271, 119, 61, -271, 1002,
- 1002, -271, 189, 1002, 1002, 693, 883, -271, -271, -271,
- -10, 741, -271, -271, -271, 625, 579, 114, -271, -271,
- 741, 114, -271, 35, 333, -10, 3, 148, 333, 333,
- 194, -19, -271, 130, -271, 804, 226, -271, -271, -271,
- -271, -271, -271, 114, -271, -271, 41, -271, -271, -271,
- 114, 114, 175, 169, 114, 27, -271, -271, 693, -271,
- -271, 5, 693, 1002, 119, 726, 151, 1002, 220, -271,
- -271, 333, 114, 155, 114, 975, 114, 126, 114, 693,
- 114, 929, 693, -271, 384, 192, -271, 176, -271, -271,
- 929, 119, -271, -271, -271, 243, 245, -271, 192, -271,
- 114, -271, 119, 114, -271, -271, 114, -271, 114, 693,
- -271, 431, 693, -271, 505, -271
+ -275, 376, -275, -275, -12, -9, -275, -275, -275, -275,
+ 171, -275, -275, 44, 44, 44, 5, 40, -275, -275,
+ -275, 1139, 1139, -275, 1139, 1166, 869, 27, -275, -18,
+ 2, -275, -275, 89, 884, 1065, 192, 214, -275, -275,
+ -275, -275, 248, 795, 869, -275, 10, -275, -275, -275,
+ -275, -275, 116, 82, -275, 115, -275, -275, -275, 795,
+ 795, 166, 107, 104, 107, 107, 1139, 117, -275, -275,
+ 15, 349, 23, 45, -275, 125, -275, -275, -275, 89,
+ -275, 125, -275, 178, -275, -275, 1092, 172, 1139, 1139,
+ 1139, 125, -275, -275, -275, 1139, 146, 192, 1139, 1139,
+ 1139, 1139, 1139, 1139, 1139, 1139, 1139, 1139, 1139, 1139,
+ -275, 181, -275, -275, 173, 1139, -275, -275, -275, 128,
+ 73, -275, 1107, 14, 1107, -275, -275, -275, -275, 1139,
+ -275, 128, 128, 349, -275, -275, -275, 1139, 125, -275,
+ 152, 916, -275, -275, 16, 92, -275, 20, 92, 89,
+ -275, 599, -275, -275, -275, 148, -275, 124, 22, 1048,
+ 1139, 199, 44, 265, 265, 107, 107, 107, 107, 265,
+ 265, 107, 107, 107, 107, -275, -275, 1107, -275, 1092,
+ 842, -275, 43, 192, -275, -275, 1107, -275, 172, -275,
+ 1107, -275, -275, -275, -275, -275, 133, -275, 41, 144,
+ 145, 125, 147, 92, 92, -275, -275, 92, 1139, 92,
+ 125, -275, -275, 92, -275, -275, 1107, -275, 151, 125,
+ 1139, 1107, -275, -275, -275, -275, -275, -275, 128, 76,
+ -275, 1139, 1139, -275, 224, 1139, 1139, 715, 949, -275,
+ -275, -275, 92, 1107, -275, -275, -275, 646, 599, 125,
+ -275, -275, 1107, 125, -275, 49, 349, 92, -9, 160,
+ 349, 349, 206, 113, -275, 151, -275, 869, 225, -275,
+ 169, -275, -275, -275, -275, -275, 125, -275, -275, 11,
+ -275, -275, -275, 125, 125, 179, 172, 125, 15, -275,
+ -275, 715, -275, -275, 2, 715, 1139, 128, 762, 152,
+ 1139, 219, -275, -275, 349, 125, 275, 125, 1065, 125,
+ 112, 125, 715, 125, 997, 715, -275, 261, 205, -275,
+ 191, -275, -275, 997, 128, -275, -275, -275, 271, 272,
+ -275, -275, 205, -275, 125, -275, 128, 125, -275, -275,
+ 125, -275, 125, 715, -275, 449, 715, -275, 524, -275
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -789,64 +796,65 @@ static const yytype_int16 yypact[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 2, 0, 1, 6, 0, 175, 157, 158, 21, 22,
- 0, 23, 24, 164, 0, 0, 0, 152, 5, 88,
- 37, 0, 0, 36, 0, 0, 0, 0, 3, 0,
- 0, 147, 34, 4, 19, 118, 126, 127, 129, 153,
- 161, 177, 154, 0, 0, 172, 0, 176, 27, 26,
- 30, 31, 0, 0, 28, 92, 165, 155, 156, 0,
- 0, 0, 160, 154, 159, 148, 0, 181, 154, 107,
- 0, 105, 0, 0, 162, 90, 187, 7, 8, 41,
- 38, 90, 9, 0, 89, 122, 0, 0, 0, 0,
- 0, 90, 123, 125, 124, 0, 0, 128, 0, 0,
+ 2, 0, 1, 6, 0, 189, 171, 172, 21, 22,
+ 0, 23, 24, 178, 0, 0, 0, 166, 5, 90,
+ 38, 0, 0, 37, 0, 0, 0, 0, 3, 0,
+ 0, 161, 34, 4, 19, 132, 140, 141, 143, 167,
+ 175, 191, 168, 0, 0, 186, 0, 190, 27, 26,
+ 30, 31, 0, 0, 28, 94, 179, 169, 170, 0,
+ 0, 0, 174, 168, 173, 162, 0, 195, 168, 109,
+ 0, 107, 0, 0, 176, 92, 201, 7, 8, 42,
+ 39, 92, 9, 0, 91, 136, 0, 0, 0, 0,
+ 0, 92, 137, 139, 138, 0, 0, 142, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 120, 119, 137, 138, 0, 0, 0, 0, 105, 0,
- 174, 173, 29, 32, 0, 136, 0, 0, 0, 179,
- 180, 178, 108, 90, 184, 0, 0, 149, 14, 0,
- 0, 17, 0, 0, 91, 182, 0, 42, 35, 114,
- 115, 112, 113, 0, 0, 116, 164, 134, 135, 131,
- 132, 133, 130, 145, 146, 142, 143, 144, 141, 121,
- 111, 163, 171, 0, 93, 150, 151, 109, 189, 0,
- 110, 106, 13, 10, 16, 11, 40, 0, 58, 0,
- 0, 0, 90, 0, 0, 0, 79, 80, 0, 101,
- 0, 90, 39, 52, 0, 61, 45, 66, 38, 185,
- 90, 0, 20, 140, 98, 96, 0, 0, 139, 0,
- 101, 63, 0, 0, 0, 0, 67, 53, 54, 55,
- 0, 102, 56, 183, 60, 0, 0, 90, 186, 43,
- 117, 90, 99, 0, 0, 0, 166, 0, 0, 0,
- 0, 175, 68, 0, 57, 0, 83, 81, 44, 25,
- 33, 100, 97, 90, 59, 64, 0, 168, 170, 65,
- 90, 90, 0, 0, 90, 0, 84, 62, 0, 167,
- 169, 0, 0, 0, 0, 0, 82, 0, 86, 69,
- 47, 0, 90, 0, 90, 85, 90, 0, 90, 0,
- 90, 67, 0, 71, 0, 0, 70, 0, 48, 49,
- 67, 0, 87, 74, 77, 0, 0, 78, 0, 188,
- 90, 46, 0, 90, 76, 75, 90, 38, 90, 0,
- 38, 0, 0, 51, 0, 50
+ 134, 133, 151, 152, 0, 0, 117, 36, 122, 0,
+ 0, 115, 121, 0, 107, 188, 187, 29, 32, 0,
+ 150, 0, 0, 0, 193, 194, 192, 110, 92, 198,
+ 0, 0, 163, 14, 0, 0, 17, 0, 0, 93,
+ 196, 0, 43, 35, 127, 128, 129, 125, 126, 0,
+ 0, 130, 178, 148, 149, 145, 146, 147, 144, 159,
+ 160, 156, 157, 158, 155, 124, 135, 123, 177, 118,
+ 0, 185, 0, 95, 164, 165, 111, 203, 0, 112,
+ 108, 13, 10, 16, 11, 41, 0, 59, 0, 0,
+ 0, 92, 0, 0, 0, 81, 82, 0, 103, 0,
+ 92, 40, 53, 0, 62, 46, 67, 39, 199, 92,
+ 0, 20, 154, 119, 120, 116, 100, 98, 0, 0,
+ 153, 0, 103, 64, 0, 0, 0, 0, 68, 54,
+ 55, 56, 0, 104, 57, 197, 61, 0, 0, 92,
+ 200, 44, 131, 92, 101, 0, 0, 0, 180, 0,
+ 0, 0, 0, 189, 69, 0, 58, 0, 85, 83,
+ 0, 45, 25, 33, 102, 99, 92, 60, 65, 0,
+ 182, 184, 66, 92, 92, 0, 0, 92, 0, 86,
+ 63, 0, 181, 183, 0, 0, 0, 0, 0, 84,
+ 0, 88, 70, 48, 0, 92, 0, 92, 87, 92,
+ 0, 92, 0, 92, 68, 0, 72, 0, 0, 71,
+ 0, 49, 50, 68, 0, 89, 75, 78, 0, 0,
+ 79, 80, 0, 202, 92, 47, 0, 92, 77, 76,
+ 92, 39, 92, 0, 39, 0, 0, 52, 0, 51
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -271, -271, -271, -271, -271, -271, 218, -271, -271, -271,
- -271, -40, -271, -271, -206, 113, -150, -271, -271, -218,
- -271, -271, -270, -271, -271, -271, -271, -271, -271, -271,
- -271, 43, 29, -271, -271, -271, 47, -45, -20, -1,
- -271, -271, -271, -18, 39, -271, 246, -271, 8, 112,
- -271, -271, 11, -39, -271, -271, -70, -2, -271, -26,
- -227, -60, -271, -28, -38, 64
+ -275, -275, -275, -275, -275, -275, 252, -275, -275, -275,
+ -275, -33, -275, -80, -275, -213, 100, -144, -275, -275,
+ -231, -275, -275, -274, -275, -275, -275, -275, -275, -275,
+ -275, -275, 7, 62, -275, -275, -275, 54, -275, -43,
+ 1, -275, -23, -1, -275, -275, -275, -13, 17, -275,
+ 263, -275, 8, 127, -275, -275, 21, -36, -275, -275,
+ -78, -2, -275, -27, -230, -65, -275, -15, -38, -94
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 1, 28, 140, 143, 29, 77, 53, 54, 30,
- 173, 31, 83, 32, 146, 78, 202, 203, 220, 204,
- 235, 246, 253, 297, 306, 318, 205, 256, 277, 287,
- 206, 144, 145, 125, 216, 217, 230, 116, 117, 207,
- 115, 94, 95, 35, 36, 37, 38, 39, 40, 55,
- 265, 266, 267, 45, 46, 47, 41, 42, 131, 208,
- 209, 137, 237, 210, 320, 136
+ -1, 1, 28, 145, 148, 29, 77, 53, 54, 30,
+ 182, 31, 83, 118, 32, 151, 78, 211, 212, 232,
+ 213, 247, 258, 265, 310, 319, 332, 214, 268, 290,
+ 300, 215, 149, 150, 130, 228, 229, 242, 269, 70,
+ 119, 120, 121, 216, 115, 94, 95, 35, 36, 37,
+ 38, 39, 40, 55, 278, 279, 280, 45, 46, 47,
+ 41, 42, 136, 217, 218, 142, 249, 219, 334, 141
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@@ -854,294 +862,325 @@ static const yytype_int16 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int16 yytable[] =
{
- 34, 81, 236, 80, 80, 182, 70, 121, 252, 258,
- 135, 56, 57, 58, 126, 127, 132, 150, 184, 63,
- 63, 273, 63, 68, 119, 71, 214, 221, 132, 215,
- 120, 311, 43, 63, 4, 74, 261, 112, 113, 262,
- 322, 19, 118, 118, 33, 138, 5, 100, 101, 102,
- 139, 44, 103, 129, 130, -12, 171, 279, 118, 118,
- 62, 64, 242, 65, 76, 128, 175, 176, -15, 74,
- 133, 85, 79, 44, 97, 250, 59, 75, -12, 72,
- 321, 73, 133, 252, 44, 149, 172, 151, 152, 153,
- 222, -15, 252, -94, 155, 134, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 63, 63, 25, 218,
- 147, 44, 81, -105, 170, 81, 133, 60, 92, 93,
- 154, 331, 63, 84, 334, 141, 122, 303, 288, -95,
- 142, 177, 290, 123, 19, 181, 124, 157, 158, 159,
- 160, 161, 162, 163, 164, 165, 166, 167, 168, 309,
- 304, 305, 312, 212, 56, 75, 241, 76, 103, 132,
- -105, -105, 178, 174, 85, 19, 81, 81, -104, 86,
- 81, 4, 81, 5, 110, 111, 81, 19, 148, 333,
- 156, 238, 335, 79, 263, 169, 79, 134, 270, 271,
- 257, 179, 219, 247, 223, 87, 88, 89, 231, -90,
- 224, 226, 81, 284, 76, 112, 113, 268, 90, -104,
- 240, 92, 93, 133, 114, 286, 269, 81, 244, 231,
- 272, 225, 248, 249, 292, 274, -104, 268, 85, 76,
- 233, 298, -104, 86, 118, 275, 276, 79, 79, 239,
- 296, 79, 283, 79, 48, 49, 319, 79, 82, 201,
- 324, 323, 325, 183, 71, 289, 185, 294, 85, 87,
- 88, 89, 328, 86, 317, 300, 259, 245, 213, 295,
- 260, 67, 90, 79, 91, 92, 93, 280, 0, 0,
- 326, 243, 291, 0, 293, 63, 50, 51, 79, 87,
- 4, 5, 278, 63, 6, 7, 0, 0, 0, 281,
- 282, 0, 0, 285, 0, 92, 93, 227, 228, 0,
- 52, 229, 0, 232, 0, 0, 0, 234, 0, 0,
- 0, 299, 0, 301, 0, 302, 307, 308, 0, 310,
- 14, 15, 16, 17, 97, 0, 0, 0, 0, 20,
- 0, 0, 85, 254, 0, 21, 22, 86, 23, 327,
- 24, 0, 329, 25, 66, 330, 61, 332, 264, 2,
- 3, 0, 4, 5, 0, 0, 6, 7, 0, 0,
- 0, 0, 0, 87, 88, 89, 8, 9, 0, 0,
- 0, 0, 85, 0, 0, 0, 90, 86, 0, 92,
- 93, 313, 314, 0, 10, 11, 12, 13, 0, 0,
- 0, 134, 14, 15, 16, 17, 18, 0, 0, 0,
- 19, 20, 0, 87, 88, 0, 0, 21, 22, 0,
- 23, 0, 24, 0, 0, 25, 26, 0, 27, 92,
- 93, -18, 186, -18, 4, 5, 20, 0, 6, 7,
- 0, 0, 315, 316, 0, 23, 0, 0, 0, 0,
- 187, 0, 188, 189, 190, -73, -73, 191, 192, 193,
- 194, 195, 196, 197, 198, 199, 0, 0, 0, 13,
- 200, 0, 0, 0, 14, 15, 16, 17, 0, 0,
- 0, 0, -73, 20, 98, 99, 100, 101, 102, 21,
- 22, 103, 23, 0, 24, 0, 0, 25, 26, 0,
- 61, 0, 0, 75, -73, 76, 186, 0, 4, 5,
- 0, 0, 6, 7, 104, 105, 106, 107, 108, 0,
- 0, 109, 0, 0, 187, 0, 188, 189, 190, -72,
- -72, 191, 192, 193, 194, 195, 196, 197, 198, 199,
- 0, 0, 0, 13, 200, 0, 0, 0, 14, 15,
- 16, 17, 0, 0, 0, 0, -72, 20, 0, 0,
+ 34, 123, 80, 80, 248, 140, 154, 264, 33, 156,
+ 126, 56, 57, 58, 81, 137, 137, 191, 271, 63,
+ 63, 193, 63, 68, 143, 71, 180, 125, 292, 144,
+ 4, 175, 85, 63, 19, 74, 79, 86, 62, 64,
+ 324, 65, 122, 124, 226, 233, 146, 227, 5, 336,
+ 274, 147, 97, 275, 178, 75, 43, 76, 122, 122,
+ 131, 132, 44, 87, 88, 133, 184, 185, -12, 74,
+ 138, 138, -15, 59, 179, 75, 72, 254, 73, 92,
+ 93, 44, 44, 264, 139, 155, 181, 157, 158, 159,
+ 335, -12, 264, 262, 161, -15, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 60, 234,
+ 230, 25, -96, 316, 177, 163, 164, 165, 166, 167,
+ 168, 169, 170, 171, 172, 173, 174, 63, 345, 138,
+ 81, 348, 138, 81, 85, 255, 186, 317, 318, 86,
+ 190, 84, -114, 152, 19, -97, 183, 301, 112, 113,
+ 128, 303, 79, 160, 286, 79, 223, 225, 85, 221,
+ 56, 134, 135, 253, 19, 87, 127, 76, 322, 4,
+ 137, 325, 129, 103, 48, 49, 5, 19, 122, 122,
+ -106, 92, 93, 153, 44, 162, -92, 176, 81, 81,
+ 117, 276, 81, 188, 81, 283, 284, 139, 81, 347,
+ 187, 231, 349, 250, 270, 92, 93, 243, 297, -115,
+ 79, 79, 235, 236, 79, 238, 79, 50, 51, 252,
+ 79, -106, 281, 299, 288, 138, 76, 81, 259, 282,
+ 256, 243, 305, 285, 260, 261, 289, 331, -106, 311,
+ 309, 52, 81, 281, -106, 192, 124, 296, 194, 79,
+ 287, 98, 99, 100, 101, 102, -115, -115, 103, 337,
+ 333, 110, 111, 237, 79, 210, 71, 302, 326, 327,
+ 117, 342, 245, 104, 105, 106, 107, 108, 338, 339,
+ 109, 251, 82, 307, 330, 85, 257, 308, 67, 222,
+ 86, 313, 112, 113, 340, 304, 0, 306, 63, 0,
+ 293, 114, 0, 239, 240, 0, 63, 241, 0, 244,
+ 0, 272, 0, 246, 20, 273, 87, 88, 89, 0,
+ 328, 329, 0, 23, 0, 97, 100, 101, 102, 90,
+ 0, 103, 92, 93, 0, 0, 0, 0, 291, 0,
+ 0, 0, 266, 0, 0, 294, 295, 0, 0, 298,
+ 76, 0, 0, 0, 0, 0, 0, 277, 0, 85,
+ 0, 0, 0, 0, 86, 0, 0, 312, 0, 314,
+ 0, 315, 320, 321, 0, 323, 2, 3, 0, 4,
+ 5, 0, 0, 6, 7, 0, 0, 0, 0, 0,
+ 87, 88, 89, 0, 8, 9, 341, 0, 0, 343,
+ 0, 0, 344, 90, 346, 0, 92, 93, 0, 0,
+ 0, 0, 10, 11, 12, 13, 0, 0, 139, 0,
+ 14, 15, 16, 17, 18, 0, 0, 0, 19, 20,
+ 0, 0, 0, 0, 0, 21, 22, 0, 23, 0,
+ 24, 0, 0, 25, 26, 0, 27, 0, 0, -18,
+ 195, -18, 4, 5, 0, 0, 6, 7, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 196,
+ 0, 197, 198, 199, -74, -74, 200, 201, 202, 203,
+ 204, 205, 206, 207, 208, 0, 0, 0, 13, 209,
+ 0, 0, 0, 14, 15, 16, 17, 0, 0, 0,
+ 0, -74, 20, 0, 0, 0, 0, 0, 21, 22,
+ 0, 23, 0, 24, 0, 0, 25, 26, 0, 61,
+ 0, 0, 75, -74, 76, 195, 0, 4, 5, 0,
+ 0, 6, 7, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 196, 0, 197, 198, 199, -73,
+ -73, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+ 0, 0, 0, 13, 209, 0, 0, 0, 14, 15,
+ 16, 17, 0, 0, 0, 0, -73, 20, 0, 0,
0, 0, 0, 21, 22, 0, 23, 0, 24, 0,
- 0, 25, 26, 0, 61, 0, 0, 75, -72, 76,
- 186, 0, 4, 5, 0, 0, 6, 7, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 187, 0,
- 188, 189, 190, 0, 0, 191, 192, 193, 194, 195,
- 196, 197, 198, 199, 0, 0, 0, 13, 200, 0,
- 0, 0, 14, 15, 16, 17, 69, 0, 4, 5,
- 0, 20, 6, 7, 0, -103, 0, 21, 22, 0,
- 23, 0, 24, 0, 0, 25, 26, 0, 61, 0,
- 0, 75, 201, 76, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 13, 0, 0, 0, 0, 14, 15,
- 16, 17, 0, 0, 0, 0, -103, 20, 0, 0,
- 0, 0, 0, 21, 22, 0, 23, 0, 24, 0,
- 0, 25, 255, -103, 61, 0, 4, 5, 0, -103,
- 6, 7, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 187, 0, 188, 189, 190, 0, 0, 191,
- 192, 193, 194, 195, 196, 197, 198, 199, 0, 4,
- 5, 13, 200, 6, 7, 0, 14, 15, 16, 17,
+ 0, 25, 26, 0, 61, 0, 0, 75, -73, 76,
+ 195, 0, 4, 5, 0, 0, 6, 7, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 196,
+ 0, 197, 198, 199, 0, 0, 200, 201, 202, 203,
+ 204, 205, 206, 207, 208, 0, 0, 0, 13, 209,
+ 0, 0, 0, 14, 15, 16, 17, 69, 0, 4,
+ 5, 0, 20, 6, 7, 0, 0, -105, 21, 22,
+ 0, 23, 0, 24, 0, 0, 25, 26, 0, 61,
+ 0, 0, 75, 210, 76, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 13, 0, 0, 0, 0,
+ 14, 15, 16, 17, 0, 0, 0, 0, -105, 20,
+ 0, 0, 0, 0, 0, 21, 22, 0, 23, 0,
+ 24, 0, 0, 25, 267, -105, 61, 0, 4, 5,
+ 0, -105, 6, 7, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 196, 0, 197, 198, 199,
+ 0, 0, 200, 201, 202, 203, 204, 205, 206, 207,
+ 208, 0, 0, 0, 13, 209, 0, 0, 0, 14,
+ 15, 16, 17, 0, 0, 4, 5, 0, 20, 6,
+ 7, 0, 0, 0, 21, 22, 0, 23, 0, 24,
+ 0, 0, 25, 26, 0, 61, 0, 0, 75, 0,
+ 76, 0, 0, 0, 0, 0, 116, 0, 4, 5,
+ 0, 13, 6, 7, 117, 0, 14, 15, 16, 17,
0, 0, 0, 0, 0, 20, 0, 0, 0, 0,
- 85, 21, 22, 0, 23, 86, 24, 0, 0, 25,
- 26, 0, 61, 0, 13, 75, 0, 76, 0, 14,
- 15, 16, 17, 69, 0, 4, 5, 0, 20, 6,
- 7, 87, 88, 89, 21, 22, 0, 23, 0, 24,
- 0, 0, 25, 26, 90, 61, 0, 92, 93, 0,
- 76, 0, 0, 0, 0, 69, 0, 4, 5, 0,
- 13, 6, 7, 0, 0, 14, 15, 16, 17, 0,
- 0, 0, 0, 0, 20, 0, 0, 0, 0, 0,
- 21, 22, 0, 23, 0, 24, 0, 0, 25, 26,
- -103, 61, 13, 0, 0, 0, 0, 14, 15, 16,
- 17, 180, 0, 4, 5, 0, 20, 6, 7, 0,
- 0, 0, 21, 22, 0, 23, 0, 24, 0, 0,
- 25, 26, 0, 61, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 4, 251, 13, 0,
- 6, 7, 0, 14, 15, 16, 17, 0, 0, 0,
- 0, 0, 20, 0, 0, 189, 0, 0, 21, 22,
- 0, 23, 0, 24, 196, 197, 25, 26, 0, 61,
- 0, 13, 0, 0, 0, 0, 14, 15, 16, 17,
- 0, 0, 4, 5, 0, 20, 6, 7, 0, 0,
0, 21, 22, 0, 23, 0, 24, 0, 0, 25,
- 26, 189, 61, 0, 0, 0, 0, 0, 0, 0,
- 196, 197, 0, 0, 0, 0, 0, 13, 0, 0,
- 0, 0, 14, 15, 16, 17, 0, 0, 4, 5,
- 0, 20, 6, 7, 0, 0, 96, 21, 22, 0,
- 23, 0, 24, 0, 0, 25, 26, 0, 61, 0,
- 0, 0, 0, 0, 0, 4, 5, 0, 0, 6,
- 7, 0, 0, 13, 0, 0, 0, 0, 14, 15,
- 16, 17, 0, 0, 0, 0, 0, 20, 0, 0,
- 0, 0, 0, 21, 22, 0, 23, 0, 24, 0,
- 13, 25, 26, 0, 61, 14, 15, 16, 17, 0,
- 85, 0, 0, 0, 20, 86, 0, 0, 0, 0,
- 21, 22, 0, 23, 0, 24, 0, 0, 25, 26,
- 0, 61, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 87, 88, 89, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 90, 211, 0, 92, 93
+ 26, 0, 61, 0, 13, 0, 0, 76, 0, 14,
+ 15, 16, 17, 224, 0, 4, 5, 0, 20, 6,
+ 7, 117, 0, 0, 21, 22, 0, 23, 0, 24,
+ 0, 0, 25, 26, -113, 61, 0, 0, 0, 0,
+ 69, 0, 4, 5, 0, 0, 6, 7, 0, 0,
+ 0, 13, 0, 0, 0, 0, 14, 15, 16, 17,
+ 0, 0, 0, 0, 85, 20, 0, 0, 0, 86,
+ 0, 21, 22, 0, 23, 0, 24, 0, 13, 25,
+ 26, 0, 61, 14, 15, 16, 17, 189, 0, 4,
+ 5, 0, 20, 6, 7, 87, 88, 89, 21, 22,
+ 0, 23, 0, 24, 0, 0, 25, 26, 90, 61,
+ 91, 92, 93, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 4, 263, 0, 13, 6, 7, 0, 0,
+ 14, 15, 16, 17, 0, 0, 0, 0, 0, 20,
+ 0, 0, 198, 0, 0, 21, 22, 0, 23, 0,
+ 24, 205, 206, 25, 26, 0, 61, 0, 13, 0,
+ 0, 0, 0, 14, 15, 16, 17, 0, 0, 0,
+ 4, 5, 20, 0, 6, 7, 0, 0, 21, 22,
+ 0, 23, 0, 24, 0, 0, 25, 26, 0, 61,
+ 198, 0, 0, 0, 0, 0, 0, 0, 0, 205,
+ 206, 0, 0, 0, 0, 0, 13, 0, 0, 0,
+ 0, 14, 15, 16, 17, 0, 0, 0, 0, 0,
+ 20, 0, 0, 0, 0, 0, 21, 22, 85, 23,
+ 0, 24, 0, 86, 25, 26, 0, 61, 4, 5,
+ 0, 0, 6, 7, 0, 0, 0, 96, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 87,
+ 88, 89, 0, 0, 0, 4, 5, 0, 0, 6,
+ 7, 117, 90, 220, 13, 92, 93, 0, 0, 14,
+ 15, 16, 17, 0, 0, 0, 0, 85, 20, 0,
+ 0, 0, 86, 0, 21, 22, 0, 23, 0, 24,
+ 0, 13, 25, 26, 0, 61, 14, 15, 16, 17,
+ 0, 0, 4, 5, 0, 20, 6, 7, 87, 88,
+ 89, 21, 22, 0, 23, 0, 24, 0, 0, 25,
+ 26, 90, 61, 0, 92, 93, 0, 0, 0, 4,
+ 5, 0, 0, 6, 7, 0, 0, 0, 13, 0,
+ 0, 0, 0, 14, 15, 16, 17, 0, 0, 0,
+ 0, 0, 20, 0, 0, 0, 0, 0, 21, 22,
+ 0, 23, 0, 24, 0, 0, 25, 26, 0, 61,
+ 14, 15, 16, 17, 0, 0, 0, 0, 0, 20,
+ 0, 0, 0, 0, 0, 21, 22, 0, 23, 0,
+ 24, 0, 0, 25, 66, 0, 61
};
static const yytype_int16 yycheck[] =
{
- 1, 29, 208, 29, 30, 1, 26, 46, 226, 236,
- 70, 13, 14, 15, 59, 60, 1, 87, 1, 21,
- 22, 40, 24, 25, 44, 26, 1, 4, 1, 4,
- 16, 301, 67, 35, 3, 27, 1, 43, 44, 4,
- 310, 51, 43, 44, 1, 1, 4, 60, 61, 62,
- 6, 70, 65, 43, 44, 51, 116, 16, 59, 60,
- 21, 22, 1, 24, 74, 66, 126, 127, 51, 61,
- 55, 9, 29, 70, 35, 225, 67, 72, 74, 48,
- 307, 50, 55, 301, 70, 86, 71, 88, 89, 90,
- 67, 74, 310, 68, 95, 68, 98, 99, 100, 101,
- 102, 103, 104, 105, 106, 107, 108, 109, 66, 179,
- 81, 70, 140, 9, 115, 143, 55, 67, 56, 57,
- 91, 327, 124, 51, 330, 1, 49, 1, 278, 68,
- 6, 132, 282, 67, 51, 136, 56, 98, 99, 100,
- 101, 102, 103, 104, 105, 106, 107, 108, 109, 299,
- 24, 25, 302, 154, 156, 72, 216, 74, 65, 1,
- 56, 57, 133, 124, 9, 51, 194, 195, 10, 14,
- 198, 3, 200, 4, 12, 13, 204, 51, 5, 329,
- 38, 209, 332, 140, 244, 13, 143, 68, 248, 249,
- 235, 40, 67, 4, 67, 40, 41, 42, 199, 73,
- 67, 67, 230, 273, 74, 43, 44, 246, 53, 51,
- 211, 56, 57, 55, 52, 275, 68, 245, 219, 220,
- 26, 192, 223, 224, 284, 253, 68, 266, 9, 74,
- 201, 291, 74, 14, 235, 255, 10, 194, 195, 210,
- 20, 198, 67, 200, 3, 4, 54, 204, 30, 73,
- 7, 311, 7, 140, 255, 281, 143, 285, 9, 40,
- 41, 42, 322, 14, 304, 293, 237, 220, 156, 287,
- 241, 25, 53, 230, 55, 56, 57, 266, -1, -1,
- 318, 217, 283, -1, 285, 287, 45, 46, 245, 40,
- 3, 4, 263, 295, 7, 8, -1, -1, -1, 270,
- 271, -1, -1, 274, -1, 56, 57, 194, 195, -1,
- 69, 198, -1, 200, -1, -1, -1, 204, -1, -1,
- -1, 292, -1, 294, -1, 296, 297, 298, -1, 300,
- 43, 44, 45, 46, 295, -1, -1, -1, -1, 52,
- -1, -1, 9, 230, -1, 58, 59, 14, 61, 320,
- 63, -1, 323, 66, 67, 326, 69, 328, 245, 0,
+ 1, 44, 29, 30, 217, 70, 86, 238, 1, 87,
+ 46, 13, 14, 15, 29, 1, 1, 1, 248, 21,
+ 22, 1, 24, 25, 1, 26, 120, 17, 17, 6,
+ 3, 111, 10, 35, 52, 27, 29, 15, 21, 22,
+ 314, 24, 43, 44, 1, 4, 1, 4, 4, 323,
+ 1, 6, 35, 4, 119, 73, 68, 75, 59, 60,
+ 59, 60, 71, 41, 42, 66, 131, 132, 52, 61,
+ 56, 56, 52, 68, 1, 73, 49, 1, 51, 57,
+ 58, 71, 71, 314, 69, 86, 72, 88, 89, 90,
+ 320, 75, 323, 237, 95, 75, 98, 99, 100, 101,
+ 102, 103, 104, 105, 106, 107, 108, 109, 68, 68,
+ 188, 67, 69, 1, 115, 98, 99, 100, 101, 102,
+ 103, 104, 105, 106, 107, 108, 109, 129, 341, 56,
+ 145, 344, 56, 148, 10, 229, 137, 25, 26, 15,
+ 141, 52, 69, 81, 52, 69, 129, 291, 44, 45,
+ 68, 295, 145, 91, 41, 148, 179, 180, 10, 160,
+ 162, 44, 45, 228, 52, 41, 50, 75, 312, 3,
+ 1, 315, 57, 66, 3, 4, 4, 52, 179, 180,
+ 11, 57, 58, 5, 71, 39, 74, 14, 203, 204,
+ 9, 256, 207, 41, 209, 260, 261, 69, 213, 343,
+ 138, 68, 346, 218, 247, 57, 58, 208, 286, 10,
+ 203, 204, 68, 68, 207, 68, 209, 46, 47, 220,
+ 213, 52, 258, 288, 267, 56, 75, 242, 4, 69,
+ 231, 232, 297, 27, 235, 236, 11, 317, 69, 304,
+ 21, 70, 257, 279, 75, 145, 247, 68, 148, 242,
+ 265, 59, 60, 61, 62, 63, 57, 58, 66, 324,
+ 55, 13, 14, 201, 257, 74, 267, 294, 7, 8,
+ 9, 336, 210, 59, 60, 61, 62, 63, 7, 7,
+ 66, 219, 30, 298, 317, 10, 232, 300, 25, 162,
+ 15, 306, 44, 45, 332, 296, -1, 298, 300, -1,
+ 279, 53, -1, 203, 204, -1, 308, 207, -1, 209,
+ -1, 249, -1, 213, 53, 253, 41, 42, 43, -1,
+ 59, 60, -1, 62, -1, 308, 61, 62, 63, 54,
+ -1, 66, 57, 58, -1, -1, -1, -1, 276, -1,
+ -1, -1, 242, -1, -1, 283, 284, -1, -1, 287,
+ 75, -1, -1, -1, -1, -1, -1, 257, -1, 10,
+ -1, -1, -1, -1, 15, -1, -1, 305, -1, 307,
+ -1, 309, 310, 311, -1, 313, 0, 1, -1, 3,
+ 4, -1, -1, 7, 8, -1, -1, -1, -1, -1,
+ 41, 42, 43, -1, 18, 19, 334, -1, -1, 337,
+ -1, -1, 340, 54, 342, -1, 57, 58, -1, -1,
+ -1, -1, 36, 37, 38, 39, -1, -1, 69, -1,
+ 44, 45, 46, 47, 48, -1, -1, -1, 52, 53,
+ -1, -1, -1, -1, -1, 59, 60, -1, 62, -1,
+ 64, -1, -1, 67, 68, -1, 70, -1, -1, 73,
+ 1, 75, 3, 4, -1, -1, 7, 8, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 20,
+ -1, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 32, 33, 34, 35, -1, -1, -1, 39, 40,
+ -1, -1, -1, 44, 45, 46, 47, -1, -1, -1,
+ -1, 52, 53, -1, -1, -1, -1, -1, 59, 60,
+ -1, 62, -1, 64, -1, -1, 67, 68, -1, 70,
+ -1, -1, 73, 74, 75, 1, -1, 3, 4, -1,
+ -1, 7, 8, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 20, -1, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ -1, -1, -1, 39, 40, -1, -1, -1, 44, 45,
+ 46, 47, -1, -1, -1, -1, 52, 53, -1, -1,
+ -1, -1, -1, 59, 60, -1, 62, -1, 64, -1,
+ -1, 67, 68, -1, 70, -1, -1, 73, 74, 75,
1, -1, 3, 4, -1, -1, 7, 8, -1, -1,
- -1, -1, -1, 40, 41, 42, 17, 18, -1, -1,
- -1, -1, 9, -1, -1, -1, 53, 14, -1, 56,
- 57, 7, 8, -1, 35, 36, 37, 38, -1, -1,
- -1, 68, 43, 44, 45, 46, 47, -1, -1, -1,
- 51, 52, -1, 40, 41, -1, -1, 58, 59, -1,
- 61, -1, 63, -1, -1, 66, 67, -1, 69, 56,
- 57, 72, 1, 74, 3, 4, 52, -1, 7, 8,
- -1, -1, 58, 59, -1, 61, -1, -1, -1, -1,
- 19, -1, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, 33, 34, -1, -1, -1, 38,
- 39, -1, -1, -1, 43, 44, 45, 46, -1, -1,
- -1, -1, 51, 52, 58, 59, 60, 61, 62, 58,
- 59, 65, 61, -1, 63, -1, -1, 66, 67, -1,
- 69, -1, -1, 72, 73, 74, 1, -1, 3, 4,
- -1, -1, 7, 8, 58, 59, 60, 61, 62, -1,
- -1, 65, -1, -1, 19, -1, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- -1, -1, -1, 38, 39, -1, -1, -1, 43, 44,
- 45, 46, -1, -1, -1, -1, 51, 52, -1, -1,
- -1, -1, -1, 58, 59, -1, 61, -1, 63, -1,
- -1, 66, 67, -1, 69, -1, -1, 72, 73, 74,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 20,
+ -1, 22, 23, 24, -1, -1, 27, 28, 29, 30,
+ 31, 32, 33, 34, 35, -1, -1, -1, 39, 40,
+ -1, -1, -1, 44, 45, 46, 47, 1, -1, 3,
+ 4, -1, 53, 7, 8, -1, -1, 11, 59, 60,
+ -1, 62, -1, 64, -1, -1, 67, 68, -1, 70,
+ -1, -1, 73, 74, 75, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 39, -1, -1, -1, -1,
+ 44, 45, 46, 47, -1, -1, -1, -1, 52, 53,
+ -1, -1, -1, -1, -1, 59, 60, -1, 62, -1,
+ 64, -1, -1, 67, 68, 69, 70, -1, 3, 4,
+ -1, 75, 7, 8, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 20, -1, 22, 23, 24,
+ -1, -1, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, -1, -1, -1, 39, 40, -1, -1, -1, 44,
+ 45, 46, 47, -1, -1, 3, 4, -1, 53, 7,
+ 8, -1, -1, -1, 59, 60, -1, 62, -1, 64,
+ -1, -1, 67, 68, -1, 70, -1, -1, 73, -1,
+ 75, -1, -1, -1, -1, -1, 1, -1, 3, 4,
+ -1, 39, 7, 8, 9, -1, 44, 45, 46, 47,
+ -1, -1, -1, -1, -1, 53, -1, -1, -1, -1,
+ -1, 59, 60, -1, 62, -1, 64, -1, -1, 67,
+ 68, -1, 70, -1, 39, -1, -1, 75, -1, 44,
+ 45, 46, 47, 1, -1, 3, 4, -1, 53, 7,
+ 8, 9, -1, -1, 59, 60, -1, 62, -1, 64,
+ -1, -1, 67, 68, 69, 70, -1, -1, -1, -1,
1, -1, 3, 4, -1, -1, 7, 8, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 19, -1,
- 21, 22, 23, -1, -1, 26, 27, 28, 29, 30,
- 31, 32, 33, 34, -1, -1, -1, 38, 39, -1,
- -1, -1, 43, 44, 45, 46, 1, -1, 3, 4,
- -1, 52, 7, 8, -1, 10, -1, 58, 59, -1,
- 61, -1, 63, -1, -1, 66, 67, -1, 69, -1,
- -1, 72, 73, 74, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 38, -1, -1, -1, -1, 43, 44,
- 45, 46, -1, -1, -1, -1, 51, 52, -1, -1,
- -1, -1, -1, 58, 59, -1, 61, -1, 63, -1,
- -1, 66, 67, 68, 69, -1, 3, 4, -1, 74,
- 7, 8, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 19, -1, 21, 22, 23, -1, -1, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, -1, 3,
- 4, 38, 39, 7, 8, -1, 43, 44, 45, 46,
- -1, -1, -1, -1, -1, 52, -1, -1, -1, -1,
- 9, 58, 59, -1, 61, 14, 63, -1, -1, 66,
- 67, -1, 69, -1, 38, 72, -1, 74, -1, 43,
- 44, 45, 46, 1, -1, 3, 4, -1, 52, 7,
- 8, 40, 41, 42, 58, 59, -1, 61, -1, 63,
- -1, -1, 66, 67, 53, 69, -1, 56, 57, -1,
- 74, -1, -1, -1, -1, 1, -1, 3, 4, -1,
- 38, 7, 8, -1, -1, 43, 44, 45, 46, -1,
- -1, -1, -1, -1, 52, -1, -1, -1, -1, -1,
- 58, 59, -1, 61, -1, 63, -1, -1, 66, 67,
- 68, 69, 38, -1, -1, -1, -1, 43, 44, 45,
- 46, 1, -1, 3, 4, -1, 52, 7, 8, -1,
- -1, -1, 58, 59, -1, 61, -1, 63, -1, -1,
- 66, 67, -1, 69, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 3, 4, 38, -1,
- 7, 8, -1, 43, 44, 45, 46, -1, -1, -1,
- -1, -1, 52, -1, -1, 22, -1, -1, 58, 59,
- -1, 61, -1, 63, 31, 32, 66, 67, -1, 69,
- -1, 38, -1, -1, -1, -1, 43, 44, 45, 46,
- -1, -1, 3, 4, -1, 52, 7, 8, -1, -1,
- -1, 58, 59, -1, 61, -1, 63, -1, -1, 66,
- 67, 22, 69, -1, -1, -1, -1, -1, -1, -1,
- 31, 32, -1, -1, -1, -1, -1, 38, -1, -1,
- -1, -1, 43, 44, 45, 46, -1, -1, 3, 4,
- -1, 52, 7, 8, -1, -1, 11, 58, 59, -1,
- 61, -1, 63, -1, -1, 66, 67, -1, 69, -1,
- -1, -1, -1, -1, -1, 3, 4, -1, -1, 7,
- 8, -1, -1, 38, -1, -1, -1, -1, 43, 44,
- 45, 46, -1, -1, -1, -1, -1, 52, -1, -1,
- -1, -1, -1, 58, 59, -1, 61, -1, 63, -1,
- 38, 66, 67, -1, 69, 43, 44, 45, 46, -1,
- 9, -1, -1, -1, 52, 14, -1, -1, -1, -1,
- 58, 59, -1, 61, -1, 63, -1, -1, 66, 67,
- -1, 69, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 40, 41, 42, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 53, 54, -1, 56, 57
+ -1, 39, -1, -1, -1, -1, 44, 45, 46, 47,
+ -1, -1, -1, -1, 10, 53, -1, -1, -1, 15,
+ -1, 59, 60, -1, 62, -1, 64, -1, 39, 67,
+ 68, -1, 70, 44, 45, 46, 47, 1, -1, 3,
+ 4, -1, 53, 7, 8, 41, 42, 43, 59, 60,
+ -1, 62, -1, 64, -1, -1, 67, 68, 54, 70,
+ 56, 57, 58, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 3, 4, -1, 39, 7, 8, -1, -1,
+ 44, 45, 46, 47, -1, -1, -1, -1, -1, 53,
+ -1, -1, 23, -1, -1, 59, 60, -1, 62, -1,
+ 64, 32, 33, 67, 68, -1, 70, -1, 39, -1,
+ -1, -1, -1, 44, 45, 46, 47, -1, -1, -1,
+ 3, 4, 53, -1, 7, 8, -1, -1, 59, 60,
+ -1, 62, -1, 64, -1, -1, 67, 68, -1, 70,
+ 23, -1, -1, -1, -1, -1, -1, -1, -1, 32,
+ 33, -1, -1, -1, -1, -1, 39, -1, -1, -1,
+ -1, 44, 45, 46, 47, -1, -1, -1, -1, -1,
+ 53, -1, -1, -1, -1, -1, 59, 60, 10, 62,
+ -1, 64, -1, 15, 67, 68, -1, 70, 3, 4,
+ -1, -1, 7, 8, -1, -1, -1, 12, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 41,
+ 42, 43, -1, -1, -1, 3, 4, -1, -1, 7,
+ 8, 9, 54, 55, 39, 57, 58, -1, -1, 44,
+ 45, 46, 47, -1, -1, -1, -1, 10, 53, -1,
+ -1, -1, 15, -1, 59, 60, -1, 62, -1, 64,
+ -1, 39, 67, 68, -1, 70, 44, 45, 46, 47,
+ -1, -1, 3, 4, -1, 53, 7, 8, 41, 42,
+ 43, 59, 60, -1, 62, -1, 64, -1, -1, 67,
+ 68, 54, 70, -1, 57, 58, -1, -1, -1, 3,
+ 4, -1, -1, 7, 8, -1, -1, -1, 39, -1,
+ -1, -1, -1, 44, 45, 46, 47, -1, -1, -1,
+ -1, -1, 53, -1, -1, -1, -1, -1, 59, 60,
+ -1, 62, -1, 64, -1, -1, 67, 68, -1, 70,
+ 44, 45, 46, 47, -1, -1, -1, -1, -1, 53,
+ -1, -1, -1, -1, -1, 59, 60, -1, 62, -1,
+ 64, -1, -1, 67, 68, -1, 70
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 76, 0, 1, 3, 4, 7, 8, 17, 18,
- 35, 36, 37, 38, 43, 44, 45, 46, 47, 51,
- 52, 58, 59, 61, 63, 66, 67, 69, 77, 80,
- 84, 86, 88, 106, 114, 118, 119, 120, 121, 122,
- 123, 131, 132, 67, 70, 128, 129, 130, 3, 4,
- 45, 46, 69, 82, 83, 124, 132, 132, 132, 67,
- 67, 69, 119, 132, 119, 119, 67, 121, 132, 1,
- 113, 114, 48, 50, 123, 72, 74, 81, 90, 106,
- 134, 138, 81, 87, 51, 9, 14, 40, 41, 42,
- 53, 55, 56, 57, 116, 117, 11, 119, 58, 59,
- 60, 61, 62, 65, 58, 59, 60, 61, 62, 65,
- 12, 13, 43, 44, 52, 115, 112, 113, 114, 113,
- 16, 128, 49, 67, 56, 108, 112, 112, 114, 43,
- 44, 133, 1, 55, 68, 136, 140, 136, 1, 6,
- 78, 1, 6, 79, 106, 107, 89, 107, 5, 114,
- 131, 114, 114, 114, 107, 114, 38, 119, 119, 119,
- 119, 119, 119, 119, 119, 119, 119, 119, 119, 13,
- 114, 136, 71, 85, 119, 136, 136, 114, 107, 40,
- 1, 114, 1, 90, 1, 90, 1, 19, 21, 22,
- 23, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 39, 73, 91, 92, 94, 101, 105, 114, 134, 135,
- 138, 54, 114, 124, 1, 4, 109, 110, 131, 67,
- 93, 4, 67, 67, 67, 107, 67, 90, 90, 90,
- 111, 114, 90, 107, 90, 95, 89, 137, 138, 107,
- 114, 136, 1, 140, 114, 111, 96, 4, 114, 114,
- 91, 4, 94, 97, 90, 67, 102, 112, 135, 107,
- 107, 1, 4, 136, 90, 125, 126, 127, 128, 68,
- 136, 136, 26, 40, 138, 113, 10, 103, 107, 16,
- 127, 107, 107, 67, 131, 107, 136, 104, 91, 134,
- 91, 114, 136, 114, 138, 118, 20, 98, 136, 107,
- 138, 107, 107, 1, 24, 25, 99, 107, 107, 91,
- 107, 97, 91, 7, 8, 58, 59, 86, 100, 54,
- 139, 135, 97, 136, 7, 7, 139, 107, 136, 107,
- 107, 89, 107, 91, 89, 91
+ 0, 77, 0, 1, 3, 4, 7, 8, 18, 19,
+ 36, 37, 38, 39, 44, 45, 46, 47, 48, 52,
+ 53, 59, 60, 62, 64, 67, 68, 70, 78, 81,
+ 85, 87, 90, 108, 119, 123, 124, 125, 126, 127,
+ 128, 136, 137, 68, 71, 133, 134, 135, 3, 4,
+ 46, 47, 70, 83, 84, 129, 137, 137, 137, 68,
+ 68, 70, 124, 137, 124, 124, 68, 126, 137, 1,
+ 115, 119, 49, 51, 128, 73, 75, 82, 92, 108,
+ 139, 143, 82, 88, 52, 10, 15, 41, 42, 43,
+ 54, 56, 57, 58, 121, 122, 12, 124, 59, 60,
+ 61, 62, 63, 66, 59, 60, 61, 62, 63, 66,
+ 13, 14, 44, 45, 53, 120, 1, 9, 89, 116,
+ 117, 118, 119, 115, 119, 17, 133, 50, 68, 57,
+ 110, 116, 116, 119, 44, 45, 138, 1, 56, 69,
+ 141, 145, 141, 1, 6, 79, 1, 6, 80, 108,
+ 109, 91, 109, 5, 89, 119, 136, 119, 119, 119,
+ 109, 119, 39, 124, 124, 124, 124, 124, 124, 124,
+ 124, 124, 124, 124, 124, 89, 14, 119, 141, 1,
+ 145, 72, 86, 124, 141, 141, 119, 109, 41, 1,
+ 119, 1, 92, 1, 92, 1, 20, 22, 23, 24,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 40,
+ 74, 93, 94, 96, 103, 107, 119, 139, 140, 143,
+ 55, 119, 129, 118, 1, 118, 1, 4, 111, 112,
+ 136, 68, 95, 4, 68, 68, 68, 109, 68, 92,
+ 92, 92, 113, 119, 92, 109, 92, 97, 91, 142,
+ 143, 109, 119, 141, 1, 145, 119, 113, 98, 4,
+ 119, 119, 93, 4, 96, 99, 92, 68, 104, 114,
+ 115, 140, 109, 109, 1, 4, 141, 92, 130, 131,
+ 132, 133, 69, 141, 141, 27, 41, 143, 115, 11,
+ 105, 109, 17, 132, 109, 109, 68, 136, 109, 141,
+ 106, 93, 139, 93, 119, 141, 119, 143, 123, 21,
+ 100, 141, 109, 143, 109, 109, 1, 25, 26, 101,
+ 109, 109, 93, 109, 99, 93, 7, 8, 59, 60,
+ 87, 89, 102, 55, 144, 140, 99, 141, 7, 7,
+ 144, 109, 141, 109, 109, 91, 109, 93, 91, 93
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 75, 76, 76, 76, 76, 76, 77, 77, 77,
- 77, 77, 78, 78, 78, 79, 79, 79, 80, 80,
- 80, 80, 80, 80, 80, 81, 82, 82, 82, 82,
- 83, 83, 85, 84, 87, 86, 88, 88, 89, 89,
- 89, 90, 90, 91, 91, 91, 91, 91, 91, 91,
- 91, 91, 91, 92, 92, 92, 92, 92, 93, 92,
- 92, 95, 94, 96, 94, 94, 94, 97, 97, 98,
- 98, 98, 99, 99, 100, 100, 100, 100, 100, 101,
- 101, 102, 102, 103, 104, 103, 105, 105, 106, 106,
- 107, 107, 108, 108, 109, 109, 110, 110, 110, 110,
- 110, 111, 111, 112, 112, 113, 113, 113, 113, 113,
- 113, 114, 114, 114, 114, 114, 114, 114, 114, 115,
- 115, 115, 116, 116, 117, 117, 118, 118, 118, 119,
- 119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
- 120, 120, 120, 120, 120, 120, 120, 121, 121, 121,
- 121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
- 121, 122, 122, 123, 124, 124, 125, 125, 126, 126,
- 127, 128, 129, 129, 130, 131, 131, 132, 132, 133,
- 133, 133, 134, 135, 136, 137, 137, 138, 139, 140
+ 0, 76, 77, 77, 77, 77, 77, 78, 78, 78,
+ 78, 78, 79, 79, 79, 80, 80, 80, 81, 81,
+ 81, 81, 81, 81, 81, 82, 83, 83, 83, 83,
+ 84, 84, 86, 85, 88, 87, 89, 90, 90, 91,
+ 91, 91, 92, 92, 93, 93, 93, 93, 93, 93,
+ 93, 93, 93, 93, 94, 94, 94, 94, 94, 95,
+ 94, 94, 97, 96, 98, 96, 96, 96, 99, 99,
+ 100, 100, 100, 101, 101, 102, 102, 102, 102, 102,
+ 102, 103, 103, 104, 104, 105, 106, 105, 107, 107,
+ 108, 108, 109, 109, 110, 110, 111, 111, 112, 112,
+ 112, 112, 112, 113, 113, 114, 114, 115, 115, 115,
+ 115, 115, 115, 116, 116, 117, 117, 117, 117, 117,
+ 117, 118, 118, 119, 119, 119, 119, 119, 119, 119,
+ 119, 119, 119, 120, 120, 120, 121, 121, 122, 122,
+ 123, 123, 123, 124, 124, 124, 124, 124, 124, 124,
+ 124, 124, 124, 124, 125, 125, 125, 125, 125, 125,
+ 125, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 127, 127, 128, 129, 129,
+ 130, 130, 131, 131, 132, 133, 134, 134, 135, 136,
+ 136, 137, 137, 138, 138, 138, 139, 140, 141, 142,
+ 142, 143, 144, 145
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
@@ -1150,22 +1189,24 @@ static const yytype_uint8 yyr2[] =
0, 2, 0, 2, 2, 2, 2, 2, 2, 2,
4, 4, 1, 2, 1, 1, 2, 1, 0, 1,
4, 1, 1, 1, 1, 5, 1, 1, 1, 2,
- 1, 1, 0, 7, 0, 3, 1, 1, 0, 2,
- 2, 1, 2, 2, 3, 1, 9, 6, 8, 8,
- 12, 11, 1, 2, 2, 2, 2, 3, 0, 4,
- 2, 0, 4, 0, 4, 4, 1, 0, 1, 0,
- 2, 2, 5, 4, 1, 2, 2, 1, 1, 1,
- 1, 1, 3, 0, 0, 3, 6, 9, 1, 2,
- 0, 1, 0, 2, 0, 1, 1, 3, 1, 2,
- 3, 0, 1, 0, 1, 1, 3, 1, 2, 3,
- 3, 3, 3, 3, 3, 3, 3, 5, 1, 1,
- 1, 2, 1, 1, 1, 1, 1, 1, 2, 1,
- 3, 3, 3, 3, 3, 3, 3, 2, 2, 5,
- 4, 3, 3, 3, 3, 3, 3, 1, 2, 3,
- 4, 4, 1, 1, 1, 2, 2, 1, 1, 2,
- 2, 1, 2, 4, 0, 1, 0, 2, 1, 2,
- 1, 3, 1, 2, 2, 1, 2, 1, 3, 1,
- 1, 0, 2, 2, 1, 0, 1, 1, 1, 2
+ 1, 1, 0, 7, 0, 3, 1, 1, 1, 0,
+ 2, 2, 1, 2, 2, 3, 1, 9, 6, 8,
+ 8, 12, 11, 1, 2, 2, 2, 2, 3, 0,
+ 4, 2, 0, 4, 0, 4, 4, 1, 0, 1,
+ 0, 2, 2, 5, 4, 1, 2, 2, 1, 1,
+ 1, 1, 1, 1, 3, 0, 0, 3, 6, 9,
+ 1, 2, 0, 1, 0, 2, 0, 1, 1, 3,
+ 1, 2, 3, 0, 1, 0, 1, 1, 3, 1,
+ 2, 3, 3, 0, 1, 1, 3, 1, 2, 3,
+ 3, 1, 1, 3, 3, 3, 3, 3, 3, 3,
+ 3, 5, 1, 1, 1, 2, 1, 1, 1, 1,
+ 1, 1, 2, 1, 3, 3, 3, 3, 3, 3,
+ 3, 2, 2, 5, 4, 3, 3, 3, 3, 3,
+ 3, 1, 2, 3, 4, 4, 1, 1, 1, 2,
+ 2, 1, 1, 2, 2, 1, 2, 4, 0, 1,
+ 0, 2, 1, 2, 1, 3, 1, 2, 2, 1,
+ 2, 1, 3, 1, 1, 0, 2, 2, 1, 0,
+ 1, 1, 1, 2
};
@@ -1847,7 +1888,7 @@ yyreduce:
rule = 0;
yyerrok;
}
-#line 1851 "awkgram.c" /* yacc.c:1646 */
+#line 1892 "awkgram.c" /* yacc.c:1646 */
break;
case 5:
@@ -1855,7 +1896,7 @@ yyreduce:
{
next_sourcefile();
}
-#line 1859 "awkgram.c" /* yacc.c:1646 */
+#line 1900 "awkgram.c" /* yacc.c:1646 */
break;
case 6:
@@ -1868,7 +1909,7 @@ yyreduce:
*/
/* yyerrok; */
}
-#line 1872 "awkgram.c" /* yacc.c:1646 */
+#line 1913 "awkgram.c" /* yacc.c:1646 */
break;
case 7:
@@ -1877,7 +1918,7 @@ yyreduce:
(void) append_rule((yyvsp[-1]), (yyvsp[0]));
first_rule = false;
}
-#line 1881 "awkgram.c" /* yacc.c:1646 */
+#line 1922 "awkgram.c" /* yacc.c:1646 */
break;
case 8:
@@ -1892,7 +1933,7 @@ yyreduce:
} else /* pattern rule with non-empty pattern */
(void) append_rule((yyvsp[-1]), NULL);
}
-#line 1896 "awkgram.c" /* yacc.c:1646 */
+#line 1937 "awkgram.c" /* yacc.c:1646 */
break;
case 9:
@@ -1903,7 +1944,7 @@ yyreduce:
want_param_names = DONT_CHECK;
yyerrok;
}
-#line 1907 "awkgram.c" /* yacc.c:1646 */
+#line 1948 "awkgram.c" /* yacc.c:1646 */
break;
case 10:
@@ -1913,7 +1954,7 @@ yyreduce:
at_seen = false;
yyerrok;
}
-#line 1917 "awkgram.c" /* yacc.c:1646 */
+#line 1958 "awkgram.c" /* yacc.c:1646 */
break;
case 11:
@@ -1923,7 +1964,7 @@ yyreduce:
at_seen = false;
yyerrok;
}
-#line 1927 "awkgram.c" /* yacc.c:1646 */
+#line 1968 "awkgram.c" /* yacc.c:1646 */
break;
case 12:
@@ -1935,19 +1976,19 @@ yyreduce:
bcfree((yyvsp[0]));
(yyval) = NULL;
}
-#line 1939 "awkgram.c" /* yacc.c:1646 */
+#line 1980 "awkgram.c" /* yacc.c:1646 */
break;
case 13:
#line 281 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 1945 "awkgram.c" /* yacc.c:1646 */
+#line 1986 "awkgram.c" /* yacc.c:1646 */
break;
case 14:
#line 283 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 1951 "awkgram.c" /* yacc.c:1646 */
+#line 1992 "awkgram.c" /* yacc.c:1646 */
break;
case 15:
@@ -1959,19 +2000,19 @@ yyreduce:
bcfree((yyvsp[0]));
(yyval) = NULL;
}
-#line 1963 "awkgram.c" /* yacc.c:1646 */
+#line 2004 "awkgram.c" /* yacc.c:1646 */
break;
case 16:
#line 296 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 1969 "awkgram.c" /* yacc.c:1646 */
+#line 2010 "awkgram.c" /* yacc.c:1646 */
break;
case 17:
#line 298 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 1975 "awkgram.c" /* yacc.c:1646 */
+#line 2016 "awkgram.c" /* yacc.c:1646 */
break;
case 18:
@@ -1984,7 +2025,7 @@ yyreduce:
} else
(yyval) = NULL;
}
-#line 1988 "awkgram.c" /* yacc.c:1646 */
+#line 2029 "awkgram.c" /* yacc.c:1646 */
break;
case 19:
@@ -1997,7 +2038,7 @@ yyreduce:
} else
(yyval) = (yyvsp[0]);
}
-#line 2001 "awkgram.c" /* yacc.c:1646 */
+#line 2042 "awkgram.c" /* yacc.c:1646 */
break;
case 20:
@@ -2031,7 +2072,7 @@ yyreduce:
(yyval) = list_append(list_merge((yyvsp[-3]), (yyvsp[0])), tp);
rule = Rule;
}
-#line 2035 "awkgram.c" /* yacc.c:1646 */
+#line 2076 "awkgram.c" /* yacc.c:1646 */
break;
case 21:
@@ -2049,7 +2090,7 @@ yyreduce:
check_comment();
(yyval) = (yyvsp[0]);
}
-#line 2053 "awkgram.c" /* yacc.c:1646 */
+#line 2094 "awkgram.c" /* yacc.c:1646 */
break;
case 22:
@@ -2067,7 +2108,7 @@ yyreduce:
check_comment();
(yyval) = (yyvsp[0]);
}
-#line 2071 "awkgram.c" /* yacc.c:1646 */
+#line 2112 "awkgram.c" /* yacc.c:1646 */
break;
case 23:
@@ -2079,7 +2120,7 @@ yyreduce:
check_comment();
(yyval) = (yyvsp[0]);
}
-#line 2083 "awkgram.c" /* yacc.c:1646 */
+#line 2124 "awkgram.c" /* yacc.c:1646 */
break;
case 24:
@@ -2091,7 +2132,7 @@ yyreduce:
check_comment();
(yyval) = (yyvsp[0]);
}
-#line 2095 "awkgram.c" /* yacc.c:1646 */
+#line 2136 "awkgram.c" /* yacc.c:1646 */
break;
case 25:
@@ -2104,19 +2145,19 @@ yyreduce:
ip = (yyvsp[-3]);
(yyval) = ip;
}
-#line 2108 "awkgram.c" /* yacc.c:1646 */
+#line 2149 "awkgram.c" /* yacc.c:1646 */
break;
case 26:
#line 411 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2114 "awkgram.c" /* yacc.c:1646 */
+#line 2155 "awkgram.c" /* yacc.c:1646 */
break;
case 27:
#line 413 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2120 "awkgram.c" /* yacc.c:1646 */
+#line 2161 "awkgram.c" /* yacc.c:1646 */
break;
case 28:
@@ -2126,7 +2167,7 @@ yyreduce:
tokstart);
YYABORT;
}
-#line 2130 "awkgram.c" /* yacc.c:1646 */
+#line 2171 "awkgram.c" /* yacc.c:1646 */
break;
case 29:
@@ -2135,13 +2176,13 @@ yyreduce:
(yyval) = (yyvsp[0]);
at_seen = false;
}
-#line 2139 "awkgram.c" /* yacc.c:1646 */
+#line 2180 "awkgram.c" /* yacc.c:1646 */
break;
case 32:
#line 433 "awkgram.y" /* yacc.c:1646 */
{ want_param_names = FUNC_HEADER; }
-#line 2145 "awkgram.c" /* yacc.c:1646 */
+#line 2186 "awkgram.c" /* yacc.c:1646 */
break;
case 33:
@@ -2173,13 +2214,13 @@ yyreduce:
(yyval) = (yyvsp[-6]);
want_param_names = FUNC_BODY;
}
-#line 2177 "awkgram.c" /* yacc.c:1646 */
+#line 2218 "awkgram.c" /* yacc.c:1646 */
break;
case 34:
#line 469 "awkgram.y" /* yacc.c:1646 */
{ want_regexp = true; }
-#line 2183 "awkgram.c" /* yacc.c:1646 */
+#line 2224 "awkgram.c" /* yacc.c:1646 */
break;
case 35:
@@ -2212,28 +2253,52 @@ yyreduce:
(yyval)->opcode = Op_match_rec;
(yyval)->memory = n;
}
-#line 2216 "awkgram.c" /* yacc.c:1646 */
+#line 2257 "awkgram.c" /* yacc.c:1646 */
break;
case 36:
#line 503 "awkgram.y" /* yacc.c:1646 */
+ {
+ NODE *n, *exp;
+ char *re;
+ size_t len;
+
+ re = (yyvsp[0])->lextok;
+ (yyvsp[0])->lextok = NULL;
+ len = strlen(re);
+
+ exp = make_str_node(re, len, ALREADY_MALLOCED);
+ n = make_regnode(Node_typedregex, exp);
+ if (n == NULL) {
+ unref(exp);
+ YYABORT;
+ }
+ (yyval) = (yyvsp[0]);
+ (yyval)->opcode = Op_push_re;
+ (yyval)->memory = n;
+ }
+#line 2281 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 37:
+#line 525 "awkgram.y" /* yacc.c:1646 */
{ bcfree((yyvsp[0])); }
-#line 2222 "awkgram.c" /* yacc.c:1646 */
+#line 2287 "awkgram.c" /* yacc.c:1646 */
break;
- case 38:
-#line 509 "awkgram.y" /* yacc.c:1646 */
+ case 39:
+#line 531 "awkgram.y" /* yacc.c:1646 */
{
if (comment != NULL) {
(yyval) = list_create(comment);
comment = NULL;
} else (yyval) = NULL;
}
-#line 2233 "awkgram.c" /* yacc.c:1646 */
+#line 2298 "awkgram.c" /* yacc.c:1646 */
break;
- case 39:
-#line 516 "awkgram.y" /* yacc.c:1646 */
+ case 40:
+#line 538 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0]) == NULL) {
if (comment == NULL)
@@ -2261,40 +2326,40 @@ yyreduce:
}
yyerrok;
}
-#line 2265 "awkgram.c" /* yacc.c:1646 */
+#line 2330 "awkgram.c" /* yacc.c:1646 */
break;
- case 40:
-#line 544 "awkgram.y" /* yacc.c:1646 */
+ case 41:
+#line 566 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2271 "awkgram.c" /* yacc.c:1646 */
+#line 2336 "awkgram.c" /* yacc.c:1646 */
break;
- case 43:
-#line 554 "awkgram.y" /* yacc.c:1646 */
+ case 44:
+#line 576 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2277 "awkgram.c" /* yacc.c:1646 */
+#line 2342 "awkgram.c" /* yacc.c:1646 */
break;
- case 44:
-#line 556 "awkgram.y" /* yacc.c:1646 */
+ case 45:
+#line 578 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 2283 "awkgram.c" /* yacc.c:1646 */
+#line 2348 "awkgram.c" /* yacc.c:1646 */
break;
- case 45:
-#line 558 "awkgram.y" /* yacc.c:1646 */
+ case 46:
+#line 580 "awkgram.y" /* yacc.c:1646 */
{
if (do_pretty_print)
(yyval) = list_prepend((yyvsp[0]), instruction(Op_exec_count));
else
(yyval) = (yyvsp[0]);
}
-#line 2294 "awkgram.c" /* yacc.c:1646 */
+#line 2359 "awkgram.c" /* yacc.c:1646 */
break;
- case 46:
-#line 565 "awkgram.y" /* yacc.c:1646 */
+ case 47:
+#line 587 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
INSTRUCTION *ip, *nextc, *tbreak;
@@ -2384,11 +2449,11 @@ yyreduce:
break_allowed--;
fix_break_continue(ip, tbreak, NULL);
}
-#line 2388 "awkgram.c" /* yacc.c:1646 */
+#line 2453 "awkgram.c" /* yacc.c:1646 */
break;
- case 47:
-#line 655 "awkgram.y" /* yacc.c:1646 */
+ case 48:
+#line 677 "awkgram.y" /* yacc.c:1646 */
{
/*
* -----------------
@@ -2430,11 +2495,11 @@ yyreduce:
continue_allowed--;
fix_break_continue(ip, tbreak, tcont);
}
-#line 2434 "awkgram.c" /* yacc.c:1646 */
+#line 2499 "awkgram.c" /* yacc.c:1646 */
break;
- case 48:
-#line 697 "awkgram.y" /* yacc.c:1646 */
+ case 49:
+#line 719 "awkgram.y" /* yacc.c:1646 */
{
/*
* -----------------
@@ -2476,11 +2541,11 @@ yyreduce:
} /* else
$1 and $4 are NULLs */
}
-#line 2480 "awkgram.c" /* yacc.c:1646 */
+#line 2545 "awkgram.c" /* yacc.c:1646 */
break;
- case 49:
-#line 739 "awkgram.y" /* yacc.c:1646 */
+ case 50:
+#line 761 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip;
char *var_name = (yyvsp[-5])->lextok;
@@ -2593,44 +2658,44 @@ regular_loop:
break_allowed--;
continue_allowed--;
}
-#line 2597 "awkgram.c" /* yacc.c:1646 */
+#line 2662 "awkgram.c" /* yacc.c:1646 */
break;
- case 50:
-#line 852 "awkgram.y" /* yacc.c:1646 */
+ case 51:
+#line 874 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_for_loop((yyvsp[-11]), (yyvsp[-9]), (yyvsp[-6]), (yyvsp[-3]), (yyvsp[0]));
break_allowed--;
continue_allowed--;
}
-#line 2608 "awkgram.c" /* yacc.c:1646 */
+#line 2673 "awkgram.c" /* yacc.c:1646 */
break;
- case 51:
-#line 859 "awkgram.y" /* yacc.c:1646 */
+ case 52:
+#line 881 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_for_loop((yyvsp[-10]), (yyvsp[-8]), (INSTRUCTION *) NULL, (yyvsp[-3]), (yyvsp[0]));
break_allowed--;
continue_allowed--;
}
-#line 2619 "awkgram.c" /* yacc.c:1646 */
+#line 2684 "awkgram.c" /* yacc.c:1646 */
break;
- case 52:
-#line 866 "awkgram.y" /* yacc.c:1646 */
+ case 53:
+#line 888 "awkgram.y" /* yacc.c:1646 */
{
if (do_pretty_print)
(yyval) = list_prepend((yyvsp[0]), instruction(Op_exec_count));
else
(yyval) = (yyvsp[0]);
}
-#line 2630 "awkgram.c" /* yacc.c:1646 */
+#line 2695 "awkgram.c" /* yacc.c:1646 */
break;
- case 53:
-#line 876 "awkgram.y" /* yacc.c:1646 */
+ case 54:
+#line 898 "awkgram.y" /* yacc.c:1646 */
{
if (! break_allowed)
error_ln((yyvsp[-1])->source_line,
@@ -2639,11 +2704,11 @@ regular_loop:
(yyval) = list_create((yyvsp[-1]));
}
-#line 2643 "awkgram.c" /* yacc.c:1646 */
+#line 2708 "awkgram.c" /* yacc.c:1646 */
break;
- case 54:
-#line 885 "awkgram.y" /* yacc.c:1646 */
+ case 55:
+#line 907 "awkgram.y" /* yacc.c:1646 */
{
if (! continue_allowed)
error_ln((yyvsp[-1])->source_line,
@@ -2652,11 +2717,11 @@ regular_loop:
(yyval) = list_create((yyvsp[-1]));
}
-#line 2656 "awkgram.c" /* yacc.c:1646 */
+#line 2721 "awkgram.c" /* yacc.c:1646 */
break;
- case 55:
-#line 894 "awkgram.y" /* yacc.c:1646 */
+ case 56:
+#line 916 "awkgram.y" /* yacc.c:1646 */
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule && rule != Rule)
@@ -2665,11 +2730,11 @@ regular_loop:
(yyvsp[-1])->target_jmp = ip_rec;
(yyval) = list_create((yyvsp[-1]));
}
-#line 2669 "awkgram.c" /* yacc.c:1646 */
+#line 2734 "awkgram.c" /* yacc.c:1646 */
break;
- case 56:
-#line 903 "awkgram.y" /* yacc.c:1646 */
+ case 57:
+#line 925 "awkgram.y" /* yacc.c:1646 */
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule == BEGIN || rule == END || rule == ENDFILE)
@@ -2680,11 +2745,11 @@ regular_loop:
(yyvsp[-1])->target_endfile = ip_endfile;
(yyval) = list_create((yyvsp[-1]));
}
-#line 2684 "awkgram.c" /* yacc.c:1646 */
+#line 2749 "awkgram.c" /* yacc.c:1646 */
break;
- case 57:
-#line 914 "awkgram.y" /* yacc.c:1646 */
+ case 58:
+#line 936 "awkgram.y" /* yacc.c:1646 */
{
/* Initialize the two possible jump targets, the actual target
* is resolved at run-time.
@@ -2699,20 +2764,20 @@ regular_loop:
} else
(yyval) = list_append((yyvsp[-1]), (yyvsp[-2]));
}
-#line 2703 "awkgram.c" /* yacc.c:1646 */
+#line 2768 "awkgram.c" /* yacc.c:1646 */
break;
- case 58:
-#line 929 "awkgram.y" /* yacc.c:1646 */
+ case 59:
+#line 951 "awkgram.y" /* yacc.c:1646 */
{
if (! in_function)
yyerror(_("`return' used outside function context"));
}
-#line 2712 "awkgram.c" /* yacc.c:1646 */
+#line 2777 "awkgram.c" /* yacc.c:1646 */
break;
- case 59:
-#line 932 "awkgram.y" /* yacc.c:1646 */
+ case 60:
+#line 954 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-1]) == NULL) {
(yyval) = list_create((yyvsp[-3]));
@@ -2733,17 +2798,17 @@ regular_loop:
(yyval) = list_append((yyvsp[-1]), (yyvsp[-3]));
}
}
-#line 2737 "awkgram.c" /* yacc.c:1646 */
+#line 2802 "awkgram.c" /* yacc.c:1646 */
break;
- case 61:
-#line 964 "awkgram.y" /* yacc.c:1646 */
+ case 62:
+#line 986 "awkgram.y" /* yacc.c:1646 */
{ in_print = true; in_parens = 0; }
-#line 2743 "awkgram.c" /* yacc.c:1646 */
+#line 2808 "awkgram.c" /* yacc.c:1646 */
break;
- case 62:
-#line 965 "awkgram.y" /* yacc.c:1646 */
+ case 63:
+#line 987 "awkgram.y" /* yacc.c:1646 */
{
/*
* Optimization: plain `print' has no expression list, so $3 is null.
@@ -2840,17 +2905,17 @@ regular_print:
}
}
}
-#line 2844 "awkgram.c" /* yacc.c:1646 */
+#line 2909 "awkgram.c" /* yacc.c:1646 */
break;
- case 63:
-#line 1062 "awkgram.y" /* yacc.c:1646 */
+ case 64:
+#line 1084 "awkgram.y" /* yacc.c:1646 */
{ sub_counter = 0; }
-#line 2850 "awkgram.c" /* yacc.c:1646 */
+#line 2915 "awkgram.c" /* yacc.c:1646 */
break;
- case 64:
-#line 1063 "awkgram.y" /* yacc.c:1646 */
+ case 65:
+#line 1085 "awkgram.y" /* yacc.c:1646 */
{
char *arr = (yyvsp[-2])->lextok;
@@ -2883,11 +2948,11 @@ regular_print:
(yyval) = list_append(list_append((yyvsp[0]), (yyvsp[-2])), (yyvsp[-3]));
}
}
-#line 2887 "awkgram.c" /* yacc.c:1646 */
+#line 2952 "awkgram.c" /* yacc.c:1646 */
break;
- case 65:
-#line 1100 "awkgram.y" /* yacc.c:1646 */
+ case 66:
+#line 1122 "awkgram.y" /* yacc.c:1646 */
{
static bool warned = false;
char *arr = (yyvsp[-1])->lextok;
@@ -2913,52 +2978,52 @@ regular_print:
fatal(_("`delete' is not allowed with FUNCTAB"));
}
}
-#line 2917 "awkgram.c" /* yacc.c:1646 */
+#line 2982 "awkgram.c" /* yacc.c:1646 */
break;
- case 66:
-#line 1126 "awkgram.y" /* yacc.c:1646 */
+ case 67:
+#line 1148 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = optimize_assignment((yyvsp[0])); }
-#line 2923 "awkgram.c" /* yacc.c:1646 */
+#line 2988 "awkgram.c" /* yacc.c:1646 */
break;
- case 67:
-#line 1131 "awkgram.y" /* yacc.c:1646 */
+ case 68:
+#line 1153 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2929 "awkgram.c" /* yacc.c:1646 */
+#line 2994 "awkgram.c" /* yacc.c:1646 */
break;
- case 68:
-#line 1133 "awkgram.y" /* yacc.c:1646 */
+ case 69:
+#line 1155 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2935 "awkgram.c" /* yacc.c:1646 */
+#line 3000 "awkgram.c" /* yacc.c:1646 */
break;
- case 69:
-#line 1138 "awkgram.y" /* yacc.c:1646 */
+ case 70:
+#line 1160 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2941 "awkgram.c" /* yacc.c:1646 */
+#line 3006 "awkgram.c" /* yacc.c:1646 */
break;
- case 70:
-#line 1140 "awkgram.y" /* yacc.c:1646 */
+ case 71:
+#line 1162 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-1]) == NULL)
(yyval) = list_create((yyvsp[0]));
else
(yyval) = list_prepend((yyvsp[-1]), (yyvsp[0]));
}
-#line 2952 "awkgram.c" /* yacc.c:1646 */
+#line 3017 "awkgram.c" /* yacc.c:1646 */
break;
- case 71:
-#line 1147 "awkgram.y" /* yacc.c:1646 */
+ case 72:
+#line 1169 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2958 "awkgram.c" /* yacc.c:1646 */
+#line 3023 "awkgram.c" /* yacc.c:1646 */
break;
- case 72:
-#line 1152 "awkgram.y" /* yacc.c:1646 */
+ case 73:
+#line 1174 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *casestmt = (yyvsp[0]);
if ((yyvsp[0]) == NULL)
@@ -2970,11 +3035,11 @@ regular_print:
bcfree((yyvsp[-2]));
(yyval) = (yyvsp[-4]);
}
-#line 2974 "awkgram.c" /* yacc.c:1646 */
+#line 3039 "awkgram.c" /* yacc.c:1646 */
break;
- case 73:
-#line 1164 "awkgram.y" /* yacc.c:1646 */
+ case 74:
+#line 1186 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *casestmt = (yyvsp[0]);
if ((yyvsp[0]) == NULL)
@@ -2985,17 +3050,17 @@ regular_print:
(yyvsp[-3])->case_stmt = casestmt;
(yyval) = (yyvsp[-3]);
}
-#line 2989 "awkgram.c" /* yacc.c:1646 */
+#line 3054 "awkgram.c" /* yacc.c:1646 */
break;
- case 74:
-#line 1178 "awkgram.y" /* yacc.c:1646 */
+ case 75:
+#line 1200 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2995 "awkgram.c" /* yacc.c:1646 */
+#line 3060 "awkgram.c" /* yacc.c:1646 */
break;
- case 75:
-#line 1180 "awkgram.y" /* yacc.c:1646 */
+ case 76:
+#line 1202 "awkgram.y" /* yacc.c:1646 */
{
NODE *n = (yyvsp[0])->memory;
(void) force_number(n);
@@ -3003,71 +3068,84 @@ regular_print:
bcfree((yyvsp[-1]));
(yyval) = (yyvsp[0]);
}
-#line 3007 "awkgram.c" /* yacc.c:1646 */
+#line 3072 "awkgram.c" /* yacc.c:1646 */
break;
- case 76:
-#line 1188 "awkgram.y" /* yacc.c:1646 */
+ case 77:
+#line 1210 "awkgram.y" /* yacc.c:1646 */
{
bcfree((yyvsp[-1]));
(yyval) = (yyvsp[0]);
}
-#line 3016 "awkgram.c" /* yacc.c:1646 */
+#line 3081 "awkgram.c" /* yacc.c:1646 */
break;
- case 77:
-#line 1193 "awkgram.y" /* yacc.c:1646 */
+ case 78:
+#line 1215 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3022 "awkgram.c" /* yacc.c:1646 */
+#line 3087 "awkgram.c" /* yacc.c:1646 */
break;
- case 78:
-#line 1195 "awkgram.y" /* yacc.c:1646 */
+ case 79:
+#line 1217 "awkgram.y" /* yacc.c:1646 */
{
+ if ((yyvsp[0])->memory->type == Node_regex)
+ (yyvsp[0])->opcode = Op_push_re;
+ else
+ (yyvsp[0])->opcode = Op_push;
+ (yyval) = (yyvsp[0]);
+ }
+#line 3099 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 80:
+#line 1225 "awkgram.y" /* yacc.c:1646 */
+ {
+ assert((yyvsp[0])->memory->type == Node_typedregex);
(yyvsp[0])->opcode = Op_push_re;
(yyval) = (yyvsp[0]);
}
-#line 3031 "awkgram.c" /* yacc.c:1646 */
+#line 3109 "awkgram.c" /* yacc.c:1646 */
break;
- case 79:
-#line 1203 "awkgram.y" /* yacc.c:1646 */
+ case 81:
+#line 1234 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3037 "awkgram.c" /* yacc.c:1646 */
+#line 3115 "awkgram.c" /* yacc.c:1646 */
break;
- case 80:
-#line 1205 "awkgram.y" /* yacc.c:1646 */
+ case 82:
+#line 1236 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3043 "awkgram.c" /* yacc.c:1646 */
+#line 3121 "awkgram.c" /* yacc.c:1646 */
break;
- case 82:
-#line 1215 "awkgram.y" /* yacc.c:1646 */
+ case 84:
+#line 1246 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = (yyvsp[-1]);
}
-#line 3051 "awkgram.c" /* yacc.c:1646 */
+#line 3129 "awkgram.c" /* yacc.c:1646 */
break;
- case 83:
-#line 1222 "awkgram.y" /* yacc.c:1646 */
+ case 85:
+#line 1253 "awkgram.y" /* yacc.c:1646 */
{
in_print = false;
in_parens = 0;
(yyval) = NULL;
}
-#line 3061 "awkgram.c" /* yacc.c:1646 */
+#line 3139 "awkgram.c" /* yacc.c:1646 */
break;
- case 84:
-#line 1227 "awkgram.y" /* yacc.c:1646 */
+ case 86:
+#line 1258 "awkgram.y" /* yacc.c:1646 */
{ in_print = false; in_parens = 0; }
-#line 3067 "awkgram.c" /* yacc.c:1646 */
+#line 3145 "awkgram.c" /* yacc.c:1646 */
break;
- case 85:
-#line 1228 "awkgram.y" /* yacc.c:1646 */
+ case 87:
+#line 1259 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2])->redir_type == redirect_twoway
&& (yyvsp[0])->lasti->opcode == Op_K_getline_redir
@@ -3075,63 +3153,63 @@ regular_print:
yyerror(_("multistage two-way pipelines don't work"));
(yyval) = list_prepend((yyvsp[0]), (yyvsp[-2]));
}
-#line 3079 "awkgram.c" /* yacc.c:1646 */
+#line 3157 "awkgram.c" /* yacc.c:1646 */
break;
- case 86:
-#line 1239 "awkgram.y" /* yacc.c:1646 */
+ case 88:
+#line 1270 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_condition((yyvsp[-3]), (yyvsp[-5]), (yyvsp[0]), NULL, NULL);
}
-#line 3087 "awkgram.c" /* yacc.c:1646 */
+#line 3165 "awkgram.c" /* yacc.c:1646 */
break;
- case 87:
-#line 1244 "awkgram.y" /* yacc.c:1646 */
+ case 89:
+#line 1275 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_condition((yyvsp[-6]), (yyvsp[-8]), (yyvsp[-3]), (yyvsp[-2]), (yyvsp[0]));
}
-#line 3095 "awkgram.c" /* yacc.c:1646 */
+#line 3173 "awkgram.c" /* yacc.c:1646 */
break;
- case 92:
-#line 1261 "awkgram.y" /* yacc.c:1646 */
+ case 94:
+#line 1292 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3101 "awkgram.c" /* yacc.c:1646 */
+#line 3179 "awkgram.c" /* yacc.c:1646 */
break;
- case 93:
-#line 1263 "awkgram.y" /* yacc.c:1646 */
+ case 95:
+#line 1294 "awkgram.y" /* yacc.c:1646 */
{
bcfree((yyvsp[-1]));
(yyval) = (yyvsp[0]);
}
-#line 3110 "awkgram.c" /* yacc.c:1646 */
+#line 3188 "awkgram.c" /* yacc.c:1646 */
break;
- case 94:
-#line 1271 "awkgram.y" /* yacc.c:1646 */
+ case 96:
+#line 1302 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3116 "awkgram.c" /* yacc.c:1646 */
+#line 3194 "awkgram.c" /* yacc.c:1646 */
break;
- case 95:
-#line 1273 "awkgram.y" /* yacc.c:1646 */
+ case 97:
+#line 1304 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3122 "awkgram.c" /* yacc.c:1646 */
+#line 3200 "awkgram.c" /* yacc.c:1646 */
break;
- case 96:
-#line 1278 "awkgram.y" /* yacc.c:1646 */
+ case 98:
+#line 1309 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->param_count = 0;
(yyval) = list_create((yyvsp[0]));
}
-#line 3131 "awkgram.c" /* yacc.c:1646 */
+#line 3209 "awkgram.c" /* yacc.c:1646 */
break;
- case 97:
-#line 1283 "awkgram.y" /* yacc.c:1646 */
+ case 99:
+#line 1314 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2]) != NULL && (yyvsp[0]) != NULL) {
(yyvsp[0])->param_count = (yyvsp[-2])->lasti->param_count + 1;
@@ -3140,74 +3218,74 @@ regular_print:
} else
(yyval) = NULL;
}
-#line 3144 "awkgram.c" /* yacc.c:1646 */
+#line 3222 "awkgram.c" /* yacc.c:1646 */
break;
- case 98:
-#line 1292 "awkgram.y" /* yacc.c:1646 */
+ case 100:
+#line 1323 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3150 "awkgram.c" /* yacc.c:1646 */
+#line 3228 "awkgram.c" /* yacc.c:1646 */
break;
- case 99:
-#line 1294 "awkgram.y" /* yacc.c:1646 */
+ case 101:
+#line 1325 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3156 "awkgram.c" /* yacc.c:1646 */
+#line 3234 "awkgram.c" /* yacc.c:1646 */
break;
- case 100:
-#line 1296 "awkgram.y" /* yacc.c:1646 */
+ case 102:
+#line 1327 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-2]); }
-#line 3162 "awkgram.c" /* yacc.c:1646 */
+#line 3240 "awkgram.c" /* yacc.c:1646 */
break;
- case 101:
-#line 1302 "awkgram.y" /* yacc.c:1646 */
+ case 103:
+#line 1333 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3168 "awkgram.c" /* yacc.c:1646 */
+#line 3246 "awkgram.c" /* yacc.c:1646 */
break;
- case 102:
-#line 1304 "awkgram.y" /* yacc.c:1646 */
+ case 104:
+#line 1335 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3174 "awkgram.c" /* yacc.c:1646 */
+#line 3252 "awkgram.c" /* yacc.c:1646 */
break;
- case 103:
-#line 1309 "awkgram.y" /* yacc.c:1646 */
+ case 105:
+#line 1340 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3180 "awkgram.c" /* yacc.c:1646 */
+#line 3258 "awkgram.c" /* yacc.c:1646 */
break;
- case 104:
-#line 1311 "awkgram.y" /* yacc.c:1646 */
+ case 106:
+#line 1342 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3186 "awkgram.c" /* yacc.c:1646 */
+#line 3264 "awkgram.c" /* yacc.c:1646 */
break;
- case 105:
-#line 1316 "awkgram.y" /* yacc.c:1646 */
+ case 107:
+#line 1347 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_expression_list(NULL, (yyvsp[0])); }
-#line 3192 "awkgram.c" /* yacc.c:1646 */
+#line 3270 "awkgram.c" /* yacc.c:1646 */
break;
- case 106:
-#line 1318 "awkgram.y" /* yacc.c:1646 */
+ case 108:
+#line 1349 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
yyerrok;
}
-#line 3201 "awkgram.c" /* yacc.c:1646 */
+#line 3279 "awkgram.c" /* yacc.c:1646 */
break;
- case 107:
-#line 1323 "awkgram.y" /* yacc.c:1646 */
+ case 109:
+#line 1354 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3207 "awkgram.c" /* yacc.c:1646 */
+#line 3285 "awkgram.c" /* yacc.c:1646 */
break;
- case 108:
-#line 1325 "awkgram.y" /* yacc.c:1646 */
+ case 110:
+#line 1356 "awkgram.y" /* yacc.c:1646 */
{
/*
* Returning the expression list instead of NULL lets
@@ -3215,58 +3293,159 @@ regular_print:
*/
(yyval) = (yyvsp[-1]);
}
-#line 3219 "awkgram.c" /* yacc.c:1646 */
+#line 3297 "awkgram.c" /* yacc.c:1646 */
break;
- case 109:
-#line 1333 "awkgram.y" /* yacc.c:1646 */
+ case 111:
+#line 1364 "awkgram.y" /* yacc.c:1646 */
{
/* Ditto */
(yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
}
-#line 3228 "awkgram.c" /* yacc.c:1646 */
+#line 3306 "awkgram.c" /* yacc.c:1646 */
break;
- case 110:
-#line 1338 "awkgram.y" /* yacc.c:1646 */
+ case 112:
+#line 1369 "awkgram.y" /* yacc.c:1646 */
{
/* Ditto */
(yyval) = (yyvsp[-2]);
}
-#line 3237 "awkgram.c" /* yacc.c:1646 */
+#line 3315 "awkgram.c" /* yacc.c:1646 */
break;
- case 111:
-#line 1347 "awkgram.y" /* yacc.c:1646 */
+ case 113:
+#line 1377 "awkgram.y" /* yacc.c:1646 */
+ { (yyval) = NULL; }
+#line 3321 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 114:
+#line 1379 "awkgram.y" /* yacc.c:1646 */
+ { (yyval) = (yyvsp[0]); }
+#line 3327 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 115:
+#line 1384 "awkgram.y" /* yacc.c:1646 */
+ { (yyval) = mk_expression_list(NULL, (yyvsp[0])); }
+#line 3333 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 116:
+#line 1386 "awkgram.y" /* yacc.c:1646 */
+ {
+ (yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
+ yyerrok;
+ }
+#line 3342 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 117:
+#line 1391 "awkgram.y" /* yacc.c:1646 */
+ { (yyval) = NULL; }
+#line 3348 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 118:
+#line 1393 "awkgram.y" /* yacc.c:1646 */
+ {
+ /*
+ * Returning the expression list instead of NULL lets
+ * snode get a list of arguments that it can count.
+ */
+ (yyval) = (yyvsp[-1]);
+ }
+#line 3360 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 119:
+#line 1401 "awkgram.y" /* yacc.c:1646 */
+ {
+ /* Ditto */
+ (yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
+ }
+#line 3369 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 120:
+#line 1406 "awkgram.y" /* yacc.c:1646 */
+ {
+ /* Ditto */
+ (yyval) = (yyvsp[-2]);
+ }
+#line 3378 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 121:
+#line 1413 "awkgram.y" /* yacc.c:1646 */
+ { (yyval) = (yyvsp[0]); }
+#line 3384 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 122:
+#line 1414 "awkgram.y" /* yacc.c:1646 */
+ { (yyval) = list_create((yyvsp[0])); }
+#line 3390 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 123:
+#line 1420 "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 3248 "awkgram.c" /* yacc.c:1646 */
+#line 3401 "awkgram.c" /* yacc.c:1646 */
break;
- case 112:
-#line 1354 "awkgram.y" /* yacc.c:1646 */
+ case 124:
+#line 1427 "awkgram.y" /* yacc.c:1646 */
+ {
+ (yyval) = mk_assignment((yyvsp[-2]), list_create((yyvsp[0])), (yyvsp[-1]));
+ }
+#line 3409 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 125:
+#line 1431 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_boolean((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3254 "awkgram.c" /* yacc.c:1646 */
+#line 3415 "awkgram.c" /* yacc.c:1646 */
break;
- case 113:
-#line 1356 "awkgram.y" /* yacc.c:1646 */
+ case 126:
+#line 1433 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_boolean((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3260 "awkgram.c" /* yacc.c:1646 */
+#line 3421 "awkgram.c" /* yacc.c:1646 */
break;
- case 114:
-#line 1358 "awkgram.y" /* yacc.c:1646 */
+ case 127:
+#line 1435 "awkgram.y" /* yacc.c:1646 */
+ {
+ if ((yyvsp[-2])->lasti->opcode == Op_match_rec)
+ warning_ln((yyvsp[-1])->source_line,
+ _("regular expression on left of `~' or `!~' operator"));
+
+ assert((yyvsp[0])->opcode == Op_push_re
+ && (yyvsp[0])->memory->type == Node_typedregex);
+ /* RHS is @/.../ */
+ (yyvsp[-1])->memory = (yyvsp[0])->memory;
+ bcfree((yyvsp[0]));
+ (yyval) = list_append((yyvsp[-2]), (yyvsp[-1]));
+ }
+#line 3438 "awkgram.c" /* yacc.c:1646 */
+ break;
+
+ case 128:
+#line 1448 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[-2])->lasti->opcode == Op_match_rec)
warning_ln((yyvsp[-1])->source_line,
_("regular expression on left of `~' or `!~' operator"));
if ((yyvsp[0])->lasti == (yyvsp[0])->nexti && (yyvsp[0])->nexti->opcode == Op_match_rec) {
+ /* RHS is /.../ */
(yyvsp[-1])->memory = (yyvsp[0])->nexti->memory;
bcfree((yyvsp[0])->nexti); /* Op_match_rec */
bcfree((yyvsp[0])); /* Op_list */
@@ -3276,11 +3455,11 @@ regular_print:
(yyval) = list_append(list_merge((yyvsp[-2]), (yyvsp[0])), (yyvsp[-1]));
}
}
-#line 3280 "awkgram.c" /* yacc.c:1646 */
+#line 3459 "awkgram.c" /* yacc.c:1646 */
break;
- case 115:
-#line 1374 "awkgram.y" /* yacc.c:1646 */
+ case 129:
+#line 1465 "awkgram.y" /* yacc.c:1646 */
{
if (do_lint_old)
warning_ln((yyvsp[-1])->source_line,
@@ -3290,91 +3469,91 @@ regular_print:
(yyvsp[-1])->expr_count = 1;
(yyval) = list_append(list_merge((yyvsp[-2]), (yyvsp[0])), (yyvsp[-1]));
}
-#line 3294 "awkgram.c" /* yacc.c:1646 */
+#line 3473 "awkgram.c" /* yacc.c:1646 */
break;
- case 116:
-#line 1384 "awkgram.y" /* yacc.c:1646 */
+ case 130:
+#line 1475 "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 3305 "awkgram.c" /* yacc.c:1646 */
+#line 3484 "awkgram.c" /* yacc.c:1646 */
break;
- case 117:
-#line 1391 "awkgram.y" /* yacc.c:1646 */
+ case 131:
+#line 1482 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_condition((yyvsp[-4]), (yyvsp[-3]), (yyvsp[-2]), (yyvsp[-1]), (yyvsp[0])); }
-#line 3311 "awkgram.c" /* yacc.c:1646 */
+#line 3490 "awkgram.c" /* yacc.c:1646 */
break;
- case 118:
-#line 1393 "awkgram.y" /* yacc.c:1646 */
+ case 132:
+#line 1484 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3317 "awkgram.c" /* yacc.c:1646 */
+#line 3496 "awkgram.c" /* yacc.c:1646 */
break;
- case 119:
-#line 1398 "awkgram.y" /* yacc.c:1646 */
+ case 133:
+#line 1489 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3323 "awkgram.c" /* yacc.c:1646 */
+#line 3502 "awkgram.c" /* yacc.c:1646 */
break;
- case 120:
-#line 1400 "awkgram.y" /* yacc.c:1646 */
+ case 134:
+#line 1491 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3329 "awkgram.c" /* yacc.c:1646 */
+#line 3508 "awkgram.c" /* yacc.c:1646 */
break;
- case 121:
-#line 1402 "awkgram.y" /* yacc.c:1646 */
+ case 135:
+#line 1493 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_assign_quotient;
(yyval) = (yyvsp[0]);
}
-#line 3338 "awkgram.c" /* yacc.c:1646 */
+#line 3517 "awkgram.c" /* yacc.c:1646 */
break;
- case 122:
-#line 1410 "awkgram.y" /* yacc.c:1646 */
+ case 136:
+#line 1501 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3344 "awkgram.c" /* yacc.c:1646 */
+#line 3523 "awkgram.c" /* yacc.c:1646 */
break;
- case 123:
-#line 1412 "awkgram.y" /* yacc.c:1646 */
+ case 137:
+#line 1503 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3350 "awkgram.c" /* yacc.c:1646 */
+#line 3529 "awkgram.c" /* yacc.c:1646 */
break;
- case 124:
-#line 1417 "awkgram.y" /* yacc.c:1646 */
+ case 138:
+#line 1508 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3356 "awkgram.c" /* yacc.c:1646 */
+#line 3535 "awkgram.c" /* yacc.c:1646 */
break;
- case 125:
-#line 1419 "awkgram.y" /* yacc.c:1646 */
+ case 139:
+#line 1510 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3362 "awkgram.c" /* yacc.c:1646 */
+#line 3541 "awkgram.c" /* yacc.c:1646 */
break;
- case 126:
-#line 1424 "awkgram.y" /* yacc.c:1646 */
+ case 140:
+#line 1515 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3368 "awkgram.c" /* yacc.c:1646 */
+#line 3547 "awkgram.c" /* yacc.c:1646 */
break;
- case 127:
-#line 1426 "awkgram.y" /* yacc.c:1646 */
+ case 141:
+#line 1517 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3374 "awkgram.c" /* yacc.c:1646 */
+#line 3553 "awkgram.c" /* yacc.c:1646 */
break;
- case 128:
-#line 1428 "awkgram.y" /* yacc.c:1646 */
+ case 142:
+#line 1519 "awkgram.y" /* yacc.c:1646 */
{
int count = 2;
bool is_simple_var = false;
@@ -3421,47 +3600,47 @@ regular_print:
max_args = count;
}
}
-#line 3425 "awkgram.c" /* yacc.c:1646 */
+#line 3604 "awkgram.c" /* yacc.c:1646 */
break;
- case 130:
-#line 1480 "awkgram.y" /* yacc.c:1646 */
+ case 144:
+#line 1571 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3431 "awkgram.c" /* yacc.c:1646 */
+#line 3610 "awkgram.c" /* yacc.c:1646 */
break;
- case 131:
-#line 1482 "awkgram.y" /* yacc.c:1646 */
+ case 145:
+#line 1573 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3437 "awkgram.c" /* yacc.c:1646 */
+#line 3616 "awkgram.c" /* yacc.c:1646 */
break;
- case 132:
-#line 1484 "awkgram.y" /* yacc.c:1646 */
+ case 146:
+#line 1575 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3443 "awkgram.c" /* yacc.c:1646 */
+#line 3622 "awkgram.c" /* yacc.c:1646 */
break;
- case 133:
-#line 1486 "awkgram.y" /* yacc.c:1646 */
+ case 147:
+#line 1577 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3449 "awkgram.c" /* yacc.c:1646 */
+#line 3628 "awkgram.c" /* yacc.c:1646 */
break;
- case 134:
-#line 1488 "awkgram.y" /* yacc.c:1646 */
+ case 148:
+#line 1579 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3455 "awkgram.c" /* yacc.c:1646 */
+#line 3634 "awkgram.c" /* yacc.c:1646 */
break;
- case 135:
-#line 1490 "awkgram.y" /* yacc.c:1646 */
+ case 149:
+#line 1581 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3461 "awkgram.c" /* yacc.c:1646 */
+#line 3640 "awkgram.c" /* yacc.c:1646 */
break;
- case 136:
-#line 1492 "awkgram.y" /* yacc.c:1646 */
+ case 150:
+#line 1583 "awkgram.y" /* yacc.c:1646 */
{
/*
* In BEGINFILE/ENDFILE, allow `getline [var] < file'
@@ -3475,29 +3654,29 @@ regular_print:
_("non-redirected `getline' undefined inside END action"));
(yyval) = mk_getline((yyvsp[-2]), (yyvsp[-1]), (yyvsp[0]), redirect_input);
}
-#line 3479 "awkgram.c" /* yacc.c:1646 */
+#line 3658 "awkgram.c" /* yacc.c:1646 */
break;
- case 137:
-#line 1506 "awkgram.y" /* yacc.c:1646 */
+ case 151:
+#line 1597 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postincrement;
(yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
}
-#line 3488 "awkgram.c" /* yacc.c:1646 */
+#line 3667 "awkgram.c" /* yacc.c:1646 */
break;
- case 138:
-#line 1511 "awkgram.y" /* yacc.c:1646 */
+ case 152:
+#line 1602 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postdecrement;
(yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
}
-#line 3497 "awkgram.c" /* yacc.c:1646 */
+#line 3676 "awkgram.c" /* yacc.c:1646 */
break;
- case 139:
-#line 1516 "awkgram.y" /* yacc.c:1646 */
+ case 153:
+#line 1607 "awkgram.y" /* yacc.c:1646 */
{
if (do_lint_old) {
warning_ln((yyvsp[-1])->source_line,
@@ -3517,64 +3696,64 @@ regular_print:
(yyval) = list_append(list_merge(t, (yyvsp[0])), (yyvsp[-1]));
}
}
-#line 3521 "awkgram.c" /* yacc.c:1646 */
+#line 3700 "awkgram.c" /* yacc.c:1646 */
break;
- case 140:
-#line 1541 "awkgram.y" /* yacc.c:1646 */
+ case 154:
+#line 1632 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = mk_getline((yyvsp[-1]), (yyvsp[0]), (yyvsp[-3]), (yyvsp[-2])->redir_type);
bcfree((yyvsp[-2]));
}
-#line 3530 "awkgram.c" /* yacc.c:1646 */
+#line 3709 "awkgram.c" /* yacc.c:1646 */
break;
- case 141:
-#line 1547 "awkgram.y" /* yacc.c:1646 */
+ case 155:
+#line 1638 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3536 "awkgram.c" /* yacc.c:1646 */
+#line 3715 "awkgram.c" /* yacc.c:1646 */
break;
- case 142:
-#line 1549 "awkgram.y" /* yacc.c:1646 */
+ case 156:
+#line 1640 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3542 "awkgram.c" /* yacc.c:1646 */
+#line 3721 "awkgram.c" /* yacc.c:1646 */
break;
- case 143:
-#line 1551 "awkgram.y" /* yacc.c:1646 */
+ case 157:
+#line 1642 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3548 "awkgram.c" /* yacc.c:1646 */
+#line 3727 "awkgram.c" /* yacc.c:1646 */
break;
- case 144:
-#line 1553 "awkgram.y" /* yacc.c:1646 */
+ case 158:
+#line 1644 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3554 "awkgram.c" /* yacc.c:1646 */
+#line 3733 "awkgram.c" /* yacc.c:1646 */
break;
- case 145:
-#line 1555 "awkgram.y" /* yacc.c:1646 */
+ case 159:
+#line 1646 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3560 "awkgram.c" /* yacc.c:1646 */
+#line 3739 "awkgram.c" /* yacc.c:1646 */
break;
- case 146:
-#line 1557 "awkgram.y" /* yacc.c:1646 */
+ case 160:
+#line 1648 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3566 "awkgram.c" /* yacc.c:1646 */
+#line 3745 "awkgram.c" /* yacc.c:1646 */
break;
- case 147:
-#line 1562 "awkgram.y" /* yacc.c:1646 */
+ case 161:
+#line 1653 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_create((yyvsp[0]));
}
-#line 3574 "awkgram.c" /* yacc.c:1646 */
+#line 3753 "awkgram.c" /* yacc.c:1646 */
break;
- case 148:
-#line 1566 "awkgram.y" /* yacc.c:1646 */
+ case 162:
+#line 1657 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0])->opcode == Op_match_rec) {
(yyvsp[0])->opcode = Op_nomatch;
@@ -3606,37 +3785,37 @@ regular_print:
}
}
}
-#line 3610 "awkgram.c" /* yacc.c:1646 */
+#line 3789 "awkgram.c" /* yacc.c:1646 */
break;
- case 149:
-#line 1598 "awkgram.y" /* yacc.c:1646 */
+ case 163:
+#line 1689 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3616 "awkgram.c" /* yacc.c:1646 */
+#line 3795 "awkgram.c" /* yacc.c:1646 */
break;
- case 150:
-#line 1600 "awkgram.y" /* yacc.c:1646 */
+ case 164:
+#line 1691 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = snode((yyvsp[-1]), (yyvsp[-3]));
if ((yyval) == NULL)
YYABORT;
}
-#line 3626 "awkgram.c" /* yacc.c:1646 */
+#line 3805 "awkgram.c" /* yacc.c:1646 */
break;
- case 151:
-#line 1606 "awkgram.y" /* yacc.c:1646 */
+ case 165:
+#line 1697 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = snode((yyvsp[-1]), (yyvsp[-3]));
if ((yyval) == NULL)
YYABORT;
}
-#line 3636 "awkgram.c" /* yacc.c:1646 */
+#line 3815 "awkgram.c" /* yacc.c:1646 */
break;
- case 152:
-#line 1612 "awkgram.y" /* yacc.c:1646 */
+ case 166:
+#line 1703 "awkgram.y" /* yacc.c:1646 */
{
static bool warned = false;
@@ -3649,45 +3828,45 @@ regular_print:
if ((yyval) == NULL)
YYABORT;
}
-#line 3653 "awkgram.c" /* yacc.c:1646 */
+#line 3832 "awkgram.c" /* yacc.c:1646 */
break;
- case 155:
-#line 1627 "awkgram.y" /* yacc.c:1646 */
+ case 169:
+#line 1718 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[-1])->opcode = Op_preincrement;
(yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1]));
}
-#line 3662 "awkgram.c" /* yacc.c:1646 */
+#line 3841 "awkgram.c" /* yacc.c:1646 */
break;
- case 156:
-#line 1632 "awkgram.y" /* yacc.c:1646 */
+ case 170:
+#line 1723 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[-1])->opcode = Op_predecrement;
(yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1]));
}
-#line 3671 "awkgram.c" /* yacc.c:1646 */
+#line 3850 "awkgram.c" /* yacc.c:1646 */
break;
- case 157:
-#line 1637 "awkgram.y" /* yacc.c:1646 */
+ case 171:
+#line 1728 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_create((yyvsp[0]));
}
-#line 3679 "awkgram.c" /* yacc.c:1646 */
+#line 3858 "awkgram.c" /* yacc.c:1646 */
break;
- case 158:
-#line 1641 "awkgram.y" /* yacc.c:1646 */
+ case 172:
+#line 1732 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_create((yyvsp[0]));
}
-#line 3687 "awkgram.c" /* yacc.c:1646 */
+#line 3866 "awkgram.c" /* yacc.c:1646 */
break;
- case 159:
-#line 1645 "awkgram.y" /* yacc.c:1646 */
+ case 173:
+#line 1736 "awkgram.y" /* yacc.c:1646 */
{
if ((yyvsp[0])->lasti->opcode == Op_push_i
&& ((yyvsp[0])->lasti->memory->flags & (STRCUR|STRING)) == 0
@@ -3702,11 +3881,11 @@ regular_print:
(yyval) = list_append((yyvsp[0]), (yyvsp[-1]));
}
}
-#line 3706 "awkgram.c" /* yacc.c:1646 */
+#line 3885 "awkgram.c" /* yacc.c:1646 */
break;
- case 160:
-#line 1660 "awkgram.y" /* yacc.c:1646 */
+ case 174:
+#line 1751 "awkgram.y" /* yacc.c:1646 */
{
/*
* was: $$ = $2
@@ -3716,20 +3895,20 @@ regular_print:
(yyvsp[-1])->memory = make_number(0.0);
(yyval) = list_append((yyvsp[0]), (yyvsp[-1]));
}
-#line 3720 "awkgram.c" /* yacc.c:1646 */
+#line 3899 "awkgram.c" /* yacc.c:1646 */
break;
- case 161:
-#line 1673 "awkgram.y" /* yacc.c:1646 */
+ case 175:
+#line 1764 "awkgram.y" /* yacc.c:1646 */
{
func_use((yyvsp[0])->lasti->func_name, FUNC_USE);
(yyval) = (yyvsp[0]);
}
-#line 3729 "awkgram.c" /* yacc.c:1646 */
+#line 3908 "awkgram.c" /* yacc.c:1646 */
break;
- case 162:
-#line 1678 "awkgram.y" /* yacc.c:1646 */
+ case 176:
+#line 1769 "awkgram.y" /* yacc.c:1646 */
{
/* indirect function call */
INSTRUCTION *f, *t;
@@ -3763,11 +3942,11 @@ regular_print:
(yyval) = list_prepend((yyvsp[0]), t);
at_seen = false;
}
-#line 3767 "awkgram.c" /* yacc.c:1646 */
+#line 3946 "awkgram.c" /* yacc.c:1646 */
break;
- case 163:
-#line 1715 "awkgram.y" /* yacc.c:1646 */
+ case 177:
+#line 1806 "awkgram.y" /* yacc.c:1646 */
{
NODE *n;
@@ -3792,49 +3971,49 @@ regular_print:
(yyval) = list_append(t, (yyvsp[-3]));
}
}
-#line 3796 "awkgram.c" /* yacc.c:1646 */
+#line 3975 "awkgram.c" /* yacc.c:1646 */
break;
- case 164:
-#line 1743 "awkgram.y" /* yacc.c:1646 */
+ case 178:
+#line 1834 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3802 "awkgram.c" /* yacc.c:1646 */
+#line 3981 "awkgram.c" /* yacc.c:1646 */
break;
- case 165:
-#line 1745 "awkgram.y" /* yacc.c:1646 */
+ case 179:
+#line 1836 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3808 "awkgram.c" /* yacc.c:1646 */
+#line 3987 "awkgram.c" /* yacc.c:1646 */
break;
- case 166:
-#line 1750 "awkgram.y" /* yacc.c:1646 */
+ case 180:
+#line 1841 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3814 "awkgram.c" /* yacc.c:1646 */
+#line 3993 "awkgram.c" /* yacc.c:1646 */
break;
- case 167:
-#line 1752 "awkgram.y" /* yacc.c:1646 */
+ case 181:
+#line 1843 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3820 "awkgram.c" /* yacc.c:1646 */
+#line 3999 "awkgram.c" /* yacc.c:1646 */
break;
- case 168:
-#line 1757 "awkgram.y" /* yacc.c:1646 */
+ case 182:
+#line 1848 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3826 "awkgram.c" /* yacc.c:1646 */
+#line 4005 "awkgram.c" /* yacc.c:1646 */
break;
- case 169:
-#line 1759 "awkgram.y" /* yacc.c:1646 */
+ case 183:
+#line 1850 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
}
-#line 3834 "awkgram.c" /* yacc.c:1646 */
+#line 4013 "awkgram.c" /* yacc.c:1646 */
break;
- case 170:
-#line 1766 "awkgram.y" /* yacc.c:1646 */
+ case 184:
+#line 1857 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip = (yyvsp[0])->lasti;
int count = ip->sub_count; /* # of SUBSEP-seperated expressions */
@@ -3848,11 +4027,11 @@ regular_print:
sub_counter++; /* count # of dimensions */
(yyval) = (yyvsp[0]);
}
-#line 3852 "awkgram.c" /* yacc.c:1646 */
+#line 4031 "awkgram.c" /* yacc.c:1646 */
break;
- case 171:
-#line 1783 "awkgram.y" /* yacc.c:1646 */
+ case 185:
+#line 1874 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *t = (yyvsp[-1]);
if ((yyvsp[-1]) == NULL) {
@@ -3866,31 +4045,31 @@ regular_print:
(yyvsp[0])->sub_count = count_expressions(&t, false);
(yyval) = list_append(t, (yyvsp[0]));
}
-#line 3870 "awkgram.c" /* yacc.c:1646 */
+#line 4049 "awkgram.c" /* yacc.c:1646 */
break;
- case 172:
-#line 1800 "awkgram.y" /* yacc.c:1646 */
+ case 186:
+#line 1891 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 3876 "awkgram.c" /* yacc.c:1646 */
+#line 4055 "awkgram.c" /* yacc.c:1646 */
break;
- case 173:
-#line 1802 "awkgram.y" /* yacc.c:1646 */
+ case 187:
+#line 1893 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
}
-#line 3884 "awkgram.c" /* yacc.c:1646 */
+#line 4063 "awkgram.c" /* yacc.c:1646 */
break;
- case 174:
-#line 1809 "awkgram.y" /* yacc.c:1646 */
+ case 188:
+#line 1900 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 3890 "awkgram.c" /* yacc.c:1646 */
+#line 4069 "awkgram.c" /* yacc.c:1646 */
break;
- case 175:
-#line 1814 "awkgram.y" /* yacc.c:1646 */
+ case 189:
+#line 1905 "awkgram.y" /* yacc.c:1646 */
{
char *var_name = (yyvsp[0])->lextok;
@@ -3898,22 +4077,22 @@ regular_print:
(yyvsp[0])->memory = variable((yyvsp[0])->source_line, var_name, Node_var_new);
(yyval) = list_create((yyvsp[0]));
}
-#line 3902 "awkgram.c" /* yacc.c:1646 */
+#line 4081 "awkgram.c" /* yacc.c:1646 */
break;
- case 176:
-#line 1822 "awkgram.y" /* yacc.c:1646 */
+ case 190:
+#line 1913 "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 3913 "awkgram.c" /* yacc.c:1646 */
+#line 4092 "awkgram.c" /* yacc.c:1646 */
break;
- case 177:
-#line 1832 "awkgram.y" /* yacc.c:1646 */
+ case 191:
+#line 1923 "awkgram.y" /* yacc.c:1646 */
{
INSTRUCTION *ip = (yyvsp[0])->nexti;
if (ip->opcode == Op_push
@@ -3925,73 +4104,73 @@ regular_print:
} else
(yyval) = (yyvsp[0]);
}
-#line 3929 "awkgram.c" /* yacc.c:1646 */
+#line 4108 "awkgram.c" /* yacc.c:1646 */
break;
- case 178:
-#line 1844 "awkgram.y" /* yacc.c:1646 */
+ case 192:
+#line 1935 "awkgram.y" /* yacc.c:1646 */
{
(yyval) = list_append((yyvsp[-1]), (yyvsp[-2]));
if ((yyvsp[0]) != NULL)
mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
}
-#line 3939 "awkgram.c" /* yacc.c:1646 */
+#line 4118 "awkgram.c" /* yacc.c:1646 */
break;
- case 179:
-#line 1853 "awkgram.y" /* yacc.c:1646 */
+ case 193:
+#line 1944 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postincrement;
}
-#line 3947 "awkgram.c" /* yacc.c:1646 */
+#line 4126 "awkgram.c" /* yacc.c:1646 */
break;
- case 180:
-#line 1857 "awkgram.y" /* yacc.c:1646 */
+ case 194:
+#line 1948 "awkgram.y" /* yacc.c:1646 */
{
(yyvsp[0])->opcode = Op_postdecrement;
}
-#line 3955 "awkgram.c" /* yacc.c:1646 */
+#line 4134 "awkgram.c" /* yacc.c:1646 */
break;
- case 181:
-#line 1860 "awkgram.y" /* yacc.c:1646 */
+ case 195:
+#line 1951 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 3961 "awkgram.c" /* yacc.c:1646 */
+#line 4140 "awkgram.c" /* yacc.c:1646 */
break;
- case 183:
-#line 1868 "awkgram.y" /* yacc.c:1646 */
+ case 197:
+#line 1959 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 3967 "awkgram.c" /* yacc.c:1646 */
+#line 4146 "awkgram.c" /* yacc.c:1646 */
break;
- case 184:
-#line 1872 "awkgram.y" /* yacc.c:1646 */
+ case 198:
+#line 1963 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 3973 "awkgram.c" /* yacc.c:1646 */
+#line 4152 "awkgram.c" /* yacc.c:1646 */
break;
- case 187:
-#line 1881 "awkgram.y" /* yacc.c:1646 */
+ case 201:
+#line 1972 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 3979 "awkgram.c" /* yacc.c:1646 */
+#line 4158 "awkgram.c" /* yacc.c:1646 */
break;
- case 188:
-#line 1885 "awkgram.y" /* yacc.c:1646 */
+ case 202:
+#line 1976 "awkgram.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); yyerrok; }
-#line 3985 "awkgram.c" /* yacc.c:1646 */
+#line 4164 "awkgram.c" /* yacc.c:1646 */
break;
- case 189:
-#line 1889 "awkgram.y" /* yacc.c:1646 */
+ case 203:
+#line 1980 "awkgram.y" /* yacc.c:1646 */
{ yyerrok; }
-#line 3991 "awkgram.c" /* yacc.c:1646 */
+#line 4170 "awkgram.c" /* yacc.c:1646 */
break;
-#line 3995 "awkgram.c" /* yacc.c:1646 */
+#line 4174 "awkgram.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -4219,7 +4398,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 1891 "awkgram.y" /* yacc.c:1906 */
+#line 1982 "awkgram.y" /* yacc.c:1906 */
struct token {
@@ -4345,6 +4524,7 @@ static const struct token tokentab[] = {
{"systime", Op_builtin, LEX_BUILTIN, GAWKX|A(0), do_systime, 0},
{"tolower", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_tolower, 0},
{"toupper", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_toupper, 0},
+{"typeof", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_typeof, 0},
{"while", Op_K_while, LEX_WHILE, BREAK|CONTINUE, 0, 0},
{"xor", Op_builtin, LEX_BUILTIN, GAWKX, do_xor, MPF(xor)},
};
@@ -5515,6 +5695,7 @@ yylex(void)
bool inhex = false;
bool intlstr = false;
AWKNUM d;
+ bool collecting_typed_regexp = false;
#define GET_INSTRUCTION(op) bcalloc(op, 1, sourceline)
@@ -5549,6 +5730,7 @@ yylex(void)
lexeme = lexptr;
thisline = NULL;
+collect_regexp:
if (want_regexp) {
int in_brack = 0; /* count brackets, [[:alnum:]] allowed */
int b_index = -1;
@@ -5635,7 +5817,13 @@ end_regexp:
peek);
}
}
- return lasttok = REGEXP;
+ if (collecting_typed_regexp) {
+ collecting_typed_regexp = false;
+ lasttok = TYPED_REGEXP;
+ } else
+ lasttok = REGEXP;
+
+ return lasttok;
case '\n':
pushback();
yyerror(_("unterminated regexp"));
@@ -5693,6 +5881,13 @@ retry:
return lasttok = NEWLINE;
case '@':
+ c = nextc(true);
+ if (c == '/') {
+ want_regexp = true;
+ collecting_typed_regexp = true;
+ goto collect_regexp;
+ }
+ pushback();
at_seen = true;
return lasttok = '@';
@@ -6502,7 +6697,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push)
arg->nexti->opcode = Op_push_arg; /* argument may be array */
}
- } else if (r->builtin == do_isarray) {
+ } else if (r->builtin == do_isarray || r->builtin == do_typeof) {
arg = subn->nexti;
if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push)
arg->nexti->opcode = Op_push_arg; /* argument may be array */
@@ -7084,7 +7279,7 @@ make_regnode(int type, NODE *exp)
n->type = type;
n->re_cnt = 1;
- if (type == Node_regex) {
+ if (type == Node_regex || type == Node_typedregex) {
n->re_reg = make_regexp(exp->stptr, exp->stlen, false, true, false);
if (n->re_reg == NULL) {
freenode(n);
@@ -7107,6 +7302,8 @@ mk_rexp(INSTRUCTION *list)
ip = list->nexti;
if (ip == list->lasti && ip->opcode == Op_match_rec)
ip->opcode = Op_push_re;
+ else if (ip == list->lasti && ip->opcode == Op_push_re)
+ ; /* do nothing --- @/.../ */
else {
ip = instruction(Op_push_re);
ip->memory = make_regnode(Node_dynregex, NULL);
diff --git a/awkgram.y b/awkgram.y
index 71646008..28541f86 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -169,7 +169,7 @@ extern double fmod(double x, double y);
%}
%token FUNC_CALL NAME REGEXP FILENAME
-%token YNUMBER YSTRING
+%token YNUMBER YSTRING TYPED_REGEXP
%token RELOP IO_OUT IO_IN
%token ASSIGNOP ASSIGN MATCHOP CONCAT_OP
%token SUBSCRIPT
@@ -197,7 +197,7 @@ extern double fmod(double x, double y);
%left MATCHOP
%nonassoc RELOP '<' '>' IO_IN IO_OUT
%left CONCAT_OP
-%left YSTRING YNUMBER
+%left YSTRING YNUMBER TYPED_REGEXP
%left '+' '-'
%left '*' '/' '%'
%right '!' UNARY
@@ -498,6 +498,28 @@ regexp
}
;
+typed_regexp
+ : TYPED_REGEXP
+ {
+ NODE *n, *exp;
+ char *re;
+ size_t len;
+
+ re = $1->lextok;
+ $1->lextok = NULL;
+ len = strlen(re);
+
+ exp = make_str_node(re, len, ALREADY_MALLOCED);
+ n = make_regnode(Node_typedregex, exp);
+ if (n == NULL) {
+ unref(exp);
+ YYABORT;
+ }
+ $$ = $1;
+ $$->opcode = Op_push_re;
+ $$->memory = n;
+ }
+
a_slash
: '/'
{ bcfree($1); }
@@ -1193,6 +1215,15 @@ case_value
{ $$ = $1; }
| regexp
{
+ if ($1->memory->type == Node_regex)
+ $1->opcode = Op_push_re;
+ else
+ $1->opcode = Op_push;
+ $$ = $1;
+ }
+ | typed_regexp
+ {
+ assert($1->memory->type == Node_typedregex);
$1->opcode = Op_push_re;
$$ = $1;
}
@@ -1341,6 +1372,48 @@ expression_list
}
;
+opt_fcall_expression_list
+ : /* empty */
+ { $$ = NULL; }
+ | fcall_expression_list
+ { $$ = $1; }
+ ;
+
+fcall_expression_list
+ : fcall_exp
+ { $$ = mk_expression_list(NULL, $1); }
+ | fcall_expression_list comma fcall_exp
+ {
+ $$ = mk_expression_list($1, $3);
+ yyerrok;
+ }
+ | error
+ { $$ = NULL; }
+ | fcall_expression_list error
+ {
+ /*
+ * Returning the expression list instead of NULL lets
+ * snode get a list of arguments that it can count.
+ */
+ $$ = $1;
+ }
+ | fcall_expression_list error fcall_exp
+ {
+ /* Ditto */
+ $$ = mk_expression_list($1, $3);
+ }
+ | fcall_expression_list comma error
+ {
+ /* Ditto */
+ $$ = $1;
+ }
+ ;
+
+fcall_exp
+ : exp { $$ = $1; }
+ | typed_regexp { $$ = list_create($1); }
+ ;
+
/* Expressions, not including the comma operator. */
exp
: variable assign_operator exp %prec ASSIGNOP
@@ -1350,10 +1423,27 @@ exp
_("regular expression on right of assignment"));
$$ = mk_assignment($1, $3, $2);
}
+ | variable ASSIGN typed_regexp %prec ASSIGNOP
+ {
+ $$ = mk_assignment($1, list_create($3), $2);
+ }
| exp LEX_AND exp
{ $$ = mk_boolean($1, $3, $2); }
| exp LEX_OR exp
{ $$ = mk_boolean($1, $3, $2); }
+ | exp MATCHOP typed_regexp
+ {
+ if ($1->lasti->opcode == Op_match_rec)
+ warning_ln($2->source_line,
+ _("regular expression on left of `~' or `!~' operator"));
+
+ assert($3->opcode == Op_push_re
+ && $3->memory->type == Node_typedregex);
+ /* RHS is @/.../ */
+ $2->memory = $3->memory;
+ bcfree($3);
+ $$ = list_append($1, $2);
+ }
| exp MATCHOP exp
{
if ($1->lasti->opcode == Op_match_rec)
@@ -1361,6 +1451,7 @@ exp
_("regular expression on left of `~' or `!~' operator"));
if ($3->lasti == $3->nexti && $3->nexti->opcode == Op_match_rec) {
+ /* RHS is /.../ */
$2->memory = $3->nexti->memory;
bcfree($3->nexti); /* Op_match_rec */
bcfree($3); /* Op_list */
@@ -1596,13 +1687,13 @@ non_post_simp_exp
}
| '(' exp r_paren
{ $$ = $2; }
- | LEX_BUILTIN '(' opt_expression_list r_paren
+ | LEX_BUILTIN '(' opt_fcall_expression_list r_paren
{
$$ = snode($3, $1);
if ($$ == NULL)
YYABORT;
}
- | LEX_LENGTH '(' opt_expression_list r_paren
+ | LEX_LENGTH '(' opt_fcall_expression_list r_paren
{
$$ = snode($3, $1);
if ($$ == NULL)
@@ -1711,7 +1802,7 @@ func_call
;
direct_func_call
- : FUNC_CALL '(' opt_expression_list r_paren
+ : FUNC_CALL '(' opt_fcall_expression_list r_paren
{
NODE *n;
@@ -2013,6 +2104,7 @@ static const struct token tokentab[] = {
{"systime", Op_builtin, LEX_BUILTIN, GAWKX|A(0), do_systime, 0},
{"tolower", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_tolower, 0},
{"toupper", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_toupper, 0},
+{"typeof", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_typeof, 0},
{"while", Op_K_while, LEX_WHILE, BREAK|CONTINUE, 0, 0},
{"xor", Op_builtin, LEX_BUILTIN, GAWKX, do_xor, MPF(xor)},
};
@@ -3183,6 +3275,7 @@ yylex(void)
bool inhex = false;
bool intlstr = false;
AWKNUM d;
+ bool collecting_typed_regexp = false;
#define GET_INSTRUCTION(op) bcalloc(op, 1, sourceline)
@@ -3217,6 +3310,7 @@ yylex(void)
lexeme = lexptr;
thisline = NULL;
+collect_regexp:
if (want_regexp) {
int in_brack = 0; /* count brackets, [[:alnum:]] allowed */
int b_index = -1;
@@ -3303,7 +3397,13 @@ end_regexp:
peek);
}
}
- return lasttok = REGEXP;
+ if (collecting_typed_regexp) {
+ collecting_typed_regexp = false;
+ lasttok = TYPED_REGEXP;
+ } else
+ lasttok = REGEXP;
+
+ return lasttok;
case '\n':
pushback();
yyerror(_("unterminated regexp"));
@@ -3361,6 +3461,13 @@ retry:
return lasttok = NEWLINE;
case '@':
+ c = nextc(true);
+ if (c == '/') {
+ want_regexp = true;
+ collecting_typed_regexp = true;
+ goto collect_regexp;
+ }
+ pushback();
at_seen = true;
return lasttok = '@';
@@ -4170,7 +4277,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push)
arg->nexti->opcode = Op_push_arg; /* argument may be array */
}
- } else if (r->builtin == do_isarray) {
+ } else if (r->builtin == do_isarray || r->builtin == do_typeof) {
arg = subn->nexti;
if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push)
arg->nexti->opcode = Op_push_arg; /* argument may be array */
@@ -4752,7 +4859,7 @@ make_regnode(int type, NODE *exp)
n->type = type;
n->re_cnt = 1;
- if (type == Node_regex) {
+ if (type == Node_regex || type == Node_typedregex) {
n->re_reg = make_regexp(exp->stptr, exp->stlen, false, true, false);
if (n->re_reg == NULL) {
freenode(n);
@@ -4775,6 +4882,8 @@ mk_rexp(INSTRUCTION *list)
ip = list->nexti;
if (ip == list->lasti && ip->opcode == Op_match_rec)
ip->opcode = Op_push_re;
+ else if (ip == list->lasti && ip->opcode == Op_push_re)
+ ; /* do nothing --- @/.../ */
else {
ip = instruction(Op_push_re);
ip->memory = make_regnode(Node_dynregex, NULL);
diff --git a/awklib/ChangeLog b/awklib/ChangeLog
index f0e82f5b..791c25f6 100644
--- a/awklib/ChangeLog
+++ b/awklib/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-19 Arnold D. Robbins <arnold@skeeve.com>
+
+ * extract.awk: Sync with current version in the doc. Thanks to
+ Antonio Columbo for pointing this out.
+
2015-05-19 Arnold D. Robbins <arnold@skeeve.com>
* 4.1.3: Release tar ball made.
diff --git a/awklib/eg/lib/inplace.awk b/awklib/eg/lib/inplace.awk
index d1574654..15a83f58 100644
--- a/awklib/eg/lib/inplace.awk
+++ b/awklib/eg/lib/inplace.awk
@@ -5,15 +5,29 @@
# Please set INPLACE_SUFFIX to make a backup copy. For example, you may
# want to set INPLACE_SUFFIX to .bak on the command line or in a BEGIN rule.
+# By default, each filename on the command line will be edited inplace.
+# But you can selectively disable this by adding an inplace=0 argument
+# prior to files that you do not want to process this way. You can then
+# reenable it later on the commandline by putting inplace=1 before files
+# that you wish to be subject to inplace editing.
+
# N.B. We call inplace_end() in the BEGINFILE and END rules so that any
# actions in an ENDFILE rule will be redirected as expected.
+BEGIN {
+ inplace = 1 # enabled by default
+}
+
BEGINFILE {
if (_inplace_filename != "")
inplace_end(_inplace_filename, INPLACE_SUFFIX)
- inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX)
+ if (inplace)
+ inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX)
+ else
+ _inplace_filename = ""
}
END {
- inplace_end(FILENAME, INPLACE_SUFFIX)
+ if (_inplace_filename != "")
+ inplace_end(_inplace_filename, INPLACE_SUFFIX)
}
diff --git a/awklib/eg/network/coreserv.awk b/awklib/eg/network/coreserv.awk
index 348568e0..a5c8b1ed 100644
--- a/awklib/eg/network/coreserv.awk
+++ b/awklib/eg/network/coreserv.awk
@@ -1,7 +1,7 @@
# CGI Library and core of a web server
#
# Juergen Kahrs, Juergen.Kahrs@vr-web.de
-# with Arnold Robbins, arnold@gnu.org
+# with Arnold Robbins, arnold@skeeve.com
# September 2000
# Global arrays
diff --git a/awklib/extract.awk b/awklib/extract.awk
index 1b052e73..2662574b 100644
--- a/awklib/extract.awk
+++ b/awklib/extract.awk
@@ -1,16 +1,14 @@
-# extract.awk --- extract files and run programs
-# from texinfo files
+# extract.awk --- extract files and run programs from Texinfo files
#
-# Arnold Robbins, arnold@gnu.org, Public Domain
+# Arnold Robbins, arnold@skeeve.com, Public Domain
# May 1993
# Revised September 2000
BEGIN { IGNORECASE = 1 }
-/^@c(omment)?[ \t]+system/ \
-{
+/^@c(omment)?[ \t]+system/ {
if (NF < 3) {
- e = (FILENAME ":" FNR)
+ e = ("extract: " FILENAME ":" FNR)
e = (e ": badly formed `system' line")
print e > "/dev/stderr"
next
@@ -19,15 +17,14 @@ BEGIN { IGNORECASE = 1 }
$2 = ""
stat = system($0)
if (stat != 0) {
- e = (FILENAME ":" FNR)
+ e = ("extract: " FILENAME ":" FNR)
e = (e ": warning: system returned " stat)
print e > "/dev/stderr"
}
}
-/^@c(omment)?[ \t]+file/ \
-{
+/^@c(omment)?[ \t]+file/ {
if (NF != 3) {
- e = (FILENAME ":" FNR ": badly formed `file' line")
+ e = ("extract: " FILENAME ":" FNR ": badly formed `file' line")
print e > "/dev/stderr"
next
}
@@ -65,8 +62,8 @@ BEGIN { IGNORECASE = 1 }
}
function unexpected_eof()
{
- printf("%s:%d: unexpected EOF or error\n",
- FILENAME, FNR) > "/dev/stderr"
+ printf("extract: %s:%d: unexpected EOF or error\n",
+ FILENAME, FNR) > "/dev/stderr"
exit 1
}
diff --git a/builtin.c b/builtin.c
index a9733597..61a4398b 100644
--- a/builtin.c
+++ b/builtin.c
@@ -481,6 +481,12 @@ do_isarray(int nargs)
{
NODE *tmp;
int ret = 1;
+ static bool warned = false;
+
+ if (do_lint && ! warned) {
+ warned = true;
+ lintwarn(_("`isarray' is deprecated. Use `typeof' instead"));
+ }
tmp = POP();
if (tmp->type != Node_var_array) {
@@ -3139,7 +3145,8 @@ call_sub(const char *name, int nargs)
* push replace
* push $0
*/
- regex = make_regnode(Node_regex, regex);
+ if (regex->type != Node_typedregex)
+ regex = make_regnode(Node_regex, regex);
PUSH(regex);
PUSH(replace);
lhs = r_get_field(zero, (Func_ptr *) 0, true);
@@ -3163,7 +3170,8 @@ call_sub(const char *name, int nargs)
* nargs++
* }
*/
- regex = make_regnode(Node_regex, regex);
+ if (regex->type != Node_typedregex)
+ regex = make_regnode(Node_regex, regex);
PUSH(regex);
PUSH(replace);
PUSH(glob_flag);
@@ -3200,7 +3208,8 @@ call_match(int nargs)
/* Don't need to pop the string just to push it back ... */
- regex = make_regnode(Node_regex, regex);
+ if (regex->type != Node_typedregex)
+ regex = make_regnode(Node_regex, regex);
PUSH(regex);
if (array)
@@ -3228,7 +3237,8 @@ call_split_func(const char *name, int nargs)
if (nargs >= 3) {
regex = POP_STRING();
- regex = make_regnode(Node_regex, regex);
+ if (regex->type != Node_typedregex)
+ regex = make_regnode(Node_regex, regex);
} else {
if (name[0] == 's') {
regex = make_regnode(Node_regex, FS_node->var_value);
@@ -3855,6 +3865,44 @@ do_intdiv(int nargs)
return make_number((AWKNUM) 0.0);
}
+/* do_typeof --- return a string with the type of the arg */
+
+NODE *
+do_typeof(int nargs)
+{
+ NODE *arg;
+ char *res = "unknown";
+ int null_str_flags = (STRCUR|STRING|NUMCUR|NUMBER);
+
+ arg = POP();
+ switch (arg->type) {
+ case Node_var_array:
+ res = "array";
+ break;
+ case Node_typedregex:
+ res = "regexp";
+ break;
+ case Node_val:
+ case Node_var:
+ if ((arg->flags & null_str_flags) == null_str_flags)
+ res = "untyped";
+ else if ((arg->flags & STRING) != 0)
+ res = "scalar_s";
+ else if ((arg->flags & NUMBER) != 0)
+ res = "scalar_n";
+ break;
+ case Node_var_new:
+ res = "untyped";
+ break;
+ default:
+ fatal(_("typeof: unknown argument type `%s'"),
+ nodetype2str(arg->type));
+ break;
+ }
+
+ DEREF(arg);
+ return make_string(res, strlen(res));
+}
/* mbc_byte_count --- return number of bytes for corresponding numchars multibyte characters */
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 1a0a265f..8c0f151d 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,17 @@
+2015-06-19 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawkinet.info: Fix an old arnold@gnu.org.
+
+2015-06-17 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * gawktexi.in: Document inplace shortcomings -- it does not preserve
+ ACLs, and it may leave temporary files behind if killed by a signal.
+
+2015-06-17 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * gawktexi.in: Document new inplace variable to control whether
+ inplace editing is active.
+
2015-06-13 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in: Comment out exercise 10.3, since the answer
@@ -49,6 +63,16 @@
* gawktexi.in (Bugs): Add that email should be in plain
text and not in HTML. Sigh.
+2015-05-11 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Add doc on conversions for strongly typed
+ regexp variables.
+
+2015-05-03 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Add initial documentation for strongly typed
+ regexps and for `typeof'.
+
2015-04-29 Arnold D. Robbins <arnold@skeeve.com>
* 4.1.2: Release tar ball made.
diff --git a/doc/gawk.info b/doc/gawk.info
index bd325521..6d6def4f 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -175,6 +175,7 @@ in (a) below. A copy of the license is included in the section entitled
* Computed Regexps:: Using Dynamic Regexps.
* GNU Regexp Operators:: Operators specific to GNU software.
* Case-sensitivity:: How to do case-insensitive matching.
+* Strong Regexp Constants:: Strongly typed regexp constants.
* Regexp Summary:: Regular expressions summary.
* Records:: Controlling how data is split into
records.
@@ -3311,6 +3312,7 @@ you specify more complicated classes of strings.
* Computed Regexps:: Using Dynamic Regexps.
* GNU Regexp Operators:: Operators specific to GNU software.
* Case-sensitivity:: How to do case-insensitive matching.
+* Strong Regexp Constants:: Strongly typed regexp constants.
* Regexp Summary:: Regular expressions summary.

@@ -4013,7 +4015,7 @@ No options
default.

-File: gawk.info, Node: Case-sensitivity, Next: Regexp Summary, Prev: GNU Regexp Operators, Up: Regexp
+File: gawk.info, Node: Case-sensitivity, Next: Strong Regexp Constants, Prev: GNU Regexp Operators, Up: Regexp
3.8 Case Sensitivity in Matching
================================
@@ -4087,10 +4089,77 @@ and we don't recommend it.
that 'gawk' does the right thing.

-File: gawk.info, Node: Regexp Summary, Prev: Case-sensitivity, Up: Regexp
+File: gawk.info, Node: Strong Regexp Constants, Next: Regexp Summary, Prev: Case-sensitivity, Up: Regexp
-3.9 Summary
-===========
+3.9 Strongly Typed Regexp Constants
+===================================
+
+This minor node describes a 'gawk'-specific feature.
+
+ Regexp constants ('/.../') hold a strange position in the 'awk'
+language. In most contexts, they act like an expression: '$0 ~ /.../'.
+In other contexts, they denote only a regexp to be matched. In no case
+are they really a "first class citizen" of the language. That is, you
+cannot define a scalar variable whose type is "regexp" in the same sense
+that you can define a variable to be a number or a string:
+
+ num = 42 Numeric variable
+ str = "hi" String variable
+ re = /foo/ Wrong! re is the result of $0 ~ /foo/
+
+ For a number of more advanced use cases (described later on in this
+Info file), it would be nice to have regexp constants that are "strongly
+typed"; in other words, that denote a regexp useful for matching, and
+not an expression.
+
+ 'gawk' provides this feature. A strongly typed regexp constant looks
+almost like a regular regexp constant, except that it is preceded by an
+'@' sign:
+
+ re = @/foo/ Regexp variable
+
+ Strongly typed regexp constants _cannot_ be used eveywhere that a
+regular regexp constant can, because this would make the language even
+more confusing. Instead, you may use them only in certain contexts:
+
+ * On the righthand side of the '~' and '!~' operators: 'some_var ~
+ @/foo/' (*note Regexp Usage::).
+
+ * In the 'case' part of a 'switch' statement (*note Switch
+ Statement::).
+
+ * As an argument to one of the built-in functions that accept regexp
+ constants: 'gensub()', 'gsub()', 'match()', 'patsplit()',
+ 'split()', and 'sub()' (*note String Functions::).
+
+ * As a parameter in a call to a user-defined function (*note
+ User-defined::).
+
+ * On the righthand side of an assignment to a variable: 'some_var =
+ @/foo/'. In this case, the type of 'some_var' is regexp.
+ Additionally, 'some_var' can be used with '~' and '!~', passed to
+ one of the built-in functions listed above, or passed as a
+ parameter to a user-defined function.
+
+ You may use the 'typeof()' built-in function (*note Type Functions::)
+to determine if a variable or function parameter is a regexp variable.
+
+ The true power of this feature comes from the ability to create
+variables that have regexp type. Such variables can be passed on to
+user-defined functions, without the confusing aspects of computed
+regular expressions created from strings or string constants. They may
+also be passed through indirect function calls (*note Indirect Calls::)
+onto the built-in functions that accept regexp constants.
+
+ When used in numeric conversions, strongly typed regexp variables
+convert to zero. When used in string conversions, they convert to the
+string value of the original regexp text.
+
+
+File: gawk.info, Node: Regexp Summary, Prev: Strong Regexp Constants, Up: Regexp
+
+3.10 Summary
+============
* Regular expressions describe sets of strings to be matched. In
'awk', regular expression constants are written enclosed between
@@ -4123,6 +4192,9 @@ File: gawk.info, Node: Regexp Summary, Prev: Case-sensitivity, Up: Regexp
sensitivity of regexp matching. In other 'awk' versions, use
'tolower()' or 'toupper()'.
+ * Strongly typed regexp constants ('@/.../') enable certain advanced
+ use cases to be described later on in the Info file.
+

File: gawk.info, Node: Reading Files, Next: Printing, Prev: Regexp, Up: Top
@@ -13426,14 +13498,33 @@ File: gawk.info, Node: Type Functions, Next: I18N Functions, Prev: Bitwise Fu
9.1.7 Getting Type Information
------------------------------
-'gawk' provides a single function that lets you distinguish an array
-from a scalar variable. This is necessary for writing code that
-traverses every element of an array of arrays (*note Arrays of
-Arrays::).
+'gawk' provides two functions that lets you distinguish the type of a
+variable. This is necessary for writing code that traverses every
+element of an array of arrays (*note Arrays of Arrays::), and in other
+contexts.
'isarray(X)'
Return a true value if X is an array. Otherwise, return false.
+'typeof(X)'
+ Return one of the following strings, depending upon the type of X:
+
+ '"array"'
+ X is an array.
+
+ '"regexp"'
+ X is a strongly typed regexp (*note Strong Regexp
+ Constants::).
+
+ '"scalar_n"'
+ X is a number.
+
+ '"scalar_s"'
+ X is a string.
+
+ '"untyped"'
+ X has not yet been given a type.
+
'isarray()' is meant for use in two circumstances. The first is when
traversing a multidimensional array: you can test if an element is
itself an array or not. The second is inside the body of a user-defined
@@ -13447,6 +13538,14 @@ parameter is an array or not.
that has not been previously used to 'isarray()', 'gawk' ends up
turning it into a scalar.
+ The 'typeof()' function is general; it allows you to determine if a
+variable or function parameter is a scalar, an array, or a strongly
+typed regexp.
+
+ 'isarray()' is deprecated; you should use 'typeof()' instead. You
+should replace any existing uses of 'isarray(var)' in your code with
+'typeof(var) == "array"'.
+

File: gawk.info, Node: I18N Functions, Prev: Type Functions, Up: Built-in
@@ -25838,17 +25937,31 @@ The 'inplace' extension emulates GNU 'sed''s '-i' option, which performs
# Please set INPLACE_SUFFIX to make a backup copy. For example, you may
# want to set INPLACE_SUFFIX to .bak on the command line or in a BEGIN rule.
+ # By default, each filename on the command line will be edited inplace.
+ # But you can selectively disable this by adding an inplace=0 argument
+ # prior to files that you do not want to process this way. You can then
+ # reenable it later on the commandline by putting inplace=1 before files
+ # that you wish to be subject to inplace editing.
+
# N.B. We call inplace_end() in the BEGINFILE and END rules so that any
# actions in an ENDFILE rule will be redirected as expected.
+ BEGIN {
+ inplace = 1 # enabled by default
+ }
+
BEGINFILE {
if (_inplace_filename != "")
inplace_end(_inplace_filename, INPLACE_SUFFIX)
- inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX)
+ if (inplace)
+ inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX)
+ else
+ _inplace_filename = ""
}
END {
- inplace_end(FILENAME, INPLACE_SUFFIX)
+ if (_inplace_filename != "")
+ inplace_end(_inplace_filename, INPLACE_SUFFIX)
}
For each regular file that is processed, the extension redirects
@@ -25859,6 +25972,12 @@ extension restores standard output to its original destination. If
a backup file name created by appending that suffix. Finally, the
temporary file is renamed to the original file name.
+ Note that the use of this feature can be controlled by placing
+'inplace=0' on the command-line prior to listing files that should not
+be processed this way. You can reenable inplace editing by adding an
+'inplace=1' argument prior to files that should be subject to inplace
+editing.
+
The '_inplace_filename' variable serves to keep track of the current
filename so as to not invoke 'inplace_end()' before processing the first
file.
@@ -25875,6 +25994,13 @@ processing immediately without damaging the original file.
$ gawk -i inplace -v INPLACE_SUFFIX=.bak '{ gsub(/foo/, "bar") }
> { print }' file1 file2 file3
+ Please note that, while the extension does attempt to preserve
+ownership and permissions, it makes no attempt to copy the ACLs from the
+original file.
+
+ If the program dies prematurely, as might happen if an unhandled
+signal is received, a temporary file may be left behind.
+

File: gawk.info, Node: Extension Sample Ord, Next: Extension Sample Readdir, Prev: Extension Sample Inplace, Up: Extension Samples
@@ -34714,6 +34840,8 @@ Index
* trunc-mod operation: Arithmetic Ops. (line 66)
* truth values: Truth Values. (line 6)
* type conversion: Strings And Numbers. (line 21)
+* type, of variable: Type Functions. (line 14)
+* 'typeof': Type Functions. (line 14)
* 'u' debugger command (alias for 'until'): Debugger Execution Control.
(line 82)
* unassigned array elements: Reference to Elements.
@@ -34760,6 +34888,7 @@ Index
* values, numeric: Basic Data Typing. (line 13)
* values, string: Basic Data Typing. (line 13)
* variable assignments and input files: Other Arguments. (line 26)
+* variable type: Type Functions. (line 14)
* variable typing: Typing and Comparison.
(line 9)
* variables: Other Features. (line 6)
@@ -34860,561 +34989,562 @@ Index

Tag Table:
Node: Top1200
-Node: Foreword342435
-Node: Foreword446877
-Node: Preface48409
-Ref: Preface-Footnote-151281
-Ref: Preface-Footnote-251388
-Ref: Preface-Footnote-351622
-Node: History51764
-Node: Names54117
-Ref: Names-Footnote-155211
-Node: This Manual55358
-Ref: This Manual-Footnote-161840
-Node: Conventions61940
-Node: Manual History64295
-Ref: Manual History-Footnote-167291
-Ref: Manual History-Footnote-267332
-Node: How To Contribute67406
-Node: Acknowledgments68535
-Node: Getting Started73403
-Node: Running gawk75842
-Node: One-shot77032
-Node: Read Terminal78295
-Node: Long80327
-Node: Executable Scripts81840
-Ref: Executable Scripts-Footnote-184635
-Node: Comments84738
-Node: Quoting87222
-Node: DOS Quoting92740
-Node: Sample Data Files93415
-Node: Very Simple96010
-Node: Two Rules100912
-Node: More Complex102798
-Node: Statements/Lines105661
-Ref: Statements/Lines-Footnote-1110120
-Node: Other Features110385
-Node: When111322
-Ref: When-Footnote-1113076
-Node: Intro Summary113141
-Node: Invoking Gawk114025
-Node: Command Line115539
-Node: Options116337
-Ref: Options-Footnote-1131988
-Ref: Options-Footnote-2132218
-Node: Other Arguments132243
-Node: Naming Standard Input135190
-Node: Environment Variables136283
-Node: AWKPATH Variable136841
-Ref: AWKPATH Variable-Footnote-1140252
-Ref: AWKPATH Variable-Footnote-2140297
-Node: AWKLIBPATH Variable140558
-Node: Other Environment Variables141815
-Node: Exit Status145453
-Node: Include Files146130
-Node: Loading Shared Libraries149725
-Node: Obsolete151153
-Node: Undocumented151845
-Node: Invoking Summary152142
-Node: Regexp153802
-Node: Regexp Usage155256
-Node: Escape Sequences157293
-Node: Regexp Operators163526
-Ref: Regexp Operators-Footnote-1170943
-Ref: Regexp Operators-Footnote-2171090
-Node: Bracket Expressions171188
-Ref: table-char-classes173211
-Node: Leftmost Longest176157
-Node: Computed Regexps177460
-Node: GNU Regexp Operators180887
-Node: Case-sensitivity184566
-Ref: Case-sensitivity-Footnote-1187453
-Ref: Case-sensitivity-Footnote-2187688
-Node: Regexp Summary187796
-Node: Reading Files189262
-Node: Records191425
-Node: awk split records192158
-Node: gawk split records197090
-Ref: gawk split records-Footnote-1201634
-Node: Fields201671
-Node: Nonconstant Fields204412
-Ref: Nonconstant Fields-Footnote-1206648
-Node: Changing Fields206852
-Node: Field Separators212782
-Node: Default Field Splitting215480
-Node: Regexp Field Splitting216598
-Node: Single Character Fields219951
-Node: Command Line Field Separator221011
-Node: Full Line Fields224229
-Ref: Full Line Fields-Footnote-1225751
-Ref: Full Line Fields-Footnote-2225797
-Node: Field Splitting Summary225898
-Node: Constant Size227972
-Node: Splitting By Content232551
-Ref: Splitting By Content-Footnote-1236522
-Node: Multiple Line236685
-Ref: Multiple Line-Footnote-1242568
-Node: Getline242747
-Node: Plain Getline245214
-Node: Getline/Variable247853
-Node: Getline/File249002
-Node: Getline/Variable/File250388
-Ref: Getline/Variable/File-Footnote-1251992
-Node: Getline/Pipe252080
-Node: Getline/Variable/Pipe254785
-Node: Getline/Coprocess255918
-Node: Getline/Variable/Coprocess257183
-Node: Getline Notes257923
-Node: Getline Summary260718
-Ref: table-getline-variants261140
-Node: Read Timeout261888
-Ref: Read Timeout-Footnote-1265795
-Node: Retrying Input265853
-Node: Command-line directories267052
-Node: Input Summary267959
-Node: Input Exercises271131
-Node: Printing271859
-Node: Print273694
-Node: Print Examples275151
-Node: Output Separators277931
-Node: OFMT279948
-Node: Printf281304
-Node: Basic Printf282089
-Node: Control Letters283663
-Node: Format Modifiers287651
-Node: Printf Examples293666
-Node: Redirection296152
-Node: Special FD302995
-Ref: Special FD-Footnote-1306163
-Node: Special Files306237
-Node: Other Inherited Files306854
-Node: Special Network307855
-Node: Special Caveats308715
-Node: Close Files And Pipes309664
-Ref: Close Files And Pipes-Footnote-1316851
-Ref: Close Files And Pipes-Footnote-2316999
-Node: Nonfatal317150
-Node: Output Summary319475
-Node: Output Exercises320697
-Node: Expressions321376
-Node: Values322564
-Node: Constants323242
-Node: Scalar Constants323933
-Ref: Scalar Constants-Footnote-1324797
-Node: Nondecimal-numbers325047
-Node: Regexp Constants328061
-Node: Using Constant Regexps328587
-Node: Variables331750
-Node: Using Variables332407
-Node: Assignment Options334318
-Node: Conversion336192
-Node: Strings And Numbers336716
-Ref: Strings And Numbers-Footnote-1339780
-Node: Locale influences conversions339889
-Ref: table-locale-affects342647
-Node: All Operators343265
-Node: Arithmetic Ops343894
-Node: Concatenation346400
-Ref: Concatenation-Footnote-1349247
-Node: Assignment Ops349354
-Ref: table-assign-ops354346
-Node: Increment Ops355659
-Node: Truth Values and Conditions359119
-Node: Truth Values360193
-Node: Typing and Comparison361241
-Node: Variable Typing362061
-Node: Comparison Operators365685
-Ref: table-relational-ops366104
-Node: POSIX String Comparison369599
-Ref: POSIX String Comparison-Footnote-1370673
-Node: Boolean Ops370812
-Ref: Boolean Ops-Footnote-1375294
-Node: Conditional Exp375386
-Node: Function Calls377122
-Node: Precedence381002
-Node: Locales384661
-Node: Expressions Summary386293
-Node: Patterns and Actions388866
-Node: Pattern Overview389986
-Node: Regexp Patterns391663
-Node: Expression Patterns392205
-Node: Ranges395986
-Node: BEGIN/END399094
-Node: Using BEGIN/END399855
-Ref: Using BEGIN/END-Footnote-1402592
-Node: I/O And BEGIN/END402698
-Node: BEGINFILE/ENDFILE405014
-Node: Empty407921
-Node: Using Shell Variables408238
-Node: Action Overview410512
-Node: Statements412837
-Node: If Statement414685
-Node: While Statement416180
-Node: Do Statement418208
-Node: For Statement419356
-Node: Switch Statement422515
-Node: Break Statement424901
-Node: Continue Statement426993
-Node: Next Statement428820
-Node: Nextfile Statement431203
-Node: Exit Statement433855
-Node: Built-in Variables436260
-Node: User-modified437393
-Node: Auto-set444981
-Ref: Auto-set-Footnote-1459230
-Ref: Auto-set-Footnote-2459436
-Node: ARGC and ARGV459492
-Node: Pattern Action Summary463711
-Node: Arrays466141
-Node: Array Basics467470
-Node: Array Intro468314
-Ref: figure-array-elements470289
-Ref: Array Intro-Footnote-1472993
-Node: Reference to Elements473121
-Node: Assigning Elements475585
-Node: Array Example476076
-Node: Scanning an Array477835
-Node: Controlling Scanning480859
-Ref: Controlling Scanning-Footnote-1486258
-Node: Numeric Array Subscripts486574
-Node: Uninitialized Subscripts488758
-Node: Delete490377
-Ref: Delete-Footnote-1493129
-Node: Multidimensional493186
-Node: Multiscanning496281
-Node: Arrays of Arrays497872
-Node: Arrays Summary502640
-Node: Functions504733
-Node: Built-in505771
-Node: Calling Built-in506849
-Node: Numeric Functions508845
-Ref: Numeric Functions-Footnote-1513678
-Ref: Numeric Functions-Footnote-2514035
-Ref: Numeric Functions-Footnote-3514083
-Node: String Functions514355
-Ref: String Functions-Footnote-1537863
-Ref: String Functions-Footnote-2537992
-Ref: String Functions-Footnote-3538240
-Node: Gory Details538327
-Ref: table-sub-escapes540118
-Ref: table-sub-proposed541637
-Ref: table-posix-sub543000
-Ref: table-gensub-escapes544541
-Ref: Gory Details-Footnote-1545364
-Node: I/O Functions545515
-Ref: I/O Functions-Footnote-1552736
-Node: Time Functions552884
-Ref: Time Functions-Footnote-1563389
-Ref: Time Functions-Footnote-2563457
-Ref: Time Functions-Footnote-3563615
-Ref: Time Functions-Footnote-4563726
-Ref: Time Functions-Footnote-5563838
-Ref: Time Functions-Footnote-6564065
-Node: Bitwise Functions564331
-Ref: table-bitwise-ops564925
-Ref: Bitwise Functions-Footnote-1569263
-Node: Type Functions569436
-Node: I18N Functions570592
-Node: User-defined572243
-Node: Definition Syntax573048
-Ref: Definition Syntax-Footnote-1578735
-Node: Function Example578806
-Ref: Function Example-Footnote-1581728
-Node: Function Caveats581750
-Node: Calling A Function582268
-Node: Variable Scope583226
-Node: Pass By Value/Reference586220
-Node: Return Statement589719
-Node: Dynamic Typing592698
-Node: Indirect Calls593628
-Ref: Indirect Calls-Footnote-1603879
-Node: Functions Summary604007
-Node: Library Functions606712
-Ref: Library Functions-Footnote-1610321
-Ref: Library Functions-Footnote-2610464
-Node: Library Names610635
-Ref: Library Names-Footnote-1614096
-Ref: Library Names-Footnote-2614319
-Node: General Functions614405
-Node: Strtonum Function615508
-Node: Assert Function618530
-Node: Round Function621856
-Node: Cliff Random Function623397
-Node: Ordinal Functions624413
-Ref: Ordinal Functions-Footnote-1627476
-Ref: Ordinal Functions-Footnote-2627728
-Node: Join Function627938
-Ref: Join Function-Footnote-1629708
-Node: Getlocaltime Function629908
-Node: Readfile Function633652
-Node: Shell Quoting635626
-Node: Data File Management637027
-Node: Filetrans Function637659
-Node: Rewind Function641756
-Node: File Checking643142
-Ref: File Checking-Footnote-1644476
-Node: Empty Files644677
-Node: Ignoring Assigns646656
-Node: Getopt Function648206
-Ref: Getopt Function-Footnote-1659676
-Node: Passwd Functions659876
-Ref: Passwd Functions-Footnote-1668717
-Node: Group Functions668805
-Ref: Group Functions-Footnote-1676704
-Node: Walking Arrays676911
-Node: Library Functions Summary679921
-Node: Library Exercises681327
-Node: Sample Programs681792
-Node: Running Examples682562
-Node: Clones683290
-Node: Cut Program684514
-Node: Egrep Program694235
-Ref: Egrep Program-Footnote-1701747
-Node: Id Program701857
-Node: Split Program705537
-Ref: Split Program-Footnote-1708996
-Node: Tee Program709125
-Node: Uniq Program711915
-Node: Wc Program719341
-Ref: Wc Program-Footnote-1723596
-Node: Miscellaneous Programs723690
-Node: Dupword Program724903
-Node: Alarm Program726933
-Node: Translate Program731788
-Ref: Translate Program-Footnote-1736353
-Node: Labels Program736623
-Ref: Labels Program-Footnote-1739974
-Node: Word Sorting740058
-Node: History Sorting744130
-Node: Extract Program745965
-Node: Simple Sed753496
-Node: Igawk Program756570
-Ref: Igawk Program-Footnote-1770901
-Ref: Igawk Program-Footnote-2771103
-Ref: Igawk Program-Footnote-3771225
-Node: Anagram Program771340
-Node: Signature Program774402
-Node: Programs Summary775649
-Node: Programs Exercises776864
-Ref: Programs Exercises-Footnote-1780993
-Node: Advanced Features781084
-Node: Nondecimal Data783074
-Node: Array Sorting784665
-Node: Controlling Array Traversal785365
-Ref: Controlling Array Traversal-Footnote-1793734
-Node: Array Sorting Functions793852
-Ref: Array Sorting Functions-Footnote-1797739
-Node: Two-way I/O797935
-Ref: Two-way I/O-Footnote-1802886
-Ref: Two-way I/O-Footnote-2803073
-Node: TCP/IP Networking803155
-Node: Profiling806062
-Node: Advanced Features Summary814333
-Node: Internationalization816269
-Node: I18N and L10N817749
-Node: Explaining gettext818436
-Ref: Explaining gettext-Footnote-1823459
-Ref: Explaining gettext-Footnote-2823644
-Node: Programmer i18n823809
-Ref: Programmer i18n-Footnote-1828665
-Node: Translator i18n828714
-Node: String Extraction829508
-Ref: String Extraction-Footnote-1830641
-Node: Printf Ordering830727
-Ref: Printf Ordering-Footnote-1833513
-Node: I18N Portability833577
-Ref: I18N Portability-Footnote-1836033
-Node: I18N Example836096
-Ref: I18N Example-Footnote-1838902
-Node: Gawk I18N838975
-Node: I18N Summary839620
-Node: Debugger840961
-Node: Debugging841983
-Node: Debugging Concepts842424
-Node: Debugging Terms844233
-Node: Awk Debugging846808
-Node: Sample Debugging Session847714
-Node: Debugger Invocation848248
-Node: Finding The Bug849634
-Node: List of Debugger Commands856112
-Node: Breakpoint Control857445
-Node: Debugger Execution Control861139
-Node: Viewing And Changing Data864501
-Node: Execution Stack867875
-Node: Debugger Info869512
-Node: Miscellaneous Debugger Commands873583
-Node: Readline Support878592
-Node: Limitations879488
-Node: Debugging Summary881597
-Node: Arbitrary Precision Arithmetic882770
-Node: Computer Arithmetic884186
-Ref: table-numeric-ranges887777
-Ref: Computer Arithmetic-Footnote-1888499
-Node: Math Definitions888556
-Ref: table-ieee-formats891870
-Ref: Math Definitions-Footnote-1892473
-Node: MPFR features892578
-Node: FP Math Caution894251
-Ref: FP Math Caution-Footnote-1895323
-Node: Inexactness of computations895692
-Node: Inexact representation896652
-Node: Comparing FP Values898012
-Node: Errors accumulate899094
-Node: Getting Accuracy900527
-Node: Try To Round903237
-Node: Setting precision904136
-Ref: table-predefined-precision-strings904833
-Node: Setting the rounding mode906663
-Ref: table-gawk-rounding-modes907037
-Ref: Setting the rounding mode-Footnote-1910445
-Node: Arbitrary Precision Integers910624
-Ref: Arbitrary Precision Integers-Footnote-1915541
-Node: POSIX Floating Point Problems915690
-Ref: POSIX Floating Point Problems-Footnote-1919572
-Node: Floating point summary919610
-Node: Dynamic Extensions921800
-Node: Extension Intro923353
-Node: Plugin License924619
-Node: Extension Mechanism Outline925416
-Ref: figure-load-extension925855
-Ref: figure-register-new-function927420
-Ref: figure-call-new-function928512
-Node: Extension API Description930575
-Node: Extension API Functions Introduction932109
-Node: General Data Types936968
-Ref: General Data Types-Footnote-1942923
-Node: Memory Allocation Functions943222
-Ref: Memory Allocation Functions-Footnote-1946067
-Node: Constructor Functions946166
-Node: Registration Functions947911
-Node: Extension Functions948596
-Node: Exit Callback Functions950895
-Node: Extension Version String952145
-Node: Input Parsers952808
-Node: Output Wrappers962693
-Node: Two-way processors967205
-Node: Printing Messages969469
-Ref: Printing Messages-Footnote-1970545
-Node: Updating 'ERRNO'970698
-Node: Requesting Values971439
-Ref: table-value-types-returned972178
-Node: Accessing Parameters973061
-Node: Symbol Table Access974297
-Node: Symbol table by name974809
-Node: Symbol table by cookie976830
-Ref: Symbol table by cookie-Footnote-1980979
-Node: Cached values981043
-Ref: Cached values-Footnote-1984544
-Node: Array Manipulation984635
-Ref: Array Manipulation-Footnote-1985726
-Node: Array Data Types985763
-Ref: Array Data Types-Footnote-1988421
-Node: Array Functions988513
-Node: Flattening Arrays992372
-Node: Creating Arrays999280
-Node: Redirection API1004052
-Node: Extension API Variables1006883
-Node: Extension Versioning1007516
-Node: Extension API Informational Variables1009407
-Node: Extension API Boilerplate1010471
-Node: Finding Extensions1014285
-Node: Extension Example1014845
-Node: Internal File Description1015643
-Node: Internal File Ops1019723
-Ref: Internal File Ops-Footnote-11031485
-Node: Using Internal File Ops1031625
-Ref: Using Internal File Ops-Footnote-11034008
-Node: Extension Samples1034283
-Node: Extension Sample File Functions1035812
-Node: Extension Sample Fnmatch1043461
-Node: Extension Sample Fork1044948
-Node: Extension Sample Inplace1046166
-Node: Extension Sample Ord1048252
-Node: Extension Sample Readdir1049088
-Ref: table-readdir-file-types1049977
-Node: Extension Sample Revout1050782
-Node: Extension Sample Rev2way1051371
-Node: Extension Sample Read write array1052111
-Node: Extension Sample Readfile1054053
-Node: Extension Sample Time1055148
-Node: Extension Sample API Tests1056496
-Node: gawkextlib1056988
-Node: Extension summary1059435
-Node: Extension Exercises1063127
-Node: Language History1064624
-Node: V7/SVR3.11066280
-Node: SVR41068433
-Node: POSIX1069867
-Node: BTL1071247
-Node: POSIX/GNU1071977
-Node: Feature History1077816
-Node: Common Extensions1092135
-Node: Ranges and Locales1093418
-Ref: Ranges and Locales-Footnote-11098034
-Ref: Ranges and Locales-Footnote-21098061
-Ref: Ranges and Locales-Footnote-31098296
-Node: Contributors1098517
-Node: History summary1104086
-Node: Installation1105466
-Node: Gawk Distribution1106411
-Node: Getting1106895
-Node: Extracting1107718
-Node: Distribution contents1109356
-Node: Unix Installation1115452
-Node: Quick Installation1116134
-Node: Shell Startup Files1118548
-Node: Additional Configuration Options1119626
-Node: Configuration Philosophy1121431
-Node: Non-Unix Installation1123801
-Node: PC Installation1124259
-Node: PC Binary Installation1125579
-Node: PC Compiling1127431
-Ref: PC Compiling-Footnote-11130455
-Node: PC Testing1130564
-Node: PC Using1131744
-Node: Cygwin1135858
-Node: MSYS1136628
-Node: VMS Installation1137129
-Node: VMS Compilation1137920
-Ref: VMS Compilation-Footnote-11139150
-Node: VMS Dynamic Extensions1139208
-Node: VMS Installation Details1140893
-Node: VMS Running1143146
-Node: VMS GNV1145987
-Node: VMS Old Gawk1146722
-Node: Bugs1147193
-Node: Other Versions1151307
-Node: Installation summary1157781
-Node: Notes1158839
-Node: Compatibility Mode1159704
-Node: Additions1160486
-Node: Accessing The Source1161411
-Node: Adding Code1162847
-Node: New Ports1169002
-Node: Derived Files1173490
-Ref: Derived Files-Footnote-11178975
-Ref: Derived Files-Footnote-21179010
-Ref: Derived Files-Footnote-31179608
-Node: Future Extensions1179722
-Node: Implementation Limitations1180380
-Node: Extension Design1181563
-Node: Old Extension Problems1182717
-Ref: Old Extension Problems-Footnote-11184235
-Node: Extension New Mechanism Goals1184292
-Ref: Extension New Mechanism Goals-Footnote-11187656
-Node: Extension Other Design Decisions1187845
-Node: Extension Future Growth1189958
-Node: Old Extension Mechanism1190794
-Node: Notes summary1192557
-Node: Basic Concepts1193739
-Node: Basic High Level1194420
-Ref: figure-general-flow1194702
-Ref: figure-process-flow1195387
-Ref: Basic High Level-Footnote-11198688
-Node: Basic Data Typing1198873
-Node: Glossary1202201
-Node: Copying1234147
-Node: GNU Free Documentation License1271686
-Node: Index1296804
+Node: Foreword342508
+Node: Foreword446950
+Node: Preface48482
+Ref: Preface-Footnote-151354
+Ref: Preface-Footnote-251461
+Ref: Preface-Footnote-351695
+Node: History51837
+Node: Names54190
+Ref: Names-Footnote-155284
+Node: This Manual55431
+Ref: This Manual-Footnote-161913
+Node: Conventions62013
+Node: Manual History64368
+Ref: Manual History-Footnote-167364
+Ref: Manual History-Footnote-267405
+Node: How To Contribute67479
+Node: Acknowledgments68608
+Node: Getting Started73476
+Node: Running gawk75915
+Node: One-shot77105
+Node: Read Terminal78368
+Node: Long80400
+Node: Executable Scripts81913
+Ref: Executable Scripts-Footnote-184708
+Node: Comments84811
+Node: Quoting87295
+Node: DOS Quoting92813
+Node: Sample Data Files93488
+Node: Very Simple96083
+Node: Two Rules100985
+Node: More Complex102871
+Node: Statements/Lines105734
+Ref: Statements/Lines-Footnote-1110193
+Node: Other Features110458
+Node: When111395
+Ref: When-Footnote-1113149
+Node: Intro Summary113214
+Node: Invoking Gawk114098
+Node: Command Line115612
+Node: Options116410
+Ref: Options-Footnote-1132061
+Ref: Options-Footnote-2132291
+Node: Other Arguments132316
+Node: Naming Standard Input135263
+Node: Environment Variables136356
+Node: AWKPATH Variable136914
+Ref: AWKPATH Variable-Footnote-1140325
+Ref: AWKPATH Variable-Footnote-2140370
+Node: AWKLIBPATH Variable140631
+Node: Other Environment Variables141888
+Node: Exit Status145526
+Node: Include Files146203
+Node: Loading Shared Libraries149798
+Node: Obsolete151226
+Node: Undocumented151918
+Node: Invoking Summary152215
+Node: Regexp153875
+Node: Regexp Usage155394
+Node: Escape Sequences157431
+Node: Regexp Operators163664
+Ref: Regexp Operators-Footnote-1171081
+Ref: Regexp Operators-Footnote-2171228
+Node: Bracket Expressions171326
+Ref: table-char-classes173349
+Node: Leftmost Longest176295
+Node: Computed Regexps177598
+Node: GNU Regexp Operators181025
+Node: Case-sensitivity184704
+Ref: Case-sensitivity-Footnote-1187600
+Ref: Case-sensitivity-Footnote-2187835
+Node: Strong Regexp Constants187943
+Node: Regexp Summary190885
+Node: Reading Files192491
+Node: Records194654
+Node: awk split records195387
+Node: gawk split records200319
+Ref: gawk split records-Footnote-1204863
+Node: Fields204900
+Node: Nonconstant Fields207641
+Ref: Nonconstant Fields-Footnote-1209877
+Node: Changing Fields210081
+Node: Field Separators216011
+Node: Default Field Splitting218709
+Node: Regexp Field Splitting219827
+Node: Single Character Fields223180
+Node: Command Line Field Separator224240
+Node: Full Line Fields227458
+Ref: Full Line Fields-Footnote-1228980
+Ref: Full Line Fields-Footnote-2229026
+Node: Field Splitting Summary229127
+Node: Constant Size231201
+Node: Splitting By Content235780
+Ref: Splitting By Content-Footnote-1239751
+Node: Multiple Line239914
+Ref: Multiple Line-Footnote-1245797
+Node: Getline245976
+Node: Plain Getline248443
+Node: Getline/Variable251082
+Node: Getline/File252231
+Node: Getline/Variable/File253617
+Ref: Getline/Variable/File-Footnote-1255221
+Node: Getline/Pipe255309
+Node: Getline/Variable/Pipe258014
+Node: Getline/Coprocess259147
+Node: Getline/Variable/Coprocess260412
+Node: Getline Notes261152
+Node: Getline Summary263947
+Ref: table-getline-variants264369
+Node: Read Timeout265117
+Ref: Read Timeout-Footnote-1269024
+Node: Retrying Input269082
+Node: Command-line directories270281
+Node: Input Summary271188
+Node: Input Exercises274360
+Node: Printing275088
+Node: Print276923
+Node: Print Examples278380
+Node: Output Separators281160
+Node: OFMT283177
+Node: Printf284533
+Node: Basic Printf285318
+Node: Control Letters286892
+Node: Format Modifiers290880
+Node: Printf Examples296895
+Node: Redirection299381
+Node: Special FD306224
+Ref: Special FD-Footnote-1309392
+Node: Special Files309466
+Node: Other Inherited Files310083
+Node: Special Network311084
+Node: Special Caveats311944
+Node: Close Files And Pipes312893
+Ref: Close Files And Pipes-Footnote-1320080
+Ref: Close Files And Pipes-Footnote-2320228
+Node: Nonfatal320379
+Node: Output Summary322704
+Node: Output Exercises323926
+Node: Expressions324605
+Node: Values325793
+Node: Constants326471
+Node: Scalar Constants327162
+Ref: Scalar Constants-Footnote-1328026
+Node: Nondecimal-numbers328276
+Node: Regexp Constants331290
+Node: Using Constant Regexps331816
+Node: Variables334979
+Node: Using Variables335636
+Node: Assignment Options337547
+Node: Conversion339421
+Node: Strings And Numbers339945
+Ref: Strings And Numbers-Footnote-1343009
+Node: Locale influences conversions343118
+Ref: table-locale-affects345876
+Node: All Operators346494
+Node: Arithmetic Ops347123
+Node: Concatenation349629
+Ref: Concatenation-Footnote-1352476
+Node: Assignment Ops352583
+Ref: table-assign-ops357575
+Node: Increment Ops358888
+Node: Truth Values and Conditions362348
+Node: Truth Values363422
+Node: Typing and Comparison364470
+Node: Variable Typing365290
+Node: Comparison Operators368914
+Ref: table-relational-ops369333
+Node: POSIX String Comparison372828
+Ref: POSIX String Comparison-Footnote-1373902
+Node: Boolean Ops374041
+Ref: Boolean Ops-Footnote-1378523
+Node: Conditional Exp378615
+Node: Function Calls380351
+Node: Precedence384231
+Node: Locales387890
+Node: Expressions Summary389522
+Node: Patterns and Actions392095
+Node: Pattern Overview393215
+Node: Regexp Patterns394892
+Node: Expression Patterns395434
+Node: Ranges399215
+Node: BEGIN/END402323
+Node: Using BEGIN/END403084
+Ref: Using BEGIN/END-Footnote-1405821
+Node: I/O And BEGIN/END405927
+Node: BEGINFILE/ENDFILE408243
+Node: Empty411150
+Node: Using Shell Variables411467
+Node: Action Overview413741
+Node: Statements416066
+Node: If Statement417914
+Node: While Statement419409
+Node: Do Statement421437
+Node: For Statement422585
+Node: Switch Statement425744
+Node: Break Statement428130
+Node: Continue Statement430222
+Node: Next Statement432049
+Node: Nextfile Statement434432
+Node: Exit Statement437084
+Node: Built-in Variables439489
+Node: User-modified440622
+Node: Auto-set448210
+Ref: Auto-set-Footnote-1462459
+Ref: Auto-set-Footnote-2462665
+Node: ARGC and ARGV462721
+Node: Pattern Action Summary466940
+Node: Arrays469370
+Node: Array Basics470699
+Node: Array Intro471543
+Ref: figure-array-elements473518
+Ref: Array Intro-Footnote-1476222
+Node: Reference to Elements476350
+Node: Assigning Elements478814
+Node: Array Example479305
+Node: Scanning an Array481064
+Node: Controlling Scanning484088
+Ref: Controlling Scanning-Footnote-1489487
+Node: Numeric Array Subscripts489803
+Node: Uninitialized Subscripts491987
+Node: Delete493606
+Ref: Delete-Footnote-1496358
+Node: Multidimensional496415
+Node: Multiscanning499510
+Node: Arrays of Arrays501101
+Node: Arrays Summary505869
+Node: Functions507962
+Node: Built-in509000
+Node: Calling Built-in510078
+Node: Numeric Functions512074
+Ref: Numeric Functions-Footnote-1516907
+Ref: Numeric Functions-Footnote-2517264
+Ref: Numeric Functions-Footnote-3517312
+Node: String Functions517584
+Ref: String Functions-Footnote-1541092
+Ref: String Functions-Footnote-2541221
+Ref: String Functions-Footnote-3541469
+Node: Gory Details541556
+Ref: table-sub-escapes543347
+Ref: table-sub-proposed544866
+Ref: table-posix-sub546229
+Ref: table-gensub-escapes547770
+Ref: Gory Details-Footnote-1548593
+Node: I/O Functions548744
+Ref: I/O Functions-Footnote-1555965
+Node: Time Functions556113
+Ref: Time Functions-Footnote-1566618
+Ref: Time Functions-Footnote-2566686
+Ref: Time Functions-Footnote-3566844
+Ref: Time Functions-Footnote-4566955
+Ref: Time Functions-Footnote-5567067
+Ref: Time Functions-Footnote-6567294
+Node: Bitwise Functions567560
+Ref: table-bitwise-ops568154
+Ref: Bitwise Functions-Footnote-1572492
+Node: Type Functions572665
+Node: I18N Functions574527
+Node: User-defined576178
+Node: Definition Syntax576983
+Ref: Definition Syntax-Footnote-1582670
+Node: Function Example582741
+Ref: Function Example-Footnote-1585663
+Node: Function Caveats585685
+Node: Calling A Function586203
+Node: Variable Scope587161
+Node: Pass By Value/Reference590155
+Node: Return Statement593654
+Node: Dynamic Typing596633
+Node: Indirect Calls597563
+Ref: Indirect Calls-Footnote-1607814
+Node: Functions Summary607942
+Node: Library Functions610647
+Ref: Library Functions-Footnote-1614256
+Ref: Library Functions-Footnote-2614399
+Node: Library Names614570
+Ref: Library Names-Footnote-1618031
+Ref: Library Names-Footnote-2618254
+Node: General Functions618340
+Node: Strtonum Function619443
+Node: Assert Function622465
+Node: Round Function625791
+Node: Cliff Random Function627332
+Node: Ordinal Functions628348
+Ref: Ordinal Functions-Footnote-1631411
+Ref: Ordinal Functions-Footnote-2631663
+Node: Join Function631873
+Ref: Join Function-Footnote-1633643
+Node: Getlocaltime Function633843
+Node: Readfile Function637587
+Node: Shell Quoting639561
+Node: Data File Management640962
+Node: Filetrans Function641594
+Node: Rewind Function645691
+Node: File Checking647077
+Ref: File Checking-Footnote-1648411
+Node: Empty Files648612
+Node: Ignoring Assigns650591
+Node: Getopt Function652141
+Ref: Getopt Function-Footnote-1663611
+Node: Passwd Functions663811
+Ref: Passwd Functions-Footnote-1672652
+Node: Group Functions672740
+Ref: Group Functions-Footnote-1680639
+Node: Walking Arrays680846
+Node: Library Functions Summary683856
+Node: Library Exercises685262
+Node: Sample Programs685727
+Node: Running Examples686497
+Node: Clones687225
+Node: Cut Program688449
+Node: Egrep Program698170
+Ref: Egrep Program-Footnote-1705682
+Node: Id Program705792
+Node: Split Program709472
+Ref: Split Program-Footnote-1712931
+Node: Tee Program713060
+Node: Uniq Program715850
+Node: Wc Program723276
+Ref: Wc Program-Footnote-1727531
+Node: Miscellaneous Programs727625
+Node: Dupword Program728838
+Node: Alarm Program730868
+Node: Translate Program735723
+Ref: Translate Program-Footnote-1740288
+Node: Labels Program740558
+Ref: Labels Program-Footnote-1743909
+Node: Word Sorting743993
+Node: History Sorting748065
+Node: Extract Program749900
+Node: Simple Sed757431
+Node: Igawk Program760505
+Ref: Igawk Program-Footnote-1774836
+Ref: Igawk Program-Footnote-2775038
+Ref: Igawk Program-Footnote-3775160
+Node: Anagram Program775275
+Node: Signature Program778337
+Node: Programs Summary779584
+Node: Programs Exercises780799
+Ref: Programs Exercises-Footnote-1784928
+Node: Advanced Features785019
+Node: Nondecimal Data787009
+Node: Array Sorting788600
+Node: Controlling Array Traversal789300
+Ref: Controlling Array Traversal-Footnote-1797669
+Node: Array Sorting Functions797787
+Ref: Array Sorting Functions-Footnote-1801674
+Node: Two-way I/O801870
+Ref: Two-way I/O-Footnote-1806821
+Ref: Two-way I/O-Footnote-2807008
+Node: TCP/IP Networking807090
+Node: Profiling809997
+Node: Advanced Features Summary818268
+Node: Internationalization820204
+Node: I18N and L10N821684
+Node: Explaining gettext822371
+Ref: Explaining gettext-Footnote-1827394
+Ref: Explaining gettext-Footnote-2827579
+Node: Programmer i18n827744
+Ref: Programmer i18n-Footnote-1832600
+Node: Translator i18n832649
+Node: String Extraction833443
+Ref: String Extraction-Footnote-1834576
+Node: Printf Ordering834662
+Ref: Printf Ordering-Footnote-1837448
+Node: I18N Portability837512
+Ref: I18N Portability-Footnote-1839968
+Node: I18N Example840031
+Ref: I18N Example-Footnote-1842837
+Node: Gawk I18N842910
+Node: I18N Summary843555
+Node: Debugger844896
+Node: Debugging845918
+Node: Debugging Concepts846359
+Node: Debugging Terms848168
+Node: Awk Debugging850743
+Node: Sample Debugging Session851649
+Node: Debugger Invocation852183
+Node: Finding The Bug853569
+Node: List of Debugger Commands860047
+Node: Breakpoint Control861380
+Node: Debugger Execution Control865074
+Node: Viewing And Changing Data868436
+Node: Execution Stack871810
+Node: Debugger Info873447
+Node: Miscellaneous Debugger Commands877518
+Node: Readline Support882527
+Node: Limitations883423
+Node: Debugging Summary885532
+Node: Arbitrary Precision Arithmetic886705
+Node: Computer Arithmetic888121
+Ref: table-numeric-ranges891712
+Ref: Computer Arithmetic-Footnote-1892434
+Node: Math Definitions892491
+Ref: table-ieee-formats895805
+Ref: Math Definitions-Footnote-1896408
+Node: MPFR features896513
+Node: FP Math Caution898186
+Ref: FP Math Caution-Footnote-1899258
+Node: Inexactness of computations899627
+Node: Inexact representation900587
+Node: Comparing FP Values901947
+Node: Errors accumulate903029
+Node: Getting Accuracy904462
+Node: Try To Round907172
+Node: Setting precision908071
+Ref: table-predefined-precision-strings908768
+Node: Setting the rounding mode910598
+Ref: table-gawk-rounding-modes910972
+Ref: Setting the rounding mode-Footnote-1914380
+Node: Arbitrary Precision Integers914559
+Ref: Arbitrary Precision Integers-Footnote-1919476
+Node: POSIX Floating Point Problems919625
+Ref: POSIX Floating Point Problems-Footnote-1923507
+Node: Floating point summary923545
+Node: Dynamic Extensions925735
+Node: Extension Intro927288
+Node: Plugin License928554
+Node: Extension Mechanism Outline929351
+Ref: figure-load-extension929790
+Ref: figure-register-new-function931355
+Ref: figure-call-new-function932447
+Node: Extension API Description934510
+Node: Extension API Functions Introduction936044
+Node: General Data Types940903
+Ref: General Data Types-Footnote-1946858
+Node: Memory Allocation Functions947157
+Ref: Memory Allocation Functions-Footnote-1950002
+Node: Constructor Functions950101
+Node: Registration Functions951846
+Node: Extension Functions952531
+Node: Exit Callback Functions954830
+Node: Extension Version String956080
+Node: Input Parsers956743
+Node: Output Wrappers966628
+Node: Two-way processors971140
+Node: Printing Messages973404
+Ref: Printing Messages-Footnote-1974480
+Node: Updating 'ERRNO'974633
+Node: Requesting Values975374
+Ref: table-value-types-returned976113
+Node: Accessing Parameters976996
+Node: Symbol Table Access978232
+Node: Symbol table by name978744
+Node: Symbol table by cookie980765
+Ref: Symbol table by cookie-Footnote-1984914
+Node: Cached values984978
+Ref: Cached values-Footnote-1988479
+Node: Array Manipulation988570
+Ref: Array Manipulation-Footnote-1989661
+Node: Array Data Types989698
+Ref: Array Data Types-Footnote-1992356
+Node: Array Functions992448
+Node: Flattening Arrays996307
+Node: Creating Arrays1003215
+Node: Redirection API1007987
+Node: Extension API Variables1010818
+Node: Extension Versioning1011451
+Node: Extension API Informational Variables1013342
+Node: Extension API Boilerplate1014406
+Node: Finding Extensions1018220
+Node: Extension Example1018780
+Node: Internal File Description1019578
+Node: Internal File Ops1023658
+Ref: Internal File Ops-Footnote-11035420
+Node: Using Internal File Ops1035560
+Ref: Using Internal File Ops-Footnote-11037943
+Node: Extension Samples1038218
+Node: Extension Sample File Functions1039747
+Node: Extension Sample Fnmatch1047396
+Node: Extension Sample Fork1048883
+Node: Extension Sample Inplace1050101
+Node: Extension Sample Ord1053311
+Node: Extension Sample Readdir1054147
+Ref: table-readdir-file-types1055036
+Node: Extension Sample Revout1055841
+Node: Extension Sample Rev2way1056430
+Node: Extension Sample Read write array1057170
+Node: Extension Sample Readfile1059112
+Node: Extension Sample Time1060207
+Node: Extension Sample API Tests1061555
+Node: gawkextlib1062047
+Node: Extension summary1064494
+Node: Extension Exercises1068186
+Node: Language History1069683
+Node: V7/SVR3.11071339
+Node: SVR41073492
+Node: POSIX1074926
+Node: BTL1076306
+Node: POSIX/GNU1077036
+Node: Feature History1082875
+Node: Common Extensions1097194
+Node: Ranges and Locales1098477
+Ref: Ranges and Locales-Footnote-11103093
+Ref: Ranges and Locales-Footnote-21103120
+Ref: Ranges and Locales-Footnote-31103355
+Node: Contributors1103576
+Node: History summary1109145
+Node: Installation1110525
+Node: Gawk Distribution1111470
+Node: Getting1111954
+Node: Extracting1112777
+Node: Distribution contents1114415
+Node: Unix Installation1120511
+Node: Quick Installation1121193
+Node: Shell Startup Files1123607
+Node: Additional Configuration Options1124685
+Node: Configuration Philosophy1126490
+Node: Non-Unix Installation1128860
+Node: PC Installation1129318
+Node: PC Binary Installation1130638
+Node: PC Compiling1132490
+Ref: PC Compiling-Footnote-11135514
+Node: PC Testing1135623
+Node: PC Using1136803
+Node: Cygwin1140917
+Node: MSYS1141687
+Node: VMS Installation1142188
+Node: VMS Compilation1142979
+Ref: VMS Compilation-Footnote-11144209
+Node: VMS Dynamic Extensions1144267
+Node: VMS Installation Details1145952
+Node: VMS Running1148205
+Node: VMS GNV1151046
+Node: VMS Old Gawk1151781
+Node: Bugs1152252
+Node: Other Versions1156366
+Node: Installation summary1162840
+Node: Notes1163898
+Node: Compatibility Mode1164763
+Node: Additions1165545
+Node: Accessing The Source1166470
+Node: Adding Code1167906
+Node: New Ports1174061
+Node: Derived Files1178549
+Ref: Derived Files-Footnote-11184034
+Ref: Derived Files-Footnote-21184069
+Ref: Derived Files-Footnote-31184667
+Node: Future Extensions1184781
+Node: Implementation Limitations1185439
+Node: Extension Design1186622
+Node: Old Extension Problems1187776
+Ref: Old Extension Problems-Footnote-11189294
+Node: Extension New Mechanism Goals1189351
+Ref: Extension New Mechanism Goals-Footnote-11192715
+Node: Extension Other Design Decisions1192904
+Node: Extension Future Growth1195017
+Node: Old Extension Mechanism1195853
+Node: Notes summary1197616
+Node: Basic Concepts1198798
+Node: Basic High Level1199479
+Ref: figure-general-flow1199761
+Ref: figure-process-flow1200446
+Ref: Basic High Level-Footnote-11203747
+Node: Basic Data Typing1203932
+Node: Glossary1207260
+Node: Copying1239206
+Node: GNU Free Documentation License1276745
+Node: Index1301863

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index d61a47de..7552f164 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -562,6 +562,7 @@ particular records in a file and perform operations upon them.
* Computed Regexps:: Using Dynamic Regexps.
* GNU Regexp Operators:: Operators specific to GNU software.
* Case-sensitivity:: How to do case-insensitive matching.
+* Strong Regexp Constants:: Strongly typed regexp constants.
* Regexp Summary:: Regular expressions summary.
* Records:: Controlling how data is split into
records.
@@ -5013,6 +5014,7 @@ regular expressions work, we present more complicated instances.
* Computed Regexps:: Using Dynamic Regexps.
* GNU Regexp Operators:: Operators specific to GNU software.
* Case-sensitivity:: How to do case-insensitive matching.
+* Strong Regexp Constants:: Strongly typed regexp constants.
* Regexp Summary:: Regular expressions summary.
@end menu
@@ -6260,6 +6262,89 @@ The value of @code{IGNORECASE} has no effect if @command{gawk} is in
compatibility mode (@pxref{Options}).
Case is always significant in compatibility mode.
+@node Strong Regexp Constants
+@section Strongly Typed Regexp Constants
+
+This @value{SECTION} describes a @command{gawk}-specific feature.
+
+Regexp constants (@code{/@dots{}/}) hold a strange position in the
+@command{awk} language. In most contexts, they act like an expression:
+@samp{$0 ~ /@dots{}/}. In other contexts, they denote only a regexp to
+be matched. In no case are they really a ``first class citizen'' of the
+language. That is, you cannot define a scalar variable whose type is
+``regexp'' in the same sense that you can define a variable to be a
+number or a string:
+
+@example
+num = 42 @ii{Numeric variable}
+str = "hi" @ii{String variable}
+re = /foo/ @ii{Wrong!} re @ii{is the result of} $0 ~ /foo/
+@end example
+
+For a number of more advanced use cases (described later on in this
+@value{DOCUMENT}), it would be nice to have regexp constants that
+are @dfn{strongly typed}; in other words, that denote a regexp useful
+for matching, and not an expression.
+
+@command{gawk} provides this feature. A strongly typed regexp constant
+looks almost like a regular regexp constant, except that it is preceded
+by an @samp{@@} sign:
+
+@example
+re = @@/foo/ @ii{Regexp variable}
+@end example
+
+Strongly typed regexp constants @emph{cannot} be used eveywhere that a
+regular regexp constant can, because this would make the language even more
+confusing. Instead, you may use them only in certain contexts:
+
+@itemize @bullet
+@item
+On the righthand side of the @samp{~} and @samp{!~} operators: @samp{some_var ~ @@/foo/}
+(@pxref{Regexp Usage}).
+
+@item
+In the @code{case} part of a @code{switch} statement
+(@pxref{Switch Statement}).
+
+@item
+As an argument to one of the built-in functions that accept regexp constants:
+@code{gensub()},
+@code{gsub()},
+@code{match()},
+@code{patsplit()},
+@code{split()},
+and
+@code{sub()}
+(@pxref{String Functions}).
+
+@item
+As a parameter in a call to a user-defined function
+(@pxref{User-defined}).
+
+@item
+On the righthand side of an assignment to a variable: @samp{some_var = @@/foo/}.
+In this case, the type of @code{some_var} is regexp. Additionally, @code{some_var}
+can be used with @samp{~} and @samp{!~}, passed to one of the built-in functions
+listed above, or passed as a parameter to a user-defined function.
+@end itemize
+
+You may use the @code{typeof()} built-in function
+(@pxref{Type Functions})
+to determine if a variable or function parameter is
+a regexp variable.
+
+The true power of this feature comes from the ability to create variables that
+have regexp type. Such variables can be passed on to user-defined functions,
+without the confusing aspects of computed regular expressions created from
+strings or string constants. They may also be passed through indirect function
+calls (@pxref{Indirect Calls})
+onto the built-in functions that accept regexp constants.
+
+When used in numeric conversions, strongly typed regexp variables convert
+to zero. When used in string conversions, they convert to the string
+value of the original regexp text.
+
@node Regexp Summary
@section Summary
@@ -6303,6 +6388,11 @@ treated as regular expressions).
case sensitivity of regexp matching. In other @command{awk}
versions, use @code{tolower()} or @code{toupper()}.
+@item
+Strongly typed regexp constants (@code{@@/.../}) enable
+certain advanced use cases to be described later on in the
+@value{DOCUMENT}.
+
@end itemize
@@ -19387,16 +19477,41 @@ results of the @code{compl()}, @code{lshift()}, and @code{rshift()} functions.
@node Type Functions
@subsection Getting Type Information
-@command{gawk} provides a single function that lets you distinguish
-an array from a scalar variable. This is necessary for writing code
+@command{gawk} provides two functions that lets you distinguish
+the type of a variable.
+This is necessary for writing code
that traverses every element of an array of arrays
-(@pxref{Arrays of Arrays}).
+(@pxref{Arrays of Arrays}), and in other contexts.
@table @code
@cindexgawkfunc{isarray}
@cindex scalar or array
@item isarray(@var{x})
Return a true value if @var{x} is an array. Otherwise, return false.
+
+@cindexgawkfunc{typeof}
+@cindex variable type
+@cindex type, of variable
+@item typeof(@var{x})
+Return one of the following strings, depending upon the type of @var{x}:
+
+@c nested table
+@table @code
+@item "array"
+@var{x} is an array.
+
+@item "regexp"
+@var{x} is a strongly typed regexp (@pxref{Strong Regexp Constants}).
+
+@item "scalar_n"
+@var{x} is a number.
+
+@item "scalar_s"
+@var{x} is a string.
+
+@item "untyped"
+@var{x} has not yet been given a type.
+@end table
@end table
@code{isarray()} is meant for use in two circumstances. The first is when
@@ -19414,6 +19529,14 @@ that has not been previously used to @code{isarray()}, @command{gawk}
ends up turning it into a scalar.
@end quotation
+The @code{typeof()} function is general; it allows you to determine
+if a variable or function parameter is a scalar, an array, or a strongly
+typed regexp.
+
+@code{isarray()} is deprecated; you should use @code{typeof()} instead.
+You should replace any existing uses of @samp{isarray(var)} in your
+code with @samp{typeof(var) == "array"}.
+
@node I18N Functions
@subsection String-Translation Functions
@cindex @command{gawk}, string-translation functions
@@ -34975,17 +35098,31 @@ properly:
# Please set INPLACE_SUFFIX to make a backup copy. For example, you may
# want to set INPLACE_SUFFIX to .bak on the command line or in a BEGIN rule.
+# By default, each filename on the command line will be edited inplace.
+# But you can selectively disable this by adding an inplace=0 argument
+# prior to files that you do not want to process this way. You can then
+# reenable it later on the commandline by putting inplace=1 before files
+# that you wish to be subject to inplace editing.
+
# N.B. We call inplace_end() in the BEGINFILE and END rules so that any
# actions in an ENDFILE rule will be redirected as expected.
+BEGIN @{
+ inplace = 1 # enabled by default
+@}
+
BEGINFILE @{
if (_inplace_filename != "")
inplace_end(_inplace_filename, INPLACE_SUFFIX)
- inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX)
+ if (inplace)
+ inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX)
+ else
+ _inplace_filename = ""
@}
END @{
- inplace_end(FILENAME, INPLACE_SUFFIX)
+ if (_inplace_filename != "")
+ inplace_end(_inplace_filename, INPLACE_SUFFIX)
@}
@end group
@c endfile
@@ -34999,6 +35136,11 @@ If @code{INPLACE_SUFFIX} is not an empty string, the original file is
linked to a backup @value{FN} created by appending that suffix. Finally,
the temporary file is renamed to the original @value{FN}.
+Note that the use of this feature can be controlled by placing @samp{inplace=0}
+on the command-line prior to listing files that should not be processed this
+way. You can reenable inplace editing by adding an @samp{inplace=1} argument
+prior to files that should be subject to inplace editing.
+
The @code{_inplace_filename} variable serves to keep track of the
current filename so as to not invoke @code{inplace_end()} before
processing the first file.
@@ -35019,6 +35161,10 @@ $ @kbd{gawk -i inplace -v INPLACE_SUFFIX=.bak '@{ gsub(/foo/, "bar") @}}
> @kbd{@{ print @}' file1 file2 file3}
@end example
+Please note that, while the extension does attempt to preserve ownership and permissions, it makes no attempt to copy the ACLs from the original file.
+
+If the program dies prematurely, as might happen if an unhandled signal is received, a temporary file may be left behind.
+
@node Extension Sample Ord
@subsection Character and Numeric values: @code{ord()} and @code{chr()}
diff --git a/doc/gawkinet.info b/doc/gawkinet.info
index d726be0b..81837aa3 100644
--- a/doc/gawkinet.info
+++ b/doc/gawkinet.info
@@ -1,12 +1,7 @@
-This is gawkinet.info, produced by makeinfo version 4.13 from
+This is gawkinet.info, produced by makeinfo version 5.2 from
gawkinet.texi.
-INFO-DIR-SECTION Network applications
-START-INFO-DIR-ENTRY
-* Gawkinet: (gawkinet). TCP/IP Internetworking With `gawk'.
-END-INFO-DIR-ENTRY
-
- This is Edition 1.3 of `TCP/IP Internetworking with `gawk'', for the
+This is Edition 1.3 of 'TCP/IP Internetworking with 'gawk'', for the
4.0.0 (or later) version of the GNU implementation of AWK.
@@ -27,10 +22,14 @@ texts being (a) (see below), and with the Back-Cover Texts being (b)
b. "You have the freedom to copy and modify this GNU manual. Buying
copies from the FSF supports it in developing GNU and promoting
software freedom."
+INFO-DIR-SECTION Network applications
+START-INFO-DIR-ENTRY
+* Gawkinet: (gawkinet). TCP/IP Internetworking With 'gawk'.
+END-INFO-DIR-ENTRY
- This file documents the networking features in GNU `awk'.
+ This file documents the networking features in GNU 'awk'.
- This is Edition 1.3 of `TCP/IP Internetworking with `gawk'', for the
+ This is Edition 1.3 of 'TCP/IP Internetworking with 'gawk'', for the
4.0.0 (or later) version of the GNU implementation of AWK.
@@ -58,10 +57,10 @@ File: gawkinet.info, Node: Top, Next: Preface, Prev: (dir), Up: (dir)
General Introduction
********************
-This file documents the networking features in GNU Awk (`gawk') version
+This file documents the networking features in GNU Awk ('gawk') version
4.0 and later.
- This is Edition 1.3 of `TCP/IP Internetworking with `gawk'', for the
+ This is Edition 1.3 of 'TCP/IP Internetworking with 'gawk'', for the
4.0.0 (or later) version of the GNU implementation of AWK.
@@ -100,7 +99,7 @@ texts being (a) (see below), and with the Back-Cover Texts being (b)
* Basic Protocols:: The basic protocols.
* Ports:: The idea behind ports.
* Making Connections:: Making TCP/IP connections.
-* Gawk Special Files:: How to do `gawk' networking.
+* Gawk Special Files:: How to do 'gawk' networking.
* Special File Fields:: The fields in the special file name.
* Comparing Protocols:: Differences between the protocols.
* File /inet/tcp:: The TCP special file.
@@ -135,28 +134,28 @@ Preface
*******
In May of 1997, Ju"rgen Kahrs felt the need for network access from
-`awk', and, with a little help from me, set about adding features to do
-this for `gawk'. At that time, he wrote the bulk of this Info file.
+'awk', and, with a little help from me, set about adding features to do
+this for 'gawk'. At that time, he wrote the bulk of this Info file.
- The code and documentation were added to the `gawk' 3.1 development
+ The code and documentation were added to the 'gawk' 3.1 development
tree, and languished somewhat until I could finally get down to some
-serious work on that version of `gawk'. This finally happened in the
+serious work on that version of 'gawk'. This finally happened in the
middle of 2000.
Meantime, Ju"rgen wrote an article about the Internet special files
-and `|&' operator for `Linux Journal', and made a networking patch for
-the production versions of `gawk' available from his home page. In
-August of 2000 (for `gawk' 3.0.6), this patch also made it to the main
-GNU `ftp' distribution site.
+and '|&' operator for 'Linux Journal', and made a networking patch for
+the production versions of 'gawk' available from his home page. In
+August of 2000 (for 'gawk' 3.0.6), this patch also made it to the main
+GNU 'ftp' distribution site.
- For release with `gawk', I edited Ju"rgen's prose for English
-grammar and style, as he is not a native English speaker. I also
-rearranged the material somewhat for what I felt was a better order of
-presentation, and (re)wrote some of the introductory material.
+ For release with 'gawk', I edited Ju"rgen's prose for English grammar
+and style, as he is not a native English speaker. I also rearranged the
+material somewhat for what I felt was a better order of presentation,
+and (re)wrote some of the introductory material.
- The majority of this document and the code are his work, and the
-high quality and interesting ideas speak for themselves. It is my hope
-that these features will be of significant value to the `awk' community.
+ The majority of this document and the code are his work, and the high
+quality and interesting ideas speak for themselves. It is my hope that
+these features will be of significant value to the 'awk' community.
Arnold Robbins
@@ -170,16 +169,16 @@ File: gawkinet.info, Node: Introduction, Next: Using Networking, Prev: Prefac
*********************
This major node provides a (necessarily) brief introduction to computer
-networking concepts. For many applications of `gawk' to TCP/IP
+networking concepts. For many applications of 'gawk' to TCP/IP
networking, we hope that this is enough. For more advanced tasks, you
will need deeper background, and it may be necessary to switch to
lower-level programming in C or C++.
- There are two real-life models for the way computers send messages
-to each other over a network. While the analogies are not perfect,
-they are close enough to convey the major concepts. These two models
-are the phone system (reliable byte-stream communications), and the
-postal system (best-effort datagrams).
+ There are two real-life models for the way computers send messages to
+each other over a network. While the analogies are not perfect, they
+are close enough to convey the major concepts. These two models are the
+phone system (reliable byte-stream communications), and the postal
+system (best-effort datagrams).
* Menu:
@@ -199,19 +198,19 @@ When you make a phone call, the following steps occur:
1. You dial a number.
2. The phone system connects to the called party, telling them there
- is an incoming call. (Their phone rings.)
+ is an incoming call. (Their phone rings.)
3. The other party answers the call, or, in the case of a computer
network, refuses to answer the call.
- 4. Assuming the other party answers, the connection between you is
- now a "duplex" (two-way), "reliable" (no data lost), sequenced
- (data comes out in the order sent) data stream.
+ 4. Assuming the other party answers, the connection between you is now
+ a "duplex" (two-way), "reliable" (no data lost), sequenced (data
+ comes out in the order sent) data stream.
5. You and your friend may now talk freely, with the phone system
- moving the data (your voices) from one end to the other. From
- your point of view, you have a direct end-to-end connection with
- the person on the other end.
+ moving the data (your voices) from one end to the other. From your
+ point of view, you have a direct end-to-end connection with the
+ person on the other end.
The same steps occur in a duplex reliable computer networking
connection. There is considerably more overhead in setting up the
@@ -234,16 +233,15 @@ following.
3. Each envelope may travel a different route to its destination.
- 4. The envelopes may arrive in a different order from the one in
- which they were sent.
+ 4. The envelopes may arrive in a different order from the one in which
+ they were sent.
- 5. One or more may get lost in the mail. (Although, fortunately,
- this does not occur very often.)
+ 5. One or more may get lost in the mail. (Although, fortunately, this
+ does not occur very often.)
6. In a computer network, one or more "packets" may also arrive
multiple times. (This doesn't happen with the postal system!)
-
The important characteristics of datagram communications, like those
of the postal system are thus:
@@ -255,8 +253,8 @@ of the postal system are thus:
* Delivery is _not_ sequenced; packets may arrive out of order,
and/or multiple times.
- * Unlike the phone system, overhead is considerably lower. It is
- not necessary to set up the call first.
+ * Unlike the phone system, overhead is considerably lower. It is not
+ necessary to set up the call first.
The price the user pays for the lower overhead of datagram
communications is exactly the lower reliability; it is often necessary
@@ -293,45 +291,45 @@ File: gawkinet.info, Node: Basic Protocols, Next: Ports, Prev: The TCP/IP Pro
----------------------------------
IP
- The Internet Protocol. This protocol is almost never used
- directly by applications. It provides the basic packet delivery
- and routing infrastructure of the Internet. Much like the phone
- company's switching centers or the Post Office's trucks, it is not
- of much day-to-day interest to the regular user (or programmer).
- It happens to be a best effort datagram protocol. In the early
+ The Internet Protocol. This protocol is almost never used directly
+ by applications. It provides the basic packet delivery and routing
+ infrastructure of the Internet. Much like the phone company's
+ switching centers or the Post Office's trucks, it is not of much
+ day-to-day interest to the regular user (or programmer). It
+ happens to be a best effort datagram protocol. In the early
twenty-first century, there are two versions of this protocol in
use:
- IPv4
+ IPv4
The original version of the Internet Protocol, with 32-bit
addresses, on which most of the current Internet is based.
- IPv6
+ IPv6
The "next generation" of the Internet Protocol, with 128-bit
addresses. This protocol is in wide use in certain parts of
the world, but has not yet replaced IPv4.(1)
Versions of the other protocols that sit "atop" IP exist for both
- IPv4 and IPv6. However, as the IPv6 versions are fundamentally the
- same as the original IPv4 versions, we will not distinguish
- further between them.
+ IPv4 and IPv6. However, as the IPv6 versions are fundamentally the
+ same as the original IPv4 versions, we will not distinguish further
+ between them.
UDP
The User Datagram Protocol. This is a best effort datagram
- protocol. It provides a small amount of extra reliability over
- IP, and adds the notion of "ports", described in *note TCP and UDP
+ protocol. It provides a small amount of extra reliability over IP,
+ and adds the notion of "ports", described in *note TCP and UDP
Ports: Ports.
TCP
The Transmission Control Protocol. This is a duplex, reliable,
sequenced byte-stream protocol, again layered on top of IP, and
also providing the notion of ports. This is the protocol that you
- will most likely use when using `gawk' for network programming.
+ will most likely use when using 'gawk' for network programming.
All other user-level protocols use either TCP or UDP to do their
basic communications. Examples are SMTP (Simple Mail Transfer
Protocol), FTP (File Transfer Protocol), and HTTP (HyperText Transfer
-Protocol).
+Protocol).
---------- Footnotes ----------
@@ -344,14 +342,14 @@ File: gawkinet.info, Node: Ports, Prev: Basic Protocols, Up: The TCP/IP Proto
-----------------------
In the postal system, the address on an envelope indicates a physical
-location, such as a residence or office building. But there may be
-more than one person at the location; thus you have to further quantify
-the recipient by putting a person or company name on the envelope.
+location, such as a residence or office building. But there may be more
+than one person at the location; thus you have to further quantify the
+recipient by putting a person or company name on the envelope.
In the phone system, one phone number may represent an entire
company, in which case you need a person's extension number in order to
reach that individual directly. Or, when you call a home, you have to
-say, "May I please speak to ..." before talking to the person directly.
+say, "May I please speak to ..." before talking to the person directly.
IP networking provides the concept of addressing. An IP address
represents a particular computer, but no more. In order to reach the
@@ -361,11 +359,10 @@ Internet Protocol suite, this is done with "port numbers", which
represent the services, much like an extension number used with a phone
number.
- Port numbers are 16-bit integers. Unix and Unix-like systems
-reserve ports below 1024 for "well known" services, such as SMTP, FTP,
-and HTTP. Numbers 1024 and above may be used by any application,
-although there is no promise made that a particular port number is
-always available.
+ Port numbers are 16-bit integers. Unix and Unix-like systems reserve
+ports below 1024 for "well known" services, such as SMTP, FTP, and HTTP.
+Numbers 1024 and above may be used by any application, although there is
+no promise made that a particular port number is always available.

File: gawkinet.info, Node: Making Connections, Prev: The TCP/IP Protocols, Up: Introduction
@@ -374,12 +371,12 @@ File: gawkinet.info, Node: Making Connections, Prev: The TCP/IP Protocols, Up
====================================================
Two terms come up repeatedly when discussing networking: "client" and
-"server". For now, we'll discuss these terms at the "connection
-level", when first establishing connections between two processes on
-different systems over a network. (Once the connection is established,
-the higher level, or "application level" protocols, such as HTTP or
-FTP, determine who is the client and who is the server. Often, it
-turns out that the client and server are the same in both roles.)
+"server". For now, we'll discuss these terms at the "connection level",
+when first establishing connections between two processes on different
+systems over a network. (Once the connection is established, the higher
+level, or "application level" protocols, such as HTTP or FTP, determine
+who is the client and who is the server. Often, it turns out that the
+client and server are the same in both roles.)
The "server" is the system providing the service, such as the web
server or email server. It is the "host" (system) which is _connected
@@ -389,34 +386,33 @@ building to answer the phone(1), the server process (usually) has to be
started first and be waiting for a connection.
The "client" is the system requesting the service. It is the system
-_initiating the connection_ in a transaction. (Just as when you pick
-up the phone to call an office or store.)
-
- In the TCP/IP framework, each end of a connection is represented by
-a pair of (ADDRESS, PORT) pairs. For the duration of the connection,
-the ports in use at each end are unique, and cannot be used
-simultaneously by other processes on the same system. (Only after
-closing a connection can a new one be built up on the same port. This
-is contrary to the usual behavior of fully developed web servers which
-have to avoid situations in which they are not reachable. We have to
-pay this price in order to enjoy the benefits of a simple communication
-paradigm in `gawk'.)
+_initiating the connection_ in a transaction. (Just as when you pick up
+the phone to call an office or store.)
+
+ In the TCP/IP framework, each end of a connection is represented by a
+pair of (ADDRESS, PORT) pairs. For the duration of the connection, the
+ports in use at each end are unique, and cannot be used simultaneously
+by other processes on the same system. (Only after closing a connection
+can a new one be built up on the same port. This is contrary to the
+usual behavior of fully developed web servers which have to avoid
+situations in which they are not reachable. We have to pay this price
+in order to enjoy the benefits of a simple communication paradigm in
+'gawk'.)
Furthermore, once the connection is established, communications are
-"synchronous".(2) I.e., each end waits on the other to finish
-transmitting, before replying. This is much like two people in a phone
+"synchronous".(2) I.e., each end waits on the other to finish
+transmitting, before replying. This is much like two people in a phone
conversation. While both could talk simultaneously, doing so usually
doesn't work too well.
In the case of TCP, the synchronicity is enforced by the protocol
when sending data. Data writes "block" until the data have been
-received on the other end. For both TCP and UDP, data reads block
-until there is incoming data waiting to be read. This is summarized in
-the following table, where an "X" indicates that the given action
-blocks.
+received on the other end. For both TCP and UDP, data reads block until
+there is incoming data waiting to be read. This is summarized in the
+following table, where an "X" indicates that the given action blocks.
TCP X X
-UDP X
+UDP X
---------- Footnotes ----------
@@ -429,38 +425,38 @@ receiving a "there's no data" error return.

File: gawkinet.info, Node: Using Networking, Next: Some Applications and Techniques, Prev: Introduction, Up: Top
-2 Networking With `gawk'
+2 Networking With 'gawk'
************************
-The `awk' programming language was originally developed as a
+The 'awk' programming language was originally developed as a
pattern-matching language for writing short programs to perform data
-manipulation tasks. `awk''s strength is the manipulation of textual
+manipulation tasks. 'awk''s strength is the manipulation of textual
data that is stored in files. It was never meant to be used for
networking purposes. To exploit its features in a networking context,
it's necessary to use an access mode for network connections that
resembles the access of files as closely as possible.
- `awk' is also meant to be a prototyping language. It is used to
+ 'awk' is also meant to be a prototyping language. It is used to
demonstrate feasibility and to play with features and user interfaces.
-This can be done with file-like handling of network connections.
-`gawk' trades the lack of many of the advanced features of the TCP/IP
-family of protocols for the convenience of simple connection handling.
-The advanced features are available when programming in C or Perl. In
-fact, the network programming in this major node is very similar to
-what is described in books such as `Internet Programming with Python',
-`Advanced Perl Programming', or `Web Client Programming with Perl'.
+This can be done with file-like handling of network connections. 'gawk'
+trades the lack of many of the advanced features of the TCP/IP family of
+protocols for the convenience of simple connection handling. The
+advanced features are available when programming in C or Perl. In fact,
+the network programming in this major node is very similar to what is
+described in books such as 'Internet Programming with Python', 'Advanced
+Perl Programming', or 'Web Client Programming with Perl'.
However, you can do the programming here without first having to
learn object-oriented ideology; underlying languages such as Tcl/Tk,
Perl, Python; or all of the libraries necessary to extend these
languages before they are ready for the Internet.
- This major node demonstrates how to use the TCP protocol. The UDP
+ This major node demonstrates how to use the TCP protocol. The UDP
protocol is much less important for most users.
* Menu:
-* Gawk Special Files:: How to do `gawk' networking.
+* Gawk Special Files:: How to do 'gawk' networking.
* TCP Connecting:: Making a TCP connection.
* Troubleshooting:: Troubleshooting TCP/IP connections.
* Interacting:: Interacting with a service.
@@ -476,20 +472,20 @@ protocol is much less important for most users.

File: gawkinet.info, Node: Gawk Special Files, Next: TCP Connecting, Prev: Using Networking, Up: Using Networking
-2.1 `gawk''s Networking Mechanisms
+2.1 'gawk''s Networking Mechanisms
==================================
-The `|&' operator for use in communicating with a "coprocess" is
+The '|&' operator for use in communicating with a "coprocess" is
described in *note Two-way Communications With Another Process:
(gawk)Two-way I/O. It shows how to do two-way I/O to a separate
-process, sending it data with `print' or `printf' and reading data with
-`getline'. If you haven't read it already, you should detour there to
+process, sending it data with 'print' or 'printf' and reading data with
+'getline'. If you haven't read it already, you should detour there to
do so.
- `gawk' transparently extends the two-way I/O mechanism to simple
+ 'gawk' transparently extends the two-way I/O mechanism to simple
networking through the use of special file names. When a "coprocess"
that matches the special files we are about to describe is started,
-`gawk' creates the appropriate network connection, and then two-way I/O
+'gawk' creates the appropriate network connection, and then two-way I/O
proceeds as usual.
At the C, C++, and Perl level, networking is accomplished via
@@ -498,8 +494,8 @@ developed at the University of California at Berkeley that is now used
almost universally for TCP/IP networking. Socket level programming,
while fairly straightforward, requires paying attention to a number of
details, as well as using binary data. It is not well-suited for use
-from a high-level language like `awk'. The special files provided in
-`gawk' hide the details from the programmer, making things much simpler
+from a high-level language like 'awk'. The special files provided in
+'gawk' hide the details from the programmer, making things much simpler
and easier to use.
The special file name for network access is made up of several
@@ -524,56 +520,56 @@ File: gawkinet.info, Node: Special File Fields, Next: Comparing Protocols, Pr
This node explains the meaning of all the other fields, as well as the
range of values and the defaults. All of the fields are mandatory. To
let the system pick a value, or if the field doesn't apply to the
-protocol, specify it as `0':
+protocol, specify it as '0':
NET-TYPE
- This is one of `inet4' for IPv4, `inet6' for IPv6, or `inet' to
- use the system default (which is likely to be IPv4). For the rest
- of this document, we will use the generic `/inet' in our
- descriptions of how `gawk''s networking works.
+ This is one of 'inet4' for IPv4, 'inet6' for IPv6, or 'inet' to use
+ the system default (which is likely to be IPv4). For the rest of
+ this document, we will use the generic '/inet' in our descriptions
+ of how 'gawk''s networking works.
PROTOCOL
Determines which member of the TCP/IP family of protocols is
- selected to transport the data across the network. There are two
- possible values (always written in lowercase): `tcp' and `udp'.
+ selected to transport the data across the network. There are two
+ possible values (always written in lowercase): 'tcp' and 'udp'.
The exact meaning of each is explained later in this node.
LOCALPORT
Determines which port on the local machine is used to communicate
- across the network. Application-level clients usually use `0' to
+ across the network. Application-level clients usually use '0' to
indicate they do not care which local port is used--instead they
- specify a remote port to connect to. It is vital for
- application-level servers to use a number different from `0' here
+ specify a remote port to connect to. It is vital for
+ application-level servers to use a number different from '0' here
because their service has to be available at a specific publicly
- known port number. It is possible to use a name from
- `/etc/services' here.
+ known port number. It is possible to use a name from
+ '/etc/services' here.
HOSTNAME
Determines which remote host is to be at the other end of the
- connection. Application-level servers must fill this field with a
- `0' to indicate their being open for all other hosts to connect to
+ connection. Application-level servers must fill this field with a
+ '0' to indicate their being open for all other hosts to connect to
them and enforce connection level server behavior this way. It is
not possible for an application-level server to restrict its
availability to one remote host by entering a host name here.
- Application-level clients must enter a name different from `0'.
- The name can be either symbolic (e.g., `jpl-devvax.jpl.nasa.gov')
- or numeric (e.g., `128.149.1.143').
+ Application-level clients must enter a name different from '0'.
+ The name can be either symbolic (e.g., 'jpl-devvax.jpl.nasa.gov')
+ or numeric (e.g., '128.149.1.143').
REMOTEPORT
Determines which port on the remote machine is used to communicate
- across the network. For `/inet/tcp' and `/inet/udp',
- application-level clients _must_ use a number other than `0' to
+ across the network. For '/inet/tcp' and '/inet/udp',
+ application-level clients _must_ use a number other than '0' to
indicate to which port on the remote machine they want to connect.
- Application-level servers must not fill this field with a `0'.
+ Application-level servers must not fill this field with a '0'.
Instead they specify a local port to which clients connect. It is
- possible to use a name from `/etc/services' here.
+ possible to use a name from '/etc/services' here.
Experts in network programming will notice that the usual
client/server asymmetry found at the level of the socket API is not
-visible here. This is for the sake of simplicity of the high-level
-concept. If this asymmetry is necessary for your application, use
-another language. For `gawk', it is more important to enable users to
-write a client program with a minimum of code. What happens when first
+visible here. This is for the sake of simplicity of the high-level
+concept. If this asymmetry is necessary for your application, use
+another language. For 'gawk', it is more important to enable users to
+write a client program with a minimum of code. What happens when first
accessing a network connection is seen in the following pseudocode:
if ((name of remote host given) && (other side accepts connection)) {
@@ -589,24 +585,25 @@ accessing a network connection is seen in the following pseudocode:
}
The exact behavior of this algorithm depends on the values of the
-fields of the special file name. When in doubt, *note
-table-inet-components:: gives you the combinations of values and their
-meaning. If this table is too complicated, focus on the three lines
-printed in *bold*. All the examples in *note Networking With `gawk':
+fields of the special file name. When in doubt, *note Table 2.1:
+table-inet-components. gives you the combinations of values and their
+meaning. If this table is too complicated, focus on the three lines
+printed in *bold*. All the examples in *note Networking With 'gawk':
Using Networking, use only the patterns printed in bold letters.
-PROTOCOL LOCAL PORT HOST NAME REMOTE RESULTING CONNECTION-LEVEL
- PORT BEHAVIOR
-------------------------------------------------------------------------------
-*tcp* *0* *x* *x* *Dedicated client, fails if
+PROTOCOL LOCAL HOST NAME REMOTE RESULTING CONNECTION-LEVEL
+ PORT PORT BEHAVIOR
+------------------------------------------------------------------------------
+*tcp* *0* *x* *x* *Dedicated client, fails if
immediately connecting to a
- server on the
- other side fails*
+ server on the other side
+ fails*
udp 0 x x Dedicated client
-*tcp, udp* *x* *x* *x* *Client, switches to
- dedicated server if
+*tcp, *x* *x* *x* *Client, switches to
+udp* dedicated server if
necessary*
-*tcp, udp* *x* *0* *0* *Dedicated server*
+*tcp, *x* *0* *0* *Dedicated server*
+udp*
tcp, udp x x 0 Invalid
tcp, udp 0 0 x Invalid
tcp, udp x 0 x Invalid
@@ -626,7 +623,7 @@ File: gawkinet.info, Node: Comparing Protocols, Prev: Special File Fields, Up
-------------------------
This node develops a pair of programs (sender and receiver) that do
-nothing but send a timestamp from one machine to another. The sender
+nothing but send a timestamp from one machine to another. The sender
and the receiver are implemented with each of the two protocols
available and demonstrate the differences between them.
@@ -638,10 +635,10 @@ available and demonstrate the differences between them.

File: gawkinet.info, Node: File /inet/tcp, Next: File /inet/udp, Prev: Comparing Protocols, Up: Comparing Protocols
-2.1.2.1 `/inet/tcp'
+2.1.2.1 '/inet/tcp'
...................
-Once again, always use TCP. (Use UDP when low overhead is a necessity,
+Once again, always use TCP. (Use UDP when low overhead is a necessity,
and use RAW for network experimentation.) The first example is the
sender program:
@@ -661,21 +658,21 @@ sender program:
}
TCP guarantees that the bytes arrive at the receiving end in exactly
-the same order that they were sent. No byte is lost (except for broken
-connections), doubled, or out of order. Some overhead is necessary to
+the same order that they were sent. No byte is lost (except for broken
+connections), doubled, or out of order. Some overhead is necessary to
accomplish this, but this is the price to pay for a reliable service.
-It does matter which side starts first. The sender/server has to be
+It does matter which side starts first. The sender/server has to be
started first, and it waits for the receiver to read a line.

File: gawkinet.info, Node: File /inet/udp, Prev: File /inet/tcp, Up: Comparing Protocols
-2.1.2.2 `/inet/udp'
+2.1.2.2 '/inet/udp'
...................
The server and client programs that use UDP are almost identical to
-their TCP counterparts; only the PROTOCOL has changed. As before, it
-does matter which side starts first. The receiving side blocks and
+their TCP counterparts; only the PROTOCOL has changed. As before, it
+does matter which side starts first. The receiving side blocks and
waits for the sender. In this case, the receiver/client has to be
started first:
@@ -695,10 +692,11 @@ started first:
}
UDP cannot guarantee that the datagrams at the receiving end will
-arrive in exactly the same order they were sent. Some datagrams could be
-lost, some doubled, and some out of order. But no overhead is necessary
-to accomplish this. This unreliable behavior is good enough for tasks
-such as data acquisition, logging, and even stateless services like NFS.
+arrive in exactly the same order they were sent. Some datagrams could
+be lost, some doubled, and some out of order. But no overhead is
+necessary to accomplish this. This unreliable behavior is good enough
+for tasks such as data acquisition, logging, and even stateless services
+like NFS.

File: gawkinet.info, Node: TCP Connecting, Next: Troubleshooting, Prev: Gawk Special Files, Up: Using Networking
@@ -706,10 +704,10 @@ File: gawkinet.info, Node: TCP Connecting, Next: Troubleshooting, Prev: Gawk
2.2 Establishing a TCP Connection
=================================
-Let's observe a network connection at work. Type in the following
-program and watch the output. Within a second, it connects via TCP
-(`/inet/tcp') to the machine it is running on (`localhost') and asks
-the service `daytime' on the machine what time it is:
+Let's observe a network connection at work. Type in the following
+program and watch the output. Within a second, it connects via TCP
+('/inet/tcp') to the machine it is running on ('localhost') and asks the
+service 'daytime' on the machine what time it is:
BEGIN {
"/inet/tcp/0/localhost/daytime" |& getline
@@ -717,39 +715,39 @@ the service `daytime' on the machine what time it is:
close("/inet/tcp/0/localhost/daytime")
}
- Even experienced `awk' users will find the second line strange in two
+ Even experienced 'awk' users will find the second line strange in two
respects:
* A special file is used as a shell command that pipes its output
- into `getline'. One would rather expect to see the special file
- being read like any other file (`getline <
+ into 'getline'. One would rather expect to see the special file
+ being read like any other file ('getline <
"/inet/tcp/0/localhost/daytime")'.
- * The operator `|&' has not been part of any `awk' implementation
- (until now). It is actually the only extension of the `awk'
- language needed (apart from the special files) to introduce
- network access.
+ * The operator '|&' has not been part of any 'awk' implementation
+ (until now). It is actually the only extension of the 'awk'
+ language needed (apart from the special files) to introduce network
+ access.
- The `|&' operator was introduced in `gawk' 3.1 in order to overcome
-the crucial restriction that access to files and pipes in `awk' is
-always unidirectional. It was formerly impossible to use both access
-modes on the same file or pipe. Instead of changing the whole concept
-of file access, the `|&' operator behaves exactly like the usual pipe
+ The '|&' operator was introduced in 'gawk' 3.1 in order to overcome
+the crucial restriction that access to files and pipes in 'awk' is
+always unidirectional. It was formerly impossible to use both access
+modes on the same file or pipe. Instead of changing the whole concept
+of file access, the '|&' operator behaves exactly like the usual pipe
operator except for two additions:
- * Normal shell commands connected to their `gawk' program with a `|&'
- pipe can be accessed bidirectionally. The `|&' turns out to be a
- quite general, useful, and natural extension of `awk'.
+ * Normal shell commands connected to their 'gawk' program with a '|&'
+ pipe can be accessed bidirectionally. The '|&' turns out to be a
+ quite general, useful, and natural extension of 'awk'.
* Pipes that consist of a special file name for network connections
- are not executed as shell commands. Instead, they can be read and
+ are not executed as shell commands. Instead, they can be read and
written to, just like a full-duplex network connection.
- In the earlier example, the `|&' operator tells `getline' to read a
-line from the special file `/inet/tcp/0/localhost/daytime'. We could
-also have printed a line into the special file. But instead we just
+ In the earlier example, the '|&' operator tells 'getline' to read a
+line from the special file '/inet/tcp/0/localhost/daytime'. We could
+also have printed a line into the special file. But instead we just
read a line with the time, printed it, and closed the connection.
-(While we could just let `gawk' close the connection by finishing the
+(While we could just let 'gawk' close the connection by finishing the
program, in this Info file we are pedantic and always explicitly close
the connections.)
@@ -760,23 +758,23 @@ File: gawkinet.info, Node: Troubleshooting, Next: Interacting, Prev: TCP Conn
=======================================
It may well be that for some reason the program shown in the previous
-example does not run on your machine. When looking at possible reasons
+example does not run on your machine. When looking at possible reasons
for this, you will learn much about typical problems that arise in
-network programming. First of all, your implementation of `gawk' may
-not support network access because it is a pre-3.1 version or you do
-not have a network interface in your machine. Perhaps your machine
-uses some other protocol, such as DECnet or Novell's IPX. For the rest
-of this major node, we will assume you work on a Unix machine that
-supports TCP/IP. If the previous example program does not run on your
-machine, it may help to replace the name `localhost' with the name of
-your machine or its IP address. If it does, you could replace
-`localhost' with the name of another machine in your vicinity--this
-way, the program connects to another machine. Now you should see the
-date and time being printed by the program, otherwise your machine may
-not support the `daytime' service. Try changing the service to
-`chargen' or `ftp'. This way, the program connects to other services
-that should give you some response. If you are curious, you should have
-a look at your `/etc/services' file. It could look like this:
+network programming. First of all, your implementation of 'gawk' may
+not support network access because it is a pre-3.1 version or you do not
+have a network interface in your machine. Perhaps your machine uses
+some other protocol, such as DECnet or Novell's IPX. For the rest of
+this major node, we will assume you work on a Unix machine that supports
+TCP/IP. If the previous example program does not run on your machine, it
+may help to replace the name 'localhost' with the name of your machine
+or its IP address. If it does, you could replace 'localhost' with the
+name of another machine in your vicinity--this way, the program connects
+to another machine. Now you should see the date and time being printed
+by the program, otherwise your machine may not support the 'daytime'
+service. Try changing the service to 'chargen' or 'ftp'. This way, the
+program connects to other services that should give you some response.
+If you are curious, you should have a look at your '/etc/services' file.
+It could look like this:
# /etc/services:
#
@@ -808,26 +806,26 @@ a look at your `/etc/services' file. It could look like this:
...
Here, you find a list of services that traditional Unix machines
-usually support. If your GNU/Linux machine does not do so, it may be
-that these services are switched off in some startup script. Systems
+usually support. If your GNU/Linux machine does not do so, it may be
+that these services are switched off in some startup script. Systems
running some flavor of Microsoft Windows usually do _not_ support these
-services. Nevertheless, it _is_ possible to do networking with `gawk'
-on Microsoft Windows.(1) The first column of the file gives the name of
+services. Nevertheless, it _is_ possible to do networking with 'gawk'
+on Microsoft Windows.(1) The first column of the file gives the name of
the service, and the second column gives a unique number and the
protocol that one can use to connect to this service. The rest of the
-line is treated as a comment. You see that some services (`echo')
+line is treated as a comment. You see that some services ('echo')
support TCP as well as UDP.
---------- Footnotes ----------
(1) Microsoft preferred to ignore the TCP/IP family of protocols
-until 1995. Then came the rise of the Netscape browser as a landmark
-"killer application." Microsoft added TCP/IP support and their own
-browser to Microsoft Windows 95 at the last minute. They even
+until 1995. Then came the rise of the Netscape browser as a landmark
+"killer application." Microsoft added TCP/IP support and their own
+browser to Microsoft Windows 95 at the last minute. They even
back-ported their TCP/IP implementation to Microsoft Windows for
Workgroups 3.11, but it was a rather rudimentary and half-hearted
-implementation. Nevertheless, the equivalent of `/etc/services' resides
-under `C:\WINNT\system32\drivers\etc\services' on Microsoft Windows 2000
+implementation. Nevertheless, the equivalent of '/etc/services' resides
+under 'C:\WINNT\system32\drivers\etc\services' on Microsoft Windows 2000
and Microsoft Windows XP.

@@ -837,10 +835,10 @@ File: gawkinet.info, Node: Interacting, Next: Setting Up, Prev: Troubleshooti
======================================
The next program makes use of the possibility to really interact with a
-network service by printing something into the special file. It asks the
-so-called `finger' service if a user of the machine is logged in. When
-testing this program, try to change `localhost' to some other machine
-name in your local network:
+network service by printing something into the special file. It asks
+the so-called 'finger' service if a user of the machine is logged in.
+When testing this program, try to change 'localhost' to some other
+machine name in your local network:
BEGIN {
NetService = "/inet/tcp/0/localhost/finger"
@@ -851,39 +849,39 @@ name in your local network:
}
After telling the service on the machine which user to look for, the
-program repeatedly reads lines that come as a reply. When no more lines
+program repeatedly reads lines that come as a reply. When no more lines
are coming (because the service has closed the connection), the program
-also closes the connection. Try replacing `"NAME"' with your login name
+also closes the connection. Try replacing '"NAME"' with your login name
(or the name of someone else logged in). For a list of all users
-currently logged in, replace NAME with an empty string (`""').
+currently logged in, replace NAME with an empty string ('""').
- The final `close' command could be safely deleted from the above
+ The final 'close' command could be safely deleted from the above
script, because the operating system closes any open connection by
-default when a script reaches the end of execution. In order to avoid
+default when a script reaches the end of execution. In order to avoid
portability problems, it is best to always close connections explicitly.
With the Linux kernel, for example, proper closing results in flushing
-of buffers. Letting the close happen by default may result in
+of buffers. Letting the close happen by default may result in
discarding buffers.
- When looking at `/etc/services' you may have noticed that the
-`daytime' service is also available with `udp'. In the earlier example,
-change `tcp' to `udp', and change `finger' to `daytime'. After
-starting the modified program, you see the expected day and time
-message. The program then hangs, because it waits for more lines
-coming from the service. However, they never come. This behavior is a
-consequence of the differences between TCP and UDP. When using UDP,
-neither party is automatically informed about the other closing the
-connection. Continuing to experiment this way reveals many other subtle
-differences between TCP and UDP. To avoid such trouble, one should
-always remember the advice Douglas E. Comer and David Stevens give in
-Volume III of their series `Internetworking With TCP' (page 14):
+ When looking at '/etc/services' you may have noticed that the
+'daytime' service is also available with 'udp'. In the earlier example,
+change 'tcp' to 'udp', and change 'finger' to 'daytime'. After starting
+the modified program, you see the expected day and time message. The
+program then hangs, because it waits for more lines coming from the
+service. However, they never come. This behavior is a consequence of
+the differences between TCP and UDP. When using UDP, neither party is
+automatically informed about the other closing the connection.
+Continuing to experiment this way reveals many other subtle differences
+between TCP and UDP. To avoid such trouble, one should always remember
+the advice Douglas E. Comer and David Stevens give in Volume III of
+their series 'Internetworking With TCP' (page 14):
When designing client-server applications, beginners are strongly
advised to use TCP because it provides reliable,
- connection-oriented communication. Programs only use UDP if the
+ connection-oriented communication. Programs only use UDP if the
application protocol handles reliability, the application requires
- hardware broadcast or multicast, or the application cannot
- tolerate virtual circuit overhead.
+ hardware broadcast or multicast, or the application cannot tolerate
+ virtual circuit overhead.

File: gawkinet.info, Node: Setting Up, Next: Email, Prev: Interacting, Up: Using Networking
@@ -892,17 +890,17 @@ File: gawkinet.info, Node: Setting Up, Next: Email, Prev: Interacting, Up: U
========================
The preceding programs behaved as clients that connect to a server
-somewhere on the Internet and request a particular service. Now we set
-up such a service to mimic the behavior of the `daytime' service. Such
-a server does not know in advance who is going to connect to it over
-the network. Therefore, we cannot insert a name for the host to connect
-to in our special file name.
-
- Start the following program in one window. Notice that the service
-does not have the name `daytime', but the number `8888'. From looking
-at `/etc/services', you know that names like `daytime' are just
+somewhere on the Internet and request a particular service. Now we set
+up such a service to mimic the behavior of the 'daytime' service. Such
+a server does not know in advance who is going to connect to it over the
+network. Therefore, we cannot insert a name for the host to connect to
+in our special file name.
+
+ Start the following program in one window. Notice that the service
+does not have the name 'daytime', but the number '8888'. From looking
+at '/etc/services', you know that names like 'daytime' are just
mnemonics for predetermined 16-bit integers. Only the system
-administrator (`root') could enter our new service into `/etc/services'
+administrator ('root') could enter our new service into '/etc/services'
with an appropriate name. Also notice that the service name has to be
entered into a different field of the special file name because we are
setting up a server, not a client:
@@ -912,35 +910,35 @@ setting up a server, not a client:
close("/inet/tcp/8888/0/0")
}
- Now open another window on the same machine. Copy the client
-program given as the first example (*note Establishing a TCP
-Connection: TCP Connecting.) to a new file and edit it, changing the
-name `daytime' to `8888'. Then start the modified client. You should
-get a reply like this:
+ Now open another window on the same machine. Copy the client program
+given as the first example (*note Establishing a TCP Connection: TCP
+Connecting.) to a new file and edit it, changing the name 'daytime' to
+'8888'. Then start the modified client. You should get a reply like
+this:
Sat Sep 27 19:08:16 CEST 1997
Both programs explicitly close the connection.
- Now we will intentionally make a mistake to see what happens when
-the name `8888' (the so-called port) is already used by another service.
-Start the server program in both windows. The first one works, but the
-second one complains that it could not open the connection. Each port
+ Now we will intentionally make a mistake to see what happens when the
+name '8888' (the so-called port) is already used by another service.
+Start the server program in both windows. The first one works, but the
+second one complains that it could not open the connection. Each port
on a single machine can only be used by one server program at a time.
-Now terminate the server program and change the name `8888' to `echo'.
+Now terminate the server program and change the name '8888' to 'echo'.
After restarting it, the server program does not run any more, and you
-know why: there is already an `echo' service running on your machine.
-But even if this isn't true, you would not get your own `echo' server
+know why: there is already an 'echo' service running on your machine.
+But even if this isn't true, you would not get your own 'echo' server
running on a Unix machine, because the ports with numbers smaller than
-1024 (`echo' is at port 7) are reserved for `root'. On machines
-running some flavor of Microsoft Windows, there is no restriction that
-reserves ports 1 to 1024 for a privileged user; hence, you can start an
-`echo' server there.
+1024 ('echo' is at port 7) are reserved for 'root'. On machines running
+some flavor of Microsoft Windows, there is no restriction that reserves
+ports 1 to 1024 for a privileged user; hence, you can start an 'echo'
+server there.
Turning this short server program into something really useful is
simple. Imagine a server that first reads a file name from the client
through the network connection, then does something with the file and
-sends a result back to the client. The server-side processing could be:
+sends a result back to the client. The server-side processing could be:
BEGIN {
NetService = "/inet/tcp/8888/0/0"
@@ -951,13 +949,13 @@ sends a result back to the client. The server-side processing could be:
close(NetService)
}
-and we would have a remote copying facility. Such a server reads the
+and we would have a remote copying facility. Such a server reads the
name of a file from any client that connects to it and transmits the
-contents of the named file across the net. The server-side processing
+contents of the named file across the net. The server-side processing
could also be the execution of a command that is transmitted across the
-network. From this example, you can see how simple it is to open up a
-security hole on your machine. If you allow clients to connect to your
-machine and execute arbitrary commands, anyone would be free to do `rm
+network. From this example, you can see how simple it is to open up a
+security hole on your machine. If you allow clients to connect to your
+machine and execute arbitrary commands, anyone would be free to do 'rm
-rf *'.

@@ -967,16 +965,16 @@ File: gawkinet.info, Node: Email, Next: Web page, Prev: Setting Up, Up: Usin
=================
The distribution of email is usually done by dedicated email servers
-that communicate with your machine using special protocols. To receive
-email, we will use the Post Office Protocol (POP). Sending can be done
+that communicate with your machine using special protocols. To receive
+email, we will use the Post Office Protocol (POP). Sending can be done
with the much older Simple Mail Transfer Protocol (SMTP).
When you type in the following program, replace the EMAILHOST by the
-name of your local email server. Ask your administrator if the server
+name of your local email server. Ask your administrator if the server
has a POP service, and then use its name or number in the program below.
Now the program is ready to connect to your email server, but it will
not succeed in retrieving your mail because it does not yet know your
-login name or password. Replace them in the program and it shows you
+login name or password. Replace them in the program and it shows you
the first email the server has in store:
BEGIN {
@@ -996,16 +994,16 @@ the first email the server has in store:
close(POPService)
}
- The record separators `RS' and `ORS' are redefined because the
-protocol (POP) requires CR-LF to separate lines. After identifying
-yourself to the email service, the command `retr 1' instructs the
-service to send the first of all your email messages in line. If the
-service replies with something other than `+OK', the program exits;
-maybe there is no email. Otherwise, the program first announces that it
-intends to finish reading email, and then redefines `RS' in order to
-read the entire email as multiline input in one record. From the POP
+ The record separators 'RS' and 'ORS' are redefined because the
+protocol (POP) requires CR-LF to separate lines. After identifying
+yourself to the email service, the command 'retr 1' instructs the
+service to send the first of all your email messages in line. If the
+service replies with something other than '+OK', the program exits;
+maybe there is no email. Otherwise, the program first announces that it
+intends to finish reading email, and then redefines 'RS' in order to
+read the entire email as multiline input in one record. From the POP
RFC, we know that the body of the email always ends with a single line
-containing a single dot. The program looks for this using `RS =
+containing a single dot. The program looks for this using 'RS =
"\r\n\\.\r\n"'. When it finds this sequence in the mail message, it
quits. You can invoke this program as often as you like; it does not
delete the message it reads, but instead leaves it on the server.
@@ -1016,20 +1014,19 @@ File: gawkinet.info, Node: Web page, Next: Primitive Service, Prev: Email, U
2.7 Reading a Web Page
======================
-Retrieving a web page from a web server is as simple as retrieving
-email from an email server. We only have to use a similar, but not
-identical, protocol and a different port. The name of the protocol is
-HyperText Transfer Protocol (HTTP) and the port number is usually 80.
-As in the preceding node, ask your administrator about the name of your
-local web server or proxy web server and its port number for HTTP
-requests.
+Retrieving a web page from a web server is as simple as retrieving email
+from an email server. We only have to use a similar, but not identical,
+protocol and a different port. The name of the protocol is HyperText
+Transfer Protocol (HTTP) and the port number is usually 80. As in the
+preceding node, ask your administrator about the name of your local web
+server or proxy web server and its port number for HTTP requests.
The following program employs a rather crude approach toward
-retrieving a web page. It uses the prehistoric syntax of HTTP 0.9,
-which almost all web servers still support. The most noticeable thing
+retrieving a web page. It uses the prehistoric syntax of HTTP 0.9,
+which almost all web servers still support. The most noticeable thing
about it is that the program directs the request to the local proxy
server whose name you insert in the special file name (which in turn
-calls `www.yahoo.com'):
+calls 'www.yahoo.com'):
BEGIN {
RS = ORS = "\r\n"
@@ -1040,29 +1037,29 @@ calls `www.yahoo.com'):
close(HttpService)
}
- Again, lines are separated by a redefined `RS' and `ORS'. The `GET'
-request that we send to the server is the only kind of HTTP request
-that existed when the web was created in the early 1990s. HTTP calls
-this `GET' request a "method," which tells the service to transmit a
-web page (here the home page of the Yahoo! search engine). Version 1.0
-added the request methods `HEAD' and `POST'. The current version of
-HTTP is 1.1,(1) and knows the additional request methods `OPTIONS',
-`PUT', `DELETE', and `TRACE'. You can fill in any valid web address,
-and the program prints the HTML code of that page to your screen.
+ Again, lines are separated by a redefined 'RS' and 'ORS'. The 'GET'
+request that we send to the server is the only kind of HTTP request that
+existed when the web was created in the early 1990s. HTTP calls this
+'GET' request a "method," which tells the service to transmit a web page
+(here the home page of the Yahoo! search engine). Version 1.0 added
+the request methods 'HEAD' and 'POST'. The current version of HTTP is
+1.1,(1) and knows the additional request methods 'OPTIONS', 'PUT',
+'DELETE', and 'TRACE'. You can fill in any valid web address, and the
+program prints the HTML code of that page to your screen.
Notice the similarity between the responses of the POP and HTTP
-services. First, you get a header that is terminated by an empty line,
-and then you get the body of the page in HTML. The lines of the
-headers also have the same form as in POP. There is the name of a
-parameter, then a colon, and finally the value of that parameter.
+services. First, you get a header that is terminated by an empty line,
+and then you get the body of the page in HTML. The lines of the headers
+also have the same form as in POP. There is the name of a parameter,
+then a colon, and finally the value of that parameter.
- Images (`.png' or `.gif' files) can also be retrieved this way, but
-then you get binary data that should be redirected into a file. Another
+ Images ('.png' or '.gif' files) can also be retrieved this way, but
+then you get binary data that should be redirected into a file. Another
application is calling a CGI (Common Gateway Interface) script on some
-server. CGI scripts are used when the contents of a web page are not
+server. CGI scripts are used when the contents of a web page are not
constant, but generated instantly at the moment you send a request for
-the page. For example, to get a detailed report about the current
-quotes of Motorola stock shares, call a CGI script at Yahoo! with the
+the page. For example, to get a detailed report about the current
+quotes of Motorola stock shares, call a CGI script at Yahoo! with the
following:
get = "GET http://quote.yahoo.com/q?s=MOT&d=t"
@@ -1073,7 +1070,7 @@ following:
---------- Footnotes ----------
(1) Version 1.0 of HTTP was defined in RFC 1945. HTTP 1.1 was
-initially specified in RFC 2068. In June 1999, RFC 2068 was made
+initially specified in RFC 2068. In June 1999, RFC 2068 was made
obsolete by RFC 2616, an update without any substantial changes.

@@ -1083,31 +1080,31 @@ File: gawkinet.info, Node: Primitive Service, Next: Interacting Service, Prev
===========================
Now we know enough about HTTP to set up a primitive web service that
-just says `"Hello, world"' when someone connects to it with a browser.
-Compared to the situation in the preceding node, our program changes
-the role. It tries to behave just like the server we have observed.
-Since we are setting up a server here, we have to insert the port
-number in the `localport' field of the special file name. The other two
-fields (HOSTNAME and REMOTEPORT) have to contain a `0' because we do
-not know in advance which host will connect to our service.
+just says '"Hello, world"' when someone connects to it with a browser.
+Compared to the situation in the preceding node, our program changes the
+role. It tries to behave just like the server we have observed. Since
+we are setting up a server here, we have to insert the port number in
+the 'localport' field of the special file name. The other two fields
+(HOSTNAME and REMOTEPORT) have to contain a '0' because we do not know
+in advance which host will connect to our service.
In the early 1990s, all a server had to do was send an HTML document
-and close the connection. Here, we adhere to the modern syntax of HTTP.
+and close the connection. Here, we adhere to the modern syntax of HTTP.
The steps are as follows:
1. Send a status line telling the web browser that everything is okay.
2. Send a line to tell the browser how many bytes follow in the body
- of the message. This was not necessary earlier because both
+ of the message. This was not necessary earlier because both
parties knew that the document ended when the connection closed.
- Nowadays it is possible to stay connected after the transmission
- of one web page. This is to avoid the network traffic necessary
- for repeatedly establishing TCP connections for requesting several
- images. Thus, there is the need to tell the receiving party how
- many bytes will be sent. The header is terminated as usual with an
+ Nowadays it is possible to stay connected after the transmission of
+ one web page. This is to avoid the network traffic necessary for
+ repeatedly establishing TCP connections for requesting several
+ images. Thus, there is the need to tell the receiving party how
+ many bytes will be sent. The header is terminated as usual with an
empty line.
- 3. Send the `"Hello, world"' body in HTML. The useless `while' loop
+ 3. Send the '"Hello, world"' body in HTML. The useless 'while' loop
swallows the request of the browser. We could actually omit the
loop, and on most machines the program would still work. First,
start the following program:
@@ -1128,8 +1125,8 @@ The steps are as follows:
}
Now, on the same machine, start your favorite browser and let it
-point to `http://localhost:8080' (the browser needs to know on which
-port our server is listening for requests). If this does not work, the
+point to <http://localhost:8080> (the browser needs to know on which
+port our server is listening for requests). If this does not work, the
browser probably tries to connect to a proxy server that does not know
your machine. If so, change the browser's configuration so that the
browser does not try to use a proxy to connect to your machine.
@@ -1149,14 +1146,14 @@ Applications and Techniques::.
* CGI Lib:: A simple CGI library.
Setting up a web service that allows user interaction is more
-difficult and shows us the limits of network access in `gawk'. In this
-node, we develop a main program (a `BEGIN' pattern and its action)
-that will become the core of event-driven execution controlled by a
-graphical user interface (GUI). Each HTTP event that the user triggers
-by some action within the browser is received in this central
-procedure. Parameters and menu choices are extracted from this request,
-and an appropriate measure is taken according to the user's choice.
-For example:
+difficult and shows us the limits of network access in 'gawk'. In this
+node, we develop a main program (a 'BEGIN' pattern and its action) that
+will become the core of event-driven execution controlled by a graphical
+user interface (GUI). Each HTTP event that the user triggers by some
+action within the browser is received in this central procedure.
+Parameters and menu choices are extracted from this request, and an
+appropriate measure is taken according to the user's choice. For
+example:
BEGIN {
if (MyHost == "") {
@@ -1205,17 +1202,17 @@ For example:
This web server presents menu choices in the form of HTML links.
Therefore, it has to tell the browser the name of the host it is
-residing on. When starting the server, the user may supply the name of
-the host from the command line with `gawk -v MyHost="Rumpelstilzchen"'.
+residing on. When starting the server, the user may supply the name of
+the host from the command line with 'gawk -v MyHost="Rumpelstilzchen"'.
If the user does not do this, the server looks up the name of the host
-it is running on for later use as a web address in HTML documents. The
-same applies to the port number. These values are inserted later into
+it is running on for later use as a web address in HTML documents. The
+same applies to the port number. These values are inserted later into
the HTML content of the web pages to refer to the home system.
Each server that is built around this core has to initialize some
application-dependent variables (such as the default home page) in a
-procedure `SetUpServer', which is called immediately before entering the
-infinite loop of the server. For now, we will write an instance that
+procedure 'SetUpServer', which is called immediately before entering the
+infinite loop of the server. For now, we will write an instance that
initiates a trivial interaction. With this home page, the client user
can click on two possible choices, and receive the current date either
in human-readable format or in seconds since 1970:
@@ -1233,33 +1230,33 @@ in human-readable format or in seconds since 1970:
On the first run through the main loop, the default line terminators
are set and the default home page is copied to the actual home page.
-Since this is the first run, `GETARG["Method"]' is not initialized yet,
-hence the case selection over the method does nothing. Now that the
-home page is initialized, the server can start communicating to a
-client browser.
+Since this is the first run, 'GETARG["Method"]' is not initialized yet,
+hence the case selection over the method does nothing. Now that the
+home page is initialized, the server can start communicating to a client
+browser.
It does so by printing the HTTP header into the network connection
-(`print ... |& HttpService'). This command blocks execution of the
-server script until a client connects. If this server script is
+('print ... |& HttpService'). This command blocks execution of the
+server script until a client connects. If this server script is
compared with the primitive one we wrote before, you will notice two
-additional lines in the header. The first instructs the browser to
-close the connection after each request. The second tells the browser
+additional lines in the header. The first instructs the browser to
+close the connection after each request. The second tells the browser
that it should never try to _remember_ earlier requests that had
-identical web addresses (no caching). Otherwise, it could happen that
+identical web addresses (no caching). Otherwise, it could happen that
the browser retrieves the time of day in the previous example just once,
and later it takes the web page from the cache, always displaying the
same time of day although time advances each second.
Having supplied the initial home page to the browser with a valid
-document stored in the parameter `Prompt', it closes the connection and
+document stored in the parameter 'Prompt', it closes the connection and
waits for the next request. When the request comes, a log line is
-printed that allows us to see which request the server receives. The
-final step in the loop is to call the function `CGI_setup', which reads
+printed that allows us to see which request the server receives. The
+final step in the loop is to call the function 'CGI_setup', which reads
all the lines of the request (coming from the browser), processes them,
-and stores the transmitted parameters in the array `PARAM'. The complete
-text of these application-independent functions can be found in *note A
-Simple CGI Library: CGI Lib. For now, we use a simplified version of
-`CGI_setup':
+and stores the transmitted parameters in the array 'PARAM'. The
+complete text of these application-independent functions can be found in
+*note A Simple CGI Library: CGI Lib. For now, we use a simplified
+version of 'CGI_setup':
function CGI_setup( method, uri, version, i) {
delete GETARG; delete MENU; delete PARAM
@@ -1282,30 +1279,30 @@ Simple CGI Library: CGI Lib. For now, we use a simplified version of
}
At first, the function clears all variables used for global storage
-of request parameters. The rest of the function serves the purpose of
+of request parameters. The rest of the function serves the purpose of
filling the global parameters with the extracted new values. To
accomplish this, the name of the requested resource is split into parts
-and stored for later evaluation. If the request contains a `?', then
+and stored for later evaluation. If the request contains a '?', then
the request has CGI variables seamlessly appended to the web address.
-Everything in front of the `?' is split up into menu items, and
-everything behind the `?' is a list of `VARIABLE=VALUE' pairs
-(separated by `&') that also need splitting. This way, CGI variables are
-isolated and stored. This procedure lacks recognition of special
-characters that are transmitted in coded form(1). Here, any optional
-request header and body parts are ignored. We do not need header
-parameters and the request body. However, when refining our approach or
-working with the `POST' and `PUT' methods, reading the header and body
-becomes inevitable. Header parameters should then be stored in a global
-array as well as the body.
+Everything in front of the '?' is split up into menu items, and
+everything behind the '?' is a list of 'VARIABLE=VALUE' pairs (separated
+by '&') that also need splitting. This way, CGI variables are isolated
+and stored. This procedure lacks recognition of special characters that
+are transmitted in coded form(1). Here, any optional request header and
+body parts are ignored. We do not need header parameters and the
+request body. However, when refining our approach or working with the
+'POST' and 'PUT' methods, reading the header and body becomes
+inevitable. Header parameters should then be stored in a global array
+as well as the body.
On each subsequent run through the main loop, one request from a
browser is received, evaluated, and answered according to the user's
-choice. This can be done by letting the value of the HTTP method guide
-the main loop into execution of the procedure `HandleGET', which
-evaluates the user's choice. In this case, we have only one
+choice. This can be done by letting the value of the HTTP method guide
+the main loop into execution of the procedure 'HandleGET', which
+evaluates the user's choice. In this case, we have only one
hierarchical level of menus, but in the general case, menus are nested.
-The menu choices at each level are separated by `/', just as in file
-names. Notice how simple it is to construct menus of arbitrary depth:
+The menu choices at each level are separated by '/', just as in file
+names. Notice how simple it is to construct menus of arbitrary depth:
function HandleGET() {
if ( MENU[2] == "human") {
@@ -1316,19 +1313,19 @@ names. Notice how simple it is to construct menus of arbitrary depth:
}
The disadvantage of this approach is that our server is slow and can
-handle only one request at a time. Its main advantage, however, is that
-the server consists of just one `gawk' program. No need for installing
-an `httpd', and no need for static separate HTML files, CGI scripts, or
-`root' privileges. This is rapid prototyping. This program can be
+handle only one request at a time. Its main advantage, however, is that
+the server consists of just one 'gawk' program. No need for installing
+an 'httpd', and no need for static separate HTML files, CGI scripts, or
+'root' privileges. This is rapid prototyping. This program can be
started on the same host that runs your browser. Then let your browser
-point to `http://localhost:8080'.
+point to <http://localhost:8080>.
It is also possible to include images into the HTML pages. Most
-browsers support the not very well-known `.xbm' format, which may
-contain only monochrome pictures but is an ASCII format. Binary images
-are possible but not so easy to handle. Another way of including images
+browsers support the not very well-known '.xbm' format, which may
+contain only monochrome pictures but is an ASCII format. Binary images
+are possible but not so easy to handle. Another way of including images
is to generate them with a tool such as GNUPlot, by calling the tool
-with the `system' function or through a pipe.
+with the 'system' function or through a pipe.
---------- Footnotes ----------
@@ -1343,25 +1340,25 @@ File: gawkinet.info, Node: CGI Lib, Prev: Interacting Service, Up: Interactin
HTTP is like being married: you have to be able to handle whatever
you're given, while being very careful what you send back.
Phil Smith III,
- `http://www.netfunny.com/rhf/jokes/99/Mar/http.html'
+ <http://www.netfunny.com/rhf/jokes/99/Mar/http.html>
In *note A Web Service with Interaction: Interacting Service, we saw
-the function `CGI_setup' as part of the web server "core logic"
-framework. The code presented there handles almost everything necessary
+the function 'CGI_setup' as part of the web server "core logic"
+framework. The code presented there handles almost everything necessary
for CGI requests. One thing it doesn't do is handle encoded characters
-in the requests. For example, an `&' is encoded as a percent sign
-followed by the hexadecimal value: `%26'. These encoded values should
-be decoded. Following is a simple library to perform these tasks.
-This code is used for all web server examples used throughout the rest
-of this Info file. If you want to use it for your own web server,
-store the source code into a file named `inetlib.awk'. Then you can
-include these functions into your code by placing the following
-statement into your program (on the first line of your script):
+in the requests. For example, an '&' is encoded as a percent sign
+followed by the hexadecimal value: '%26'. These encoded values should
+be decoded. Following is a simple library to perform these tasks. This
+code is used for all web server examples used throughout the rest of
+this Info file. If you want to use it for your own web server, store
+the source code into a file named 'inetlib.awk'. Then you can include
+these functions into your code by placing the following statement into
+your program (on the first line of your script):
@include inetlib.awk
But beware, this mechanism is only possible if you invoke your web
-server script with `igawk' instead of the usual `awk' or `gawk'. Here
+server script with 'igawk' instead of the usual 'awk' or 'gawk'. Here
is the code:
# CGI Library and core of a web server
@@ -1446,11 +1443,11 @@ is the code:
MENU[i] = _CGI_decode(MENU[i])
}
- This isolates details in a single function, `CGI_setup'. Decoding
-of encoded characters is pushed off to a helper function,
-`_CGI_decode'. The use of the leading underscore (`_') in the function
-name is intended to indicate that it is an "internal" function,
-although there is nothing to enforce this:
+ This isolates details in a single function, 'CGI_setup'. Decoding of
+encoded characters is pushed off to a helper function, '_CGI_decode'.
+The use of the leading underscore ('_') in the function name is intended
+to indicate that it is an "internal" function, although there is nothing
+to enforce this:
function _CGI_decode(str, hexdigs, i, pre, code1, code2,
val, result)
@@ -1482,10 +1479,10 @@ although there is nothing to enforce this:
This works by splitting the string apart around an encoded character.
The two digits are converted to lowercase characters and looked up in a
-string of hex digits. Note that `0' is not in the string on purpose;
-`index' returns zero when it's not found, automatically giving the
+string of hex digits. Note that '0' is not in the string on purpose;
+'index' returns zero when it's not found, automatically giving the
correct value! Once the hexadecimal value is converted from characters
-in a string into a numerical value, `sprintf' converts the value back
+in a string into a numerical value, 'sprintf' converts the value back
into a real character. The following is a simple test harness for the
above functions:
@@ -1530,14 +1527,14 @@ File: gawkinet.info, Node: Simple Server, Next: Caveats, Prev: Interacting Se
In the preceding node, we built the core logic for event-driven GUIs.
In this node, we finally extend the core to a real application. No one
-would actually write a commercial web server in `gawk', but it is
+would actually write a commercial web server in 'gawk', but it is
instructive to see that it is feasible in principle.
The application is ELIZA, the famous program by Joseph Weizenbaum
that mimics the behavior of a professional psychotherapist when talking
-to you. Weizenbaum would certainly object to this description, but
-this is part of the legend around ELIZA. Take the site-independent
-core logic and append the following code:
+to you. Weizenbaum would certainly object to this description, but this
+is part of the legend around ELIZA. Take the site-independent core logic
+and append the following code:
function SetUpServer() {
SetUpEliza()
@@ -1561,22 +1558,22 @@ core logic and append the following code:
TopFooter = "</BODY></HTML>"
}
- `SetUpServer' is similar to the previous example, except for calling
-another function, `SetUpEliza'. This approach can be used to implement
+ 'SetUpServer' is similar to the previous example, except for calling
+another function, 'SetUpEliza'. This approach can be used to implement
other kinds of servers. The only changes needed to do so are hidden in
-the functions `SetUpServer' and `HandleGET'. Perhaps it might be
-necessary to implement other HTTP methods. The `igawk' program that
-comes with `gawk' may be useful for this process.
+the functions 'SetUpServer' and 'HandleGET'. Perhaps it might be
+necessary to implement other HTTP methods. The 'igawk' program that
+comes with 'gawk' may be useful for this process.
When extending this example to a complete application, the first
-thing to do is to implement the function `SetUpServer' to initialize
-the HTML pages and some variables. These initializations determine the
-way your HTML pages look (colors, titles, menu items, etc.).
+thing to do is to implement the function 'SetUpServer' to initialize the
+HTML pages and some variables. These initializations determine the way
+your HTML pages look (colors, titles, menu items, etc.).
- The function `HandleGET' is a nested case selection that decides
+ The function 'HandleGET' is a nested case selection that decides
which page the user wants to see next. Each nesting level refers to a
menu level of the GUI. Each case implements a certain action of the
-menu. On the deepest level of case selection, the handler essentially
+menu. On the deepest level of case selection, the handler essentially
knows what the user wants and stores the answer into the variable that
holds the HTML page contents:
@@ -1613,11 +1610,11 @@ holds the HTML page contents:
Initially the user does not say anything; then ELIZA resets its money
counter and asks the user to tell what comes to mind open heartedly.
The subsequent answers are converted to uppercase characters and stored
-for later comparison. ELIZA presents the bill when being confronted with
-a sentence that contains the phrase "shut up." Otherwise, it looks for
-keywords in the sentence, conjugates the rest of the sentence, remembers
-the keyword for later use, and finally selects an answer from the set of
-possible answers:
+for later comparison. ELIZA presents the bill when being confronted
+with a sentence that contains the phrase "shut up." Otherwise, it looks
+for keywords in the sentence, conjugates the rest of the sentence,
+remembers the keyword for later use, and finally selects an answer from
+the set of possible answers:
function ElizaSays(YouSay) {
if (YouSay == "") {
@@ -1662,9 +1659,9 @@ possible answers:
return answer
}
- In the long but simple function `SetUpEliza', you can see tables for
-conjugation, keywords, and answers.(1) The associative array `k'
-contains indices into the array of answers `r'. To choose an answer,
+ In the long but simple function 'SetUpEliza', you can see tables for
+conjugation, keywords, and answers.(1) The associative array 'k'
+contains indices into the array of answers 'r'. To choose an answer,
ELIZA just picks an index randomly:
function SetUpEliza() {
@@ -1698,19 +1695,18 @@ ELIZA just picks an index randomly:
k["YOU ARE"] =\
k["YOURE"] = "6 7 8 9"
...
-
}
Some interesting remarks and details (including the original source
code of ELIZA) are found on Mark Humphrys' home page. Yahoo! also has
-a page with a collection of ELIZA-like programs. Many of them are
-written in Java, some of them disclosing the Java source code, and a
-few even explain how to modify the Java source code.
+a page with a collection of ELIZA-like programs. Many of them are
+written in Java, some of them disclosing the Java source code, and a few
+even explain how to modify the Java source code.
---------- Footnotes ----------
(1) The version shown here is abbreviated. The full version comes
-with the `gawk' distribution.
+with the 'gawk' distribution.

File: gawkinet.info, Node: Caveats, Next: Challenges, Prev: Simple Server, Up: Using Networking
@@ -1721,7 +1717,7 @@ File: gawkinet.info, Node: Caveats, Next: Challenges, Prev: Simple Server, U
By now it should be clear that debugging a networked application is more
complicated than debugging a single-process single-hosted application.
The behavior of a networked application sometimes looks noncausal
-because it is not reproducible in a strong sense. Whether a network
+because it is not reproducible in a strong sense. Whether a network
application works or not sometimes depends on the following:
* How crowded the underlying network is
@@ -1731,13 +1727,12 @@ application works or not sometimes depends on the following:
* The state of the party at the other end
The most difficult problems for a beginner arise from the hidden
-states of the underlying network. After closing a TCP connection, it's
+states of the underlying network. After closing a TCP connection, it's
often necessary to wait a short while before reopening the connection.
-Even more difficult is the establishment of a connection that
-previously ended with a "broken pipe." Those connections have to "time
-out" for a minute or so before they can reopen. Check this with the
-command `netstat -a', which provides a list of still "active"
-connections.
+Even more difficult is the establishment of a connection that previously
+ended with a "broken pipe." Those connections have to "time out" for a
+minute or so before they can reopen. Check this with the command
+'netstat -a', which provides a list of still "active" connections.

File: gawkinet.info, Node: Challenges, Prev: Caveats, Up: Using Networking
@@ -1745,18 +1740,17 @@ File: gawkinet.info, Node: Challenges, Prev: Caveats, Up: Using Networking
2.12 Where To Go From Here
==========================
-Now, you have learned enough to build your own application. You could,
+Now, you have learned enough to build your own application. You could,
for example, take part in the Loebner Contest to win $100,000. The
-Loebner Prize is the first formal instantiation of a Turing Test. Hugh
+Loebner Prize is the first formal instantiation of a Turing Test. Hugh
Loebner agreed with The Cambridge Center for Behavioral Studies to
-underwrite a contest designed to implement the Turing Test. Dr.
-Loebner pledged a Grand Prize of $100,000 for the first computer whose
-responses were indistinguishable from a human's. Each year an annual
-prize of $2000 and a bronze medal is awarded to the _most_ human
-computer. The winner of the annual contest is the best entry relative
-to other entries that year, irrespective of how good it is in an
-absolute sense. Here is an example of a conversation with the winning
-program of 1997:
+underwrite a contest designed to implement the Turing Test. Dr. Loebner
+pledged a Grand Prize of $100,000 for the first computer whose responses
+were indistinguishable from a human's. Each year an annual prize of
+$2000 and a bronze medal is awarded to the _most_ human computer. The
+winner of the annual contest is the best entry relative to other entries
+that year, irrespective of how good it is in an absolute sense. Here is
+an example of a conversation with the winning program of 1997:
(c)1997 Cambridge Center For Behavioral Studies all rights reserved [CONVERSE]
[Intelligent Research Ltd.] Start at: [1997/04/29 08:59:40]
@@ -1799,44 +1793,44 @@ program of 1997:
PROGRAM[10:49:02]Do you think of yourself as being attractive?
This program insists on always speaking about the same story around
-Bill Clinton. You see, even a program with a rather narrow mind can
-behave so much like a human being that it can win this prize. It is
+Bill Clinton. You see, even a program with a rather narrow mind can
+behave so much like a human being that it can win this prize. It is
quite common to let these programs talk to each other via network
-connections. But during the competition itself, the program and its
-computer have to be present at the place the competition is held. We
-all would love to see a `gawk' program win in such an event. Maybe it
+connections. But during the competition itself, the program and its
+computer have to be present at the place the competition is held. We
+all would love to see a 'gawk' program win in such an event. Maybe it
is up to you to accomplish this?
Some other ideas for useful networked applications:
- * Read the file `doc/awkforai.txt' in the `gawk' distribution. It
+ * Read the file 'doc/awkforai.txt' in the 'gawk' distribution. It
was written by Ronald P. Loui (at the time, Associate Professor of
- Computer Science, at Washington University in St. Louis,
- <loui@ai.wustl.edu>) and summarizes why he taught `gawk' to
- students of Artificial Intelligence. Here are some passages from
+ Computer Science, at Washington University in St. Louis,
+ <loui@ai.wustl.edu>) and summarizes why he taught 'gawk' to
+ students of Artificial Intelligence. Here are some passages from
the text:
The GAWK manual can be consumed in a single lab session and
the language can be mastered by the next morning by the
average student. GAWK's automatic initialization, implicit
- coercion, I/O support and lack of pointers forgive many of
- the mistakes that young programmers are likely to make.
- Those who have seen C but not mastered it are happy to see
- that GAWK retains some of the same sensibilities while adding
- what must be regarded as spoonsful of syntactic sugar.
+ coercion, I/O support and lack of pointers forgive many of the
+ mistakes that young programmers are likely to make. Those who
+ have seen C but not mastered it are happy to see that GAWK
+ retains some of the same sensibilities while adding what must
+ be regarded as spoonsful of syntactic sugar.
...
There are further simple answers. Probably the best is the
fact that increasingly, undergraduate AI programming is
involving the Web. Oren Etzioni (University of Washington,
Seattle) has for a while been arguing that the "softbot" is
replacing the mechanical engineers' robot as the most
- glamorous AI testbed. If the artifact whose behavior needs
- to be controlled in an intelligent way is the software agent,
+ glamorous AI testbed. If the artifact whose behavior needs to
+ be controlled in an intelligent way is the software agent,
then a language that is well-suited to controlling the
software environment is the appropriate language. That would
imply a scripting language. If the robot is KAREL, then the
- right language is "turn left; turn right." If the robot is
+ right language is "turn left; turn right." If the robot is
Netscape, then the right language is something that can
- generate `netscape -remote
+ generate 'netscape -remote
'openURL(http://cs.wustl.edu/~loui)'' with elan.
...
AI programming requires high-level thinking. There have
@@ -1847,39 +1841,39 @@ is up to you to accomplish this?
Second, inference is merely the expansion of notation. No
matter whether the logic that underlies an AI program is
fuzzy, probabilistic, deontic, defeasible, or deductive, the
- logic merely defines how strings can be transformed into
- other strings. A language that provides the best support for
- string processing in the end provides the best support for
- logic, for the exploration of various logics, and for most
- forms of symbolic processing that AI might choose to call
- "reasoning" instead of "logic." The implication is that
- PROLOG, which saves the AI programmer from having to write a
- unifier, saves perhaps two dozen lines of GAWK code at the
- expense of strongly biasing the logic and representational
- expressiveness of any approach.
-
- Now that `gawk' itself can connect to the Internet, it should be
+ logic merely defines how strings can be transformed into other
+ strings. A language that provides the best support for string
+ processing in the end provides the best support for logic, for
+ the exploration of various logics, and for most forms of
+ symbolic processing that AI might choose to call "reasoning"
+ instead of "logic." The implication is that PROLOG, which
+ saves the AI programmer from having to write a unifier, saves
+ perhaps two dozen lines of GAWK code at the expense of
+ strongly biasing the logic and representational expressiveness
+ of any approach.
+
+ Now that 'gawk' itself can connect to the Internet, it should be
obvious that it is suitable for writing intelligent web agents.
- * `awk' is strong at pattern recognition and string processing. So,
+ * 'awk' is strong at pattern recognition and string processing. So,
it is well suited to the classic problem of language translation.
A first try could be a program that knows the 100 most frequent
- English words and their counterparts in German or French. The
+ English words and their counterparts in German or French. The
service could be implemented by regularly reading email with the
program above, replacing each word by its translation and sending
- the translation back via SMTP. Users would send English email to
+ the translation back via SMTP. Users would send English email to
their translation service and get back a translated email message
- in return. As soon as this works, more effort can be spent on a
+ in return. As soon as this works, more effort can be spent on a
real translation program.
- * Another dialogue-oriented application (on the verge of ridicule)
- is the email "support service." Troubled customers write an email
- to an automatic `gawk' service that reads the email. It looks for
- keywords in the mail and assembles a reply email accordingly. By
+ * Another dialogue-oriented application (on the verge of ridicule) is
+ the email "support service." Troubled customers write an email to
+ an automatic 'gawk' service that reads the email. It looks for
+ keywords in the mail and assembles a reply email accordingly. By
carefully investigating the email header, and repeating these
keywords through the reply email, it is rather simple to give the
- customer a feeling that someone cares. Ideally, such a service
- would search a database of previous cases for solutions. If none
+ customer a feeling that someone cares. Ideally, such a service
+ would search a database of previous cases for solutions. If none
exists, the database could, for example, consist of all the
newsgroups, mailing lists and FAQs on the Internet.
@@ -1892,28 +1886,28 @@ File: gawkinet.info, Node: Some Applications and Techniques, Next: Links, Pre
In this major node, we look at a number of self-contained scripts, with
an emphasis on concise networking. Along the way, we work towards
creating building blocks that encapsulate often needed functions of the
-networking world, show new techniques that broaden the scope of
-problems that can be solved with `gawk', and explore leading edge
-technology that may shape the future of networking.
+networking world, show new techniques that broaden the scope of problems
+that can be solved with 'gawk', and explore leading edge technology that
+may shape the future of networking.
We often refer to the site-independent core of the server that we
built in *note A Simple Web Server: Simple Server. When building new
and nontrivial servers, we always copy this building block and append
-new instances of the two functions `SetUpServer' and `HandleGET'.
+new instances of the two functions 'SetUpServer' and 'HandleGET'.
This makes a lot of sense, since this scheme of event-driven
-execution provides `gawk' with an interface to the most widely accepted
-standard for GUIs: the web browser. Now, `gawk' can rival even Tcl/Tk.
+execution provides 'gawk' with an interface to the most widely accepted
+standard for GUIs: the web browser. Now, 'gawk' can rival even Tcl/Tk.
- Tcl and `gawk' have much in common. Both are simple scripting
+ Tcl and 'gawk' have much in common. Both are simple scripting
languages that allow us to quickly solve problems with short programs.
-But Tcl has Tk on top of it, and `gawk' had nothing comparable up to
-now. While Tcl needs a large and ever-changing library (Tk, which was
-bound to the X Window System until recently), `gawk' needs just the
+But Tcl has Tk on top of it, and 'gawk' had nothing comparable up to
+now. While Tcl needs a large and ever-changing library (Tk, which was
+bound to the X Window System until recently), 'gawk' needs just the
networking interface and some kind of browser on the client's side.
Besides better portability, the most important advantage of this
approach (embracing well-established standards such HTTP and HTML) is
-that _we do not need to change the language_. We let others do the work
+that _we do not need to change the language_. We let others do the work
of fighting over protocols and standards. We can use HTML, JavaScript,
VRML, or whatever else comes along to do our work.
@@ -1936,22 +1930,22 @@ File: gawkinet.info, Node: PANIC, Next: GETURL, Prev: Some Applications and T
3.1 PANIC: An Emergency Web Server
==================================
-At first glance, the `"Hello, world"' example in *note A Primitive Web
-Service: Primitive Service, seems useless. By adding just a few lines,
+At first glance, the '"Hello, world"' example in *note A Primitive Web
+Service: Primitive Service, seems useless. By adding just a few lines,
we can turn it into something useful.
The PANIC program tells everyone who connects that the local site is
-not working. When a web server breaks down, it makes a difference if
+not working. When a web server breaks down, it makes a difference if
customers get a strange "network unreachable" message, or a short
-message telling them that the server has a problem. In such an
-emergency, the hard disk and everything on it (including the regular
-web service) may be unavailable. Rebooting the web server off a
-diskette makes sense in this setting.
+message telling them that the server has a problem. In such an
+emergency, the hard disk and everything on it (including the regular web
+service) may be unavailable. Rebooting the web server off a diskette
+makes sense in this setting.
- To use the PANIC program as an emergency web server, all you need
-are the `gawk' executable and the program below on a diskette. By
-default, it connects to port 8080. A different value may be supplied on
-the command line:
+ To use the PANIC program as an emergency web server, all you need are
+the 'gawk' executable and the program below on a diskette. By default,
+it connects to port 8080. A different value may be supplied on the
+command line:
BEGIN {
RS = ORS = "\r\n"
@@ -1979,23 +1973,23 @@ File: gawkinet.info, Node: GETURL, Next: REMCONF, Prev: PANIC, Up: Some Appl
================================
GETURL is a versatile building block for shell scripts that need to
-retrieve files from the Internet. It takes a web address as a
+retrieve files from the Internet. It takes a web address as a
command-line parameter and tries to retrieve the contents of this
-address. The contents are printed to standard output, while the header
-is printed to `/dev/stderr'. A surrounding shell script could analyze
-the contents and extract the text or the links. An ASCII browser could
+address. The contents are printed to standard output, while the header
+is printed to '/dev/stderr'. A surrounding shell script could analyze
+the contents and extract the text or the links. An ASCII browser could
be written around GETURL. But more interestingly, web robots are
straightforward to write on top of GETURL. On the Internet, you can find
-several programs of the same name that do the same job. They are usually
-much more complex internally and at least 10 times longer.
+several programs of the same name that do the same job. They are
+usually much more complex internally and at least 10 times longer.
At first, GETURL checks if it was called with exactly one web
address. Then, it checks if the user chose to use a special proxy
-server whose name is handed over in a variable. By default, it is
-assumed that the local machine serves as proxy. GETURL uses the `GET'
-method by default to access the web page. By handing over the name of a
-different method (such as `HEAD'), it is possible to choose a different
-behavior. With the `HEAD' method, the user does not receive the body of
+server whose name is handed over in a variable. By default, it is
+assumed that the local machine serves as proxy. GETURL uses the 'GET'
+method by default to access the web page. By handing over the name of a
+different method (such as 'HEAD'), it is possible to choose a different
+behavior. With the 'HEAD' method, the user does not receive the body of
the page content, but does receive the header:
BEGIN {
@@ -2025,8 +2019,8 @@ the page content, but does receive the header:
This program can be changed as needed, but be careful with the last
lines. Make sure transmission of binary data is not corrupted by
-additional line breaks. Even as it is now, the byte sequence
-`"\r\n\r\n"' would disappear if it were contained in binary data. Don't
+additional line breaks. Even as it is now, the byte sequence
+'"\r\n\r\n"' would disappear if it were contained in binary data. Don't
get caught in a trap when trying a quick fix on this one.

@@ -2036,13 +2030,12 @@ File: gawkinet.info, Node: REMCONF, Next: URLCHK, Prev: GETURL, Up: Some App
=====================================================
Today, you often find powerful processors in embedded systems.
-Dedicated network routers and controllers for all kinds of machinery
-are examples of embedded systems. Processors like the Intel 80x86 or
-the AMD Elan are able to run multitasking operating systems, such as
-XINU or GNU/Linux in embedded PCs. These systems are small and usually
-do not have a keyboard or a display. Therefore it is difficult to set
-up their configuration. There are several widespread ways to set them
-up:
+Dedicated network routers and controllers for all kinds of machinery are
+examples of embedded systems. Processors like the Intel 80x86 or the
+AMD Elan are able to run multitasking operating systems, such as XINU or
+GNU/Linux in embedded PCs. These systems are small and usually do not
+have a keyboard or a display. Therefore it is difficult to set up their
+configuration. There are several widespread ways to set them up:
* DIP switches
@@ -2050,22 +2043,21 @@ up:
* Serial lines or some kind of keyboard
- * Network connections via `telnet' or SNMP
+ * Network connections via 'telnet' or SNMP
* HTTP connections with HTML GUIs
In this node, we look at a solution that uses HTTP connections to
control variables of an embedded system that are stored in a file.
-Since embedded systems have tight limits on resources like memory, it
-is difficult to employ advanced techniques such as SNMP and HTTP
-servers. `gawk' fits in quite nicely with its single executable which
-needs just a short script to start working. The following program
-stores the variables in a file, and a concurrent process in the
-embedded system may read the file. The program uses the
-site-independent part of the simple web server that we developed in
-*note A Web Service with Interaction: Interacting Service. As
-mentioned there, all we have to do is to write two new procedures
-`SetUpServer' and `HandleGET':
+Since embedded systems have tight limits on resources like memory, it is
+difficult to employ advanced techniques such as SNMP and HTTP servers.
+'gawk' fits in quite nicely with its single executable which needs just
+a short script to start working. The following program stores the
+variables in a file, and a concurrent process in the embedded system may
+read the file. The program uses the site-independent part of the simple
+web server that we developed in *note A Web Service with Interaction:
+Interacting Service. As mentioned there, all we have to do is to write
+two new procedures 'SetUpServer' and 'HandleGET':
function SetUpServer() {
TopHeader = "<HTML><title>Remote Configuration</title>"
@@ -2082,20 +2074,20 @@ mentioned there, all we have to do is to write two new procedures
if (ConfigFile == "") ConfigFile = "config.asc"
}
- The function `SetUpServer' initializes the top level HTML texts as
-usual. It also initializes the name of the file that contains the
-configuration parameters and their values. In case the user supplies a
-name from the command line, that name is used. The file is expected to
-contain one parameter per line, with the name of the parameter in
-column one and the value in column two.
-
- The function `HandleGET' reflects the structure of the menu tree as
-usual. The first menu choice tells the user what this is all about. The
-second choice reads the configuration file line by line and stores the
-parameters and their values. Notice that the record separator for this
-file is `"\n"', in contrast to the record separator for HTTP. The third
-menu choice builds an HTML table to show the contents of the
-configuration file just read. The fourth choice does the real work of
+ The function 'SetUpServer' initializes the top level HTML texts as
+usual. It also initializes the name of the file that contains the
+configuration parameters and their values. In case the user supplies a
+name from the command line, that name is used. The file is expected to
+contain one parameter per line, with the name of the parameter in column
+one and the value in column two.
+
+ The function 'HandleGET' reflects the structure of the menu tree as
+usual. The first menu choice tells the user what this is all about.
+The second choice reads the configuration file line by line and stores
+the parameters and their values. Notice that the record separator for
+this file is '"\n"', in contrast to the record separator for HTTP. The
+third menu choice builds an HTML table to show the contents of the
+configuration file just read. The fourth choice does the real work of
changing parameters, and the last one just saves the configuration into
a file:
@@ -2140,10 +2132,10 @@ a file:
}
}
- We could also view the configuration file as a database. From this
+ We could also view the configuration file as a database. From this
point of view, the previous program acts like a primitive database
server. Real SQL database systems also make a service available by
-providing a TCP port that clients can connect to. But the application
+providing a TCP port that clients can connect to. But the application
level protocols they use are usually proprietary and also change from
time to time. This is also true for the protocol that MiniSQL uses.
@@ -2154,20 +2146,20 @@ File: gawkinet.info, Node: URLCHK, Next: WEBGRAB, Prev: REMCONF, Up: Some Ap
======================================
Most people who make heavy use of Internet resources have a large
-bookmark file with pointers to interesting web sites. It is impossible
-to regularly check by hand if any of these sites have changed. A program
-is needed to automatically look at the headers of web pages and tell
-which ones have changed. URLCHK does the comparison after using GETURL
-with the `HEAD' method to retrieve the header.
+bookmark file with pointers to interesting web sites. It is impossible
+to regularly check by hand if any of these sites have changed. A
+program is needed to automatically look at the headers of web pages and
+tell which ones have changed. URLCHK does the comparison after using
+GETURL with the 'HEAD' method to retrieve the header.
Like GETURL, this program first checks that it is called with exactly
-one command-line parameter. URLCHK also takes the same command-line
-variables `Proxy' and `ProxyPort' as GETURL, because these variables
-are handed over to GETURL for each URL that gets checked. The one and
-only parameter is the name of a file that contains one line for each
-URL. In the first column, we find the URL, and the second and third
-columns hold the length of the URL's body when checked for the two last
-times. Now, we follow this plan:
+one command-line parameter. URLCHK also takes the same command-line
+variables 'Proxy' and 'ProxyPort' as GETURL, because these variables are
+handed over to GETURL for each URL that gets checked. The one and only
+parameter is the name of a file that contains one line for each URL. In
+the first column, we find the URL, and the second and third columns hold
+the length of the URL's body when checked for the two last times. Now,
+we follow this plan:
1. Read the URLs from the file and remember their most recent lengths
@@ -2177,11 +2169,11 @@ times. Now, we follow this plan:
4. If the most recent and the new length differ, tell the user
- It may seem a bit peculiar to read the URLs from a file together
-with their two most recent lengths, but this approach has several
-advantages. You can call the program again and again with the same
-file. After running the program, you can regenerate the changed URLs by
-extracting those lines that differ in their second and third columns:
+ It may seem a bit peculiar to read the URLs from a file together with
+their two most recent lengths, but this approach has several advantages.
+You can call the program again and again with the same file. After
+running the program, you can regenerate the changed URLs by extracting
+those lines that differ in their second and third columns:
BEGIN {
if (ARGC != 2) {
@@ -2214,18 +2206,18 @@ extracting those lines that differ in their second and third columns:
Another thing that may look strange is the way GETURL is called.
Before calling GETURL, we have to check if the proxy variables need to
-be passed on. If so, we prepare strings that will become part of the
-command line later. In `GetHeader', we store these strings together
-with the longest part of the command line. Later, in the loop over the
-URLs, `GetHeader' is appended with the URL and a redirection operator
-to form the command that reads the URL's header over the Internet.
-GETURL always produces the headers over `/dev/stderr'. That is the
-reason why we need the redirection operator to have the header piped in.
+be passed on. If so, we prepare strings that will become part of the
+command line later. In 'GetHeader', we store these strings together
+with the longest part of the command line. Later, in the loop over the
+URLs, 'GetHeader' is appended with the URL and a redirection operator to
+form the command that reads the URL's header over the Internet. GETURL
+always produces the headers over '/dev/stderr'. That is the reason why
+we need the redirection operator to have the header piped in.
This program is not perfect because it assumes that changing URLs
-results in changed lengths, which is not necessarily true. A more
+results in changed lengths, which is not necessarily true. A more
advanced approach is to look at some other header line that holds time
-information. But, as always when things get a bit more complicated,
+information. But, as always when things get a bit more complicated,
this is left as an exercise to the reader.

@@ -2246,44 +2238,44 @@ the Bourne shell:
print command
}
- Notice that the regular expression for URLs is rather crude. A
-precise regular expression is much more complex. But this one works
-rather well. One problem is that it is unable to find internal links of
-an HTML document. Another problem is that `ftp', `telnet', `news',
-`mailto', and other kinds of links are missing in the regular
+ Notice that the regular expression for URLs is rather crude. A
+precise regular expression is much more complex. But this one works
+rather well. One problem is that it is unable to find internal links of
+an HTML document. Another problem is that 'ftp', 'telnet', 'news',
+'mailto', and other kinds of links are missing in the regular
expression. However, it is straightforward to add them, if doing so is
necessary for other tasks.
- This program reads an HTML file and prints all the HTTP links that
-it finds. It relies on `gawk''s ability to use regular expressions as
-record separators. With `RS' set to a regular expression that matches
+ This program reads an HTML file and prints all the HTTP links that it
+finds. It relies on 'gawk''s ability to use regular expressions as
+record separators. With 'RS' set to a regular expression that matches
links, the second action is executed each time a non-empty link is
-found. We can find the matching link itself in `RT'.
+found. We can find the matching link itself in 'RT'.
- The action could use the `system' function to let another GETURL
+ The action could use the 'system' function to let another GETURL
retrieve the page, but here we use a different approach. This simple
-program prints shell commands that can be piped into `sh' for
-execution. This way it is possible to first extract the links, wrap
-shell commands around them, and pipe all the shell commands into a
-file. After editing the file, execution of the file retrieves exactly
-those files that we really need. In case we do not want to edit, we can
-retrieve all the pages like this:
+program prints shell commands that can be piped into 'sh' for execution.
+This way it is possible to first extract the links, wrap shell commands
+around them, and pipe all the shell commands into a file. After editing
+the file, execution of the file retrieves exactly those files that we
+really need. In case we do not want to edit, we can retrieve all the
+pages like this:
gawk -f geturl.awk http://www.suse.de | gawk -f webgrab.awk | sh
After this, you will find the contents of all referenced documents in
-files named `doc*.html' even if they do not contain HTML code. The
-most annoying thing is that we always have to pass the proxy to GETURL.
-If you do not like to see the headers of the web pages appear on the
-screen, you can redirect them to `/dev/null'. Watching the headers
+files named 'doc*.html' even if they do not contain HTML code. The most
+annoying thing is that we always have to pass the proxy to GETURL. If
+you do not like to see the headers of the web pages appear on the
+screen, you can redirect them to '/dev/null'. Watching the headers
appear can be quite interesting, because it reveals interesting details
such as which web server the companies use. Now, it is clear how the
-clever marketing people use web robots to determine the market shares
-of Microsoft and Netscape in the web server market.
+clever marketing people use web robots to determine the market shares of
+Microsoft and Netscape in the web server market.
Port 80 of any web server is like a small hole in a repellent
firewall. After attaching a browser to port 80, we usually catch a
-glimpse of the bright side of the server (its home page). With a tool
+glimpse of the bright side of the server (its home page). With a tool
like GETURL at hand, we are able to discover some of the more concealed
or even "indecent" services (i.e., lacking conformity to standards of
quality). It can be exciting to see the fancy CGI scripts that lie
@@ -2295,14 +2287,14 @@ there, revealing the inner workings of the server, ready to be called:
some servers give you a directory listing of the CGI files.
Knowing the names, you can try to call some of them and watch for
- useful results. Sometimes there are executables in such directories
- (such as Perl interpreters) that you may call remotely. If there
- are subdirectories with configuration data of the web server, this
- can also be quite interesting to read.
+ useful results. Sometimes there are executables in such
+ directories (such as Perl interpreters) that you may call remotely.
+ If there are subdirectories with configuration data of the web
+ server, this can also be quite interesting to read.
* The well-known Apache web server usually has its CGI files in the
- directory `/cgi-bin'. There you can often find the scripts
- `test-cgi' and `printenv'. Both tell you some things about the
+ directory '/cgi-bin'. There you can often find the scripts
+ 'test-cgi' and 'printenv'. Both tell you some things about the
current connection and the installation of the web server. Just
call:
@@ -2311,10 +2303,10 @@ there, revealing the inner workings of the server, ready to be called:
* Sometimes it is even possible to retrieve system files like the web
server's log file--possibly containing customer data--or even the
- file `/etc/passwd'. (We don't recommend this!)
+ file '/etc/passwd'. (We don't recommend this!)
- *Caution:* Although this may sound funny or simply irrelevant, we
-are talking about severe security holes. Try to explore your own system
+ *Caution:* Although this may sound funny or simply irrelevant, we are
+talking about severe security holes. Try to explore your own system
this way and make sure that none of the above reveals too much
information about your system.
@@ -2325,27 +2317,27 @@ File: gawkinet.info, Node: STATIST, Next: MAZE, Prev: WEBGRAB, Up: Some Appl
================================================
In the HTTP server examples we've shown thus far, we never present an
-image to the browser and its user. Presenting images is one task.
+image to the browser and its user. Presenting images is one task.
Generating images that reflect some user input and presenting these
-dynamically generated images is another. In this node, we use GNUPlot
-for generating `.png', `.ps', or `.gif' files.(1)
+dynamically generated images is another. In this node, we use GNUPlot
+for generating '.png', '.ps', or '.gif' files.(1)
The program we develop takes the statistical parameters of two
-samples and computes the t-test statistics. As a result, we get the
+samples and computes the t-test statistics. As a result, we get the
probabilities that the means and the variances of both samples are the
-same. In order to let the user check plausibility, the program presents
-an image of the distributions. The statistical computation follows
-`Numerical Recipes in C: The Art of Scientific Computing' by William H.
+same. In order to let the user check plausibility, the program presents
+an image of the distributions. The statistical computation follows
+'Numerical Recipes in C: The Art of Scientific Computing' by William H.
Press, Saul A. Teukolsky, William T. Vetterling, and Brian P. Flannery.
-Since `gawk' does not have a built-in function for the computation of
-the beta function, we use the `ibeta' function of GNUPlot. As a side
-effect, we learn how to use GNUPlot as a sophisticated calculator. The
-comparison of means is done as in `tutest', paragraph 14.2, page 613,
-and the comparison of variances is done as in `ftest', page 611 in
-`Numerical Recipes'.
+Since 'gawk' does not have a built-in function for the computation of
+the beta function, we use the 'ibeta' function of GNUPlot. As a side
+effect, we learn how to use GNUPlot as a sophisticated calculator. The
+comparison of means is done as in 'tutest', paragraph 14.2, page 613,
+and the comparison of variances is done as in 'ftest', page 611 in
+'Numerical Recipes'.
As usual, we take the site-independent code for servers and append
-our own functions `SetUpServer' and `HandleGET':
+our own functions 'SetUpServer' and 'HandleGET':
function SetUpServer() {
TopHeader = "<HTML><title>Statistics with GAWK</title>"
@@ -2360,25 +2352,25 @@ our own functions `SetUpServer' and `HandleGET':
m1=m2=0; v1=v2=1; n1=n2=10
}
- Here, you see the menu structure that the user sees. Later, we will
-see how the program structure of the `HandleGET' function reflects the
-menu structure. What is missing here is the link for the image we
-generate. In an event-driven environment, request, generation, and
+ Here, you see the menu structure that the user sees. Later, we will
+see how the program structure of the 'HandleGET' function reflects the
+menu structure. What is missing here is the link for the image we
+generate. In an event-driven environment, request, generation, and
delivery of images are separated.
- Notice the way we initialize the `GnuPlot' command string for the
-pipe. By default, GNUPlot outputs the generated image via standard
-output, as well as the results of `print'(ed) calculations via standard
+ Notice the way we initialize the 'GnuPlot' command string for the
+pipe. By default, GNUPlot outputs the generated image via standard
+output, as well as the results of 'print'(ed) calculations via standard
error. The redirection causes standard error to be mixed into standard
-output, enabling us to read results of calculations with `getline'. By
+output, enabling us to read results of calculations with 'getline'. By
initializing the statistical parameters with some meaningful defaults,
we make sure the user gets an image the first time he uses the program.
- Following is the rather long function `HandleGET', which implements
+ Following is the rather long function 'HandleGET', which implements
the contents of this service by reacting to the different kinds of
-requests from the browser. Before you start playing with this script,
+requests from the browser. Before you start playing with this script,
make sure that your browser supports JavaScript and that it also has
-this option switched on. The script uses a short snippet of JavaScript
+this option switched on. The script uses a short snippet of JavaScript
code for delayed opening of a window with an image. A more detailed
explanation follows:
@@ -2457,105 +2449,100 @@ explanation follows:
}
As usual, we give a short description of the service in the first
-menu choice. The third menu choice shows us that generation and
-presentation of an image are two separate actions. While the latter
+menu choice. The third menu choice shows us that generation and
+presentation of an image are two separate actions. While the latter
takes place quite instantly in the third menu choice, the former takes
-place in the much longer second choice. Image data passes from the
-generating action to the presenting action via the variable `Image'
-that contains a complete `.png' image, which is otherwise stored in a
-file. If you prefer `.ps' or `.gif' images over the default `.png'
-images, you may select these options by uncommenting the appropriate
-lines. But remember to do so in two places: when telling GNUPlot which
-kind of images to generate, and when transmitting the image at the end
-of the program.
-
- Looking at the end of the program, the way we pass the
-`Content-type' to the browser is a bit unusual. It is appended to the
-`OK' of the first header line to make sure the type information becomes
-part of the header. The other variables that get transmitted across
-the network are made empty, because in this case we do not have an HTML
-document to transmit, but rather raw image data to contain in the body.
-
- Most of the work is done in the second menu choice. It starts with a
-strange JavaScript code snippet. When first implementing this server,
-we used a short `"<IMG SRC=" MyPrefix "/Image>"' here. But then
+place in the much longer second choice. Image data passes from the
+generating action to the presenting action via the variable 'Image' that
+contains a complete '.png' image, which is otherwise stored in a file.
+If you prefer '.ps' or '.gif' images over the default '.png' images, you
+may select these options by uncommenting the appropriate lines. But
+remember to do so in two places: when telling GNUPlot which kind of
+images to generate, and when transmitting the image at the end of the
+program.
+
+ Looking at the end of the program, the way we pass the 'Content-type'
+to the browser is a bit unusual. It is appended to the 'OK' of the
+first header line to make sure the type information becomes part of the
+header. The other variables that get transmitted across the network are
+made empty, because in this case we do not have an HTML document to
+transmit, but rather raw image data to contain in the body.
+
+ Most of the work is done in the second menu choice. It starts with a
+strange JavaScript code snippet. When first implementing this server,
+we used a short '"<IMG SRC=" MyPrefix "/Image>"' here. But then
browsers got smarter and tried to improve on speed by requesting the
-image and the HTML code at the same time. When doing this, the browser
+image and the HTML code at the same time. When doing this, the browser
tries to build up a connection for the image request while the request
-for the HTML text is not yet completed. The browser tries to connect to
-the `gawk' server on port 8080 while port 8080 is still in use for
-transmission of the HTML text. The connection for the image cannot be
+for the HTML text is not yet completed. The browser tries to connect to
+the 'gawk' server on port 8080 while port 8080 is still in use for
+transmission of the HTML text. The connection for the image cannot be
built up, so the image appears as "broken" in the browser window. We
-solved this problem by telling the browser to open a separate window
-for the image, but only after a delay of 1000 milliseconds. By this
-time, the server should be ready for serving the next request.
-
- But there is one more subtlety in the JavaScript code. Each time
-the JavaScript code opens a window for the image, the name of the image
-is appended with a timestamp (`systime'). Why this constant change of
-name for the image? Initially, we always named the image `Image', but
-then the Netscape browser noticed the name had _not_ changed since the
+solved this problem by telling the browser to open a separate window for
+the image, but only after a delay of 1000 milliseconds. By this time,
+the server should be ready for serving the next request.
+
+ But there is one more subtlety in the JavaScript code. Each time the
+JavaScript code opens a window for the image, the name of the image is
+appended with a timestamp ('systime'). Why this constant change of name
+for the image? Initially, we always named the image 'Image', but then
+the Netscape browser noticed the name had _not_ changed since the
previous request and displayed the previous image (caching behavior).
The server core is implemented so that browsers are told _not_ to cache
-anything. Obviously HTTP requests do not always work as expected. One
+anything. Obviously HTTP requests do not always work as expected. One
way to circumvent the cache of such overly smart browsers is to change
-the name of the image with each request. These three lines of JavaScript
-caused us a lot of trouble.
+the name of the image with each request. These three lines of
+JavaScript caused us a lot of trouble.
- The rest can be broken down into two phases. At first, we check if
-there are statistical parameters. When the program is first started,
+ The rest can be broken down into two phases. At first, we check if
+there are statistical parameters. When the program is first started,
there usually are no parameters because it enters the page coming from
-the top menu. Then, we only have to present the user a form that he
-can use to change statistical parameters and submit them. Subsequently,
-the submission of the form causes the execution of the first phase
-because _now_ there _are_ parameters to handle.
+the top menu. Then, we only have to present the user a form that he can
+use to change statistical parameters and submit them. Subsequently, the
+submission of the form causes the execution of the first phase because
+_now_ there _are_ parameters to handle.
Now that we have parameters, we know there will be an image
-available. Therefore we insert the JavaScript code here to initiate
-the opening of the image in a separate window. Then, we prepare some
+available. Therefore we insert the JavaScript code here to initiate the
+opening of the image in a separate window. Then, we prepare some
variables that will be passed to GNUPlot for calculation of the
-probabilities. Prior to reading the results, we must temporarily change
-`RS' because GNUPlot separates lines with newlines. After instructing
-GNUPlot to generate a `.png' (or `.ps' or `.gif') image, we initiate
-the insertion of some text, explaining the resulting probabilities. The
-final `plot' command actually generates the image data. This raw binary
+probabilities. Prior to reading the results, we must temporarily change
+'RS' because GNUPlot separates lines with newlines. After instructing
+GNUPlot to generate a '.png' (or '.ps' or '.gif') image, we initiate the
+insertion of some text, explaining the resulting probabilities. The
+final 'plot' command actually generates the image data. This raw binary
has to be read in carefully without adding, changing, or deleting a
-single byte. Hence the unusual initialization of `Image' and completion
-with a `while' loop.
+single byte. Hence the unusual initialization of 'Image' and completion
+with a 'while' loop.
When using this server, it soon becomes clear that it is far from
-being perfect. It mixes source code of six scripting languages or
+being perfect. It mixes source code of six scripting languages or
protocols:
- * GNU `awk' implements a server for the protocol:
-
+ * GNU 'awk' implements a server for the protocol:
* HTTP which transmits:
-
* HTML text which contains a short piece of:
-
* JavaScript code opening a separate window.
-
* A Bourne shell script is used for piping commands into:
-
* GNUPlot to generate the image to be opened.
After all this work, the GNUPlot image opens in the JavaScript window
where it can be viewed by the user.
- It is probably better not to mix up so many different languages.
-The result is not very readable. Furthermore, the statistical part of
-the server does not take care of invalid input. Among others, using
+ It is probably better not to mix up so many different languages. The
+result is not very readable. Furthermore, the statistical part of the
+server does not take care of invalid input. Among others, using
negative variances will cause invalid results.
---------- Footnotes ----------
(1) Due to licensing problems, the default installation of GNUPlot
-disables the generation of `.gif' files. If your installed version
-does not accept `set term gif', just download and install the most
-recent version of GNUPlot and the GD library
-(http://www.boutell.com/gd/) by Thomas Boutell. Otherwise you still
-have the chance to generate some ASCII-art style images with GNUPlot by
-using `set term dumb'. (We tried it and it worked.)
+disables the generation of '.gif' files. If your installed version does
+not accept 'set term gif', just download and install the most recent
+version of GNUPlot and the GD library (http://www.boutell.com/gd/) by
+Thomas Boutell. Otherwise you still have the chance to generate some
+ASCII-art style images with GNUPlot by using 'set term dumb'. (We tried
+it and it worked.)

File: gawkinet.info, Node: MAZE, Next: MOBAGWHO, Prev: STATIST, Up: Some Applications and Techniques
@@ -2566,19 +2553,19 @@ File: gawkinet.info, Node: MAZE, Next: MOBAGWHO, Prev: STATIST, Up: Some App
In the long run, every program becomes rococo, and then rubble.
Alan Perlis
- By now, we know how to present arbitrary `Content-type's to a
+ By now, we know how to present arbitrary 'Content-type's to a
browser. In this node, our server will present a 3D world to our
browser. The 3D world is described in a scene description language
(VRML, Virtual Reality Modeling Language) that allows us to travel
-through a perspective view of a 2D maze with our browser. Browsers with
-a VRML plugin enable exploration of this technology. We could do one of
-those boring `Hello world' examples here, that are usually presented
+through a perspective view of a 2D maze with our browser. Browsers with
+a VRML plugin enable exploration of this technology. We could do one of
+those boring 'Hello world' examples here, that are usually presented
when introducing novices to VRML. If you have never written any VRML
-code, have a look at the VRML FAQ. Presenting a static VRML scene is a
-bit trivial; in order to expose `gawk''s new capabilities, we will
-present a dynamically generated VRML scene. The function `SetUpServer'
+code, have a look at the VRML FAQ. Presenting a static VRML scene is a
+bit trivial; in order to expose 'gawk''s new capabilities, we will
+present a dynamically generated VRML scene. The function 'SetUpServer'
is very simple because it only sets the default HTML page and
-initializes the random number generator. As usual, the surrounding
+initializes the random number generator. As usual, the surrounding
server lets you browse the maze.
function SetUpServer() {
@@ -2593,15 +2580,15 @@ server lets you browse the maze.
srand()
}
- The function `HandleGET' is a bit longer because it first computes
+ The function 'HandleGET' is a bit longer because it first computes
the maze and afterwards generates the VRML code that is sent across the
-network. As shown in the STATIST example (*note STATIST::), we set the
+network. As shown in the STATIST example (*note STATIST::), we set the
type of the content to VRML and then store the VRML representation of
-the maze as the page content. We assume that the maze is stored in a 2D
-array. Initially, the maze consists of walls only. Then, we add an
+the maze as the page content. We assume that the maze is stored in a 2D
+array. Initially, the maze consists of walls only. Then, we add an
entry and an exit to the maze and let the rest of the work be done by
-the function `MakeMaze'. Now, only the wall fields are left in the
-maze. By iterating over the these fields, we generate one line of VRML
+the function 'MakeMaze'. Now, only the wall fields are left in the
+maze. By iterating over the these fields, we generate one line of VRML
code for each wall field.
function HandleGET() {
@@ -2650,25 +2637,25 @@ code for each wall field.
}
}
- Finally, we have a look at `MakeMaze', the function that generates
-the `Maze' array. When entered, this function assumes that the array
+ Finally, we have a look at 'MakeMaze', the function that generates
+the 'Maze' array. When entered, this function assumes that the array
has been initialized so that each element represents a wall element and
-the maze is initially full of wall elements. Only the entrance and the
-exit of the maze should have been left free. The parameters of the
+the maze is initially full of wall elements. Only the entrance and the
+exit of the maze should have been left free. The parameters of the
function tell us which element must be marked as not being a wall.
-After this, we take a look at the four neighboring elements and
-remember which we have already treated. Of all the neighboring
-elements, we take one at random and walk in that direction. Therefore,
-the wall element in that direction has to be removed and then, we call
-the function recursively for that element. The maze is only completed
-if we iterate the above procedure for _all_ neighboring elements (in
-random order) and for our present element by recursively calling the
-function for the present element. This last iteration could have been
-done in a loop, but it is done much simpler recursively.
+After this, we take a look at the four neighboring elements and remember
+which we have already treated. Of all the neighboring elements, we take
+one at random and walk in that direction. Therefore, the wall element
+in that direction has to be removed and then, we call the function
+recursively for that element. The maze is only completed if we iterate
+the above procedure for _all_ neighboring elements (in random order) and
+for our present element by recursively calling the function for the
+present element. This last iteration could have been done in a loop,
+but it is done much simpler recursively.
Notice that elements with coordinates that are both odd are assumed
to be on our way through the maze and the generating process cannot
-terminate as long as there is such an element not being `delete'd. All
+terminate as long as there is such an element not being 'delete'd. All
other elements are potentially part of the wall.
function MakeMaze(x, y) {
@@ -2702,51 +2689,51 @@ File: gawkinet.info, Node: MOBAGWHO, Next: STOXPRED, Prev: MAZE, Up: Some Ap
C. A. R. Hoare
A "mobile agent" is a program that can be dispatched from a computer
-and transported to a remote server for execution. This is called
+and transported to a remote server for execution. This is called
"migration", which means that a process on another system is started
-that is independent from its originator. Ideally, it wanders through a
-network while working for its creator or owner. In places like the UMBC
+that is independent from its originator. Ideally, it wanders through a
+network while working for its creator or owner. In places like the UMBC
Agent Web, people are quite confident that (mobile) agents are a
software engineering paradigm that enables us to significantly increase
-the efficiency of our work. Mobile agents could become the mediators
-between users and the networking world. For an unbiased view at this
-technology, see the remarkable paper `Mobile Agents: Are they a good
+the efficiency of our work. Mobile agents could become the mediators
+between users and the networking world. For an unbiased view at this
+technology, see the remarkable paper 'Mobile Agents: Are they a good
idea?'.(1)
- When trying to migrate a process from one system to another, a
-server process is needed on the receiving side. Depending on the kind
-of server process, several ways of implementation come to mind. How
-the process is implemented depends upon the kind of server process:
+ When trying to migrate a process from one system to another, a server
+process is needed on the receiving side. Depending on the kind of
+server process, several ways of implementation come to mind. How the
+process is implemented depends upon the kind of server process:
* HTTP can be used as the protocol for delivery of the migrating
- process. In this case, we use a common web server as the receiving
- server process. A universal CGI script mediates between migrating
+ process. In this case, we use a common web server as the receiving
+ server process. A universal CGI script mediates between migrating
process and web server. Each server willing to accept migrating
- agents makes this universal service available. HTTP supplies the
- `POST' method to transfer some data to a file on the web server.
- When a CGI script is called remotely with the `POST' method
- instead of the usual `GET' method, data is transmitted from the
- client process to the standard input of the server's CGI script.
- So, to implement a mobile agent, we must not only write the agent
- program to start on the client side, but also the CGI script to
- receive the agent on the server side.
-
- * The `PUT' method can also be used for migration. HTTP does not
- require a CGI script for migration via `PUT'. However, with common
+ agents makes this universal service available. HTTP supplies the
+ 'POST' method to transfer some data to a file on the web server.
+ When a CGI script is called remotely with the 'POST' method instead
+ of the usual 'GET' method, data is transmitted from the client
+ process to the standard input of the server's CGI script. So, to
+ implement a mobile agent, we must not only write the agent program
+ to start on the client side, but also the CGI script to receive the
+ agent on the server side.
+
+ * The 'PUT' method can also be used for migration. HTTP does not
+ require a CGI script for migration via 'PUT'. However, with common
web servers there is no advantage to this solution, because web
servers such as Apache require explicit activation of a special
- `PUT' script.
+ 'PUT' script.
- * `Agent Tcl' pursues a different course; it relies on a dedicated
+ * 'Agent Tcl' pursues a different course; it relies on a dedicated
server process with a dedicated protocol specialized for receiving
mobile agents.
Our agent example abuses a common web server as a migration tool.
So, it needs a universal CGI script on the receiving side (the web
-server). The receiving script is activated with a `POST' request when
-placed into a location like `/httpd/cgi-bin/PostAgent.sh'. Make sure
-that the server system uses a version of `gawk' that supports network
-access (Version 3.1 or later; verify with `gawk --version').
+server). The receiving script is activated with a 'POST' request when
+placed into a location like '/httpd/cgi-bin/PostAgent.sh'. Make sure
+that the server system uses a version of 'gawk' that supports network
+access (Version 3.1 or later; verify with 'gawk --version').
#!/bin/sh
MobAg=/tmp/MobileAgent.$$
@@ -2758,34 +2745,34 @@ access (Version 3.1 or later; verify with `gawk --version').
gawk 'BEGIN { print "\r\nAgent started" }'
rm $MobAg # delete script file of agent
- By making its process id (`$$') part of the unique file name, the
+ By making its process id ('$$') part of the unique file name, the
script avoids conflicts between concurrent instances of the script.
First, all lines from standard input (the mobile agent's source code)
-are copied into this unique file. Then, the agent is started as a
+are copied into this unique file. Then, the agent is started as a
concurrent process and a short message reporting this fact is sent to
the submitting client. Finally, the script file of the mobile agent is
-removed because it is no longer needed. Although it is a short script,
+removed because it is no longer needed. Although it is a short script,
there are several noteworthy points:
Security
- _There is none_. In fact, the CGI script should never be made
+ _There is none_. In fact, the CGI script should never be made
available on a server that is part of the Internet because everyone
- would be allowed to execute arbitrary commands with it. This
+ would be allowed to execute arbitrary commands with it. This
behavior is acceptable only when performing rapid prototyping.
Self-Reference
Each migrating instance of an agent is started in a way that
enables it to read its own source code from standard input and use
- the code for subsequent migrations. This is necessary because it
- needs to treat the agent's code as data to transmit. `gawk' is not
- the ideal language for such a job. Lisp and Tcl are more suitable
+ the code for subsequent migrations. This is necessary because it
+ needs to treat the agent's code as data to transmit. 'gawk' is not
+ the ideal language for such a job. Lisp and Tcl are more suitable
because they do not make a distinction between program code and
data.
Independence
After migration, the agent is not linked to its former home in any
- way. By reporting `Agent started', it waves "Goodbye" to its
- origin. The originator may choose to terminate or not.
+ way. By reporting 'Agent started', it waves "Goodbye" to its
+ origin. The originator may choose to terminate or not.
The originating agent itself is started just like any other
command-line script, and reports the results on standard output. By
@@ -2793,10 +2780,10 @@ letting the name of the original host migrate with the agent, the agent
that migrates to a host far away from its origin can report the result
back home. Having arrived at the end of the journey, the agent
establishes a connection and reports the results. This is the reason
-for determining the name of the host with `uname -n' and storing it in
-`MyOrigin' for later use. We may also set variables with the `-v'
-option from the command line. This interactivity is only of importance
-in the context of starting a mobile agent; therefore this `BEGIN'
+for determining the name of the host with 'uname -n' and storing it in
+'MyOrigin' for later use. We may also set variables with the '-v'
+option from the command line. This interactivity is only of importance
+in the context of starting a mobile agent; therefore this 'BEGIN'
pattern and its action do not take part in migration:
BEGIN {
@@ -2815,15 +2802,15 @@ pattern and its action do not take part in migration:
}
}
- Since `gawk' cannot manipulate and transmit parts of the program
-directly, the source code is read and stored in strings. Therefore,
-the program scans itself for the beginning and the ending of functions.
-Each line in between is appended to the code string until the end of
-the function has been reached. A special case is this part of the
-program itself. It is not a function. Placing a similar framework
-around it causes it to be treated like a function. Notice that this
-mechanism works for all the functions of the source code, but it cannot
-guarantee that the order of the functions is preserved during migration:
+ Since 'gawk' cannot manipulate and transmit parts of the program
+directly, the source code is read and stored in strings. Therefore, the
+program scans itself for the beginning and the ending of functions.
+Each line in between is appended to the code string until the end of the
+function has been reached. A special case is this part of the program
+itself. It is not a function. Placing a similar framework around it
+causes it to be treated like a function. Notice that this mechanism
+works for all the functions of the source code, but it cannot guarantee
+that the order of the functions is preserved during migration:
#ReadMySelf
/^function / { FUNC = $2 }
@@ -2835,10 +2822,10 @@ guarantee that the order of the functions is preserved during migration:
The web server code in *note A Web Service with Interaction:
Interacting Service, was first developed as a site-independent core.
-Likewise, the `gawk'-based mobile agent starts with an
-agent-independent core, to which can be appended application-dependent
-functions. What follows is the only application-independent function
-needed for the mobile agent:
+Likewise, the 'gawk'-based mobile agent starts with an agent-independent
+core, to which can be appended application-dependent functions. What
+follows is the only application-independent function needed for the
+mobile agent:
function migrate(Destination, MobCode, Label) {
MOBVAR["Label"] = Label
@@ -2859,54 +2846,54 @@ needed for the mobile agent:
close(HttpService)
}
- The `migrate' function prepares the aforementioned strings
-containing the program code and transmits them to a server. A
-consequence of this modular approach is that the `migrate' function
-takes some parameters that aren't needed in this application, but that
-will be in future ones. Its mandatory parameter `Destination' holds the
-name (or IP address) of the server that the agent wants as a host for
-its code. The optional parameter `MobCode' may contain some `gawk' code
-that is inserted during migration in front of all other code. The
-optional parameter `Label' may contain a string that tells the agent
-what to do in program execution after arrival at its new home site. One
-of the serious obstacles in implementing a framework for mobile agents
-is that it does not suffice to migrate the code. It is also necessary
-to migrate the state of execution of the agent. In contrast to `Agent
-Tcl', this program does not try to migrate the complete set of
-variables. The following conventions are used:
+ The 'migrate' function prepares the aforementioned strings containing
+the program code and transmits them to a server. A consequence of this
+modular approach is that the 'migrate' function takes some parameters
+that aren't needed in this application, but that will be in future ones.
+Its mandatory parameter 'Destination' holds the name (or IP address) of
+the server that the agent wants as a host for its code. The optional
+parameter 'MobCode' may contain some 'gawk' code that is inserted during
+migration in front of all other code. The optional parameter 'Label'
+may contain a string that tells the agent what to do in program
+execution after arrival at its new home site. One of the serious
+obstacles in implementing a framework for mobile agents is that it does
+not suffice to migrate the code. It is also necessary to migrate the
+state of execution of the agent. In contrast to 'Agent Tcl', this
+program does not try to migrate the complete set of variables. The
+following conventions are used:
* Each variable in an agent program is local to the current host and
does _not_ migrate.
- * The array `MOBFUN' shown above is an exception. It is handled by
- the function `migrate' and does migrate with the application.
+ * The array 'MOBFUN' shown above is an exception. It is handled by
+ the function 'migrate' and does migrate with the application.
- * The other exception is the array `MOBVAR'. Each variable that
+ * The other exception is the array 'MOBVAR'. Each variable that
takes part in migration has to be an element of this array.
- `migrate' also takes care of this.
+ 'migrate' also takes care of this.
- Now it's clear what happens to the `Label' parameter of the function
-`migrate'. It is copied into `MOBVAR["Label"]' and travels alongside
-the other data. Since travelling takes place via HTTP, records must be
-separated with `"\r\n"' in `RS' and `ORS' as usual. The code assembly
+ Now it's clear what happens to the 'Label' parameter of the function
+'migrate'. It is copied into 'MOBVAR["Label"]' and travels alongside
+the other data. Since travelling takes place via HTTP, records must be
+separated with '"\r\n"' in 'RS' and 'ORS' as usual. The code assembly
for migration takes place in three steps:
- * Iterate over `MOBFUN' to collect all functions verbatim.
+ * Iterate over 'MOBFUN' to collect all functions verbatim.
- * Prepare a `BEGIN' pattern and put assignments to mobile variables
+ * Prepare a 'BEGIN' pattern and put assignments to mobile variables
into the action part.
* Transmission itself resembles GETURL: the header with the request
- and the `Content-length' is followed by the body. In case there is
+ and the 'Content-length' is followed by the body. In case there is
any reply over the network, it is read completely and echoed to
standard output to avoid irritating the server.
- The application-independent framework is now almost complete. What
-follows is the `END' pattern that is executed when the mobile agent has
-finished reading its own code. First, it checks whether it is already
-running on a remote host or not. In case initialization has not yet
-taken place, it starts `MyInit'. Otherwise (later, on a remote host), it
-starts `MyJob':
+ The application-independent framework is now almost complete. What
+follows is the 'END' pattern that is executed when the mobile agent has
+finished reading its own code. First, it checks whether it is already
+running on a remote host or not. In case initialization has not yet
+taken place, it starts 'MyInit'. Otherwise (later, on a remote host),
+it starts 'MyJob':
END {
if (ARGC != 2) exit # stop when called with wrong parameters
@@ -2917,7 +2904,7 @@ starts `MyJob':
}
All that's left to extend the framework into a complete application
-is to write two application-specific functions: `MyInit' and `MyJob'.
+is to write two application-specific functions: 'MyInit' and 'MyJob'.
Keep in mind that the former is executed once on the originating host,
while the latter is executed after each migration:
@@ -2932,11 +2919,11 @@ while the latter is executed after each migration:
}
As mentioned earlier, this agent takes the name of its origin
-(`MyOrigin') with it. Then, it takes the name of its first destination
-and goes there for further work. Notice that this name has the port
-number of the web server appended to the name of the server, because
-the function `migrate' needs it this way to create the `HttpService'
-variable. Finally, it waits for the result to arrive. The `MyJob'
+('MyOrigin') with it. Then, it takes the name of its first destination
+and goes there for further work. Notice that this name has the port
+number of the web server appended to the name of the server, because the
+function 'migrate' needs it this way to create the 'HttpService'
+variable. Finally, it waits for the result to arrive. The 'MyJob'
function runs on the remote host:
function MyJob() {
@@ -2956,23 +2943,23 @@ function runs on the remote host:
}
}
- After migrating, the first thing to do in `MyJob' is to delete the
-name of the current host from the list of hosts to visit. Now, it is
+ After migrating, the first thing to do in 'MyJob' is to delete the
+name of the current host from the list of hosts to visit. Now, it is
time to start the real work by appending the host's name to the result
string, and reading line by line who is logged in on this host. A very
-annoying circumstance is the fact that the elements of `MOBVAR' cannot
-hold the newline character (`"\n"'). If they did, migration of this
-string did not work because the string didn't obey the syntax rule for
-a string in `gawk'. `SUBSEP' is used as a temporary replacement. If
-the list of hosts to visit holds at least one more entry, the agent
-migrates to that place to go on working there. Otherwise, we replace
-the `SUBSEP's with a newline character in the resulting string, and
-report it to the originating host, whose name is stored in
-`MOBVAR["MyOrigin"]'.
+annoying circumstance is the fact that the elements of 'MOBVAR' cannot
+hold the newline character ('"\n"'). If they did, migration of this
+string did not work because the string didn't obey the syntax rule for a
+string in 'gawk'. 'SUBSEP' is used as a temporary replacement. If the
+list of hosts to visit holds at least one more entry, the agent migrates
+to that place to go on working there. Otherwise, we replace the
+'SUBSEP's with a newline character in the resulting string, and report
+it to the originating host, whose name is stored in
+'MOBVAR["MyOrigin"]'.
---------- Footnotes ----------
- (1) `http://www.research.ibm.com/massive/mobag.ps'
+ (1) <http://www.research.ibm.com/massive/mobag.ps>

File: gawkinet.info, Node: STOXPRED, Next: PROTBASE, Prev: MOBAGWHO, Up: Some Applications and Techniques
@@ -2980,30 +2967,30 @@ File: gawkinet.info, Node: STOXPRED, Next: PROTBASE, Prev: MOBAGWHO, Up: Som
3.9 STOXPRED: Stock Market Prediction As A Service
==================================================
- Far out in the uncharted backwaters of the unfashionable end of
- the Western Spiral arm of the Galaxy lies a small unregarded
- yellow sun.
+ Far out in the uncharted backwaters of the unfashionable end of the
+ Western Spiral arm of the Galaxy lies a small unregarded yellow
+ sun.
Orbiting this at a distance of roughly ninety-two million miles is
an utterly insignificant little blue-green planet whose
ape-descendent life forms are so amazingly primitive that they
still think digital watches are a pretty neat idea.
- This planet has -- or rather had -- a problem, which was this:
- most of the people living on it were unhappy for pretty much of
- the time. Many solutions were suggested for this problem, but
- most of these were largely concerned with the movements of small
- green pieces of paper, which is odd because it wasn't the small
- green pieces of paper that were unhappy.
- Douglas Adams, `The Hitch Hiker's Guide to the Galaxy'
+ This planet has -- or rather had -- a problem, which was this: most
+ of the people living on it were unhappy for pretty much of the
+ time. Many solutions were suggested for this problem, but most of
+ these were largely concerned with the movements of small green
+ pieces of paper, which is odd because it wasn't the small green
+ pieces of paper that were unhappy.
+ Douglas Adams, 'The Hitch Hiker's Guide to the Galaxy'
Valuable services on the Internet are usually _not_ implemented as
-mobile agents. There are much simpler ways of implementing services.
-All Unix systems provide, for example, the `cron' service. Unix system
+mobile agents. There are much simpler ways of implementing services.
+All Unix systems provide, for example, the 'cron' service. Unix system
users can write a list of tasks to be done each day, each week, twice a
-day, or just once. The list is entered into a file named `crontab'.
+day, or just once. The list is entered into a file named 'crontab'.
For example, to distribute a newsletter on a daily basis this way, use
-`cron' for calling a script each day early in the morning.
+'cron' for calling a script each day early in the morning.
# run at 8 am on weekdays, distribute the newsletter
0 8 * * 1-5 $HOME/bin/daily.job >> $HOME/log/newsletter 2>&1
@@ -3012,13 +2999,13 @@ For example, to distribute a newsletter on a daily basis this way, use
assembles it in a nice form and sends the results via email to the
customers.
- The following is an example of a primitive newsletter on stock
-market prediction. It is a report which first tries to predict the
-change of each share in the Dow Jones Industrial Index for the
-particular day. Then it mentions some especially promising shares as
-well as some shares which look remarkably bad on that day. The report
-ends with the usual disclaimer which tells every child _not_ to try
-this at home and hurt anybody.
+ The following is an example of a primitive newsletter on stock market
+prediction. It is a report which first tries to predict the change of
+each share in the Dow Jones Industrial Index for the particular day.
+Then it mentions some especially promising shares as well as some shares
+which look remarkably bad on that day. The report ends with the usual
+disclaimer which tells every child _not_ to try this at home and hurt
+anybody.
Good morning Uncle Scrooge,
@@ -3053,7 +3040,7 @@ this at home and hurt anybody.
DD http://biz.yahoo.com/n/d/dd.html
...
- The script as a whole is rather long. In order to ease the pain of
+ The script as a whole is rather long. In order to ease the pain of
studying other people's source code, we have broken the script up into
meaningful parts which are invoked one after the other. The basic
structure of the script is as follows:
@@ -3068,17 +3055,17 @@ structure of the script is as follows:
}
The earlier parts store data into variables and arrays which are
-subsequently used by later parts of the script. The `Init' function
+subsequently used by later parts of the script. The 'Init' function
first checks if the script is invoked correctly (without any
-parameters). If not, it informs the user of the correct usage. What
-follows are preparations for the retrieval of the historical quote
-data. The names of the 30 stock shares are stored in an array `name'
-along with the current date in `day', `month', and `year'.
+parameters). If not, it informs the user of the correct usage. What
+follows are preparations for the retrieval of the historical quote data.
+The names of the 30 stock shares are stored in an array 'name' along
+with the current date in 'day', 'month', and 'year'.
All users who are separated from the Internet by a firewall and have
-to direct their Internet accesses to a proxy must supply the name of
-the proxy to this script with the `-v Proxy=NAME' option. For most
-users, the default proxy and port number should suffice.
+to direct their Internet accesses to a proxy must supply the name of the
+proxy to this script with the '-v Proxy=NAME' option. For most users,
+the default proxy and port number should suffice.
function Init() {
if (ARGC != 1) {
@@ -3102,12 +3089,12 @@ users, the default proxy and port number should suffice.
YahooData = "/inet/tcp/0/" Proxy "/" ProxyPort
}
- There are two really interesting parts in the script. One is the
+ There are two really interesting parts in the script. One is the
function which reads the historical stock quotes from an Internet
-server. The other is the one that does the actual prediction. In the
-following function we see how the quotes are read from the Yahoo
-server. The data which comes from the server is in CSV format
-(comma-separated values):
+server. The other is the one that does the actual prediction. In the
+following function we see how the quotes are read from the Yahoo server.
+The data which comes from the server is in CSV format (comma-separated
+values):
Date,Open,High,Low,Close,Volume
9-Oct-00,22.75,22.75,21.375,22.375,7888500
@@ -3116,22 +3103,22 @@ server. The data which comes from the server is in CSV format
Lines contain values of the same time instant, whereas columns are
separated by commas and contain the kind of data that is described in
-the header (first) line. At first, `gawk' is instructed to separate
-columns by commas (`FS = ","'). In the loop that follows, a connection
+the header (first) line. At first, 'gawk' is instructed to separate
+columns by commas ('FS = ","'). In the loop that follows, a connection
to the Yahoo server is first opened, then a download takes place, and
-finally the connection is closed. All this happens once for each ticker
-symbol. In the body of this loop, an Internet address is built up as a
-string according to the rules of the Yahoo server. The starting and
-ending date are chosen to be exactly the same, but one year apart in
-the past. All the action is initiated within the `printf' command which
+finally the connection is closed. All this happens once for each ticker
+symbol. In the body of this loop, an Internet address is built up as a
+string according to the rules of the Yahoo server. The starting and
+ending date are chosen to be exactly the same, but one year apart in the
+past. All the action is initiated within the 'printf' command which
transmits the request for data to the Yahoo server.
In the inner loop, the server's data is first read and then scanned
-line by line. Only lines which have six columns and the name of a month
-in the first column contain relevant data. This data is stored in the
-two-dimensional array `quote'; one dimension being time, the other
-being the ticker symbol. During retrieval of the first stock's data,
-the calendar names of the time instances are stored in the array `day'
+line by line. Only lines which have six columns and the name of a month
+in the first column contain relevant data. This data is stored in the
+two-dimensional array 'quote'; one dimension being time, the other being
+the ticker symbol. During retrieval of the first stock's data, the
+calendar names of the time instances are stored in the array 'day'
because we need them later.
function ReadQuotes() {
@@ -3157,9 +3144,9 @@ because we need them later.
Now that we _have_ the data, it can be checked once again to make
sure that no individual stock is missing or invalid, and that all the
-stock quotes are aligned correctly. Furthermore, we renumber the time
-instances. The most recent day gets day number 1 and all other days get
-consecutive numbers. All quotes are rounded toward the nearest whole
+stock quotes are aligned correctly. Furthermore, we renumber the time
+instances. The most recent day gets day number 1 and all other days get
+consecutive numbers. All quotes are rounded toward the nearest whole
number in US Dollars.
function CleanUp() {
@@ -3181,13 +3168,13 @@ number in US Dollars.
Now we have arrived at the second really interesting part of the
whole affair. What we present here is a very primitive prediction
algorithm: _If a stock fell yesterday, assume it will also fall today;
-if it rose yesterday, assume it will rise today_. (Feel free to
-replace this algorithm with a smarter one.) If a stock changed in the
-same direction on two consecutive days, this is an indication which
-should be highlighted. Two-day advances are stored in `hot' and
-two-day declines in `avoid'.
+if it rose yesterday, assume it will rise today_. (Feel free to replace
+this algorithm with a smarter one.) If a stock changed in the same
+direction on two consecutive days, this is an indication which should be
+highlighted. Two-day advances are stored in 'hot' and two-day declines
+in 'avoid'.
- The rest of the function is a sanity check. It counts the number of
+ The rest of the function is a sanity check. It counts the number of
correct predictions in relation to the total number of predictions one
could have made in the year before.
@@ -3224,9 +3211,9 @@ could have made in the year before.
}
}
- At this point the hard work has been done: the array `predict'
-contains the predictions for all the ticker symbols. It is up to the
-function `Report' to find some nice words to introduce the desired
+ At this point the hard work has been done: the array 'predict'
+contains the predictions for all the ticker symbols. It is up to the
+function 'Report' to find some nice words to introduce the desired
information.
function Report() {
@@ -3263,8 +3250,8 @@ information.
report = report "you should visit a doctor who can treat your ailment."
}
- The function `SendMail' goes through the list of customers and opens
-a pipe to the `mail' command for each of them. Each one receives an
+ The function 'SendMail' goes through the list of customers and opens
+a pipe to the 'mail' command for each of them. Each one receives an
email message with a proper subject heading and is addressed with his
full name.
@@ -3290,8 +3277,8 @@ all the ticker symbols and sending the emails may take several minutes
to complete, depending upon network traffic and the speed of the
available Internet link. The quality of the prediction algorithm is
likely to be disappointing. Try to find a better one. Should you find
-one with a success rate of more than 50%, please tell us about it! It
-is only for the sake of curiosity, of course. `:-)'
+one with a success rate of more than 50%, please tell us about it! It
+is only for the sake of curiosity, of course. ':-)'

File: gawkinet.info, Node: PROTBASE, Prev: STOXPRED, Up: Some Applications and Techniques
@@ -3300,75 +3287,75 @@ File: gawkinet.info, Node: PROTBASE, Prev: STOXPRED, Up: Some Applications an
===================================================
Hoare's Law of Large Problems: Inside every large problem is a
- small problem struggling to get out.
+ small problem struggling to get out.
Yahoo's database of stock market data is just one among the many
-large databases on the Internet. Another one is located at NCBI
-(National Center for Biotechnology Information). Established in 1988 as
+large databases on the Internet. Another one is located at NCBI
+(National Center for Biotechnology Information). Established in 1988 as
a national resource for molecular biology information, NCBI creates
public databases, conducts research in computational biology, develops
software tools for analyzing genome data, and disseminates biomedical
-information. In this section, we look at one of NCBI's public services,
+information. In this section, we look at one of NCBI's public services,
which is called BLAST (Basic Local Alignment Search Tool).
You probably know that the information necessary for reproducing
-living cells is encoded in the genetic material of the cells. The
-genetic material is a very long chain of four base nucleotides. It is
-the order of appearance (the sequence) of nucleotides which contains
-the information about the substance to be produced. Scientists in
+living cells is encoded in the genetic material of the cells. The
+genetic material is a very long chain of four base nucleotides. It is
+the order of appearance (the sequence) of nucleotides which contains the
+information about the substance to be produced. Scientists in
biotechnology often find a specific fragment, determine the nucleotide
-sequence, and need to know where the sequence at hand comes from. This
-is where the large databases enter the game. At NCBI, databases store
+sequence, and need to know where the sequence at hand comes from. This
+is where the large databases enter the game. At NCBI, databases store
the knowledge about which sequences have ever been found and where they
have been found. When the scientist sends his sequence to the BLAST
service, the server looks for regions of genetic material in its
database which look the most similar to the delivered nucleotide
-sequence. After a search time of some seconds or minutes the server
-sends an answer to the scientist. In order to make access simple, NCBI
+sequence. After a search time of some seconds or minutes the server
+sends an answer to the scientist. In order to make access simple, NCBI
chose to offer their database service through popular Internet
-protocols. There are four basic ways to use the so-called BLAST
+protocols. There are four basic ways to use the so-called BLAST
services:
- * The easiest way to use BLAST is through the web. Users may simply
+ * The easiest way to use BLAST is through the web. Users may simply
point their browsers at the NCBI home page and link to the BLAST
pages. NCBI provides a stable URL that may be used to perform
- BLAST searches without interactive use of a web browser. This is
+ BLAST searches without interactive use of a web browser. This is
what we will do later in this section. A demonstration client and
- a `README' file demonstrate how to access this URL.
+ a 'README' file demonstrate how to access this URL.
- * Currently, `blastcl3' is the standard network BLAST client. You
- can download `blastcl3' from the anonymous FTP location.
+ * Currently, 'blastcl3' is the standard network BLAST client. You
+ can download 'blastcl3' from the anonymous FTP location.
* BLAST 2.0 can be run locally as a full executable and can be used
to run BLAST searches against private local databases, or
- downloaded copies of the NCBI databases. BLAST 2.0 executables may
+ downloaded copies of the NCBI databases. BLAST 2.0 executables may
be found on the NCBI anonymous FTP server.
* The NCBI BLAST Email server is the best option for people without
- convenient access to the web. A similarity search can be performed
+ convenient access to the web. A similarity search can be performed
by sending a properly formatted mail message containing the
nucleotide or protein query sequence to <blast@ncbi.nlm.nih.gov>.
- The query sequence is compared against the specified database
- using the BLAST algorithm and the results are returned in an email
- message. For more information on formulating email BLAST searches,
+ The query sequence is compared against the specified database using
+ the BLAST algorithm and the results are returned in an email
+ message. For more information on formulating email BLAST searches,
you can send a message consisting of the word "HELP" to the same
address, <blast@ncbi.nlm.nih.gov>.
- Our starting point is the demonstration client mentioned in the
-first option. The `README' file that comes along with the client
-explains the whole process in a nutshell. In the rest of this section,
-we first show what such requests look like. Then we show how to use
-`gawk' to implement a client in about 10 lines of code. Finally, we
-show how to interpret the result returned from the service.
+ Our starting point is the demonstration client mentioned in the first
+option. The 'README' file that comes along with the client explains the
+whole process in a nutshell. In the rest of this section, we first show
+what such requests look like. Then we show how to use 'gawk' to
+implement a client in about 10 lines of code. Finally, we show how to
+interpret the result returned from the service.
Sequences are expected to be represented in the standard IUB/IUPAC
-amino acid and nucleic acid codes, with these exceptions: lower-case
+amino acid and nucleic acid codes, with these exceptions: lower-case
letters are accepted and are mapped into upper-case; a single hyphen or
dash can be used to represent a gap of indeterminate length; and in
-amino acid sequences, `U' and `*' are acceptable letters (see below).
+amino acid sequences, 'U' and '*' are acceptable letters (see below).
Before submitting a request, any numerical digits in the query sequence
should either be removed or replaced by appropriate letter codes (e.g.,
-`N' for unknown nucleic acid residue or `X' for unknown amino acid
+'N' for unknown nucleic acid residue or 'X' for unknown amino acid
residue). The nucleic acid codes supported are:
A --> adenosine M --> A C (amino)
@@ -3381,10 +3368,10 @@ residue). The nucleic acid codes supported are:
K --> G T (keto) N --> A G C T (any)
- gap of indeterminate length
- Now you know the alphabet of nucleotide sequences. The last two lines
-of the following example query show you such a sequence, which is
+ Now you know the alphabet of nucleotide sequences. The last two
+lines of the following example query show you such a sequence, which is
obviously made up only of elements of the alphabet just described.
-Store this example query into a file named `protbase.request'. You are
+Store this example query into a file named 'protbase.request'. You are
now ready to send it to the server with the demonstration client.
PROGRAM blastn
@@ -3396,38 +3383,38 @@ now ready to send it to the server with the demonstration client.
caccaccatggacagcaaa
The actual search request begins with the mandatory parameter
-`PROGRAM' in the first column followed by the value `blastn' (the name
-of the program) for searching nucleic acids. The next line contains
-the mandatory search parameter `DATALIB' with the value `month' for the
+'PROGRAM' in the first column followed by the value 'blastn' (the name
+of the program) for searching nucleic acids. The next line contains the
+mandatory search parameter 'DATALIB' with the value 'month' for the
newest nucleic acid sequences. The third line contains an optional
-`EXPECT' parameter and the value desired for it. The fourth line
-contains the mandatory `BEGIN' directive, followed by the query
-sequence in FASTA/Pearson format. Each line of information must be
-less than 80 characters in length.
+'EXPECT' parameter and the value desired for it. The fourth line
+contains the mandatory 'BEGIN' directive, followed by the query sequence
+in FASTA/Pearson format. Each line of information must be less than 80
+characters in length.
The "month" database contains all new or revised sequences released
in the last 30 days and is useful for searching against new sequences.
-There are five different blast programs, `blastn' being the one that
-compares a nucleotide query sequence against a nucleotide sequence
+There are five different blast programs, 'blastn' being the one that
+compares a nucleotide query sequence against a nucleotide sequence
database.
The last server directive that must appear in every request is the
-`BEGIN' directive. The query sequence should immediately follow the
-`BEGIN' directive and must appear in FASTA/Pearson format. A sequence
+'BEGIN' directive. The query sequence should immediately follow the
+'BEGIN' directive and must appear in FASTA/Pearson format. A sequence
in FASTA/Pearson format begins with a single-line description. The
description line, which is required, is distinguished from the lines of
-sequence data that follow it by having a greater-than (`>') symbol in
-the first column. For the purposes of the BLAST server, the text of
-the description is arbitrary.
-
- If you prefer to use a client written in `gawk', just store the
-following 10 lines of code into a file named `protbase.awk' and use
-this client instead. Invoke it with `gawk -f protbase.awk
-protbase.request'. Then wait a minute and watch the result coming in.
-In order to replicate the demonstration client's behavior as closely as
-possible, this client does not use a proxy server. We could also have
-extended the client program in *note Retrieving Web Pages: GETURL, to
-implement the client request from `protbase.awk' as a special case.
+sequence data that follow it by having a greater-than ('>') symbol in
+the first column. For the purposes of the BLAST server, the text of the
+description is arbitrary.
+
+ If you prefer to use a client written in 'gawk', just store the
+following 10 lines of code into a file named 'protbase.awk' and use this
+client instead. Invoke it with 'gawk -f protbase.awk protbase.request'.
+Then wait a minute and watch the result coming in. In order to
+replicate the demonstration client's behavior as closely as possible,
+this client does not use a proxy server. We could also have extended
+the client program in *note Retrieving Web Pages: GETURL, to implement
+the client request from 'protbase.awk' as a special case.
{ request = request "\n" $0 }
@@ -3442,18 +3429,18 @@ implement the client request from `protbase.awk' as a special case.
}
The demonstration client from NCBI is 214 lines long (written in C)
-and it is not immediately obvious what it does. Our client is so short
-that it _is_ obvious what it does. First it loops over all lines of the
-query and stores the whole query into a variable. Then the script
+and it is not immediately obvious what it does. Our client is so short
+that it _is_ obvious what it does. First it loops over all lines of the
+query and stores the whole query into a variable. Then the script
establishes an Internet connection to the NCBI server and transmits the
-query by framing it with a proper HTTP request. Finally it receives and
+query by framing it with a proper HTTP request. Finally it receives and
prints the complete result coming from the server.
- Now, let us look at the result. It begins with an HTTP header, which
-you can ignore. Then there are some comments about the query having been
-filtered to avoid spuriously high scores. After this, there is a
+ Now, let us look at the result. It begins with an HTTP header, which
+you can ignore. Then there are some comments about the query having
+been filtered to avoid spuriously high scores. After this, there is a
reference to the paper that describes the software being used for
-searching the data base. After a repetition of the original query's
+searching the data base. After a repetition of the original query's
description we find the list of significant alignments:
Sequences producing significant alignments: (bits) Value
@@ -3469,13 +3456,13 @@ description we find the list of significant alignments:
This means that the query sequence was found in seven human
chromosomes. But the value 0.20 (20%) means that the probability of an
accidental match is rather high (20%) in all cases and should be taken
-into account. You may wonder what the first column means. It is a key
-to the specific database in which this occurrence was found. The
-unique sequence identifiers reported in the search results can be used
-as sequence retrieval keys via the NCBI server. The syntax of sequence
+into account. You may wonder what the first column means. It is a key
+to the specific database in which this occurrence was found. The unique
+sequence identifiers reported in the search results can be used as
+sequence retrieval keys via the NCBI server. The syntax of sequence
header lines used by the NCBI BLAST server depends on the database from
-which each sequence was obtained. The table below lists the
-identifiers for the databases from which the sequences were derived.
+which each sequence was obtained. The table below lists the identifiers
+for the databases from which the sequences were derived.
Database Name Identifier Syntax
============================ ========================
@@ -3490,14 +3477,14 @@ identifiers for the databases from which the sequences were derived.
Patents pat|country|number
GenInfo Backbone Id bbs|number
- For example, an identifier might be `gb|AC021182.14|AC021182', where
-the `gb' tag indicates that the identifier refers to a GenBank sequence,
-`AC021182.14' is its GenBank ACCESSION, and `AC021182' is the GenBank
-LOCUS. The identifier contains no spaces, so that a space indicates
-the end of the identifier.
+ For example, an identifier might be 'gb|AC021182.14|AC021182', where
+the 'gb' tag indicates that the identifier refers to a GenBank sequence,
+'AC021182.14' is its GenBank ACCESSION, and 'AC021182' is the GenBank
+LOCUS. The identifier contains no spaces, so that a space indicates the
+end of the identifier.
- Let us continue in the result listing. Each of the seven alignments
-mentioned above is subsequently described in detail. We will have a
+ Let us continue in the result listing. Each of the seven alignments
+mentioned above is subsequently described in detail. We will have a
closer look at the first of them.
>gb|AC021182.14|AC021182 Homo sapiens chromosome 7 clone RP11-733N23, WORKING DRAFT SEQUENCE, 4
@@ -3512,31 +3499,31 @@ closer look at the first of them.
|||||||||||||||||||
Sbjct: 69786 tggtgaagtgtgtttcttg 69804
- This alignment was located on the human chromosome 7. The fragment
-on which part of the query was found had a total length of 176383. Only
+ This alignment was located on the human chromosome 7. The fragment
+on which part of the query was found had a total length of 176383. Only
19 of the nucleotides matched and the matching sequence ran from
character 35 to 53 in the query sequence and from 69786 to 69804 in the
fragment on chromosome 7. If you are still reading at this point, you
are probably interested in finding out more about Computational Biology
and you might appreciate the following hints.
- 1. There is a book called `Introduction to Computational Biology' by
+ 1. There is a book called 'Introduction to Computational Biology' by
Michael S. Waterman, which is worth reading if you are seriously
- interested. You can find a good book review on the Internet.
+ interested. You can find a good book review on the Internet.
2. While Waterman's book can explain to you the algorithms employed
internally in the database search engines, most practitioners
- prefer to approach the subject differently. The applied side of
+ prefer to approach the subject differently. The applied side of
Computational Biology is called Bioinformatics, and emphasizes the
tools available for day-to-day work as well as how to actually
- _use_ them. One of the very few affordable books on Bioinformatics
- is `Developing Bioinformatics Computer Skills'.
+ _use_ them. One of the very few affordable books on Bioinformatics
+ is 'Developing Bioinformatics Computer Skills'.
3. The sequences _gawk_ and _gnuawk_ are in widespread use in the
- genetic material of virtually every earthly living being. Let us
+ genetic material of virtually every earthly living being. Let us
take this as a clear indication that the divine creator has
- intended `gawk' to prevail over other scripting languages such as
- `perl', `tcl', or `python' which are not even proper sequences.
+ intended 'gawk' to prevail over other scripting languages such as
+ 'perl', 'tcl', or 'python' which are not even proper sequences.
(:-)

@@ -3548,123 +3535,122 @@ File: gawkinet.info, Node: Links, Next: GNU Free Documentation License, Prev:
This section lists the URLs for various items discussed in this major
node. They are presented in the order in which they appear.
-`Internet Programming with Python'
- `http://www.fsbassociates.com/books/python.htm'
+'Internet Programming with Python'
+ <http://www.fsbassociates.com/books/python.htm>
-`Advanced Perl Programming'
- `http://www.oreilly.com/catalog/advperl'
+'Advanced Perl Programming'
+ <http://www.oreilly.com/catalog/advperl>
-`Web Client Programming with Perl'
- `http://www.oreilly.com/catalog/webclient'
+'Web Client Programming with Perl'
+ <http://www.oreilly.com/catalog/webclient>
Richard Stevens's home page and book
- `http://www.kohala.com/~rstevens'
+ <http://www.kohala.com/~rstevens>
The SPAK home page
- `http://www.userfriendly.net/linux/RPM/contrib/libc6/i386/spak-0.6b-1.i386.html'
+ <http://www.userfriendly.net/linux/RPM/contrib/libc6/i386/spak-0.6b-1.i386.html>
-Volume III of `Internetworking with TCP/IP', by Comer and Stevens
- `http://www.cs.purdue.edu/homes/dec/tcpip3s.cont.html'
+Volume III of 'Internetworking with TCP/IP', by Comer and Stevens
+ <http://www.cs.purdue.edu/homes/dec/tcpip3s.cont.html>
XBM Graphics File Format
- `http://www.wotsit.org/download.asp?f=xbm'
+ <http://www.wotsit.org/download.asp?f=xbm>
GNUPlot
- `http://www.cs.dartmouth.edu/gnuplot_info.html'
+ <http://www.cs.dartmouth.edu/gnuplot_info.html>
Mark Humphrys' Eliza page
- `http://www.compapp.dcu.ie/~humphrys/eliza.html'
+ <http://www.compapp.dcu.ie/~humphrys/eliza.html>
Yahoo! Eliza Information
- `http://dir.yahoo.com/Recreation/Games/Computer_Games/Internet_Games/Web_Games/Artificial_Intelligence'
+ <http://dir.yahoo.com/Recreation/Games/Computer_Games/Internet_Games/Web_Games/Artificial_Intelligence>
Java versions of Eliza
- `http://www.tjhsst.edu/Psych/ch1/eliza.html'
+ <http://www.tjhsst.edu/Psych/ch1/eliza.html>
Java versions of Eliza with source code
- `http://home.adelphia.net/~lifeisgood/eliza/eliza.htm'
+ <http://home.adelphia.net/~lifeisgood/eliza/eliza.htm>
Eliza Programs with Explanations
- `http://chayden.net/chayden/eliza/Eliza.shtml'
+ <http://chayden.net/chayden/eliza/Eliza.shtml>
Loebner Contest
- `http://acm.org/~loebner/loebner-prize.htmlx'
+ <http://acm.org/~loebner/loebner-prize.htmlx>
Tck/Tk Information
- `http://www.scriptics.com/'
+ <http://www.scriptics.com/>
Intel 80x86 Processors
- `http://developer.intel.com/design/platform/embedpc/what_is.htm'
+ <http://developer.intel.com/design/platform/embedpc/what_is.htm>
AMD Elan Processors
- `http://www.amd.com/products/epd/processors/4.32bitcont/32bitcont/index.html'
+ <http://www.amd.com/products/epd/processors/4.32bitcont/32bitcont/index.html>
XINU
- `http://willow.canberra.edu.au/~chrisc/xinu.html'
+ <http://willow.canberra.edu.au/~chrisc/xinu.html>
GNU/Linux
- `http://uclinux.lineo.com/'
+ <http://uclinux.lineo.com/>
Embedded PCs
- `http://dir.yahoo.com/Business_and_Economy/Business_to_Business/Computers/Hardware/Embedded_Control/'
+ <http://dir.yahoo.com/Business_and_Economy/Business_to_Business/Computers/Hardware/Embedded_Control/>
MiniSQL
- `http://www.hughes.com.au/library/'
+ <http://www.hughes.com.au/library/>
Market Share Surveys
- `http://www.netcraft.com/survey'
+ <http://www.netcraft.com/survey>
-`Numerical Recipes in C: The Art of Scientific Computing'
- `http://www.nr.com'
+'Numerical Recipes in C: The Art of Scientific Computing'
+ <http://www.nr.com>
VRML
- `http://www.vrml.org'
+ <http://www.vrml.org>
The VRML FAQ
- `http://www.vrml.org/technicalinfo/specifications/specifications.htm#FAQ'
+ <http://www.vrml.org/technicalinfo/specifications/specifications.htm#FAQ>
The UMBC Agent Web
- `http://www.cs.umbc.edu/agents'
+ <http://www.cs.umbc.edu/agents>
Apache Web Server
- `http://www.apache.org'
+ <http://www.apache.org>
National Center for Biotechnology Information (NCBI)
- `http://www.ncbi.nlm.nih.gov'
+ <http://www.ncbi.nlm.nih.gov>
Basic Local Alignment Search Tool (BLAST)
- `http://www.ncbi.nlm.nih.gov/BLAST/blast_overview.html'
+ <http://www.ncbi.nlm.nih.gov/BLAST/blast_overview.html>
NCBI Home Page
- `http://www.ncbi.nlm.nih.gov'
+ <http://www.ncbi.nlm.nih.gov>
BLAST Pages
- `http://www.ncbi.nlm.nih.gov/BLAST'
+ <http://www.ncbi.nlm.nih.gov/BLAST>
BLAST Demonstration Client
- `ftp://ncbi.nlm.nih.gov/blast/blasturl/'
+ <ftp://ncbi.nlm.nih.gov/blast/blasturl/>
BLAST anonymous FTP location
- `ftp://ncbi.nlm.nih.gov/blast/network/netblast/'
+ <ftp://ncbi.nlm.nih.gov/blast/network/netblast/>
BLAST 2.0 Executables
- `ftp://ncbi.nlm.nih.gov/blast/executables/'
+ <ftp://ncbi.nlm.nih.gov/blast/executables/>
IUB/IUPAC Amino Acid and Nucleic Acid Codes
- `http://www.uthscsa.edu/geninfo/blastmail.html#item6'
+ <http://www.uthscsa.edu/geninfo/blastmail.html#item6>
FASTA/Pearson Format
- `http://www.ncbi.nlm.nih.gov/BLAST/fasta.html'
+ <http://www.ncbi.nlm.nih.gov/BLAST/fasta.html>
Fasta/Pearson Sequence in Java
- `http://www.kazusa.or.jp/java/codon_table_java/'
-
-Book Review of `Introduction to Computational Biology'
- `http://www.acm.org/crossroads/xrds5-1/introcb.html'
+ <http://www.kazusa.or.jp/java/codon_table_java/>
-`Developing Bioinformatics Computer Skills'
- `http://www.oreilly.com/catalog/bioskills/'
+Book Review of 'Introduction to Computational Biology'
+ <http://www.acm.org/crossroads/xrds5-1/introcb.html>
+'Developing Bioinformatics Computer Skills'
+ <http://www.oreilly.com/catalog/bioskills/>

File: gawkinet.info, Node: GNU Free Documentation License, Next: Index, Prev: Links, Up: Top
@@ -3675,7 +3661,7 @@ GNU Free Documentation License
Version 1.3, 3 November 2008
Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
- `http://fsf.org/'
+ <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -3700,21 +3686,21 @@ GNU Free Documentation License
free program should come with manuals providing the same freedoms
that the software does. But this License is not limited to
software manuals; it can be used for any textual work, regardless
- of subject matter or whether it is published as a printed book.
- We recommend this License principally for works whose purpose is
+ of subject matter or whether it is published as a printed book. We
+ recommend this License principally for works whose purpose is
instruction or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium,
- that contains a notice placed by the copyright holder saying it
- can be distributed under the terms of this License. Such a notice
+ that contains a notice placed by the copyright holder saying it can
+ be distributed under the terms of this License. Such a notice
grants a world-wide, royalty-free license, unlimited in duration,
to use that work under the conditions stated herein. The
"Document", below, refers to any such manual or work. Any member
- of the public is a licensee, and is addressed as "you". You
- accept the license if you copy, modify or distribute the work in a
- way requiring permission under copyright law.
+ of the public is a licensee, and is addressed as "you". You accept
+ the license if you copy, modify or distribute the work in a way
+ requiring permission under copyright law.
A "Modified Version" of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
@@ -3732,12 +3718,12 @@ GNU Free Documentation License
regarding them.
The "Invariant Sections" are certain Secondary Sections whose
- titles are designated, as being those of Invariant Sections, in
- the notice that says that the Document is released under this
- License. If a section does not fit the above definition of
- Secondary then it is not allowed to be designated as Invariant.
- The Document may contain zero Invariant Sections. If the Document
- does not identify any Invariant Sections then there are none.
+ titles are designated, as being those of Invariant Sections, in the
+ notice that says that the Document is released under this License.
+ If a section does not fit the above definition of Secondary then it
+ is not allowed to be designated as Invariant. The Document may
+ contain zero Invariant Sections. If the Document does not identify
+ any Invariant Sections then there are none.
The "Cover Texts" are certain short passages of text that are
listed, as Front-Cover Texts or Back-Cover Texts, in the notice
@@ -3748,27 +3734,27 @@ GNU Free Documentation License
A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
- straightforwardly with generic text editors or (for images
- composed of pixels) generic paint programs or (for drawings) some
- widely available drawing editor, and that is suitable for input to
- text formatters or for automatic translation to a variety of
- formats suitable for input to text formatters. A copy made in an
- otherwise Transparent file format whose markup, or absence of
- markup, has been arranged to thwart or discourage subsequent
- modification by readers is not Transparent. An image format is
- not Transparent if used for any substantial amount of text. A
- copy that is not "Transparent" is called "Opaque".
+ straightforwardly with generic text editors or (for images composed
+ of pixels) generic paint programs or (for drawings) some widely
+ available drawing editor, and that is suitable for input to text
+ formatters or for automatic translation to a variety of formats
+ suitable for input to text formatters. A copy made in an otherwise
+ Transparent file format whose markup, or absence of markup, has
+ been arranged to thwart or discourage subsequent modification by
+ readers is not Transparent. An image format is not Transparent if
+ used for any substantial amount of text. A copy that is not
+ "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format,
- SGML or XML using a publicly available DTD, and
- standard-conforming simple HTML, PostScript or PDF designed for
- human modification. Examples of transparent image formats include
- PNG, XCF and JPG. Opaque formats include proprietary formats that
- can be read and edited only by proprietary word processors, SGML or
- XML for which the DTD and/or processing tools are not generally
- available, and the machine-generated HTML, PostScript or PDF
- produced by some word processors for output purposes only.
+ SGML or XML using a publicly available DTD, and standard-conforming
+ simple HTML, PostScript or PDF designed for human modification.
+ Examples of transparent image formats include PNG, XCF and JPG.
+ Opaque formats include proprietary formats that can be read and
+ edited only by proprietary word processors, SGML or XML for which
+ the DTD and/or processing tools are not generally available, and
+ the machine-generated HTML, PostScript or PDF produced by some word
+ processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the
@@ -3806,8 +3792,8 @@ GNU Free Documentation License
may not use technical measures to obstruct or control the reading
or further copying of the copies you make or distribute. However,
you may accept compensation in exchange for copies. If you
- distribute a large enough number of copies you must also follow
- the conditions in section 3.
+ distribute a large enough number of copies you must also follow the
+ conditions in section 3.
You may also lend copies, under the same conditions stated above,
and you may publicly display copies.
@@ -3821,12 +3807,11 @@ GNU Free Documentation License
these Cover Texts: Front-Cover Texts on the front cover, and
Back-Cover Texts on the back cover. Both covers must also clearly
and legibly identify you as the publisher of these copies. The
- front cover must present the full title with all words of the
- title equally prominent and visible. You may add other material
- on the covers in addition. Copying with changes limited to the
- covers, as long as they preserve the title of the Document and
- satisfy these conditions, can be treated as verbatim copying in
- other respects.
+ front cover must present the full title with all words of the title
+ equally prominent and visible. You may add other material on the
+ covers in addition. Copying with changes limited to the covers, as
+ long as they preserve the title of the Document and satisfy these
+ conditions, can be treated as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
@@ -3834,40 +3819,39 @@ GNU Free Documentation License
adjacent pages.
If you publish or distribute Opaque copies of the Document
- numbering more than 100, you must either include a
- machine-readable Transparent copy along with each Opaque copy, or
- state in or with each Opaque copy a computer-network location from
- which the general network-using public has access to download
- using public-standard network protocols a complete Transparent
- copy of the Document, free of added material. If you use the
- latter option, you must take reasonably prudent steps, when you
- begin distribution of Opaque copies in quantity, to ensure that
- this Transparent copy will remain thus accessible at the stated
- location until at least one year after the last time you
- distribute an Opaque copy (directly or through your agents or
- retailers) of that edition to the public.
+ numbering more than 100, you must either include a machine-readable
+ Transparent copy along with each Opaque copy, or state in or with
+ each Opaque copy a computer-network location from which the general
+ network-using public has access to download using public-standard
+ network protocols a complete Transparent copy of the Document, free
+ of added material. If you use the latter option, you must take
+ reasonably prudent steps, when you begin distribution of Opaque
+ copies in quantity, to ensure that this Transparent copy will
+ remain thus accessible at the stated location until at least one
+ year after the last time you distribute an Opaque copy (directly or
+ through your agents or retailers) of that edition to the public.
It is requested, but not required, that you contact the authors of
- the Document well before redistributing any large number of
- copies, to give them a chance to provide you with an updated
- version of the Document.
+ the Document well before redistributing any large number of copies,
+ to give them a chance to provide you with an updated version of the
+ Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document
under the conditions of sections 2 and 3 above, provided that you
- release the Modified Version under precisely this License, with
- the Modified Version filling the role of the Document, thus
- licensing distribution and modification of the Modified Version to
- whoever possesses a copy of it. In addition, you must do these
- things in the Modified Version:
+ release the Modified Version under precisely this License, with the
+ Modified Version filling the role of the Document, thus licensing
+ distribution and modification of the Modified Version to whoever
+ possesses a copy of it. In addition, you must do these things in
+ the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title
- distinct from that of the Document, and from those of
- previous versions (which should, if there were any, be listed
- in the History section of the Document). You may use the
- same title as a previous version if the original publisher of
- that version gives permission.
+ distinct from that of the Document, and from those of previous
+ versions (which should, if there were any, be listed in the
+ History section of the Document). You may use the same title
+ as a previous version if the original publisher of that
+ version gives permission.
B. List on the Title Page, as authors, one or more persons or
entities responsible for authorship of the modifications in
@@ -3897,31 +3881,30 @@ GNU Free Documentation License
I. Preserve the section Entitled "History", Preserve its Title,
and add to it an item stating at least the title, year, new
- authors, and publisher of the Modified Version as given on
- the Title Page. If there is no section Entitled "History" in
- the Document, create one stating the title, year, authors,
- and publisher of the Document as given on its Title Page,
- then add an item describing the Modified Version as stated in
- the previous sentence.
+ authors, and publisher of the Modified Version as given on the
+ Title Page. If there is no section Entitled "History" in the
+ Document, create one stating the title, year, authors, and
+ publisher of the Document as given on its Title Page, then add
+ an item describing the Modified Version as stated in the
+ previous sentence.
J. Preserve the network location, if any, given in the Document
for public access to a Transparent copy of the Document, and
likewise the network locations given in the Document for
- previous versions it was based on. These may be placed in
- the "History" section. You may omit a network location for a
- work that was published at least four years before the
- Document itself, or if the original publisher of the version
- it refers to gives permission.
+ previous versions it was based on. These may be placed in the
+ "History" section. You may omit a network location for a work
+ that was published at least four years before the Document
+ itself, or if the original publisher of the version it refers
+ to gives permission.
K. For any section Entitled "Acknowledgements" or "Dedications",
- Preserve the Title of the section, and preserve in the
- section all the substance and tone of each of the contributor
+ Preserve the Title of the section, and preserve in the section
+ all the substance and tone of each of the contributor
acknowledgements and/or dedications given therein.
- L. Preserve all the Invariant Sections of the Document,
- unaltered in their text and in their titles. Section numbers
- or the equivalent are not considered part of the section
- titles.
+ L. Preserve all the Invariant Sections of the Document, unaltered
+ in their text and in their titles. Section numbers or the
+ equivalent are not considered part of the section titles.
M. Delete any section Entitled "Endorsements". Such a section
may not be included in the Modified Version.
@@ -3934,11 +3917,11 @@ GNU Free Documentation License
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no
- material copied from the Document, you may at your option
- designate some or all of these sections as invariant. To do this,
- add their titles to the list of Invariant Sections in the Modified
- Version's license notice. These titles must be distinct from any
- other section titles.
+ material copied from the Document, you may at your option designate
+ some or all of these sections as invariant. To do this, add their
+ titles to the list of Invariant Sections in the Modified Version's
+ license notice. These titles must be distinct from any other
+ section titles.
You may add a section Entitled "Endorsements", provided it contains
nothing but endorsements of your Modified Version by various
@@ -3947,15 +3930,15 @@ GNU Free Documentation License
definition of a standard.
You may add a passage of up to five words as a Front-Cover Text,
- and a passage of up to 25 words as a Back-Cover Text, to the end
- of the list of Cover Texts in the Modified Version. Only one
- passage of Front-Cover Text and one of Back-Cover Text may be
- added by (or through arrangements made by) any one entity. If the
- Document already includes a cover text for the same cover,
- previously added by you or by arrangement made by the same entity
- you are acting on behalf of, you may not add another; but you may
- replace the old one, on explicit permission from the previous
- publisher that added the old one.
+ and a passage of up to 25 words as a Back-Cover Text, to the end of
+ the list of Cover Texts in the Modified Version. Only one passage
+ of Front-Cover Text and one of Back-Cover Text may be added by (or
+ through arrangements made by) any one entity. If the Document
+ already includes a cover text for the same cover, previously added
+ by you or by arrangement made by the same entity you are acting on
+ behalf of, you may not add another; but you may replace the old
+ one, on explicit permission from the previous publisher that added
+ the old one.
The author(s) and publisher(s) of the Document do not by this
License give permission to use their names for publicity for or to
@@ -3965,8 +3948,8 @@ GNU Free Documentation License
You may combine the Document with other documents released under
this License, under the terms defined in section 4 above for
- modified versions, provided that you include in the combination
- all of the Invariant Sections of all of the original documents,
+ modified versions, provided that you include in the combination all
+ of the Invariant Sections of all of the original documents,
unmodified, and list them all as Invariant Sections of your
combined work in its license notice, and that you preserve all
their Warranty Disclaimers.
@@ -3993,20 +3976,20 @@ GNU Free Documentation License
documents released under this License, and replace the individual
copies of this License in the various documents with a single copy
that is included in the collection, provided that you follow the
- rules of this License for verbatim copying of each of the
- documents in all other respects.
+ rules of this License for verbatim copying of each of the documents
+ in all other respects.
You may extract a single document from such a collection, and
distribute it individually under this License, provided you insert
- a copy of this License into the extracted document, and follow
- this License in all other respects regarding verbatim copying of
- that document.
+ a copy of this License into the extracted document, and follow this
+ License in all other respects regarding verbatim copying of that
+ document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other
- separate and independent documents or works, in or on a volume of
- a storage or distribution medium, is called an "aggregate" if the
+ separate and independent documents or works, in or on a volume of a
+ storage or distribution medium, is called an "aggregate" if the
copyright resulting from the compilation is not used to limit the
legal rights of the compilation's users beyond what the individual
works permit. When the Document is included in an aggregate, this
@@ -4051,8 +4034,8 @@ GNU Free Documentation License
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
- provisionally, unless and until the copyright holder explicitly
- and finally terminates your license, and (b) permanently, if the
+ provisionally, unless and until the copyright holder explicitly and
+ finally terminates your license, and (b) permanently, if the
copyright holder fails to notify you of the violation by some
reasonable means prior to 60 days after the cessation.
@@ -4064,33 +4047,33 @@ GNU Free Documentation License
after your receipt of the notice.
Termination of your rights under this section does not terminate
- the licenses of parties who have received copies or rights from
- you under this License. If your rights have been terminated and
- not permanently reinstated, receipt of a copy of some or all of
- the same material does not give you any rights to use it.
+ the licenses of parties who have received copies or rights from you
+ under this License. If your rights have been terminated and not
+ permanently reinstated, receipt of a copy of some or all of the
+ same material does not give you any rights to use it.
- 10. FUTURE REVISIONS OF THIS LICENSE
+ 10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions of
the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
- `http://www.gnu.org/copyleft/'.
+ <http://www.gnu.org/copyleft/>.
Each version of the License is given a distinguishing version
number. If the Document specifies that a particular numbered
version of this License "or any later version" applies to it, you
have the option of following the terms and conditions either of
that specified version or of any later version that has been
- published (not as a draft) by the Free Software Foundation. If
- the Document does not specify a version number of this License,
- you may choose any version ever published (not as a draft) by the
- Free Software Foundation. If the Document specifies that a proxy
- can decide which future versions of this License can be used, that
+ published (not as a draft) by the Free Software Foundation. If the
+ Document does not specify a version number of this License, you may
+ choose any version ever published (not as a draft) by the Free
+ Software Foundation. If the Document specifies that a proxy can
+ decide which future versions of this License can be used, that
proxy's public statement of acceptance of a version permanently
authorizes you to choose that version for the Document.
- 11. RELICENSING
+ 11. RELICENSING
"Massive Multiauthor Collaboration Site" (or "MMC Site") means any
World Wide Web server that publishes copyrightable works and also
@@ -4120,7 +4103,6 @@ GNU Free Documentation License
site under CC-BY-SA on the same site at any time before August 1,
2009, provided the MMC is eligible for relicensing.
-
ADDENDUM: How to use this License for your documents
====================================================
@@ -4137,7 +4119,7 @@ notices just after the title page:
Free Documentation License''.
If you have Invariant Sections, Front-Cover Texts and Back-Cover
-Texts, replace the "with...Texts." line with this:
+Texts, replace the "with...Texts." line with this:
with the Invariant Sections being LIST THEIR TITLES, with
the Front-Cover Texts being LIST, and with the Back-Cover Texts
@@ -4148,9 +4130,9 @@ combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
-recommend releasing these examples in parallel under your choice of
-free software license, such as the GNU General Public License, to
-permit their use in free software.
+recommend releasing these examples in parallel under your choice of free
+software license, such as the GNU General Public License, to permit
+their use in free software.

File: gawkinet.info, Node: Index, Prev: GNU Free Documentation License, Up: Top
@@ -4161,152 +4143,156 @@ Index
* Menu:
-* /inet/ files (gawk): Gawk Special Files. (line 34)
-* /inet/tcp special files (gawk): File /inet/tcp. (line 6)
-* /inet/udp special files (gawk): File /inet/udp. (line 6)
+* '/inet/' files ('gawk'): Gawk Special Files. (line 34)
+* '/inet/tcp' special files ('gawk'): File /inet/tcp. (line 6)
+* '/inet/udp' special files ('gawk'): File /inet/udp. (line 6)
+* '|' (vertical bar), '|&' operator (I/O): TCP Connecting. (line 25)
* advanced features, network connections: Troubleshooting. (line 6)
+* agent: Challenges. (line 75)
* agent <1>: MOBAGWHO. (line 6)
-* agent: Challenges. (line 76)
-* AI: Challenges. (line 76)
-* apache <1>: MOBAGWHO. (line 42)
+* AI: Challenges. (line 75)
* apache: WEBGRAB. (line 72)
+* apache <1>: MOBAGWHO. (line 42)
* Bioinformatics: PROTBASE. (line 227)
* BLAST, Basic Local Alignment Search Tool: PROTBASE. (line 6)
* blocking: Making Connections. (line 35)
* Boutell, Thomas: STATIST. (line 6)
* CGI (Common Gateway Interface): MOBAGWHO. (line 42)
* CGI (Common Gateway Interface), dynamic web pages and: Web page.
- (line 46)
+ (line 45)
* CGI (Common Gateway Interface), library: CGI Lib. (line 11)
* clients: Making Connections. (line 21)
-* Clinton, Bill: Challenges. (line 59)
-* Common Gateway Interface, See CGI: Web page. (line 46)
+* Clinton, Bill: Challenges. (line 58)
+* Common Gateway Interface, See CGI: Web page. (line 45)
* Computational Biology: PROTBASE. (line 227)
* contest: Challenges. (line 6)
-* cron utility: STOXPRED. (line 23)
+* 'cron' utility: STOXPRED. (line 23)
* CSV format: STOXPRED. (line 128)
* Dow Jones Industrial Index: STOXPRED. (line 44)
* ELIZA program: Simple Server. (line 11)
+* ELIZA program <1>: Simple Server. (line 178)
* email: Email. (line 11)
* FASTA/Pearson format: PROTBASE. (line 102)
* FDL (Free Documentation License): GNU Free Documentation License.
(line 6)
* filenames, for network access: Gawk Special Files. (line 29)
-* files, /inet/ (gawk): Gawk Special Files. (line 34)
-* files, /inet/tcp (gawk): File /inet/tcp. (line 6)
-* files, /inet/udp (gawk): File /inet/udp. (line 6)
-* finger utility: Setting Up. (line 22)
+* files, '/inet/' ('gawk'): Gawk Special Files. (line 34)
+* files, '/inet/tcp' ('gawk'): File /inet/tcp. (line 6)
+* files, '/inet/udp' ('gawk'): File /inet/udp. (line 6)
+* 'finger' utility: Setting Up. (line 22)
* Free Documentation License (FDL): GNU Free Documentation License.
(line 6)
* FTP (File Transfer Protocol): Basic Protocols. (line 45)
-* gawk, networking: Using Networking. (line 6)
-* gawk, networking, connections <1>: TCP Connecting. (line 6)
-* gawk, networking, connections: Special File Fields. (line 53)
-* gawk, networking, filenames: Gawk Special Files. (line 29)
-* gawk, networking, See Also email: Email. (line 6)
-* gawk, networking, service, establishing: Setting Up. (line 6)
-* gawk, networking, troubleshooting: Caveats. (line 6)
-* gawk, web and, See web service: Interacting Service. (line 6)
-* getline command: TCP Connecting. (line 11)
+* 'gawk', networking: Using Networking. (line 6)
+* 'gawk', networking, connections: Special File Fields. (line 53)
+* 'gawk', networking, connections <1>: TCP Connecting. (line 6)
+* 'gawk', networking, filenames: Gawk Special Files. (line 29)
+* 'gawk', networking, See Also email: Email. (line 6)
+* 'gawk', networking, service, establishing: Setting Up. (line 6)
+* 'gawk', networking, troubleshooting: Caveats. (line 6)
+* 'gawk', web and, See web service: Interacting Service. (line 6)
+* 'getline' command: TCP Connecting. (line 11)
* GETURL program: GETURL. (line 6)
+* GIF image format: Web page. (line 45)
* GIF image format <1>: STATIST. (line 6)
-* GIF image format: Web page. (line 46)
* GNU Free Documentation License: GNU Free Documentation License.
(line 6)
-* GNU/Linux <1>: REMCONF. (line 6)
-* GNU/Linux <2>: Interacting. (line 27)
* GNU/Linux: Troubleshooting. (line 54)
-* GNUPlot utility <1>: STATIST. (line 6)
+* GNU/Linux <1>: Interacting. (line 27)
+* GNU/Linux <2>: REMCONF. (line 6)
* GNUPlot utility: Interacting Service. (line 189)
-* Hoare, C.A.R. <1>: PROTBASE. (line 6)
+* GNUPlot utility <1>: STATIST. (line 6)
* Hoare, C.A.R.: MOBAGWHO. (line 6)
+* Hoare, C.A.R. <1>: PROTBASE. (line 6)
* hostname field: Special File Fields. (line 34)
-* HTML (Hypertext Markup Language): Web page. (line 30)
-* HTTP (Hypertext Transfer Protocol) <1>: Web page. (line 6)
+* HTML (Hypertext Markup Language): Web page. (line 29)
* HTTP (Hypertext Transfer Protocol): Basic Protocols. (line 45)
+* HTTP (Hypertext Transfer Protocol) <1>: Web page. (line 6)
* HTTP (Hypertext Transfer Protocol), record separators and: Web page.
- (line 30)
+ (line 29)
* HTTP server, core logic: Interacting Service. (line 6)
-* Humphrys, Mark: Simple Server. (line 179)
-* Hypertext Markup Language (HTML): Web page. (line 30)
+* HTTP server, core logic <1>: Interacting Service. (line 24)
+* Humphrys, Mark: Simple Server. (line 178)
+* Hypertext Markup Language (HTML): Web page. (line 29)
* Hypertext Transfer Protocol, See HTTP: Web page. (line 6)
* image format: STATIST. (line 6)
* images, in web pages: Interacting Service. (line 189)
-* images, retrieving over networks: Web page. (line 46)
-* input/output, two-way, See Also gawk, networking: Gawk Special Files.
+* images, retrieving over networks: Web page. (line 45)
+* input/output, two-way, See Also 'gawk', networking: Gawk Special Files.
(line 19)
* Internet, See networks: Interacting. (line 48)
* JavaScript: STATIST. (line 56)
-* Linux <1>: REMCONF. (line 6)
-* Linux <2>: Interacting. (line 27)
* Linux: Troubleshooting. (line 54)
+* Linux <1>: Interacting. (line 27)
+* Linux <2>: REMCONF. (line 6)
* Lisp: MOBAGWHO. (line 98)
* localport field: Gawk Special Files. (line 34)
* Loebner, Hugh: Challenges. (line 6)
-* Loui, Ronald: Challenges. (line 76)
+* Loui, Ronald: Challenges. (line 75)
* MAZE: MAZE. (line 6)
* Microsoft Windows: WEBGRAB. (line 43)
* Microsoft Windows, networking: Troubleshooting. (line 54)
* Microsoft Windows, networking, ports: Setting Up. (line 37)
-* MiniSQL: REMCONF. (line 111)
+* MiniSQL: REMCONF. (line 109)
* MOBAGWHO program: MOBAGWHO. (line 6)
* NCBI, National Center for Biotechnology Information: PROTBASE.
(line 6)
* network type field: Special File Fields. (line 11)
-* networks, gawk and: Using Networking. (line 6)
-* networks, gawk and, connections <1>: TCP Connecting. (line 6)
-* networks, gawk and, connections: Special File Fields. (line 53)
-* networks, gawk and, filenames: Gawk Special Files. (line 29)
-* networks, gawk and, See Also email: Email. (line 6)
-* networks, gawk and, service, establishing: Setting Up. (line 6)
-* networks, gawk and, troubleshooting: Caveats. (line 6)
+* networks, 'gawk' and: Using Networking. (line 6)
+* networks, 'gawk' and, connections: Special File Fields. (line 53)
+* networks, 'gawk' and, connections <1>: TCP Connecting. (line 6)
+* networks, 'gawk' and, filenames: Gawk Special Files. (line 29)
+* networks, 'gawk' and, See Also email: Email. (line 6)
+* networks, 'gawk' and, service, establishing: Setting Up. (line 6)
+* networks, 'gawk' and, troubleshooting: Caveats. (line 6)
* networks, ports, reserved: Setting Up. (line 37)
* networks, ports, specifying: Special File Fields. (line 24)
* networks, See Also web pages: PANIC. (line 6)
* Numerical Recipes: STATIST. (line 24)
-* ORS variable, HTTP and: Web page. (line 30)
-* ORS variable, POP and: Email. (line 36)
+* 'ORS' variable, HTTP and: Web page. (line 29)
+* 'ORS' variable, POP and: Email. (line 36)
* PANIC program: PANIC. (line 6)
* Perl: Using Networking. (line 14)
-* Perl, gawk networking and: Using Networking. (line 24)
+* Perl, 'gawk' networking and: Using Networking. (line 24)
* Perlis, Alan: MAZE. (line 6)
* pipes, networking and: TCP Connecting. (line 30)
+* PNG image format: Web page. (line 45)
* PNG image format <1>: STATIST. (line 6)
-* PNG image format: Web page. (line 46)
* POP (Post Office Protocol): Email. (line 6)
+* POP (Post Office Protocol) <1>: Email. (line 36)
* Post Office Protocol (POP): Email. (line 6)
* PostScript: STATIST. (line 138)
-* PROLOG: Challenges. (line 76)
+* PROLOG: Challenges. (line 75)
* PROTBASE: PROTBASE. (line 6)
* protocol field: Special File Fields. (line 17)
* PS image format: STATIST. (line 6)
* Python: Using Networking. (line 14)
-* Python, gawk networking and: Using Networking. (line 24)
-* record separators, HTTP and: Web page. (line 30)
+* Python, 'gawk' networking and: Using Networking. (line 24)
+* record separators, HTTP and: Web page. (line 29)
* record separators, POP and: Email. (line 36)
* REMCONF program: REMCONF. (line 6)
* remoteport field: Gawk Special Files. (line 34)
+* robot: Challenges. (line 84)
* robot <1>: WEBGRAB. (line 6)
-* robot: Challenges. (line 85)
-* RS variable, HTTP and: Web page. (line 30)
-* RS variable, POP and: Email. (line 36)
-* servers <1>: Setting Up. (line 22)
+* 'RS' variable, HTTP and: Web page. (line 29)
+* 'RS' variable, POP and: Email. (line 36)
* servers: Making Connections. (line 14)
+* servers <1>: Setting Up. (line 22)
* servers, as hosts: Special File Fields. (line 34)
* servers, HTTP: Interacting Service. (line 6)
* servers, web: Simple Server. (line 6)
* Simple Mail Transfer Protocol (SMTP): Email. (line 6)
-* SMTP (Simple Mail Transfer Protocol) <1>: Email. (line 6)
* SMTP (Simple Mail Transfer Protocol): Basic Protocols. (line 45)
+* SMTP (Simple Mail Transfer Protocol) <1>: Email. (line 6)
* STATIST program: STATIST. (line 6)
* STOXPRED program: STOXPRED. (line 6)
* synchronous communications: Making Connections. (line 35)
* Tcl/Tk: Using Networking. (line 14)
-* Tcl/Tk, gawk and <1>: Some Applications and Techniques.
+* Tcl/Tk, 'gawk' and: Using Networking. (line 24)
+* Tcl/Tk, 'gawk' and <1>: Some Applications and Techniques.
(line 22)
-* Tcl/Tk, gawk and: Using Networking. (line 24)
-* TCP (Transmission Control Protocol) <1>: File /inet/tcp. (line 6)
* TCP (Transmission Control Protocol): Using Networking. (line 29)
+* TCP (Transmission Control Protocol) <1>: File /inet/tcp. (line 6)
* TCP (Transmission Control Protocol), connection, establishing: TCP Connecting.
(line 6)
* TCP (Transmission Control Protocol), UDP and: Interacting. (line 48)
@@ -4314,7 +4300,7 @@ Index
* TCP/IP, protocols, selecting: Special File Fields. (line 17)
* TCP/IP, sockets and: Gawk Special Files. (line 19)
* Transmission Control Protocol, See TCP: Using Networking. (line 29)
-* troubleshooting, gawk, networks: Caveats. (line 6)
+* troubleshooting, 'gawk', networks: Caveats. (line 6)
* troubleshooting, networks, connections: Troubleshooting. (line 6)
* troubleshooting, networks, timeouts: Caveats. (line 18)
* UDP (User Datagram Protocol): File /inet/udp. (line 6)
@@ -4322,76 +4308,75 @@ Index
* Unix, network ports and: Setting Up. (line 37)
* URLCHK program: URLCHK. (line 6)
* User Datagram Protocol, See UDP: File /inet/udp. (line 6)
-* vertical bar (|), |& operator (I/O): TCP Connecting. (line 25)
+* vertical bar ('|'), '|&' operator (I/O): TCP Connecting. (line 25)
* VRML: MAZE. (line 6)
* web browsers, See web service: Interacting Service. (line 6)
* web pages: Web page. (line 6)
* web pages, images in: Interacting Service. (line 189)
* web pages, retrieving: GETURL. (line 6)
* web servers: Simple Server. (line 6)
-* web service <1>: PANIC. (line 6)
* web service: Primitive Service. (line 6)
+* web service <1>: PANIC. (line 6)
* WEBGRAB program: WEBGRAB. (line 6)
* Weizenbaum, Joseph: Simple Server. (line 11)
* XBM image format: Interacting Service. (line 189)
-* Yahoo! <1>: STOXPRED. (line 6)
* Yahoo!: REMCONF. (line 6)
-* | (vertical bar), |& operator (I/O): TCP Connecting. (line 25)
+* Yahoo! <1>: STOXPRED. (line 6)

Tag Table:
-Node: Top2015
-Node: Preface5652
-Node: Introduction7027
-Node: Stream Communications8053
-Node: Datagram Communications9226
-Node: The TCP/IP Protocols10857
-Ref: The TCP/IP Protocols-Footnote-111541
-Node: Basic Protocols11698
-Ref: Basic Protocols-Footnote-113741
-Node: Ports13770
-Node: Making Connections15177
-Ref: Making Connections-Footnote-117738
-Ref: Making Connections-Footnote-217785
-Node: Using Networking17966
-Node: Gawk Special Files20284
-Node: Special File Fields22094
-Ref: table-inet-components25967
-Node: Comparing Protocols27287
-Node: File /inet/tcp27820
-Node: File /inet/udp28846
-Node: TCP Connecting29944
-Node: Troubleshooting32282
-Ref: Troubleshooting-Footnote-135334
-Node: Interacting35903
-Node: Setting Up38633
-Node: Email42127
-Node: Web page44453
-Ref: Web page-Footnote-147258
-Node: Primitive Service47455
-Node: Interacting Service50189
-Ref: Interacting Service-Footnote-159318
-Node: CGI Lib59350
-Node: Simple Server66311
-Ref: Simple Server-Footnote-174034
-Node: Caveats74135
-Node: Challenges75278
-Node: Some Applications and Techniques83957
-Node: PANIC86414
-Node: GETURL88132
-Node: REMCONF90755
-Node: URLCHK96231
-Node: WEBGRAB100066
-Node: STATIST104516
-Ref: STATIST-Footnote-1116224
-Node: MAZE116669
-Node: MOBAGWHO122853
-Ref: MOBAGWHO-Footnote-1136797
-Node: STOXPRED136852
-Node: PROTBASE151107
-Node: Links164188
-Node: GNU Free Documentation License167622
-Node: Index192761
+Node: Top2010
+Node: Preface5647
+Node: Introduction7022
+Node: Stream Communications8048
+Node: Datagram Communications9222
+Node: The TCP/IP Protocols10852
+Ref: The TCP/IP Protocols-Footnote-111536
+Node: Basic Protocols11693
+Ref: Basic Protocols-Footnote-113738
+Node: Ports13767
+Node: Making Connections15174
+Ref: Making Connections-Footnote-117732
+Ref: Making Connections-Footnote-217779
+Node: Using Networking17960
+Node: Gawk Special Files20283
+Node: Special File Fields22093
+Ref: table-inet-components25986
+Node: Comparing Protocols27295
+Node: File /inet/tcp27829
+Node: File /inet/udp28857
+Node: TCP Connecting29960
+Node: Troubleshooting32306
+Ref: Troubleshooting-Footnote-135365
+Node: Interacting35938
+Node: Setting Up38676
+Node: Email42179
+Node: Web page44511
+Ref: Web page-Footnote-147328
+Node: Primitive Service47526
+Node: Interacting Service50267
+Ref: Interacting Service-Footnote-159424
+Node: CGI Lib59456
+Node: Simple Server66420
+Ref: Simple Server-Footnote-174149
+Node: Caveats74250
+Node: Challenges75395
+Node: Some Applications and Techniques84093
+Node: PANIC86554
+Node: GETURL88278
+Node: REMCONF90911
+Node: URLCHK96398
+Node: WEBGRAB100247
+Node: STATIST104707
+Ref: STATIST-Footnote-1116444
+Node: MAZE116889
+Node: MOBAGWHO123088
+Ref: MOBAGWHO-Footnote-1137080
+Node: STOXPRED137135
+Node: PROTBASE151417
+Node: Links164533
+Node: GNU Free Documentation License167966
+Node: Index193086

End Tag Table
diff --git a/doc/gawkinet.texi b/doc/gawkinet.texi
index 10223239..12274d04 100644
--- a/doc/gawkinet.texi
+++ b/doc/gawkinet.texi
@@ -1764,7 +1764,7 @@ Here is the code:
@c file eg/network/coreserv.awk
#
# Juergen Kahrs, Juergen.Kahrs@@vr-web.de
-# with Arnold Robbins, arnold@@gnu.org
+# with Arnold Robbins, arnold@@skeeve.com
# September 2000
@c endfile
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 47482816..e02cd568 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -557,6 +557,7 @@ particular records in a file and perform operations upon them.
* Computed Regexps:: Using Dynamic Regexps.
* GNU Regexp Operators:: Operators specific to GNU software.
* Case-sensitivity:: How to do case-insensitive matching.
+* Strong Regexp Constants:: Strongly typed regexp constants.
* Regexp Summary:: Regular expressions summary.
* Records:: Controlling how data is split into
records.
@@ -4924,6 +4925,7 @@ regular expressions work, we present more complicated instances.
* Computed Regexps:: Using Dynamic Regexps.
* GNU Regexp Operators:: Operators specific to GNU software.
* Case-sensitivity:: How to do case-insensitive matching.
+* Strong Regexp Constants:: Strongly typed regexp constants.
* Regexp Summary:: Regular expressions summary.
@end menu
@@ -6044,6 +6046,89 @@ The value of @code{IGNORECASE} has no effect if @command{gawk} is in
compatibility mode (@pxref{Options}).
Case is always significant in compatibility mode.
+@node Strong Regexp Constants
+@section Strongly Typed Regexp Constants
+
+This @value{SECTION} describes a @command{gawk}-specific feature.
+
+Regexp constants (@code{/@dots{}/}) hold a strange position in the
+@command{awk} language. In most contexts, they act like an expression:
+@samp{$0 ~ /@dots{}/}. In other contexts, they denote only a regexp to
+be matched. In no case are they really a ``first class citizen'' of the
+language. That is, you cannot define a scalar variable whose type is
+``regexp'' in the same sense that you can define a variable to be a
+number or a string:
+
+@example
+num = 42 @ii{Numeric variable}
+str = "hi" @ii{String variable}
+re = /foo/ @ii{Wrong!} re @ii{is the result of} $0 ~ /foo/
+@end example
+
+For a number of more advanced use cases (described later on in this
+@value{DOCUMENT}), it would be nice to have regexp constants that
+are @dfn{strongly typed}; in other words, that denote a regexp useful
+for matching, and not an expression.
+
+@command{gawk} provides this feature. A strongly typed regexp constant
+looks almost like a regular regexp constant, except that it is preceded
+by an @samp{@@} sign:
+
+@example
+re = @@/foo/ @ii{Regexp variable}
+@end example
+
+Strongly typed regexp constants @emph{cannot} be used eveywhere that a
+regular regexp constant can, because this would make the language even more
+confusing. Instead, you may use them only in certain contexts:
+
+@itemize @bullet
+@item
+On the righthand side of the @samp{~} and @samp{!~} operators: @samp{some_var ~ @@/foo/}
+(@pxref{Regexp Usage}).
+
+@item
+In the @code{case} part of a @code{switch} statement
+(@pxref{Switch Statement}).
+
+@item
+As an argument to one of the built-in functions that accept regexp constants:
+@code{gensub()},
+@code{gsub()},
+@code{match()},
+@code{patsplit()},
+@code{split()},
+and
+@code{sub()}
+(@pxref{String Functions}).
+
+@item
+As a parameter in a call to a user-defined function
+(@pxref{User-defined}).
+
+@item
+On the righthand side of an assignment to a variable: @samp{some_var = @@/foo/}.
+In this case, the type of @code{some_var} is regexp. Additionally, @code{some_var}
+can be used with @samp{~} and @samp{!~}, passed to one of the built-in functions
+listed above, or passed as a parameter to a user-defined function.
+@end itemize
+
+You may use the @code{typeof()} built-in function
+(@pxref{Type Functions})
+to determine if a variable or function parameter is
+a regexp variable.
+
+The true power of this feature comes from the ability to create variables that
+have regexp type. Such variables can be passed on to user-defined functions,
+without the confusing aspects of computed regular expressions created from
+strings or string constants. They may also be passed through indirect function
+calls (@pxref{Indirect Calls})
+onto the built-in functions that accept regexp constants.
+
+When used in numeric conversions, strongly typed regexp variables convert
+to zero. When used in string conversions, they convert to the string
+value of the original regexp text.
+
@node Regexp Summary
@section Summary
@@ -6087,6 +6172,11 @@ treated as regular expressions).
case sensitivity of regexp matching. In other @command{awk}
versions, use @code{tolower()} or @code{toupper()}.
+@item
+Strongly typed regexp constants (@code{@@/.../}) enable
+certain advanced use cases to be described later on in the
+@value{DOCUMENT}.
+
@end itemize
@@ -18508,16 +18598,41 @@ results of the @code{compl()}, @code{lshift()}, and @code{rshift()} functions.
@node Type Functions
@subsection Getting Type Information
-@command{gawk} provides a single function that lets you distinguish
-an array from a scalar variable. This is necessary for writing code
+@command{gawk} provides two functions that lets you distinguish
+the type of a variable.
+This is necessary for writing code
that traverses every element of an array of arrays
-(@pxref{Arrays of Arrays}).
+(@pxref{Arrays of Arrays}), and in other contexts.
@table @code
@cindexgawkfunc{isarray}
@cindex scalar or array
@item isarray(@var{x})
Return a true value if @var{x} is an array. Otherwise, return false.
+
+@cindexgawkfunc{typeof}
+@cindex variable type
+@cindex type, of variable
+@item typeof(@var{x})
+Return one of the following strings, depending upon the type of @var{x}:
+
+@c nested table
+@table @code
+@item "array"
+@var{x} is an array.
+
+@item "regexp"
+@var{x} is a strongly typed regexp (@pxref{Strong Regexp Constants}).
+
+@item "scalar_n"
+@var{x} is a number.
+
+@item "scalar_s"
+@var{x} is a string.
+
+@item "untyped"
+@var{x} has not yet been given a type.
+@end table
@end table
@code{isarray()} is meant for use in two circumstances. The first is when
@@ -18535,6 +18650,14 @@ that has not been previously used to @code{isarray()}, @command{gawk}
ends up turning it into a scalar.
@end quotation
+The @code{typeof()} function is general; it allows you to determine
+if a variable or function parameter is a scalar, an array, or a strongly
+typed regexp.
+
+@code{isarray()} is deprecated; you should use @code{typeof()} instead.
+You should replace any existing uses of @samp{isarray(var)} in your
+code with @samp{typeof(var) == "array"}.
+
@node I18N Functions
@subsection String-Translation Functions
@cindex @command{gawk}, string-translation functions
@@ -34066,17 +34189,31 @@ properly:
# Please set INPLACE_SUFFIX to make a backup copy. For example, you may
# want to set INPLACE_SUFFIX to .bak on the command line or in a BEGIN rule.
+# By default, each filename on the command line will be edited inplace.
+# But you can selectively disable this by adding an inplace=0 argument
+# prior to files that you do not want to process this way. You can then
+# reenable it later on the commandline by putting inplace=1 before files
+# that you wish to be subject to inplace editing.
+
# N.B. We call inplace_end() in the BEGINFILE and END rules so that any
# actions in an ENDFILE rule will be redirected as expected.
+BEGIN @{
+ inplace = 1 # enabled by default
+@}
+
BEGINFILE @{
if (_inplace_filename != "")
inplace_end(_inplace_filename, INPLACE_SUFFIX)
- inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX)
+ if (inplace)
+ inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX)
+ else
+ _inplace_filename = ""
@}
END @{
- inplace_end(FILENAME, INPLACE_SUFFIX)
+ if (_inplace_filename != "")
+ inplace_end(_inplace_filename, INPLACE_SUFFIX)
@}
@end group
@c endfile
@@ -34090,6 +34227,11 @@ If @code{INPLACE_SUFFIX} is not an empty string, the original file is
linked to a backup @value{FN} created by appending that suffix. Finally,
the temporary file is renamed to the original @value{FN}.
+Note that the use of this feature can be controlled by placing @samp{inplace=0}
+on the command-line prior to listing files that should not be processed this
+way. You can reenable inplace editing by adding an @samp{inplace=1} argument
+prior to files that should be subject to inplace editing.
+
The @code{_inplace_filename} variable serves to keep track of the
current filename so as to not invoke @code{inplace_end()} before
processing the first file.
@@ -34110,6 +34252,10 @@ $ @kbd{gawk -i inplace -v INPLACE_SUFFIX=.bak '@{ gsub(/foo/, "bar") @}}
> @kbd{@{ print @}' file1 file2 file3}
@end example
+Please note that, while the extension does attempt to preserve ownership and permissions, it makes no attempt to copy the ACLs from the original file.
+
+If the program dies prematurely, as might happen if an unhandled signal is received, a temporary file may be left behind.
+
@node Extension Sample Ord
@subsection Character and Numeric values: @code{ord()} and @code{chr()}
diff --git a/eval.c b/eval.c
index b50bcea8..73bd56cb 100644
--- a/eval.c
+++ b/eval.c
@@ -234,6 +234,7 @@ static const char *const nodetypes[] = {
"Node_val",
"Node_regex",
"Node_dynregex",
+ "Node_typedregex",
"Node_var",
"Node_var_array",
"Node_var_new",
@@ -1362,6 +1363,11 @@ setup_frame(INSTRUCTION *pc)
r->var_value = m;
break;
+ case Node_typedregex:
+ r->type = Node_var;
+ r->var_value = m;
+ break;
+
default:
cant_happen();
}
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 3188c1e1..bbdd57fb 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,14 @@
+2015-06-17 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * inplace.3am (BUGS): Document that ACLs are not preserved, and
+ a temporary file may be left behind if the program is killed by
+ a signal.
+
+2015-06-17 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * inplace.3am: Document new inplace variable to control whether
+ inplace editing is active.
+
2015-05-19 Arnold D. Robbins <arnold@skeeve.com>
* 4.1.3: Release tar ball made.
diff --git a/extension/inplace.3am b/extension/inplace.3am
index 64aec91c..a045fe6c 100644
--- a/extension/inplace.3am
+++ b/extension/inplace.3am
@@ -1,4 +1,4 @@
-.TH INPLACE 3am "Apr 08 2015" "Free Software Foundation" "GNU Awk Extension Modules"
+.TH INPLACE 3am "Jun 17 2015" "Free Software Foundation" "GNU Awk Extension Modules"
.SH NAME
inplace \- emulate sed/perl/ruby in-place editing
.SH SYNOPSIS
@@ -32,8 +32,18 @@ rule or on the command line, then the
extension concatenates that suffix onto the original
filename and uses the result as a filename for renaming
the original.
+.PP
+One can disable inplace editing selectively by placing
+.B inplace=0
+on the command line prior to files that should be processed normally.
+One can reenable inplace editing by placing
+.B inplace=1
+prior to files that should be subject to inplace editing.
... .SH NOTES
-... .SH BUGS
+.SH BUGS
+While the extension does attempt to preserve ownership and permissions, it makes no attempt to copy the ACLs from the original file.
+.PP
+If the program dies prematurely, as might happen if an unhandled signal is received, a temporary file may be left behind.
.SH EXAMPLE
.ft CW
.nf
diff --git a/hardregex.txt b/hardregex.txt
new file mode 100644
index 00000000..557548c8
--- /dev/null
+++ b/hardregex.txt
@@ -0,0 +1,24 @@
+New variable type: "regexp", --> Node_hardregexp. (Need a better name).
+
+Syntax: @/.../
+
+Use:
+ a = @/.../ # a now has type regexp
+ a = foo(1, "bar", @/.../) # pass a regex to user defined function
+
+New function:
+ t = typeof(exp) # "array", "regexp", "scalar"
+ # Open: "scalar" vs. "scalar_s" / "scalar_n"
+
+Obsolete function:
+ isarray(exp)
+
+Conversions:
+ r = @/.../
+ s = r "" # what happens? becomes regex string?
+ s = r + 0 # what happens? treat as numeric 0?
+
+Why?
+ Allows passing regexes through user defined functions
+ Allows passing regexes through indirect funtion calls
+ In general, this is a gap in the language
diff --git a/profile.c b/profile.c
index dcc2946c..0f686768 100644
--- a/profile.c
+++ b/profile.c
@@ -32,6 +32,8 @@ static void parenthesize(int type, NODE *left, NODE *right);
static char *pp_list(int nargs, const char *paren, const char *delim);
static char *pp_group3(const char *s1, const char *s2, const char *s3);
static char *pp_concat(int nargs);
+static char *pp_string_or_strong_regex(const char *in_str, size_t len, int delim, bool strong_regex);
+static char *pp_strong_regex(const char *in_str, size_t len, int delim);
static bool is_binary(int type);
static bool is_scalar(int type);
static int prec_level(int type);
@@ -624,14 +626,17 @@ cleanup:
break;
case Op_push_re:
- if (pc->memory->type != Node_regex)
+ if (pc->memory->type != Node_regex && pc->memory->type != Node_typedregex)
break;
/* else
fall through */
case Op_match_rec:
{
NODE *re = pc->memory->re_exp;
- str = pp_string(re->stptr, re->stlen, '/');
+ if (pc->memory->type == Node_regex)
+ str = pp_string(re->stptr, re->stlen, '/');
+ else
+ str = pp_strong_regex(re->stptr, re->stlen, '/');
pp_push(pc->opcode, str, CAN_FREE);
}
break;
@@ -653,6 +658,11 @@ cleanup:
txt = t2->pp_str;
str = pp_group3(txt, op2str(pc->opcode), restr);
pp_free(t2);
+ } else if (m->type == Node_typedregex) {
+ NODE *re = m->re_exp;
+ restr = pp_strong_regex(re->stptr, re->stlen, '/');
+ str = pp_group3(txt, op2str(pc->opcode), restr);
+ efree(restr);
} else {
NODE *re = m->re_exp;
restr = pp_string(re->stptr, re->stlen, '/');
@@ -1323,11 +1333,27 @@ parenthesize(int type, NODE *left, NODE *right)
pp_parenthesize(right);
}
-/* pp_string --- pretty format a string or regex constant */
+/* pp_string --- pretty format a string or regular regex constant */
char *
pp_string(const char *in_str, size_t len, int delim)
{
+ return pp_string_or_strong_regex(in_str, len, delim, false);
+}
+
+/* pp_strong_regex --- pretty format a hard regex constant */
+
+static char *
+pp_strong_regex(const char *in_str, size_t len, int delim)
+{
+ return pp_string_or_strong_regex(in_str, len, delim, true);
+}
+
+/* pp_string_or_strong_regex --- pretty format a string, regex, or hard regex constant */
+
+char *
+pp_string_or_strong_regex(const char *in_str, size_t len, int delim, bool strong_regex)
+{
static char str_escapes[] = "\a\b\f\n\r\t\v\\";
static char str_printables[] = "abfnrtv\\";
static char re_escapes[] = "\a\b\f\n\r\t\v";
@@ -1359,11 +1385,15 @@ pp_string(const char *in_str, size_t len, int delim)
osiz *= 2; \
} ofre -= (l)
- osiz = len + 3 + 1; /* initial size; 3 for delim + terminating null */
+ /* initial size; 3 for delim + terminating null, 1 for @ */
+ osiz = len + 3 + 1 + (strong_regex == true);
emalloc(obuf, char *, osiz, "pp_string");
obufout = obuf;
ofre = osiz - 1;
+ if (strong_regex)
+ *obufout++ = '@';
+
*obufout++ = delim;
for (; len > 0; len--, str++) {
chksize(2); /* make space for 2 chars */
diff --git a/re.c b/re.c
index 39453b1c..b67a02fa 100644
--- a/re.c
+++ b/re.c
@@ -351,10 +351,14 @@ re_update(NODE *t)
/* regex was compiled with settings matching IGNORECASE */
if ((t->re_flags & CONSTANT) != 0) {
/* it's a constant, so just return it as is */
- assert(t->type == Node_regex);
+ assert(t->type == Node_regex || t->type == Node_typedregex);
return t->re_reg;
}
t1 = t->re_exp;
+ if (t1->type == Node_typedregex) {
+ assert((t1->re_flags & CONSTANT) != 0);
+ return t1->re_reg;
+ }
if (t->re_text != NULL) {
/* if contents haven't changed, just return it */
if (cmp_nodes(t->re_text, t1) == 0)
@@ -429,6 +433,15 @@ avoid_dfa(NODE *re, char *str, size_t len)
{
char *end;
+ /*
+ * f = @/.../
+ * if ("foo" ~ f) ...
+ *
+ * This creates a Node_dynregex with NULL re_reg.
+ */
+ if (re->re_reg == NULL)
+ return false;
+
if (! re->re_reg->has_anchor)
return false;
diff --git a/test/ChangeLog b/test/ChangeLog
index b80398e8..b57a756f 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,14 @@
+2015-06-19 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (gsubind, typedregex1, typeof1): New tests.
+ * gsubind.awk, gsubind.ok, typedregex1.awk, typedregex1.ok,
+ typeof1.awk, typeof1.ok: New files.
+
+2015-06-17 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * inplace1.ok, inplace2.ok, inplace3.ok: Update line number in error
+ messages, since inplace.awk changed a bit.
+
2015-05-29 Arnold D. Robbins <arnold@skeeve.com>
* checknegtime.awk: New file.
@@ -142,6 +153,7 @@
2015-02-27 Arnold D. Robbins <arnold@skeeve.com>
* nonfatal1.ok: Update after code changes.
+ * id.ok: Updated after code change.
2015-02-26 Arnold D. Robbins <arnold@skeeve.com>
diff --git a/test/Makefile.am b/test/Makefile.am
index f13fa2fb..537a5655 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -381,6 +381,8 @@ EXTRA_DIST = \
gnureops.ok \
gsubasgn.awk \
gsubasgn.ok \
+ gsubind.awk \
+ gsubind.ok \
gsubtest.awk \
gsubtest.ok \
gsubtst2.awk \
@@ -979,6 +981,10 @@ EXTRA_DIST = \
tweakfld.awk \
tweakfld.in \
tweakfld.ok \
+ typedregex1.awk \
+ typedregex1.ok \
+ typeof1.awk \
+ typeof1.ok \
uninit2.awk \
uninit2.ok \
uninit3.awk \
@@ -1076,7 +1082,7 @@ GAWK_EXT_TESTS = \
colonwarn clos1way crlf dbugeval delsub devfd devfd1 devfd2 dumpvars errno exit \
fieldwdth fpat1 fpat2 fpat3 fpat4 fpatnull fsfwfs funlen \
functab1 functab2 functab3 fwtest fwtest2 fwtest3 \
- genpot gensub gensub2 getlndir gnuops2 gnuops3 gnureops \
+ genpot gensub gensub2 getlndir gnuops2 gnuops3 gnureops gsubind \
icasefs icasers id igncdym igncfs ignrcas2 ignrcase \
incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \
include include2 indirectbuiltin indirectcall indirectcall2 \
@@ -1093,6 +1099,7 @@ GAWK_EXT_TESTS = \
splitarg4 strftime \
strtonum switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 \
symtab7 symtab8 symtab9 \
+ typedregex1 typeof1
timeout
EXTRA_TESTS = inftest regtest
diff --git a/test/Makefile.in b/test/Makefile.in
index 08c04a02..a8895ed7 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -638,6 +638,8 @@ EXTRA_DIST = \
gnureops.ok \
gsubasgn.awk \
gsubasgn.ok \
+ gsubind.awk \
+ gsubind.ok \
gsubtest.awk \
gsubtest.ok \
gsubtst2.awk \
@@ -1236,6 +1238,10 @@ EXTRA_DIST = \
tweakfld.awk \
tweakfld.in \
tweakfld.ok \
+ typedregex1.awk \
+ typedregex1.ok \
+ typeof1.awk \
+ typeof1.ok \
uninit2.awk \
uninit2.ok \
uninit3.awk \
@@ -1332,7 +1338,7 @@ GAWK_EXT_TESTS = \
colonwarn clos1way crlf dbugeval delsub devfd devfd1 devfd2 dumpvars errno exit \
fieldwdth fpat1 fpat2 fpat3 fpat4 fpatnull fsfwfs funlen \
functab1 functab2 functab3 fwtest fwtest2 fwtest3 \
- genpot gensub gensub2 getlndir gnuops2 gnuops3 gnureops \
+ genpot gensub gensub2 getlndir gnuops2 gnuops3 gnureops gsubind \
icasefs icasers id igncdym igncfs ignrcas2 ignrcase \
incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \
include include2 indirectbuiltin indirectcall indirectcall2 \
@@ -1349,7 +1355,7 @@ GAWK_EXT_TESTS = \
splitarg4 strftime \
strtonum switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 \
symtab7 symtab8 symtab9 \
- timeout
+ typedregex1 typeof1
EXTRA_TESTS = inftest regtest
INET_TESTS = inetdayu inetdayt inetechu inetecht
@@ -1591,6 +1597,7 @@ uninstall-am:
.PRECIOUS: Makefile
+ timeout
# Message stuff is to make it a little easier to follow.
# Make the pass-fail last and dependent on others to avoid
@@ -3648,6 +3655,11 @@ gnureops:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+gsubind:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
icasefs:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -3883,7 +3895,12 @@ symtab7:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-timeout:
+typedregex1:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+typeof1:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
diff --git a/test/Maketests b/test/Maketests
index 017caa76..a674d5d0 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1092,6 +1092,11 @@ gnureops:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+gsubind:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
icasefs:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -1327,7 +1332,12 @@ symtab7:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-timeout:
+typedregex1:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+typeof1:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
diff --git a/test/gsubind.awk b/test/gsubind.awk
new file mode 100644
index 00000000..fce0d818
--- /dev/null
+++ b/test/gsubind.awk
@@ -0,0 +1,9 @@
+BEGIN {
+ f = "foo"
+ p = @/o/
+ gsub(p, "q", f)
+ print f
+ fun = "gsub"
+ @fun(p, "q", f)
+ print f
+}
diff --git a/test/gsubind.ok b/test/gsubind.ok
new file mode 100644
index 00000000..d25f018a
--- /dev/null
+++ b/test/gsubind.ok
@@ -0,0 +1,3 @@
+fqq
+gawk: gsubind.awk:7: fatal: gsub: can be called indirectly only with two arguments
+EXIT CODE: 2
diff --git a/test/id.ok b/test/id.ok
index bd26b473..145869f1 100644
--- a/test/id.ok
+++ b/test/id.ok
@@ -45,6 +45,7 @@ BINMODE -> scalar
sin -> builtin
asorti -> builtin
FIELDWIDTHS -> scalar
+typeof -> builtin
function1 -> user
FILENAME -> scalar
close -> builtin
diff --git a/test/inplace1.ok b/test/inplace1.ok
index 82562235..91b5276b 100644
--- a/test/inplace1.ok
+++ b/test/inplace1.ok
@@ -1,5 +1,5 @@
before
-gawk: inplace:14: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-'
+gawk: inplace:25: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-'
stdin start
is bar replaced?
stdin end
diff --git a/test/inplace2.ok b/test/inplace2.ok
index 82562235..91b5276b 100644
--- a/test/inplace2.ok
+++ b/test/inplace2.ok
@@ -1,5 +1,5 @@
before
-gawk: inplace:14: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-'
+gawk: inplace:25: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-'
stdin start
is bar replaced?
stdin end
diff --git a/test/inplace3.ok b/test/inplace3.ok
index a7b7254f..deb926b9 100644
--- a/test/inplace3.ok
+++ b/test/inplace3.ok
@@ -1,11 +1,11 @@
before
-gawk: inplace:14: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-'
+gawk: inplace:25: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-'
stdin start
is bar replaced?
stdin end
after
Before
-gawk: inplace:14: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-'
+gawk: inplace:25: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-'
stdin start
is foo replaced?
stdin end
diff --git a/test/typedregex1.awk b/test/typedregex1.awk
new file mode 100644
index 00000000..fc8ba805
--- /dev/null
+++ b/test/typedregex1.awk
@@ -0,0 +1,296 @@
+# This file describes the semantics for hard regex constants
+# As much as possible it's executable code so that it can be used
+# (or split into) test cases for development and regression testing.
+
+function simple_tests( fbre, numresult, strresult)
+{
+ # usable as case value
+ switch ("foobaaar") {
+ case @/fo+ba+r/:
+ print "switch-case: ok"
+ break
+ default:
+ print "switch-case: fail"
+ break
+ }
+
+ # usable with ~ and !~
+ if ("foobaaar" ~ @/fo+ba+r/)
+ print "match ~: ok"
+ else
+ print "match ~: fail"
+
+ if ("quasimoto" !~ @/fo+ba+r/)
+ print "match !~: ok"
+ else
+ print "match !~: fail"
+
+ # assign to variable, use in match
+ fbre = @/fo+ba+r/
+ if ("foobaaar" ~ fbre)
+ print "variable match ~: ok"
+ else
+ print "variable match ~: fail"
+
+ if ("quasimoto" !~ fbre)
+ print "variable match !~: ok"
+ else
+ print "variable match !~: fail"
+
+ # Use as numeric value, should be zero
+ numresult = fbre + 42
+ if (numresult == 42)
+ print "variable as numeric value: ok"
+ else
+ print "variable as numeric value: fail"
+
+ # Use as string value, should be string value of regexp text
+ strresult = "<" fbre ">"
+ if (strresult == "<fo+ba+r>")
+ print "variable as string value: ok"
+ else
+ print "variable as string value: fail", strresult
+
+ # typeof should work
+ if (typeof(@/fo+ba+r/) == "regexp")
+ print "typeof constant: ok"
+ else
+ print "typeof constant: fail"
+
+ if (typeof(fbre) == "regexp")
+ print "typeof variable: ok"
+ else
+ print "typeof variable: fail"
+
+ # conversion to number, works. should it be fatal?
+ fbre++
+ if (fbre == 1)
+ print "conversion to number: ok"
+ else
+ print "conversion to number: fail"
+
+ if (typeof(fbre) == "scalar_n")
+ print "typeof variable after conversion: ok"
+ else
+ print "typeof variable after conversion: fail"
+}
+
+function match_tests( fbre, fun)
+{
+ if (match("foobaaar", @/fo+ba+r/))
+ print "match(constant): ok"
+ else
+ print "match(constant): fail"
+
+ fbre = @/fo+ba+r/
+ if (match("foobaaar", fbre))
+ print "match(variable): ok"
+ else
+ print "match(variable): fail"
+
+ fun = "match"
+ if (@fun("foobaaar", @/fo+ba+r/))
+ print "match(constant) indirect: ok"
+ else
+ print "match(constant) indirect: fail"
+
+ if (@fun("foobaaar", fbre))
+ print "match(variable) indirect: ok"
+ else
+ print "match(variable) indirect: fail"
+}
+
+function sub_tests( fbre, count, target, fun)
+{
+ target = "abc foobaar def foobar ghi"
+ count = sub(@/fo+ba+r/, "XX", target)
+ if (count == 1 && target == "abc XX def foobar ghi")
+ print "sub(constant): ok"
+ else
+ print "sub(constant): fail"
+
+ fbre = @/fo+ba+r/
+ target = "abc foobaar def foobar ghi"
+ count = sub(fbre, "XX", target)
+ if (count == 1 && target == "abc XX def foobar ghi")
+ print "sub(variable): ok"
+ else
+ print "sub(variable): fail"
+
+ fun = "sub"
+ $0 = "abc foobaar def foobar ghi"
+ count = @fun(@/fo+ba+r/, "XX")
+ if (count == 1 && $0 == "abc XX def foobar ghi")
+ print "sub(constant) indirect: ok"
+ else
+ print "sub(constant) indirect: fail"
+
+ $0 = "abc foobaar def foobar ghi"
+ count = @fun(fbre, "XX")
+ if (count == 1 && $0 == "abc XX def foobar ghi")
+ print "sub(variable) indirect: ok"
+ else
+ print "sub(variable) indirect: fail"
+}
+
+function gsub_tests( fbre, count, target, fun)
+{
+ target = "abc foobaar def foobar ghi"
+ count = gsub(@/fo+ba+r/, "XX", target)
+ if (count == 2 && target == "abc XX def XX ghi")
+ print "gsub(constant): ok"
+ else
+ print "gsub(constant): fail"
+
+ fbre = @/fo+ba+r/
+ target = "abc foobaar def foobar ghi"
+ count = gsub(fbre, "XX", target)
+ if (count == 2 && target == "abc XX def XX ghi")
+ print "gsub(variable): ok"
+ else
+ print "gsub(variable): fail"
+
+ fun = "gsub"
+ $0 = "abc foobaar def foobar ghi"
+ count = @fun(@/fo+ba+r/, "XX")
+ if (count == 2 && $0 == "abc XX def XX ghi")
+ print "gsub(constant) indirect: ok"
+ else
+ print "gsub(constant) indirect: fail"
+
+ $0 = "abc foobaar def foobar ghi"
+ count = @fun(fbre, "XX")
+ if (count == 2 && $0 == "abc XX def XX ghi")
+ print "gsub(variable) indirect: ok"
+ else
+ print "gsub(variable) indirect: fail"
+}
+
+function gensub_tests( fbre, result, target, fun)
+{
+ target = "abc foobaar def foobar ghi"
+ result = gensub(@/fo+ba+r/, "XX", "g", target)
+ if (result == "abc XX def XX ghi")
+ print "gensub(constant): ok"
+ else
+ print "gensub(constant): fail"
+
+ fbre = @/fo+ba+r/
+ target = "abc foobaar def foobar ghi"
+ result = gensub(fbre, "XX", "g", target)
+ if (result == "abc XX def XX ghi")
+ print "gensub(variable): ok"
+ else
+ print "gensub(variable): fail"
+
+ fun = "gensub"
+ $0 = "abc foobaar def foobar ghi"
+ result = @fun(@/fo+ba+r/, "XX", "g")
+ if (result == "abc XX def XX ghi")
+ print "gensub(constant) indirect: ok"
+ else
+ print "gensub(constant) indirect: fail"
+
+ $0 = "abc foobaar def foobar ghi"
+ result = @fun(fbre, "XX", "g")
+ if (result == "abc XX def XX ghi")
+ print "gensub(variable) indirect: ok"
+ else
+ print "gensub(variable) indirect: fail"
+
+ result = @fun(@/fo+ba+r/, "XX", "g", target)
+ if (result == "abc XX def XX ghi")
+ print "gensub(constant) indirect 2: ok"
+ else
+ print "gensub(constant) indirect 2: fail"
+
+ result = @fun(fbre, "XX", "g", target)
+ if (result == "abc XX def XX ghi")
+ print "gensub(variable) indirect 2: ok"
+ else
+ print "gensub(variable) indirect 2: fail"
+}
+
+function split_tests( fbre, data, seps, fun, b1)
+{
+ delete data
+ delete seps
+ b1 = split("a:b:c:d", data, @/:/, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "split(constant): ok"
+ else
+ print "split(constant): fail"
+
+ delete data
+ delete seps
+ fbre = @/:/
+ b1 = split("a:b:c:d", data, fbre, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "split(variable): ok"
+ else
+ print "split(variable): fail"
+
+ fun = "split"
+ delete data
+ delete seps
+ b1 = @fun("a:b:c:d", data, @/:/, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "split(constant) indirect: ok"
+ else
+ print "split(constant) indirect: fail"
+
+ delete data
+ delete seps
+ b1 = @fun("a:b:c:d", data, fbre, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "split(variable) indirect: ok"
+ else
+ print "split(variable) indirect: fail"
+}
+
+function patsplit_tests( fbre, data, seps, fun, b1)
+{
+ delete data
+ delete seps
+ b1 = patsplit("a:b:c:d", data, @/[a-z]+/, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "patsplit(constant): ok"
+ else
+ print "patsplit(constant): fail"
+
+ delete data
+ delete seps
+ fbre = @/[a-z]+/
+ b1 = patsplit("a:b:c:d", data, fbre, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "patsplit(variable): ok"
+ else
+ print "patsplit(variable): fail"
+
+ fun = "patsplit"
+ delete data
+ delete seps
+ b1 = @fun("a:b:c:d", data, @/[a-z]+/, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "patsplit(constant) indirect: ok"
+ else
+ print "patsplit(constant) indirect: fail"
+
+ delete data
+ delete seps
+ b1 = @fun("a:b:c:d", data, fbre, seps)
+ if (b1 == 4 && data[1] == "a" && seps[1] == ":")
+ print "patsplit(variable) indirect: ok"
+ else
+ print "patsplit(variable) indirect: fail"
+}
+
+BEGIN {
+ simple_tests()
+ match_tests()
+ sub_tests()
+ gsub_tests()
+ gensub_tests()
+ split_tests()
+ patsplit_tests()
+}
diff --git a/test/typedregex1.ok b/test/typedregex1.ok
new file mode 100644
index 00000000..03ef7cfa
--- /dev/null
+++ b/test/typedregex1.ok
@@ -0,0 +1,37 @@
+switch-case: ok
+match ~: ok
+match !~: ok
+variable match ~: ok
+variable match !~: ok
+variable as numeric value: ok
+variable as string value: ok
+typeof constant: ok
+typeof variable: ok
+conversion to number: ok
+typeof variable after conversion: ok
+match(constant): ok
+match(variable): ok
+match(constant) indirect: ok
+match(variable) indirect: ok
+sub(constant): ok
+sub(variable): ok
+sub(constant) indirect: ok
+sub(variable) indirect: ok
+gsub(constant): ok
+gsub(variable): ok
+gsub(constant) indirect: ok
+gsub(variable) indirect: ok
+gensub(constant): ok
+gensub(variable): ok
+gensub(constant) indirect: ok
+gensub(variable) indirect: ok
+gensub(constant) indirect 2: ok
+gensub(variable) indirect 2: ok
+split(constant): ok
+split(variable): ok
+split(constant) indirect: ok
+split(variable) indirect: ok
+patsplit(constant): ok
+patsplit(variable): ok
+patsplit(constant) indirect: ok
+patsplit(variable) indirect: ok
diff --git a/test/typeof1.awk b/test/typeof1.awk
new file mode 100644
index 00000000..c301030e
--- /dev/null
+++ b/test/typeof1.awk
@@ -0,0 +1,9 @@
+BEGIN {
+ a = 5 ; print typeof(a)
+ print typeof(b)
+ print typeof(@/foo/)
+ c = "foo" ; print typeof(c)
+ d[1] = 1 ; print typeof(d), typeof(d[1])
+ e = @/foo/ ; print typeof(e)
+ print typeof(@/bar/)
+}
diff --git a/test/typeof1.ok b/test/typeof1.ok
new file mode 100644
index 00000000..3a2f6a92
--- /dev/null
+++ b/test/typeof1.ok
@@ -0,0 +1,7 @@
+scalar_n
+untyped
+regexp
+scalar_s
+array scalar_n
+regexp
+regexp