gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, master, updated. gawk-4.1.0-4455-g79fcb0a


From: Arnold Robbins
Subject: [SCM] gawk branch, master, updated. gawk-4.1.0-4455-g79fcb0a
Date: Mon, 6 Sep 2021 07:10:01 -0400 (EDT)

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  79fcb0a4a39b5cc529a48942d25817e4d7146658 (commit)
       via  50d91293b73ed7b9b50e1928ccf87a1f5281da1f (commit)
       via  4f7ec39c9d7a02b1ef483a78e7596390c049df53 (commit)
       via  dedc6b3d8512aca225d9b39a13b60dbd5c92d702 (commit)
       via  278cfe82e88d7899cb66bf79141fcc8b0a2727be (commit)
      from  96bbb013bdbfc03c3fccb6c5c2a5c8142e061329 (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=79fcb0a4a39b5cc529a48942d25817e4d7146658

commit 79fcb0a4a39b5cc529a48942d25817e4d7146658
Merge: 96bbb01 50d9129
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Mon Sep 6 14:09:55 2021 +0300

    Merge branch 'gawk-5.1-stable'

diff --cc builtin.c
index 087f1ab,73a404e..e1e8015
--- a/builtin.c
+++ b/builtin.c
@@@ -4353,17 -4362,105 +4365,120 @@@ check_symtab_functab(NODE *dest, const 
                fatal(msg, fname, "FUNCTAB");
  }
  
 +/* do_mkbool --- create boolean values */
 +
 +NODE *
 +do_mkbool(int nargs)
 +{
 +      NODE *tmp;
 +      bool result;
 +
 +      tmp = POP_SCALAR();
 +      result = boolval(tmp);
 +      DEREF(tmp);
 +
 +      return make_bool_node(result);
 +}
++
+ /* reverse --- reverse the contents of a string in place */
+ 
+ static void
+ reverse(char *str)
+ {
+       int i, j;
+       char tmp;
+ 
+       for (i = 0, j = strlen(str) - 1; j > i; i++, j--) {
+               tmp = str[i];
+               str[i] = str[j];
+               str[j] = tmp;
+       }
+ }
+ 
+ /* add_thousands --- add the thousands separator. Needed for MPFR %d format */
+ 
+ /*
+  * Copy the source string into the destination string, backwards,
+  * adding the thousands separator at the right points. Then reverse
+  * the string when done. This gives us much cleaner code than trying
+  * to work through the string backwards. (We tried it, it was yucky.)
+  */
+ 
+ static const char *
+ add_thousands(const char *original, struct lconv *loc)
+ {
+       size_t orig_len = strlen(original);
+       size_t new_len = orig_len + (orig_len * strlen(loc->thousands_sep)) + 
1;        // worst case
+       char *newbuf;
+       char decimal_point = '\0';
+       const char *dec = NULL;
+       const char *src;
+       char *dest;
+ 
+       emalloc(newbuf, char *, new_len, "add_thousands");
+       memset(newbuf, '\0', new_len);
+ 
+       src = original + strlen(original) - 1;
+       dest = newbuf;
+ 
+       if (loc->decimal_point[0] != '\0') {
+               decimal_point = loc->decimal_point[0];
+               if ((dec = strchr(original, decimal_point)) != NULL) {
+                       while (src >= dec)
+                               *dest++ = *src--;
+               }
+       }
+ 
+ 
+       int ii = 0;
+       int jj = 0;
+       do {
+               *dest++ = *src--;
+               if (loc->grouping[ii] && ++jj == loc->grouping[ii]) {
+                       if (src >= original) {  /* only add if more digits 
coming */
+                               const char *ts = loc->thousands_sep;
+ 
+                               while (*ts != '\0')
+                                       *dest++ = *ts++;
+                       }
+                       if (loc->grouping[ii+1] == 0)
+                               jj = 0;         /* keep using current val in 
loc.grouping[ii] */
+                       else if (loc->grouping[ii+1] == CHAR_MAX) {
+                               // copy in the rest and be done
+                               while (src >= original)
+                                       *dest++ = *src--;
+                               break;
+                       } else {
+                               ii++;
+                               jj = 0;
+                       }
+               }
+       } while (src >= original);
+ 
+       *dest++ = '\0';
+       reverse(newbuf);
+ 
+       return newbuf;
+ }
+ 
+ #if 0
+ // test program
+ 
+ int main(int argc, char **argv)
+ {
+       struct lconv *l;
+ 
+       setlocale(LC_ALL, "");
+       l = localeconv();
+ 
+       const char *new = add_thousands("12345678901234567890.54321", l);
+       printf("%s\n", new);
+       free((void*) new);
+ 
+       new = add_thousands("12345678901234567890", l);
+       printf("%s\n", new);
+       free((void*) new);
+ 
+       return 0;
+ }
+ #endif
diff --cc pc/Makefile.tst
index a26a70c,b2c92c7..e8fb497
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@@ -190,10 -190,10 +190,10 @@@ UNIX_TESTS = 
  
  GAWK_EXT_TESTS = \
        aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort arraysort2 
\
 -      arraytype \
 +      arraytype asortbool \
        backw badargs beginfile1 beginfile2 binmode1 \
        charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
-       clos1way6 crlf \
+       clos1way6 commas crlf \
        dbugeval dbugeval2 dbugeval3 dbugtypedre1 dbugtypedre2 delsub \
        devfd devfd1 devfd2 dfacheck1 dumpvars \
        errno exit fieldwdth forcenum \
diff --cc test/Makefile.am
index 94dba46,bd800ff..d9d3861
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@@ -1434,10 -1437,10 +1439,10 @@@ UNIX_TESTS = 
  
  GAWK_EXT_TESTS = \
        aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort arraysort2 
\
 -      arraytype \
 +      arraytype asortbool \
        backw badargs beginfile1 beginfile2 binmode1 \
        charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
-       clos1way6 crlf \
+       clos1way6 commas crlf \
        dbugeval dbugeval2 dbugeval3 dbugtypedre1 dbugtypedre2 delsub \
        devfd devfd1 devfd2 dfacheck1 dumpvars \
        errno exit fieldwdth forcenum \
diff --cc test/Makefile.in
index 18ccdfc,3a8381c..3892de6
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@@ -1697,10 -1700,10 +1702,10 @@@ UNIX_TESTS = 
  
  GAWK_EXT_TESTS = \
        aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort arraysort2 
\
 -      arraytype \
 +      arraytype asortbool \
        backw badargs beginfile1 beginfile2 binmode1 \
        charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
-       clos1way6 crlf \
+       clos1way6 commas crlf \
        dbugeval dbugeval2 dbugeval3 dbugtypedre1 dbugtypedre2 delsub \
        devfd devfd1 devfd2 dfacheck1 dumpvars \
        errno exit fieldwdth forcenum \

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

Summary of changes:
 ChangeLog        |   10 +
 builtin.c        |  117 ++++-
 pc/ChangeLog     |    4 +
 pc/Makefile.tst  |   17 +-
 po/ChangeLog     |    4 +
 po/bg.po         | 1251 +++++++++++++++++----------------------------------
 po/de.po         | 1309 ++++++++++++++++++------------------------------------
 po/fr.po         | 1239 ++++++++++++++++++---------------------------------
 po/pt_BR.po      | 1186 +++++++++++++++++--------------------------------
 test/ChangeLog   |    7 +
 test/Makefile.am |   13 +-
 test/Makefile.in |   24 +-
 test/Maketests   |   11 +
 test/typeof6.awk |   46 ++
 test/typeof6.ok  |    1 +
 15 files changed, 1944 insertions(+), 3295 deletions(-)
 create mode 100644 test/typeof6.awk
 create mode 100644 test/typeof6.ok


hooks/post-receive
-- 
gawk



reply via email to

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