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. d806340faadd79524b3adcc


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. d806340faadd79524b3adccef6cbced20cd88396
Date: Fri, 01 Apr 2011 08:58:57 +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  d806340faadd79524b3adccef6cbced20cd88396 (commit)
       via  6aed27e0a553cb31800bbaeee1bf8e96a98abb12 (commit)
      from  b1746329b7749a8f760bab04c12e5127a23e46ed (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=d806340faadd79524b3adccef6cbced20cd88396

commit d806340faadd79524b3adccef6cbced20cd88396
Author: Arnold D. Robbins <address@hidden>
Date:   Fri Apr 1 11:58:20 2011 +0300

    Fix array sorting, add test case.

diff --git a/ChangeLog b/ChangeLog
index c013795..c627676 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Apr  1 11:53:54 2011  Pat Rankin  <address@hidden>
+
+       * array.c (sort_up_index_number): Fix the NODE arguments passed to
+       sort_up_index_string() when a tie breaker is needed.
+
 Fri Apr  1 11:49:17 2011  Arnold D. Robbins  <address@hidden>
 
        Change ISATTY macro to os_isatty function.
diff --git a/array.c b/array.c
index 0b03397..6817a37 100644
--- a/array.c
+++ b/array.c
@@ -1433,8 +1433,8 @@ sort_up_index_number(const void *p1, const void *p2)
 
        /* break a tie with the index string itself */
        if (ret == 0)
-               return sort_up_index_string((const void *) n1->sort_index,
-                                           (const void *) n2->sort_index);
+               return sort_up_index_string((const void *) &n1->sort_index,
+                                           (const void *) &n2->sort_index);
        return ret;
 }
 
diff --git a/test/ChangeLog b/test/ChangeLog
index c429ce4..ee4c679 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+Fri Apr  1 11:56:54 2011  Arnold D. Robbins  <address@hidden>
+
+       * arraysort.awk, arraysort.ok:  New files from John Haque,
+       edited somewhat.
+       * Makefile.am (arraysort): New test.
+
 Wed Mar 30 22:00:59 2011  Arnold D. Robbins  <address@hidden>
 
        * next.sh, exit.sh: New files from John Haque, edited somewhat.
diff --git a/test/Makefile.am b/test/Makefile.am
index 2fecaca..ad44ffa 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -46,6 +46,8 @@ EXTRA_DIST = \
        anchgsub.awk \
        anchgsub.in \
        anchgsub.ok \
+       arraysort.awk \
+       arraysort.ok \
        argarray.awk \
        argarray.in \
        argarray.ok \
@@ -767,6 +769,7 @@ UNIX_TESTS = fflush getlnhd localenl pid pipeio1 pipeio2 
poundbang space strftln
 
 GAWK_EXT_TESTS = \
        aadelete1 aadelete2 aarray1 aasort aasorti \
+       arraysort \
        argtest backw badargs beginfile1 binmode1 clos1way \
        devfd devfd1 devfd2 dumpvars \
        fieldwdth fpat1 funlen fsfwfs fwtest fwtest2 gensub gensub2 getlndir \
diff --git a/test/Makefile.in b/test/Makefile.in
index 51bdf29..7e57d7e 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -231,6 +231,8 @@ EXTRA_DIST = \
        anchgsub.awk \
        anchgsub.in \
        anchgsub.ok \
+       arraysort.awk \
+       arraysort.ok \
        argarray.awk \
        argarray.in \
        argarray.ok \
@@ -951,6 +953,7 @@ BASIC_TESTS = addcomma anchgsub argarray arrayparm 
arrayprm2 arrayprm3 \
 UNIX_TESTS = fflush getlnhd localenl pid pipeio1 pipeio2 poundbang space 
strftlng
 GAWK_EXT_TESTS = \
        aadelete1 aadelete2 aarray1 aasort aasorti \
