diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | configh.in | 3 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | dfa.c | 43 | ||||
-rw-r--r-- | regex.c | 2 |
6 files changed, 51 insertions, 9 deletions
@@ -1,3 +1,11 @@ +2012-05-01 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. RRI code now there, needed additional + change for gawk. + * configure.ac: Add check for stdbool.h. + * regex.c: Add check for if not have stdbool.h, then define the + bool stuff. + 2012-04-27 Arnold D. Robbins <arnold@skeeve.com> * dfa.c: Sync with GNU grep. @@ -177,6 +177,9 @@ /* Define to 1 if you have the <stdarg.h> header file. */ #undef HAVE_STDARG_H +/* Define to 1 if you have the <stdbool.h> header file. */ +#undef HAVE_STDBOOL_H + /* Define to 1 if you have the <stddef.h> header file. */ #undef HAVE_STDDEF_H @@ -8222,7 +8222,7 @@ $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi for ac_header in arpa/inet.h fcntl.h limits.h locale.h libintl.h mcheck.h \ - netdb.h netinet/in.h stdarg.h stddef.h string.h \ + netdb.h netinet/in.h stdarg.h stddef.h stdbool.h string.h \ sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h \ termios.h stropts.h wchar.h wctype.h do : diff --git a/configure.ac b/configure.ac index 274ec85b..d618476d 100644 --- a/configure.ac +++ b/configure.ac @@ -138,7 +138,7 @@ AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_HEADER_TIME AC_CHECK_HEADERS(arpa/inet.h fcntl.h limits.h locale.h libintl.h mcheck.h \ - netdb.h netinet/in.h stdarg.h stddef.h string.h \ + netdb.h netinet/in.h stdarg.h stddef.h stdbool.h string.h \ sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h \ termios.h stropts.h wchar.h wctype.h) @@ -36,6 +36,14 @@ #if HAVE_SETLOCALE #include <locale.h> #endif +#ifdef HAVE_STDBOOL_H +#include <stdbool.h> +#else +#define bool int +#define true (1) +#define false (0) +#endif /* HAVE_STDBOOL_H */ + #define STREQ(a, b) (strcmp (a, b) == 0) @@ -61,10 +69,6 @@ #endif #ifdef GAWK -#define bool int -#define true (1) -#define false (0) - /* The __pure__ attribute was added in gcc 2.96. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) @@ -1134,6 +1138,33 @@ parse_bracket_exp (void) } else { +#ifndef GAWK + /* Defer to the system regex library about the meaning + of range expressions. */ + regex_t re; + char pattern[6] = { '[', 0, '-', 0, ']', 0 }; + char subject[2] = { 0, 0 }; + c1 = c; + if (case_fold) + { + c1 = tolower (c1); + c2 = tolower (c2); + } + + pattern[1] = c1; + pattern[3] = c2; + regcomp (&re, pattern, REG_NOSUB); + for (c = 0; c < NOTCHAR; ++c) + { + if ((case_fold && isupper (c)) + || (MB_CUR_MAX > 1 && btowc (c) == WEOF)) + continue; + subject[0] = c; + if (regexec (&re, subject, 0, NULL, 0) != REG_NOMATCH) + setbit_case_fold_c (c, ccl); + } + regfree (&re); +#else c1 = c; if (case_fold) { @@ -1142,6 +1173,7 @@ parse_bracket_exp (void) } for (c = c1; c <= c2; c++) setbit_case_fold_c (c, ccl); +#endif } colon_warning_state |= 8; @@ -3049,8 +3081,7 @@ match_mb_charset (struct dfa *d, state_num s, position pos, size_t idx) /* match with a range? */ for (i = 0; i < work_mbc->nranges; i++) { - if (work_mbc->range_sts[i] <= wc && - wc <= work_mbc->range_ends[i]) + if (work_mbc->range_sts[i] <= wc && wc <= work_mbc->range_ends[i]) goto charset_matched; } @@ -64,7 +64,7 @@ #include "regex_internal.h" #include "regex_internal.c" -#ifdef GAWK +#ifndef HAVE_STDBOOL_H #define bool int #define true (1) #define false (0) |