gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, gawk-4.0-stable, updated. ee77c260899fdc


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.0-stable, updated. ee77c260899fdce1cec5cf51053ccdb107f76d62
Date: Wed, 10 Aug 2011 20:01:16 +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, gawk-4.0-stable has been updated
       via  ee77c260899fdce1cec5cf51053ccdb107f76d62 (commit)
      from  b8c993f5a867f38fa9edd343d7d90b4b36800be2 (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=ee77c260899fdce1cec5cf51053ccdb107f76d62

commit ee77c260899fdce1cec5cf51053ccdb107f76d62
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Aug 10 23:00:53 2011 +0300

    Fix bug with FPAT.

diff --git a/ChangeLog b/ChangeLog
index 3ac6378..5fcf749 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -33,6 +33,12 @@
 
        * field.c (set_FIELDWIDTHS): Adjust calculations.
 
+       Fix problem with FPAT, reported by "T. X. G." <address@hidden>
+
+       * awk.h (Regexp): Add new member 'non_empty'.
+       * field.c (fpat_parse_field): Save/restore local variable non_empty
+       from member in Regexp struct.
+
 2011-08-09         Arnold D. Robbins     <address@hidden>
 
        Fix pty issue reported by "T. X. G." <address@hidden>
diff --git a/awk.h b/awk.h
index 4b4210f..2ffe91d 100644
--- a/awk.h
+++ b/awk.h
@@ -205,6 +205,7 @@ typedef struct Regexp {
        struct dfa *dfareg;
        short dfa;
        short has_anchor;       /* speed up of avoid_dfa kludge, temporary */
+       short non_empty;        /* for use in fpat_parse_field */
 } Regexp;
 #define        RESTART(rp,s)   (rp)->regs.start[0]
 #define        REEND(rp,s)     (rp)->regs.end[0]
diff --git a/field.c b/field.c
index 148f8f0..14a0333 100644
--- a/field.c
+++ b/field.c
@@ -849,7 +849,8 @@ get_field(long requested, Func_ptr *assign)
        if (assign != NULL)
                field0_valid = FALSE;           /* $0 needs reconstruction */
 #else
-       /* keep things uniform. Also, mere intention of assigning something
+       /*
+        * Keep things uniform. Also, mere intention of assigning something
         * to $n should not make $0 invalid. Makes sense to invalidate $0
         * after the actual assignment is performed. Not a real issue in 
         * the interpreter otherwise, but causes problem in the
@@ -1584,9 +1585,6 @@ fpat_parse_field(long up_to,      /* parse only up to 
this field number */
                memset(&mbs, 0, sizeof(mbstate_t));
 #endif
 
-       if (in_middle)
-               regex_flags |= RE_NO_BOL;
-
        if (up_to == UNLIMITED)
                nf = 0;
 
@@ -1596,7 +1594,13 @@ fpat_parse_field(long up_to,     /* parse only up to 
this field number */
        if (rp == NULL) /* use FPAT */
                rp = FPAT_regexp;
 
-       eosflag = non_empty = FALSE;
+       if (in_middle) {
+               regex_flags |= RE_NO_BOL;
+               non_empty = rp->non_empty;
+       } else
+               non_empty = FALSE;
+
+       eosflag = FALSE;
        need_to_set_sep = TRUE;
        start = scan;
        while (research(rp, scan, 0, (end - scan), regex_flags) != -1
@@ -1675,5 +1679,6 @@ fpat_parse_field(long up_to,      /* parse only up to 
this field number */
        }
 
        *buf = scan;
+       rp->non_empty = non_empty;
        return nf;
 }
diff --git a/test/ChangeLog b/test/ChangeLog
index 334f196..8c165b0 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,7 +1,8 @@
 2011-08-10         Arnold D. Robbins     <address@hidden>
 
-       * Makefile.am (beginfile2, fwtest3): New tests.
+       * Makefile.am (beginfile2, fpat3, fwtest3): New tests.
        * beginfile2.awk, beginfile2.in, beginfile2.ok: New files.
+       * fpat3.awk, fpat3.in, fpat3.ok: New files.
        * fwtest3.awk, fwtest3.in, fwtest3.ok: New files.
 
 2011-08-09         Arnold D. Robbins     <address@hidden>
diff --git a/test/Makefile.am b/test/Makefile.am
index a778995..3d259af 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -234,6 +234,9 @@ EXTRA_DIST = \
        fpat1.ok \
        fpat2.awk \
        fpat2.ok \
+       fpat3.awk \
+       fpat3.in \
+       fpat3.ok \
        fpatnull.awk \
        fpatnull.in \
        fpatnull.ok \
@@ -811,7 +814,8 @@ GAWK_EXT_TESTS = \
        aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \
        backw badargs beginfile1 beginfile2 \
        binmode1 clos1way delsub devfd devfd1 \
-       devfd2 dumpvars exit fieldwdth fpat1 fpat2 fpatnull fsfwfs funlen \
+       devfd2 dumpvars exit fieldwdth fpat1 fpat2 fpat3 \
+       fpatnull fsfwfs funlen \
        fwtest fwtest2 fwtest3 \
        gensub gensub2 getlndir gnuops2 gnuops3 gnureops \
        icasefs icasers igncdym igncfs ignrcas2 ignrcase indirectcall lint \
diff --git a/test/Makefile.in b/test/Makefile.in
index 1f1f582..3dd318f 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -419,6 +419,9 @@ EXTRA_DIST = \
        fpat1.ok \
        fpat2.awk \
        fpat2.ok \
+       fpat3.awk \
+       fpat3.in \
+       fpat3.ok \
        fpatnull.awk \
        fpatnull.in \
        fpatnull.ok \
@@ -996,7 +999,8 @@ GAWK_EXT_TESTS = \
        aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \
        backw badargs beginfile1 beginfile2 \
        binmode1 clos1way delsub devfd devfd1 \
-       devfd2 dumpvars exit fieldwdth fpat1 fpat2 fpatnull fsfwfs funlen \
+       devfd2 dumpvars exit fieldwdth fpat1 fpat2 fpat3 \
+       fpatnull fsfwfs funlen \
        fwtest fwtest2 fwtest3 \
        gensub gensub2 getlndir gnuops2 gnuops3 gnureops \
        icasefs icasers igncdym igncfs ignrcas2 ignrcase indirectcall lint \
@@ -2689,6 +2693,11 @@ fpat2:
        @AWKPATH=$(srcdir) $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
 
+fpat3:
+       @echo fpat3
+       @AWKPATH=$(srcdir) $(AWK) -f address@hidden  < $(srcdir)/address@hidden 
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+
 fpatnull:
        @echo fpatnull
        @AWKPATH=$(srcdir) $(AWK) -f address@hidden  < $(srcdir)/address@hidden 
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index cfbfc79..c76769f 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -930,6 +930,11 @@ fpat2:
        @AWKPATH=$(srcdir) $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
 
+fpat3:
+       @echo fpat3
+       @AWKPATH=$(srcdir) $(AWK) -f address@hidden  < $(srcdir)/address@hidden 
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+
 fpatnull:
        @echo fpatnull
        @AWKPATH=$(srcdir) $(AWK) -f address@hidden  < $(srcdir)/address@hidden 
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/fpat3.awk b/test/fpat3.awk
new file mode 100644
index 0000000..801bb58
--- /dev/null
+++ b/test/fpat3.awk
@@ -0,0 +1,10 @@
+BEGIN {
+       FPAT = "[^,]*"
+
+}
+
+{
+       if (x) NF
+       for (i = 1; i <= 4; ++i)
+               print i, $i
+}
diff --git a/test/fpat3.in b/test/fpat3.in
new file mode 100644
index 0000000..28416a4
--- /dev/null
+++ b/test/fpat3.in
@@ -0,0 +1 @@
+a,b,,c
diff --git a/test/fpat3.ok b/test/fpat3.ok
new file mode 100644
index 0000000..543bb42
--- /dev/null
+++ b/test/fpat3.ok
@@ -0,0 +1,4 @@
+1 a
+2 b
+3 
+4 c

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

Summary of changes:
 ChangeLog        |    6 ++++++
 awk.h            |    1 +
 field.c          |   15 ++++++++++-----
 test/ChangeLog   |    3 ++-
 test/Makefile.am |    6 +++++-
 test/Makefile.in |   11 ++++++++++-
 test/Maketests   |    5 +++++
 test/fpat3.awk   |   10 ++++++++++
 test/fpat3.in    |    1 +
 test/fpat3.ok    |    4 ++++
 10 files changed, 54 insertions(+), 8 deletions(-)
 create mode 100644 test/fpat3.awk
 create mode 100644 test/fpat3.in
 create mode 100644 test/fpat3.ok


hooks/post-receive
-- 
gawk



reply via email to

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