gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, memory-work, created. gawk-4.1.0-487-g31


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, memory-work, created. gawk-4.1.0-487-g31c6051
Date: Sun, 16 Nov 2014 17:55:35 +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, memory-work has been created
        at  31c6051694d3152e50eb037e20c4734c7321eac6 (commit)

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

commit 31c6051694d3152e50eb037e20c4734c7321eac6
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Nov 16 19:54:57 2014 +0200

    Add field reference changes. Currently breaks sortglos test.

diff --git a/interpret.h b/interpret.h
index 74f56c7..83ccbfc 100644
--- a/interpret.h
+++ b/interpret.h
@@ -340,7 +340,12 @@ uninitialized_scalar:
                        lhs = r_get_field(t1, (Func_ptr *) 0, true);
                        decr_sp();
                        DEREF(t1);
-                       r = dupnode(*lhs);     /* can't use UPREF here */
+                       /* only for $0, up ref count */
+                       if (*lhs == fields_arr[0]) {
+                               r = *lhs;
+                               UPREF(r);
+                       } else
+                               r = dupnode(*lhs);
                        PUSH(r);
                        break;
 
@@ -649,11 +654,22 @@ mod:
                        lhs = get_lhs(pc->memory, false);
                        unref(*lhs);
                        r = pc->initval;        /* constant initializer */