+       arraysort \
        argtest backw badargs beginfile1 binmode1 clos1way \
        devfd devfd1 devfd2 dumpvars \
        fieldwdth fpat1 funlen fsfwfs fwtest fwtest2 gensub gensub2 getlndir \
@@ -2565,6 +2568,11 @@ aasorti:
        @AWKPATH=$(srcdir) $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
 
+arraysort:
+       @echo arraysort
+       @AWKPATH=$(srcdir) $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+
 backw:
        @echo backw
        @AWKPATH=$(srcdir) $(AWK) -f address@hidden  < $(srcdir)/address@hidden 
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index ea4b76d..70b7df6 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -865,6 +865,11 @@ aasorti:
        @AWKPATH=$(srcdir) $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
 
+arraysort:
+       @echo arraysort
+       @AWKPATH=$(srcdir) $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
+       @-$(CMP) $(srcdir)/address@hidden _$@ && rm -f _$@
+
 backw:
        @echo backw
        @AWKPATH=$(srcdir) $(AWK) -f address@hidden  < $(srcdir)/address@hidden 
>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/arraysort.awk b/test/arraysort.awk
new file mode 100644
index 0000000..2853552
--- /dev/null
+++ b/test/arraysort.awk
@@ -0,0 +1,11 @@
+# Date: Thu, 31 Mar 2011 12:29:09 -0600
+# From: address@hidden
+
+BEGIN { a[100]=a[1]=a["x"]=a["y"]=1; PROCINFO["sorted_in"]="num";
+for (i in a) print i, a[i] }
+
+BEGIN { a[100]=a[1]=a["x"]=1; PROCINFO["sorted_in"]="num";
+for (i in a) print i, a[i] }
+
+BEGIN { a[0]=a[100]=a[1]=a["x"]=1;  PROCINFO["sorted_in"]="num";
+for (i in a) print i, a[i] }
diff --git a/test/arraysort.ok b/test/arraysort.ok
new file mode 100644
index 0000000..2306e8a
--- /dev/null
+++ b/test/arraysort.ok
@@ -0,0 +1,13 @@
+x 1
+y 1
+1 1
+100 1
+x 1
+y 1
+1 1
+100 1
+0 1
+x 1
+y 1
+1 1
+100 1

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

commit 6aed27e0a553cb31800bbaeee1bf8e96a98abb12
Author: Arnold D. Robbins <address@hidden>
Date:   Fri Apr 1 11:52:37 2011 +0300

    Change ISATTY macro to os_isatty function.

diff --git a/ChangeLog b/ChangeLog
index 7264bb3..c013795 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Fri Apr  1 11:49:17 2011  Arnold D. Robbins  <address@hidden>
+
+       Change ISATTY macro to os_isatty function.
+
+       * awk.h (ISATTY): Remove definition.
+       (os_isatty): Add declaration.
+       * debug.c, io.c, main.c: Change all calls.
+
 Thu Mar 31 22:57:36 2011  Arnold D. Robbins  <address@hidden>
 
        * Checklist: Updated. This is a git-only file.
diff --git a/awk.h b/awk.h
index d5a3735..d781ff6 100644
--- a/awk.h
+++ b/awk.h
@@ -163,11 +163,6 @@ typedef int off_t;
 #define O_BINARY       0
 #endif
 
-/* Windows needs a separate definition, see pc/config.h.  */
-#ifndef ISATTY
-# define ISATTY(fd) isatty(fd)
-#endif
-
 #ifndef HAVE_VPRINTF
 #error "you lose: you need a system with vfprintf"
 #endif /* HAVE_VPRINTF */
@@ -1279,6 +1274,7 @@ extern char *gawk_name(const char *filespec);
 extern void os_arg_fixup(int *argcp, char ***argvp);
 extern int os_devopen(const char *name, int flag);
 extern void os_close_on_exec(int fd, const char *name, const char *what, const 
char *dir);
+extern int os_isatty(int fd);
 extern int os_isdir(int fd);
 extern int os_is_setuid(void);
 extern int os_setbinmode(int fd, int mode);
