"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "interpret.h" between
gawk-5.0.1.tar.xz and gawk-5.1.0.tar.xz

About: GNU awk - pattern scanning and processing language.

interpret.h  (gawk-5.0.1.tar.xz):interpret.h  (gawk-5.1.0.tar.xz)
/* /*
* interpret.h --- run a list of instructions. * interpret.h --- run a list of instructions.
*/ */
/* /*
* Copyright (C) 1986, 1988, 1989, 1991-2019 the Free Software Foundation, Inc. * Copyright (C) 1986, 1988, 1989, 1991-2020,
* the Free Software Foundation, Inc.
* *
* This file is part of GAWK, the GNU implementation of the * This file is part of GAWK, the GNU implementation of the
* AWK Programming Language. * AWK Programming Language.
* *
* GAWK is free software; you can redistribute it and/or modify * GAWK is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GAWK is distributed in the hope that it will be useful, * GAWK is distributed in the hope that it will be useful,
skipping to change at line 266 skipping to change at line 267
lintwarn(_("reference to uninitialized element `% s[\"%.*s\"]'"), lintwarn(_("reference to uninitialized element `% s[\"%.*s\"]'"),
array_vname(t1), (int) t2->stlen, t2->stp tr); array_vname(t1), (int) t2->stlen, t2->stp tr);
if (t2->stlen == 0) if (t2->stlen == 0)
lintwarn(_("subscript of array `%s' is nu ll string"), array_vname(t1)); lintwarn(_("subscript of array `%s' is nu ll string"), array_vname(t1));
} }
/* for FUNCTAB, get the name as the element value */ /* for FUNCTAB, get the name as the element value */
if (t1 == func_table) { if (t1 == func_table) {
static bool warned = false; static bool warned = false;
if (do_lint && ! warned) { if (do_lint_extensions && ! warned) {
warned = true; warned = true;
lintwarn(_("FUNCTAB is a gawk extension") ); lintwarn(_("FUNCTAB is a gawk extension") );
} }
r = t2; r = t2;
} else { } else {
/* make sure stuff like NF, NR, are up to date */ /* make sure stuff like NF, NR, are up to date */
if (t1 == symbol_table) if (t1 == symbol_table)
update_global_values(); update_global_values();
r = *assoc_lookup(t1, t2); r = *assoc_lookup(t1, t2);
} }
DEREF(t2); DEREF(t2);
/* for SYMTAB, step through to the actual variable */ /* for SYMTAB, step through to the actual variable */
if (t1 == symbol_table) { if (t1 == symbol_table) {
static bool warned = false; static bool warned = false;
if (do_lint && ! warned) { if (do_lint_extensions && ! warned) {
warned = true; warned = true;
lintwarn(_("SYMTAB is a gawk extension")) ; lintwarn(_("SYMTAB is a gawk extension")) ;
} }
if (r->type == Node_var) if (r->type == Node_var)
r = r->var_value; r = r->var_value;
else if (r->type == Node_var_new) {
// variable may exist but have never been
set.
r->var_value = dupnode(Nnull_string);
r = r->var_value;
}
} }
if (r->type == Node_val) if (r->type == Node_val)
UPREF(r); UPREF(r);
PUSH(r); PUSH(r);
break; break;
case Op_sub_array: case Op_sub_array:
t2 = mk_sub(pc->sub_count); t2 = mk_sub(pc->sub_count);
t1 = POP_ARRAY(false); t1 = POP_ARRAY(false);
skipping to change at line 743 skipping to change at line 749
break; break;
case Op_assign_concat: case Op_assign_concat:
/* x = x ... string concatenation optimization */ /* x = x ... string concatenation optimization */
lhs = get_lhs(pc->memory, false); lhs = get_lhs(pc->memory, false);
t1 = force_string(*lhs); t1 = force_string(*lhs);
t2 = POP_STRING(); t2 = POP_STRING();
if (t1 != *lhs) { if (t1 != *lhs) {
unref(*lhs); unref(*lhs);
*lhs = dupnode(t1); if (t1->valref == 1)
*lhs = t1;
else
*lhs = dupnode(t1);
} }
if (t1 != t2 && t1->valref == 1 && (t1->flags & (MALLOC|M PFN|MPZN)) == MALLOC) { if (t1 != t2 && t1->valref == 1 && (t1->flags & (MALLOC|M PFN|MPZN)) == MALLOC) {
size_t nlen = t1->stlen + t2->stlen; size_t nlen = t1->stlen + t2->stlen;
erealloc(t1->stptr, char *, nlen + 1, "r_interpre t"); erealloc(t1->stptr, char *, nlen + 1, "r_interpre t");
memcpy(t1->stptr + t1->stlen, t2->stptr, t2->stle n); memcpy(t1->stptr + t1->stlen, t2->stptr, t2->stle n);
t1->stlen = nlen; t1->stlen = nlen;
t1->stptr[nlen] = '\0'; t1->stptr[nlen] = '\0';
/* clear flags except WSTRCUR (used below) */ /* clear flags except WSTRCUR (used below) */
skipping to change at line 1067 skipping to change at line 1076
case Op_match_rec: case Op_match_rec:
m = pc->memory; m = pc->memory;
t1 = *get_field(0, (Func_ptr *) 0); t1 = *get_field(0, (Func_ptr *) 0);
match_re: match_re:
rp = re_update(m); rp = re_update(m);
di = research(rp, t1->stptr, 0, t1->stlen, RE_NO_FLAGS); di = research(rp, t1->stptr, 0, t1->stlen, RE_NO_FLAGS);
di = (di == -1) ^ (op != Op_nomatch); di = (di == -1) ^ (op != Op_nomatch);
if (op != Op_match_rec) { if (op != Op_match_rec) {
decr_sp(); decr_sp();
DEREF(t1); DEREF(t1);
if (m->type == Node_dynregex) {
DEREF(m->re_exp);
m->re_exp = NULL;
}
} }
r = node_Boolean[di]; r = node_Boolean[di];
UPREF(r); UPREF(r);
PUSH(r); PUSH(r);
break; break;
case Op_nomatch: case Op_nomatch:
/* fall through */ /* fall through */
case Op_match: case Op_match:
m = pc->memory; m = pc->memory;
 End of changes. 6 change blocks. 
4 lines changed or deleted 18 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)