-                       if (r == NULL)
-                               *lhs = POP_SCALAR();
-                       else {
+                       if (r != NULL) {
                                UPREF(r);
                                *lhs = r;
+                       } else {
+                               r = POP_SCALAR();
+
+                               /* if was a field, turn it into a var */
+                               if ((r->flags & FIELD) == 0) {
+                                       *lhs = r;
+                               } else if (r->valref == 1) {
+                                       r->flags &= ~FIELD;
+                                       *lhs = r;
+                               } else {
+                                       *lhs = dupnode(r);
+                                       DEREF(r);
+                               }
                        }
                        break;
 
diff --git a/test/ChangeLog b/test/ChangeLog
index e28ac2b..633fef5 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-16         Arnold D. Robbins     <address@hidden>
+
+       * Makefile.am (sortglos): New test.
+       * sortglos.awk, sortglos.in, sortglos.ok: New files.
+
 2014-11-09         Arnold D. Robbins     <address@hidden>
 
        * mbprintf4.awk: Add record and line number for debugging.
diff --git a/test/Makefile.am b/test/Makefile.am
index f8db283..3c85012 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -831,6 +831,9 @@ EXTRA_DIST = \
        sortfor.awk \
        sortfor.in \
        sortfor.ok \
+       sortglos.awk \
+       sortglos.in \
+       sortglos.ok \
        sortu.awk \
        sortu.ok \
        space.ok \
@@ -996,7 +999,7 @@ BASIC_TESTS = \
        rand range1 rebt8b1 redfilnm regeq regexprange regrange reindops \
        reparse resplit rri1 rs rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 \
        rstest3 rstest4 rstest5 rswhite \
-       scalar sclforin sclifin sortempty splitargv splitarr splitdef \
+       scalar sclforin sclifin sortempty sortglos splitargv splitarr splitdef \
        splitvar splitwht strcat1 strnum1 strtod subamp subi18n \
        subsepnm subslash substr swaplns synerr1 synerr2 tradanch tweakfld \
        uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs \
diff --git a/test/Makefile.in b/test/Makefile.in
index a337288..69a4bef 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1077,6 +1077,9 @@ EXTRA_DIST = \
        sortfor.awk \
        sortfor.in \
        sortfor.ok \
+       sortglos.awk \
+       sortglos.in \
+       sortglos.ok \
        sortu.awk \
        sortu.ok \
        space.ok \
@@ -1241,7 +1244,7 @@ BASIC_TESTS = \
        rand range1 rebt8b1 redfilnm regeq regexprange regrange reindops \
        reparse resplit rri1 rs rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 \
        rstest3 rstest4 rstest5 rswhite \
-       scalar sclforin sclifin sortempty splitargv splitarr splitdef \
+       scalar sclforin sclifin sortempty sortglos splitargv splitarr splitdef \
        splitvar splitwht strcat1 strnum1 strtod subamp subi18n \
        subsepnm subslash substr swaplns synerr1 synerr2 tradanch tweakfld \
        uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs \
@@ -3195,6 +3198,11 @@ sortempty:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+sortglos:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 splitargv:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index f8d5e8a..85c13d5 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -777,6 +777,11 @@ sortempty:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+sortglos:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 splitargv:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/sortglos.awk b/test/sortglos.awk
new file mode 100755
index 0000000..e4f910d
--- /dev/null
+++ b/test/sortglos.awk
@@ -0,0 +1,51 @@
+BEGIN {
+       pr="y";
+       npre=0;
+       po="n";
+       npos=0;
+       }
+
+pr=="y"      { npre++; pre[npre]=$0; }
+$1=="@table" && $2=="@asis" { pr="n";nite++; next; }
+
+po=="y"      { npos++; pos[npos]=$0; }
+$1=="@end" && $2=="table"   {
+       po="y";
+       npos++;
+       pos[npos]=$0;
+       # last item...
+       vec[nite]=nlin;
+}
+
+       { nite++; }
+
+END {
+       for ( i=1; i<=npre; i++ ) { print pre[i]; }
+       if ( srt=="y" ) {
+               n=asorti(entr,ital);
+               ##print "n=",n;
+               for ( i=1; i<=n; i++ ) {
+                       #printf("=========> %3.3d %s\n",i,ital[i]);
+                       # ital[i] is the sorted key;
+                       j=entr[ital[i]];
+                       # j is the original item number
+                       for ( k=1; k<=vec[j]; k++ ) {
+                               print dat[j,k];
+                       }
+               }
+       }
+       if ( srt=="n" ) {
+               for ( i=1; i<=nite; i++ ) {
+                       printf("=========> %3.3d %2.2d %s\n",i,vec[i],titl[i]);
+                       for ( j=1; j<=vec[i]; j++ ) {
+                               print dat[i,j];
+                       }
+               }
+               print "========================= END";
+       }
+       for ( i=1; i<=npos; i++ ) { print pos[i]; }
+       print "@c npre=" npre;
+       print "@c nite=" nite;
+       print "@c npos=" npos;
+}
+
diff --git a/test/sortglos.in b/test/sortglos.in
new file mode 100755
index 0000000..b24373d
--- /dev/null
+++ b/test/sortglos.in
@@ -0,0 +1,22 @@
address@hidden Glossario
address@hidden Glossario
+
address@hidden @asis
address@hidden Azione
+Una serie di istruzioni @command{awk} associate a una regola.  Se
+l'espressione di ricerca della regola individua un record in input,
address@hidden esegue su quel record l'azione relativa.  Le azioni sono
+sempre racchiuse fra parentesi graffe.
+(@xref{Panoramica sulle azioni}).
+
address@hidden Spazio bianco
+Una sequenza di spazi, TAB, o caratteri di "a capo" presenti in un record in
+input o in una stringa.
address@hidden table
+
address@hidden ifclear
+
address@hidden The GNU General Public License.
+
address@hidden aggiornato alla versione: settembre 2014
address@hidden ultimo aggiornamento: 14 novembre 2014
diff --git a/test/sortglos.ok b/test/sortglos.ok
new file mode 100644
index 0000000..69ddbe6
--- /dev/null
+++ b/test/sortglos.ok
@@ -0,0 +1,15 @@
address@hidden Glossario
address@hidden Glossario
+
address@hidden @asis
address@hidden table
+
address@hidden ifclear
+
address@hidden The GNU General Public License.
+
address@hidden aggiornato alla versione: settembre 2014
address@hidden ultimo aggiornamento: 14 novembre 2014
address@hidden npre=4
address@hidden nite=22
address@hidden npos=8

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


hooks/post-receive
-- 
gawk



reply via email to

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