gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-1479-ga3e095


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-1479-ga3e0954
Date: Mon, 22 Jun 2015 19:56:33 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, master has been updated
       via  a3e0954544c7cc4f34b710ac863d56419b57915a (commit)
       via  d43f951d4e8be461fd8be7182a4ff1b219fa8edd (commit)
       via  9bf2c3a7bac4abe6c97af4efb2614575279e7b63 (commit)
      from  f57f0699d7193571233735ba691ba19fc072b7dc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=a3e0954544c7cc4f34b710ac863d56419b57915a

commit a3e0954544c7cc4f34b710ac863d56419b57915a
Author: Arnold D. Robbins <address@hidden>
Date:   Mon Jun 22 22:56:06 2015 +0300

    Fix typeof to work correctly on subarrays.

diff --git a/ChangeLog b/ChangeLog
index 8479244..9e41242 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,11 @@
        (initialize_watch_item): Ditto.
        (print_memory): Ditto.
 
+       Fix typeof to work on subarrays.  Thanks, yet again, to
+       Hermann Peifer for the bug report.
+
+       * builtin.c (do_typeof): Don't deref Node_var_array.
+
 2015-06-21         Arnold D. Robbins     <address@hidden>
 
        Fixes for typeof - Don't let typeof change an untyped variable
diff --git a/builtin.c b/builtin.c
index 942a36d..e476ec9 100644
--- a/builtin.c
+++ b/builtin.c
@@ -3872,11 +3872,13 @@ do_typeof(int nargs)
 {
        NODE *arg;
        char *res = "unknown";
+       bool deref = true;
 
        arg = POP();
        switch (arg->type) {
        case Node_var_array:
                res = "array";
+               deref = false;
                break;
        case Node_typedregex:
                res = "regexp";
@@ -3899,7 +3901,8 @@ do_typeof(int nargs)
                break;
        }
 
-       DEREF(arg);
+       if (deref)
+               DEREF(arg);
        return make_string(res, strlen(res));
 }
 

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=d43f951d4e8be461fd8be7182a4ff1b219fa8edd

commit d43f951d4e8be461fd8be7182a4ff1b219fa8edd
Author: Arnold D. Robbins <address@hidden>
Date:   Mon Jun 22 22:53:02 2015 +0300

    Improve debugger support for typed regexps.

diff --git a/ChangeLog b/ChangeLog
index 5f27a32..8479244 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,14 @@
        also.
        * profile.c (pprint): Add Op_push_arg_untyped.
 
+       Improve debugger support for typed regexps.
+       Thanks to Hermann Peifer for the bug report.
+
+       * awkgram.y (valinfo): Add support for Node_typedregex.
+       * debug.c (watchpoint_triggerred): Handle Node_typedregex.
+       (initialize_watch_item): Ditto.
+       (print_memory): Ditto.
+
 2015-06-21         Arnold D. Robbins     <address@hidden>
 
        Fixes for typeof - Don't let typeof change an untyped variable