diff --git a/debug.c b/debug.c
index 1086563..3726f05 100644
--- a/debug.c
+++ b/debug.c
@@ -2738,7 +2738,7 @@ interpret(INSTRUCTION *pc)
 
        input_fd = fileno(stdin);
        out_fp = stdout;
-       if (ISATTY(input_fd))
+       if (os_isatty(input_fd))
                input_from_tty = TRUE;
        if (input_fd == 0 && input_from_tty)
                initialize_readline();
@@ -4089,7 +4089,7 @@ do_option(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
 void
 initialize_pager(FILE *fp)
 {
-       if (! ISATTY(fileno(fp)) || ! input_from_tty || input_fd != 0) {
+       if (! os_isatty(fileno(fp)) || ! input_from_tty || input_fd != 0) {
                screen_width = INT_MAX;
                screen_height = INT_MAX;
        } else {
@@ -4113,7 +4113,7 @@ prompt_continue(FILE *fp)
 {
        int quit_pager = FALSE;
 
-       if (ISATTY(fileno(fp)) && input_fd == 0)
+       if (os_isatty(fileno(fp)) && input_fd == 0)
                quit_pager = prompt_yes_no(
                        _("\t------[Enter] to continue or q [Enter] to 
quit------"),
                        _("q")[0], FALSE, fp);
@@ -5071,7 +5071,7 @@ set_gawk_output(const char *file)
                        efree(output_file);
                }
                output_fp = stdout;
-               output_is_tty = ISATTY(fileno(stdout));
+               output_is_tty = os_isatty(fileno(stdout));
                output_file = "/dev/stdout";
        }
 
@@ -5092,7 +5092,7 @@ set_gawk_output(const char *file)
                if (STREQ(cp, "stderr")) {
                        output_fp = stderr;
                        output_file = "/dev/stderr";
-                       output_is_tty = ISATTY(fileno(stderr));
+                       output_is_tty = os_isatty(fileno(stderr));
                        return;
                }
                
@@ -5125,7 +5125,7 @@ set_gawk_output(const char *file)
                output_fp = fp;
                output_file = estrdup(file, strlen(file));
                setbuf(fp, (char *) NULL);
-               output_is_tty = ISATTY(fileno(fp));
+               output_is_tty = os_isatty(fileno(fp));
        } else {
                d_error(_("could not open `%s' for writing (%s)"),
                                        file,
diff --git a/io.c b/io.c
index c9d421b..dfe449c 100644
--- a/io.c
+++ b/io.c
@@ -781,7 +781,7 @@ redirect(NODE *redir_exp, int redirtype, int *errflg)
                                        if (rp->fp == NULL)
                                                close(fd);
                                }
-                               if (rp->fp != NULL && ISATTY(fd))
+                               if (rp->fp != NULL && os_isatty(fd))
                                        rp->flag |= RED_NOBUF;
 
                                /* Move rp to the head of the list. */
@@ -2561,7 +2561,7 @@ iop_alloc(int fd, const char *name, IOBUF *iop, int 
do_openhooks)
                return NULL;
        }
 
-       if (ISATTY(iop->fd))
+       if (os_isatty(iop->fd))
                iop->flag |= IOP_IS_TTY;
        iop->readsize = iop->size = optimal_bufsize(iop->fd, & sbuf);
        iop->sbuf = sbuf;
diff --git a/main.c b/main.c
index b1773d2..b60692a 100644
--- a/main.c
+++ b/main.c
@@ -621,7 +621,7 @@ out:
 #ifdef GAWKDEBUG
        setbuf(stdout, (char *) NULL);  /* make debugging easier */
 #endif
-       if (ISATTY(fileno(stdout)))
+       if (os_isatty(fileno(stdout)))
                output_is_tty = TRUE;
        /* No -f or --source options, use next arg */
        if (srcfiles->next == srcfiles) {
diff --git a/pc/ChangeLog b/pc/ChangeLog
index 316b23f..532ea8b 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,8 @@
+Fri Apr  1 11:50:59 2011  Arnold D. Robbins  <address@hidden>
+
+       * config.h (ISATTY): Remove definition.
+       * gawkmisc.pc (os_iastty): New function.
+
 Sun Feb 27 22:58:08 2011  Scott Deifik         <address@hidden>
 
        * Makefile.tst: Sync with mainline version.
diff --git a/pc/config.h b/pc/config.h
index 4ec2d71..4dd797c 100644
--- a/pc/config.h
+++ b/pc/config.h
@@ -518,8 +518,4 @@
 #define HAVE_USLEEP 1
 #endif
 
-#if defined(__MINGW32__) || defined(_MSC_VER)
-# define ISATTY(fd) (isatty(fd) && lseek(fd,SEEK_CUR,0) == -1)
-#endif
-
 /* #define NO_LINT 1 */
diff --git a/pc/gawkmisc.pc b/pc/gawkmisc.pc
index 6776067..43f81ff 100644
--- a/pc/gawkmisc.pc
+++ b/pc/gawkmisc.pc
@@ -280,6 +280,18 @@ int fd;
                setmode(fd, orig_tty_mode);
        }
 }
+
+/* os_isatty --- return true if fd is a tty */
+
+int
+os_isatty(int fd)
+{
+#if defined(__MINGW32__) || defined(_MSC_VER)
+       return (isatty(fd) && lseek(fd, SEEK_CUR, 0) == -1);
+#else
+       return isatty(fd);
+#endif
+}
  
 /* files_are_same --- return true if files are identical */
 
diff --git a/posix/ChangeLog b/posix/ChangeLog
index e0cce05..ceecc6b 100644
--- a/posix/ChangeLog
+++ b/posix/ChangeLog
@@ -1,3 +1,7 @@
+Fri Apr  1 11:50:59 2011  Arnold D. Robbins  <address@hidden>
+
+       * gawkmisc.c (os_iastty): New function.
+
 Sun Feb 13 20:23:34 2011  Eli Zaretskii  <address@hidden>
 
        * gawkmisc.c (files_are_same): Change arguments; call `stat' as
diff --git a/posix/gawkmisc.c b/posix/gawkmisc.c
index 8c40f53..6290ff5 100644
--- a/posix/gawkmisc.c
+++ b/posix/gawkmisc.c
@@ -234,6 +234,14 @@ os_restore_mode(int fd)
        /* no-op */
        return;
 }
+
+/* os_isatty --- return true if fd is a tty */
+
+int
+os_isatty(int fd)
+{
+       return isatty(fd);
+}
  
 /* files_are_same --- return true if files are identical */
 

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

Summary of changes:
 ChangeLog          |   13 +++++++++++++
 array.c            |    4 ++--
 awk.h              |    6 +-----
 debug.c            |   12 ++++++------
 io.c               |    4 ++--
 main.c             |    2 +-
 pc/ChangeLog       |    5 +++++
 pc/config.h        |    4 ----
 pc/gawkmisc.pc     |   12 ++++++++++++
 posix/ChangeLog    |    4 ++++
 posix/gawkmisc.c   |    8 ++++++++
 test/ChangeLog     |    6 ++++++
 test/Makefile.am   |    3 +++
 test/Makefile.in   |    8 ++++++++
 test/Maketests     |    5 +++++
 test/arraysort.awk |   11 +++++++++++
 test/arraysort.ok  |   13 +++++++++++++
 17 files changed, 100 insertions(+), 20 deletions(-)
 create mode 100644 test/arraysort.awk
 create mode 100644 test/arraysort.ok


hooks/post-receive
-- 
gawk



reply via email to

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