aboutsummaryrefslogtreecommitdiffstats
path: root/awkgram.c
diff options
context:
space:
mode:
Diffstat (limited to 'awkgram.c')
-rw-r--r--awkgram.c3631
1 files changed, 1612 insertions, 2019 deletions
diff --git a/awkgram.c b/awkgram.c
index 33f0d6cd..54680e75 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -83,20 +83,17 @@ static char *get_src_buf(void);
static int yylex(void);
int yyparse(void);
static INSTRUCTION *snode(INSTRUCTION *subn, INSTRUCTION *op);
-static int func_install(INSTRUCTION *fp, INSTRUCTION *def);
-static void pop_params(NODE *params);
-static NODE *make_param(char *pname);
+static char **check_params(char *fname, int pcount, INSTRUCTION *list);
+static int install_function(char *fname, INSTRUCTION *fi, INSTRUCTION *plist);
static NODE *mk_rexp(INSTRUCTION *exp);
-static void append_param(char *pname);
-static int dup_parms(INSTRUCTION *fp, NODE *func);
static void param_sanity(INSTRUCTION *arglist);
static int parms_shadow(INSTRUCTION *pc, int *shadow);
static int isnoeffect(OPCODE type);
static INSTRUCTION *make_assignable(INSTRUCTION *ip);
static void dumpintlstr(const char *str, size_t len);
static void dumpintlstr2(const char *str1, size_t len1, const char *str2, size_t len2);
-static int isarray(NODE *n);
static int include_source(INSTRUCTION *file);
+static int load_library(INSTRUCTION *file);
static void next_sourcefile(void);
static char *tokexpand(void);
@@ -104,6 +101,7 @@ static char *tokexpand(void);
static INSTRUCTION *mk_program(void);
static INSTRUCTION *append_rule(INSTRUCTION *pattern, INSTRUCTION *action);
+static INSTRUCTION *mk_function(INSTRUCTION *fi, INSTRUCTION *def);
static INSTRUCTION *mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch,
INSTRUCTION *elsep, INSTRUCTION *false_branch);
static INSTRUCTION *mk_expression_list(INSTRUCTION *list, INSTRUCTION *s1);
@@ -115,23 +113,23 @@ static INSTRUCTION *mk_boolean(INSTRUCTION *left, INSTRUCTION *right, INSTRUCTIO
static INSTRUCTION *mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op);
static INSTRUCTION *mk_getline(INSTRUCTION *op, INSTRUCTION *opt_var, INSTRUCTION *redir, int redirtype);
static NODE *make_regnode(int type, NODE *exp);
-static int count_expressions(INSTRUCTION **list, int isarg);
+static int count_expressions(INSTRUCTION **list, bool isarg);
static INSTRUCTION *optimize_assignment(INSTRUCTION *exp);
static void add_lint(INSTRUCTION *list, LINTTYPE linttype);
-enum defref { FUNC_DEFINE, FUNC_USE };
+static void process_deferred();
+
+enum defref { FUNC_DEFINE, FUNC_USE, FUNC_EXT };
static void func_use(const char *name, enum defref how);
static void check_funcs(void);
-static void free_bcpool(INSTRUCTION *pl);
static ssize_t read_one_line(int fd, void *buffer, size_t count);
static int one_line_close(int fd);
-static void (*install_func)(char *) = NULL;
-
-static int want_source = FALSE;
-static int want_regexp; /* lexical scanning kludge */
-static int can_return; /* parsing kludge */
+static bool want_source = false;
+static bool want_regexp = false; /* lexical scanning kludge */
+static char *in_function; /* parsing kludge */
+static bool symtab_used = false; /* program used SYMTAB */
static int rule = 0;
const char *const ruletab[] = {
@@ -143,50 +141,39 @@ const char *const ruletab[] = {
"ENDFILE",
};
-static int in_print = FALSE; /* lexical scanning kludge for print */
+static bool in_print = false; /* lexical scanning kludge for print */
static int in_parens = 0; /* lexical scanning kludge for print */
static int sub_counter = 0; /* array dimension counter for use in delete */
static char *lexptr = NULL; /* pointer to next char during parsing */
static char *lexend;
static char *lexptr_begin; /* keep track of where we were for error msgs */
static char *lexeme; /* beginning of lexeme for debugging */
-static int lexeof; /* seen EOF for current source? */
+static bool lexeof; /* seen EOF for current source? */
static char *thisline = NULL;
static int in_braces = 0; /* count braces for firstline, lastline in an 'action' */
static int lastline = 0;
static int firstline = 0;
static SRCFILE *sourcefile = NULL; /* current program source */
static int lasttok = 0;
-static int eof_warned = FALSE; /* GLOBAL: want warning for each file */
+static bool eof_warned = false; /* GLOBAL: want warning for each file */
static int break_allowed; /* kludge for break */
static int continue_allowed; /* kludge for continue */
-
#define END_FILE -1000
#define END_SRC -2000
#define YYDEBUG_LEXER_TEXT (lexeme)
-static int param_counter;
-static NODE *func_params; /* list of parameters for the current function */
static char *tokstart = NULL;
static char *tok = NULL;
static char *tokend;
static int errcount = 0;
-static NODE *symbol_list;
-extern void destroy_symbol(char *name);
-
-static long func_count; /* total number of functions */
-
-#define HASHSIZE 1021 /* this constant only used here */
-NODE *variables[HASHSIZE];
-static int var_count; /* total number of global variables */
-
extern char *source;
extern int sourceline;
extern SRCFILE *srcfiles;
extern INSTRUCTION *rule_list;
extern int max_args;
+extern NODE **args_array;
static INSTRUCTION *rule_block[sizeof(ruletab)];
@@ -203,21 +190,11 @@ static inline INSTRUCTION *list_prepend(INSTRUCTION *l, INSTRUCTION *x);
static inline INSTRUCTION *list_merge(INSTRUCTION *l1, INSTRUCTION *l2);
extern double fmod(double x, double y);
-/*
- * This string cannot occur as a real awk identifier.
- * Use it as a special token to make function parsing
- * uniform, but if it's seen, don't install the function.
- * e.g.
- * function split(x) { return x }
- * function x(a) { return a }
- * should only produce one error message, and not core dump.
- */
-static char builtin_func[] = "@builtin";
#define YYSTYPE INSTRUCTION *
/* Line 360 of yacc.c */
-#line 221 "awkgram.c"
+#line 198 "awkgram.c"
# ifndef YY_NULL
# if defined __cplusplus && 201103L <= __cplusplus
@@ -297,9 +274,10 @@ extern int yydebug;
LEX_EOF = 302,
LEX_INCLUDE = 303,
LEX_EVAL = 304,
- NEWLINE = 305,
- SLASH_BEFORE_EQUAL = 306,
- UNARY = 307
+ LEX_LOAD = 305,
+ NEWLINE = 306,
+ SLASH_BEFORE_EQUAL = 307,
+ UNARY = 308
};
#endif
/* Tokens. */
@@ -350,9 +328,10 @@ extern int yydebug;
#define LEX_EOF 302
#define LEX_INCLUDE 303
#define LEX_EVAL 304
-#define NEWLINE 305
-#define SLASH_BEFORE_EQUAL 306
-#define UNARY 307
+#define LEX_LOAD 305
+#define NEWLINE 306
+#define SLASH_BEFORE_EQUAL 307
+#define UNARY 308
@@ -384,7 +363,7 @@ int yyparse ();
/* Copy the second part of user declarations. */
/* Line 379 of yacc.c */
-#line 388 "awkgram.c"
+#line 367 "awkgram.c"
#ifdef short
# undef short
@@ -601,20 +580,20 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 1157
+#define YYLAST 1155
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 74
+#define YYNTOKENS 75
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 65
/* YYNRULES -- Number of rules. */
-#define YYNRULES 185
+#define YYNRULES 188
/* YYNRULES -- Number of states. */
-#define YYNSTATES 330
+#define YYNSTATES 335
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 307
+#define YYMAXUTOK 308
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -625,16 +604,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, 62, 2, 2, 65, 61, 2, 2,
- 66, 67, 59, 57, 54, 58, 2, 60, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 53, 73,
- 55, 2, 56, 52, 68, 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, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 69, 2, 70, 64, 2, 2, 2, 2, 2,
+ 2, 70, 2, 71, 65, 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, 71, 2, 72, 2, 2, 2, 2,
+ 2, 2, 2, 72, 2, 73, 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,
@@ -652,7 +631,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, 63
+ 45, 46, 47, 48, 49, 50, 51, 52, 64
};
#if YYDEBUG
@@ -661,111 +640,112 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 4, 7, 10, 13, 16, 19, 22,
- 25, 30, 32, 35, 37, 38, 40, 45, 47, 49,
- 51, 53, 59, 61, 63, 65, 68, 70, 72, 73,
- 81, 82, 86, 88, 90, 91, 94, 97, 99, 102,
- 105, 109, 111, 121, 128, 137, 146, 159, 171, 173,
- 176, 179, 182, 185, 189, 190, 195, 198, 199, 204,
- 205, 210, 215, 217, 218, 220, 221, 224, 227, 233,
- 238, 240, 243, 246, 248, 250, 252, 254, 256, 260,
- 261, 262, 266, 273, 283, 285, 288, 289, 291, 292,
- 295, 296, 298, 300, 304, 306, 309, 313, 314, 316,
- 317, 319, 321, 325, 327, 330, 334, 338, 342, 346,
- 350, 354, 358, 362, 368, 370, 372, 374, 377, 379,
- 381, 383, 385, 387, 389, 392, 394, 398, 402, 406,
- 410, 414, 418, 422, 425, 428, 434, 439, 443, 447,
- 451, 455, 459, 463, 465, 468, 472, 477, 482, 484,
- 486, 488, 491, 494, 496, 498, 501, 504, 506, 509,
- 514, 515, 517, 518, 521, 523, 526, 528, 532, 534,
- 537, 540, 542, 545, 547, 551, 553, 555, 556, 559,
- 562, 564, 565, 567, 569, 571
+ 25, 30, 35, 37, 40, 42, 44, 47, 49, 50,
+ 52, 57, 59, 61, 63, 65, 71, 73, 75, 77,
+ 80, 82, 84, 91, 92, 96, 98, 100, 101, 104,
+ 107, 109, 112, 115, 119, 121, 131, 138, 147, 156,
+ 169, 181, 183, 186, 189, 192, 195, 199, 200, 205,
+ 208, 209, 214, 215, 220, 225, 227, 228, 230, 231,
+ 234, 237, 243, 248, 250, 253, 256, 258, 260, 262,
+ 264, 266, 270, 271, 272, 276, 283, 293, 295, 298,
+ 299, 301, 302, 305, 306, 308, 310, 314, 316, 319,
+ 323, 324, 326, 327, 329, 331, 335, 337, 340, 344,
+ 348, 352, 356, 360, 364, 368, 372, 378, 380, 382,
+ 384, 387, 389, 391, 393, 395, 397, 399, 402, 404,
+ 408, 412, 416, 420, 424, 428, 432, 435, 438, 444,
+ 449, 453, 457, 461, 465, 469, 473, 475, 478, 482,
+ 487, 492, 494, 496, 498, 501, 504, 506, 508, 511,
+ 514, 516, 519, 524, 525, 527, 528, 531, 533, 536,
+ 538, 542, 544, 547, 550, 552, 555, 557, 561, 563,
+ 565, 566, 569, 572, 574, 575, 577, 579, 581
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int16 yyrhs[] =
{
- 75, 0, -1, -1, 75, 76, -1, 75, 104, -1,
- 75, 47, -1, 75, 1, -1, 78, 79, -1, 78,
- 88, -1, 82, 79, -1, 68, 48, 77, 88, -1,
- 6, -1, 6, 1, -1, 1, -1, -1, 112, -1,
- 112, 54, 105, 112, -1, 17, -1, 18, -1, 36,
- -1, 37, -1, 132, 87, 133, 135, 105, -1, 4,
- -1, 3, -1, 81, -1, 68, 49, -1, 45, -1,
- 46, -1, -1, 35, 83, 80, 66, 107, 134, 105,
- -1, -1, 86, 85, 5, -1, 60, -1, 51, -1,
- -1, 87, 89, -1, 87, 1, -1, 104, -1, 136,
- 105, -1, 136, 105, -1, 132, 87, 133, -1, 103,
- -1, 23, 66, 112, 134, 105, 132, 96, 105, 133,
- -1, 26, 66, 112, 134, 105, 89, -1, 27, 105,
- 89, 26, 66, 112, 134, 105, -1, 28, 66, 4,
- 40, 129, 134, 105, 89, -1, 28, 66, 95, 136,
- 105, 112, 136, 105, 95, 134, 105, 89, -1, 28,
- 66, 95, 136, 105, 136, 105, 95, 134, 105, 89,
- -1, 90, -1, 29, 88, -1, 30, 88, -1, 33,
- 88, -1, 39, 88, -1, 34, 109, 88, -1, -1,
- 21, 91, 109, 88, -1, 92, 88, -1, -1, 99,
- 93, 100, 101, -1, -1, 22, 4, 94, 123, -1,
- 22, 66, 4, 67, -1, 112, -1, -1, 92, -1,
- -1, 96, 97, -1, 96, 1, -1, 24, 98, 137,
- 105, 87, -1, 25, 137, 105, 87, -1, 7, -1,
- 58, 7, -1, 57, 7, -1, 8, -1, 84, -1,
- 31, -1, 32, -1, 110, -1, 66, 111, 134, -1,
- -1, -1, 10, 102, 116, -1, 19, 66, 112, 134,
- 105, 89, -1, 19, 66, 112, 134, 105, 89, 20,
- 105, 89, -1, 50, -1, 104, 50, -1, -1, 104,
- -1, -1, 55, 117, -1, -1, 108, -1, 4, -1,
- 108, 138, 4, -1, 1, -1, 108, 1, -1, 108,
- 138, 1, -1, -1, 112, -1, -1, 111, -1, 112,
- -1, 111, 138, 112, -1, 1, -1, 111, 1, -1,
- 111, 1, 112, -1, 111, 138, 1, -1, 130, 113,
- 112, -1, 112, 41, 112, -1, 112, 42, 112, -1,
- 112, 14, 112, -1, 112, 40, 129, -1, 112, 115,
- 112, -1, 112, 52, 112, 53, 112, -1, 116, -1,
- 13, -1, 12, -1, 51, 13, -1, 9, -1, 55,
- -1, 114, -1, 56, -1, 117, -1, 118, -1, 116,
- 117, -1, 119, -1, 117, 64, 117, -1, 117, 59,
- 117, -1, 117, 60, 117, -1, 117, 61, 117, -1,
- 117, 57, 117, -1, 117, 58, 117, -1, 38, 122,
- 106, -1, 130, 43, -1, 130, 44, -1, 66, 111,
- 134, 40, 129, -1, 116, 11, 38, 122, -1, 118,
- 64, 117, -1, 118, 59, 117, -1, 118, 60, 117,
- -1, 118, 61, 117, -1, 118, 57, 117, -1, 118,
- 58, 117, -1, 84, -1, 62, 117, -1, 66, 112,
- 134, -1, 45, 66, 110, 134, -1, 46, 66, 110,
- 134, -1, 46, -1, 120, -1, 130, -1, 43, 130,
- -1, 44, 130, -1, 7, -1, 8, -1, 58, 117,
- -1, 57, 117, -1, 121, -1, 68, 121, -1, 3,
- 66, 110, 134, -1, -1, 130, -1, -1, 124, 16,
- -1, 125, -1, 124, 125, -1, 126, -1, 69, 111,
- 70, -1, 126, -1, 127, 126, -1, 127, 16, -1,
- 4, -1, 4, 128, -1, 129, -1, 65, 119, 131,
- -1, 43, -1, 44, -1, -1, 71, 105, -1, 72,
- 105, -1, 67, -1, -1, 136, -1, 73, -1, 53,
- -1, 54, 105, -1
+ 76, 0, -1, -1, 76, 77, -1, 76, 105, -1,
+ 76, 47, -1, 76, 1, -1, 80, 81, -1, 80,
+ 89, -1, 84, 81, -1, 69, 48, 78, 89, -1,
+ 69, 50, 79, 89, -1, 6, -1, 6, 1, -1,
+ 1, -1, 6, -1, 6, 1, -1, 1, -1, -1,
+ 113, -1, 113, 55, 106, 113, -1, 17, -1, 18,
+ -1, 36, -1, 37, -1, 133, 88, 134, 136, 106,
+ -1, 4, -1, 3, -1, 83, -1, 69, 49, -1,
+ 45, -1, 46, -1, 35, 82, 67, 108, 135, 106,
+ -1, -1, 87, 86, 5, -1, 61, -1, 52, -1,
+ -1, 88, 90, -1, 88, 1, -1, 105, -1, 137,
+ 106, -1, 137, 106, -1, 133, 88, 134, -1, 104,
+ -1, 23, 67, 113, 135, 106, 133, 97, 106, 134,
+ -1, 26, 67, 113, 135, 106, 90, -1, 27, 106,
+ 90, 26, 67, 113, 135, 106, -1, 28, 67, 4,
+ 40, 130, 135, 106, 90, -1, 28, 67, 96, 137,
+ 106, 113, 137, 106, 96, 135, 106, 90, -1, 28,
+ 67, 96, 137, 106, 137, 106, 96, 135, 106, 90,
+ -1, 91, -1, 29, 89, -1, 30, 89, -1, 33,
+ 89, -1, 39, 89, -1, 34, 110, 89, -1, -1,
+ 21, 92, 110, 89, -1, 93, 89, -1, -1, 100,
+ 94, 101, 102, -1, -1, 22, 4, 95, 124, -1,
+ 22, 67, 4, 68, -1, 113, -1, -1, 93, -1,
+ -1, 97, 98, -1, 97, 1, -1, 24, 99, 138,
+ 106, 88, -1, 25, 138, 106, 88, -1, 7, -1,
+ 59, 7, -1, 58, 7, -1, 8, -1, 85, -1,
+ 31, -1, 32, -1, 111, -1, 67, 112, 135, -1,
+ -1, -1, 10, 103, 117, -1, 19, 67, 113, 135,
+ 106, 90, -1, 19, 67, 113, 135, 106, 90, 20,
+ 106, 90, -1, 51, -1, 105, 51, -1, -1, 105,
+ -1, -1, 56, 118, -1, -1, 109, -1, 4, -1,
+ 109, 139, 4, -1, 1, -1, 109, 1, -1, 109,
+ 139, 1, -1, -1, 113, -1, -1, 112, -1, 113,
+ -1, 112, 139, 113, -1, 1, -1, 112, 1, -1,
+ 112, 1, 113, -1, 112, 139, 1, -1, 131, 114,
+ 113, -1, 113, 41, 113, -1, 113, 42, 113, -1,
+ 113, 14, 113, -1, 113, 40, 130, -1, 113, 116,
+ 113, -1, 113, 53, 113, 54, 113, -1, 117, -1,
+ 13, -1, 12, -1, 52, 13, -1, 9, -1, 56,
+ -1, 115, -1, 57, -1, 118, -1, 119, -1, 117,
+ 118, -1, 120, -1, 118, 65, 118, -1, 118, 60,
+ 118, -1, 118, 61, 118, -1, 118, 62, 118, -1,
+ 118, 58, 118, -1, 118, 59, 118, -1, 38, 123,
+ 107, -1, 131, 43, -1, 131, 44, -1, 67, 112,
+ 135, 40, 130, -1, 117, 11, 38, 123, -1, 119,
+ 65, 118, -1, 119, 60, 118, -1, 119, 61, 118,
+ -1, 119, 62, 118, -1, 119, 58, 118, -1, 119,
+ 59, 118, -1, 85, -1, 63, 118, -1, 67, 113,
+ 135, -1, 45, 67, 111, 135, -1, 46, 67, 111,
+ 135, -1, 46, -1, 121, -1, 131, -1, 43, 131,
+ -1, 44, 131, -1, 7, -1, 8, -1, 59, 118,
+ -1, 58, 118, -1, 122, -1, 69, 122, -1, 3,
+ 67, 111, 135, -1, -1, 131, -1, -1, 125, 16,
+ -1, 126, -1, 125, 126, -1, 127, -1, 70, 112,
+ 71, -1, 127, -1, 128, 127, -1, 128, 16, -1,
+ 4, -1, 4, 129, -1, 130, -1, 66, 120, 132,
+ -1, 43, -1, 44, -1, -1, 72, 106, -1, 73,
+ 106, -1, 68, -1, -1, 137, -1, 74, -1, 54,
+ -1, 55, 106, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 218, 218, 220, 225, 226, 230, 242, 246, 257,
- 265, 273, 281, 283, 289, 290, 292, 318, 329, 340,
- 346, 355, 365, 367, 369, 380, 385, 386, 391, 390,
- 420, 419, 452, 454, 459, 460, 473, 478, 479, 483,
- 485, 487, 494, 584, 626, 668, 781, 788, 795, 805,
- 814, 823, 832, 843, 859, 858, 870, 882, 882, 978,
- 978, 1004, 1027, 1033, 1034, 1040, 1041, 1048, 1053, 1065,
- 1079, 1081, 1087, 1092, 1094, 1102, 1104, 1113, 1114, 1122,
- 1127, 1127, 1138, 1142, 1150, 1151, 1154, 1156, 1161, 1162,
- 1169, 1171, 1175, 1181, 1188, 1190, 1192, 1199, 1200, 1206,
- 1207, 1212, 1214, 1219, 1221, 1223, 1225, 1231, 1238, 1240,
- 1242, 1258, 1268, 1275, 1277, 1282, 1284, 1286, 1294, 1296,
- 1301, 1303, 1308, 1310, 1312, 1365, 1367, 1369, 1371, 1373,
- 1375, 1377, 1379, 1402, 1407, 1412, 1437, 1443, 1445, 1447,
- 1449, 1451, 1453, 1458, 1462, 1493, 1495, 1501, 1507, 1520,
- 1521, 1522, 1527, 1532, 1536, 1540, 1552, 1565, 1570, 1606,
- 1624, 1625, 1631, 1632, 1637, 1639, 1646, 1663, 1680, 1682,
- 1689, 1694, 1702, 1716, 1728, 1737, 1741, 1745, 1749, 1753,
- 1757, 1760, 1762, 1766, 1770, 1774
+ 0, 195, 195, 197, 202, 203, 209, 221, 225, 236,
+ 242, 247, 255, 263, 265, 270, 278, 280, 286, 287,
+ 289, 315, 326, 337, 343, 352, 362, 364, 366, 372,
+ 377, 378, 382, 401, 400, 434, 436, 441, 442, 455,
+ 460, 461, 465, 467, 469, 476, 566, 608, 650, 763,
+ 770, 777, 787, 796, 805, 814, 825, 841, 840, 864,
+ 876, 876, 974, 974, 1007, 1037, 1043, 1044, 1050, 1051,
+ 1058, 1063, 1075, 1089, 1091, 1099, 1104, 1106, 1114, 1116,
+ 1125, 1126, 1134, 1139, 1139, 1150, 1154, 1162, 1163, 1166,
+ 1168, 1173, 1174, 1183, 1184, 1189, 1194, 1200, 1202, 1204,
+ 1211, 1212, 1218, 1219, 1224, 1226, 1231, 1233, 1235, 1237,
+ 1243, 1250, 1252, 1254, 1270, 1280, 1287, 1289, 1294, 1296,
+ 1298, 1306, 1308, 1313, 1315, 1320, 1322, 1324, 1374, 1376,
+ 1378, 1380, 1382, 1384, 1386, 1388, 1411, 1416, 1421, 1446,
+ 1452, 1454, 1456, 1458, 1460, 1462, 1467, 1471, 1503, 1505,
+ 1511, 1517, 1530, 1531, 1532, 1537, 1542, 1546, 1550, 1565,
+ 1578, 1583, 1619, 1637, 1638, 1644, 1645, 1650, 1652, 1659,
+ 1676, 1693, 1695, 1702, 1707, 1715, 1725, 1737, 1746, 1750,
+ 1754, 1758, 1762, 1766, 1769, 1771, 1775, 1779, 1783
};
#endif
@@ -783,22 +763,22 @@ static const char *const yytname[] =
"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",
- "NEWLINE", "SLASH_BEFORE_EQUAL", "'?'", "':'", "','", "'<'", "'>'",
- "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "UNARY", "'^'", "'$'", "'('",
- "')'", "'@'", "'['", "']'", "'{'", "'}'", "';'", "$accept", "program",
- "rule", "source", "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_NULL
+ "LEX_LOAD", "NEWLINE", "SLASH_BEFORE_EQUAL", "'?'", "':'", "','", "'<'",
+ "'>'", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "UNARY", "'^'", "'$'",
+ "'('", "')'", "'@'", "'['", "']'", "'{'", "'}'", "';'", "$accept",
+ "program", "rule", "source", "library", "pattern", "action", "func_name",
+ "lex_builtin", "function_prologue", "regexp", "$@1", "a_slash",
+ "statements", "statement_term", "statement", "non_compound_stmt", "$@2",
+ "simple_stmt", "$@3", "$@4", "opt_simple_stmt", "case_statements",
+ "case_statement", "case_value", "print", "print_expression_list",
+ "output_redir", "$@5", "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_NULL
};
#endif
@@ -812,58 +792,58 @@ 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, 63, 58, 44, 60, 62, 43, 45, 42,
- 47, 37, 33, 307, 94, 36, 40, 41, 64, 91,
- 93, 123, 125, 59
+ 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
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 74, 75, 75, 75, 75, 75, 76, 76, 76,
- 76, 77, 77, 77, 78, 78, 78, 78, 78, 78,
- 78, 79, 80, 80, 80, 80, 81, 81, 83, 82,
- 85, 84, 86, 86, 87, 87, 87, 88, 88, 89,
- 89, 89, 89, 89, 89, 89, 89, 89, 89, 90,
- 90, 90, 90, 90, 91, 90, 90, 93, 92, 94,
- 92, 92, 92, 95, 95, 96, 96, 96, 97, 97,
- 98, 98, 98, 98, 98, 99, 99, 100, 100, 101,
- 102, 101, 103, 103, 104, 104, 105, 105, 106, 106,
- 107, 107, 108, 108, 108, 108, 108, 109, 109, 110,
- 110, 111, 111, 111, 111, 111, 111, 112, 112, 112,
- 112, 112, 112, 112, 112, 113, 113, 113, 114, 114,
- 115, 115, 116, 116, 116, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 117, 118, 118, 118, 118,
- 118, 118, 118, 119, 119, 119, 119, 119, 119, 119,
- 119, 119, 119, 119, 119, 119, 119, 120, 120, 121,
- 122, 122, 123, 123, 124, 124, 125, 126, 127, 127,
- 128, 129, 129, 130, 130, 131, 131, 131, 132, 133,
- 134, 135, 135, 136, 137, 138
+ 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, 84, 86, 85, 87, 87, 88, 88, 88,
+ 89, 89, 90, 90, 90, 90, 90, 90, 90, 90,
+ 90, 90, 91, 91, 91, 91, 91, 92, 91, 91,
+ 94, 93, 95, 93, 93, 93, 96, 96, 97, 97,
+ 97, 98, 98, 99, 99, 99, 99, 99, 100, 100,
+ 101, 101, 102, 103, 102, 104, 104, 105, 105, 106,
+ 106, 107, 107, 108, 108, 109, 109, 109, 109, 109,
+ 110, 110, 111, 111, 112, 112, 112, 112, 112, 112,
+ 113, 113, 113, 113, 113, 113, 113, 113, 114, 114,
+ 114, 115, 115, 116, 116, 117, 117, 117, 118, 118,
+ 118, 118, 118, 118, 118, 118, 118, 118, 118, 119,
+ 119, 119, 119, 119, 119, 119, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 121, 121, 122, 123, 123, 124, 124, 125, 125, 126,
+ 127, 128, 128, 129, 130, 130, 131, 131, 132, 132,
+ 132, 133, 134, 135, 136, 136, 137, 138, 139
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 0, 2, 2, 2, 2, 2, 2, 2,
- 4, 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
+ 4, 4, 1, 2, 1, 1, 2, 1, 0, 1,
+ 4, 1, 1, 1, 1, 5, 1, 1, 1, 2,
+ 1, 1, 6, 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
};
/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
@@ -871,392 +851,395 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 2, 0, 1, 6, 0, 171, 153, 154, 17, 18,
- 28, 19, 20, 160, 0, 0, 0, 148, 5, 84,
- 33, 0, 0, 32, 0, 0, 0, 0, 3, 0,
- 0, 143, 30, 4, 15, 114, 122, 123, 125, 149,
- 157, 173, 150, 0, 0, 168, 0, 172, 0, 88,
- 161, 151, 152, 0, 0, 0, 156, 150, 155, 144,
- 0, 177, 150, 103, 0, 101, 0, 158, 86, 183,
- 7, 8, 37, 34, 86, 9, 0, 85, 118, 0,
- 0, 0, 0, 0, 86, 119, 121, 120, 0, 0,
- 124, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 116, 115, 133, 134, 0, 0, 0,
- 0, 101, 0, 170, 169, 23, 22, 26, 27, 0,
- 0, 24, 0, 132, 0, 0, 0, 175, 176, 174,
- 104, 86, 180, 0, 0, 145, 13, 0, 0, 87,
- 178, 0, 38, 31, 110, 111, 108, 109, 0, 0,
- 112, 160, 130, 131, 127, 128, 129, 126, 141, 142,
- 138, 139, 140, 137, 117, 107, 159, 167, 25, 0,
- 89, 146, 147, 105, 185, 0, 106, 102, 12, 10,
- 36, 0, 54, 0, 0, 0, 86, 0, 0, 0,
- 75, 76, 0, 97, 0, 86, 35, 48, 0, 57,
- 41, 62, 34, 181, 86, 0, 16, 136, 94, 92,
- 0, 0, 135, 0, 97, 59, 0, 0, 0, 0,
- 63, 49, 50, 51, 0, 98, 52, 179, 56, 0,
- 0, 86, 182, 39, 113, 86, 95, 0, 0, 0,
- 162, 0, 0, 0, 0, 171, 64, 0, 53, 0,
- 79, 77, 40, 21, 29, 96, 93, 86, 55, 60,
- 0, 164, 166, 61, 86, 86, 0, 0, 86, 0,
- 80, 58, 0, 163, 165, 0, 0, 0, 0, 0,
- 78, 0, 82, 65, 43, 0, 86, 0, 86, 81,
- 86, 0, 86, 0, 86, 63, 0, 67, 0, 0,
- 66, 0, 44, 45, 63, 0, 83, 70, 73, 0,
- 0, 74, 0, 184, 86, 42, 0, 86, 72, 71,
- 86, 34, 86, 0, 34, 0, 0, 47, 0, 46
+ 2, 0, 1, 6, 0, 174, 156, 157, 21, 22,
+ 0, 23, 24, 163, 0, 0, 0, 151, 5, 87,
+ 36, 0, 0, 35, 0, 0, 0, 0, 3, 0,
+ 0, 146, 33, 4, 19, 117, 125, 126, 128, 152,
+ 160, 176, 153, 0, 0, 171, 0, 175, 27, 26,
+ 30, 31, 0, 0, 28, 91, 164, 154, 155, 0,
+ 0, 0, 159, 153, 158, 147, 0, 180, 153, 106,
+ 0, 104, 0, 0, 161, 89, 186, 7, 8, 40,
+ 37, 89, 9, 0, 88, 121, 0, 0, 0, 0,
+ 0, 89, 122, 124, 123, 0, 0, 127, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 119, 118, 136, 137, 0, 0, 0, 0, 104, 0,
+ 173, 172, 29, 0, 0, 135, 0, 0, 0, 178,
+ 179, 177, 107, 89, 183, 0, 0, 148, 14, 0,
+ 0, 17, 0, 0, 90, 181, 0, 41, 34, 113,
+ 114, 111, 112, 0, 0, 115, 163, 133, 134, 130,
+ 131, 132, 129, 144, 145, 141, 142, 143, 140, 120,
+ 110, 162, 170, 97, 95, 0, 0, 92, 149, 150,
+ 108, 188, 0, 109, 105, 13, 10, 16, 11, 39,
+ 0, 57, 0, 0, 0, 89, 0, 0, 0, 78,
+ 79, 0, 100, 0, 89, 38, 51, 0, 60, 44,
+ 65, 37, 184, 89, 0, 20, 139, 89, 98, 0,
+ 138, 0, 100, 62, 0, 0, 0, 0, 66, 52,
+ 53, 54, 0, 101, 55, 182, 59, 0, 0, 89,
+ 185, 42, 116, 32, 99, 96, 0, 0, 165, 0,
+ 0, 0, 0, 174, 67, 0, 56, 0, 82, 80,
+ 43, 25, 89, 58, 63, 0, 167, 169, 64, 89,
+ 89, 0, 0, 89, 0, 83, 61, 0, 166, 168,
+ 0, 0, 0, 0, 0, 81, 0, 85, 68, 46,
+ 0, 89, 0, 89, 84, 89, 0, 89, 0, 89,
+ 66, 0, 70, 0, 0, 69, 0, 47, 48, 66,
+ 0, 86, 73, 76, 0, 0, 77, 0, 187, 89,
+ 45, 0, 89, 75, 74, 89, 37, 89, 0, 37,
+ 0, 0, 50, 0, 49
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 1, 28, 138, 29, 70, 120, 121, 30, 48,
- 31, 76, 32, 141, 71, 196, 197, 214, 198, 229,
- 240, 247, 291, 300, 312, 199, 250, 271, 281, 200,
- 139, 140, 123, 210, 211, 224, 109, 110, 201, 108,
- 87, 88, 35, 36, 37, 38, 39, 40, 49, 259,
- 260, 261, 45, 46, 47, 41, 42, 129, 202, 203,
- 135, 231, 204, 314, 134
+ -1, 1, 28, 140, 143, 29, 77, 53, 54, 30,
+ 31, 83, 32, 146, 78, 205, 206, 222, 207, 237,
+ 248, 255, 296, 305, 317, 208, 258, 276, 286, 209,
+ 144, 145, 125, 175, 176, 232, 116, 117, 210, 115,
+ 94, 95, 35, 36, 37, 38, 39, 40, 55, 264,
+ 265, 266, 45, 46, 47, 41, 42, 131, 211, 212,
+ 137, 239, 213, 319, 136
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -269
+#define YYPACT_NINF -273
static const yytype_int16 yypact[] =
{
- -269, 335, -269, -269, -31, -24, -269, -269, -269, -269,
- -269, -269, -269, 12, 12, 12, -19, -12, -269, -269,
- -269, 978, 978, -269, 978, 1023, 804, 21, -269, 115,
- -21, -269, -269, 8, 1062, 952, -20, 330, -269, -269,
- -269, -269, 246, 736, 804, -269, 2, -269, 205, 15,
- -269, -269, -269, 736, 736, 70, 52, 80, 52, 52,
- 978, 147, -269, -269, 50, 308, 174, -269, 64, -269,
- -269, -269, 8, -269, 64, -269, 129, -269, -269, 978,
- 143, 978, 978, 978, 64, -269, -269, -269, 978, 112,
- -20, 978, 978, 978, 978, 978, 978, 978, 978, 978,
- 978, 978, 978, -269, -269, -269, -269, 141, 978, 90,
- 152, 1101, 48, -269, -269, -269, -269, -269, -269, 111,
- 105, -269, 978, -269, 90, 90, 308, -269, -269, -269,
- 978, 64, -269, 134, 830, -269, -269, 13, -16, 8,
- -269, 552, -269, -269, 53, -269, 142, 300, 1081, 978,
- 103, 12, 185, 185, 52, 52, 52, 52, 185, 185,
- 52, 52, 52, 52, -269, 1101, -269, -269, -269, 63,
- -20, -269, -269, 1101, -269, 143, -269, 1101, -269, -269,
- -269, 121, -269, 6, 130, 137, 64, 139, -16, -16,
- -269, -269, -16, 978, -16, 64, -269, -269, -16, -269,
- -269, 1101, -269, 127, 64, 978, 1101, -269, -269, -269,
- 90, 118, -269, 978, 978, -269, 180, 978, 978, 665,
- 875, -269, -269, -269, -16, 1101, -269, -269, -269, 598,
- 552, 64, -269, -269, 1101, 64, -269, 28, 308, -16,
- -24, 140, 308, 308, 189, -14, -269, 127, -269, 804,
- 201, -269, -269, -269, -269, -269, -269, 64, -269, -269,
- 14, -269, -269, -269, 64, 64, 158, 143, 64, 50,
- -269, -269, 665, -269, -269, -21, 665, 978, 90, 710,
- 134, 978, 198, -269, -269, 308, 64, 1056, 64, 952,
- 64, 60, 64, 665, 64, 907, 665, -269, 119, 177,
- -269, 155, -269, -269, 907, 90, -269, -269, -269, 224,
- 228, -269, 177, -269, 64, -269, 90, 64, -269, -269,
- 64, -269, 64, 665, -269, 406, 665, -269, 479, -269
+ -273, 376, -273, -273, -27, -21, -273, -273, -273, -273,
+ 157, -273, -273, 11, 11, 11, -5, -3, -273, -273,
+ -273, 1019, 1019, -273, 1019, 1065, 821, 116, -273, -20,
+ 1, -273, -273, 35, 758, 992, 252, 296, -273, -273,
+ -273, -273, 233, 789, 821, -273, 2, -273, -273, -273,
+ -273, -273, 63, 54, -273, 69, -273, -273, -273, 789,
+ 789, 127, 87, 115, 87, 87, 1019, 131, -273, -273,
+ 55, 295, 40, 47, -273, 83, -273, -273, -273, 35,
+ -273, 83, -273, 151, -273, -273, 1019, 132, 1019, 1019,
+ 1019, 83, -273, -273, -273, 1019, 124, 252, 1019, 1019,
+ 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019, 1019,
+ -273, -273, -273, -273, 152, 1019, 100, 16, 1034, 37,
+ -273, -273, -273, 43, 1019, -273, 100, 100, 295, -273,
+ -273, -273, 1019, 83, -273, 137, 867, -273, -273, 75,
+ -19, -273, 77, -19, 35, -273, 596, -273, -273, 123,
+ -273, 141, 175, 1098, 1019, 161, 11, -26, -26, 87,
+ 87, 87, 87, -26, -26, 87, 87, 87, 87, -273,
+ 1034, -273, -273, -273, -273, 100, 65, 252, -273, -273,
+ 1034, -273, 132, -273, 1034, -273, -273, -273, -273, -273,
+ 104, -273, 26, 118, 119, 83, 121, -19, -19, -273,
+ -273, -19, 1019, -19, 83, -273, -273, -19, -273, -273,
+ 1034, -273, 117, 83, 1019, 1034, -273, 83, -273, 112,
+ -273, 1019, 1019, -273, 188, 1019, 1019, 710, 900, -273,
+ -273, -273, -19, 1034, -273, -273, -273, 642, 596, 83,
+ -273, -273, 1034, -273, -273, -273, 295, -19, -21, 126,
+ 295, 295, 169, -13, -273, 117, -273, 821, 186, -273,
+ -273, -273, 83, -273, -273, 13, -273, -273, -273, 83,
+ 83, 139, 132, 83, 55, -273, -273, 710, -273, -273,
+ 1, 710, 1019, 100, 743, 137, 1019, 192, -273, -273,
+ 295, 83, 286, 83, 992, 83, 44, 83, 710, 83,
+ 946, 710, -273, 247, 154, -273, 156, -273, -273, 946,
+ 100, -273, -273, -273, 226, 228, -273, 154, -273, 83,
+ -273, 100, 83, -273, -273, 83, -273, 83, 710, -273,
+ 448, 710, -273, 522, -273
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -269, -269, -269, -269, -269, 208, -269, -269, -269, -269,
- -58, -269, -269, -193, 72, -171, -269, -269, -189, -269,
- -269, -268, -269, -269, -269, -269, -269, -269, -269, -269,
- 45, 37, -269, -269, -269, 38, -48, -23, -1, -269,
- -269, -269, -26, 44, -269, 217, -269, 1, 102, -269,
- -269, -3, -39, -269, -269, -72, -2, -269, -28, -213,
- -49, -269, -25, -47, 66
+ -273, -273, -273, -273, -273, -273, 208, -273, -273, -273,
+ -64, -273, -273, -202, 71, -58, -273, -273, -218, -273,
+ -273, -272, -273, -273, -273, -273, -273, -273, -273, -273,
+ 50, 76, -273, -273, -273, 19, -54, -23, -1, -273,
+ -273, -273, -44, 39, -273, 224, -273, -11, 94, -273,
+ -273, -7, -38, -273, -273, -73, -2, -273, -28, -231,
+ -46, -273, -25, -57, 85
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -101
+#define YYTABLE_NINF -104
static const yytype_int16 yytable[] =
{
- 34, 73, 73, 64, 74, 124, 125, 114, 145, 230,
- 215, 50, 51, 52, 178, 133, 5, 252, 113, 57,
- 57, 112, 57, 62, 4, 65, 267, 305, 67, 255,
- 273, 246, 256, 57, 19, 43, 316, 91, 92, 93,
- 94, 95, 111, 111, 96, 44, 33, 53, 244, 130,
- 68, 130, 111, 111, 54, 44, 67, 69, 77, 126,
- 166, 297, 78, -11, 208, 56, 58, 209, 59, 66,
- 122, 44, 216, 4, 72, 171, 172, 25, 144, 90,
- 146, 147, 148, 44, 298, 299, -11, 150, 315, 57,
- 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
- 57, 282, 131, 212, 131, 284, 246, 165, 85, 86,
- 19, 142, -101, 74, 19, 246, 96, 132, 167, 236,
- 57, 149, 303, 105, 106, 306, 307, 308, 325, 173,
- -90, 328, -86, 177, 143, 152, 153, 154, 155, 156,
- 157, 158, 159, 160, 161, 162, 163, 5, 206, 50,
- 151, 78, 327, 130, 164, 329, 79, 132, -101, -101,
- 168, 235, -100, 74, 74, 19, 170, 74, 174, 74,
- 20, 169, 131, 74, 175, 136, 309, 310, 232, 23,
- 137, 251, 80, 72, 241, -91, 68, 213, 69, 257,
- 127, 128, 225, 264, 265, 278, 217, 85, 86, 74,
- 69, 262, -100, 218, 234, 220, 131, 263, 115, 116,
- 179, 270, 238, 225, 74, 266, 242, 243, 290, -100,
- 280, 262, 268, 219, 277, -100, 269, 195, 111, 286,
- 313, 318, 227, 72, 72, 319, 292, 72, 75, 72,
- 311, 233, 61, 72, 93, 94, 95, 283, 65, 96,
- 117, 118, 239, 207, 288, 289, 317, 274, 103, 104,
- 221, 222, 294, 0, 223, 320, 226, 322, 253, 72,
- 228, 0, 254, 119, 0, 0, 285, 237, 287, 57,
- 0, 0, 0, 0, 72, 0, 0, 57, 0, 105,
- 106, 0, 0, 0, 272, 0, 248, 107, 0, 0,
- 0, 275, 276, 0, 0, 279, 0, 0, 0, 78,
- 0, 258, 0, 0, 79, 0, 0, 78, 0, 0,
- 0, 0, 79, 293, 0, 295, 0, 296, 301, 302,
- 0, 304, 0, 90, 0, 2, 3, 0, 4, 5,
- 80, 81, 6, 7, 0, 0, 0, 0, 80, 81,
- 82, 321, 8, 9, 323, 85, 86, 324, 0, 326,
- 83, 0, 0, 85, 86, 0, 0, 0, 0, 0,
- 10, 11, 12, 13, 0, 132, 0, 0, 14, 15,
- 16, 17, 18, 0, 0, 19, 20, 97, 98, 99,
- 100, 101, 21, 22, 102, 23, 0, 24, 0, 0,
- 25, 26, 0, 27, 0, 0, -14, 180, -14, 4,
+ 34, 80, 80, 70, 81, 126, 127, 260, 121, 238,
+ 254, 56, 57, 58, 150, 5, 74, 132, 120, 63,
+ 63, 119, 63, 68, 135, 71, -103, 272, 310, 278,
+ 223, 19, 19, 63, 100, 101, 102, 321, 132, 103,
+ 43, 138, 118, 118, 173, 302, 139, 174, 141, 44,
+ 74, 33, 75, 142, 76, 76, 132, 44, 118, 118,
+ 62, 64, 59, 65, 60, 128, 218, -103, 303, 304,
+ 171, 133, 44, 75, 97, 320, 185, 25, 187, 79,
+ 178, 179, 254, 44, -103, 149, 84, 151, 152, 153,
+ -103, 254, 133, 224, 155, 19, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 172, 220,
+ 133, -93, 122, 244, 170, 81, 245, -89, 81, 4,
+ 133, 123, 63, 134, 330, 124, -12, 333, -15, 217,
+ 4, 180, 85, -94, 19, 184, 5, 157, 158, 159,
+ 160, 161, 162, 163, 164, 165, 166, 167, 168, -12,
+ 85, -15, 103, 215, 56, 86, 148, 147, 112, 113,
+ 48, 49, 156, 177, 72, 169, 73, 154, 134, 252,
+ -104, 221, 81, 81, 129, 130, 81, 182, 81, 92,
+ 93, 87, 81, 259, 85, 225, 226, 240, 228, 86,
+ 79, 76, 249, 79, 268, 271, 275, 92, 93, 283,
+ 262, 233, 50, 51, 269, 270, 282, 81, 318, 181,
+ 267, 186, 295, 242, 188, 87, 88, -104, -104, 287,
+ 246, 233, 81, 289, 250, 251, 52, 267, 285, 204,
+ 273, 92, 93, 323, 274, 324, 118, 291, 82, 316,
+ 308, 247, 294, 311, 297, 110, 111, 79, 79, 67,
+ 216, 79, 288, 79, 312, 313, 71, 79, 279, 293,
+ 325, 219, 0, 0, 322, 0, 0, 299, 229, 230,
+ 332, 227, 231, 334, 234, 327, 112, 113, 236, 0,
+ 235, 290, 79, 292, 63, 114, 0, 0, 0, 241,
+ 0, 0, 63, 243, 0, 85, 0, 79, 0, 20,
+ 86, 0, 0, 256, 85, 314, 315, 0, 23, 86,
+ 98, 99, 100, 101, 102, 261, 0, 103, 263, 0,
+ 0, 0, 0, 0, 0, 0, 87, 88, 89, 0,
+ 0, 0, 0, 97, 0, 87, 88, 89, 277, 90,
+ 0, 0, 92, 93, 0, 280, 281, 0, 90, 284,
+ 0, 92, 93, 0, 104, 105, 106, 107, 108, 0,
+ 76, 109, 0, 134, 0, 0, 0, 298, 0, 300,
+ 0, 301, 306, 307, 0, 309, 2, 3, 0, 4,
5, 0, 0, 6, 7, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 181, 0, 182, 183, 184,
- -69, -69, 185, 186, 187, 188, 189, 190, 191, 192,
- 193, 0, 0, 0, 13, 194, 0, 0, 0, 14,
- 15, 16, 17, 0, 0, 0, -69, 20, 0, 0,
- 0, 0, 0, 21, 22, 0, 23, 0, 24, 0,
- 0, 25, 26, 0, 55, 0, 0, 68, -69, 69,
- 180, 0, 4, 5, 0, 0, 6, 7, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 181, 0,
- 182, 183, 184, -68, -68, 185, 186, 187, 188, 189,
- 190, 191, 192, 193, 0, 0, 0, 13, 194, 0,
- 0, 0, 14, 15, 16, 17, 0, 0, 0, -68,
+ 0, 0, 0, 8, 9, 326, 0, 0, 328, 0,
+ 0, 329, 0, 331, 0, 0, 0, 0, 0, 0,
+ 0, 10, 11, 12, 13, 0, 0, 0, 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, 189,
+ -18, 4, 5, 0, 0, 6, 7, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 190, 0, 191,
+ 192, 193, -72, -72, 194, 195, 196, 197, 198, 199,
+ 200, 201, 202, 0, 0, 0, 13, 203, 0, 0,
+ 0, 14, 15, 16, 17, 0, 0, 0, 0, -72,
20, 0, 0, 0, 0, 0, 21, 22, 0, 23,
- 0, 24, 0, 0, 25, 26, 0, 55, 0, 0,
- 68, -68, 69, 180, 0, 4, 5, 0, 0, 6,
+ 0, 24, 0, 0, 25, 26, 0, 61, 0, 0,
+ 75, -72, 76, 189, 0, 4, 5, 0, 0, 6,
7, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 181, 0, 182, 183, 184, 0, 0, 185, 186,
- 187, 188, 189, 190, 191, 192, 193, 0, 0, 0,
- 13, 194, 0, 0, 0, 14, 15, 16, 17, 63,
- 0, 4, 5, 20, 0, 6, 7, 0, -99, 21,
- 22, 0, 23, 0, 24, 0, 0, 25, 26, 0,
- 55, 0, 0, 68, 195, 69, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 13, 0, 0, 0,
- 0, 14, 15, 16, 17, 0, 0, 0, -99, 20,
- 0, 0, 0, 0, 0, 21, 22, 0, 23, 0,
- 24, 0, 0, 25, 249, -99, 55, 0, 4, 5,
- 0, -99, 6, 7, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 181, 0, 182, 183, 184, 0,
- 0, 185, 186, 187, 188, 189, 190, 191, 192, 193,
- 0, 0, 0, 13, 194, 0, 0, 0, 14, 15,
- 16, 17, 0, 4, 5, 0, 20, 6, 7, 0,
- 0, 0, 21, 22, 0, 23, 0, 24, 0, 0,
- 25, 26, 0, 55, 0, 0, 68, 63, 69, 4,
- 5, 0, 0, 6, 7, 0, 0, 0, 13, 0,
- 0, 0, 0, 14, 15, 16, 17, 0, 0, 0,
+ 0, 190, 0, 191, 192, 193, -71, -71, 194, 195,
+ 196, 197, 198, 199, 200, 201, 202, 0, 0, 0,
+ 13, 203, 0, 0, 0, 14, 15, 16, 17, 0,
+ 0, 0, 0, -71, 20, 0, 0, 0, 0, 0,
+ 21, 22, 0, 23, 0, 24, 0, 0, 25, 26,
+ 0, 61, 0, 0, 75, -71, 76, 189, 0, 4,
+ 5, 0, 0, 6, 7, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 190, 0, 191, 192, 193,
+ 0, 0, 194, 195, 196, 197, 198, 199, 200, 201,
+ 202, 0, 0, 0, 13, 203, 0, 0, 0, 14,
+ 15, 16, 17, 69, 0, 4, 5, 0, 20, 6,
+ 7, 0, -102, 0, 21, 22, 0, 23, 0, 24,
+ 0, 0, 25, 26, 0, 61, 0, 0, 75, 204,
+ 76, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 13, 0, 0, 0, 0, 14, 15, 16, 17, 0,
+ 0, 0, 0, -102, 20, 0, 0, 0, 0, 0,
+ 21, 22, 0, 23, 0, 24, 0, 0, 25, 257,
+ -102, 61, 0, 4, 5, 0, -102, 6, 7, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 190,
+ 0, 191, 192, 193, 0, 0, 194, 195, 196, 197,
+ 198, 199, 200, 201, 202, 0, 4, 5, 13, 203,
+ 6, 7, 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, 91, 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, 13, 25, 26, 0, 55, 14,
- 15, 16, 17, 69, 0, 0, 0, 20, 0, 0,
- 0, 0, 0, 21, 22, 0, 23, 0, 24, 0,
- 0, 25, 26, -99, 55, 63, 0, 4, 5, 0,
- 0, 6, 7, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 176, 0, 4, 5, 0, 0, 6, 7, 0,
- 0, 0, 13, 0, 0, 0, 0, 14, 15, 16,
- 17, 0, 0, 0, 0, 20, 0, 0, 0, 0,
- 0, 21, 22, 0, 23, 0, 24, 0, 13, 25,
- 26, 0, 55, 14, 15, 16, 17, 0, 4, 245,
- 0, 20, 6, 7, 0, 0, 0, 21, 22, 0,
- 23, 0, 24, 0, 0, 25, 26, 183, 55, 0,
- 0, 0, 0, 0, 0, 0, 190, 191, 0, 0,
- 4, 5, 0, 13, 6, 7, 0, 0, 14, 15,
- 16, 17, 0, 0, 0, 0, 20, 0, 0, 183,
- 0, 0, 21, 22, 0, 23, 0, 24, 190, 191,
- 25, 26, 0, 55, 0, 13, 0, 0, 0, 0,
- 14, 15, 16, 17, 0, 4, 5, 0, 20, 6,
- 7, 0, 0, 89, 21, 22, 0, 23, 0, 24,
- 0, 0, 25, 26, 0, 55, 0, 0, 0, 0,
- 0, 4, 5, 0, 0, 6, 7, 0, 0, 0,
+ 23, 0, 24, 0, 0, 25, 26, -102, 61, 13,
+ 0, 0, 0, 0, 14, 15, 16, 17, 183, 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, 253, 13, 0, 6, 7, 0,
+ 14, 15, 16, 17, 0, 0, 0, 0, 0, 20,
+ 0, 0, 192, 0, 0, 21, 22, 0, 23, 0,
+ 24, 199, 200, 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, 192, 61,
+ 0, 0, 0, 0, 0, 0, 0, 199, 200, 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, 20, 0, 0, 0, 0, 0, 21,
- 22, 0, 23, 0, 24, 0, 13, 25, 26, 0,
- 55, 14, 15, 16, 17, 0, 4, 5, 0, 20,
- 6, 7, 0, 0, 0, 21, 22, 0, 23, 0,
- 24, 0, 0, 25, 26, 0, 55, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 78, 14, 15, 16, 17,
- 79, 78, 0, 0, 20, 0, 79, 0, 0, 0,
- 21, 22, 0, 23, 0, 24, 0, 0, 25, 60,
- 78, 55, 0, 0, 0, 79, 80, 81, 82, 0,
- 0, 0, 80, 81, 82, 0, 0, 0, 83, 0,
- 78, 85, 86, 0, 83, 79, 84, 85, 86, 0,
- 0, 80, 81, 82, 0, 0, 0, 0, 0, 69,
- 0, 0, 0, 83, 205, 0, 85, 86, 0, 0,
- 0, 80, 81, 82, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 83, 0, 0, 85, 86
+ 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, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 85, 14, 15,
+ 16, 17, 86, 0, 0, 0, 0, 20, 0, 0,
+ 0, 0, 0, 21, 22, 0, 23, 0, 24, 0,
+ 0, 25, 66, 0, 61, 0, 0, 0, 87, 88,
+ 89, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 90, 214, 0, 92, 93
};
#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-269)))
+ (!!((Yystate) == (-273)))
#define yytable_value_is_error(Yytable_value) \
- (!!((Yytable_value) == (-101)))
+ (!!((Yytable_value) == (-104)))
static const yytype_int16 yycheck[] =
{
- 1, 29, 30, 26, 29, 53, 54, 46, 80, 202,
- 4, 13, 14, 15, 1, 64, 4, 230, 16, 21,
- 22, 44, 24, 25, 3, 26, 40, 295, 27, 1,
- 16, 220, 4, 35, 50, 66, 304, 57, 58, 59,
- 60, 61, 43, 44, 64, 69, 1, 66, 219, 1,
- 71, 1, 53, 54, 66, 69, 55, 73, 50, 60,
- 109, 1, 9, 50, 1, 21, 22, 4, 24, 48,
- 55, 69, 66, 3, 29, 124, 125, 65, 79, 35,
- 81, 82, 83, 69, 24, 25, 73, 88, 301, 91,
- 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
- 102, 272, 54, 175, 54, 276, 295, 108, 55, 56,
- 50, 74, 9, 138, 50, 304, 64, 67, 70, 1,
- 122, 84, 293, 43, 44, 296, 7, 8, 321, 130,
- 67, 324, 72, 134, 5, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 4, 149, 151,
- 38, 9, 323, 1, 13, 326, 14, 67, 55, 56,
- 49, 210, 10, 188, 189, 50, 122, 192, 131, 194,
- 51, 66, 54, 198, 40, 1, 57, 58, 203, 60,
- 6, 229, 40, 138, 4, 67, 71, 66, 73, 238,
- 43, 44, 193, 242, 243, 267, 66, 55, 56, 224,
- 73, 240, 50, 66, 205, 66, 54, 67, 3, 4,
- 138, 10, 213, 214, 239, 26, 217, 218, 20, 67,
- 269, 260, 247, 186, 66, 73, 249, 72, 229, 278,
- 53, 7, 195, 188, 189, 7, 285, 192, 30, 194,
- 298, 204, 25, 198, 59, 60, 61, 275, 249, 64,
- 45, 46, 214, 151, 279, 281, 305, 260, 12, 13,
- 188, 189, 287, -1, 192, 312, 194, 316, 231, 224,
- 198, -1, 235, 68, -1, -1, 277, 211, 279, 281,
- -1, -1, -1, -1, 239, -1, -1, 289, -1, 43,
- 44, -1, -1, -1, 257, -1, 224, 51, -1, -1,
- -1, 264, 265, -1, -1, 268, -1, -1, -1, 9,
- -1, 239, -1, -1, 14, -1, -1, 9, -1, -1,
- -1, -1, 14, 286, -1, 288, -1, 290, 291, 292,
- -1, 294, -1, 289, -1, 0, 1, -1, 3, 4,
- 40, 41, 7, 8, -1, -1, -1, -1, 40, 41,
- 42, 314, 17, 18, 317, 55, 56, 320, -1, 322,
- 52, -1, -1, 55, 56, -1, -1, -1, -1, -1,
- 35, 36, 37, 38, -1, 67, -1, -1, 43, 44,
- 45, 46, 47, -1, -1, 50, 51, 57, 58, 59,
- 60, 61, 57, 58, 64, 60, -1, 62, -1, -1,
- 65, 66, -1, 68, -1, -1, 71, 1, 73, 3,
+ 1, 29, 30, 26, 29, 59, 60, 238, 46, 211,
+ 228, 13, 14, 15, 87, 4, 27, 1, 16, 21,
+ 22, 44, 24, 25, 70, 26, 10, 40, 300, 16,
+ 4, 51, 51, 35, 60, 61, 62, 309, 1, 65,
+ 67, 1, 43, 44, 1, 1, 6, 4, 1, 70,
+ 61, 1, 72, 6, 74, 74, 1, 70, 59, 60,
+ 21, 22, 67, 24, 67, 66, 1, 51, 24, 25,
+ 116, 55, 70, 72, 35, 306, 1, 66, 1, 29,
+ 126, 127, 300, 70, 68, 86, 51, 88, 89, 90,
+ 74, 309, 55, 67, 95, 51, 98, 99, 100, 101,
+ 102, 103, 104, 105, 106, 107, 108, 109, 71, 182,
+ 55, 68, 49, 1, 115, 140, 4, 73, 143, 3,
+ 55, 67, 124, 68, 326, 56, 51, 329, 51, 175,
+ 3, 132, 9, 68, 51, 136, 4, 98, 99, 100,
+ 101, 102, 103, 104, 105, 106, 107, 108, 109, 74,
+ 9, 74, 65, 154, 156, 14, 5, 81, 43, 44,
+ 3, 4, 38, 124, 48, 13, 50, 91, 68, 227,
+ 9, 67, 197, 198, 43, 44, 201, 40, 203, 56,
+ 57, 40, 207, 237, 9, 67, 67, 212, 67, 14,
+ 140, 74, 4, 143, 68, 26, 10, 56, 57, 272,
+ 246, 202, 45, 46, 250, 251, 67, 232, 54, 133,
+ 248, 140, 20, 214, 143, 40, 41, 56, 57, 277,
+ 221, 222, 247, 281, 225, 226, 69, 265, 274, 73,
+ 255, 56, 57, 7, 257, 7, 237, 283, 30, 303,
+ 298, 222, 286, 301, 290, 12, 13, 197, 198, 25,
+ 156, 201, 280, 203, 7, 8, 257, 207, 265, 284,
+ 317, 176, -1, -1, 310, -1, -1, 292, 197, 198,
+ 328, 195, 201, 331, 203, 321, 43, 44, 207, -1,
+ 204, 282, 232, 284, 286, 52, -1, -1, -1, 213,
+ -1, -1, 294, 217, -1, 9, -1, 247, -1, 52,
+ 14, -1, -1, 232, 9, 58, 59, -1, 61, 14,
+ 58, 59, 60, 61, 62, 239, -1, 65, 247, -1,
+ -1, -1, -1, -1, -1, -1, 40, 41, 42, -1,
+ -1, -1, -1, 294, -1, 40, 41, 42, 262, 53,
+ -1, -1, 56, 57, -1, 269, 270, -1, 53, 273,
+ -1, 56, 57, -1, 58, 59, 60, 61, 62, -1,
+ 74, 65, -1, 68, -1, -1, -1, 291, -1, 293,
+ -1, 295, 296, 297, -1, 299, 0, 1, -1, 3,
4, -1, -1, 7, 8, -1, -1, -1, -1, -1,
- -1, -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, 50, 51, -1, -1,
- -1, -1, -1, 57, 58, -1, 60, -1, 62, -1,
- -1, 65, 66, -1, 68, -1, -1, 71, 72, 73,
- 1, -1, 3, 4, -1, -1, 7, 8, -1, -1,
- -1, -1, -1, -1, -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, 50,
- 51, -1, -1, -1, -1, -1, 57, 58, -1, 60,
- -1, 62, -1, -1, 65, 66, -1, 68, -1, -1,
- 71, 72, 73, 1, -1, 3, 4, -1, -1, 7,
+ -1, -1, -1, 17, 18, 319, -1, -1, 322, -1,
+ -1, 325, -1, 327, -1, -1, -1, -1, -1, -1,
+ -1, 35, 36, 37, 38, -1, -1, -1, -1, 43,
+ 44, 45, 46, 47, -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, 1,
+ 74, 3, 4, -1, -1, 7, 8, -1, -1, -1,
+ -1, -1, -1, -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, -1, -1, -1, -1, -1, 58, 59, -1, 61,
+ -1, 63, -1, -1, 66, 67, -1, 69, -1, -1,
+ 72, 73, 74, 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,
+ -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, 3, 4, 51, -1, 7, 8, -1, 10, 57,
- 58, -1, 60, -1, 62, -1, -1, 65, 66, -1,
- 68, -1, -1, 71, 72, 73, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 38, -1, -1, -1,
- -1, 43, 44, 45, 46, -1, -1, -1, 50, 51,
- -1, -1, -1, -1, -1, 57, 58, -1, 60, -1,
- 62, -1, -1, 65, 66, 67, 68, -1, 3, 4,
- -1, 73, 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, 3, 4, -1, 51, 7, 8, -1,
- -1, -1, 57, 58, -1, 60, -1, 62, -1, -1,
- 65, 66, -1, 68, -1, -1, 71, 1, 73, 3,
- 4, -1, -1, 7, 8, -1, -1, -1, 38, -1,
- -1, -1, -1, 43, 44, 45, 46, -1, -1, -1,
- -1, 51, -1, -1, -1, -1, -1, 57, 58, -1,
- 60, -1, 62, -1, 38, 65, 66, -1, 68, 43,
- 44, 45, 46, 73, -1, -1, -1, 51, -1, -1,
- -1, -1, -1, 57, 58, -1, 60, -1, 62, -1,
- -1, 65, 66, 67, 68, 1, -1, 3, 4, -1,
- -1, 7, 8, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 1, -1, 3, 4, -1, -1, 7, 8, -1,
- -1, -1, 38, -1, -1, -1, -1, 43, 44, 45,
- 46, -1, -1, -1, -1, 51, -1, -1, -1, -1,
- -1, 57, 58, -1, 60, -1, 62, -1, 38, 65,
- 66, -1, 68, 43, 44, 45, 46, -1, 3, 4,
- -1, 51, 7, 8, -1, -1, -1, 57, 58, -1,
- 60, -1, 62, -1, -1, 65, 66, 22, 68, -1,
- -1, -1, -1, -1, -1, -1, 31, 32, -1, -1,
- 3, 4, -1, 38, 7, 8, -1, -1, 43, 44,
- 45, 46, -1, -1, -1, -1, 51, -1, -1, 22,
- -1, -1, 57, 58, -1, 60, -1, 62, 31, 32,
- 65, 66, -1, 68, -1, 38, -1, -1, -1, -1,
- 43, 44, 45, 46, -1, 3, 4, -1, 51, 7,
- 8, -1, -1, 11, 57, 58, -1, 60, -1, 62,
- -1, -1, 65, 66, -1, 68, -1, -1, -1, -1,
- -1, 3, 4, -1, -1, 7, 8, -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, 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, 55, 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, 51, -1, -1, -1, -1, -1, 57,
- 58, -1, 60, -1, 62, -1, 38, 65, 66, -1,
- 68, 43, 44, 45, 46, -1, 3, 4, -1, 51,
- 7, 8, -1, -1, -1, 57, 58, -1, 60, -1,
- 62, -1, -1, 65, 66, -1, 68, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 9, 43, 44, 45, 46,
- 14, 9, -1, -1, 51, -1, 14, -1, -1, -1,
- 57, 58, -1, 60, -1, 62, -1, -1, 65, 66,
- 9, 68, -1, -1, -1, 14, 40, 41, 42, -1,
- -1, -1, 40, 41, 42, -1, -1, -1, 52, -1,
- 9, 55, 56, -1, 52, 14, 54, 55, 56, -1,
- -1, 40, 41, 42, -1, -1, -1, -1, -1, 73,
- -1, -1, -1, 52, 53, -1, 55, 56, -1, -1,
- -1, 40, 41, 42, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 52, -1, -1, 55, 56
+ -1, -1, -1, 9, 52, -1, -1, -1, 14, -1,
+ 58, 59, -1, 61, -1, 63, -1, 38, 66, 67,
+ -1, 69, 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, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 9, 43, 44,
+ 45, 46, 14, -1, -1, -1, -1, 52, -1, -1,
+ -1, -1, -1, 58, 59, -1, 61, -1, 63, -1,
+ -1, 66, 67, -1, 69, -1, -1, -1, 40, 41,
+ 42, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 53, 54, -1, 56, 57
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 75, 0, 1, 3, 4, 7, 8, 17, 18,
- 35, 36, 37, 38, 43, 44, 45, 46, 47, 50,
- 51, 57, 58, 60, 62, 65, 66, 68, 76, 78,
- 82, 84, 86, 104, 112, 116, 117, 118, 119, 120,
- 121, 129, 130, 66, 69, 126, 127, 128, 83, 122,
- 130, 130, 130, 66, 66, 68, 117, 130, 117, 117,
- 66, 119, 130, 1, 111, 112, 48, 121, 71, 73,
- 79, 88, 104, 132, 136, 79, 85, 50, 9, 14,
- 40, 41, 42, 52, 54, 55, 56, 114, 115, 11,
- 117, 57, 58, 59, 60, 61, 64, 57, 58, 59,
- 60, 61, 64, 12, 13, 43, 44, 51, 113, 110,
- 111, 112, 111, 16, 126, 3, 4, 45, 46, 68,
- 80, 81, 55, 106, 110, 110, 112, 43, 44, 131,
- 1, 54, 67, 134, 138, 134, 1, 6, 77, 104,
- 105, 87, 105, 5, 112, 129, 112, 112, 112, 105,
- 112, 38, 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 13, 112, 134, 70, 49, 66,
- 117, 134, 134, 112, 105, 40, 1, 112, 1, 88,
- 1, 19, 21, 22, 23, 26, 27, 28, 29, 30,
- 31, 32, 33, 34, 39, 72, 89, 90, 92, 99,
- 103, 112, 132, 133, 136, 53, 112, 122, 1, 4,
- 107, 108, 129, 66, 91, 4, 66, 66, 66, 105,
- 66, 88, 88, 88, 109, 112, 88, 105, 88, 93,
- 87, 135, 136, 105, 112, 134, 1, 138, 112, 109,
- 94, 4, 112, 112, 89, 4, 92, 95, 88, 66,
- 100, 110, 133, 105, 105, 1, 4, 134, 88, 123,
- 124, 125, 126, 67, 134, 134, 26, 40, 136, 111,
- 10, 101, 105, 16, 125, 105, 105, 66, 129, 105,
- 134, 102, 89, 132, 89, 112, 134, 112, 136, 116,
- 20, 96, 134, 105, 136, 105, 105, 1, 24, 25,
- 97, 105, 105, 89, 105, 95, 89, 7, 8, 57,
- 58, 84, 98, 53, 137, 133, 95, 134, 7, 7,
- 137, 105, 134, 105, 105, 87, 105, 89, 87, 89
+ 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, 85, 87, 105, 113, 117, 118, 119, 120, 121,
+ 122, 130, 131, 67, 70, 127, 128, 129, 3, 4,
+ 45, 46, 69, 82, 83, 123, 131, 131, 131, 67,
+ 67, 69, 118, 131, 118, 118, 67, 120, 131, 1,
+ 112, 113, 48, 50, 122, 72, 74, 81, 89, 105,
+ 133, 137, 81, 86, 51, 9, 14, 40, 41, 42,
+ 53, 55, 56, 57, 115, 116, 11, 118, 58, 59,
+ 60, 61, 62, 65, 58, 59, 60, 61, 62, 65,
+ 12, 13, 43, 44, 52, 114, 111, 112, 113, 112,
+ 16, 127, 49, 67, 56, 107, 111, 111, 113, 43,
+ 44, 132, 1, 55, 68, 135, 139, 135, 1, 6,
+ 78, 1, 6, 79, 105, 106, 88, 106, 5, 113,
+ 130, 113, 113, 113, 106, 113, 38, 118, 118, 118,
+ 118, 118, 118, 118, 118, 118, 118, 118, 118, 13,
+ 113, 135, 71, 1, 4, 108, 109, 118, 135, 135,
+ 113, 106, 40, 1, 113, 1, 89, 1, 89, 1,
+ 19, 21, 22, 23, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 39, 73, 90, 91, 93, 100, 104,
+ 113, 133, 134, 137, 54, 113, 123, 135, 1, 139,
+ 130, 67, 92, 4, 67, 67, 67, 106, 67, 89,
+ 89, 89, 110, 113, 89, 106, 89, 94, 88, 136,
+ 137, 106, 113, 106, 1, 4, 113, 110, 95, 4,
+ 113, 113, 90, 4, 93, 96, 89, 67, 101, 111,
+ 134, 106, 135, 89, 124, 125, 126, 127, 68, 135,
+ 135, 26, 40, 137, 112, 10, 102, 106, 16, 126,
+ 106, 106, 67, 130, 106, 135, 103, 90, 133, 90,
+ 113, 135, 113, 137, 117, 20, 97, 135, 106, 137,
+ 106, 106, 1, 24, 25, 98, 106, 106, 90, 106,
+ 96, 90, 7, 8, 58, 59, 85, 99, 54, 138,
+ 134, 96, 135, 7, 7, 138, 106, 135, 106, 106,
+ 88, 106, 90, 88, 90
};
#define yyerrok (yyerrstatus = 0)
@@ -2046,7 +2029,7 @@ yyreduce:
{
case 3:
/* Line 1778 of yacc.c */
-#line 221 "awkgram.y"
+#line 198 "awkgram.y"
{
rule = 0;
yyerrok;
@@ -2055,15 +2038,17 @@ yyreduce:
case 5:
/* Line 1778 of yacc.c */
-#line 227 "awkgram.y"
+#line 204 "awkgram.y"
{
next_sourcefile();
+ if (sourcefile == srcfiles)
+ process_deferred();
}
break;
case 6:
/* Line 1778 of yacc.c */
-#line 231 "awkgram.y"
+#line 210 "awkgram.y"
{
rule = 0;
/*
@@ -2076,7 +2061,7 @@ yyreduce:
case 7:
/* Line 1778 of yacc.c */
-#line 243 "awkgram.y"
+#line 222 "awkgram.y"
{
(void) append_rule((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
}
@@ -2084,7 +2069,7 @@ yyreduce:
case 8:
/* Line 1778 of yacc.c */
-#line 247 "awkgram.y"
+#line 226 "awkgram.y"
{
if (rule != Rule) {
msg(_("%s blocks must have an action part"), ruletab[rule]);
@@ -2099,28 +2084,35 @@ yyreduce:
case 9:
/* Line 1778 of yacc.c */
-#line 258 "awkgram.y"
+#line 237 "awkgram.y"
{
- can_return = FALSE;
- if ((yyvsp[(1) - (2)]) && func_install((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)])) < 0)
- YYABORT;
- func_params = NULL;
+ in_function = NULL;
+ (void) mk_function((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
yyerrok;
}
break;
case 10:
/* Line 1778 of yacc.c */
-#line 266 "awkgram.y"
+#line 243 "awkgram.y"
{
- want_source = FALSE;
+ want_source = false;
yyerrok;
}
break;
case 11:
/* Line 1778 of yacc.c */
-#line 274 "awkgram.y"
+#line 248 "awkgram.y"
+ {
+ want_source = false;
+ yyerrok;
+ }
+ break;
+
+ case 12:
+/* Line 1778 of yacc.c */
+#line 256 "awkgram.y"
{
if (include_source((yyvsp[(1) - (1)])) < 0)
YYABORT;
@@ -2130,33 +2122,57 @@ yyreduce:
}
break;
- case 12:
+ case 13:
/* Line 1778 of yacc.c */
-#line 282 "awkgram.y"
+#line 264 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 13:
+ case 14:
/* Line 1778 of yacc.c */
-#line 284 "awkgram.y"
+#line 266 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 14:
+ case 15:
/* Line 1778 of yacc.c */
-#line 289 "awkgram.y"
+#line 271 "awkgram.y"
+ {
+ if (load_library((yyvsp[(1) - (1)])) < 0)
+ YYABORT;
+ efree((yyvsp[(1) - (1)])->lextok);
+ bcfree((yyvsp[(1) - (1)]));
+ (yyval) = NULL;
+ }
+ break;
+
+ case 16:
+/* Line 1778 of yacc.c */
+#line 279 "awkgram.y"
+ { (yyval) = NULL; }
+ break;
+
+ case 17:
+/* Line 1778 of yacc.c */
+#line 281 "awkgram.y"
+ { (yyval) = NULL; }
+ break;
+
+ case 18:
+/* Line 1778 of yacc.c */
+#line 286 "awkgram.y"
{ (yyval) = NULL; rule = Rule; }
break;
- case 15:
+ case 19:
/* Line 1778 of yacc.c */
-#line 291 "awkgram.y"
+#line 288 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); rule = Rule; }
break;
- case 16:
+ case 20:
/* Line 1778 of yacc.c */
-#line 293 "awkgram.y"
+#line 290 "awkgram.y"
{
INSTRUCTION *tp;
@@ -2164,8 +2180,8 @@ yyreduce:
add_lint((yyvsp[(4) - (4)]), LINT_assign_in_cond);
tp = instruction(Op_no_op);
- list_prepend((yyvsp[(1) - (4)]), bcalloc(Op_line_range, !!do_profiling + 1, 0));
- (yyvsp[(1) - (4)])->nexti->triggered = FALSE;
+ list_prepend((yyvsp[(1) - (4)]), bcalloc(Op_line_range, !!do_pretty_print + 1, 0));
+ (yyvsp[(1) - (4)])->nexti->triggered = false;
(yyvsp[(1) - (4)])->nexti->target_jmp = (yyvsp[(4) - (4)])->nexti;
list_append((yyvsp[(1) - (4)]), instruction(Op_cond_pair));
@@ -2175,7 +2191,7 @@ yyreduce:
list_append((yyvsp[(4) - (4)]), instruction(Op_cond_pair));
(yyvsp[(4) - (4)])->lasti->line_range = (yyvsp[(1) - (4)])->nexti;
(yyvsp[(4) - (4)])->lasti->target_jmp = tp;
- if (do_profiling) {
+ if (do_pretty_print) {
((yyvsp[(1) - (4)])->nexti + 1)->condpair_left = (yyvsp[(1) - (4)])->lasti;
((yyvsp[(1) - (4)])->nexti + 1)->condpair_right = (yyvsp[(4) - (4)])->lasti;
}
@@ -2184,9 +2200,9 @@ yyreduce:
}
break;
- case 17:
+ case 21:
/* Line 1778 of yacc.c */
-#line 319 "awkgram.y"
+#line 316 "awkgram.y"
{
static int begin_seen = 0;
if (do_lint_old && ++begin_seen == 2)
@@ -2199,9 +2215,9 @@ yyreduce:
}
break;
- case 18:
+ case 22:
/* Line 1778 of yacc.c */
-#line 330 "awkgram.y"
+#line 327 "awkgram.y"
{
static int end_seen = 0;
if (do_lint_old && ++end_seen == 2)
@@ -2214,9 +2230,9 @@ yyreduce:
}
break;
- case 19:
+ case 23:
/* Line 1778 of yacc.c */
-#line 341 "awkgram.y"
+#line 338 "awkgram.y"
{
(yyvsp[(1) - (1)])->in_rule = rule = BEGINFILE;
(yyvsp[(1) - (1)])->source_file = source;
@@ -2224,9 +2240,9 @@ yyreduce:
}
break;
- case 20:
+ case 24:
/* Line 1778 of yacc.c */
-#line 347 "awkgram.y"
+#line 344 "awkgram.y"
{
(yyvsp[(1) - (1)])->in_rule = rule = ENDFILE;
(yyvsp[(1) - (1)])->source_file = source;
@@ -2234,9 +2250,9 @@ yyreduce:
}
break;
- case 21:
+ case 25:
/* Line 1778 of yacc.c */
-#line 356 "awkgram.y"
+#line 353 "awkgram.y"
{
if ((yyvsp[(2) - (5)]) == NULL)
(yyval) = list_create(instruction(Op_no_op));
@@ -2245,90 +2261,71 @@ yyreduce:
}
break;
- case 22:
+ case 26:
/* Line 1778 of yacc.c */
-#line 366 "awkgram.y"
+#line 363 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 23:
+ case 27:
/* Line 1778 of yacc.c */
-#line 368 "awkgram.y"
+#line 365 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 24:
+ case 28:
/* Line 1778 of yacc.c */
-#line 370 "awkgram.y"
+#line 367 "awkgram.y"
{
yyerror(_("`%s' is a built-in function, it cannot be redefined"),
- tokstart);
- (yyvsp[(1) - (1)])->opcode = Op_symbol; /* Op_symbol instead of Op_token so that
- * free_bc_internal does not try to free it
- */
- (yyvsp[(1) - (1)])->lextok = builtin_func;
- (yyval) = (yyvsp[(1) - (1)]);
- /* yyerrok; */
+ tokstart);
+ YYABORT;
}
break;
- case 25:
+ case 29:
/* Line 1778 of yacc.c */
-#line 381 "awkgram.y"
+#line 373 "awkgram.y"
{ (yyval) = (yyvsp[(2) - (2)]); }
break;
- case 28:
+ case 32:
/* Line 1778 of yacc.c */
-#line 391 "awkgram.y"
+#line 383 "awkgram.y"
{
- param_counter = 0;
- func_params = NULL;
+ (yyvsp[(1) - (6)])->source_file = source;
+ if (install_function((yyvsp[(2) - (6)])->lextok, (yyvsp[(1) - (6)]), (yyvsp[(4) - (6)])) < 0)
+ YYABORT;
+ in_function = (yyvsp[(2) - (6)])->lextok;
+ (yyvsp[(2) - (6)])->lextok = NULL;
+ bcfree((yyvsp[(2) - (6)]));
+ /* $4 already free'd in install_function */
+ (yyval) = (yyvsp[(1) - (6)]);
}
break;
- case 29:
-/* Line 1778 of yacc.c */
-#line 396 "awkgram.y"
- {
- NODE *t;
-
- (yyvsp[(1) - (7)])->source_file = source;
- t = make_param((yyvsp[(3) - (7)])->lextok);
- (yyvsp[(3) - (7)])->lextok = NULL;
- bcfree((yyvsp[(3) - (7)]));
- t->flags |= FUNC;
- t->rnode = func_params;
- func_params = t;
- (yyval) = (yyvsp[(1) - (7)]);
- can_return = TRUE;
- /* check for duplicate parameter names */
- if (dup_parms((yyvsp[(1) - (7)]), t))
- errcount++;
- }
- break;
-
- case 30:
+ case 33:
/* Line 1778 of yacc.c */
-#line 420 "awkgram.y"
- { ++want_regexp; }
+#line 401 "awkgram.y"
+ { want_regexp = true; }
break;
- case 31:
+ case 34:
/* Line 1778 of yacc.c */
-#line 422 "awkgram.y"
+#line 403 "awkgram.y"
{
NODE *n, *exp;
char *re;
size_t len;
re = (yyvsp[(3) - (3)])->lextok;
+ (yyvsp[(3) - (3)])->lextok = NULL;
len = strlen(re);
if (do_lint) {
if (len == 0)
lintwarn_ln((yyvsp[(3) - (3)])->source_line,
_("regexp constant `//' looks like a C++ comment, but is not"));
- else if ((re)[0] == '*' && (re)[len-1] == '*')
+ else if (re[0] == '*' && re[len-1] == '*')
/* possible C comment */
lintwarn_ln((yyvsp[(3) - (3)])->source_line,
_("regexp constant `/%s/' looks like a C comment, but is not"), re);
@@ -2346,21 +2343,21 @@ yyreduce:
}
break;
- case 32:
+ case 35:
/* Line 1778 of yacc.c */
-#line 453 "awkgram.y"
+#line 435 "awkgram.y"
{ bcfree((yyvsp[(1) - (1)])); }
break;
- case 34:
+ case 37:
/* Line 1778 of yacc.c */
-#line 459 "awkgram.y"
+#line 441 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 35:
+ case 38:
/* Line 1778 of yacc.c */
-#line 461 "awkgram.y"
+#line 443 "awkgram.y"
{
if ((yyvsp[(2) - (2)]) == NULL)
(yyval) = (yyvsp[(1) - (2)]);
@@ -2375,38 +2372,38 @@ yyreduce:
}
break;
- case 36:
+ case 39:
/* Line 1778 of yacc.c */
-#line 474 "awkgram.y"
+#line 456 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 39:
+ case 42:
/* Line 1778 of yacc.c */
-#line 484 "awkgram.y"
+#line 466 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 40:
+ case 43:
/* Line 1778 of yacc.c */
-#line 486 "awkgram.y"
+#line 468 "awkgram.y"
{ (yyval) = (yyvsp[(2) - (3)]); }
break;
- case 41:
+ case 44:
/* Line 1778 of yacc.c */
-#line 488 "awkgram.y"
+#line 470 "awkgram.y"
{
- if (do_profiling)
+ if (do_pretty_print)
(yyval) = list_prepend((yyvsp[(1) - (1)]), instruction(Op_exec_count));
else
(yyval) = (yyvsp[(1) - (1)]);
}
break;
- case 42:
+ case 45:
/* Line 1778 of yacc.c */
-#line 495 "awkgram.y"
+#line 477 "awkgram.y"
{
INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
INSTRUCTION *ip, *nextc, *tbreak;
@@ -2452,7 +2449,7 @@ yyreduce:
case_values[case_count++] = caseval;
} else {
/* match a constant regex against switch expression. */
- (curr + 1)->match_exp = TRUE;
+ (curr + 1)->match_exp = true;
}
curr->stmt_start = casestmt->nexti;
curr->stmt_end = casestmt->lasti;
@@ -2465,7 +2462,7 @@ yyreduce:
else
dflt->target_jmp = casestmt->nexti;
- if (do_profiling) {
+ if (do_pretty_print) {
curr->stmt_start = casestmt->nexti;
curr->stmt_end = casestmt->lasti;
(void) list_prepend(cexp, curr);
@@ -2480,7 +2477,7 @@ yyreduce:
efree(case_values);
ip = (yyvsp[(3) - (9)]);
- if (do_profiling) {
+ if (do_pretty_print) {
(void) list_prepend(ip, (yyvsp[(1) - (9)]));
(void) list_prepend(ip, instruction(Op_exec_count));
(yyvsp[(1) - (9)])->target_break = tbreak;
@@ -2498,9 +2495,9 @@ yyreduce:
}
break;
- case 43:
+ case 46:
/* Line 1778 of yacc.c */
-#line 585 "awkgram.y"
+#line 567 "awkgram.y"
{
/*
* -----------------
@@ -2523,7 +2520,7 @@ yyreduce:
ip = list_append((yyvsp[(3) - (6)]), instruction(Op_jmp_false));
ip->lasti->target_jmp = tbreak;
- if (do_profiling) {
+ if (do_pretty_print) {
(void) list_append(ip, instruction(Op_exec_count));
(yyvsp[(1) - (6)])->target_break = tbreak;
(yyvsp[(1) - (6)])->target_continue = tcont;
@@ -2544,9 +2541,9 @@ yyreduce:
}
break;
- case 44:
+ case 47:
/* Line 1778 of yacc.c */
-#line 627 "awkgram.y"
+#line 609 "awkgram.y"
{
/*
* -----------------
@@ -2569,7 +2566,7 @@ yyreduce:
ip = list_merge((yyvsp[(3) - (8)]), (yyvsp[(6) - (8)]));
else
ip = list_prepend((yyvsp[(6) - (8)]), instruction(Op_no_op));
- if (do_profiling)
+ if (do_pretty_print)
(void) list_prepend(ip, instruction(Op_exec_count));
(void) list_append(ip, instruction(Op_jmp_true));
ip->lasti->target_jmp = ip->nexti;
@@ -2579,7 +2576,7 @@ yyreduce:
continue_allowed--;
fix_break_continue(ip, tbreak, tcont);
- if (do_profiling) {
+ if (do_pretty_print) {
(yyvsp[(1) - (8)])->target_break = tbreak;
(yyvsp[(1) - (8)])->target_continue = tcont;
((yyvsp[(1) - (8)]) + 1)->doloop_cond = tcont;
@@ -2590,9 +2587,9 @@ yyreduce:
}
break;
- case 45:
+ case 48:
/* Line 1778 of yacc.c */
-#line 669 "awkgram.y"
+#line 651 "awkgram.y"
{
INSTRUCTION *ip;
char *var_name = (yyvsp[(3) - (8)])->lextok;
@@ -2643,30 +2640,30 @@ yyreduce:
} else {
INSTRUCTION *tbreak, *tcont;
- /* [ Op_push_array a ]
- * [ Op_arrayfor_init | ib ]
- * ic:[ Op_arrayfor_incr | ib ]
- * [ Op_var_assign if any ]
- *
- * body
- *
- * [Op_jmp | ic ]
- * ib:[Op_arrayfor_final ]
- */
+ /* [ Op_push_array a ]
+ * [ Op_arrayfor_init | ib ]
+ * ic:[ Op_arrayfor_incr | ib ]
+ * [ Op_var_assign if any ]
+ *
+ * body
+ *
+ * [Op_jmp | ic ]
+ * ib:[Op_arrayfor_final ]
+ */
regular_loop:
ip = (yyvsp[(5) - (8)]);
ip->nexti->opcode = Op_push_array;
tbreak = instruction(Op_arrayfor_final);
(yyvsp[(4) - (8)])->opcode = Op_arrayfor_incr;
- (yyvsp[(4) - (8)])->array_var = variable(var_name, Node_var);
+ (yyvsp[(4) - (8)])->array_var = variable((yyvsp[(3) - (8)])->source_line, var_name, Node_var);
(yyvsp[(4) - (8)])->target_jmp = tbreak;
tcont = (yyvsp[(4) - (8)]);
(yyvsp[(3) - (8)])->opcode = Op_arrayfor_init;
(yyvsp[(3) - (8)])->target_jmp = tbreak;
(void) list_append(ip, (yyvsp[(3) - (8)]));
- if (do_profiling) {
+ if (do_pretty_print) {
(yyvsp[(1) - (8)])->opcode = Op_K_arrayfor;
(yyvsp[(1) - (8)])->target_continue = tcont;
(yyvsp[(1) - (8)])->target_break = tbreak;
@@ -2687,7 +2684,7 @@ regular_loop:
ip->lasti->assign_var = (yyvsp[(4) - (8)])->array_var->var_assign;
}
- if (do_profiling) {
+ if (do_pretty_print) {
(void) list_append(ip, instruction(Op_exec_count));
((yyvsp[(1) - (8)]) + 1)->forloop_cond = (yyvsp[(4) - (8)]);
((yyvsp[(1) - (8)]) + 1)->forloop_body = ip->lasti;
@@ -2707,9 +2704,9 @@ regular_loop:
}
break;
- case 46:
+ case 49:
/* Line 1778 of yacc.c */
-#line 782 "awkgram.y"
+#line 764 "awkgram.y"
{
(yyval) = mk_for_loop((yyvsp[(1) - (12)]), (yyvsp[(3) - (12)]), (yyvsp[(6) - (12)]), (yyvsp[(9) - (12)]), (yyvsp[(12) - (12)]));
@@ -2718,9 +2715,9 @@ regular_loop:
}
break;
- case 47:
+ case 50:
/* Line 1778 of yacc.c */
-#line 789 "awkgram.y"
+#line 771 "awkgram.y"
{
(yyval) = mk_for_loop((yyvsp[(1) - (11)]), (yyvsp[(3) - (11)]), (INSTRUCTION *) NULL, (yyvsp[(8) - (11)]), (yyvsp[(11) - (11)]));
@@ -2729,20 +2726,20 @@ regular_loop:
}
break;
- case 48:
+ case 51:
/* Line 1778 of yacc.c */
-#line 796 "awkgram.y"
+#line 778 "awkgram.y"
{
- if (do_profiling)
+ if (do_pretty_print)
(yyval) = list_prepend((yyvsp[(1) - (1)]), instruction(Op_exec_count));
else
(yyval) = (yyvsp[(1) - (1)]);
}
break;
- case 49:
+ case 52:
/* Line 1778 of yacc.c */
-#line 806 "awkgram.y"
+#line 788 "awkgram.y"
{
if (! break_allowed)
error_ln((yyvsp[(1) - (2)])->source_line,
@@ -2753,9 +2750,9 @@ regular_loop:
}
break;
- case 50:
+ case 53:
/* Line 1778 of yacc.c */
-#line 815 "awkgram.y"
+#line 797 "awkgram.y"
{
if (! continue_allowed)
error_ln((yyvsp[(1) - (2)])->source_line,
@@ -2766,9 +2763,9 @@ regular_loop:
}
break;
- case 51:
+ case 54:
/* Line 1778 of yacc.c */
-#line 824 "awkgram.y"
+#line 806 "awkgram.y"
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule && rule != Rule)
@@ -2779,9 +2776,9 @@ regular_loop:
}
break;
- case 52:
+ case 55:
/* Line 1778 of yacc.c */
-#line 833 "awkgram.y"
+#line 815 "awkgram.y"
{
/* if inside function (rule = 0), resolve context at run-time */
if (rule == BEGIN || rule == END || rule == ENDFILE)
@@ -2794,9 +2791,9 @@ regular_loop:
}
break;
- case 53:
+ case 56:
/* Line 1778 of yacc.c */
-#line 844 "awkgram.y"
+#line 826 "awkgram.y"
{
/* Initialize the two possible jump targets, the actual target
* is resolved at run-time.
@@ -2807,43 +2804,55 @@ regular_loop:
if ((yyvsp[(2) - (3)]) == NULL) {
(yyval) = list_create((yyvsp[(1) - (3)]));
(void) list_prepend((yyval), instruction(Op_push_i));
- (yyval)->nexti->memory = Nnull_string;
+ (yyval)->nexti->memory = dupnode(Nnull_string);
} else
(yyval) = list_append((yyvsp[(2) - (3)]), (yyvsp[(1) - (3)]));
}
break;
- case 54:
+ case 57:
/* Line 1778 of yacc.c */
-#line 859 "awkgram.y"
+#line 841 "awkgram.y"
{
- if (! can_return)
+ if (! in_function)
yyerror(_("`return' used outside function context"));
}
break;
- case 55:
+ case 58:
/* Line 1778 of yacc.c */
-#line 862 "awkgram.y"
+#line 844 "awkgram.y"
{
if ((yyvsp[(3) - (4)]) == NULL) {
(yyval) = list_create((yyvsp[(1) - (4)]));
(void) list_prepend((yyval), instruction(Op_push_i));
- (yyval)->nexti->memory = Nnull_string;
- } else
+ (yyval)->nexti->memory = dupnode(Nnull_string);
+ } else {
+ if (do_optimize > 1
+ && (yyvsp[(3) - (4)])->lasti->opcode == Op_func_call
+ && strcmp((yyvsp[(3) - (4)])->lasti->func_name, in_function) == 0
+ ) {
+ /* Do tail recursion optimization. Tail
+ * call without a return value is recognized
+ * in mk_function().
+ */
+ ((yyvsp[(3) - (4)])->lasti + 1)->tail_call = true;
+ }
+
(yyval) = list_append((yyvsp[(3) - (4)]), (yyvsp[(1) - (4)]));
+ }
}
break;
- case 57:
+ case 60:
/* Line 1778 of yacc.c */
-#line 882 "awkgram.y"
- { in_print = TRUE; in_parens = 0; }
+#line 876 "awkgram.y"
+ { in_print = true; in_parens = 0; }
break;
- case 58:
+ case 61:
/* Line 1778 of yacc.c */
-#line 883 "awkgram.y"
+#line 877 "awkgram.y"
{
/*
* Optimization: plain `print' has no expression list, so $3 is null.
@@ -2852,15 +2861,14 @@ regular_loop:
*/
if ((yyvsp[(1) - (4)])->opcode == Op_K_print &&
- ((yyvsp[(3) - (4)]) == NULL
- || ((yyvsp[(3) - (4)])->lasti->opcode == Op_field_spec
- && (yyvsp[(3) - (4)])->nexti->nexti->nexti == (yyvsp[(3) - (4)])->lasti
- && (yyvsp[(3) - (4)])->nexti->nexti->opcode == Op_push_i
- && (yyvsp[(3) - (4)])->nexti->nexti->memory->type == Node_val
- && (yyvsp[(3) - (4)])->nexti->nexti->memory->numbr == 0.0)
- )
+ ((yyvsp[(3) - (4)]) == NULL
+ || ((yyvsp[(3) - (4)])->lasti->opcode == Op_field_spec
+ && (yyvsp[(3) - (4)])->nexti->nexti->nexti == (yyvsp[(3) - (4)])->lasti
+ && (yyvsp[(3) - (4)])->nexti->nexti->opcode == Op_push_i
+ && (yyvsp[(3) - (4)])->nexti->nexti->memory->type == Node_val)
+ )
) {
- static short warned = FALSE;
+ static bool warned = false;
/* -----------------
* output_redir
* [ redirect exp ]
@@ -2871,16 +2879,19 @@ regular_loop:
*/
if ((yyvsp[(3) - (4)]) != NULL) {
- bcfree((yyvsp[(3) - (4)])->lasti); /* Op_field_spec */
- (yyvsp[(3) - (4)])->nexti->nexti->memory->flags &= ~PERM;
- (yyvsp[(3) - (4)])->nexti->nexti->memory->flags |= MALLOC;
- unref((yyvsp[(3) - (4)])->nexti->nexti->memory); /* Node_val */
+ NODE *n = (yyvsp[(3) - (4)])->nexti->nexti->memory;
+
+ if (! iszero(n))
+ goto regular_print;
+
+ bcfree((yyvsp[(3) - (4)])->lasti); /* Op_field_spec */
+ unref(n); /* Node_val */
bcfree((yyvsp[(3) - (4)])->nexti->nexti); /* Op_push_i */
- bcfree((yyvsp[(3) - (4)])->nexti); /* Op_list */
- bcfree((yyvsp[(3) - (4)])); /* Op_list */
+ bcfree((yyvsp[(3) - (4)])->nexti); /* Op_list */
+ bcfree((yyvsp[(3) - (4)])); /* Op_list */
} else {
if (do_lint && (rule == BEGIN || rule == END) && ! warned) {
- warned = TRUE;
+ warned = true;
lintwarn_ln((yyvsp[(1) - (4)])->source_line,
_("plain `print' in BEGIN or END rule should probably be `print \"\"'"));
}
@@ -2889,7 +2900,7 @@ regular_loop:
(yyvsp[(1) - (4)])->expr_count = 0;
(yyvsp[(1) - (4)])->opcode = Op_K_print_rec;
if ((yyvsp[(4) - (4)]) == NULL) { /* no redircetion */
- (yyvsp[(1) - (4)])->redir_type = 0;
+ (yyvsp[(1) - (4)])->redir_type = redirect_none;
(yyval) = list_create((yyvsp[(1) - (4)]));
} else {
INSTRUCTION *ip;
@@ -2909,16 +2920,16 @@ regular_loop:
* [$1 | NULL | redir_type | expr_count]
*
*/
-
+regular_print:
if ((yyvsp[(4) - (4)]) == NULL) { /* no redirection */
if ((yyvsp[(3) - (4)]) == NULL) { /* printf without arg */
(yyvsp[(1) - (4)])->expr_count = 0;
- (yyvsp[(1) - (4)])->redir_type = 0;
+ (yyvsp[(1) - (4)])->redir_type = redirect_none;
(yyval) = list_create((yyvsp[(1) - (4)]));
} else {
INSTRUCTION *t = (yyvsp[(3) - (4)]);
- (yyvsp[(1) - (4)])->expr_count = count_expressions(&t, FALSE);
- (yyvsp[(1) - (4)])->redir_type = 0;
+ (yyvsp[(1) - (4)])->expr_count = count_expressions(&t, false);
+ (yyvsp[(1) - (4)])->redir_type = redirect_none;
(yyval) = list_append(t, (yyvsp[(1) - (4)]));
}
} else {
@@ -2932,7 +2943,7 @@ regular_loop:
(yyval) = list_append((yyvsp[(4) - (4)]), (yyvsp[(1) - (4)]));
} else {
INSTRUCTION *t = (yyvsp[(3) - (4)]);
- (yyvsp[(1) - (4)])->expr_count = count_expressions(&t, FALSE);
+ (yyvsp[(1) - (4)])->expr_count = count_expressions(&t, false);
(yyval) = list_append(list_merge((yyvsp[(4) - (4)]), t), (yyvsp[(1) - (4)]));
}
}
@@ -2940,20 +2951,27 @@ regular_loop:
}
break;
- case 59:
+ case 62:
/* Line 1778 of yacc.c */
-#line 978 "awkgram.y"
+#line 974 "awkgram.y"
{ sub_counter = 0; }
break;
- case 60:
+ case 63:
/* Line 1778 of yacc.c */
-#line 979 "awkgram.y"
+#line 975 "awkgram.y"
{
char *arr = (yyvsp[(2) - (4)])->lextok;
(yyvsp[(2) - (4)])->opcode = Op_push_array;
- (yyvsp[(2) - (4)])->memory = variable(arr, Node_var_new);
+ (yyvsp[(2) - (4)])->memory = variable((yyvsp[(2) - (4)])->source_line, arr, Node_var_new);
+
+ if (! do_posix && ! do_traditional) {
+ if ((yyvsp[(2) - (4)])->memory == symbol_table)
+ fatal(_("`delete' is not allowed with SYMTAB"));
+ else if ((yyvsp[(2) - (4)])->memory == func_table)
+ fatal(_("`delete' is not allowed with FUNCTAB"));
+ }
if ((yyvsp[(4) - (4)]) == NULL) {
/*
@@ -2976,15 +2994,15 @@ regular_loop:
}
break;
- case 61:
+ case 64:
/* Line 1778 of yacc.c */
-#line 1009 "awkgram.y"
+#line 1012 "awkgram.y"
{
- static short warned = FALSE;
+ static bool warned = false;
char *arr = (yyvsp[(3) - (4)])->lextok;
if (do_lint && ! warned) {
- warned = TRUE;
+ warned = true;
lintwarn_ln((yyvsp[(1) - (4)])->source_line,
_("`delete(array)' is a non-portable tawk extension"));
}
@@ -2992,40 +3010,47 @@ regular_loop:
error_ln((yyvsp[(1) - (4)])->source_line,
_("`delete(array)' is a non-portable tawk extension"));
}
- (yyvsp[(3) - (4)])->memory = variable(arr, Node_var_new);
+ (yyvsp[(3) - (4)])->memory = variable((yyvsp[(3) - (4)])->source_line, arr, Node_var_new);
(yyvsp[(3) - (4)])->opcode = Op_push_array;
(yyvsp[(1) - (4)])->expr_count = 0;
(yyval) = list_append(list_create((yyvsp[(3) - (4)])), (yyvsp[(1) - (4)]));
+
+ if (! do_posix && ! do_traditional) {
+ if ((yyvsp[(3) - (4)])->memory == symbol_table)
+ fatal(_("`delete' is not allowed with SYMTAB"));
+ else if ((yyvsp[(3) - (4)])->memory == func_table)
+ fatal(_("`delete' is not allowed with FUNCTAB"));
+ }
}
break;
- case 62:
+ case 65:
/* Line 1778 of yacc.c */
-#line 1028 "awkgram.y"
+#line 1038 "awkgram.y"
{ (yyval) = optimize_assignment((yyvsp[(1) - (1)])); }
break;
- case 63:
+ case 66:
/* Line 1778 of yacc.c */
-#line 1033 "awkgram.y"
+#line 1043 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 64:
+ case 67:
/* Line 1778 of yacc.c */
-#line 1035 "awkgram.y"
+#line 1045 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 65:
+ case 68:
/* Line 1778 of yacc.c */
-#line 1040 "awkgram.y"
+#line 1050 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 66:
+ case 69:
/* Line 1778 of yacc.c */
-#line 1042 "awkgram.y"
+#line 1052 "awkgram.y"
{
if ((yyvsp[(1) - (2)]) == NULL)
(yyval) = list_create((yyvsp[(2) - (2)]));
@@ -3034,20 +3059,20 @@ regular_loop:
}
break;
- case 67:
+ case 70:
/* Line 1778 of yacc.c */
-#line 1049 "awkgram.y"
+#line 1059 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 68:
+ case 71:
/* Line 1778 of yacc.c */
-#line 1054 "awkgram.y"
+#line 1064 "awkgram.y"
{
INSTRUCTION *casestmt = (yyvsp[(5) - (5)]);
if ((yyvsp[(5) - (5)]) == NULL)
casestmt = list_create(instruction(Op_no_op));
- if (do_profiling)
+ if (do_pretty_print)
(void) list_prepend(casestmt, instruction(Op_exec_count));
(yyvsp[(1) - (5)])->case_exp = (yyvsp[(2) - (5)]);
(yyvsp[(1) - (5)])->case_stmt = casestmt;
@@ -3056,14 +3081,14 @@ regular_loop:
}
break;
- case 69:
+ case 72:
/* Line 1778 of yacc.c */
-#line 1066 "awkgram.y"
+#line 1076 "awkgram.y"
{
INSTRUCTION *casestmt = (yyvsp[(4) - (4)]);
if ((yyvsp[(4) - (4)]) == NULL)
casestmt = list_create(instruction(Op_no_op));
- if (do_profiling)
+ if (do_pretty_print)
(void) list_prepend(casestmt, instruction(Op_exec_count));
bcfree((yyvsp[(2) - (4)]));
(yyvsp[(1) - (4)])->case_stmt = casestmt;
@@ -3071,85 +3096,87 @@ regular_loop:
}
break;
- case 70:
+ case 73:
/* Line 1778 of yacc.c */
-#line 1080 "awkgram.y"
+#line 1090 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 71:
+ case 74:
/* Line 1778 of yacc.c */
-#line 1082 "awkgram.y"
+#line 1092 "awkgram.y"
{
- (yyvsp[(2) - (2)])->memory->numbr = -(force_number((yyvsp[(2) - (2)])->memory));
+ NODE *n = (yyvsp[(2) - (2)])->memory;
+ (void) force_number(n);
+ negate_num(n);
bcfree((yyvsp[(1) - (2)]));
(yyval) = (yyvsp[(2) - (2)]);
}
break;
- case 72:
+ case 75:
/* Line 1778 of yacc.c */
-#line 1088 "awkgram.y"
+#line 1100 "awkgram.y"
{
bcfree((yyvsp[(1) - (2)]));
(yyval) = (yyvsp[(2) - (2)]);
}
break;
- case 73:
+ case 76:
/* Line 1778 of yacc.c */
-#line 1093 "awkgram.y"
+#line 1105 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 74:
+ case 77:
/* Line 1778 of yacc.c */
-#line 1095 "awkgram.y"
+#line 1107 "awkgram.y"
{
(yyvsp[(1) - (1)])->opcode = Op_push_re;
(yyval) = (yyvsp[(1) - (1)]);
}
break;
- case 75:
+ case 78:
/* Line 1778 of yacc.c */
-#line 1103 "awkgram.y"
+#line 1115 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 76:
+ case 79:
/* Line 1778 of yacc.c */
-#line 1105 "awkgram.y"
+#line 1117 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 78:
+ case 81:
/* Line 1778 of yacc.c */
-#line 1115 "awkgram.y"
+#line 1127 "awkgram.y"
{
(yyval) = (yyvsp[(2) - (3)]);
}
break;
- case 79:
+ case 82:
/* Line 1778 of yacc.c */
-#line 1122 "awkgram.y"
+#line 1134 "awkgram.y"
{
- in_print = FALSE;
+ in_print = false;
in_parens = 0;
(yyval) = NULL;
}
break;
- case 80:
+ case 83:
/* Line 1778 of yacc.c */
-#line 1127 "awkgram.y"
- { in_print = FALSE; in_parens = 0; }
+#line 1139 "awkgram.y"
+ { in_print = false; in_parens = 0; }
break;
- case 81:
+ case 84:
/* Line 1778 of yacc.c */
-#line 1128 "awkgram.y"
+#line 1140 "awkgram.y"
{
if ((yyvsp[(1) - (3)])->redir_type == redirect_twoway
&& (yyvsp[(3) - (3)])->lasti->opcode == Op_K_getline_redir
@@ -3159,142 +3186,152 @@ regular_loop:
}
break;
- case 82:
+ case 85:
/* Line 1778 of yacc.c */
-#line 1139 "awkgram.y"
+#line 1151 "awkgram.y"
{
(yyval) = mk_condition((yyvsp[(3) - (6)]), (yyvsp[(1) - (6)]), (yyvsp[(6) - (6)]), NULL, NULL);
}
break;
- case 83:
+ case 86:
/* Line 1778 of yacc.c */
-#line 1144 "awkgram.y"
+#line 1156 "awkgram.y"
{
(yyval) = mk_condition((yyvsp[(3) - (9)]), (yyvsp[(1) - (9)]), (yyvsp[(6) - (9)]), (yyvsp[(7) - (9)]), (yyvsp[(9) - (9)]));
}
break;
- case 88:
+ case 91:
/* Line 1778 of yacc.c */
-#line 1161 "awkgram.y"
+#line 1173 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 89:
+ case 92:
/* Line 1778 of yacc.c */
-#line 1163 "awkgram.y"
+#line 1175 "awkgram.y"
{
bcfree((yyvsp[(1) - (2)]));
(yyval) = (yyvsp[(2) - (2)]);
}
break;
- case 92:
+ case 93:
+/* Line 1778 of yacc.c */
+#line 1183 "awkgram.y"
+ { (yyval) = NULL; }
+ break;
+
+ case 94:
+/* Line 1778 of yacc.c */
+#line 1185 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]) ; }
+ break;
+
+ case 95:
/* Line 1778 of yacc.c */
-#line 1176 "awkgram.y"
+#line 1190 "awkgram.y"
{
- append_param((yyvsp[(1) - (1)])->lextok);
- (yyvsp[(1) - (1)])->lextok = NULL;
- bcfree((yyvsp[(1) - (1)]));
+ (yyvsp[(1) - (1)])->param_count = 0;
+ (yyval) = list_create((yyvsp[(1) - (1)]));
}
break;
- case 93:
+ case 96:
/* Line 1778 of yacc.c */
-#line 1182 "awkgram.y"
+#line 1195 "awkgram.y"
{
- append_param((yyvsp[(3) - (3)])->lextok);
- (yyvsp[(3) - (3)])->lextok = NULL;
- bcfree((yyvsp[(3) - (3)]));
+ (yyvsp[(3) - (3)])->param_count = (yyvsp[(1) - (3)])->lasti->param_count + 1;
+ (yyval) = list_append((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]));
yyerrok;
}
break;
- case 94:
+ case 97:
/* Line 1778 of yacc.c */
-#line 1189 "awkgram.y"
- { /* func_params = NULL; */ }
+#line 1201 "awkgram.y"
+ { (yyval) = NULL; }
break;
- case 95:
+ case 98:
/* Line 1778 of yacc.c */
-#line 1191 "awkgram.y"
- { /* func_params = NULL; */ }
+#line 1203 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (2)]); }
break;
- case 96:
+ case 99:
/* Line 1778 of yacc.c */
-#line 1193 "awkgram.y"
- { /* func_params = NULL; */ }
+#line 1205 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (3)]); }
break;
- case 97:
+ case 100:
/* Line 1778 of yacc.c */
-#line 1199 "awkgram.y"
+#line 1211 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 98:
+ case 101:
/* Line 1778 of yacc.c */
-#line 1201 "awkgram.y"
+#line 1213 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 99:
+ case 102:
/* Line 1778 of yacc.c */
-#line 1206 "awkgram.y"
+#line 1218 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 100:
+ case 103:
/* Line 1778 of yacc.c */
-#line 1208 "awkgram.y"
+#line 1220 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 101:
+ case 104:
/* Line 1778 of yacc.c */
-#line 1213 "awkgram.y"
+#line 1225 "awkgram.y"
{ (yyval) = mk_expression_list(NULL, (yyvsp[(1) - (1)])); }
break;
- case 102:
+ case 105:
/* Line 1778 of yacc.c */
-#line 1215 "awkgram.y"
+#line 1227 "awkgram.y"
{
(yyval) = mk_expression_list((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]));
yyerrok;
}
break;
- case 103:
+ case 106:
/* Line 1778 of yacc.c */
-#line 1220 "awkgram.y"
+#line 1232 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 104:
+ case 107:
/* Line 1778 of yacc.c */
-#line 1222 "awkgram.y"
+#line 1234 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 105:
+ case 108:
/* Line 1778 of yacc.c */
-#line 1224 "awkgram.y"
+#line 1236 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 106:
+ case 109:
/* Line 1778 of yacc.c */
-#line 1226 "awkgram.y"
+#line 1238 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 107:
+ case 110:
/* Line 1778 of yacc.c */
-#line 1232 "awkgram.y"
+#line 1244 "awkgram.y"
{
if (do_lint && (yyvsp[(3) - (3)])->lasti->opcode == Op_match_rec)
lintwarn_ln((yyvsp[(2) - (3)])->source_line,
@@ -3303,21 +3340,21 @@ regular_loop:
}
break;
- case 108:
+ case 111:
/* Line 1778 of yacc.c */
-#line 1239 "awkgram.y"
+#line 1251 "awkgram.y"
{ (yyval) = mk_boolean((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 109:
+ case 112:
/* Line 1778 of yacc.c */
-#line 1241 "awkgram.y"
+#line 1253 "awkgram.y"
{ (yyval) = mk_boolean((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 110:
+ case 113:
/* Line 1778 of yacc.c */
-#line 1243 "awkgram.y"
+#line 1255 "awkgram.y"
{
if ((yyvsp[(1) - (3)])->lasti->opcode == Op_match_rec)
warning_ln((yyvsp[(2) - (3)])->source_line,
@@ -3335,12 +3372,12 @@ regular_loop:
}
break;
- case 111:
+ case 114:
/* Line 1778 of yacc.c */
-#line 1259 "awkgram.y"
+#line 1271 "awkgram.y"
{
if (do_lint_old)
- warning_ln((yyvsp[(2) - (3)])->source_line,
+ warning_ln((yyvsp[(2) - (3)])->source_line,
_("old awk does not support the keyword `in' except after `for'"));
(yyvsp[(3) - (3)])->nexti->opcode = Op_push_array;
(yyvsp[(2) - (3)])->opcode = Op_in_array;
@@ -3349,9 +3386,9 @@ regular_loop:
}
break;
- case 112:
+ case 115:
/* Line 1778 of yacc.c */
-#line 1269 "awkgram.y"
+#line 1281 "awkgram.y"
{
if (do_lint && (yyvsp[(3) - (3)])->lasti->opcode == Op_match_rec)
lintwarn_ln((yyvsp[(2) - (3)])->source_line,
@@ -3360,81 +3397,81 @@ regular_loop:
}
break;
- case 113:
+ case 116:
/* Line 1778 of yacc.c */
-#line 1276 "awkgram.y"
+#line 1288 "awkgram.y"
{ (yyval) = mk_condition((yyvsp[(1) - (5)]), (yyvsp[(2) - (5)]), (yyvsp[(3) - (5)]), (yyvsp[(4) - (5)]), (yyvsp[(5) - (5)])); }
break;
- case 114:
+ case 117:
/* Line 1778 of yacc.c */
-#line 1278 "awkgram.y"
+#line 1290 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 115:
+ case 118:
/* Line 1778 of yacc.c */
-#line 1283 "awkgram.y"
+#line 1295 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 116:
+ case 119:
/* Line 1778 of yacc.c */
-#line 1285 "awkgram.y"
+#line 1297 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 117:
+ case 120:
/* Line 1778 of yacc.c */
-#line 1287 "awkgram.y"
+#line 1299 "awkgram.y"
{
(yyvsp[(2) - (2)])->opcode = Op_assign_quotient;
(yyval) = (yyvsp[(2) - (2)]);
}
break;
- case 118:
+ case 121:
/* Line 1778 of yacc.c */
-#line 1295 "awkgram.y"
+#line 1307 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 119:
+ case 122:
/* Line 1778 of yacc.c */
-#line 1297 "awkgram.y"
+#line 1309 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 120:
+ case 123:
/* Line 1778 of yacc.c */
-#line 1302 "awkgram.y"
+#line 1314 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 121:
+ case 124:
/* Line 1778 of yacc.c */
-#line 1304 "awkgram.y"
+#line 1316 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 122:
+ case 125:
/* Line 1778 of yacc.c */
-#line 1309 "awkgram.y"
+#line 1321 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 123:
+ case 126:
/* Line 1778 of yacc.c */
-#line 1311 "awkgram.y"
+#line 1323 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 124:
+ case 127:
/* Line 1778 of yacc.c */
-#line 1313 "awkgram.y"
+#line 1325 "awkgram.y"
{
int count = 2;
- int is_simple_var = FALSE;
+ bool is_simple_var = false;
if ((yyvsp[(1) - (2)])->lasti->opcode == Op_concat) {
/* multiple (> 2) adjacent strings optimization */
@@ -3443,32 +3480,29 @@ regular_loop:
(yyvsp[(1) - (2)])->lasti->opcode = Op_no_op;
} else {
is_simple_var = ((yyvsp[(1) - (2)])->nexti->opcode == Op_push
- && (yyvsp[(1) - (2)])->lasti == (yyvsp[(1) - (2)])->nexti); /* first exp. is a simple
- * variable?; kludge for use
- * in Op_assign_concat.
- */
+ && (yyvsp[(1) - (2)])->lasti == (yyvsp[(1) - (2)])->nexti); /* first exp. is a simple
+ * variable?; kludge for use
+ * in Op_assign_concat.
+ */
}
if (do_optimize > 1
- && (yyvsp[(1) - (2)])->nexti == (yyvsp[(1) - (2)])->lasti && (yyvsp[(1) - (2)])->nexti->opcode == Op_push_i
- && (yyvsp[(2) - (2)])->nexti == (yyvsp[(2) - (2)])->lasti && (yyvsp[(2) - (2)])->nexti->opcode == Op_push_i
+ && (yyvsp[(1) - (2)])->nexti == (yyvsp[(1) - (2)])->lasti && (yyvsp[(1) - (2)])->nexti->opcode == Op_push_i
+ && (yyvsp[(2) - (2)])->nexti == (yyvsp[(2) - (2)])->lasti && (yyvsp[(2) - (2)])->nexti->opcode == Op_push_i
) {
NODE *n1 = (yyvsp[(1) - (2)])->nexti->memory;
NODE *n2 = (yyvsp[(2) - (2)])->nexti->memory;
size_t nlen;
- (void) force_string(n1);
- (void) force_string(n2);
+ n1 = force_string(n1);
+ n2 = force_string(n2);
nlen = n1->stlen + n2->stlen;
erealloc(n1->stptr, char *, nlen + 2, "constant fold");
memcpy(n1->stptr + n1->stlen, n2->stptr, n2->stlen);
n1->stlen = nlen;
n1->stptr[nlen] = '\0';
- n1->flags &= ~(NUMCUR|NUMBER);
+ n1->flags &= ~(NUMCUR|NUMBER|NUMINT);
n1->flags |= (STRING|STRCUR);
-
- n2->flags &= ~PERM;
- n2->flags |= MALLOC;
unref(n2);
bcfree((yyvsp[(2) - (2)])->nexti);
bcfree((yyvsp[(2) - (2)]));
@@ -3483,45 +3517,45 @@ regular_loop:
}
break;
- case 126:
+ case 129:
/* Line 1778 of yacc.c */
-#line 1368 "awkgram.y"
+#line 1377 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 127:
+ case 130:
/* Line 1778 of yacc.c */
-#line 1370 "awkgram.y"
+#line 1379 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 128:
+ case 131:
/* Line 1778 of yacc.c */
-#line 1372 "awkgram.y"
+#line 1381 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 129:
+ case 132:
/* Line 1778 of yacc.c */
-#line 1374 "awkgram.y"
+#line 1383 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 130:
+ case 133:
/* Line 1778 of yacc.c */
-#line 1376 "awkgram.y"
+#line 1385 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 131:
+ case 134:
/* Line 1778 of yacc.c */
-#line 1378 "awkgram.y"
+#line 1387 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 132:
+ case 135:
/* Line 1778 of yacc.c */
-#line 1380 "awkgram.y"
+#line 1389 "awkgram.y"
{
/*
* In BEGINFILE/ENDFILE, allow `getline var < file'
@@ -3546,27 +3580,27 @@ regular_loop:
}
break;
- case 133:
+ case 136:
/* Line 1778 of yacc.c */
-#line 1403 "awkgram.y"
+#line 1412 "awkgram.y"
{
(yyvsp[(2) - (2)])->opcode = Op_postincrement;
(yyval) = mk_assignment((yyvsp[(1) - (2)]), NULL, (yyvsp[(2) - (2)]));
}
break;
- case 134:
+ case 137:
/* Line 1778 of yacc.c */
-#line 1408 "awkgram.y"
+#line 1417 "awkgram.y"
{
(yyvsp[(2) - (2)])->opcode = Op_postdecrement;
(yyval) = mk_assignment((yyvsp[(1) - (2)]), NULL, (yyvsp[(2) - (2)]));
}
break;
- case 135:
+ case 138:
/* Line 1778 of yacc.c */
-#line 1413 "awkgram.y"
+#line 1422 "awkgram.y"
{
if (do_lint_old) {
warning_ln((yyvsp[(4) - (5)])->source_line,
@@ -3582,78 +3616,79 @@ regular_loop:
(yyval) = list_merge((yyvsp[(5) - (5)]), (yyvsp[(4) - (5)]));
} else {
INSTRUCTION *t = (yyvsp[(2) - (5)]);
- (yyvsp[(4) - (5)])->expr_count = count_expressions(&t, FALSE);
+ (yyvsp[(4) - (5)])->expr_count = count_expressions(&t, false);
(yyval) = list_append(list_merge(t, (yyvsp[(5) - (5)])), (yyvsp[(4) - (5)]));
}
}
break;
- case 136:
+ case 139:
/* Line 1778 of yacc.c */
-#line 1438 "awkgram.y"
+#line 1447 "awkgram.y"
{
(yyval) = mk_getline((yyvsp[(3) - (4)]), (yyvsp[(4) - (4)]), (yyvsp[(1) - (4)]), (yyvsp[(2) - (4)])->redir_type);
bcfree((yyvsp[(2) - (4)]));
}
break;
- case 137:
+ case 140:
/* Line 1778 of yacc.c */
-#line 1444 "awkgram.y"
+#line 1453 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 138:
+ case 141:
/* Line 1778 of yacc.c */
-#line 1446 "awkgram.y"
+#line 1455 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 139:
+ case 142:
/* Line 1778 of yacc.c */
-#line 1448 "awkgram.y"
+#line 1457 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 140:
+ case 143:
/* Line 1778 of yacc.c */
-#line 1450 "awkgram.y"
+#line 1459 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 141:
+ case 144:
/* Line 1778 of yacc.c */
-#line 1452 "awkgram.y"
+#line 1461 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 142:
+ case 145:
/* Line 1778 of yacc.c */
-#line 1454 "awkgram.y"
+#line 1463 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 143:
+ case 146:
/* Line 1778 of yacc.c */
-#line 1459 "awkgram.y"
+#line 1468 "awkgram.y"
{
(yyval) = list_create((yyvsp[(1) - (1)]));
}
break;
- case 144:
+ case 147:
/* Line 1778 of yacc.c */
-#line 1463 "awkgram.y"
+#line 1472 "awkgram.y"
{
if ((yyvsp[(2) - (2)])->opcode == Op_match_rec) {
(yyvsp[(2) - (2)])->opcode = Op_nomatch;
(yyvsp[(1) - (2)])->opcode = Op_push_i;
- (yyvsp[(1) - (2)])->memory = mk_number(0.0, (PERM|NUMCUR|NUMBER));
+ (yyvsp[(1) - (2)])->memory = make_number(0.0);
(yyval) = list_append(list_append(list_create((yyvsp[(1) - (2)])),
- instruction(Op_field_spec)), (yyvsp[(2) - (2)]));
+ instruction(Op_field_spec)), (yyvsp[(2) - (2)]));
} else {
if (do_optimize > 1 && (yyvsp[(2) - (2)])->nexti == (yyvsp[(2) - (2)])->lasti
- && (yyvsp[(2) - (2)])->nexti->opcode == Op_push_i
+ && (yyvsp[(2) - (2)])->nexti->opcode == Op_push_i
+ && ((yyvsp[(2) - (2)])->nexti->memory->flags & (MPFN|MPZN)) == 0
) {
NODE *n = (yyvsp[(2) - (2)])->nexti->memory;
if ((n->flags & (STRCUR|STRING)) != 0) {
@@ -3676,15 +3711,15 @@ regular_loop:
}
break;
- case 145:
+ case 148:
/* Line 1778 of yacc.c */
-#line 1494 "awkgram.y"
+#line 1504 "awkgram.y"
{ (yyval) = (yyvsp[(2) - (3)]); }
break;
- case 146:
+ case 149:
/* Line 1778 of yacc.c */
-#line 1496 "awkgram.y"
+#line 1506 "awkgram.y"
{
(yyval) = snode((yyvsp[(3) - (4)]), (yyvsp[(1) - (4)]));
if ((yyval) == NULL)
@@ -3692,9 +3727,9 @@ regular_loop:
}
break;
- case 147:
+ case 150:
/* Line 1778 of yacc.c */
-#line 1502 "awkgram.y"
+#line 1512 "awkgram.y"
{
(yyval) = snode((yyvsp[(3) - (4)]), (yyvsp[(1) - (4)]));
if ((yyval) == NULL)
@@ -3702,14 +3737,14 @@ regular_loop:
}
break;
- case 148:
+ case 151:
/* Line 1778 of yacc.c */
-#line 1508 "awkgram.y"
+#line 1518 "awkgram.y"
{
- static short warned1 = FALSE;
+ static bool warned = false;
- if (do_lint && ! warned1) {
- warned1 = TRUE;
+ if (do_lint && ! warned) {
+ warned = true;
lintwarn_ln((yyvsp[(1) - (1)])->source_line,
_("call of `length' without parentheses is not portable"));
}
@@ -3719,47 +3754,50 @@ regular_loop:
}
break;
- case 151:
+ case 154:
/* Line 1778 of yacc.c */
-#line 1523 "awkgram.y"
+#line 1533 "awkgram.y"
{
(yyvsp[(1) - (2)])->opcode = Op_preincrement;
(yyval) = mk_assignment((yyvsp[(2) - (2)]), NULL, (yyvsp[(1) - (2)]));
}
break;
- case 152:
+ case 155:
/* Line 1778 of yacc.c */
-#line 1528 "awkgram.y"
+#line 1538 "awkgram.y"
{
(yyvsp[(1) - (2)])->opcode = Op_predecrement;
(yyval) = mk_assignment((yyvsp[(2) - (2)]), NULL, (yyvsp[(1) - (2)]));
}
break;
- case 153:
+ case 156:
/* Line 1778 of yacc.c */
-#line 1533 "awkgram.y"
+#line 1543 "awkgram.y"
{
(yyval) = list_create((yyvsp[(1) - (1)]));
}
break;
- case 154:
+ case 157:
/* Line 1778 of yacc.c */
-#line 1537 "awkgram.y"
+#line 1547 "awkgram.y"
{
(yyval) = list_create((yyvsp[(1) - (1)]));
}
break;
- case 155:
+ case 158:
/* Line 1778 of yacc.c */
-#line 1541 "awkgram.y"
+#line 1551 "awkgram.y"
{
if ((yyvsp[(2) - (2)])->lasti->opcode == Op_push_i
- && ((yyvsp[(2) - (2)])->lasti->memory->flags & (STRCUR|STRING)) == 0) {
- (yyvsp[(2) - (2)])->lasti->memory->numbr = -(force_number((yyvsp[(2) - (2)])->lasti->memory));
+ && ((yyvsp[(2) - (2)])->lasti->memory->flags & (STRCUR|STRING)) == 0
+ ) {
+ NODE *n = (yyvsp[(2) - (2)])->lasti->memory;
+ (void) force_number(n);
+ negate_num(n);
(yyval) = (yyvsp[(2) - (2)]);
bcfree((yyvsp[(1) - (2)]));
} else {
@@ -3769,44 +3807,44 @@ regular_loop:
}
break;
- case 156:
+ case 159:
/* Line 1778 of yacc.c */
-#line 1553 "awkgram.y"
+#line 1566 "awkgram.y"
{
/*
* was: $$ = $2
* POSIX semantics: force a conversion to numeric type
*/
(yyvsp[(1) - (2)])->opcode = Op_plus_i;
- (yyvsp[(1) - (2)])->memory = mk_number((AWKNUM) 0.0, (PERM|NUMCUR|NUMBER));
+ (yyvsp[(1) - (2)])->memory = make_number(0.0);
(yyval) = list_append((yyvsp[(2) - (2)]), (yyvsp[(1) - (2)]));
}
break;
- case 157:
+ case 160:
/* Line 1778 of yacc.c */
-#line 1566 "awkgram.y"
+#line 1579 "awkgram.y"
{
func_use((yyvsp[(1) - (1)])->lasti->func_name, FUNC_USE);
(yyval) = (yyvsp[(1) - (1)]);
}
break;
- case 158:
+ case 161:
/* Line 1778 of yacc.c */
-#line 1571 "awkgram.y"
+#line 1584 "awkgram.y"
{
/* indirect function call */
INSTRUCTION *f, *t;
char *name;
NODE *indirect_var;
- static short warned = FALSE;
+ static bool warned = false;
const char *msg = _("indirect function calls are a gawk extension");
if (do_traditional || do_posix)
yyerror("%s", msg);
else if (do_lint && ! warned) {
- warned = TRUE;
+ warned = true;
lintwarn("%s", msg);
}
@@ -3815,7 +3853,7 @@ regular_loop:
name = estrdup(f->func_name, strlen(f->func_name));
if (is_std_var(name))
yyerror(_("can not use special variable `%s' for indirect function call"), name);
- indirect_var = variable(name, Node_var_new);
+ indirect_var = variable(f->source_line, name, Node_var_new);
t = instruction(Op_push);
t->memory = indirect_var;
@@ -3829,9 +3867,9 @@ regular_loop:
}
break;
- case 159:
+ case 162:
/* Line 1778 of yacc.c */
-#line 1607 "awkgram.y"
+#line 1620 "awkgram.y"
{
param_sanity((yyvsp[(3) - (4)]));
(yyvsp[(1) - (4)])->opcode = Op_func_call;
@@ -3841,53 +3879,53 @@ regular_loop:
(yyval) = list_create((yyvsp[(1) - (4)]));
} else {
INSTRUCTION *t = (yyvsp[(3) - (4)]);
- ((yyvsp[(1) - (4)]) + 1)->expr_count = count_expressions(&t, TRUE);
+ ((yyvsp[(1) - (4)]) + 1)->expr_count = count_expressions(&t, true);
(yyval) = list_append(t, (yyvsp[(1) - (4)]));
}
}
break;
- case 160:
+ case 163:
/* Line 1778 of yacc.c */
-#line 1624 "awkgram.y"
+#line 1637 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 161:
+ case 164:
/* Line 1778 of yacc.c */
-#line 1626 "awkgram.y"
+#line 1639 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 162:
+ case 165:
/* Line 1778 of yacc.c */
-#line 1631 "awkgram.y"
+#line 1644 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 163:
+ case 166:
/* Line 1778 of yacc.c */
-#line 1633 "awkgram.y"
+#line 1646 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (2)]); }
break;
- case 164:
+ case 167:
/* Line 1778 of yacc.c */
-#line 1638 "awkgram.y"
+#line 1651 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 165:
+ case 168:
/* Line 1778 of yacc.c */
-#line 1640 "awkgram.y"
+#line 1653 "awkgram.y"
{
(yyval) = list_merge((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
}
break;
- case 166:
+ case 169:
/* Line 1778 of yacc.c */
-#line 1647 "awkgram.y"
+#line 1660 "awkgram.y"
{
INSTRUCTION *ip = (yyvsp[(1) - (1)])->lasti;
int count = ip->sub_count; /* # of SUBSEP-seperated expressions */
@@ -3903,9 +3941,9 @@ regular_loop:
}
break;
- case 167:
+ case 170:
/* Line 1778 of yacc.c */
-#line 1664 "awkgram.y"
+#line 1677 "awkgram.y"
{
INSTRUCTION *t = (yyvsp[(2) - (3)]);
if ((yyvsp[(2) - (3)]) == NULL) {
@@ -3913,69 +3951,65 @@ regular_loop:
_("invalid subscript expression"));
/* install Null string as subscript. */
t = list_create(instruction(Op_push_i));
- t->nexti->memory = Nnull_string;
+ t->nexti->memory = dupnode(Nnull_string);
(yyvsp[(3) - (3)])->sub_count = 1;
} else
- (yyvsp[(3) - (3)])->sub_count = count_expressions(&t, FALSE);
+ (yyvsp[(3) - (3)])->sub_count = count_expressions(&t, false);
(yyval) = list_append(t, (yyvsp[(3) - (3)]));
}
break;
- case 168:
+ case 171:
/* Line 1778 of yacc.c */
-#line 1681 "awkgram.y"
+#line 1694 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 169:
+ case 172:
/* Line 1778 of yacc.c */
-#line 1683 "awkgram.y"
+#line 1696 "awkgram.y"
{
(yyval) = list_merge((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
}
break;
- case 170:
+ case 173:
/* Line 1778 of yacc.c */
-#line 1690 "awkgram.y"
+#line 1703 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (2)]); }
break;
- case 171:
+ case 174:
/* Line 1778 of yacc.c */
-#line 1695 "awkgram.y"
+#line 1708 "awkgram.y"
{
char *var_name = (yyvsp[(1) - (1)])->lextok;
(yyvsp[(1) - (1)])->opcode = Op_push;
- (yyvsp[(1) - (1)])->memory = variable(var_name, Node_var_new);
+ (yyvsp[(1) - (1)])->memory = variable((yyvsp[(1) - (1)])->source_line, var_name, Node_var_new);
(yyval) = list_create((yyvsp[(1) - (1)]));
}
break;
- case 172:
+ case 175:
/* Line 1778 of yacc.c */
-#line 1703 "awkgram.y"
+#line 1716 "awkgram.y"
{
- NODE *n;
-
char *arr = (yyvsp[(1) - (2)])->lextok;
- if ((n = lookup(arr)) != NULL && ! isarray(n))
- yyerror(_("use of non-array as array"));
- (yyvsp[(1) - (2)])->memory = variable(arr, Node_var_new);
+ (yyvsp[(1) - (2)])->memory = variable((yyvsp[(1) - (2)])->source_line, arr, Node_var_new);
(yyvsp[(1) - (2)])->opcode = Op_push_array;
(yyval) = list_prepend((yyvsp[(2) - (2)]), (yyvsp[(1) - (2)]));
}
break;
- case 173:
+ case 176:
/* Line 1778 of yacc.c */
-#line 1717 "awkgram.y"
+#line 1726 "awkgram.y"
{
INSTRUCTION *ip = (yyvsp[(1) - (1)])->nexti;
if (ip->opcode == Op_push
- && ip->memory->type == Node_var
- && ip->memory->var_update
+ && ip->memory->type == Node_var
+ && ip->memory->var_update
) {
(yyval) = list_prepend((yyvsp[(1) - (1)]), instruction(Op_var_update));
(yyval)->nexti->update_var = ip->memory->var_update;
@@ -3984,71 +4018,71 @@ regular_loop:
}
break;
- case 174:
+ case 177:
/* Line 1778 of yacc.c */
-#line 1729 "awkgram.y"
+#line 1738 "awkgram.y"
{
(yyval) = list_append((yyvsp[(2) - (3)]), (yyvsp[(1) - (3)]));
if ((yyvsp[(3) - (3)]) != NULL)
- mk_assignment((yyvsp[(2) - (3)]), NULL, (yyvsp[(3) - (3)]));
+ mk_assignment((yyvsp[(2) - (3)]), NULL, (yyvsp[(3) - (3)]));
}
break;
- case 175:
+ case 178:
/* Line 1778 of yacc.c */
-#line 1738 "awkgram.y"
+#line 1747 "awkgram.y"
{
(yyvsp[(1) - (1)])->opcode = Op_postincrement;
}
break;
- case 176:
+ case 179:
/* Line 1778 of yacc.c */
-#line 1742 "awkgram.y"
+#line 1751 "awkgram.y"
{
(yyvsp[(1) - (1)])->opcode = Op_postdecrement;
}
break;
- case 177:
+ case 180:
/* Line 1778 of yacc.c */
-#line 1745 "awkgram.y"
+#line 1754 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 179:
+ case 182:
/* Line 1778 of yacc.c */
-#line 1753 "awkgram.y"
+#line 1762 "awkgram.y"
{ yyerrok; }
break;
- case 180:
+ case 183:
/* Line 1778 of yacc.c */
-#line 1757 "awkgram.y"
+#line 1766 "awkgram.y"
{ yyerrok; }
break;
- case 183:
+ case 186:
/* Line 1778 of yacc.c */
-#line 1766 "awkgram.y"
+#line 1775 "awkgram.y"
{ yyerrok; }
break;
- case 184:
+ case 187:
/* Line 1778 of yacc.c */
-#line 1770 "awkgram.y"
+#line 1779 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); yyerrok; }
break;
- case 185:
+ case 188:
/* Line 1778 of yacc.c */
-#line 1774 "awkgram.y"
+#line 1783 "awkgram.y"
{ yyerrok; }
break;
/* Line 1778 of yacc.c */
-#line 4064 "awkgram.c"
+#line 4098 "awkgram.c"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -4280,7 +4314,7 @@ yyreturn:
/* Line 2041 of yacc.c */
-#line 1776 "awkgram.y"
+#line 1785 "awkgram.y"
struct token {
@@ -4298,6 +4332,7 @@ struct token {
# define CONTINUE 0x1000 /* continue allowed inside */
NODE *(*ptr)(int); /* function that implements this keyword */
+ NODE *(*ptr2)(int); /* alternate arbitrary-precision function */
};
#if 'a' == 0x81 /* it's EBCDIC */
@@ -4321,81 +4356,87 @@ tokcompare(const void *l, const void *r)
* Function pointers come from declarations in awk.h.
*/
+#ifdef HAVE_MPFR
+#define MPF(F) do_mpfr_##F
+#else
+#define MPF(F) 0
+#endif
+
static const struct token tokentab[] = {
-{"BEGIN", Op_rule, LEX_BEGIN, 0, 0},
-{"BEGINFILE", Op_rule, LEX_BEGINFILE, GAWKX, 0},
-{"END", Op_rule, LEX_END, 0, 0},
-{"ENDFILE", Op_rule, LEX_ENDFILE, GAWKX, 0},
+{"BEGIN", Op_rule, LEX_BEGIN, 0, 0, 0},
+{"BEGINFILE", Op_rule, LEX_BEGINFILE, GAWKX, 0, 0},
+{"END", Op_rule, LEX_END, 0, 0, 0},
+{"ENDFILE", Op_rule, LEX_ENDFILE, GAWKX, 0, 0},
#ifdef ARRAYDEBUG
-{"adump", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_adump},
+{"adump", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2), do_adump, 0},
#endif
-{"and", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_and},
-{"asort", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3), do_asort},
-{"asorti", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3), do_asorti},
-{"atan2", Op_builtin, LEX_BUILTIN, NOT_OLD|A(2), do_atan2},
-{"bindtextdomain", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2), do_bindtextdomain},
-{"break", Op_K_break, LEX_BREAK, 0, 0},
-{"case", Op_K_case, LEX_CASE, GAWKX, 0},
-{"close", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1)|A(2), do_close},
-{"compl", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_compl},
-{"continue", Op_K_continue, LEX_CONTINUE, 0, 0},
-{"cos", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_cos},
-{"dcgettext", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3), do_dcgettext},
-{"dcngettext", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3)|A(4)|A(5), do_dcngettext},
-{"default", Op_K_default, LEX_DEFAULT, GAWKX, 0},
-{"delete", Op_K_delete, LEX_DELETE, NOT_OLD, 0},
-{"do", Op_K_do, LEX_DO, NOT_OLD|BREAK|CONTINUE, 0},
-{"else", Op_K_else, LEX_ELSE, 0, 0},
-{"eval", Op_symbol, LEX_EVAL, 0, 0},
-{"exit", Op_K_exit, LEX_EXIT, 0, 0},
-{"exp", Op_builtin, LEX_BUILTIN, A(1), do_exp},
-{"extension", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_ext},
-{"fflush", Op_builtin, LEX_BUILTIN, A(0)|A(1), do_fflush},
-{"for", Op_K_for, LEX_FOR, BREAK|CONTINUE, 0},
-{"func", Op_func, LEX_FUNCTION, NOT_POSIX|NOT_OLD, 0},
-{"function",Op_func, LEX_FUNCTION, NOT_OLD, 0},
-{"gensub", Op_sub_builtin, LEX_BUILTIN, GAWKX|A(3)|A(4), 0},
-{"getline", Op_K_getline_redir, LEX_GETLINE, NOT_OLD, 0},
-{"gsub", Op_sub_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), 0},
-{"if", Op_K_if, LEX_IF, 0, 0},
-{"in", Op_symbol, LEX_IN, 0, 0},
-{"include", Op_symbol, LEX_INCLUDE, GAWKX, 0},
-{"index", Op_builtin, LEX_BUILTIN, A(2), do_index},
-{"int", Op_builtin, LEX_BUILTIN, A(1), do_int},
-{"isarray", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_isarray},
-{"length", Op_builtin, LEX_LENGTH, A(0)|A(1), do_length},
-{"log", Op_builtin, LEX_BUILTIN, A(1), do_log},
-{"lshift", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_lshift},
-{"match", Op_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), do_match},
-{"mktime", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_mktime},
-{"next", Op_K_next, LEX_NEXT, 0, 0},
-{"nextfile", Op_K_nextfile, LEX_NEXTFILE, 0, 0},
-{"or", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_or},
-{"patsplit", Op_builtin, LEX_BUILTIN, GAWKX|A(2)|A(3)|A(4), do_patsplit},
-{"print", Op_K_print, LEX_PRINT, 0, 0},
-{"printf", Op_K_printf, LEX_PRINTF, 0, 0},
-{"rand", Op_builtin, LEX_BUILTIN, NOT_OLD|A(0), do_rand},
-{"return", Op_K_return, LEX_RETURN, NOT_OLD, 0},
-{"rshift", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_rshift},
-{"sin", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_sin},
-{"split", Op_builtin, LEX_BUILTIN, A(2)|A(3)|A(4), do_split},
-{"sprintf", Op_builtin, LEX_BUILTIN, 0, do_sprintf},
-{"sqrt", Op_builtin, LEX_BUILTIN, A(1), do_sqrt},
-{"srand", Op_builtin, LEX_BUILTIN, NOT_OLD|A(0)|A(1), do_srand},
+{"and", Op_builtin, LEX_BUILTIN, GAWKX, do_and, MPF(and)},
+{"asort", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3), do_asort, 0},
+{"asorti", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3), do_asorti, 0},
+{"atan2", Op_builtin, LEX_BUILTIN, NOT_OLD|A(2), do_atan2, MPF(atan2)},
+{"bindtextdomain", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2), do_bindtextdomain, 0},
+{"break", Op_K_break, LEX_BREAK, 0, 0, 0},
+{"case", Op_K_case, LEX_CASE, GAWKX, 0, 0},
+{"close", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1)|A(2), do_close, 0},
+{"compl", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_compl, MPF(compl)},
+{"continue", Op_K_continue, LEX_CONTINUE, 0, 0, 0},
+{"cos", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_cos, MPF(cos)},
+{"dcgettext", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3), do_dcgettext, 0},
+{"dcngettext", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3)|A(4)|A(5), do_dcngettext, 0},
+{"default", Op_K_default, LEX_DEFAULT, GAWKX, 0, 0},
+{"delete", Op_K_delete, LEX_DELETE, NOT_OLD, 0, 0},
+{"do", Op_K_do, LEX_DO, NOT_OLD|BREAK|CONTINUE, 0, 0},
+{"else", Op_K_else, LEX_ELSE, 0, 0, 0},
+{"eval", Op_symbol, LEX_EVAL, 0, 0, 0},
+{"exit", Op_K_exit, LEX_EXIT, 0, 0, 0},
+{"exp", Op_builtin, LEX_BUILTIN, A(1), do_exp, MPF(exp)},
+{"fflush", Op_builtin, LEX_BUILTIN, A(0)|A(1), do_fflush, 0},
+{"for", Op_K_for, LEX_FOR, BREAK|CONTINUE, 0, 0},
+{"func", Op_func, LEX_FUNCTION, NOT_POSIX|NOT_OLD, 0, 0},
+{"function",Op_func, LEX_FUNCTION, NOT_OLD, 0, 0},
+{"gensub", Op_sub_builtin, LEX_BUILTIN, GAWKX|A(3)|A(4), 0, 0},
+{"getline", Op_K_getline_redir, LEX_GETLINE, NOT_OLD, 0, 0},
+{"gsub", Op_sub_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), 0, 0},
+{"if", Op_K_if, LEX_IF, 0, 0, 0},
+{"in", Op_symbol, LEX_IN, 0, 0, 0},
+{"include", Op_symbol, LEX_INCLUDE, GAWKX, 0, 0},
+{"index", Op_builtin, LEX_BUILTIN, A(2), do_index, 0},
+{"int", Op_builtin, LEX_BUILTIN, A(1), do_int, MPF(int)},
+{"isarray", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_isarray, 0},
+{"length", Op_builtin, LEX_LENGTH, A(0)|A(1), do_length, 0},
+{"load", Op_symbol, LEX_LOAD, GAWKX, 0, 0},
+{"log", Op_builtin, LEX_BUILTIN, A(1), do_log, MPF(log)},
+{"lshift", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_lshift, MPF(lshift)},
+{"match", Op_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), do_match, 0},
+{"mktime", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_mktime, 0},
+{"next", Op_K_next, LEX_NEXT, 0, 0, 0},
+{"nextfile", Op_K_nextfile, LEX_NEXTFILE, 0, 0, 0},
+{"or", Op_builtin, LEX_BUILTIN, GAWKX, do_or, MPF(or)},
+{"patsplit", Op_builtin, LEX_BUILTIN, GAWKX|A(2)|A(3)|A(4), do_patsplit, 0},
+{"print", Op_K_print, LEX_PRINT, 0, 0, 0},
+{"printf", Op_K_printf, LEX_PRINTF, 0, 0, 0},
+{"rand", Op_builtin, LEX_BUILTIN, NOT_OLD|A(0), do_rand, MPF(rand)},
+{"return", Op_K_return, LEX_RETURN, NOT_OLD, 0, 0},
+{"rshift", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_rshift, MPF(rhift)},
+{"sin", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_sin, MPF(sin)},
+{"split", Op_builtin, LEX_BUILTIN, A(2)|A(3)|A(4), do_split, 0},
+{"sprintf", Op_builtin, LEX_BUILTIN, 0, do_sprintf, 0},
+{"sqrt", Op_builtin, LEX_BUILTIN, A(1), do_sqrt, MPF(sqrt)},
+{"srand", Op_builtin, LEX_BUILTIN, NOT_OLD|A(0)|A(1), do_srand, MPF(srand)},
#if defined(GAWKDEBUG) || defined(ARRAYDEBUG) /* || ... */
-{"stopme", Op_builtin, LEX_BUILTIN, GAWKX|A(0), stopme},
+{"stopme", Op_builtin, LEX_BUILTIN, GAWKX|A(0), stopme, 0},
#endif
-{"strftime", Op_builtin, LEX_BUILTIN, GAWKX|A(0)|A(1)|A(2)|A(3), do_strftime},
-{"strtonum", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_strtonum},
-{"sub", Op_sub_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), 0},
-{"substr", Op_builtin, LEX_BUILTIN, A(2)|A(3), do_substr},
-{"switch", Op_K_switch, LEX_SWITCH, GAWKX|BREAK, 0},
-{"system", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_system},
-{"systime", Op_builtin, LEX_BUILTIN, GAWKX|A(0), do_systime},
-{"tolower", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_tolower},
-{"toupper", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_toupper},
-{"while", Op_K_while, LEX_WHILE, BREAK|CONTINUE, 0},
-{"xor", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_xor},
+{"strftime", Op_builtin, LEX_BUILTIN, GAWKX|A(0)|A(1)|A(2)|A(3), do_strftime, 0},
+{"strtonum", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_strtonum, MPF(strtonum)},
+{"sub", Op_sub_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), 0, 0},
+{"substr", Op_builtin, LEX_BUILTIN, A(2)|A(3), do_substr, 0},
+{"switch", Op_K_switch, LEX_SWITCH, GAWKX|BREAK, 0, 0},
+{"system", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_system, 0},
+{"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},
+{"while", Op_K_while, LEX_WHILE, BREAK|CONTINUE, 0, 0},
+{"xor", Op_builtin, LEX_BUILTIN, GAWKX, do_xor, MPF(xor)},
};
#if MBS_SUPPORT
@@ -4431,6 +4472,23 @@ getfname(NODE *(*fptr)(int))
return NULL;
}
+/* negate_num --- negate a number in NODE */
+
+void
+negate_num(NODE *n)
+{
+#ifdef HAVE_MPFR
+ if (is_mpg_float(n)) {
+ int tval;
+ tval = mpfr_neg(n->mpg_numbr, n->mpg_numbr, ROUND_MODE);
+ IEEE_FMT(n->mpg_numbr, tval);
+ } else if (is_mpg_integer(n)) {
+ mpz_neg(n->mpg_i, n->mpg_i);
+ } else
+#endif
+ n->numbr = -n->numbr;
+}
+
/* print_included_from --- print `Included from ..' file names and locations */
static void
@@ -4454,7 +4512,7 @@ print_included_from()
line--;
msg("%s %s:%d%c",
s->prev == sourcefile ? "In file included from"
- : " from",
+ : " from",
(s->stype == SRC_INC ||
s->stype == SRC_FILE) ? s->src : "cmd. line",
line,
@@ -4476,7 +4534,7 @@ warning_ln(int line, const char *mesg, ...)
sourceline = line;
print_included_from();
va_start(args, mesg);
- err(_("warning: "), mesg, args);
+ err(false, _("warning: "), mesg, args);
va_end(args);
sourceline = saveline;
}
@@ -4494,9 +4552,9 @@ lintwarn_ln(int line, const char *mesg, ...)
print_included_from();
va_start(args, mesg);
if (lintfunc == r_fatal)
- err(_("fatal: "), mesg, args);
+ err(true, _("fatal: "), mesg, args);
else
- err(_("warning: "), mesg, args);
+ err(false, _("warning: "), mesg, args);
va_end(args);
sourceline = saveline;
if (lintfunc == r_fatal)
@@ -4516,7 +4574,7 @@ error_ln(int line, const char *m, ...)
print_included_from();
errcount++;
va_start(args, m);
- err("error: ", m, args);
+ err(false, "error: ", m, args);
va_end(args);
sourceline = saveline;
}
@@ -4594,7 +4652,7 @@ yyerror(const char *m, ...)
*bp++ = ' ';
}
strcpy(bp, mesg);
- err("", buf, args);
+ err(false, "", buf, args);
va_end(args);
efree(buf);
}
@@ -4635,7 +4693,7 @@ mk_program()
if (endfile_block == NULL)
endfile_block = list_create(ip_endfile);
else {
- ip_rec->has_endfile = TRUE;
+ ip_rec->has_endfile = true;
(void) list_prepend(endfile_block, ip_endfile);
}
@@ -4736,8 +4794,11 @@ parse_program(INSTRUCTION **pcode)
ip_atexit = instruction(Op_atexit); /* target for `exit' in END block */
}
- sourcefile = srcfiles->next;
- lexeof = FALSE;
+ for (sourcefile = srcfiles->next; sourcefile->stype == SRC_EXTLIB;
+ sourcefile = sourcefile->next)
+ ;
+
+ lexeof = false;
lexptr = NULL;
lasttok = 0;
memset(rule_block, 0, sizeof(ruletab) * sizeof(INSTRUCTION *));
@@ -4753,6 +4814,11 @@ parse_program(INSTRUCTION **pcode)
if (ret == 0) /* avoid spurious warning if parser aborted with YYABORT */
check_funcs();
+ if (args_array == NULL)
+ emalloc(args_array, NODE **, (max_args + 2) * sizeof(NODE *), "parse_program");
+ else
+ erealloc(args_array, NODE **, (max_args + 2) * sizeof(NODE *), "parse_program");
+
return (ret || errcount);
}
@@ -4781,7 +4847,7 @@ do_add_srcfile(int stype, char *src, char *path, SRCFILE *thisfile)
*/
SRCFILE *
-add_srcfile(int stype, char *src, SRCFILE *thisfile, int *already_included, int *errcode)
+add_srcfile(int stype, char *src, SRCFILE *thisfile, bool *already_included, int *errcode)
{
SRCFILE *s;
struct stat sbuf;
@@ -4789,41 +4855,61 @@ add_srcfile(int stype, char *src, SRCFILE *thisfile, int *already_included, int
int errno_val = 0;
if (already_included)
- *already_included = FALSE;
+ *already_included = false;
if (errcode)
*errcode = 0;
if (stype == SRC_CMDLINE || stype == SRC_STDIN)
return do_add_srcfile(stype, src, NULL, thisfile);
- path = find_source(src, &sbuf, &errno_val);
+ path = find_source(src, & sbuf, &errno_val, stype == SRC_EXTLIB);
if (path == NULL) {
if (errcode) {
*errcode = errno_val;
return NULL;
}
- fatal(_("can't open source file `%s' for reading (%s)"),
- src, errno_val ? strerror(errno_val) : _("reason unknown"));
+ /* use full messages to ease translation */
+ fatal(stype != SRC_EXTLIB
+ ? _("can't open source file `%s' for reading (%s)")
+ : _("can't open shared library `%s' for reading (%s)"),
+ src,
+ errno_val ? strerror(errno_val) : _("reason unknown"));
}
+ /* N.B. We do not eliminate duplicate SRC_FILE (-f) programs. */
for (s = srcfiles->next; s != srcfiles; s = s->next) {
- if ((s->stype == SRC_FILE || s->stype == SRC_INC)
- && files_are_same(path, s)
- ) {
- if (do_lint) {
- int line = sourceline;
- /* Kludge: the line number may be off for `@include file'.
- * Since, this function is also used for '-f file' in main.c,
- * sourceline > 1 check ensures that the call is at
- * parse time.
- */
- if (sourceline > 1 && lasttok == NEWLINE)
- line--;
- lintwarn_ln(line, _("already included source file `%s'"), src);
+ if ((s->stype == SRC_FILE || s->stype == SRC_INC || s->stype == SRC_EXTLIB) && files_are_same(path, s)) {
+ if (stype == SRC_INC || stype == SRC_EXTLIB) {
+ /* eliminate duplicates */
+ if ((stype == SRC_INC) && (s->stype == SRC_FILE))
+ fatal(_("can't include `%s' and use it as a program file"), src);
+
+ if (do_lint) {
+ int line = sourceline;
+ /* Kludge: the line number may be off for `@include file'.
+ * Since, this function is also used for '-f file' in main.c,
+ * sourceline > 1 check ensures that the call is at
+ * parse time.
+ */
+ if (sourceline > 1 && lasttok == NEWLINE)
+ line--;
+ lintwarn_ln(line,
+ stype != SRC_EXTLIB
+ ? _("already included source file `%s'")
+ : _("already loaded shared library `%s'"),
+ src);
+ }
+ efree(path);
+ if (already_included)
+ *already_included = true;
+ return NULL;
+ } else {
+ /* duplicates are allowed for -f */
+ if (s->stype == SRC_INC)
+ fatal(_("can't include `%s' and use it as a program file"), src);
+ /* no need to scan for further matches, since
+ * they must be of homogeneous type */
+ break;
}
- efree(path);
- if (already_included)
- *already_included = TRUE;
- return NULL;
}
}
@@ -4841,7 +4927,7 @@ include_source(INSTRUCTION *file)
SRCFILE *s;
char *src = file->lextok;
int errcode;
- int already_included;
+ bool already_included;
if (do_traditional || do_posix) {
error_ln(file->source_line, _("@include is a gawk extension"));
@@ -4878,8 +4964,43 @@ include_source(INSTRUCTION *file)
sourceline = 0;
source = NULL;
lasttok = 0;
- lexeof = FALSE;
- eof_warned = FALSE;
+ lexeof = false;
+ eof_warned = false;
+ return 0;
+}
+
+/* load_library --- load a shared library */
+
+static int
+load_library(INSTRUCTION *file)
+{
+ SRCFILE *s;
+ char *src = file->lextok;
+ int errcode;
+ bool already_included;
+
+ if (do_traditional || do_posix) {
+ error_ln(file->source_line, _("@load is a gawk extension"));
+ return -1;
+ }
+
+ if (strlen(src) == 0) {
+ if (do_lint)
+ lintwarn_ln(file->source_line, _("empty filename after @load"));
+ return 0;
+ }
+
+ s = add_srcfile(SRC_EXTLIB, src, sourcefile, &already_included, &errcode);
+ if (s == NULL) {
+ if (already_included)
+ return 0;
+ error_ln(file->source_line,
+ _("can't open shared library `%s' for reading (%s)"),
+ src, errcode ? strerror(errcode) : _("reason unknown"));
+ return -1;
+ }
+
+ load_ext(s->fullpath);
return 0;
}
@@ -4906,10 +5027,11 @@ next_sourcefile()
* Previous versions of gawk did not core dump in such a
* case.
*
- * assert(lexeof == TRUE);
+ * assert(lexeof == true);
*/
- lexeof = FALSE;
- eof_warned = FALSE;
+
+ lexeof = false;
+ eof_warned = false;
sourcefile->srclines = sourceline; /* total no of lines in current file */
if (sourcefile->fd > INVALID_HANDLE) {
if (sourcefile->fd != fileno(stdin)) /* safety */
@@ -4922,9 +5044,12 @@ next_sourcefile()
sourcefile->lexptr_begin = NULL;
}
- sourcefile = sourcefile->next;
- if (sourcefile == srcfiles)
- return;
+ while ((sourcefile = sourcefile->next) != NULL) {
+ if (sourcefile == srcfiles)
+ return;
+ if (sourcefile->stype != SRC_EXTLIB)
+ break;
+ }
if (sourcefile->lexptr_begin != NULL) {
/* resume reading from already opened file (postponed to process '@include') */
@@ -4950,7 +5075,7 @@ get_src_buf()
{
int n;
char *scan;
- int newfile;
+ bool newfile;
int savelen;
struct stat sbuf;
@@ -4975,7 +5100,7 @@ get_src_buf()
readfunc = read_one_line;
}
- newfile = FALSE;
+ newfile = false;
if (sourcefile == srcfiles)
return NULL;
@@ -4991,13 +5116,13 @@ get_src_buf()
* gawk '' /path/name
* Sigh.
*/
- static short warned = FALSE;
+ static bool warned = false;
if (do_lint && ! warned) {
- warned = TRUE;
+ warned = true;
lintwarn(_("empty program text on command line"));
}
- lexeof = TRUE;
+ lexeof = true;
}
} else if (sourcefile->buf == NULL && *(lexptr-1) != '\n') {
/*
@@ -5025,7 +5150,7 @@ get_src_buf()
lexend = lexptr + 1;
sourcefile->buf = buf;
} else
- lexeof = TRUE;
+ lexeof = true;
return lexptr;
}
@@ -5046,7 +5171,7 @@ get_src_buf()
error(_("can't open source file `%s' for reading (%s)"),
in, strerror(errno));
errcount++;
- lexeof = TRUE;
+ lexeof = true;
return sourcefile->src;
}
@@ -5062,7 +5187,7 @@ get_src_buf()
l = A_DECENT_BUFFER_SIZE;
#undef A_DECENT_BUFFER_SIZE
sourcefile->bufsize = l;
- newfile = TRUE;
+ newfile = true;
emalloc(sourcefile->buf, char *, sourcefile->bufsize, "get_src_buf");
lexptr = lexptr_begin = lexeme = sourcefile->buf;
savelen = 0;
@@ -5113,17 +5238,17 @@ get_src_buf()
error(_("can't read sourcefile `%s' (%s)"),
source, strerror(errno));
errcount++;
- lexeof = TRUE;
+ lexeof = true;
} else {
lexend = lexptr + n;
if (n == 0) {
- static short warned = FALSE;
+ static bool warned = false;
if (do_lint && newfile && ! warned){
- warned = TRUE;
+ warned = true;
sourceline = 0;
lintwarn(_("source file `%s' is empty"), source);
}
- lexeof = TRUE;
+ lexeof = true;
}
}
return sourcefile->buf;
@@ -5299,14 +5424,14 @@ static int newline_eof()
pushback();
if (do_lint && ! eof_warned) {
lintwarn(_("source file does not end in newline"));
- eof_warned = TRUE;
+ eof_warned = true;
}
sourceline++;
return NEWLINE;
}
sourceline--;
- eof_warned = FALSE;
+ eof_warned = false;
return LEX_EOF;
}
@@ -5316,14 +5441,16 @@ static int
yylex(void)
{
int c;
- int seen_e = FALSE; /* These are for numbers */
- int seen_point = FALSE;
- int esc_seen; /* for literal strings */
+ bool seen_e = false; /* These are for numbers */
+ bool seen_point = false;
+ bool esc_seen; /* for literal strings */
int mid;
- static int did_newline = FALSE;
+ int base;
+ static bool did_newline = false;
char *tokkey;
- int inhex = FALSE;
- int intlstr = FALSE;
+ bool inhex = false;
+ bool intlstr = false;
+ AWKNUM d;
#define GET_INSTRUCTION(op) bcalloc(op, 1, sourceline)
@@ -5377,7 +5504,7 @@ yylex(void)
* The code for \ handles \[ and \].
*/
- want_regexp = FALSE;
+ want_regexp = false;
tok = tokstart;
for (;;) {
c = nextc();
@@ -5494,10 +5621,10 @@ retry:
while ((c = nextc()) == ' ' || c == '\t' || c == '\r')
continue;
if (c == '#') {
- static short warned = FALSE;
+ static bool warned = false;
if (do_lint && ! warned) {
- warned = TRUE;
+ warned = true;
lintwarn(
_("use of `\\ #...' line continuation is not portable"));
}
@@ -5570,11 +5697,11 @@ retry:
return lasttok = '*';
} else if (c == '*') {
/* make ** and **= aliases for ^ and ^= */
- static int did_warn_op = FALSE, did_warn_assgn = FALSE;
+ static bool did_warn_op = false, did_warn_assgn = false;
if (nextc() == '=') {
if (! did_warn_assgn) {
- did_warn_assgn = TRUE;
+ did_warn_assgn = true;
if (do_lint)
lintwarn(_("POSIX does not allow operator `**='"));
if (do_lint_old)
@@ -5585,7 +5712,7 @@ retry:
} else {
pushback();
if (! did_warn_op) {
- did_warn_op = TRUE;
+ did_warn_op = true;
if (do_lint)
lintwarn(_("POSIX does not allow operator `**'"));
if (do_lint_old)
@@ -5619,11 +5746,11 @@ retry:
case '^':
{
- static int did_warn_op = FALSE, did_warn_assgn = FALSE;
+ static bool did_warn_op = false, did_warn_assgn = false;
if (nextc() == '=') {
if (do_lint_old && ! did_warn_assgn) {
- did_warn_assgn = TRUE;
+ did_warn_assgn = true;
warning(_("operator `^=' is not supported in old awk"));
}
yylval = GET_INSTRUCTION(Op_assign_exp);
@@ -5631,7 +5758,7 @@ retry:
}
pushback();
if (do_lint_old && ! did_warn_op) {
- did_warn_op = TRUE;
+ did_warn_op = true;
warning(_("operator `^' is not supported in old awk"));
}
yylval = GET_INSTRUCTION(Op_exp);
@@ -5710,7 +5837,7 @@ retry:
* hacking the grammar.
*/
if (did_newline) {
- did_newline = FALSE;
+ did_newline = false;
if (--in_braces == 0)
lastline = sourceline;
return lasttok = c;
@@ -5721,7 +5848,7 @@ retry:
case '"':
string:
- esc_seen = FALSE;
+ esc_seen = false;
while ((c = nextc()) != '"') {
if (c == '\n') {
pushback();
@@ -5735,7 +5862,7 @@ retry:
sourceline++;
continue;
}
- esc_seen = TRUE;
+ esc_seen = true;
if (! want_source || c != '"')
tokadd('\\');
}
@@ -5754,12 +5881,10 @@ retry:
yylval->opcode = Op_push_i;
yylval->memory = make_str_node(tokstart,
- tok - tokstart, esc_seen ? SCAN : 0);
- yylval->memory->flags &= ~MALLOC;
- yylval->memory->flags |= PERM;
+ tok - tokstart, esc_seen ? SCAN : 0);
if (intlstr) {
yylval->memory->flags |= INTLSTR;
- intlstr = FALSE;
+ intlstr = false;
if (do_intl)
dumpintlstr(yylval->memory->stptr, yylval->memory->stlen);
}
@@ -5798,7 +5923,7 @@ retry:
case '9':
/* It's a number */
for (;;) {
- int gotnumber = FALSE;
+ bool gotnumber = false;
tokadd(c);
switch (c) {
@@ -5810,7 +5935,7 @@ retry:
int peek = nextc();
if (isxdigit(peek)) {
- inhex = TRUE;
+ inhex = true;
pushback(); /* following digit */
} else {
pushback(); /* x or X */
@@ -5821,20 +5946,20 @@ retry:
case '.':
/* period ends exponent part of floating point number */
if (seen_point || seen_e) {
- gotnumber = TRUE;
+ gotnumber = true;
break;
}
- seen_point = TRUE;
+ seen_point = true;
break;
case 'e':
case 'E':
if (inhex)
break;
if (seen_e) {
- gotnumber = TRUE;
+ gotnumber = true;
break;
}
- seen_e = TRUE;
+ seen_e = true;
if ((c = nextc()) == '-' || c == '+') {
int c2 = nextc();
@@ -5879,7 +6004,7 @@ retry:
break;
default:
done:
- gotnumber = TRUE;
+ gotnumber = true;
}
if (gotnumber)
break;
@@ -5889,19 +6014,46 @@ retry:
tokadd('\0');
yylval = GET_INSTRUCTION(Op_push_i);
- if (! do_traditional && isnondecimal(tokstart, FALSE)) {
+
+ base = 10;
+ if (! do_traditional) {
+ base = get_numbase(tokstart, false);
if (do_lint) {
- if (isdigit((unsigned char) tokstart[1])) /* not an 'x' or 'X' */
+ if (base == 8)
lintwarn("numeric constant `%.*s' treated as octal",
(int) strlen(tokstart)-1, tokstart);
- else if (tokstart[1] == 'x' || tokstart[1] == 'X')
+ else if (base == 16)
lintwarn("numeric constant `%.*s' treated as hexadecimal",
(int) strlen(tokstart)-1, tokstart);
}
- yylval->memory = mk_number(nondec2awknum(tokstart, strlen(tokstart)),
- PERM|NUMCUR|NUMBER);
- } else
- yylval->memory = mk_number(atof(tokstart), PERM|NUMCUR|NUMBER);
+ }
+
+#ifdef HAVE_MPFR
+ if (do_mpfr) {
+ NODE *r;
+
+ if (! seen_point && ! seen_e) {
+ r = mpg_integer();
+ mpg_strtoui(r->mpg_i, tokstart, strlen(tokstart), NULL, base);
+ errno = 0;
+ } else {
+ int tval;
+ r = mpg_float();
+ tval = mpfr_strtofr(r->mpg_numbr, tokstart, NULL, base, ROUND_MODE);
+ errno = 0;
+ IEEE_FMT(r->mpg_numbr, tval);
+ }
+ yylval->memory = r;
+ return lasttok = YNUMBER;
+ }
+#endif
+ if (base != 10)
+ d = nondec2awknum(tokstart, strlen(tokstart));
+ else
+ d = atof(tokstart);
+ yylval->memory = make_number(d);
+ if (d <= INT32_MAX && d >= INT32_MIN && d == (int32_t) d)
+ yylval->memory->flags |= NUMINT;
return lasttok = YNUMBER;
case '&':
@@ -5957,7 +6109,7 @@ retry:
*/
if (! do_traditional && c == '_' && lasttok != '$') {
if ((c = nextc()) == '"') {
- intlstr = TRUE;
+ intlstr = true;
goto string;
}
pushback();
@@ -5978,7 +6130,7 @@ retry:
static int warntab[sizeof(tokentab) / sizeof(tokentab[0])];
int class = tokentab[mid].class;
- if ((class == LEX_INCLUDE || class == LEX_EVAL)
+ if ((class == LEX_INCLUDE || class == LEX_LOAD || class == LEX_EVAL)
&& lasttok != '@')
goto out;
@@ -6009,7 +6161,8 @@ retry:
switch (class) {
case LEX_INCLUDE:
- want_source = TRUE;
+ case LEX_LOAD:
+ want_source = true;
break;
case LEX_EVAL:
if (in_main_context())
@@ -6033,14 +6186,36 @@ retry:
case LEX_WHILE:
case LEX_DO:
case LEX_SWITCH:
- if (! do_profiling)
+ if (! do_pretty_print)
return lasttok = class;
/* fall through */
case LEX_CASE:
yylval = bcalloc(tokentab[mid].value, 2, sourceline);
break;
+ /*
+ * These must be checked here, due to the LALR nature of the parser,
+ * the rules for continue and break may not be reduced until after
+ * a token that increments the xxx_allowed varibles is seen. Bleah.
+ */
+ case LEX_CONTINUE:
+ if (! continue_allowed) {
+ error_ln(sourceline,
+ _("`continue' is not allowed outside a loop"));
+ errcount++;
+ }
+ goto make_instruction;
+
+ case LEX_BREAK:
+ if (! break_allowed) {
+ error_ln(sourceline,
+ _("`break' is not allowed outside a loop or switch"));
+ errcount++;
+ }
+ goto make_instruction;
+
default:
+make_instruction:
yylval = GET_INSTRUCTION(tokentab[mid].value);
if (class == LEX_BUILTIN || class == LEX_LENGTH)
yylval->builtin_idx = mid;
@@ -6055,7 +6230,7 @@ out:
yylval->lextok = tokkey;
return lasttok = FUNC_CALL;
} else {
- static short goto_warned = FALSE;
+ static bool goto_warned = false;
yylval = GET_INSTRUCTION(Op_token);
yylval->lextok = tokkey;
@@ -6063,7 +6238,7 @@ out:
#define SMART_ALECK 1
if (SMART_ALECK && do_lint
&& ! goto_warned && strcasecmp(tokkey, "goto") == 0) {
- goto_warned = TRUE;
+ goto_warned = true;
lintwarn(_("`goto' considered harmful!\n"));
}
return lasttok = NAME;
@@ -6073,23 +6248,6 @@ out:
#undef NEWLINE_EOF
}
-/* mk_symbol --- allocates a symbol for the symbol table. */
-
-NODE *
-mk_symbol(NODETYPE type, NODE *value)
-{
- NODE *r;
-
- getnode(r);
- r->type = type;
- r->flags = MALLOC;
- r->lnode = value;
- r->rnode = NULL;
- r->parent_array = NULL;
- r->var_assign = (Func_ptr) 0;
- return r;
-}
-
/* snode --- instructions for builtin functions. Checks for arg. count
and supplies defaults where possible. */
@@ -6141,7 +6299,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
INSTRUCTION *expr;
expr = list_create(instruction(Op_push_i));
- expr->nexti->memory = mk_number((AWKNUM) 0.0, (PERM|NUMCUR|NUMBER));
+ expr->nexti->memory = make_number(0.0);
(void) mk_expression_list(subn,
list_append(expr, instruction(Op_field_spec)));
}
@@ -6158,10 +6316,10 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
yyerror(_("%s third parameter is not a changeable object"),
operator);
else
- ip->do_reference = TRUE;
+ ip->do_reference = true;
}
- r->expr_count = count_expressions(&subn, FALSE);
+ r->expr_count = count_expressions(&subn, false);
ip = subn->lasti;
(void) list_append(subn, r);
@@ -6185,17 +6343,23 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
r->sub_flags |= GENSUB;
if (nexp == 3) {
ip = instruction(Op_push_i);
- ip->memory = mk_number((AWKNUM) 0.0, (PERM|NUMCUR|NUMBER));
+ ip->memory = make_number(0.0);
(void) mk_expression_list(subn,
list_append(list_create(ip), instruction(Op_field_spec)));
}
- r->expr_count = count_expressions(&subn, FALSE);
+ r->expr_count = count_expressions(&subn, false);
return list_append(subn, r);
}
}
- r->builtin = tokentab[idx].ptr;
+#ifdef HAVE_MPFR
+ /* N.B.: There isn't any special processing for an alternate function below */
+ if (do_mpfr && tokentab[idx].ptr2)
+ r->builtin = tokentab[idx].ptr2;
+ else
+#endif
+ r->builtin = tokentab[idx].ptr;
/* special case processing for a few builtins */
@@ -6208,7 +6372,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
list = list_create(r);
(void) list_prepend(list, instruction(Op_field_spec));
(void) list_prepend(list, instruction(Op_push_i));
- list->nexti->memory = mk_number((AWKNUM) 0.0, (PERM|NUMCUR|NUMBER));
+ list->nexti->memory = make_number(0.0);
return list;
} else {
arg = subn->nexti;
@@ -6220,14 +6384,14 @@ 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_match) {
- static short warned = FALSE;
+ static bool warned = false;
arg = subn->nexti->lasti->nexti; /* 2nd arg list */
(void) mk_rexp(arg);
if (nexp == 3) { /* 3rd argument there */
if (do_lint && ! warned) {
- warned = TRUE;
+ warned = true;
lintwarn(_("match: third argument is a gawk extension"));
}
if (do_traditional) {
@@ -6281,10 +6445,10 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
ip->opcode = Op_push_array;
}
} else if (r->builtin == do_close) {
- static short warned = FALSE;
+ static bool warned = false;
if (nexp == 2) {
if (do_lint && ! warned) {
- warned = TRUE;
+ warned = true;
lintwarn(_("close: second argument is a gawk extension"));
}
if (do_traditional) {
@@ -6336,10 +6500,10 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
if (ip->opcode == Op_push)
ip->opcode = Op_push_array;
}
-#endif
+#endif
if (subn != NULL) {
- r->expr_count = count_expressions(&subn, FALSE);
+ r->expr_count = count_expressions(&subn, false);
return list_append(subn, r);
}
@@ -6347,75 +6511,6 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
return list_create(r);
}
-/* append_param --- append PNAME to the list of parameters
- * for the current function.
- */
-
-static void
-append_param(char *pname)
-{
- static NODE *savetail = NULL;
- NODE *p;
-
- p = make_param(pname);
- if (func_params == NULL) {
- func_params = p;
- savetail = p;
- } else if (savetail != NULL) {
- savetail->rnode = p;
- savetail = p;
- }
-}
-
-/* dup_parms --- return TRUE if there are duplicate parameters */
-
-static int
-dup_parms(INSTRUCTION *fp, NODE *func)
-{
- NODE *np;
- const char *fname, **names;
- int count, i, j, dups;
- NODE *params;
-
- if (func == NULL) /* error earlier */
- return TRUE;
-
- fname = func->param;
- count = func->param_cnt;
- params = func->rnode;
-
- if (count == 0) /* no args, no problem */
- return FALSE;
-
- if (params == NULL) /* error earlier */
- return TRUE;
-
- emalloc(names, const char **, count * sizeof(char *), "dup_parms");
-
- i = 0;
- for (np = params; np != NULL; np = np->rnode) {
- if (np->param == NULL) { /* error earlier, give up, go home */
- efree(names);
- return TRUE;
- }
- names[i++] = np->param;
- }
-
- dups = 0;
- for (i = 1; i < count; i++) {
- for (j = 0; j < i; j++) {
- if (strcmp(names[i], names[j]) == 0) {
- dups++;
- error_ln(fp->source_line,
- _("function `%s': parameter #%d, `%s', duplicates parameter #%d"),
- fname, i + 1, names[j], j+1);
- }
- }
- }
-
- efree(names);
- return (dups > 0 ? TRUE : FALSE);
-}
/* parms_shadow --- check if parameters shadow globals */
@@ -6423,19 +6518,20 @@ static int
parms_shadow(INSTRUCTION *pc, int *shadow)
{
int pcount, i;
- int ret = FALSE;
- NODE *func;
+ bool ret = false;
+ NODE *func, *fp;
char *fname;
func = pc->func_body;
- fname = func->lnode->param;
-
+ fname = func->vname;
+ fp = func->fparms;
+
#if 0 /* can't happen, already exited if error ? */
if (fname == NULL || func == NULL) /* error earlier */
- return FALSE;
+ return false;
#endif
- pcount = func->lnode->param_cnt;
+ pcount = func->param_cnt;
if (pcount == 0) /* no args, no problem */
return 0;
@@ -6447,11 +6543,11 @@ parms_shadow(INSTRUCTION *pc, int *shadow)
* about all shadowed parameters.
*/
for (i = 0; i < pcount; i++) {
- if (lookup(func->parmlist[i]) != NULL) {
+ if (lookup(fp[i].param) != NULL) {
warning(
_("function `%s': parameter `%s' shadows global variable"),
- fname, func->parmlist[i]);
- ret = TRUE;
+ fname, fp[i].param);
+ ret = true;
}
}
@@ -6459,143 +6555,41 @@ parms_shadow(INSTRUCTION *pc, int *shadow)
return 0;
}
-
-/*
- * install_symbol:
- * Install a name in the symbol table, even if it is already there.
- * Caller must check against redefinition if that is desired.
- */
-
-
-NODE *
-install_symbol(char *name, NODE *value)
-{
- NODE *hp;
- size_t len;
- int bucket;
-
- if (install_func)
- (*install_func)(name);
-
- var_count++;
- len = strlen(name);
- bucket = hash(name, len, (unsigned long) HASHSIZE, NULL);
- getnode(hp);
- hp->type = Node_hashnode;
- hp->hnext = variables[bucket];
- variables[bucket] = hp;
- hp->hlength = len;
- hp->hvalue = value;
- hp->hname = name;
- hp->hvalue->vname = name;
- return hp->hvalue;
-}
-
-/* lookup --- find the most recent hash node for name installed by install_symbol */
-
-NODE *
-lookup(const char *name)
-{
- NODE *bucket;
- size_t len;
-
- len = strlen(name);
- for (bucket = variables[hash(name, len, (unsigned long) HASHSIZE, NULL)];
- bucket != NULL; bucket = bucket->hnext)
- if (bucket->hlength == len && strncmp(bucket->hname, name, len) == 0)
- return bucket->hvalue;
- return NULL;
-}
-
-/* sym_comp --- compare two symbol (variable or function) names */
-
-static int
-sym_comp(const void *v1, const void *v2)
-{
- const NODE *const *npp1, *const *npp2;
- const NODE *n1, *n2;
- int minlen;
-
- npp1 = (const NODE *const *) v1;
- npp2 = (const NODE *const *) v2;
- n1 = *npp1;
- n2 = *npp2;
-
- if (n1->hlength > n2->hlength)
- minlen = n1->hlength;
- else
- minlen = n2->hlength;
-
- return strncmp(n1->hname, n2->hname, minlen);
-}
-
/* valinfo --- dump var info */
void
-valinfo(NODE *n, int (*print_func)(FILE *, const char *, ...), FILE *fp)
+valinfo(NODE *n, Func_print print_func, FILE *fp)
{
if (n == Nnull_string)
print_func(fp, "uninitialized scalar\n");
else if (n->flags & STRING) {
- pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', FALSE);
+ pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', false);
print_func(fp, "\n");
- } else if (n->flags & NUMBER)
+ } else if (n->flags & NUMBER) {
+#ifdef HAVE_MPFR
+ if (is_mpg_float(n))
+ print_func(fp, "%s\n", mpg_fmt("%.17R*g", ROUND_MODE, n->mpg_numbr));
+ else if (is_mpg_integer(n))
+ print_func(fp, "%s\n", mpg_fmt("%Zd", n->mpg_i));
+ else
+#endif
print_func(fp, "%.17g\n", n->numbr);
- else if (n->flags & STRCUR) {
- pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', FALSE);
+ } else if (n->flags & STRCUR) {
+ pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', false);
print_func(fp, "\n");
- } else if (n->flags & NUMCUR)
+ } else if (n->flags & NUMCUR) {
+#ifdef HAVE_MPFR
+ if (is_mpg_float(n))
+ print_func(fp, "%s\n", mpg_fmt("%.17R*g", ROUND_MODE, n->mpg_numbr));
+ else if (is_mpg_integer(n))
+ print_func(fp, "%s\n", mpg_fmt("%Zd", n->mpg_i));
+ else
+#endif
print_func(fp, "%.17g\n", n->numbr);
- else
+ } else
print_func(fp, "?? flags %s\n", flags2str(n->flags));
}
-/* get_varlist --- list of global variables */
-
-NODE **
-get_varlist()
-{
- int i, j;
- NODE **table;
- NODE *p;
-
- emalloc(table, NODE **, (var_count + 1) * sizeof(NODE *), "get_varlist");
- update_global_values();
- for (i = j = 0; i < HASHSIZE; i++)
- for (p = variables[i]; p != NULL; p = p->hnext)
- table[j++] = p;
- assert(j == var_count);
-
- /* Shazzam! */
- qsort(table, j, sizeof(NODE *), sym_comp);
-
- table[j] = NULL;
- return table;
-}
-
-/* print_vars --- print names and values of global variables */
-
-void
-print_vars(int (*print_func)(FILE *, const char *, ...), FILE *fp)
-{
- int i;
- NODE **table;
- NODE *p;
-
- table = get_varlist();
- for (i = 0; (p = table[i]) != NULL; i++) {
- if (p->hvalue->type == Node_func)
- continue;
- print_func(fp, "%.*s: ", (int) p->hlength, p->hname);
- if (p->hvalue->type == Node_var_array)
- print_func(fp, "array, %ld elements\n", p->hvalue->table_size);
- else if (p->hvalue->type == Node_var_new)
- print_func(fp, "untyped variable\n");
- else if (p->hvalue->type == Node_var)
- valinfo(p->hvalue->var_value, print_func, fp);
- }
- efree(table);
-}
/* dump_vars --- dump the symbol table */
@@ -6603,6 +6597,7 @@ void
dump_vars(const char *fname)
{
FILE *fp;
+ NODE **vars;
if (fname == NULL)
fp = stderr;
@@ -6612,228 +6607,195 @@ dump_vars(const char *fname)
fp = stderr;
}
- print_vars(fprintf, fp);
+ vars = variable_list();
+ print_vars(vars, fprintf, fp);
+ efree(vars);
if (fp != stderr && fclose(fp) != 0)
warning(_("%s: close failed (%s)"), fname, strerror(errno));
}
-/* release_all_vars --- free all variable memory */
-
-void
-release_all_vars()
-{
- int i;
- NODE *p, *next;
-
- for (i = 0; i < HASHSIZE; i++) {
- for (p = variables[i]; p != NULL; p = next) {
- next = p->hnext;
-
- if (p->hvalue->type == Node_func)
- continue;
- else if (p->hvalue->type == Node_var_array)
- assoc_clear(p->hvalue);
- else if (p->hvalue->type != Node_var_new)
- unref(p->hvalue->var_value);
-
- efree(p->hname);
- freenode(p->hvalue);
- freenode(p);
- }
- }
-}
-
/* dump_funcs --- print all functions */
void
dump_funcs()
{
- if (func_count <= 0)
- return;
-
- (void) foreach_func((int (*)(INSTRUCTION *, void *)) pp_func, TRUE, (void *) 0);
+ NODE **funcs;
+ funcs = function_list(true);
+ (void) foreach_func(funcs, (int (*)(INSTRUCTION *, void *)) pp_func, (void *) 0);
+ efree(funcs);
}
+
/* shadow_funcs --- check all functions for parameters that shadow globals */
void
shadow_funcs()
{
static int calls = 0;
- int shadow = FALSE;
-
- if (func_count <= 0)
- return;
+ bool shadow = false;
+ NODE **funcs;
if (calls++ != 0)
fatal(_("shadow_funcs() called twice!"));
- (void) foreach_func((int (*)(INSTRUCTION *, void *)) parms_shadow, TRUE, &shadow);
+ funcs = function_list(true);
+ (void) foreach_func(funcs, (int (*)(INSTRUCTION *, void *)) parms_shadow, & shadow);
+ efree(funcs);
/* End with fatal if the user requested it. */
if (shadow && lintfunc != warning)
lintwarn(_("there were shadowed variables."));
}
-/*
- * func_install:
- * check if name is already installed; if so, it had better have Null value,
- * in which case def is added as the value. Otherwise, install name with def
- * as value.
- *
- * Extra work, build up and save a list of the parameter names in a table
- * and hang it off params->parmlist. This is used to set the `vname' field
- * of each function parameter during a function call. See eval.c.
+
+/* mk_function --- finalize function definition node; remove parameters
+ * out of the symbol table.
*/
-static int
-func_install(INSTRUCTION *func, INSTRUCTION *def)
+static INSTRUCTION *
+mk_function(INSTRUCTION *fi, INSTRUCTION *def)
{
- NODE *params;
- NODE *r, *n, *thisfunc, *hp;
- char **pnames = NULL;
- char *fname;
- int pcount = 0;
- int i;
+ NODE *thisfunc;
- params = func_params;
+ thisfunc = fi->func_body;
+ assert(thisfunc != NULL);
- /* check for function foo(foo) { ... }. bleah. */
- for (n = params->rnode; n != NULL; n = n->rnode) {
- if (strcmp(n->param, params->param) == 0) {
- error_ln(func->source_line,
- _("function `%s': can't use function name as parameter name"), params->param);
- return -1;
- } else if (is_std_var(n->param)) {
- error_ln(func->source_line,
- _("function `%s': can't use special variable `%s' as a function parameter"),
- params->param, n->param);
- return -1;
- }
- }
+ if (do_optimize > 1 && def->lasti->opcode == Op_pop) {
+ /* tail call which does not return any value. */
- thisfunc = NULL; /* turn off warnings */
+ INSTRUCTION *t;
- fname = params->param;
- /* symbol table management */
- hp = remove_symbol(params->param); /* remove function name out of symbol table */
- if (hp != NULL)
- freenode(hp);
- r = lookup(fname);
- if (r != NULL) {
- error_ln(func->source_line,
- _("function name `%s' previously defined"), fname);
- return -1;
- } else if (fname == builtin_func) /* not a valid function name */
- goto remove_params;
+ for (t = def->nexti; t->nexti != def->lasti; t = t->nexti)
+ ;
+ if (t->opcode == Op_func_call
+ && strcmp(t->func_name, thisfunc->vname) == 0)
+ (t + 1)->tail_call = true;
+ }
/* add an implicit return at end;
* also used by 'return' command in debugger
*/
-
+
(void) list_append(def, instruction(Op_push_i));
- def->lasti->memory = Nnull_string;
+ def->lasti->memory = dupnode(Nnull_string);
(void) list_append(def, instruction(Op_K_return));
- if (do_profiling)
+ if (do_pretty_print)
(void) list_prepend(def, instruction(Op_exec_count));
- /* func->opcode is Op_func */
- (func + 1)->firsti = def->nexti;
- (func + 1)->lasti = def->lasti;
- (func + 2)->first_line = func->source_line;
- (func + 2)->last_line = lastline;
-
- func->nexti = def->nexti;
+ /* fi->opcode = Op_func */
+ (fi + 1)->firsti = def->nexti;
+ (fi + 1)->lasti = def->lasti;
+ (fi + 2)->first_line = fi->source_line;
+ (fi + 2)->last_line = lastline;
+ fi->nexti = def->nexti;
bcfree(def);
- (void) list_append(rule_list, func + 1); /* debugging */
-
- /* install the function */
- thisfunc = mk_symbol(Node_func, params);
- (void) install_symbol(fname, thisfunc);
- thisfunc->code_ptr = func;
- func->func_body = thisfunc;
-
- for (n = params->rnode; n != NULL; n = n->rnode)
- pcount++;
-
- if (pcount != 0) {
- emalloc(pnames, char **, (pcount + 1) * sizeof(char *), "func_install");
- for (i = 0, n = params->rnode; i < pcount; i++, n = n->rnode)
- pnames[i] = n->param;
- pnames[pcount] = NULL;
- }
- thisfunc->parmlist = pnames;
+ (void) list_append(rule_list, fi + 1); /* debugging */
/* update lint table info */
- func_use(fname, FUNC_DEFINE);
-
- func_count++; /* used in profiler / pretty printer */
+ func_use(thisfunc->vname, FUNC_DEFINE);
-remove_params:
/* remove params from symbol table */
- pop_params(params->rnode);
- return 0;
+ remove_params(thisfunc);
+ return fi;
}
-/* remove_symbol --- remove a variable from the symbol table */
+/*
+ * install_function:
+ * install function name in the symbol table.
+ * Extra work, build up and install a list of the parameter names.
+ */
-NODE *
-remove_symbol(char *name)
+static int
+install_function(char *fname, INSTRUCTION *fi, INSTRUCTION *plist)
{
- NODE *bucket, **save;
- size_t len;
+ NODE *r, *f;
+ int pcount = 0;
- len = strlen(name);
- save = &(variables[hash(name, len, (unsigned long) HASHSIZE, NULL)]);
- for (bucket = *save; bucket != NULL; bucket = bucket->hnext) {
- if (len == bucket->hlength && strncmp(bucket->hname, name, len) == 0) {
- var_count--;
- *save = bucket->hnext;
- return bucket;
- }
- save = &(bucket->hnext);
+ r = lookup(fname);
+ if (r != NULL) {
+ error_ln(fi->source_line, _("function name `%s' previously defined"), fname);
+ return -1;
}
- return NULL;
+
+ if (plist != NULL)
+ pcount = plist->lasti->param_count + 1;
+ f = install_symbol(fname, Node_func);
+ fi->func_body = f;
+ f->param_cnt = pcount;
+ f->code_ptr = fi;
+ f->fparms = NULL;
+ if (pcount > 0) {
+ char **pnames;
+ pnames = check_params(fname, pcount, plist); /* frees plist */
+ f->fparms = make_params(pnames, pcount);
+ efree(pnames);
+ install_params(f);
+ }
+ return 0;
}
-/* pop_params --- remove list of function parameters from symbol table */
-/*
- * pop parameters out of the symbol table. do this in reverse order to
- * avoid reading freed memory if there were duplicated parameters.
+/* check_params --- build a list of function parameter names after
+ * making sure that the names are valid and there are no duplicates.
*/
-static void
-pop_params(NODE *params)
+
+static char **
+check_params(char *fname, int pcount, INSTRUCTION *list)
{
- NODE *hp;
- if (params == NULL)
- return;
- pop_params(params->rnode);
- hp = remove_symbol(params->param);
- if (hp != NULL)
- freenode(hp);
-}
+ INSTRUCTION *p, *np;
+ int i, j;
+ char *name;
+ char **pnames;
-/* make_param --- make NAME into a function parameter */
+ assert(pcount > 0);
-static NODE *
-make_param(char *name)
-{
- NODE *r;
+ emalloc(pnames, char **, pcount * sizeof(char *), "check_params");
- getnode(r);
- r->type = Node_param_list;
- r->rnode = NULL;
- r->param_cnt = param_counter++;
- return (install_symbol(name, r));
+ for (i = 0, p = list->nexti; p != NULL; i++, p = np) {
+ np = p->nexti;
+ name = p->lextok;
+ p->lextok = NULL;
+
+ if (strcmp(name, fname) == 0) {
+ /* check for function foo(foo) { ... }. bleah. */
+ error_ln(p->source_line,
+ _("function `%s': can't use function name as parameter name"), fname);
+ } else if (is_std_var(name)) {
+ error_ln(p->source_line,
+ _("function `%s': can't use special variable `%s' as a function parameter"),
+ fname, name);
+ }
+
+ /* check for duplicate parameters */
+ for (j = 0; j < i; j++) {
+ if (strcmp(name, pnames[j]) == 0) {
+ error_ln(p->source_line,
+ _("function `%s': parameter #%d, `%s', duplicates parameter #%d"),
+ fname, i + 1, name, j + 1);
+ }
+ }
+
+ pnames[i] = name;
+ bcfree(p);
+ }
+ bcfree(list);
+
+ return pnames;
}
+
+#ifdef HASHSIZE
+undef HASHSIZE
+#endif
+#define HASHSIZE 1021
+
static struct fdesc {
char *name;
short used;
short defined;
+ short extension;
struct fdesc *next;
} *ftable[HASHSIZE];
@@ -6853,7 +6815,10 @@ func_use(const char *name, enum defref how)
if (strcmp(fp->name, name) == 0) {
if (how == FUNC_DEFINE)
fp->defined++;
- else
+ else if (how == FUNC_EXT) {
+ fp->defined++;
+ fp->extension++;
+ } else
fp->used++;
return;
}
@@ -6867,12 +6832,23 @@ func_use(const char *name, enum defref how)
strcpy(fp->name, name);
if (how == FUNC_DEFINE)
fp->defined++;
- else
+ else if (how == FUNC_EXT) {
+ fp->defined++;
+ fp->extension++;
+ } else
fp->used++;
fp->next = ftable[ind];
ftable[ind] = fp;
}
+/* track_ext_func --- add an extension function to the table */
+
+void
+track_ext_func(const char *name)
+{
+ func_use(name, FUNC_EXT);
+}
+
/* check_funcs --- verify functions that are called but not defined */
static void
@@ -6886,19 +6862,19 @@ check_funcs()
for (i = 0; i < HASHSIZE; i++) {
for (fp = ftable[i]; fp != NULL; fp = fp->next) {
+ if (fp->defined == 0 && ! fp->extension) {
#ifdef REALLYMEAN
- /* making this the default breaks old code. sigh. */
- if (fp->defined == 0) {
+ /* making this the default breaks old code. sigh. */
error(
_("function `%s' called but never defined"), fp->name);
errcount++;
- }
#else
- if (do_lint && fp->defined == 0)
lintwarn(
_("function `%s' called but never defined"), fp->name);
#endif
- if (do_lint && fp->used == 0) {
+ }
+
+ if (do_lint && fp->used == 0 && ! fp->extension) {
lintwarn(_("function `%s' defined but never called directly"),
fp->name);
}
@@ -6937,69 +6913,6 @@ param_sanity(INSTRUCTION *arglist)
}
}
-/* foreach_func --- execute given function for each awk function in symbol table. */
-
-int
-foreach_func(int (*pfunc)(INSTRUCTION *, void *), int sort, void *data)
-{
- int i, j;
- NODE *p;
- int ret = 0;
-
- if (sort) {
- NODE **tab;
-
- /*
- * Walk through symbol table counting functions.
- * Could be more than func_count if there are
- * extension functions.
- */
- for (i = j = 0; i < HASHSIZE; i++) {
- for (p = variables[i]; p != NULL; p = p->hnext) {
- if (p->hvalue->type == Node_func) {
- j++;
- }
- }
- }
-
- if (j == 0)
- return 0;
-
- emalloc(tab, NODE **, j * sizeof(NODE *), "foreach_func");
-
- /* now walk again, copying info */
- for (i = j = 0; i < HASHSIZE; i++) {
- for (p = variables[i]; p != NULL; p = p->hnext) {
- if (p->hvalue->type == Node_func) {
- tab[j] = p;
- j++;
- }
- }
- }
-
- /* Shazzam! */
- qsort(tab, j, sizeof(NODE *), sym_comp);
-
- for (i = 0; i < j; i++) {
- if ((ret = pfunc(tab[i]->hvalue->code_ptr, data)) != 0)
- break;
- }
-
- efree(tab);
- return ret;
- }
-
- /* unsorted */
- for (i = 0; i < HASHSIZE; i++) {
- for (p = variables[i]; p != NULL; p = p->hnext) {
- if (p->hvalue->type == Node_func
- && (ret = pfunc(p->hvalue->code_ptr, data)) != 0)
- return ret;
- }
- }
- return 0;
-}
-
/* deferred variables --- those that are only defined if needed. */
/*
@@ -7034,31 +6947,26 @@ register_deferred_variable(const char *name, NODE *(*load_func)(void))
/* variable --- make sure NAME is in the symbol table */
NODE *
-variable(char *name, NODETYPE type)
+variable(int location, char *name, NODETYPE type)
{
NODE *r;
if ((r = lookup(name)) != NULL) {
- if (r->type == Node_func) {
- error(_("function `%s' called with space between name and `(',\nor used as a variable or an array"),
+ if (r->type == Node_func || r->type == Node_ext_func )
+ error_ln(location, _("function `%s' called with space between name and `(',\nor used as a variable or an array"),
r->vname);
- errcount++;
- r->type = Node_var_new; /* continue parsing instead of exiting */
- }
+ if (r == symbol_table)
+ symtab_used = true;
} else {
/* not found */
struct deferred_variable *dv;
- for (dv = deferred_variables; TRUE; dv = dv->next) {
+ for (dv = deferred_variables; true; dv = dv->next) {
if (dv == NULL) {
- /*
- * This is the only case in which we may not free the string.
- */
- if (type == Node_var)
- r = mk_symbol(type, Nnull_string);
- else
- r = mk_symbol(type, (NODE *) NULL);
- return install_symbol(name, r);
+ /*
+ * This is the only case in which we may not free the string.
+ */
+ return install_symbol(name, type);
}
if (strcmp(name, dv->name) == 0) {
r = (*dv->load_func)();
@@ -7070,6 +6978,21 @@ variable(char *name, NODETYPE type)
return r;
}
+/* process_deferred --- if the program uses SYMTAB, load deferred variables */
+
+static void
+process_deferred()
+{
+ struct deferred_variable *dv;
+
+ if (! symtab_used)
+ return;
+
+ for (dv = deferred_variables; dv != NULL; dv = dv->next) {
+ (void) dv->load_func();
+ }
+}
+
/* make_regnode --- make a regular expression node */
static NODE *
@@ -7083,7 +7006,7 @@ make_regnode(int type, NODE *exp)
n->re_cnt = 1;
if (type == Node_regex) {
- n->re_reg = make_regexp(exp->stptr, exp->stlen, FALSE, TRUE, FALSE);
+ n->re_reg = make_regexp(exp->stptr, exp->stlen, false, true, false);
if (n->re_reg == NULL) {
freenode(n);
return NULL;
@@ -7150,12 +7073,12 @@ isnoeffect(OPCODE type)
case Op_match_rec:
case Op_not:
case Op_in_array:
- return TRUE;
+ return true;
default:
break; /* keeps gcc -Wall happy */
}
- return FALSE;
+ return false;
}
/* make_assignable --- make this operand an assignable one if posiible */
@@ -7165,9 +7088,6 @@ make_assignable(INSTRUCTION *ip)
{
switch (ip->opcode) {
case Op_push:
- if (ip->memory->type == Node_param_list
- && (ip->memory->flags & FUNC) != 0)
- return NULL;
ip->opcode = Op_push_lhs;
return ip;
case Op_field_spec:
@@ -7187,7 +7107,7 @@ make_assignable(INSTRUCTION *ip)
NODE *
stopme(int nargs ATTRIBUTE_UNUSED)
{
- return (NODE *) 0;
+ return make_number(0.0);
}
/* dumpintlstr --- write out an initial .po file entry for the string */
@@ -7207,7 +7127,7 @@ dumpintlstr(const char *str, size_t len)
}
printf("msgid ");
- pp_string_fp(fprintf, stdout, str, len, '"', TRUE);
+ pp_string_fp(fprintf, stdout, str, len, '"', true);
putchar('\n');
printf("msgstr \"\"\n\n");
fflush(stdout);
@@ -7230,36 +7150,15 @@ dumpintlstr2(const char *str1, size_t len1, const char *str2, size_t len2)
}
printf("msgid ");
- pp_string_fp(fprintf, stdout, str1, len1, '"', TRUE);
+ pp_string_fp(fprintf, stdout, str1, len1, '"', true);
putchar('\n');
printf("msgid_plural ");
- pp_string_fp(fprintf, stdout, str2, len2, '"', TRUE);
+ pp_string_fp(fprintf, stdout, str2, len2, '"', true);
putchar('\n');
printf("msgstr[0] \"\"\nmsgstr[1] \"\"\n\n");
fflush(stdout);
}
-/* isarray --- can this type be subscripted? */
-
-static int
-isarray(NODE *n)
-{
- switch (n->type) {
- case Node_var_new:
- case Node_var_array:
- return TRUE;
- case Node_param_list:
- return (n->flags & FUNC) == 0;
- case Node_array_ref:
- cant_happen();
- break;
- default:
- break; /* keeps gcc -Wall happy */
- }
-
- return FALSE;
-}
-
/* mk_binary --- instructions for binary operators */
static INSTRUCTION *
@@ -7274,11 +7173,11 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION *op)
ip1 = s1->nexti;
if (do_optimize > 1
&& ip1 == s1->lasti && ip1->opcode == Op_push_i
- && (ip1->memory->flags & (STRCUR|STRING)) == 0
- && (ip2->memory->flags & (STRCUR|STRING)) == 0
+ && (ip1->memory->flags & (MPFN|MPZN|STRCUR|STRING)) == 0
+ && (ip2->memory->flags & (MPFN|MPZN|STRCUR|STRING)) == 0
) {
NODE *n1 = ip1->memory, *n2 = ip2->memory;
- res = force_number(n1);
+ res = force_number(n1)->numbr;
(void) force_number(n2);
switch (op->opcode) {
case Op_times:
@@ -7320,11 +7219,7 @@ mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION *op)
}
op->opcode = Op_push_i;
- op->memory = mk_number(res, (PERM|NUMCUR|NUMBER));
- n1->flags &= ~PERM;
- n1->flags |= MALLOC;
- n2->flags &= ~PERM;
- n2->flags |= MALLOC;
+ op->memory = make_number(res);
unref(n1);
unref(n2);
bcfree(ip1);
@@ -7450,7 +7345,7 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch,
if (false_branch == NULL) {
false_branch = list_create(instruction(Op_no_op));
if (elsep != NULL) { /* else { } */
- if (do_profiling)
+ if (do_pretty_print)
(void) list_prepend(false_branch, elsep);
else
bcfree(elsep);
@@ -7461,7 +7356,7 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch,
/* avoid a series of no_op's: if .. else if .. else if .. */
if (false_branch->lasti->opcode != Op_no_op)
(void) list_append(false_branch, instruction(Op_no_op));
- if (do_profiling) {
+ if (do_pretty_print) {
(void) list_prepend(false_branch, elsep);
false_branch->nexti->branch_end = false_branch->lasti;
(void) list_prepend(false_branch, instruction(Op_exec_count));
@@ -7476,7 +7371,7 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch,
ip = list_append(cond, instruction(Op_jmp_false));
ip->lasti->target_jmp = false_branch->nexti->nexti;
- if (do_profiling) {
+ if (do_pretty_print) {
(void) list_prepend(ip, ifp);
(void) list_append(ip, instruction(Op_exec_count));
ip->nexti->branch_if = ip->lasti;
@@ -7538,7 +7433,7 @@ append_rule(INSTRUCTION *pattern, INSTRUCTION *action)
if (rule != Rule) {
rp = pattern;
- if (do_profiling)
+ if (do_pretty_print)
(void) list_append(action, instruction(Op_no_op));
(rp + 1)->firsti = action->nexti;
(rp + 1)->lasti = action->lasti;
@@ -7554,7 +7449,7 @@ append_rule(INSTRUCTION *pattern, INSTRUCTION *action)
if (pattern == NULL) {
/* assert(action != NULL); */
- if (do_profiling)
+ if (do_pretty_print)
(void) list_prepend(action, instruction(Op_exec_count));
(rp + 1)->firsti = action->nexti;
(rp + 1)->lasti = tp;
@@ -7570,12 +7465,12 @@ append_rule(INSTRUCTION *pattern, INSTRUCTION *action)
if (action == NULL) {
(rp + 2)->last_line = find_line(pattern, LAST_LINE);
action = list_create(instruction(Op_K_print_rec));
- if (do_profiling)
+ if (do_pretty_print)
(void) list_prepend(action, instruction(Op_exec_count));
} else
(rp + 2)->last_line = lastline;
- if (do_profiling) {
+ if (do_pretty_print) {
(void) list_prepend(pattern, instruction(Op_exec_count));
(void) list_prepend(action, instruction(Op_exec_count));
}
@@ -7636,7 +7531,7 @@ mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op)
&& tp->memory->type == Node_var
&& tp->memory->var_assign
) {
- tp->do_reference = FALSE; /* no uninitialized reference checking
+ tp->do_reference = false; /* no uninitialized reference checking
* for a special variable.
*/
(void) list_append(ip, instruction(Op_var_assign));
@@ -7655,9 +7550,7 @@ mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op)
static INSTRUCTION *
optimize_assignment(INSTRUCTION *exp)
{
- INSTRUCTION *i1;
- INSTRUCTION *i2;
- INSTRUCTION *i3;
+ INSTRUCTION *i1, *i2, *i3;
/*
* Optimize assignment statements array[subs] = x; var = x; $n = x;
@@ -7693,7 +7586,7 @@ optimize_assignment(INSTRUCTION *exp)
if ( ! do_optimize
|| ( i1->opcode != Op_assign
&& i1->opcode != Op_field_assign)
- )
+ )
return list_append(exp, instruction(Op_pop));
for (i2 = exp->nexti; i2 != i1; i2 = i2->nexti) {
@@ -7778,13 +7671,26 @@ optimize_assignment(INSTRUCTION *exp)
case Op_push_lhs:
if (i2->nexti == i1
- && i1->opcode == Op_assign
+ && i1->opcode == Op_assign
) {
/* var = .. */
i2->opcode = Op_store_var;
i2->nexti = NULL;
bcfree(i1); /* Op_assign */
exp->lasti = i2; /* update Op_list */
+
+ i3 = exp->nexti;
+ if (i3->opcode == Op_push_i
+ && (i3->memory->flags & INTLSTR) == 0
+ && i3->nexti == i2
+ ) {
+ /* constant initializer */
+ i2->initval = i3->memory;
+ bcfree(i3);
+ exp->nexti = i2;
+ } else
+ i2->initval = NULL;
+
return exp;
}
break;
@@ -7854,7 +7760,7 @@ mk_getline(INSTRUCTION *op, INSTRUCTION *var, INSTRUCTION *redir, int redirtype)
else
ip = list_create(op);
op->into_var = (var != NULL);
- op->redir_type = (redir != NULL) ? redirtype : 0;
+ op->redir_type = (redir != NULL) ? redirtype : redirect_none;
return (asgn == NULL ? ip : list_append(ip, asgn));
}
@@ -7905,7 +7811,7 @@ mk_for_loop(INSTRUCTION *forp, INSTRUCTION *init, INSTRUCTION *cond,
if (init != NULL)
ip = list_merge(init, ip);
- if (do_profiling) {
+ if (do_pretty_print) {
(void) list_append(ip, instruction(Op_exec_count));
(forp + 1)->forloop_cond = pp_cond;
(forp + 1)->forloop_body = ip->lasti;
@@ -7927,7 +7833,7 @@ mk_for_loop(INSTRUCTION *forp, INSTRUCTION *init, INSTRUCTION *cond,
ret = list_append(ip, tbreak);
fix_break_continue(ret, tbreak, tcont);
- if (do_profiling) {
+ if (do_pretty_print) {
forp->target_break = tbreak;
forp->target_continue = tcont;
ret = list_prepend(ret, forp);
@@ -8028,7 +7934,7 @@ mk_expression_list(INSTRUCTION *list, INSTRUCTION *s1)
*/
static int
-count_expressions(INSTRUCTION **list, int isarg)
+count_expressions(INSTRUCTION **list, bool isarg)
{
INSTRUCTION *expr;
INSTRUCTION *r = NULL;
@@ -8086,320 +7992,6 @@ fix_break_continue(INSTRUCTION *list, INSTRUCTION *b_target, INSTRUCTION *c_targ
}
}
-
-/* append_symbol --- append symbol to the list of symbols
- * installed in the symbol table.
- */
-
-void
-append_symbol(char *name)
-{
- NODE *hp;
-
- /* N.B.: func_install removes func name and reinstalls it;
- * and we get two entries for it here!. destroy_symbol()
- * will find and destroy the Node_func which is what we want.
- */
-
- getnode(hp);
- hp->hname = name; /* shallow copy */
- hp->hnext = symbol_list->hnext;
- symbol_list->hnext = hp;
-}
-
-/* release_symbol --- free symbol list and optionally remove symbol from symbol table */
-
-void
-release_symbols(NODE *symlist, int keep_globals)
-{
- NODE *hp, *n;
-
- for (hp = symlist->hnext; hp != NULL; hp = n) {
- if (! keep_globals) {
- /* destroys globals, function, and params
- * if still in symbol table and not removed by func_install
- * due to syntax error.
- */
- destroy_symbol(hp->hname);
- }
- n = hp->hnext;
- freenode(hp);
- }
- symlist->hnext = NULL;
-}
-
-/* destroy_symbol --- remove a symbol from symbol table
-* and free all associated memory.
-*/
-
-void
-destroy_symbol(char *name)
-{
- NODE *symbol, *hp;
-
- symbol = lookup(name);
- if (symbol == NULL)
- return;
-
- if (symbol->type == Node_func) {
- char **varnames;
- NODE *func, *n;
-
- func = symbol;
- varnames = func->parmlist;
- if (varnames != NULL)
- efree(varnames);
-
- /* function parameters of type Node_param_list */
- for (n = func->lnode->rnode; n != NULL; ) {
- NODE *np;
- np = n->rnode;
- efree(n->param);
- freenode(n);
- n = np;
- }
- freenode(func->lnode);
- func_count--;
-
- } else if (symbol->type == Node_var_array)
- assoc_clear(symbol);
- else if (symbol->type == Node_var)
- unref(symbol->var_value);
-
- /* remove from symbol table */
- hp = remove_symbol(name);
- efree(hp->hname);
- freenode(hp->hvalue);
- freenode(hp);
-}
-
-#define pool_size d.dl
-#define freei x.xi
-static INSTRUCTION *pool_list;
-static AWK_CONTEXT *curr_ctxt = NULL;
-
-/* new_context --- create a new execution context. */
-
-AWK_CONTEXT *
-new_context()
-{
- AWK_CONTEXT *ctxt;
-
- emalloc(ctxt, AWK_CONTEXT *, sizeof(AWK_CONTEXT), "new_context");
- memset(ctxt, 0, sizeof(AWK_CONTEXT));
- ctxt->srcfiles.next = ctxt->srcfiles.prev = &ctxt->srcfiles;
- ctxt->rule_list.opcode = Op_list;
- ctxt->rule_list.lasti = &ctxt->rule_list;
- return ctxt;
-}
-
-/* set_context --- change current execution context. */
-
-static void
-set_context(AWK_CONTEXT *ctxt)
-{
- pool_list = &ctxt->pools;
- symbol_list = &ctxt->symbols;
- srcfiles = &ctxt->srcfiles;
- rule_list = &ctxt->rule_list;
- install_func = ctxt->install_func;
- curr_ctxt = ctxt;
-}
-
-/*
- * push_context:
- *
- * Switch to the given context after saving the current one. The set
- * of active execution contexts forms a stack; the global or main context
- * is at the bottom of the stack.
- */
-
-void
-push_context(AWK_CONTEXT *ctxt)
-{
- ctxt->prev = curr_ctxt;
- /* save current source and sourceline */
- if (curr_ctxt != NULL) {
- curr_ctxt->sourceline = sourceline;
- curr_ctxt->source = source;
- }
- sourceline = 0;
- source = NULL;
- set_context(ctxt);
-}
-
-/* pop_context --- switch to previous execution context. */
-
-void
-pop_context()
-{
- AWK_CONTEXT *ctxt;
-
- assert(curr_ctxt != NULL);
- ctxt = curr_ctxt->prev;
- /* restore source and sourceline */
- sourceline = ctxt->sourceline;
- source = ctxt->source;
- set_context(ctxt);
-}
-
-/* in_main_context --- are we in the main context ? */
-
-int
-in_main_context()
-{
- assert(curr_ctxt != NULL);
- return (curr_ctxt->prev == NULL);
-}
-
-/* free_context --- free context structure and related data. */
-
-void
-free_context(AWK_CONTEXT *ctxt, int keep_globals)
-{
- SRCFILE *s, *sn;
-
- if (ctxt == NULL)
- return;
-
- assert(curr_ctxt != ctxt);
-
- /* free all code including function codes */
- free_bcpool(&ctxt->pools);
- /* free symbols */
- release_symbols(&ctxt->symbols, keep_globals);
- /* free srcfiles */
- for (s = &ctxt->srcfiles; s != &ctxt->srcfiles; s = sn) {
- sn = s->next;
- if (s->stype != SRC_CMDLINE && s->stype != SRC_STDIN)
- efree(s->fullpath);
- efree(s->src);
- efree(s);
- }
- efree(ctxt);
-}
-
-/* free_bc_internal --- free internal memory of an instruction. */
-
-static void
-free_bc_internal(INSTRUCTION *cp)
-{
- NODE *m;
-
- switch(cp->opcode) {
- case Op_func_call:
- if (cp->func_name != NULL
- && cp->func_name != builtin_func
- )
- efree(cp->func_name);
- break;
- case Op_push_re:
- case Op_match_rec:
- case Op_match:
- case Op_nomatch:
- m = cp->memory;
- if (m->re_reg != NULL)
- refree(m->re_reg);
- if (m->re_exp != NULL)
- unref(m->re_exp);
- if (m->re_text != NULL)
- unref(m->re_text);
- freenode(m);
- break;
- case Op_token: /* token lost during error recovery in yyparse */
- if (cp->lextok != NULL)
- efree(cp->lextok);
- break;
- case Op_illegal:
- cant_happen();
- default:
- break;
- }
-}
-
-
-/* INSTR_CHUNK must be > largest code size (3) */
-#define INSTR_CHUNK 127
-
-/* bcfree --- deallocate instruction */
-
-void
-bcfree(INSTRUCTION *cp)
-{
- cp->opcode = 0;
- cp->nexti = pool_list->freei;
- pool_list->freei = cp;
-}
-
-/* bcalloc --- allocate a new instruction */
-
-INSTRUCTION *
-bcalloc(OPCODE op, int size, int srcline)
-{
- INSTRUCTION *cp;
-
- if (size > 1) {
- /* wide instructions Op_rule, Op_func_call .. */
- emalloc(cp, INSTRUCTION *, (size + 1) * sizeof(INSTRUCTION), "bcalloc");
- cp->pool_size = size;
- cp->nexti = pool_list->nexti;
- pool_list->nexti = cp++;
- } else {
- INSTRUCTION *pool;
-
- pool = pool_list->freei;
- if (pool == NULL) {
- INSTRUCTION *last;
- emalloc(cp, INSTRUCTION *, (INSTR_CHUNK + 1) * sizeof(INSTRUCTION), "bcalloc");
-
- cp->pool_size = INSTR_CHUNK;
- cp->nexti = pool_list->nexti;
- pool_list->nexti = cp;
- pool = ++cp;
- last = &pool[INSTR_CHUNK - 1];
- for (; cp <= last; cp++) {
- cp->opcode = 0;
- cp->nexti = cp + 1;
- }
- --cp;
- cp->nexti = NULL;
- }
- cp = pool;
- pool_list->freei = cp->nexti;
- }
-
- memset(cp, 0, size * sizeof(INSTRUCTION));
- cp->opcode = op;
- cp->source_line = srcline;
- return cp;
-}
-
-/* free_bcpool --- free list of instruction memory pools */
-
-static void
-free_bcpool(INSTRUCTION *pl)
-{
- INSTRUCTION *pool, *tmp;
-
- for (pool = pl->nexti; pool != NULL; pool = tmp) {
- INSTRUCTION *cp, *last;
- long psiz;
- psiz = pool->pool_size;
- if (psiz == INSTR_CHUNK)
- last = pool + psiz;
- else
- last = pool + 1;
- for (cp = pool + 1; cp <= last ; cp++) {
- if (cp->opcode != 0)
- free_bc_internal(cp);
- }
- tmp = pool->nexti;
- efree(pool);
- }
- memset(pl, 0, sizeof(INSTRUCTION));
-}
-
-
static inline INSTRUCTION *
list_create(INSTRUCTION *x)
{
@@ -8458,13 +8050,13 @@ check_special(const char *name)
int low, high, mid;
int i;
#if 'a' == 0x81 /* it's EBCDIC */
- static int did_sort = FALSE;
+ static bool did_sort = false;
if (! did_sort) {
qsort((void *) tokentab,
sizeof(tokentab) / sizeof(tokentab[0]),
sizeof(tokentab[0]), tokcompare);
- did_sort = TRUE;
+ did_sort = true;
}
#endif
@@ -8536,3 +8128,4 @@ one_line_close(int fd)
return ret;
}
+