diff --git a/awkgram.c b/awkgram.c
index 6dc4b33..a1a055b 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -6895,6 +6895,8 @@ valinfo(NODE *n, Func_print print_func, FILE *fp)
 {
        if (n == Nnull_string)
                print_func(fp, "uninitialized scalar\n");
+       else if (n->type == Node_typedregex)
+               print_func(fp, "@/%.*s/\n", n->re_exp->stlen, n->re_exp->stptr);
        else if ((n->flags & STRING) != 0) {
                pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', false);
                print_func(fp, "\n");
diff --git a/awkgram.y b/awkgram.y
index e9b66ba..50fd90a 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -4475,6 +4475,8 @@ valinfo(NODE *n, Func_print print_func, FILE *fp)
 {
        if (n == Nnull_string)
                print_func(fp, "uninitialized scalar\n");
+       else if (n->type == Node_typedregex)
+               print_func(fp, "@/%.*s/\n", n->re_exp->stlen, n->re_exp->stptr);
        else if ((n->flags & STRING) != 0) {
                pp_string_fp(print_func, fp, n->stptr, n->stlen, '"', false);
                print_func(fp, "\n");
diff --git a/debug.c b/debug.c
index 6aaba09..99106e5 100644
--- a/debug.c
+++ b/debug.c
@@ -1736,6 +1736,8 @@ watchpoint_triggered(struct list_item *w)
                /* new != NULL */
                if (t2->type == Node_val)
                        w->cur_value = dupnode(t2);
+               else if (t2->type == Node_typedregex)
+                       w->cur_value = dupnode(t2);
                else {
                        w->flags |= CUR_IS_ARRAY;
                        w->cur_size = (t2->type == Node_var_array) ? 
assoc_length(t2) : 0;
@@ -1748,6 +1750,7 @@ watchpoint_triggered(struct list_item *w)
                        w->flags |= CUR_IS_ARRAY;
                        w->cur_size = assoc_length(t2);
                } else
+                       /* works for Node_typedregex too */
                        w->cur_value = dupnode(t2);
        }
 
@@ -1790,6 +1793,8 @@ initialize_watch_item(struct list_item *w)
                } else if (symbol->type == Node_var_array) {
                        w->flags |= CUR_IS_ARRAY;
                        w->cur_size = assoc_length(symbol);
+               } else if (symbol->type == Node_typedregex) {
+                       w->cur_value = dupnode(r);
                } /* else
                        can't happen */
        }
@@ -3703,6 +3708,9 @@ print_memory(NODE *m, NODE *func, Func_print print_func, 
FILE *fp)
                print_func(fp, " [%s]", flags2str(m->flags));
                break;
 
+       case Node_typedregex:
+               print_func(fp, "@");
+               /* fall through */
        case Node_regex:
                pp_string_fp(print_func, fp, m->re_exp->stptr, 
m->re_exp->stlen, '/', false);
                break;

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=9bf2c3a7bac4abe6c97af4efb2614575279e7b63

commit 9bf2c3a7bac4abe6c97af4efb2614575279e7b63
Author: Arnold D. Robbins <address@hidden>
Date:   Mon Jun 22 22:08:22 2015 +0300

    Make isarray also not scalarize untyped parameters.

diff --git a/ChangeLog b/ChangeLog
index b00a5c2..5f27a32 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-06-22         Arnold D. Robbins     <address@hidden>
+
+       * awkgram.y (snode): Make isarray not scalarize untyped parameters
+       also.
+       * profile.c (pprint): Add Op_push_arg_untyped.
+
 2015-06-21         Arnold D. Robbins     <address@hidden>
 
        Fixes for typeof - Don't let typeof change an untyped variable
diff --git a/awkgram.c b/awkgram.c
index ade5ed6..6dc4b33 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -6697,11 +6697,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
                        if (arg->nexti == arg->lasti && arg->nexti->opcode == 
Op_push)
                                arg->nexti->opcode = Op_push_arg;       /* 
argument may be array */
                }
-       } else if (r->builtin == do_isarray) {
-               arg = subn->nexti;
-               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_typeof) {
+       } else if (r->builtin == do_isarray || r->builtin == do_typeof) {
                arg = subn->nexti;
                if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push)
                        arg->nexti->opcode = Op_push_arg_untyped;       /* 
argument may be untyped */
diff --git a/awkgram.y b/awkgram.y
index d250369..e9b66ba 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -4277,11 +4277,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
                        if (arg->nexti == arg->lasti && arg->nexti->opcode == 
Op_push)
                                arg->nexti->opcode = Op_push_arg;       /* 
argument may be array */
                }
-       } else if (r->builtin == do_isarray) {
-               arg = subn->nexti;
-               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_typeof) {
+       } else if (r->builtin == do_isarray || r->builtin == do_typeof) {
                arg = subn->nexti;
                if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push)
                        arg->nexti->opcode = Op_push_arg_untyped;       /* 
argument may be untyped */
diff --git a/profile.c b/profile.c
index 0f68676..90f01c0 100644
--- a/profile.c
+++ b/profile.c
@@ -317,6 +317,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool 
in_for_header)
                case Op_push_array:
                case Op_push:
                case Op_push_arg:
+               case Op_push_arg_untyped:
                        m = pc->memory;
                        switch (m->type) {
                        case Node_param_list:

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog |   19 +++++++++++++++++++
 awkgram.c |    8 +++-----
 awkgram.y |    8 +++-----
 builtin.c |    5 ++++-
 debug.c   |    8 ++++++++
 profile.c |    1 +
 6 files changed, 38 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]