"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "support/regex_internal.h" between
gawk-5.0.1.tar.xz and gawk-5.1.0.tar.xz

About: GNU awk - pattern scanning and processing language.

regex_internal.h  (gawk-5.0.1.tar.xz):regex_internal.h  (gawk-5.1.0.tar.xz)
/* Extended regular expression matching and search library. /* Extended regular expression matching and search library.
Copyright (C) 2002-2019 Free Software Foundation, Inc. Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */ <https://www.gnu.org/licenses/>. */
#ifndef _REGEX_INTERNAL_H #ifndef _REGEX_INTERNAL_H
#define _REGEX_INTERNAL_H 1 #define _REGEX_INTERNAL_H 1
#include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <langinfo.h> #include <langinfo.h>
#include <locale.h> #include <locale.h>
#include <wchar.h> #include <wchar.h>
#include <wctype.h> #include <wctype.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <intprops.h> #include <intprops.h>
#include <verify.h>
#if defined DEBUG && DEBUG != 0
# include <assert.h>
# define DEBUG_ASSERT(x) assert (x)
#else
# define DEBUG_ASSERT(x) assume (x)
#endif
#ifdef _LIBC #ifdef _LIBC
# include <libc-lock.h> # include <libc-lock.h>
# define lock_define(name) __libc_lock_define (, name) # define lock_define(name) __libc_lock_define (, name)
# define lock_init(lock) (__libc_lock_init (lock), 0) # define lock_init(lock) (__libc_lock_init (lock), 0)
# define lock_fini(lock) ((void) 0) # define lock_fini(lock) ((void) 0)
# define lock_lock(lock) __libc_lock_lock (lock) # define lock_lock(lock) __libc_lock_lock (lock)
# define lock_unlock(lock) __libc_lock_unlock (lock) # define lock_unlock(lock) __libc_lock_unlock (lock)
#elif defined GNULIB_LOCK && !defined USE_UNLOCKED_IO #elif defined GNULIB_LOCK && !defined USE_UNLOCKED_IO
# include "glthread/lock.h" # include "glthread/lock.h"
/* Use gl_lock_define if empty macro arguments are known to work. # define lock_define(name) gl_lock_define (, name)
Otherwise, fall back on less-portable substitutes. */
# if ((defined __GNUC__ && !defined __STRICT_ANSI__) \
|| (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__))
# define lock_define(name) gl_lock_define (, name)
# elif USE_POSIX_THREADS
# define lock_define(name) pthread_mutex_t name;
# elif USE_PTH_THREADS
# define lock_define(name) pth_mutex_t name;
# elif USE_SOLARIS_THREADS
# define lock_define(name) mutex_t name;
# elif USE_WINDOWS_THREADS
# define lock_define(name) gl_lock_t name;
# else
# define lock_define(name)
# endif
# define lock_init(lock) glthread_lock_init (&(lock)) # define lock_init(lock) glthread_lock_init (&(lock))
# define lock_fini(lock) glthread_lock_destroy (&(lock)) # define lock_fini(lock) glthread_lock_destroy (&(lock))
# define lock_lock(lock) glthread_lock_lock (&(lock)) # define lock_lock(lock) glthread_lock_lock (&(lock))
# define lock_unlock(lock) glthread_lock_unlock (&(lock)) # define lock_unlock(lock) glthread_lock_unlock (&(lock))
#elif defined GNULIB_PTHREAD && !defined USE_UNLOCKED_IO #elif defined GNULIB_PTHREAD && !defined USE_UNLOCKED_IO
# include <pthread.h> # include <pthread.h>
# define lock_define(name) pthread_mutex_t name; # define lock_define(name) pthread_mutex_t name;
# define lock_init(lock) pthread_mutex_init (&(lock), 0) # define lock_init(lock) pthread_mutex_init (&(lock), 0)
# define lock_fini(lock) pthread_mutex_destroy (&(lock)) # define lock_fini(lock) pthread_mutex_destroy (&(lock))
# define lock_lock(lock) pthread_mutex_lock (&(lock)) # define lock_lock(lock) pthread_mutex_lock (&(lock))
skipping to change at line 152 skipping to change at line 144
# define __towupper towupper # define __towupper towupper
# define __btowc btowc # define __btowc btowc
# define __mbrtowc mbrtowc # define __mbrtowc mbrtowc
# define __wcrtomb wcrtomb # define __wcrtomb wcrtomb
# define __regfree regfree # define __regfree regfree
#endif /* not _LIBC */ #endif /* not _LIBC */
#ifndef SSIZE_MAX #ifndef SSIZE_MAX
# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
#endif #endif
#ifndef ULONG_WIDTH
# define ULONG_WIDTH REGEX_UINTEGER_WIDTH (ULONG_MAX)
/* The number of usable bits in an unsigned integer type with maximum
value MAX, as an int expression suitable in #if. Cover all known
practical hosts. This implementation exploits the fact that MAX is
1 less than a power of 2, and merely counts the number of 1 bits in
MAX; "COBn" means "count the number of 1 bits in the low-order n bits". */
# define REGEX_UINTEGER_WIDTH(max) REGEX_COB128 (max)
# define REGEX_COB128(n) (REGEX_COB64 ((n) >> 31 >> 31 >> 2) + REGEX_COB64 (n))
# define REGEX_COB64(n) (REGEX_COB32 ((n) >> 31 >> 1) + REGEX_COB32 (n))
# define REGEX_COB32(n) (REGEX_COB16 ((n) >> 16) + REGEX_COB16 (n))
# define REGEX_COB16(n) (REGEX_COB8 ((n) >> 8) + REGEX_COB8 (n))
# define REGEX_COB8(n) (REGEX_COB4 ((n) >> 4) + REGEX_COB4 (n))
# define REGEX_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + ((n) & 1))
# if ULONG_MAX / 2 + 1 != 1ul << (ULONG_WIDTH - 1)
# error "ULONG_MAX out of range"
# endif
#endif
/* The type of indexes into strings. This is signed, not size_t, /* The type of indexes into strings. This is signed, not size_t,
since the API requires indexes to fit in regoff_t anyway, and using since the API requires indexes to fit in regoff_t anyway, and using
signed integers makes the code a bit smaller and presumably faster. signed integers makes the code a bit smaller and presumably faster.
The traditional GNU regex implementation uses int for indexes. The traditional GNU regex implementation uses int for indexes.
The POSIX-compatible implementation uses a possibly-wider type. The POSIX-compatible implementation uses a possibly-wider type.
The name 'Idx' is three letters to minimize the hassle of The name 'Idx' is three letters to minimize the hassle of
reindenting a lot of regex code that formerly used 'int'. */ reindenting a lot of regex code that formerly used 'int'. */
typedef regoff_t Idx; typedef regoff_t Idx;
#ifdef _REGEX_LARGE_OFFSETS #ifdef _REGEX_LARGE_OFFSETS
skipping to change at line 175 skipping to change at line 185
#endif #endif
/* A hash value, suitable for computing hash tables. */ /* A hash value, suitable for computing hash tables. */
typedef __re_size_t re_hashval_t; typedef __re_size_t re_hashval_t;
/* An integer used to represent a set of bits. It must be unsigned, /* An integer used to represent a set of bits. It must be unsigned,
and must be at least as wide as unsigned int. */ and must be at least as wide as unsigned int. */
typedef unsigned long int bitset_word_t; typedef unsigned long int bitset_word_t;
/* All bits set in a bitset_word_t. */ /* All bits set in a bitset_word_t. */
#define BITSET_WORD_MAX ULONG_MAX #define BITSET_WORD_MAX ULONG_MAX
/* Number of bits in a bitset_word_t. */
/* Number of bits in a bitset_word_t. For portability to hosts with #define BITSET_WORD_BITS ULONG_WIDTH
padding bits, do not use '(sizeof (bitset_word_t) * CHAR_BIT)';
instead, deduce it directly from BITSET_WORD_MAX. Avoid
greater-than-32-bit integers and unconditional shifts by more than
31 bits, as they're not portable. */
#if BITSET_WORD_MAX == 0xffffffffUL
# define BITSET_WORD_BITS 32
#elif BITSET_WORD_MAX >> 31 >> 4 == 1
# define BITSET_WORD_BITS 36
#elif BITSET_WORD_MAX >> 31 >> 16 == 1
# define BITSET_WORD_BITS 48
#elif BITSET_WORD_MAX >> 31 >> 28 == 1
# define BITSET_WORD_BITS 60
#elif BITSET_WORD_MAX >> 31 >> 31 >> 1 == 1
# define BITSET_WORD_BITS 64
#elif BITSET_WORD_MAX >> 31 >> 31 >> 9 == 1
# define BITSET_WORD_BITS 72
#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 3 == 1
# define BITSET_WORD_BITS 128
#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 7 == 1
# define BITSET_WORD_BITS 256
#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 7 > 1
# define BITSET_WORD_BITS 257 /* any value > SBC_MAX will do here */
# if BITSET_WORD_BITS <= SBC_MAX
# error "Invalid SBC_MAX"
# endif
#else
# error "Add case for new bitset_word_t size"
#endif
/* Number of bitset_word_t values in a bitset_t. */ /* Number of bitset_word_t values in a bitset_t. */
#define BITSET_WORDS ((SBC_MAX + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS) #define BITSET_WORDS ((SBC_MAX + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS)
typedef bitset_word_t bitset_t[BITSET_WORDS]; typedef bitset_word_t bitset_t[BITSET_WORDS];
typedef bitset_word_t *re_bitset_ptr_t; typedef bitset_word_t *re_bitset_ptr_t;
typedef const bitset_word_t *re_const_bitset_ptr_t; typedef const bitset_word_t *re_const_bitset_ptr_t;
#define PREV_WORD_CONSTRAINT 0x0001 #define PREV_WORD_CONSTRAINT 0x0001
#define PREV_NOTWORD_CONSTRAINT 0x0002 #define PREV_NOTWORD_CONSTRAINT 0x0002
skipping to change at line 611 skipping to change at line 593
Idx nlasts; /* The number of LASTS. */ Idx nlasts; /* The number of LASTS. */
re_sub_match_last_t **lasts; re_sub_match_last_t **lasts;
} re_sub_match_top_t; } re_sub_match_top_t;
struct re_backref_cache_entry struct re_backref_cache_entry
{ {
Idx node; Idx node;
Idx str_idx; Idx str_idx;
Idx subexp_from; Idx subexp_from;
Idx subexp_to; Idx subexp_to;
bitset_word_t eps_reachable_subexps_map;
char more; char more;
char unused;
unsigned short int eps_reachable_subexps_map;
}; };
typedef struct typedef struct
{ {
/* The string object corresponding to the input string. */ /* The string object corresponding to the input string. */
re_string_t input; re_string_t input;
#if defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
const re_dfa_t *const dfa; const re_dfa_t *const dfa;
#else
const re_dfa_t *dfa;
#endif
/* EFLAGS of the argument of regexec. */ /* EFLAGS of the argument of regexec. */
int eflags; int eflags;
/* Where the matching ends. */ /* Where the matching ends. */
Idx match_last; Idx match_last;
Idx last_node; Idx last_node;
/* The state log used by the matcher. */ /* The state log used by the matcher. */
re_dfastate_t **state_log; re_dfastate_t **state_log;
Idx state_log_top; Idx state_log_top;
/* Back reference cache. */ /* Back reference cache. */
Idx nbkref_ents; Idx nbkref_ents;
 End of changes. 10 change blocks. 
54 lines changed or deleted 31 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)