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.1-stable, updated. gawk-4.1.0-874


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-874-gc65ebde
Date: Sun, 24 Apr 2016 15:07:26 +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.1-stable has been updated
       via  c65ebdef5333b1a9b891d4235367dc158d3f05b4 (commit)
       via  82242cb6dfd7ca365ab65966a648b7cf884a1859 (commit)
      from  b3b326510806ebb2459bd6d3f17213e4748bcce0 (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=c65ebdef5333b1a9b891d4235367dc158d3f05b4

commit c65ebdef5333b1a9b891d4235367dc158d3f05b4
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Apr 24 18:07:11 2016 +0300

    Sync dfa.c with grep.

diff --git a/ChangeLog b/ChangeLog
index 5a52517..bb61054 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-04-24         Arnold D. Robbins     <address@hidden>
+
+       * dfa.c: Sync with GNU grep.
+
 2016-04-11         Arnold D. Robbins     <address@hidden>
 
        * regex_internal.c: Replace _GL_ATTRIBUTE_PURE with
diff --git a/dfa.c b/dfa.c
index 76d3fab..fff4599 100644
--- a/dfa.c
+++ b/dfa.c
@@ -385,11 +385,6 @@ struct dfa
    */
   int *multibyte_prop;
 
-  /* A table indexed by byte values that contains the corresponding wide
-     character (if any) for that byte.  WEOF means the byte is not a
-     valid single-byte character.  */
-  wint_t mbrtowc_cache[NOTCHAR];
-
   /* Array of the bracket expression in the DFA.  */
   struct mb_char_classes *mbcsets;
   size_t nmbcsets;
@@ -466,19 +461,10 @@ struct dfa
 
 static void regexp (void);
 
-static void
-dfambcache (struct dfa *d)
-{
-  int i;
-  for (i = CHAR_MIN; i <= CHAR_MAX; ++i)
-    {
-      char c = i;
-      unsigned char uc = i;
-      mbstate_t s = { 0 };
-      wchar_t wc;
-      d->mbrtowc_cache[uc] = mbrtowc (&wc, &c, 1, &s) <= 1 ? wc : WEOF;
-    }
-}
+/* A table indexed by byte values that contains the corresponding wide
+   character (if any) for that byte.  WEOF means the byte is not a
+   valid single-byte character.  */
+static wint_t mbrtowc_cache[NOTCHAR];
 
 /* Store into *PWC the result of converting the leading bytes of the
    multibyte buffer S of length N bytes, using the mbrtowc_cache in *D
@@ -501,7 +487,7 @@ static size_t
 mbs_to_wchar (wint_t *pwc, char const *s, size_t n, struct dfa *d)
 {
   unsigned char uc = s[0];
-  wint_t wc = d->mbrtowc_cache[uc];
+  wint_t wc = mbrtowc_cache[uc];
 
   if (wc == WEOF)
     {
@@ -706,25 +692,18 @@ static charclass letters;
 /* Set of characters that are newline.  */
 static charclass newline;
 
-/* Add this to the test for whether a byte is word-constituent, since on
-   BSD-based systems, many values in the 128..255 range are classified as
-   alphabetic, while on glibc-based systems, they are not.  */
-#ifdef __GLIBC__
-# define is_valid_unibyte_character(c) 1
-#else
-# define is_valid_unibyte_character(c) (btowc (c) != WEOF)
-#endif
-
-/* C is a "word-constituent" byte.  */
-#define IS_WORD_CONSTITUENT(C) \
-  (is_valid_unibyte_character (C) && (isalnum (C) || (C) == '_'))
+static bool
+unibyte_word_constituent (unsigned char c)
+{
+  return mbrtowc_cache[c] != WEOF && (isalnum (c) || (c) == '_');
+}
 
 static int
 char_context (unsigned char c)
 {
   if (c == eolbyte)
     return CTX_NEWLINE;
-  if (IS_WORD_CONSTITUENT (c))
+  if (unibyte_word_constituent (c))
     return CTX_LETTER;
   return CTX_NONE;
 }
@@ -743,23 +722,29 @@ wchar_context (wint_t wc)
 void
 dfasyntax (reg_syntax_t bits, int fold, unsigned char eol)
 {
-  unsigned int i;
-
+  int i;
   syntax_bits_set = 1;
   syntax_bits = bits;
   case_fold = fold != 0;
   eolbyte = eol;
 
-  for (i = 0; i < NOTCHAR; ++i)
+  for (i = CHAR_MIN; i <= CHAR_MAX; ++i)
     {
-      sbit[i] = char_context (i);
-      switch (sbit[i])
+      char c = i;
+      unsigned char uc = i;
+      mbstate_t s = { 0 };
+      wchar_t wc;
+      mbrtowc_cache[uc] = mbrtowc (&wc, &c, 1, &s) <= 1 ? wc : WEOF;
+
+      /* Now that mbrtowc_cache[uc] is set, use it to calculate sbit.  */
+      sbit[uc] = char_context (uc);
+      switch (sbit[uc])
         {
         case CTX_LETTER:
-          setbit (i, letters);
+          setbit (uc, letters);
           break;
         case CTX_NEWLINE:
-          setbit (i, newline);
+          setbit (uc, newline);
           break;
         }
     }
@@ -1528,7 +1513,7 @@ lex (void)
             {
               zeroset (ccl);
               for (c2 = 0; c2 < NOTCHAR; ++c2)
-                if (IS_WORD_CONSTITUENT (c2))
+                if (unibyte_word_constituent (c2))
                   setbit (c2, ccl);
               if (c == 'W')
                 notset (ccl);
@@ -2753,7 +2738,7 @@ dfastate (state_num s, struct dfa *d, state_num trans[])
         state_letter = state;
 
       for (i = 0; i < NOTCHAR; ++i)
-        trans[i] = (IS_WORD_CONSTITUENT (i)) ? state_letter : state;
+        trans[i] = unibyte_word_constituent (i) ? state_letter : state;
       trans[eolbyte] = state_newline;
     }
   else
@@ -2859,7 +2844,7 @@ dfastate (state_num s, struct dfa *d, state_num trans[])
 
               if (c == eolbyte)
                 trans[c] = state_newline;
-              else if (IS_WORD_CONSTITUENT (c))
+              else if (unibyte_word_constituent (c))
                 trans[c] = state_letter;
               else if (c < NOTCHAR)
                 trans[c] = state;
@@ -3666,7 +3651,6 @@ void
 dfacomp (char const *s, size_t len, struct dfa *d, int searchflag)
 {
   dfainit (d);
-  dfambcache (d);
   dfaparse (s, len, d);
   dfassbuild (d);
 

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

commit 82242cb6dfd7ca365ab65966a648b7cf884a1859
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Apr 24 18:04:29 2016 +0300

    Make pty1 test ignore errors.

diff --git a/test/ChangeLog b/test/ChangeLog
index 1b1648b..be9eb7d 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2016-04-24         Arnold D. Robbins     <address@hidden>
+
+       * Makefile.am (pty1): Ignore errors.
+
 2016-04-17         Arnold D. Robbins     <address@hidden>
 
        * Makefile.am (pty1): Really disable test on z/OS.
diff --git a/test/Makefile.am b/test/Makefile.am
index 8ffe7db..be25403 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -2134,7 +2134,7 @@ watchpoint1:
 
 pty1:
        @echo $@
-       @case `uname` in \
+       @-case `uname` in \
        *[Oo][Ss]/390*) : ;; \
        *) AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@ ; \
        $(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@ ;; \
diff --git a/test/Makefile.in b/test/Makefile.in
index c5bca01..201f436 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -271,6 +271,7 @@ pkgextensiondir = @pkgextensiondir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -2573,7 +2574,7 @@ watchpoint1:
 
 pty1:
        @echo $@
-       @case `uname` in \
+       @-case `uname` in \
        *[Oo][Ss]/390*) : ;; \
        *) AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@ ; \
        $(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@ ;; \

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

Summary of changes:
 ChangeLog        |    4 ++++
 dfa.c            |   70 +++++++++++++++++++++---------------------------------
 test/ChangeLog   |    4 ++++
 test/Makefile.am |    2 +-
 test/Makefile.in |    3 ++-
 5 files changed, 38 insertions(+), 45 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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