glibc/posix/regex_internal.h

795 lines
23 KiB
C
Raw Normal View History

/* Extended regular expression matching and search library.
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
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,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _REGEX_INTERNAL_H
#define _REGEX_INTERNAL_H 1
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined HAVE_LOCALE_H || defined _LIBC
# include <locale.h>
#endif
#if defined HAVE_WCHAR_H || defined _LIBC
# include <wchar.h>
#endif /* HAVE_WCHAR_H || _LIBC */
#if defined HAVE_WCTYPE_H || defined _LIBC
# include <wctype.h>
#endif /* HAVE_WCTYPE_H || _LIBC */
/* In case that the system doesn't have isblank(). */
#if !defined _LIBC && !defined HAVE_ISBLANK && !defined isblank
# define isblank(ch) ((ch) == ' ' || (ch) == '\t')
#endif
#ifdef _LIBC
# ifndef _RE_DEFINE_LOCALE_FUNCTIONS
# define _RE_DEFINE_LOCALE_FUNCTIONS 1
# include <locale/localeinfo.h>
# include <locale/elem-hash.h>
# include <locale/coll-lookup.h>
# endif
#endif
/* This is for other GNU distributions with internationalized messages. */
#if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
# include <libintl.h>
# ifdef _LIBC
# undef gettext
# define gettext(msgid) \
INTUSE(__dcgettext) (INTUSE(_libc_intl_domainname), msgid, LC_MESSAGES)
# endif
#else
# define gettext(msgid) (msgid)
#endif
#ifndef gettext_noop
/* This define is so xgettext can find the internationalizable
strings. */
# define gettext_noop(String) String
#endif
#if (defined MB_CUR_MAX && HAVE_LOCALE_H && HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_WCRTOMB && HAVE_MBRTOWC && HAVE_WCSCOLL) || _LIBC
# define RE_ENABLE_I18N
#endif
#if __GNUC__ >= 3
# define BE(expr, val) __builtin_expect (expr, val)
#else
# define BE(expr, val) (expr)
# define inline
#endif
/* Number of bits in a byte. */
#define BYTE_BITS 8
/* Number of single byte character. */
#define SBC_MAX 256
#define COLL_ELEM_LEN_MAX 8
/* The character which represents newline. */
#define NEWLINE_CHAR '\n'
#define WIDE_NEWLINE_CHAR L'\n'
/* Rename to standard API for using out of glibc. */
#ifndef _LIBC
# define __wctype wctype
# define __iswctype iswctype
# define __btowc btowc
# define __mempcpy mempcpy
# define __wcrtomb wcrtomb
# define attribute_hidden
#endif /* not _LIBC */
#ifdef __GNUC__
# define __attribute(arg) __attribute__ (arg)
#else
# define __attribute(arg)
#endif
extern const char __re_error_msgid[] attribute_hidden;
extern const size_t __re_error_msgid_idx[] attribute_hidden;
/* Number of bits in an unsinged int. */
#define UINT_BITS (sizeof (unsigned int) * BYTE_BITS)
/* Number of unsigned int in an bit_set. */
#define BITSET_UINTS ((SBC_MAX + UINT_BITS - 1) / UINT_BITS)
typedef unsigned int bitset[BITSET_UINTS];
typedef unsigned int *re_bitset_ptr_t;
Update. 2004-01-02 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (re_node_set_insert): Remove unused variables. * posix/regex_internal.h (re_dfa_t): Add syntax field. * posix/regcomp.c (parse): Initialize dfa->syntax. * posix/regexec.c (acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_state_context, proceed_next_node, sift_states_iter_mb, sift_states_backward, update_cur_sifted_state, sift_states_bkref, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache, build_trtable): Remove preg argument, add dfa argument instead and remove dfa = preg->buffer initialization in the body. Adjust all callers. (check_node_accept_bytes, group_nodes_into_DFAstates, check_node_accept): Likewise. Use dfa->syntax instead of preg->syntax. (check_arrival_add_next_nodes): Remove preg argument. * posix/regex_internal.h (re_match_context_t): Make input re_string_t instead of a pointer to it. * posix/regex_internal.c (re_string_construct_common): Don't clear pstr here... (re_string_construct): ... but only here. * posix/regexec.c (match_ctx_init): Remove input argument. Don't initialize fields to zero. (re_search_internal): Move input into mctx.input. (acquire_init_state_context, check_matching, check_halt_state_context, proceed_next_node, clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, check_arrival, check_arrival_add_next_nodes, check_node_accept, extend_buffers): Change mctx->input into &mctx->input and mctx->input->field into mctx->input.field. 2004-01-02 Jakub Jelinek <jakub@redhat.com> Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_const_bitset_ptr_t): New type. (re_string_t): Add newline_anchor, word_char and word_ops_used fields. (re_dfa_t): Change word_char type to bitset. Add word_ops_used field. (re_string_context_at, re_string_reconstruct): Remove last argument. * posix/regex_internal.c (re_string_allocate): Initialize pstr->word_char and pstr->word_ops_used. (re_string_context_at): Remove newline_anchor argument. Use input->newline_anchor instead, swap && conditions. Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0. Use input->word_char bitmap instead of IS_WORD_CHAR. (re_string_reconstruct): Likewise. Adjust re_string_context_at caller. * posix/regexec.c (acquire_init_state_context, check_halt_state_context, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, check_arrival, check_node_accept): Adjust re_string_context_at and re_string_reconstruct callers. (re_search_internal): Likewise. Set input.newline_anchor. (build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR. * posix/regcomp.c (init_word_char): Change return type to void. Set dfa->word_ops_used. (free_dfa_content): Don't free dfa->word_char. (parse_expression): Remove error handling for init_word_char.
2004-01-02 22:20:51 +01:00
typedef const unsigned int *re_const_bitset_ptr_t;
#define bitset_set(set,i) (set[i / UINT_BITS] |= 1 << i % UINT_BITS)
#define bitset_clear(set,i) (set[i / UINT_BITS] &= ~(1 << i % UINT_BITS))
#define bitset_contain(set,i) (set[i / UINT_BITS] & (1 << i % UINT_BITS))
#define bitset_empty(set) memset (set, 0, sizeof (unsigned int) * BITSET_UINTS)
#define bitset_set_all(set) \
memset (set, 255, sizeof (unsigned int) * BITSET_UINTS)
#define bitset_copy(dest,src) \
memcpy (dest, src, sizeof (unsigned int) * BITSET_UINTS)
static inline void bitset_not (bitset set);
static inline void bitset_merge (bitset dest, const bitset src);
static inline void bitset_not_merge (bitset dest, const bitset src);
static inline void bitset_mask (bitset dest, const bitset src);
#define PREV_WORD_CONSTRAINT 0x0001
#define PREV_NOTWORD_CONSTRAINT 0x0002
#define NEXT_WORD_CONSTRAINT 0x0004
#define NEXT_NOTWORD_CONSTRAINT 0x0008
#define PREV_NEWLINE_CONSTRAINT 0x0010
#define NEXT_NEWLINE_CONSTRAINT 0x0020
#define PREV_BEGBUF_CONSTRAINT 0x0040
#define NEXT_ENDBUF_CONSTRAINT 0x0080
#define DUMMY_CONSTRAINT 0x0100
typedef enum
{
INSIDE_WORD = PREV_WORD_CONSTRAINT | NEXT_WORD_CONSTRAINT,
WORD_FIRST = PREV_NOTWORD_CONSTRAINT | NEXT_WORD_CONSTRAINT,
WORD_LAST = PREV_WORD_CONSTRAINT | NEXT_NOTWORD_CONSTRAINT,
LINE_FIRST = PREV_NEWLINE_CONSTRAINT,
LINE_LAST = NEXT_NEWLINE_CONSTRAINT,
BUF_FIRST = PREV_BEGBUF_CONSTRAINT,
BUF_LAST = NEXT_ENDBUF_CONSTRAINT,
WORD_DELIM = DUMMY_CONSTRAINT
} re_context_type;
typedef struct
{
int alloc;
int nelem;
int *elems;
} re_node_set;
typedef enum
{
NON_TYPE = 0,
/* Node type, These are used by token, node, tree. */
CHARACTER = 1,
END_OF_RE = 2,
SIMPLE_BRACKET = 3,
OP_BACK_REF = 4,
OP_PERIOD = 5,
#ifdef RE_ENABLE_I18N
COMPLEX_BRACKET = 6,
OP_UTF8_PERIOD = 7,
#endif /* RE_ENABLE_I18N */
/* We define EPSILON_BIT as a macro so that OP_OPEN_SUBEXP is used
when the debugger shows values of this enum type. */
#define EPSILON_BIT 8
OP_OPEN_SUBEXP = EPSILON_BIT | 0,
OP_CLOSE_SUBEXP = EPSILON_BIT | 1,
OP_ALT = EPSILON_BIT | 2,
OP_DUP_ASTERISK = EPSILON_BIT | 3,
OP_DUP_PLUS = EPSILON_BIT | 4,
OP_DUP_QUESTION = EPSILON_BIT | 5,
ANCHOR = EPSILON_BIT | 6,
/* Tree type, these are used only by tree. */
CONCAT = 16,
/* Token type, these are used only by token. */
OP_OPEN_BRACKET = 17,
OP_CLOSE_BRACKET,
OP_CHARSET_RANGE,
OP_OPEN_DUP_NUM,
OP_CLOSE_DUP_NUM,
OP_NON_MATCH_LIST,
OP_OPEN_COLL_ELEM,
OP_CLOSE_COLL_ELEM,
OP_OPEN_EQUIV_CLASS,
OP_CLOSE_EQUIV_CLASS,
OP_OPEN_CHAR_CLASS,
OP_CLOSE_CHAR_CLASS,
OP_WORD,
OP_NOTWORD,
OP_SPACE,
OP_NOTSPACE,
BACK_SLASH
} re_token_type_t;
Update. 2002-05-21 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regex.c: Define `inline' as a macro into nothing for the compilers which lack the keyword. * posix/regex.h: (RE_SYNTAX_GNU_AWK): Remove RE_CONTEXT_INVALID_OPS for the compatibility of gawk. * posix/regcomp.c: Add fake implementation of isblank() for the environments which lack the function. Don't use free_charset() in case of non-i18n envs. (build_range_exp): Don't use i18n related code in case of non-i18n envs. (build_collating_symbol): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (re_compile_fastmap_iter): Likewise. (parse_bracket_exp): Likewise. (build_word_op): Likewise. (regfree): Don't use free_charset() in case of non-i18n envs. * posix/regex_internal.h: Remove COMPLEX_BRACKET from re_token_type_t in case of non-i18n envs. Don't define re_charset_t in case of non-i18n envs. Change the type of wcs of re_string_t from wchar_t to wint_t, since we store also WEOF. * posix/regex_internal.c: (re_string_realloc_buffers): Change the type of wcs of re_string_t from wchar_t to wint_t. (re_string_reconstruct): Likewise. (create_ci_newstate): Don't use i18n related code in case of non-i18n envs. (create_cd_newstate): Likewise. 2002-05-24 Ulrich Drepper <drepper@redhat.com> * iconv/loop.c: Fix typo. 2002-05-23 Jakub Jelinek <jakub@redhat.com> * inet/ether_line.c (ether_line): Fix a typo causing only lower 4 bits of each ethernet address byte being assigned. Don't modify what line points to. * inet/tst-ether_aton.c (main): Add ether_line tests. 2002-05-23 Marcus Brinkmann <marcus@gnu.org> * manual/filesys.texi: Don't make readlink example leak memory when readlink fails.
2002-05-24 10:49:00 +02:00
#ifdef RE_ENABLE_I18N
typedef struct
{
/* Multibyte characters. */
wchar_t *mbchars;
/* Collating symbols. */
Update. 2002-05-21 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regex.c: Define `inline' as a macro into nothing for the compilers which lack the keyword. * posix/regex.h: (RE_SYNTAX_GNU_AWK): Remove RE_CONTEXT_INVALID_OPS for the compatibility of gawk. * posix/regcomp.c: Add fake implementation of isblank() for the environments which lack the function. Don't use free_charset() in case of non-i18n envs. (build_range_exp): Don't use i18n related code in case of non-i18n envs. (build_collating_symbol): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (re_compile_fastmap_iter): Likewise. (parse_bracket_exp): Likewise. (build_word_op): Likewise. (regfree): Don't use free_charset() in case of non-i18n envs. * posix/regex_internal.h: Remove COMPLEX_BRACKET from re_token_type_t in case of non-i18n envs. Don't define re_charset_t in case of non-i18n envs. Change the type of wcs of re_string_t from wchar_t to wint_t, since we store also WEOF. * posix/regex_internal.c: (re_string_realloc_buffers): Change the type of wcs of re_string_t from wchar_t to wint_t. (re_string_reconstruct): Likewise. (create_ci_newstate): Don't use i18n related code in case of non-i18n envs. (create_cd_newstate): Likewise. 2002-05-24 Ulrich Drepper <drepper@redhat.com> * iconv/loop.c: Fix typo. 2002-05-23 Jakub Jelinek <jakub@redhat.com> * inet/ether_line.c (ether_line): Fix a typo causing only lower 4 bits of each ethernet address byte being assigned. Don't modify what line points to. * inet/tst-ether_aton.c (main): Add ether_line tests. 2002-05-23 Marcus Brinkmann <marcus@gnu.org> * manual/filesys.texi: Don't make readlink example leak memory when readlink fails.
2002-05-24 10:49:00 +02:00
# ifdef _LIBC
int32_t *coll_syms;
Update. 2002-05-21 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regex.c: Define `inline' as a macro into nothing for the compilers which lack the keyword. * posix/regex.h: (RE_SYNTAX_GNU_AWK): Remove RE_CONTEXT_INVALID_OPS for the compatibility of gawk. * posix/regcomp.c: Add fake implementation of isblank() for the environments which lack the function. Don't use free_charset() in case of non-i18n envs. (build_range_exp): Don't use i18n related code in case of non-i18n envs. (build_collating_symbol): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (re_compile_fastmap_iter): Likewise. (parse_bracket_exp): Likewise. (build_word_op): Likewise. (regfree): Don't use free_charset() in case of non-i18n envs. * posix/regex_internal.h: Remove COMPLEX_BRACKET from re_token_type_t in case of non-i18n envs. Don't define re_charset_t in case of non-i18n envs. Change the type of wcs of re_string_t from wchar_t to wint_t, since we store also WEOF. * posix/regex_internal.c: (re_string_realloc_buffers): Change the type of wcs of re_string_t from wchar_t to wint_t. (re_string_reconstruct): Likewise. (create_ci_newstate): Don't use i18n related code in case of non-i18n envs. (create_cd_newstate): Likewise. 2002-05-24 Ulrich Drepper <drepper@redhat.com> * iconv/loop.c: Fix typo. 2002-05-23 Jakub Jelinek <jakub@redhat.com> * inet/ether_line.c (ether_line): Fix a typo causing only lower 4 bits of each ethernet address byte being assigned. Don't modify what line points to. * inet/tst-ether_aton.c (main): Add ether_line tests. 2002-05-23 Marcus Brinkmann <marcus@gnu.org> * manual/filesys.texi: Don't make readlink example leak memory when readlink fails.
2002-05-24 10:49:00 +02:00
# endif
/* Equivalence classes. */
Update. 2002-05-21 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regex.c: Define `inline' as a macro into nothing for the compilers which lack the keyword. * posix/regex.h: (RE_SYNTAX_GNU_AWK): Remove RE_CONTEXT_INVALID_OPS for the compatibility of gawk. * posix/regcomp.c: Add fake implementation of isblank() for the environments which lack the function. Don't use free_charset() in case of non-i18n envs. (build_range_exp): Don't use i18n related code in case of non-i18n envs. (build_collating_symbol): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (re_compile_fastmap_iter): Likewise. (parse_bracket_exp): Likewise. (build_word_op): Likewise. (regfree): Don't use free_charset() in case of non-i18n envs. * posix/regex_internal.h: Remove COMPLEX_BRACKET from re_token_type_t in case of non-i18n envs. Don't define re_charset_t in case of non-i18n envs. Change the type of wcs of re_string_t from wchar_t to wint_t, since we store also WEOF. * posix/regex_internal.c: (re_string_realloc_buffers): Change the type of wcs of re_string_t from wchar_t to wint_t. (re_string_reconstruct): Likewise. (create_ci_newstate): Don't use i18n related code in case of non-i18n envs. (create_cd_newstate): Likewise. 2002-05-24 Ulrich Drepper <drepper@redhat.com> * iconv/loop.c: Fix typo. 2002-05-23 Jakub Jelinek <jakub@redhat.com> * inet/ether_line.c (ether_line): Fix a typo causing only lower 4 bits of each ethernet address byte being assigned. Don't modify what line points to. * inet/tst-ether_aton.c (main): Add ether_line tests. 2002-05-23 Marcus Brinkmann <marcus@gnu.org> * manual/filesys.texi: Don't make readlink example leak memory when readlink fails.
2002-05-24 10:49:00 +02:00
# ifdef _LIBC
int32_t *equiv_classes;
Update. 2002-05-21 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regex.c: Define `inline' as a macro into nothing for the compilers which lack the keyword. * posix/regex.h: (RE_SYNTAX_GNU_AWK): Remove RE_CONTEXT_INVALID_OPS for the compatibility of gawk. * posix/regcomp.c: Add fake implementation of isblank() for the environments which lack the function. Don't use free_charset() in case of non-i18n envs. (build_range_exp): Don't use i18n related code in case of non-i18n envs. (build_collating_symbol): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (re_compile_fastmap_iter): Likewise. (parse_bracket_exp): Likewise. (build_word_op): Likewise. (regfree): Don't use free_charset() in case of non-i18n envs. * posix/regex_internal.h: Remove COMPLEX_BRACKET from re_token_type_t in case of non-i18n envs. Don't define re_charset_t in case of non-i18n envs. Change the type of wcs of re_string_t from wchar_t to wint_t, since we store also WEOF. * posix/regex_internal.c: (re_string_realloc_buffers): Change the type of wcs of re_string_t from wchar_t to wint_t. (re_string_reconstruct): Likewise. (create_ci_newstate): Don't use i18n related code in case of non-i18n envs. (create_cd_newstate): Likewise. 2002-05-24 Ulrich Drepper <drepper@redhat.com> * iconv/loop.c: Fix typo. 2002-05-23 Jakub Jelinek <jakub@redhat.com> * inet/ether_line.c (ether_line): Fix a typo causing only lower 4 bits of each ethernet address byte being assigned. Don't modify what line points to. * inet/tst-ether_aton.c (main): Add ether_line tests. 2002-05-23 Marcus Brinkmann <marcus@gnu.org> * manual/filesys.texi: Don't make readlink example leak memory when readlink fails.
2002-05-24 10:49:00 +02:00
# endif
/* Range expressions. */
Update. 2002-05-21 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regex.c: Define `inline' as a macro into nothing for the compilers which lack the keyword. * posix/regex.h: (RE_SYNTAX_GNU_AWK): Remove RE_CONTEXT_INVALID_OPS for the compatibility of gawk. * posix/regcomp.c: Add fake implementation of isblank() for the environments which lack the function. Don't use free_charset() in case of non-i18n envs. (build_range_exp): Don't use i18n related code in case of non-i18n envs. (build_collating_symbol): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (re_compile_fastmap_iter): Likewise. (parse_bracket_exp): Likewise. (build_word_op): Likewise. (regfree): Don't use free_charset() in case of non-i18n envs. * posix/regex_internal.h: Remove COMPLEX_BRACKET from re_token_type_t in case of non-i18n envs. Don't define re_charset_t in case of non-i18n envs. Change the type of wcs of re_string_t from wchar_t to wint_t, since we store also WEOF. * posix/regex_internal.c: (re_string_realloc_buffers): Change the type of wcs of re_string_t from wchar_t to wint_t. (re_string_reconstruct): Likewise. (create_ci_newstate): Don't use i18n related code in case of non-i18n envs. (create_cd_newstate): Likewise. 2002-05-24 Ulrich Drepper <drepper@redhat.com> * iconv/loop.c: Fix typo. 2002-05-23 Jakub Jelinek <jakub@redhat.com> * inet/ether_line.c (ether_line): Fix a typo causing only lower 4 bits of each ethernet address byte being assigned. Don't modify what line points to. * inet/tst-ether_aton.c (main): Add ether_line tests. 2002-05-23 Marcus Brinkmann <marcus@gnu.org> * manual/filesys.texi: Don't make readlink example leak memory when readlink fails.
2002-05-24 10:49:00 +02:00
# ifdef _LIBC
uint32_t *range_starts;
uint32_t *range_ends;
Update. 2002-05-21 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regex.c: Define `inline' as a macro into nothing for the compilers which lack the keyword. * posix/regex.h: (RE_SYNTAX_GNU_AWK): Remove RE_CONTEXT_INVALID_OPS for the compatibility of gawk. * posix/regcomp.c: Add fake implementation of isblank() for the environments which lack the function. Don't use free_charset() in case of non-i18n envs. (build_range_exp): Don't use i18n related code in case of non-i18n envs. (build_collating_symbol): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (re_compile_fastmap_iter): Likewise. (parse_bracket_exp): Likewise. (build_word_op): Likewise. (regfree): Don't use free_charset() in case of non-i18n envs. * posix/regex_internal.h: Remove COMPLEX_BRACKET from re_token_type_t in case of non-i18n envs. Don't define re_charset_t in case of non-i18n envs. Change the type of wcs of re_string_t from wchar_t to wint_t, since we store also WEOF. * posix/regex_internal.c: (re_string_realloc_buffers): Change the type of wcs of re_string_t from wchar_t to wint_t. (re_string_reconstruct): Likewise. (create_ci_newstate): Don't use i18n related code in case of non-i18n envs. (create_cd_newstate): Likewise. 2002-05-24 Ulrich Drepper <drepper@redhat.com> * iconv/loop.c: Fix typo. 2002-05-23 Jakub Jelinek <jakub@redhat.com> * inet/ether_line.c (ether_line): Fix a typo causing only lower 4 bits of each ethernet address byte being assigned. Don't modify what line points to. * inet/tst-ether_aton.c (main): Add ether_line tests. 2002-05-23 Marcus Brinkmann <marcus@gnu.org> * manual/filesys.texi: Don't make readlink example leak memory when readlink fails.
2002-05-24 10:49:00 +02:00
# else /* not _LIBC */
wchar_t *range_starts;
wchar_t *range_ends;
Update. 2002-05-21 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regex.c: Define `inline' as a macro into nothing for the compilers which lack the keyword. * posix/regex.h: (RE_SYNTAX_GNU_AWK): Remove RE_CONTEXT_INVALID_OPS for the compatibility of gawk. * posix/regcomp.c: Add fake implementation of isblank() for the environments which lack the function. Don't use free_charset() in case of non-i18n envs. (build_range_exp): Don't use i18n related code in case of non-i18n envs. (build_collating_symbol): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (re_compile_fastmap_iter): Likewise. (parse_bracket_exp): Likewise. (build_word_op): Likewise. (regfree): Don't use free_charset() in case of non-i18n envs. * posix/regex_internal.h: Remove COMPLEX_BRACKET from re_token_type_t in case of non-i18n envs. Don't define re_charset_t in case of non-i18n envs. Change the type of wcs of re_string_t from wchar_t to wint_t, since we store also WEOF. * posix/regex_internal.c: (re_string_realloc_buffers): Change the type of wcs of re_string_t from wchar_t to wint_t. (re_string_reconstruct): Likewise. (create_ci_newstate): Don't use i18n related code in case of non-i18n envs. (create_cd_newstate): Likewise. 2002-05-24 Ulrich Drepper <drepper@redhat.com> * iconv/loop.c: Fix typo. 2002-05-23 Jakub Jelinek <jakub@redhat.com> * inet/ether_line.c (ether_line): Fix a typo causing only lower 4 bits of each ethernet address byte being assigned. Don't modify what line points to. * inet/tst-ether_aton.c (main): Add ether_line tests. 2002-05-23 Marcus Brinkmann <marcus@gnu.org> * manual/filesys.texi: Don't make readlink example leak memory when readlink fails.
2002-05-24 10:49:00 +02:00
# endif /* not _LIBC */
/* Character classes. */
wctype_t *char_classes;
/* If this character set is the non-matching list. */
unsigned int non_match : 1;
/* # of multibyte characters. */
int nmbchars;
/* # of collating symbols. */
int ncoll_syms;
/* # of equivalence classes. */
int nequiv_classes;
/* # of range expressions. */
int nranges;
/* # of character classes. */
int nchar_classes;
} re_charset_t;
Update. 2002-05-21 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regex.c: Define `inline' as a macro into nothing for the compilers which lack the keyword. * posix/regex.h: (RE_SYNTAX_GNU_AWK): Remove RE_CONTEXT_INVALID_OPS for the compatibility of gawk. * posix/regcomp.c: Add fake implementation of isblank() for the environments which lack the function. Don't use free_charset() in case of non-i18n envs. (build_range_exp): Don't use i18n related code in case of non-i18n envs. (build_collating_symbol): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (re_compile_fastmap_iter): Likewise. (parse_bracket_exp): Likewise. (build_word_op): Likewise. (regfree): Don't use free_charset() in case of non-i18n envs. * posix/regex_internal.h: Remove COMPLEX_BRACKET from re_token_type_t in case of non-i18n envs. Don't define re_charset_t in case of non-i18n envs. Change the type of wcs of re_string_t from wchar_t to wint_t, since we store also WEOF. * posix/regex_internal.c: (re_string_realloc_buffers): Change the type of wcs of re_string_t from wchar_t to wint_t. (re_string_reconstruct): Likewise. (create_ci_newstate): Don't use i18n related code in case of non-i18n envs. (create_cd_newstate): Likewise. 2002-05-24 Ulrich Drepper <drepper@redhat.com> * iconv/loop.c: Fix typo. 2002-05-23 Jakub Jelinek <jakub@redhat.com> * inet/ether_line.c (ether_line): Fix a typo causing only lower 4 bits of each ethernet address byte being assigned. Don't modify what line points to. * inet/tst-ether_aton.c (main): Add ether_line tests. 2002-05-23 Marcus Brinkmann <marcus@gnu.org> * manual/filesys.texi: Don't make readlink example leak memory when readlink fails.
2002-05-24 10:49:00 +02:00
#endif /* RE_ENABLE_I18N */
typedef struct
{
union
{
unsigned char c; /* for CHARACTER */
re_bitset_ptr_t sbcset; /* for SIMPLE_BRACKET */
Update. 2002-05-21 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regex.c: Define `inline' as a macro into nothing for the compilers which lack the keyword. * posix/regex.h: (RE_SYNTAX_GNU_AWK): Remove RE_CONTEXT_INVALID_OPS for the compatibility of gawk. * posix/regcomp.c: Add fake implementation of isblank() for the environments which lack the function. Don't use free_charset() in case of non-i18n envs. (build_range_exp): Don't use i18n related code in case of non-i18n envs. (build_collating_symbol): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (re_compile_fastmap_iter): Likewise. (parse_bracket_exp): Likewise. (build_word_op): Likewise. (regfree): Don't use free_charset() in case of non-i18n envs. * posix/regex_internal.h: Remove COMPLEX_BRACKET from re_token_type_t in case of non-i18n envs. Don't define re_charset_t in case of non-i18n envs. Change the type of wcs of re_string_t from wchar_t to wint_t, since we store also WEOF. * posix/regex_internal.c: (re_string_realloc_buffers): Change the type of wcs of re_string_t from wchar_t to wint_t. (re_string_reconstruct): Likewise. (create_ci_newstate): Don't use i18n related code in case of non-i18n envs. (create_cd_newstate): Likewise. 2002-05-24 Ulrich Drepper <drepper@redhat.com> * iconv/loop.c: Fix typo. 2002-05-23 Jakub Jelinek <jakub@redhat.com> * inet/ether_line.c (ether_line): Fix a typo causing only lower 4 bits of each ethernet address byte being assigned. Don't modify what line points to. * inet/tst-ether_aton.c (main): Add ether_line tests. 2002-05-23 Marcus Brinkmann <marcus@gnu.org> * manual/filesys.texi: Don't make readlink example leak memory when readlink fails.
2002-05-24 10:49:00 +02:00
#ifdef RE_ENABLE_I18N
re_charset_t *mbcset; /* for COMPLEX_BRACKET */
Update. 2002-05-21 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regex.c: Define `inline' as a macro into nothing for the compilers which lack the keyword. * posix/regex.h: (RE_SYNTAX_GNU_AWK): Remove RE_CONTEXT_INVALID_OPS for the compatibility of gawk. * posix/regcomp.c: Add fake implementation of isblank() for the environments which lack the function. Don't use free_charset() in case of non-i18n envs. (build_range_exp): Don't use i18n related code in case of non-i18n envs. (build_collating_symbol): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (re_compile_fastmap_iter): Likewise. (parse_bracket_exp): Likewise. (build_word_op): Likewise. (regfree): Don't use free_charset() in case of non-i18n envs. * posix/regex_internal.h: Remove COMPLEX_BRACKET from re_token_type_t in case of non-i18n envs. Don't define re_charset_t in case of non-i18n envs. Change the type of wcs of re_string_t from wchar_t to wint_t, since we store also WEOF. * posix/regex_internal.c: (re_string_realloc_buffers): Change the type of wcs of re_string_t from wchar_t to wint_t. (re_string_reconstruct): Likewise. (create_ci_newstate): Don't use i18n related code in case of non-i18n envs. (create_cd_newstate): Likewise. 2002-05-24 Ulrich Drepper <drepper@redhat.com> * iconv/loop.c: Fix typo. 2002-05-23 Jakub Jelinek <jakub@redhat.com> * inet/ether_line.c (ether_line): Fix a typo causing only lower 4 bits of each ethernet address byte being assigned. Don't modify what line points to. * inet/tst-ether_aton.c (main): Add ether_line tests. 2002-05-23 Marcus Brinkmann <marcus@gnu.org> * manual/filesys.texi: Don't make readlink example leak memory when readlink fails.
2002-05-24 10:49:00 +02:00
#endif /* RE_ENABLE_I18N */
int idx; /* for BACK_REF */
re_context_type ctx_type; /* for ANCHOR */
} opr;
#if __GNUC__ >= 2
re_token_type_t type : 8;
#else
re_token_type_t type;
#endif
unsigned int constraint : 10; /* context constraint */
unsigned int duplicated : 1;
unsigned int opt_subexp : 1;
#ifdef RE_ENABLE_I18N
/* These 2 bits can be moved into the union if needed (e.g. if running out
of bits; move opr.c to opr.c.c and move the flags to opr.c.flags). */
unsigned int mb_partial : 1;
#endif
unsigned int word_char : 1;
} re_token_t;
#define IS_EPSILON_NODE(type) ((type) & EPSILON_BIT)
#define ACCEPT_MB_NODE(type) \
((type) >= OP_PERIOD && (type) <= OP_UTF8_PERIOD)
struct re_string_t
{
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
/* Indicate the raw buffer which is the original string passed as an
argument of regexec(), re_search(), etc.. */
2002-09-10 20:40:35 +02:00
const unsigned char *raw_mbs;
/* Store the multibyte string. In case of "case insensitive mode" like
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
REG_ICASE, upper cases of the string are stored, otherwise MBS points
the same address that RAW_MBS points. */
2002-09-10 20:40:35 +02:00
unsigned char *mbs;
#ifdef RE_ENABLE_I18N
/* Store the wide character string which is corresponding to MBS. */
Update. 2002-05-21 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regex.c: Define `inline' as a macro into nothing for the compilers which lack the keyword. * posix/regex.h: (RE_SYNTAX_GNU_AWK): Remove RE_CONTEXT_INVALID_OPS for the compatibility of gawk. * posix/regcomp.c: Add fake implementation of isblank() for the environments which lack the function. Don't use free_charset() in case of non-i18n envs. (build_range_exp): Don't use i18n related code in case of non-i18n envs. (build_collating_symbol): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (re_compile_fastmap_iter): Likewise. (parse_bracket_exp): Likewise. (build_word_op): Likewise. (regfree): Don't use free_charset() in case of non-i18n envs. * posix/regex_internal.h: Remove COMPLEX_BRACKET from re_token_type_t in case of non-i18n envs. Don't define re_charset_t in case of non-i18n envs. Change the type of wcs of re_string_t from wchar_t to wint_t, since we store also WEOF. * posix/regex_internal.c: (re_string_realloc_buffers): Change the type of wcs of re_string_t from wchar_t to wint_t. (re_string_reconstruct): Likewise. (create_ci_newstate): Don't use i18n related code in case of non-i18n envs. (create_cd_newstate): Likewise. 2002-05-24 Ulrich Drepper <drepper@redhat.com> * iconv/loop.c: Fix typo. 2002-05-23 Jakub Jelinek <jakub@redhat.com> * inet/ether_line.c (ether_line): Fix a typo causing only lower 4 bits of each ethernet address byte being assigned. Don't modify what line points to. * inet/tst-ether_aton.c (main): Add ether_line tests. 2002-05-23 Marcus Brinkmann <marcus@gnu.org> * manual/filesys.texi: Don't make readlink example leak memory when readlink fails.
2002-05-24 10:49:00 +02:00
wint_t *wcs;
Update. 2003-11-28 Ulrich Drepper <drepper@redhat.com> * sysdeps/x86_64/fpu/libm-test-ulps: Add some more minor changes to compensate other setup. 2003-11-27 Andreas Jaeger <aj@suse.de> * sysdeps/x86_64/fpu/libm-test-ulps: Add ulps for new atan2 test. * math/libm-test.inc (atan2_test): Add test that run infinitly. Reported by "Willus" <etc231etc231@willus.com>. 2003-11-27 Michael Matz <matz@suse.de> * sysdeps/ieee754/dbl-64/mpsqrt.c (fastiroot): Fix 64-bit problem with wrong types. 2003-11-28 Jakub Jelinek <jakub@redhat.com> * posix/regexec.c (acquire_init_state_context): Make inline. Add always_inline attribute. (check_matching): Add BE macro. Move if (cur_state->has_backref) into if (dfa->nbackref). (sift_states_backward): Fix comment. (transit_state): Add BE macro. Move if (next_state->has_backref) into if (dfa->nbackref && next_state). Don't check for next_state != NULL twice. * posix/regcomp.c (peek_token): Use opr.ctx_type instead of opr.idx for ANCHOR. (parse_expression): Only call init_word_char if word context will be needed. * posix/bug-regex11.c (tests): Add new tests. * posix/tst-regex.c: Include getopt.h. (timing): New variable. (main): Set timing to 1 if --timing argument is present. Add 2 new tests. (run_test, run_test_backwards): Handle timing. 2003-11-27 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (re_string_t): Remove mbs_case field. Add offsets, valid_raw_len, raw_len, raw_stop, mbs_allocated and offsets_needed fields. Change icase, is_utf8 and map_notascii type from int bitfield to unsigned char. (MBS_ALLOCATED, MBS_CASE_ALLOCATED): Remove. (build_wcs_upper_buffer): Change prototype to return int. (re_string_peek_byte_case, re_string_fetch_byte_case): Remove defines, add prototypes. * posix/regex_internal.c (re_string_allocate): Don't initialize stop here. Don't initialize mbs_case. Set valid_raw_len. Use mbs_allocated instead of MBS_* macros. (re_string_construct): Don't initialize stop and valid_len here. Don't initialize mbs_case. Use mbs_allocated instead of MBS_* macros. Reallocate buffers if build_wcs_upper_buffer converted too few bytes. Set valid_len to bufs_len only for single byte no translation and set in that case valid_raw_len as well. (re_string_realloc_buffers): Reallocate offsets if not NULL. Use mbs_allocated instead of MBS_ALLOCATED. Don't reallocate mbs_case. (re_string_construct_common): Initialize raw_len, mbs_allocated, stop and raw_stop. (build_wcs_buffer): Apply pstr->trans before mbrtowc instead of after it. Set valid_raw_len. Don't set mbs_case. (build_wcs_upper_buffer): Return REG_NOERROR or REG_ESPACE. Only use the fast path if !pstr->offsets_needed. Apply pstr->trans before mbrtowc instead of after it. If upper case character uses different number of bytes than lower case, goto to the slow path. Don't call towupper unnecessarily twice. Set valid_raw_len as well. Handle in the slow path the case if lower and upper case use different number of characters. Don't set mbs_case. (re_string_skip_chars): Use valid_raw_len instead of valid_len. (build_upper_buffer): Don't set mbs_case. Add BE macro. Set valid_raw_len. (re_string_translate_buffer): Set mbs instead of mbs_case. Set valid_raw_len. (re_string_reconstruct): Use raw_len/raw_stop to initialize len/stop. Clear valid_raw_len and offsets_needed when clearing valid_len. Use mbs_allocated instead of MBS_* macros. Check original offset against valid_raw_len instead of valid_len. Remove mbs_case handling. Adjust valid_raw_len together with valid_len. If is_utf8 and looking for tip context, apply pstr->trans first. If buffers start with partial multi-byte character, initialize mbs array as well if mbs_allocated. Check return value of build_wcs_upper_buffer. (re_string_peek_byte_case): New function. (re_string_fetch_byte_case): New function. (re_string_destruct): Use mbs_allocated instead of MBS_ALLOCATED. Don't free mbs_case. Free offsets. * posix/regcomp.c (init_dfa): Only check if charset name is UTF-8 if mb_cur_max == 6. * posix/regexec.c (re_search_internal): Initialize input.raw_stop as well. Use valid_raw_len instead of valid_len when looking through fastmap. Adjust registers through input.offsets. (extend_buffers): Allow build_wcs_upper_buffer to fail. * posix/bug-regex18.c (tests): Enable #ifdefed out tests. Add new tests.
2003-11-29 07:13:09 +01:00
int *offsets;
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
mbstate_t cur_state;
#endif
/* Index in RAW_MBS. Each character mbs[i] corresponds to
raw_mbs[raw_mbs_idx + i]. */
int raw_mbs_idx;
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
/* The length of the valid characters in the buffers. */
int valid_len;
Update. 2003-11-28 Ulrich Drepper <drepper@redhat.com> * sysdeps/x86_64/fpu/libm-test-ulps: Add some more minor changes to compensate other setup. 2003-11-27 Andreas Jaeger <aj@suse.de> * sysdeps/x86_64/fpu/libm-test-ulps: Add ulps for new atan2 test. * math/libm-test.inc (atan2_test): Add test that run infinitly. Reported by "Willus" <etc231etc231@willus.com>. 2003-11-27 Michael Matz <matz@suse.de> * sysdeps/ieee754/dbl-64/mpsqrt.c (fastiroot): Fix 64-bit problem with wrong types. 2003-11-28 Jakub Jelinek <jakub@redhat.com> * posix/regexec.c (acquire_init_state_context): Make inline. Add always_inline attribute. (check_matching): Add BE macro. Move if (cur_state->has_backref) into if (dfa->nbackref). (sift_states_backward): Fix comment. (transit_state): Add BE macro. Move if (next_state->has_backref) into if (dfa->nbackref && next_state). Don't check for next_state != NULL twice. * posix/regcomp.c (peek_token): Use opr.ctx_type instead of opr.idx for ANCHOR. (parse_expression): Only call init_word_char if word context will be needed. * posix/bug-regex11.c (tests): Add new tests. * posix/tst-regex.c: Include getopt.h. (timing): New variable. (main): Set timing to 1 if --timing argument is present. Add 2 new tests. (run_test, run_test_backwards): Handle timing. 2003-11-27 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (re_string_t): Remove mbs_case field. Add offsets, valid_raw_len, raw_len, raw_stop, mbs_allocated and offsets_needed fields. Change icase, is_utf8 and map_notascii type from int bitfield to unsigned char. (MBS_ALLOCATED, MBS_CASE_ALLOCATED): Remove. (build_wcs_upper_buffer): Change prototype to return int. (re_string_peek_byte_case, re_string_fetch_byte_case): Remove defines, add prototypes. * posix/regex_internal.c (re_string_allocate): Don't initialize stop here. Don't initialize mbs_case. Set valid_raw_len. Use mbs_allocated instead of MBS_* macros. (re_string_construct): Don't initialize stop and valid_len here. Don't initialize mbs_case. Use mbs_allocated instead of MBS_* macros. Reallocate buffers if build_wcs_upper_buffer converted too few bytes. Set valid_len to bufs_len only for single byte no translation and set in that case valid_raw_len as well. (re_string_realloc_buffers): Reallocate offsets if not NULL. Use mbs_allocated instead of MBS_ALLOCATED. Don't reallocate mbs_case. (re_string_construct_common): Initialize raw_len, mbs_allocated, stop and raw_stop. (build_wcs_buffer): Apply pstr->trans before mbrtowc instead of after it. Set valid_raw_len. Don't set mbs_case. (build_wcs_upper_buffer): Return REG_NOERROR or REG_ESPACE. Only use the fast path if !pstr->offsets_needed. Apply pstr->trans before mbrtowc instead of after it. If upper case character uses different number of bytes than lower case, goto to the slow path. Don't call towupper unnecessarily twice. Set valid_raw_len as well. Handle in the slow path the case if lower and upper case use different number of characters. Don't set mbs_case. (re_string_skip_chars): Use valid_raw_len instead of valid_len. (build_upper_buffer): Don't set mbs_case. Add BE macro. Set valid_raw_len. (re_string_translate_buffer): Set mbs instead of mbs_case. Set valid_raw_len. (re_string_reconstruct): Use raw_len/raw_stop to initialize len/stop. Clear valid_raw_len and offsets_needed when clearing valid_len. Use mbs_allocated instead of MBS_* macros. Check original offset against valid_raw_len instead of valid_len. Remove mbs_case handling. Adjust valid_raw_len together with valid_len. If is_utf8 and looking for tip context, apply pstr->trans first. If buffers start with partial multi-byte character, initialize mbs array as well if mbs_allocated. Check return value of build_wcs_upper_buffer. (re_string_peek_byte_case): New function. (re_string_fetch_byte_case): New function. (re_string_destruct): Use mbs_allocated instead of MBS_ALLOCATED. Don't free mbs_case. Free offsets. * posix/regcomp.c (init_dfa): Only check if charset name is UTF-8 if mb_cur_max == 6. * posix/regexec.c (re_search_internal): Initialize input.raw_stop as well. Use valid_raw_len instead of valid_len when looking through fastmap. Adjust registers through input.offsets. (extend_buffers): Allow build_wcs_upper_buffer to fail. * posix/bug-regex18.c (tests): Enable #ifdefed out tests. Add new tests.
2003-11-29 07:13:09 +01:00
/* The corresponding number of bytes in raw_mbs array. */
int valid_raw_len;
/* The length of the buffers MBS and WCS. */
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
int bufs_len;
/* The index in MBS, which is updated by re_string_fetch_byte. */
int cur_idx;
Update. 2003-11-28 Ulrich Drepper <drepper@redhat.com> * sysdeps/x86_64/fpu/libm-test-ulps: Add some more minor changes to compensate other setup. 2003-11-27 Andreas Jaeger <aj@suse.de> * sysdeps/x86_64/fpu/libm-test-ulps: Add ulps for new atan2 test. * math/libm-test.inc (atan2_test): Add test that run infinitly. Reported by "Willus" <etc231etc231@willus.com>. 2003-11-27 Michael Matz <matz@suse.de> * sysdeps/ieee754/dbl-64/mpsqrt.c (fastiroot): Fix 64-bit problem with wrong types. 2003-11-28 Jakub Jelinek <jakub@redhat.com> * posix/regexec.c (acquire_init_state_context): Make inline. Add always_inline attribute. (check_matching): Add BE macro. Move if (cur_state->has_backref) into if (dfa->nbackref). (sift_states_backward): Fix comment. (transit_state): Add BE macro. Move if (next_state->has_backref) into if (dfa->nbackref && next_state). Don't check for next_state != NULL twice. * posix/regcomp.c (peek_token): Use opr.ctx_type instead of opr.idx for ANCHOR. (parse_expression): Only call init_word_char if word context will be needed. * posix/bug-regex11.c (tests): Add new tests. * posix/tst-regex.c: Include getopt.h. (timing): New variable. (main): Set timing to 1 if --timing argument is present. Add 2 new tests. (run_test, run_test_backwards): Handle timing. 2003-11-27 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (re_string_t): Remove mbs_case field. Add offsets, valid_raw_len, raw_len, raw_stop, mbs_allocated and offsets_needed fields. Change icase, is_utf8 and map_notascii type from int bitfield to unsigned char. (MBS_ALLOCATED, MBS_CASE_ALLOCATED): Remove. (build_wcs_upper_buffer): Change prototype to return int. (re_string_peek_byte_case, re_string_fetch_byte_case): Remove defines, add prototypes. * posix/regex_internal.c (re_string_allocate): Don't initialize stop here. Don't initialize mbs_case. Set valid_raw_len. Use mbs_allocated instead of MBS_* macros. (re_string_construct): Don't initialize stop and valid_len here. Don't initialize mbs_case. Use mbs_allocated instead of MBS_* macros. Reallocate buffers if build_wcs_upper_buffer converted too few bytes. Set valid_len to bufs_len only for single byte no translation and set in that case valid_raw_len as well. (re_string_realloc_buffers): Reallocate offsets if not NULL. Use mbs_allocated instead of MBS_ALLOCATED. Don't reallocate mbs_case. (re_string_construct_common): Initialize raw_len, mbs_allocated, stop and raw_stop. (build_wcs_buffer): Apply pstr->trans before mbrtowc instead of after it. Set valid_raw_len. Don't set mbs_case. (build_wcs_upper_buffer): Return REG_NOERROR or REG_ESPACE. Only use the fast path if !pstr->offsets_needed. Apply pstr->trans before mbrtowc instead of after it. If upper case character uses different number of bytes than lower case, goto to the slow path. Don't call towupper unnecessarily twice. Set valid_raw_len as well. Handle in the slow path the case if lower and upper case use different number of characters. Don't set mbs_case. (re_string_skip_chars): Use valid_raw_len instead of valid_len. (build_upper_buffer): Don't set mbs_case. Add BE macro. Set valid_raw_len. (re_string_translate_buffer): Set mbs instead of mbs_case. Set valid_raw_len. (re_string_reconstruct): Use raw_len/raw_stop to initialize len/stop. Clear valid_raw_len and offsets_needed when clearing valid_len. Use mbs_allocated instead of MBS_* macros. Check original offset against valid_raw_len instead of valid_len. Remove mbs_case handling. Adjust valid_raw_len together with valid_len. If is_utf8 and looking for tip context, apply pstr->trans first. If buffers start with partial multi-byte character, initialize mbs array as well if mbs_allocated. Check return value of build_wcs_upper_buffer. (re_string_peek_byte_case): New function. (re_string_fetch_byte_case): New function. (re_string_destruct): Use mbs_allocated instead of MBS_ALLOCATED. Don't free mbs_case. Free offsets. * posix/regcomp.c (init_dfa): Only check if charset name is UTF-8 if mb_cur_max == 6. * posix/regexec.c (re_search_internal): Initialize input.raw_stop as well. Use valid_raw_len instead of valid_len when looking through fastmap. Adjust registers through input.offsets. (extend_buffers): Allow build_wcs_upper_buffer to fail. * posix/bug-regex18.c (tests): Enable #ifdefed out tests. Add new tests.
2003-11-29 07:13:09 +01:00
/* length of RAW_MBS array. */
int raw_len;
/* This is RAW_LEN - RAW_MBS_IDX + VALID_LEN - VALID_RAW_LEN. */
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
int len;
/* End of the buffer may be shorter than its length in the cases such
as re_match_2, re_search_2. Then, we use STOP for end of the buffer
instead of LEN. */
Update. 2003-11-28 Ulrich Drepper <drepper@redhat.com> * sysdeps/x86_64/fpu/libm-test-ulps: Add some more minor changes to compensate other setup. 2003-11-27 Andreas Jaeger <aj@suse.de> * sysdeps/x86_64/fpu/libm-test-ulps: Add ulps for new atan2 test. * math/libm-test.inc (atan2_test): Add test that run infinitly. Reported by "Willus" <etc231etc231@willus.com>. 2003-11-27 Michael Matz <matz@suse.de> * sysdeps/ieee754/dbl-64/mpsqrt.c (fastiroot): Fix 64-bit problem with wrong types. 2003-11-28 Jakub Jelinek <jakub@redhat.com> * posix/regexec.c (acquire_init_state_context): Make inline. Add always_inline attribute. (check_matching): Add BE macro. Move if (cur_state->has_backref) into if (dfa->nbackref). (sift_states_backward): Fix comment. (transit_state): Add BE macro. Move if (next_state->has_backref) into if (dfa->nbackref && next_state). Don't check for next_state != NULL twice. * posix/regcomp.c (peek_token): Use opr.ctx_type instead of opr.idx for ANCHOR. (parse_expression): Only call init_word_char if word context will be needed. * posix/bug-regex11.c (tests): Add new tests. * posix/tst-regex.c: Include getopt.h. (timing): New variable. (main): Set timing to 1 if --timing argument is present. Add 2 new tests. (run_test, run_test_backwards): Handle timing. 2003-11-27 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (re_string_t): Remove mbs_case field. Add offsets, valid_raw_len, raw_len, raw_stop, mbs_allocated and offsets_needed fields. Change icase, is_utf8 and map_notascii type from int bitfield to unsigned char. (MBS_ALLOCATED, MBS_CASE_ALLOCATED): Remove. (build_wcs_upper_buffer): Change prototype to return int. (re_string_peek_byte_case, re_string_fetch_byte_case): Remove defines, add prototypes. * posix/regex_internal.c (re_string_allocate): Don't initialize stop here. Don't initialize mbs_case. Set valid_raw_len. Use mbs_allocated instead of MBS_* macros. (re_string_construct): Don't initialize stop and valid_len here. Don't initialize mbs_case. Use mbs_allocated instead of MBS_* macros. Reallocate buffers if build_wcs_upper_buffer converted too few bytes. Set valid_len to bufs_len only for single byte no translation and set in that case valid_raw_len as well. (re_string_realloc_buffers): Reallocate offsets if not NULL. Use mbs_allocated instead of MBS_ALLOCATED. Don't reallocate mbs_case. (re_string_construct_common): Initialize raw_len, mbs_allocated, stop and raw_stop. (build_wcs_buffer): Apply pstr->trans before mbrtowc instead of after it. Set valid_raw_len. Don't set mbs_case. (build_wcs_upper_buffer): Return REG_NOERROR or REG_ESPACE. Only use the fast path if !pstr->offsets_needed. Apply pstr->trans before mbrtowc instead of after it. If upper case character uses different number of bytes than lower case, goto to the slow path. Don't call towupper unnecessarily twice. Set valid_raw_len as well. Handle in the slow path the case if lower and upper case use different number of characters. Don't set mbs_case. (re_string_skip_chars): Use valid_raw_len instead of valid_len. (build_upper_buffer): Don't set mbs_case. Add BE macro. Set valid_raw_len. (re_string_translate_buffer): Set mbs instead of mbs_case. Set valid_raw_len. (re_string_reconstruct): Use raw_len/raw_stop to initialize len/stop. Clear valid_raw_len and offsets_needed when clearing valid_len. Use mbs_allocated instead of MBS_* macros. Check original offset against valid_raw_len instead of valid_len. Remove mbs_case handling. Adjust valid_raw_len together with valid_len. If is_utf8 and looking for tip context, apply pstr->trans first. If buffers start with partial multi-byte character, initialize mbs array as well if mbs_allocated. Check return value of build_wcs_upper_buffer. (re_string_peek_byte_case): New function. (re_string_fetch_byte_case): New function. (re_string_destruct): Use mbs_allocated instead of MBS_ALLOCATED. Don't free mbs_case. Free offsets. * posix/regcomp.c (init_dfa): Only check if charset name is UTF-8 if mb_cur_max == 6. * posix/regexec.c (re_search_internal): Initialize input.raw_stop as well. Use valid_raw_len instead of valid_len when looking through fastmap. Adjust registers through input.offsets. (extend_buffers): Allow build_wcs_upper_buffer to fail. * posix/bug-regex18.c (tests): Enable #ifdefed out tests. Add new tests.
2003-11-29 07:13:09 +01:00
int raw_stop;
/* This is RAW_STOP - RAW_MBS_IDX adjusted through OFFSETS. */
int stop;
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
/* The context of mbs[0]. We store the context independently, since
the context of mbs[0] may be different from raw_mbs[0], which is
the beginning of the input string. */
unsigned int tip_context;
/* The translation passed as a part of an argument of re_compile_pattern. */
unsigned RE_TRANSLATE_TYPE trans;
Update. 2004-01-02 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (re_node_set_insert): Remove unused variables. * posix/regex_internal.h (re_dfa_t): Add syntax field. * posix/regcomp.c (parse): Initialize dfa->syntax. * posix/regexec.c (acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_state_context, proceed_next_node, sift_states_iter_mb, sift_states_backward, update_cur_sifted_state, sift_states_bkref, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache, build_trtable): Remove preg argument, add dfa argument instead and remove dfa = preg->buffer initialization in the body. Adjust all callers. (check_node_accept_bytes, group_nodes_into_DFAstates, check_node_accept): Likewise. Use dfa->syntax instead of preg->syntax. (check_arrival_add_next_nodes): Remove preg argument. * posix/regex_internal.h (re_match_context_t): Make input re_string_t instead of a pointer to it. * posix/regex_internal.c (re_string_construct_common): Don't clear pstr here... (re_string_construct): ... but only here. * posix/regexec.c (match_ctx_init): Remove input argument. Don't initialize fields to zero. (re_search_internal): Move input into mctx.input. (acquire_init_state_context, check_matching, check_halt_state_context, proceed_next_node, clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, check_arrival, check_arrival_add_next_nodes, check_node_accept, extend_buffers): Change mctx->input into &mctx->input and mctx->input->field into mctx->input.field. 2004-01-02 Jakub Jelinek <jakub@redhat.com> Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_const_bitset_ptr_t): New type. (re_string_t): Add newline_anchor, word_char and word_ops_used fields. (re_dfa_t): Change word_char type to bitset. Add word_ops_used field. (re_string_context_at, re_string_reconstruct): Remove last argument. * posix/regex_internal.c (re_string_allocate): Initialize pstr->word_char and pstr->word_ops_used. (re_string_context_at): Remove newline_anchor argument. Use input->newline_anchor instead, swap && conditions. Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0. Use input->word_char bitmap instead of IS_WORD_CHAR. (re_string_reconstruct): Likewise. Adjust re_string_context_at caller. * posix/regexec.c (acquire_init_state_context, check_halt_state_context, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, check_arrival, check_node_accept): Adjust re_string_context_at and re_string_reconstruct callers. (re_search_internal): Likewise. Set input.newline_anchor. (build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR. * posix/regcomp.c (init_word_char): Change return type to void. Set dfa->word_ops_used. (free_dfa_content): Don't free dfa->word_char. (parse_expression): Remove error handling for init_word_char.
2004-01-02 22:20:51 +01:00
/* Copy of re_dfa_t's word_char. */
re_const_bitset_ptr_t word_char;
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
/* 1 if REG_ICASE. */
Update. 2003-11-28 Ulrich Drepper <drepper@redhat.com> * sysdeps/x86_64/fpu/libm-test-ulps: Add some more minor changes to compensate other setup. 2003-11-27 Andreas Jaeger <aj@suse.de> * sysdeps/x86_64/fpu/libm-test-ulps: Add ulps for new atan2 test. * math/libm-test.inc (atan2_test): Add test that run infinitly. Reported by "Willus" <etc231etc231@willus.com>. 2003-11-27 Michael Matz <matz@suse.de> * sysdeps/ieee754/dbl-64/mpsqrt.c (fastiroot): Fix 64-bit problem with wrong types. 2003-11-28 Jakub Jelinek <jakub@redhat.com> * posix/regexec.c (acquire_init_state_context): Make inline. Add always_inline attribute. (check_matching): Add BE macro. Move if (cur_state->has_backref) into if (dfa->nbackref). (sift_states_backward): Fix comment. (transit_state): Add BE macro. Move if (next_state->has_backref) into if (dfa->nbackref && next_state). Don't check for next_state != NULL twice. * posix/regcomp.c (peek_token): Use opr.ctx_type instead of opr.idx for ANCHOR. (parse_expression): Only call init_word_char if word context will be needed. * posix/bug-regex11.c (tests): Add new tests. * posix/tst-regex.c: Include getopt.h. (timing): New variable. (main): Set timing to 1 if --timing argument is present. Add 2 new tests. (run_test, run_test_backwards): Handle timing. 2003-11-27 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (re_string_t): Remove mbs_case field. Add offsets, valid_raw_len, raw_len, raw_stop, mbs_allocated and offsets_needed fields. Change icase, is_utf8 and map_notascii type from int bitfield to unsigned char. (MBS_ALLOCATED, MBS_CASE_ALLOCATED): Remove. (build_wcs_upper_buffer): Change prototype to return int. (re_string_peek_byte_case, re_string_fetch_byte_case): Remove defines, add prototypes. * posix/regex_internal.c (re_string_allocate): Don't initialize stop here. Don't initialize mbs_case. Set valid_raw_len. Use mbs_allocated instead of MBS_* macros. (re_string_construct): Don't initialize stop and valid_len here. Don't initialize mbs_case. Use mbs_allocated instead of MBS_* macros. Reallocate buffers if build_wcs_upper_buffer converted too few bytes. Set valid_len to bufs_len only for single byte no translation and set in that case valid_raw_len as well. (re_string_realloc_buffers): Reallocate offsets if not NULL. Use mbs_allocated instead of MBS_ALLOCATED. Don't reallocate mbs_case. (re_string_construct_common): Initialize raw_len, mbs_allocated, stop and raw_stop. (build_wcs_buffer): Apply pstr->trans before mbrtowc instead of after it. Set valid_raw_len. Don't set mbs_case. (build_wcs_upper_buffer): Return REG_NOERROR or REG_ESPACE. Only use the fast path if !pstr->offsets_needed. Apply pstr->trans before mbrtowc instead of after it. If upper case character uses different number of bytes than lower case, goto to the slow path. Don't call towupper unnecessarily twice. Set valid_raw_len as well. Handle in the slow path the case if lower and upper case use different number of characters. Don't set mbs_case. (re_string_skip_chars): Use valid_raw_len instead of valid_len. (build_upper_buffer): Don't set mbs_case. Add BE macro. Set valid_raw_len. (re_string_translate_buffer): Set mbs instead of mbs_case. Set valid_raw_len. (re_string_reconstruct): Use raw_len/raw_stop to initialize len/stop. Clear valid_raw_len and offsets_needed when clearing valid_len. Use mbs_allocated instead of MBS_* macros. Check original offset against valid_raw_len instead of valid_len. Remove mbs_case handling. Adjust valid_raw_len together with valid_len. If is_utf8 and looking for tip context, apply pstr->trans first. If buffers start with partial multi-byte character, initialize mbs array as well if mbs_allocated. Check return value of build_wcs_upper_buffer. (re_string_peek_byte_case): New function. (re_string_fetch_byte_case): New function. (re_string_destruct): Use mbs_allocated instead of MBS_ALLOCATED. Don't free mbs_case. Free offsets. * posix/regcomp.c (init_dfa): Only check if charset name is UTF-8 if mb_cur_max == 6. * posix/regexec.c (re_search_internal): Initialize input.raw_stop as well. Use valid_raw_len instead of valid_len when looking through fastmap. Adjust registers through input.offsets. (extend_buffers): Allow build_wcs_upper_buffer to fail. * posix/bug-regex18.c (tests): Enable #ifdefed out tests. Add new tests.
2003-11-29 07:13:09 +01:00
unsigned char icase;
unsigned char is_utf8;
unsigned char map_notascii;
unsigned char mbs_allocated;
unsigned char offsets_needed;
Update. 2004-01-02 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (re_node_set_insert): Remove unused variables. * posix/regex_internal.h (re_dfa_t): Add syntax field. * posix/regcomp.c (parse): Initialize dfa->syntax. * posix/regexec.c (acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_state_context, proceed_next_node, sift_states_iter_mb, sift_states_backward, update_cur_sifted_state, sift_states_bkref, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache, build_trtable): Remove preg argument, add dfa argument instead and remove dfa = preg->buffer initialization in the body. Adjust all callers. (check_node_accept_bytes, group_nodes_into_DFAstates, check_node_accept): Likewise. Use dfa->syntax instead of preg->syntax. (check_arrival_add_next_nodes): Remove preg argument. * posix/regex_internal.h (re_match_context_t): Make input re_string_t instead of a pointer to it. * posix/regex_internal.c (re_string_construct_common): Don't clear pstr here... (re_string_construct): ... but only here. * posix/regexec.c (match_ctx_init): Remove input argument. Don't initialize fields to zero. (re_search_internal): Move input into mctx.input. (acquire_init_state_context, check_matching, check_halt_state_context, proceed_next_node, clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, check_arrival, check_arrival_add_next_nodes, check_node_accept, extend_buffers): Change mctx->input into &mctx->input and mctx->input->field into mctx->input.field. 2004-01-02 Jakub Jelinek <jakub@redhat.com> Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_const_bitset_ptr_t): New type. (re_string_t): Add newline_anchor, word_char and word_ops_used fields. (re_dfa_t): Change word_char type to bitset. Add word_ops_used field. (re_string_context_at, re_string_reconstruct): Remove last argument. * posix/regex_internal.c (re_string_allocate): Initialize pstr->word_char and pstr->word_ops_used. (re_string_context_at): Remove newline_anchor argument. Use input->newline_anchor instead, swap && conditions. Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0. Use input->word_char bitmap instead of IS_WORD_CHAR. (re_string_reconstruct): Likewise. Adjust re_string_context_at caller. * posix/regexec.c (acquire_init_state_context, check_halt_state_context, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, check_arrival, check_node_accept): Adjust re_string_context_at and re_string_reconstruct callers. (re_search_internal): Likewise. Set input.newline_anchor. (build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR. * posix/regcomp.c (init_word_char): Change return type to void. Set dfa->word_ops_used. (free_dfa_content): Don't free dfa->word_char. (parse_expression): Remove error handling for init_word_char.
2004-01-02 22:20:51 +01:00
unsigned char newline_anchor;
unsigned char word_ops_used;
Update. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/tst-regex.c (umemlen): New variable. (test_expr): Add expectedicase argument. Test case insensitive searches as well as backwards searches (case sensitive and insensitive) too. (run_test): Add icase argument. Use it to compute regcomp flags. (run_test_backwards): New function. (main): Cast read to size_t to avoid warning. Set umemlen. Add expectedicase arguments to test_expr. * posix/regex_internal.c (re_string_reconstruct): If is_utf8, find previous character by walking back instead of converting all chars from beginning. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (struct re_string_t): Add is_utf8 and mb_cur_max fields. (struct re_dfa_t): Likewise. Reorder fields to make structure smaller on 64-bit arches. (re_string_allocate, re_string_construct): Add mb_cur_max and is_utf8 arguments. (re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max instead of MB_CUR_MAX. * posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max instead of MB_CUR_MAX. (re_compile_internal): Pass new arguments to re_string_construct. (init_dfa): Initialize mb_cur_max and is_utf8 fields. (peek_token, peek_token_bracket): Use input->mb_cur_max instead of MB_CUR_MAX. (parse_expression, parse_bracket_exp, parse_charclass_op): Use dfa->mb_cur_max instead of MB_CUR_MAX. * posix/regex_internal.c (re_string_construct_common): Add mb_cur_max and is_utf8 arguments. Initialize fields with them. (re_string_allocate, re_string_construct): Add mb_cur_max and is_utf8 arguments, pass them to re_string_construct_common. Use mb_cur_max instead of MB_CUR_MAX. (re_string_realloc_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX. (re_string_reconstruct): Likewise. (re_string_context_at): Use input->mb_cur_max instead of MB_CUR_MAX. (create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max instead of MB_CUR_MAX. * posix/regexec.c (re_search_internal): Likewise. Pass new arguments to re_string_allocate. (check_matching, transit_state_sb): Use dfa->mb_cur_max instead of MB_CUR_MAX. (extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/Makefile (tests): Add bug-regex19. (bug-regex19-ENV): Add LOCPATH. * posix/bug-regex19.c: New test.
2003-11-12 18:47:46 +01:00
int mb_cur_max;
};
typedef struct re_string_t re_string_t;
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
struct re_dfa_t;
typedef struct re_dfa_t re_dfa_t;
Update. 2003-12-22 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c: Remove C99-ism. * posix/tst-rxspencer.c: Likewise. Based on a patch by Alex Davis <alex14641@yahoo.com>. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h [!_LIBC] (internal_function): Define. (re_string_allocate, re_string_construct, re_string_reconstruct, re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer, build_upper_buffer, re_string_translate_buffer, re_string_destruct, re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at, re_string_context_at, re_node_set_alloc, re_node_set_init_1 re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect, re_node_set_init_union, re_node_set_merge, re_node_set_insert re_node_set_compare, re_node_set_contains re_node_set_remove_at, re_dfa_add_node, re_acquire_state, re_acquire_state_context, free_state): Add internal_function to declaration. * posix/regexec.c (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_free_subtops, match_ctx_add_entry, search_cur_bkref_entry, match_ctx_clear_flag, match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init, re_search_internal, re_search_2_stub, re_search_stub, re_copy_regs, acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_node_context, check_halt_state_context update_regs, proceed_next_node, push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return, sift_states_iter_mb, sift_states_backward update_cur_sifted_state, add_epsilon_src_nodes, sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref, clean_state_log_if_need, merge_state_array, transit_state, check_subexp_matching_top, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node, check_arrival, check_arrival_add_next_nodes, find_collation_sequence_value, check_arrival_expand_ecl, check_arrival_expand_ecl_sub, expand_bkref_cache, build_trtable, check_node_accept_bytes, extend_buffers, group_nodes_into_DFAstates, check_node_accept): Likewise. * posix/regex_internal.c (re_string_construct_common, re_string_skip_chars, create_newstate_common, register_state, create_ci_newstate, create_cd_newstate, calc_state_hash): Likewise. (re_string_peek_byte_case, re_fetch_byte_case): Change declaration from ANSI to K&R. 2002-12-16 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (build_trtable): Don't allocate the trtable until state->word_trtable is known. Don't hardcode UINT_BITS iterations on each bitset item.
2003-12-23 03:29:44 +01:00
#ifndef _LIBC
# ifdef __i386__
# define internal_function __attribute ((regparm (3), stdcall))
# else
# define internal_function
# endif
#endif
#ifndef RE_NO_INTERNAL_PROTOTYPES
Update. 2002-07-29 Steven Munroe <sjmunroe@us.ibm.com> * sysdeps/powerpc/__longjmp.S: Moved to... * sysdeps/powerpc/powerpc32/__longjmp.S: ...here. * sysdeps/powerpc/add_n.S: Moved to... * sysdeps/powerpc/powerpc32/add_n.S: ...here. * sysdeps/powerpc/addmul_1.S: Moved to... * sysdeps/powerpc/powerpc32/addmul_1.S: ...here. * sysdeps/powerpc/atomicity.h: Moved to... * sysdeps/powerpc/powerpc32/atomicity.h: ...here. * sysdeps/powerpc/backtrace.c: Moved to... * sysdeps/powerpc/powerpc32/backtrace.c: ...here. * sysdeps/powerpc/bp-asm.h: Moved to... * sysdeps/powerpc/powerpc32/bp-asm.h: ...here. * sysdeps/powerpc/bsd-_setjmp.S: Moved to... * sysdeps/powerpc/powerpc32/bsd-_setjmp.S: ...here. * sysdeps/powerpc/bsd-setjmp.S: Moved to... * sysdeps/powerpc/powerpc32/bsd-setjmp.S: ...here. * sysdeps/powerpc/dl-machine.c: Moved to... * sysdeps/powerpc/powerpc32/dl-machine.c: ...here. * sysdeps/powerpc/dl-machine.h: Moved to... * sysdeps/powerpc/powerpc32/dl-machine.h: ...here. * sysdeps/powerpc/dl-start.S: Moved to... * sysdeps/powerpc/powerpc32/dl-start.S: ...here. * sysdeps/powerpc/gprrest0.S: Moved to... * sysdeps/powerpc/powerpc32/gprrest0.S: ...here. * sysdeps/powerpc/gprrest1.S: Moved to... * sysdeps/powerpc/powerpc32/gprrest1.S: ...here. * sysdeps/powerpc/gprsave0.S: Moved to... * sysdeps/powerpc/powerpc32/gprsave0.S: ...here. * sysdeps/powerpc/gprsave1.S: Moved to... * sysdeps/powerpc/powerpc32/gprsave1.S: ...here. * sysdeps/powerpc/lshift.S: Moved to... * sysdeps/powerpc/powerpc32/lshift.S: ...here. * sysdeps/powerpc/memset.S: Moved to... * sysdeps/powerpc/powerpc32/memset.S: ...here. * sysdeps/powerpc/mul_1.S: Moved to... * sysdeps/powerpc/powerpc32/mul_1.S: ...here. * sysdeps/powerpc/ppc-mcount.S: Moved to... * sysdeps/powerpc/powerpc32/ppc-mcount.S: ...here. * sysdeps/powerpc/register-dump.h: Moved to... * sysdeps/powerpc/powerpc32/register-dump.h: ...here. * sysdeps/powerpc/rshift.S: Moved to... * sysdeps/powerpc/powerpc32/rshift.S: ...here. * sysdeps/powerpc/setjmp.S: Moved to... * sysdeps/powerpc/powerpc32/setjmp.S: ...here. * sysdeps/powerpc/stpcpy.S: Moved to... * sysdeps/powerpc/powerpc32/stpcpy.S: ...here. * sysdeps/powerpc/strchr.S: Moved to... * sysdeps/powerpc/powerpc32/strchr.S: ...here. * sysdeps/powerpc/strcmp.S: Moved to... * sysdeps/powerpc/powerpc32/strcmp.S: ...here. * sysdeps/powerpc/strcpy.S: Moved to... * sysdeps/powerpc/powerpc32/strcpy.S: ...here. * sysdeps/powerpc/strlen.S: Moved to... * sysdeps/powerpc/powerpc32/strlen.S: ...here. * sysdeps/powerpc/sub_n.S: Moved to... * sysdeps/powerpc/powerpc32/sub_n.S: ...here. * sysdeps/powerpc/submul_1.S: Moved to... * sysdeps/powerpc/powerpc32/submul_1.S: ...here. * sysdeps/powerpc/elf/bzero.S: Moved to... * sysdeps/powerpc/powerpc32/elf/bzero.S: ...here. * sysdeps/powerpc/elf/start.S: Moved to... * sysdeps/powerpc/powerpc32/elf/start.S: ...here. * sysdeps/powerpc/fpu/__longjmp.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/__longjmp.S: ...here. * sysdeps/powerpc/fpu/fprrest.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/fprrest.S: ...here. * sysdeps/powerpc/fpu/fprsave.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/fprsave.S: ...here. * sysdeps/powerpc/fpu/setjmp.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/setjmp.S: ...here. * sysdeps/powerpc/fpu/s_copysign.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/s_copysign.S: ...here. * sysdeps/powerpc/fpu/s_copysignf.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/s_copysignf.S: ...here. * sysdeps/unix/sysv/linux/powerpc/brk.S: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S: ...here. * sysdeps/unix/sysv/linux/powerpc/clone.S: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: ...here. * sysdeps/unix/sysv/linux/powerpc/glob64.c: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/glob64.c: ...here. * sysdeps/unix/sysv/linux/powerpc/kernel_stat.h: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h: ...here. * sysdeps/unix/sysv/linux/powerpc/socket.S: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S: ...here. * sysdeps/unix/sysv/linux/powerpc/sysdep.h: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: ...here. * sysdeps/unix/sysv/linux/powerpc/syscalls.list: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: ...here. Support PowerPC64. Separate powerpc into powerpc/powerpc32 and powerpc/powerpc64. 2002-07-29 Steven Munroe <sjmunroe@us.ibm.com> * FAQ.in: Add powerpc64 to supported targets list. Also state the minimum gcc version is 3.2 * README: Add powerpc64 to supported targets list. * configure.in: Change machine=powerpc to machine=powerpc/powerpc32. Add powerpc64 and machine=powerpc/powerpc64. (HAVE_ASM_GLOBAL_DOT_NAME): Define if linux*powerpc/powerpc64*. * shlib-versions: Set DEFAULT version to 2.2.5 for powerpc64. * sysdeps/powerpc/Dist: Remove dl-machine.c, dl-start.S, ppc-mcount.S, gprsave1.S, gprsave0.S, gprrest1.S, and gprrest0.S. * sysdeps/powerpc/powerpc32/Dist: New file. * sysdeps/powerpc/Implies: Remove wordsize-32 and powerpc/soft-fp. * sysdeps/powerpc/powerpc32/Implies: New file. * sysdeps/powerpc/Makefile(cflags): Remove powerpc32 specific cflags. ($(with-fp) = no): Move test to powerpc32/Makefile. ($(subdir) = misc): Move to powerpc32/Makefile. ($(build-shared) = yes): Move to powerpc32/Makefile. ($(subdir) = csu): Move to powerpc32/Makefile. (sysdep-rtld-routines): Remove dl-start. Moved these bits to ... * sysdeps/powerpc/powerpc32/Makefile: New file. * sysdeps/powerpc/Versions: Remove libgcc functions. * sysdeps/powerpc/powerpc32/Versions: New file. * sysdeps/powerpc/fpu/Makefile: Remove fprsave and fprrest. * sysdeps/powerpc/powerpc32/fpu/Makefile: New file. * sysdeps/unix/sysv/linux/configure.in (powerpc*): Set arch_minimum_kernel=2.4.19 for powerpc/powerpc64. Also set libc_cv_gcc_unwind_find_fde=yes only if !powerpc/powerpc64. ($machine): Add powerpc/powerpc64 to if ... | for libc_cv_slibdir=/libc64. (powerpc*): Set ldd_rewrite_script. * sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed: New file. * sysdeps/unix/sysv/linux/powerpc/Dist: Remove clone.S. * sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist: New file. Add clone.S. * sysdeps/unix/sysv/linux/powerpc/Makefile: Remove oldgetrlimit64. * sysdeps/unix/sysv/linux/powerpc/Versions: Remove GLIBC_2.0 functions. Remove GLIBC_2.2 functions except getrlimit and setrlimit. Moved them to ... * sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions: New file. 2002-09-04 Ulrich Drepper <drepper@redhat.com> * libio/tst-atime.c: Include <errno.h>. (do_test): Only perform fstatvfs check if ST_NOATIME is defined. 2002-09-03 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (regcomp): Append "__restrict" modifier to avoid warnings of some compilers. (build_collating_symbol): Change the type of characters from "unsigned char" to "char", and append a cast to "char*" pointer in array subscript. (build_collating_symbol): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (re_compile_pattern): Remove incorrect cast. (re_compile_fastmap_iter): Change the type of characters from "unsigned char" to "char", and append a cast to "char*" pointer in array subscript. (parse_bracket_exp): Likewise. * posix/regex_internal.c (re_string_construct_common): Likewise. (re_string_allocate): Likewise. (re_string_construct): Likewise. (re_string_realloc_buffers): Likewise. (build_wcs_buffer): Likewise. (re_string_reconstruct): Likewise. * posix/regex_internal.h: Change the type of characters in re_string_t and bracket_elem_t from "unsigned char" to "char". * posix/regexec.c (regexec): Append "__restrict" modifier to avoid warnings of some compilers. (transit_state_bkref_loop): Change the type of characters from "unsigned char" to "char", and append a cast to "char*" pointer in array subscript. (check_node_accept_bytes): Likewise. (find_collation_sequence_value): Likewise.
2002-09-05 12:28:51 +02:00
static reg_errcode_t re_string_allocate (re_string_t *pstr, const char *str,
int len, int init_len,
Update. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/tst-regex.c (umemlen): New variable. (test_expr): Add expectedicase argument. Test case insensitive searches as well as backwards searches (case sensitive and insensitive) too. (run_test): Add icase argument. Use it to compute regcomp flags. (run_test_backwards): New function. (main): Cast read to size_t to avoid warning. Set umemlen. Add expectedicase arguments to test_expr. * posix/regex_internal.c (re_string_reconstruct): If is_utf8, find previous character by walking back instead of converting all chars from beginning. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (struct re_string_t): Add is_utf8 and mb_cur_max fields. (struct re_dfa_t): Likewise. Reorder fields to make structure smaller on 64-bit arches. (re_string_allocate, re_string_construct): Add mb_cur_max and is_utf8 arguments. (re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max instead of MB_CUR_MAX. * posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max instead of MB_CUR_MAX. (re_compile_internal): Pass new arguments to re_string_construct. (init_dfa): Initialize mb_cur_max and is_utf8 fields. (peek_token, peek_token_bracket): Use input->mb_cur_max instead of MB_CUR_MAX. (parse_expression, parse_bracket_exp, parse_charclass_op): Use dfa->mb_cur_max instead of MB_CUR_MAX. * posix/regex_internal.c (re_string_construct_common): Add mb_cur_max and is_utf8 arguments. Initialize fields with them. (re_string_allocate, re_string_construct): Add mb_cur_max and is_utf8 arguments, pass them to re_string_construct_common. Use mb_cur_max instead of MB_CUR_MAX. (re_string_realloc_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX. (re_string_reconstruct): Likewise. (re_string_context_at): Use input->mb_cur_max instead of MB_CUR_MAX. (create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max instead of MB_CUR_MAX. * posix/regexec.c (re_search_internal): Likewise. Pass new arguments to re_string_allocate. (check_matching, transit_state_sb): Use dfa->mb_cur_max instead of MB_CUR_MAX. (extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/Makefile (tests): Add bug-regex19. (bug-regex19-ENV): Add LOCPATH. * posix/bug-regex19.c: New test.
2003-11-12 18:47:46 +01:00
RE_TRANSLATE_TYPE trans, int icase,
Update. 2004-01-02 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (re_node_set_insert): Remove unused variables. * posix/regex_internal.h (re_dfa_t): Add syntax field. * posix/regcomp.c (parse): Initialize dfa->syntax. * posix/regexec.c (acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_state_context, proceed_next_node, sift_states_iter_mb, sift_states_backward, update_cur_sifted_state, sift_states_bkref, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache, build_trtable): Remove preg argument, add dfa argument instead and remove dfa = preg->buffer initialization in the body. Adjust all callers. (check_node_accept_bytes, group_nodes_into_DFAstates, check_node_accept): Likewise. Use dfa->syntax instead of preg->syntax. (check_arrival_add_next_nodes): Remove preg argument. * posix/regex_internal.h (re_match_context_t): Make input re_string_t instead of a pointer to it. * posix/regex_internal.c (re_string_construct_common): Don't clear pstr here... (re_string_construct): ... but only here. * posix/regexec.c (match_ctx_init): Remove input argument. Don't initialize fields to zero. (re_search_internal): Move input into mctx.input. (acquire_init_state_context, check_matching, check_halt_state_context, proceed_next_node, clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, check_arrival, check_arrival_add_next_nodes, check_node_accept, extend_buffers): Change mctx->input into &mctx->input and mctx->input->field into mctx->input.field. 2004-01-02 Jakub Jelinek <jakub@redhat.com> Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_const_bitset_ptr_t): New type. (re_string_t): Add newline_anchor, word_char and word_ops_used fields. (re_dfa_t): Change word_char type to bitset. Add word_ops_used field. (re_string_context_at, re_string_reconstruct): Remove last argument. * posix/regex_internal.c (re_string_allocate): Initialize pstr->word_char and pstr->word_ops_used. (re_string_context_at): Remove newline_anchor argument. Use input->newline_anchor instead, swap && conditions. Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0. Use input->word_char bitmap instead of IS_WORD_CHAR. (re_string_reconstruct): Likewise. Adjust re_string_context_at caller. * posix/regexec.c (acquire_init_state_context, check_halt_state_context, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, check_arrival, check_node_accept): Adjust re_string_context_at and re_string_reconstruct callers. (re_search_internal): Likewise. Set input.newline_anchor. (build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR. * posix/regcomp.c (init_word_char): Change return type to void. Set dfa->word_ops_used. (free_dfa_content): Don't free dfa->word_char. (parse_expression): Remove error handling for init_word_char.
2004-01-02 22:20:51 +01:00
const re_dfa_t *dfa)
internal_function;
Update. 2002-07-29 Steven Munroe <sjmunroe@us.ibm.com> * sysdeps/powerpc/__longjmp.S: Moved to... * sysdeps/powerpc/powerpc32/__longjmp.S: ...here. * sysdeps/powerpc/add_n.S: Moved to... * sysdeps/powerpc/powerpc32/add_n.S: ...here. * sysdeps/powerpc/addmul_1.S: Moved to... * sysdeps/powerpc/powerpc32/addmul_1.S: ...here. * sysdeps/powerpc/atomicity.h: Moved to... * sysdeps/powerpc/powerpc32/atomicity.h: ...here. * sysdeps/powerpc/backtrace.c: Moved to... * sysdeps/powerpc/powerpc32/backtrace.c: ...here. * sysdeps/powerpc/bp-asm.h: Moved to... * sysdeps/powerpc/powerpc32/bp-asm.h: ...here. * sysdeps/powerpc/bsd-_setjmp.S: Moved to... * sysdeps/powerpc/powerpc32/bsd-_setjmp.S: ...here. * sysdeps/powerpc/bsd-setjmp.S: Moved to... * sysdeps/powerpc/powerpc32/bsd-setjmp.S: ...here. * sysdeps/powerpc/dl-machine.c: Moved to... * sysdeps/powerpc/powerpc32/dl-machine.c: ...here. * sysdeps/powerpc/dl-machine.h: Moved to... * sysdeps/powerpc/powerpc32/dl-machine.h: ...here. * sysdeps/powerpc/dl-start.S: Moved to... * sysdeps/powerpc/powerpc32/dl-start.S: ...here. * sysdeps/powerpc/gprrest0.S: Moved to... * sysdeps/powerpc/powerpc32/gprrest0.S: ...here. * sysdeps/powerpc/gprrest1.S: Moved to... * sysdeps/powerpc/powerpc32/gprrest1.S: ...here. * sysdeps/powerpc/gprsave0.S: Moved to... * sysdeps/powerpc/powerpc32/gprsave0.S: ...here. * sysdeps/powerpc/gprsave1.S: Moved to... * sysdeps/powerpc/powerpc32/gprsave1.S: ...here. * sysdeps/powerpc/lshift.S: Moved to... * sysdeps/powerpc/powerpc32/lshift.S: ...here. * sysdeps/powerpc/memset.S: Moved to... * sysdeps/powerpc/powerpc32/memset.S: ...here. * sysdeps/powerpc/mul_1.S: Moved to... * sysdeps/powerpc/powerpc32/mul_1.S: ...here. * sysdeps/powerpc/ppc-mcount.S: Moved to... * sysdeps/powerpc/powerpc32/ppc-mcount.S: ...here. * sysdeps/powerpc/register-dump.h: Moved to... * sysdeps/powerpc/powerpc32/register-dump.h: ...here. * sysdeps/powerpc/rshift.S: Moved to... * sysdeps/powerpc/powerpc32/rshift.S: ...here. * sysdeps/powerpc/setjmp.S: Moved to... * sysdeps/powerpc/powerpc32/setjmp.S: ...here. * sysdeps/powerpc/stpcpy.S: Moved to... * sysdeps/powerpc/powerpc32/stpcpy.S: ...here. * sysdeps/powerpc/strchr.S: Moved to... * sysdeps/powerpc/powerpc32/strchr.S: ...here. * sysdeps/powerpc/strcmp.S: Moved to... * sysdeps/powerpc/powerpc32/strcmp.S: ...here. * sysdeps/powerpc/strcpy.S: Moved to... * sysdeps/powerpc/powerpc32/strcpy.S: ...here. * sysdeps/powerpc/strlen.S: Moved to... * sysdeps/powerpc/powerpc32/strlen.S: ...here. * sysdeps/powerpc/sub_n.S: Moved to... * sysdeps/powerpc/powerpc32/sub_n.S: ...here. * sysdeps/powerpc/submul_1.S: Moved to... * sysdeps/powerpc/powerpc32/submul_1.S: ...here. * sysdeps/powerpc/elf/bzero.S: Moved to... * sysdeps/powerpc/powerpc32/elf/bzero.S: ...here. * sysdeps/powerpc/elf/start.S: Moved to... * sysdeps/powerpc/powerpc32/elf/start.S: ...here. * sysdeps/powerpc/fpu/__longjmp.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/__longjmp.S: ...here. * sysdeps/powerpc/fpu/fprrest.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/fprrest.S: ...here. * sysdeps/powerpc/fpu/fprsave.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/fprsave.S: ...here. * sysdeps/powerpc/fpu/setjmp.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/setjmp.S: ...here. * sysdeps/powerpc/fpu/s_copysign.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/s_copysign.S: ...here. * sysdeps/powerpc/fpu/s_copysignf.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/s_copysignf.S: ...here. * sysdeps/unix/sysv/linux/powerpc/brk.S: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S: ...here. * sysdeps/unix/sysv/linux/powerpc/clone.S: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: ...here. * sysdeps/unix/sysv/linux/powerpc/glob64.c: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/glob64.c: ...here. * sysdeps/unix/sysv/linux/powerpc/kernel_stat.h: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h: ...here. * sysdeps/unix/sysv/linux/powerpc/socket.S: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S: ...here. * sysdeps/unix/sysv/linux/powerpc/sysdep.h: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: ...here. * sysdeps/unix/sysv/linux/powerpc/syscalls.list: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: ...here. Support PowerPC64. Separate powerpc into powerpc/powerpc32 and powerpc/powerpc64. 2002-07-29 Steven Munroe <sjmunroe@us.ibm.com> * FAQ.in: Add powerpc64 to supported targets list. Also state the minimum gcc version is 3.2 * README: Add powerpc64 to supported targets list. * configure.in: Change machine=powerpc to machine=powerpc/powerpc32. Add powerpc64 and machine=powerpc/powerpc64. (HAVE_ASM_GLOBAL_DOT_NAME): Define if linux*powerpc/powerpc64*. * shlib-versions: Set DEFAULT version to 2.2.5 for powerpc64. * sysdeps/powerpc/Dist: Remove dl-machine.c, dl-start.S, ppc-mcount.S, gprsave1.S, gprsave0.S, gprrest1.S, and gprrest0.S. * sysdeps/powerpc/powerpc32/Dist: New file. * sysdeps/powerpc/Implies: Remove wordsize-32 and powerpc/soft-fp. * sysdeps/powerpc/powerpc32/Implies: New file. * sysdeps/powerpc/Makefile(cflags): Remove powerpc32 specific cflags. ($(with-fp) = no): Move test to powerpc32/Makefile. ($(subdir) = misc): Move to powerpc32/Makefile. ($(build-shared) = yes): Move to powerpc32/Makefile. ($(subdir) = csu): Move to powerpc32/Makefile. (sysdep-rtld-routines): Remove dl-start. Moved these bits to ... * sysdeps/powerpc/powerpc32/Makefile: New file. * sysdeps/powerpc/Versions: Remove libgcc functions. * sysdeps/powerpc/powerpc32/Versions: New file. * sysdeps/powerpc/fpu/Makefile: Remove fprsave and fprrest. * sysdeps/powerpc/powerpc32/fpu/Makefile: New file. * sysdeps/unix/sysv/linux/configure.in (powerpc*): Set arch_minimum_kernel=2.4.19 for powerpc/powerpc64. Also set libc_cv_gcc_unwind_find_fde=yes only if !powerpc/powerpc64. ($machine): Add powerpc/powerpc64 to if ... | for libc_cv_slibdir=/libc64. (powerpc*): Set ldd_rewrite_script. * sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed: New file. * sysdeps/unix/sysv/linux/powerpc/Dist: Remove clone.S. * sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist: New file. Add clone.S. * sysdeps/unix/sysv/linux/powerpc/Makefile: Remove oldgetrlimit64. * sysdeps/unix/sysv/linux/powerpc/Versions: Remove GLIBC_2.0 functions. Remove GLIBC_2.2 functions except getrlimit and setrlimit. Moved them to ... * sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions: New file. 2002-09-04 Ulrich Drepper <drepper@redhat.com> * libio/tst-atime.c: Include <errno.h>. (do_test): Only perform fstatvfs check if ST_NOATIME is defined. 2002-09-03 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (regcomp): Append "__restrict" modifier to avoid warnings of some compilers. (build_collating_symbol): Change the type of characters from "unsigned char" to "char", and append a cast to "char*" pointer in array subscript. (build_collating_symbol): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (re_compile_pattern): Remove incorrect cast. (re_compile_fastmap_iter): Change the type of characters from "unsigned char" to "char", and append a cast to "char*" pointer in array subscript. (parse_bracket_exp): Likewise. * posix/regex_internal.c (re_string_construct_common): Likewise. (re_string_allocate): Likewise. (re_string_construct): Likewise. (re_string_realloc_buffers): Likewise. (build_wcs_buffer): Likewise. (re_string_reconstruct): Likewise. * posix/regex_internal.h: Change the type of characters in re_string_t and bracket_elem_t from "unsigned char" to "char". * posix/regexec.c (regexec): Append "__restrict" modifier to avoid warnings of some compilers. (transit_state_bkref_loop): Change the type of characters from "unsigned char" to "char", and append a cast to "char*" pointer in array subscript. (check_node_accept_bytes): Likewise. (find_collation_sequence_value): Likewise.
2002-09-05 12:28:51 +02:00
static reg_errcode_t re_string_construct (re_string_t *pstr, const char *str,
int len, RE_TRANSLATE_TYPE trans,
Update. 2004-01-02 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (re_node_set_insert): Remove unused variables. * posix/regex_internal.h (re_dfa_t): Add syntax field. * posix/regcomp.c (parse): Initialize dfa->syntax. * posix/regexec.c (acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_state_context, proceed_next_node, sift_states_iter_mb, sift_states_backward, update_cur_sifted_state, sift_states_bkref, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache, build_trtable): Remove preg argument, add dfa argument instead and remove dfa = preg->buffer initialization in the body. Adjust all callers. (check_node_accept_bytes, group_nodes_into_DFAstates, check_node_accept): Likewise. Use dfa->syntax instead of preg->syntax. (check_arrival_add_next_nodes): Remove preg argument. * posix/regex_internal.h (re_match_context_t): Make input re_string_t instead of a pointer to it. * posix/regex_internal.c (re_string_construct_common): Don't clear pstr here... (re_string_construct): ... but only here. * posix/regexec.c (match_ctx_init): Remove input argument. Don't initialize fields to zero. (re_search_internal): Move input into mctx.input. (acquire_init_state_context, check_matching, check_halt_state_context, proceed_next_node, clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, check_arrival, check_arrival_add_next_nodes, check_node_accept, extend_buffers): Change mctx->input into &mctx->input and mctx->input->field into mctx->input.field. 2004-01-02 Jakub Jelinek <jakub@redhat.com> Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_const_bitset_ptr_t): New type. (re_string_t): Add newline_anchor, word_char and word_ops_used fields. (re_dfa_t): Change word_char type to bitset. Add word_ops_used field. (re_string_context_at, re_string_reconstruct): Remove last argument. * posix/regex_internal.c (re_string_allocate): Initialize pstr->word_char and pstr->word_ops_used. (re_string_context_at): Remove newline_anchor argument. Use input->newline_anchor instead, swap && conditions. Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0. Use input->word_char bitmap instead of IS_WORD_CHAR. (re_string_reconstruct): Likewise. Adjust re_string_context_at caller. * posix/regexec.c (acquire_init_state_context, check_halt_state_context, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, check_arrival, check_node_accept): Adjust re_string_context_at and re_string_reconstruct callers. (re_search_internal): Likewise. Set input.newline_anchor. (build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR. * posix/regcomp.c (init_word_char): Change return type to void. Set dfa->word_ops_used. (free_dfa_content): Don't free dfa->word_char. (parse_expression): Remove error handling for init_word_char.
2004-01-02 22:20:51 +01:00
int icase, const re_dfa_t *dfa)
internal_function;
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
static reg_errcode_t re_string_reconstruct (re_string_t *pstr, int idx,
Update. 2004-01-02 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (re_node_set_insert): Remove unused variables. * posix/regex_internal.h (re_dfa_t): Add syntax field. * posix/regcomp.c (parse): Initialize dfa->syntax. * posix/regexec.c (acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_state_context, proceed_next_node, sift_states_iter_mb, sift_states_backward, update_cur_sifted_state, sift_states_bkref, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache, build_trtable): Remove preg argument, add dfa argument instead and remove dfa = preg->buffer initialization in the body. Adjust all callers. (check_node_accept_bytes, group_nodes_into_DFAstates, check_node_accept): Likewise. Use dfa->syntax instead of preg->syntax. (check_arrival_add_next_nodes): Remove preg argument. * posix/regex_internal.h (re_match_context_t): Make input re_string_t instead of a pointer to it. * posix/regex_internal.c (re_string_construct_common): Don't clear pstr here... (re_string_construct): ... but only here. * posix/regexec.c (match_ctx_init): Remove input argument. Don't initialize fields to zero. (re_search_internal): Move input into mctx.input. (acquire_init_state_context, check_matching, check_halt_state_context, proceed_next_node, clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, check_arrival, check_arrival_add_next_nodes, check_node_accept, extend_buffers): Change mctx->input into &mctx->input and mctx->input->field into mctx->input.field. 2004-01-02 Jakub Jelinek <jakub@redhat.com> Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_const_bitset_ptr_t): New type. (re_string_t): Add newline_anchor, word_char and word_ops_used fields. (re_dfa_t): Change word_char type to bitset. Add word_ops_used field. (re_string_context_at, re_string_reconstruct): Remove last argument. * posix/regex_internal.c (re_string_allocate): Initialize pstr->word_char and pstr->word_ops_used. (re_string_context_at): Remove newline_anchor argument. Use input->newline_anchor instead, swap && conditions. Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0. Use input->word_char bitmap instead of IS_WORD_CHAR. (re_string_reconstruct): Likewise. Adjust re_string_context_at caller. * posix/regexec.c (acquire_init_state_context, check_halt_state_context, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, check_arrival, check_node_accept): Adjust re_string_context_at and re_string_reconstruct callers. (re_search_internal): Likewise. Set input.newline_anchor. (build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR. * posix/regcomp.c (init_word_char): Change return type to void. Set dfa->word_ops_used. (free_dfa_content): Don't free dfa->word_char. (parse_expression): Remove error handling for init_word_char.
2004-01-02 22:20:51 +01:00
int eflags) internal_function;
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr,
Update. 2004-01-02 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (re_node_set_insert): Remove unused variables. * posix/regex_internal.h (re_dfa_t): Add syntax field. * posix/regcomp.c (parse): Initialize dfa->syntax. * posix/regexec.c (acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_state_context, proceed_next_node, sift_states_iter_mb, sift_states_backward, update_cur_sifted_state, sift_states_bkref, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache, build_trtable): Remove preg argument, add dfa argument instead and remove dfa = preg->buffer initialization in the body. Adjust all callers. (check_node_accept_bytes, group_nodes_into_DFAstates, check_node_accept): Likewise. Use dfa->syntax instead of preg->syntax. (check_arrival_add_next_nodes): Remove preg argument. * posix/regex_internal.h (re_match_context_t): Make input re_string_t instead of a pointer to it. * posix/regex_internal.c (re_string_construct_common): Don't clear pstr here... (re_string_construct): ... but only here. * posix/regexec.c (match_ctx_init): Remove input argument. Don't initialize fields to zero. (re_search_internal): Move input into mctx.input. (acquire_init_state_context, check_matching, check_halt_state_context, proceed_next_node, clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, check_arrival, check_arrival_add_next_nodes, check_node_accept, extend_buffers): Change mctx->input into &mctx->input and mctx->input->field into mctx->input.field. 2004-01-02 Jakub Jelinek <jakub@redhat.com> Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_const_bitset_ptr_t): New type. (re_string_t): Add newline_anchor, word_char and word_ops_used fields. (re_dfa_t): Change word_char type to bitset. Add word_ops_used field. (re_string_context_at, re_string_reconstruct): Remove last argument. * posix/regex_internal.c (re_string_allocate): Initialize pstr->word_char and pstr->word_ops_used. (re_string_context_at): Remove newline_anchor argument. Use input->newline_anchor instead, swap && conditions. Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0. Use input->word_char bitmap instead of IS_WORD_CHAR. (re_string_reconstruct): Likewise. Adjust re_string_context_at caller. * posix/regexec.c (acquire_init_state_context, check_halt_state_context, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, check_arrival, check_node_accept): Adjust re_string_context_at and re_string_reconstruct callers. (re_search_internal): Likewise. Set input.newline_anchor. (build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR. * posix/regcomp.c (init_word_char): Change return type to void. Set dfa->word_ops_used. (free_dfa_content): Don't free dfa->word_char. (parse_expression): Remove error handling for init_word_char.
2004-01-02 22:20:51 +01:00
int new_buf_len)
internal_function;
# ifdef RE_ENABLE_I18N
Update. 2003-12-22 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c: Remove C99-ism. * posix/tst-rxspencer.c: Likewise. Based on a patch by Alex Davis <alex14641@yahoo.com>. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h [!_LIBC] (internal_function): Define. (re_string_allocate, re_string_construct, re_string_reconstruct, re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer, build_upper_buffer, re_string_translate_buffer, re_string_destruct, re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at, re_string_context_at, re_node_set_alloc, re_node_set_init_1 re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect, re_node_set_init_union, re_node_set_merge, re_node_set_insert re_node_set_compare, re_node_set_contains re_node_set_remove_at, re_dfa_add_node, re_acquire_state, re_acquire_state_context, free_state): Add internal_function to declaration. * posix/regexec.c (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_free_subtops, match_ctx_add_entry, search_cur_bkref_entry, match_ctx_clear_flag, match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init, re_search_internal, re_search_2_stub, re_search_stub, re_copy_regs, acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_node_context, check_halt_state_context update_regs, proceed_next_node, push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return, sift_states_iter_mb, sift_states_backward update_cur_sifted_state, add_epsilon_src_nodes, sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref, clean_state_log_if_need, merge_state_array, transit_state, check_subexp_matching_top, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node, check_arrival, check_arrival_add_next_nodes, find_collation_sequence_value, check_arrival_expand_ecl, check_arrival_expand_ecl_sub, expand_bkref_cache, build_trtable, check_node_accept_bytes, extend_buffers, group_nodes_into_DFAstates, check_node_accept): Likewise. * posix/regex_internal.c (re_string_construct_common, re_string_skip_chars, create_newstate_common, register_state, create_ci_newstate, create_cd_newstate, calc_state_hash): Likewise. (re_string_peek_byte_case, re_fetch_byte_case): Change declaration from ANSI to K&R. 2002-12-16 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (build_trtable): Don't allocate the trtable until state->word_trtable is known. Don't hardcode UINT_BITS iterations on each bitset item.
2003-12-23 03:29:44 +01:00
static void build_wcs_buffer (re_string_t *pstr) internal_function;
static int build_wcs_upper_buffer (re_string_t *pstr) internal_function;
# endif /* RE_ENABLE_I18N */
Update. 2003-12-22 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c: Remove C99-ism. * posix/tst-rxspencer.c: Likewise. Based on a patch by Alex Davis <alex14641@yahoo.com>. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h [!_LIBC] (internal_function): Define. (re_string_allocate, re_string_construct, re_string_reconstruct, re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer, build_upper_buffer, re_string_translate_buffer, re_string_destruct, re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at, re_string_context_at, re_node_set_alloc, re_node_set_init_1 re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect, re_node_set_init_union, re_node_set_merge, re_node_set_insert re_node_set_compare, re_node_set_contains re_node_set_remove_at, re_dfa_add_node, re_acquire_state, re_acquire_state_context, free_state): Add internal_function to declaration. * posix/regexec.c (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_free_subtops, match_ctx_add_entry, search_cur_bkref_entry, match_ctx_clear_flag, match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init, re_search_internal, re_search_2_stub, re_search_stub, re_copy_regs, acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_node_context, check_halt_state_context update_regs, proceed_next_node, push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return, sift_states_iter_mb, sift_states_backward update_cur_sifted_state, add_epsilon_src_nodes, sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref, clean_state_log_if_need, merge_state_array, transit_state, check_subexp_matching_top, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node, check_arrival, check_arrival_add_next_nodes, find_collation_sequence_value, check_arrival_expand_ecl, check_arrival_expand_ecl_sub, expand_bkref_cache, build_trtable, check_node_accept_bytes, extend_buffers, group_nodes_into_DFAstates, check_node_accept): Likewise. * posix/regex_internal.c (re_string_construct_common, re_string_skip_chars, create_newstate_common, register_state, create_ci_newstate, create_cd_newstate, calc_state_hash): Likewise. (re_string_peek_byte_case, re_fetch_byte_case): Change declaration from ANSI to K&R. 2002-12-16 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (build_trtable): Don't allocate the trtable until state->word_trtable is known. Don't hardcode UINT_BITS iterations on each bitset item.
2003-12-23 03:29:44 +01:00
static void build_upper_buffer (re_string_t *pstr) internal_function;
static void re_string_translate_buffer (re_string_t *pstr) internal_function;
static void re_string_destruct (re_string_t *pstr) internal_function;
# ifdef RE_ENABLE_I18N
Update. 2004-01-02 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (re_node_set_insert): Remove unused variables. * posix/regex_internal.h (re_dfa_t): Add syntax field. * posix/regcomp.c (parse): Initialize dfa->syntax. * posix/regexec.c (acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_state_context, proceed_next_node, sift_states_iter_mb, sift_states_backward, update_cur_sifted_state, sift_states_bkref, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache, build_trtable): Remove preg argument, add dfa argument instead and remove dfa = preg->buffer initialization in the body. Adjust all callers. (check_node_accept_bytes, group_nodes_into_DFAstates, check_node_accept): Likewise. Use dfa->syntax instead of preg->syntax. (check_arrival_add_next_nodes): Remove preg argument. * posix/regex_internal.h (re_match_context_t): Make input re_string_t instead of a pointer to it. * posix/regex_internal.c (re_string_construct_common): Don't clear pstr here... (re_string_construct): ... but only here. * posix/regexec.c (match_ctx_init): Remove input argument. Don't initialize fields to zero. (re_search_internal): Move input into mctx.input. (acquire_init_state_context, check_matching, check_halt_state_context, proceed_next_node, clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, check_arrival, check_arrival_add_next_nodes, check_node_accept, extend_buffers): Change mctx->input into &mctx->input and mctx->input->field into mctx->input.field. 2004-01-02 Jakub Jelinek <jakub@redhat.com> Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_const_bitset_ptr_t): New type. (re_string_t): Add newline_anchor, word_char and word_ops_used fields. (re_dfa_t): Change word_char type to bitset. Add word_ops_used field. (re_string_context_at, re_string_reconstruct): Remove last argument. * posix/regex_internal.c (re_string_allocate): Initialize pstr->word_char and pstr->word_ops_used. (re_string_context_at): Remove newline_anchor argument. Use input->newline_anchor instead, swap && conditions. Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0. Use input->word_char bitmap instead of IS_WORD_CHAR. (re_string_reconstruct): Likewise. Adjust re_string_context_at caller. * posix/regexec.c (acquire_init_state_context, check_halt_state_context, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, check_arrival, check_node_accept): Adjust re_string_context_at and re_string_reconstruct callers. (re_search_internal): Likewise. Set input.newline_anchor. (build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR. * posix/regcomp.c (init_word_char): Change return type to void. Set dfa->word_ops_used. (free_dfa_content): Don't free dfa->word_char. (parse_expression): Remove error handling for init_word_char.
2004-01-02 22:20:51 +01:00
static int re_string_elem_size_at (const re_string_t *pstr, int idx)
internal_function;
static inline int re_string_char_size_at (const re_string_t *pstr, int idx)
internal_function;
static inline wint_t re_string_wchar_at (const re_string_t *pstr, int idx)
internal_function;
# endif /* RE_ENABLE_I18N */
static unsigned int re_string_context_at (const re_string_t *input, int idx,
Update. 2004-01-02 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (re_node_set_insert): Remove unused variables. * posix/regex_internal.h (re_dfa_t): Add syntax field. * posix/regcomp.c (parse): Initialize dfa->syntax. * posix/regexec.c (acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_state_context, proceed_next_node, sift_states_iter_mb, sift_states_backward, update_cur_sifted_state, sift_states_bkref, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache, build_trtable): Remove preg argument, add dfa argument instead and remove dfa = preg->buffer initialization in the body. Adjust all callers. (check_node_accept_bytes, group_nodes_into_DFAstates, check_node_accept): Likewise. Use dfa->syntax instead of preg->syntax. (check_arrival_add_next_nodes): Remove preg argument. * posix/regex_internal.h (re_match_context_t): Make input re_string_t instead of a pointer to it. * posix/regex_internal.c (re_string_construct_common): Don't clear pstr here... (re_string_construct): ... but only here. * posix/regexec.c (match_ctx_init): Remove input argument. Don't initialize fields to zero. (re_search_internal): Move input into mctx.input. (acquire_init_state_context, check_matching, check_halt_state_context, proceed_next_node, clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, check_arrival, check_arrival_add_next_nodes, check_node_accept, extend_buffers): Change mctx->input into &mctx->input and mctx->input->field into mctx->input.field. 2004-01-02 Jakub Jelinek <jakub@redhat.com> Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_const_bitset_ptr_t): New type. (re_string_t): Add newline_anchor, word_char and word_ops_used fields. (re_dfa_t): Change word_char type to bitset. Add word_ops_used field. (re_string_context_at, re_string_reconstruct): Remove last argument. * posix/regex_internal.c (re_string_allocate): Initialize pstr->word_char and pstr->word_ops_used. (re_string_context_at): Remove newline_anchor argument. Use input->newline_anchor instead, swap && conditions. Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0. Use input->word_char bitmap instead of IS_WORD_CHAR. (re_string_reconstruct): Likewise. Adjust re_string_context_at caller. * posix/regexec.c (acquire_init_state_context, check_halt_state_context, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, check_arrival, check_node_accept): Adjust re_string_context_at and re_string_reconstruct callers. (re_search_internal): Likewise. Set input.newline_anchor. (build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR. * posix/regcomp.c (init_word_char): Change return type to void. Set dfa->word_ops_used. (free_dfa_content): Don't free dfa->word_char. (parse_expression): Remove error handling for init_word_char.
2004-01-02 22:20:51 +01:00
int eflags) internal_function;
Update. 2003-11-28 Ulrich Drepper <drepper@redhat.com> * sysdeps/x86_64/fpu/libm-test-ulps: Add some more minor changes to compensate other setup. 2003-11-27 Andreas Jaeger <aj@suse.de> * sysdeps/x86_64/fpu/libm-test-ulps: Add ulps for new atan2 test. * math/libm-test.inc (atan2_test): Add test that run infinitly. Reported by "Willus" <etc231etc231@willus.com>. 2003-11-27 Michael Matz <matz@suse.de> * sysdeps/ieee754/dbl-64/mpsqrt.c (fastiroot): Fix 64-bit problem with wrong types. 2003-11-28 Jakub Jelinek <jakub@redhat.com> * posix/regexec.c (acquire_init_state_context): Make inline. Add always_inline attribute. (check_matching): Add BE macro. Move if (cur_state->has_backref) into if (dfa->nbackref). (sift_states_backward): Fix comment. (transit_state): Add BE macro. Move if (next_state->has_backref) into if (dfa->nbackref && next_state). Don't check for next_state != NULL twice. * posix/regcomp.c (peek_token): Use opr.ctx_type instead of opr.idx for ANCHOR. (parse_expression): Only call init_word_char if word context will be needed. * posix/bug-regex11.c (tests): Add new tests. * posix/tst-regex.c: Include getopt.h. (timing): New variable. (main): Set timing to 1 if --timing argument is present. Add 2 new tests. (run_test, run_test_backwards): Handle timing. 2003-11-27 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (re_string_t): Remove mbs_case field. Add offsets, valid_raw_len, raw_len, raw_stop, mbs_allocated and offsets_needed fields. Change icase, is_utf8 and map_notascii type from int bitfield to unsigned char. (MBS_ALLOCATED, MBS_CASE_ALLOCATED): Remove. (build_wcs_upper_buffer): Change prototype to return int. (re_string_peek_byte_case, re_string_fetch_byte_case): Remove defines, add prototypes. * posix/regex_internal.c (re_string_allocate): Don't initialize stop here. Don't initialize mbs_case. Set valid_raw_len. Use mbs_allocated instead of MBS_* macros. (re_string_construct): Don't initialize stop and valid_len here. Don't initialize mbs_case. Use mbs_allocated instead of MBS_* macros. Reallocate buffers if build_wcs_upper_buffer converted too few bytes. Set valid_len to bufs_len only for single byte no translation and set in that case valid_raw_len as well. (re_string_realloc_buffers): Reallocate offsets if not NULL. Use mbs_allocated instead of MBS_ALLOCATED. Don't reallocate mbs_case. (re_string_construct_common): Initialize raw_len, mbs_allocated, stop and raw_stop. (build_wcs_buffer): Apply pstr->trans before mbrtowc instead of after it. Set valid_raw_len. Don't set mbs_case. (build_wcs_upper_buffer): Return REG_NOERROR or REG_ESPACE. Only use the fast path if !pstr->offsets_needed. Apply pstr->trans before mbrtowc instead of after it. If upper case character uses different number of bytes than lower case, goto to the slow path. Don't call towupper unnecessarily twice. Set valid_raw_len as well. Handle in the slow path the case if lower and upper case use different number of characters. Don't set mbs_case. (re_string_skip_chars): Use valid_raw_len instead of valid_len. (build_upper_buffer): Don't set mbs_case. Add BE macro. Set valid_raw_len. (re_string_translate_buffer): Set mbs instead of mbs_case. Set valid_raw_len. (re_string_reconstruct): Use raw_len/raw_stop to initialize len/stop. Clear valid_raw_len and offsets_needed when clearing valid_len. Use mbs_allocated instead of MBS_* macros. Check original offset against valid_raw_len instead of valid_len. Remove mbs_case handling. Adjust valid_raw_len together with valid_len. If is_utf8 and looking for tip context, apply pstr->trans first. If buffers start with partial multi-byte character, initialize mbs array as well if mbs_allocated. Check return value of build_wcs_upper_buffer. (re_string_peek_byte_case): New function. (re_string_fetch_byte_case): New function. (re_string_destruct): Use mbs_allocated instead of MBS_ALLOCATED. Don't free mbs_case. Free offsets. * posix/regcomp.c (init_dfa): Only check if charset name is UTF-8 if mb_cur_max == 6. * posix/regexec.c (re_search_internal): Initialize input.raw_stop as well. Use valid_raw_len instead of valid_len when looking through fastmap. Adjust registers through input.offsets. (extend_buffers): Allow build_wcs_upper_buffer to fail. * posix/bug-regex18.c (tests): Enable #ifdefed out tests. Add new tests.
2003-11-29 07:13:09 +01:00
static unsigned char re_string_peek_byte_case (const re_string_t *pstr,
Update. 2003-12-22 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c: Remove C99-ism. * posix/tst-rxspencer.c: Likewise. Based on a patch by Alex Davis <alex14641@yahoo.com>. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h [!_LIBC] (internal_function): Define. (re_string_allocate, re_string_construct, re_string_reconstruct, re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer, build_upper_buffer, re_string_translate_buffer, re_string_destruct, re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at, re_string_context_at, re_node_set_alloc, re_node_set_init_1 re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect, re_node_set_init_union, re_node_set_merge, re_node_set_insert re_node_set_compare, re_node_set_contains re_node_set_remove_at, re_dfa_add_node, re_acquire_state, re_acquire_state_context, free_state): Add internal_function to declaration. * posix/regexec.c (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_free_subtops, match_ctx_add_entry, search_cur_bkref_entry, match_ctx_clear_flag, match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init, re_search_internal, re_search_2_stub, re_search_stub, re_copy_regs, acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_node_context, check_halt_state_context update_regs, proceed_next_node, push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return, sift_states_iter_mb, sift_states_backward update_cur_sifted_state, add_epsilon_src_nodes, sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref, clean_state_log_if_need, merge_state_array, transit_state, check_subexp_matching_top, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node, check_arrival, check_arrival_add_next_nodes, find_collation_sequence_value, check_arrival_expand_ecl, check_arrival_expand_ecl_sub, expand_bkref_cache, build_trtable, check_node_accept_bytes, extend_buffers, group_nodes_into_DFAstates, check_node_accept): Likewise. * posix/regex_internal.c (re_string_construct_common, re_string_skip_chars, create_newstate_common, register_state, create_ci_newstate, create_cd_newstate, calc_state_hash): Likewise. (re_string_peek_byte_case, re_fetch_byte_case): Change declaration from ANSI to K&R. 2002-12-16 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (build_trtable): Don't allocate the trtable until state->word_trtable is known. Don't hardcode UINT_BITS iterations on each bitset item.
2003-12-23 03:29:44 +01:00
int idx) internal_function;
Update. 2004-01-02 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (re_node_set_insert): Remove unused variables. * posix/regex_internal.h (re_dfa_t): Add syntax field. * posix/regcomp.c (parse): Initialize dfa->syntax. * posix/regexec.c (acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_state_context, proceed_next_node, sift_states_iter_mb, sift_states_backward, update_cur_sifted_state, sift_states_bkref, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache, build_trtable): Remove preg argument, add dfa argument instead and remove dfa = preg->buffer initialization in the body. Adjust all callers. (check_node_accept_bytes, group_nodes_into_DFAstates, check_node_accept): Likewise. Use dfa->syntax instead of preg->syntax. (check_arrival_add_next_nodes): Remove preg argument. * posix/regex_internal.h (re_match_context_t): Make input re_string_t instead of a pointer to it. * posix/regex_internal.c (re_string_construct_common): Don't clear pstr here... (re_string_construct): ... but only here. * posix/regexec.c (match_ctx_init): Remove input argument. Don't initialize fields to zero. (re_search_internal): Move input into mctx.input. (acquire_init_state_context, check_matching, check_halt_state_context, proceed_next_node, clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, check_arrival, check_arrival_add_next_nodes, check_node_accept, extend_buffers): Change mctx->input into &mctx->input and mctx->input->field into mctx->input.field. 2004-01-02 Jakub Jelinek <jakub@redhat.com> Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_const_bitset_ptr_t): New type. (re_string_t): Add newline_anchor, word_char and word_ops_used fields. (re_dfa_t): Change word_char type to bitset. Add word_ops_used field. (re_string_context_at, re_string_reconstruct): Remove last argument. * posix/regex_internal.c (re_string_allocate): Initialize pstr->word_char and pstr->word_ops_used. (re_string_context_at): Remove newline_anchor argument. Use input->newline_anchor instead, swap && conditions. Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0. Use input->word_char bitmap instead of IS_WORD_CHAR. (re_string_reconstruct): Likewise. Adjust re_string_context_at caller. * posix/regexec.c (acquire_init_state_context, check_halt_state_context, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, check_arrival, check_node_accept): Adjust re_string_context_at and re_string_reconstruct callers. (re_search_internal): Likewise. Set input.newline_anchor. (build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR. * posix/regcomp.c (init_word_char): Change return type to void. Set dfa->word_ops_used. (free_dfa_content): Don't free dfa->word_char. (parse_expression): Remove error handling for init_word_char.
2004-01-02 22:20:51 +01:00
static unsigned char re_string_fetch_byte_case (re_string_t *pstr)
internal_function;
#endif
#define re_string_peek_byte(pstr, offset) \
((pstr)->mbs[(pstr)->cur_idx + offset])
#define re_string_fetch_byte(pstr) \
((pstr)->mbs[(pstr)->cur_idx++])
#define re_string_first_byte(pstr, idx) \
((idx) == (pstr)->valid_len || (pstr)->wcs[idx] != WEOF)
#define re_string_is_single_byte_char(pstr, idx) \
((pstr)->wcs[idx] != WEOF && ((pstr)->valid_len == (idx) + 1 \
|| (pstr)->wcs[(idx) + 1] != WEOF))
#define re_string_eoi(pstr) ((pstr)->stop <= (pstr)->cur_idx)
#define re_string_cur_idx(pstr) ((pstr)->cur_idx)
#define re_string_get_buffer(pstr) ((pstr)->mbs)
#define re_string_length(pstr) ((pstr)->len)
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
#define re_string_byte_at(pstr,idx) ((pstr)->mbs[idx])
#define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx))
#define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx))
#define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))
#define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))
#define re_free(p) free (p)
struct bin_tree_t
{
struct bin_tree_t *parent;
struct bin_tree_t *left;
struct bin_tree_t *right;
/* `node_idx' is the index in dfa->nodes, if `type' == 0.
Otherwise `type' indicate the type of this node. */
re_token_type_t type;
int node_idx;
int first;
int next;
re_node_set eclosure;
};
typedef struct bin_tree_t bin_tree_t;
Update. 2003-11-19 Jakub Jelinek <jakub@redhat.com> * posix/regexec.c (extend_buffers): Don't allocate twice as big state_log as needed. Don't modify pstr->valid_len for mb_cur_max == 1 !icase !trans. * posix/regcomp.c (free_bin_tree): Removed. (create_tree): Add dfa argument. Don't call re_malloc for each tree, instead allocate from str_tree_storage. (re_dfa_add_tree_node): New function. (free_dfa_content): Handle freeing if dfa->nodes == NULL or dfa->state_table == NULL. (re_compile_internal): Call free_dfa_content if init_dfa fails. Call free_workarea_compile, re_string_destruct and free_dfa_content for most of the other failure paths. (init_dfa): Initialize str_tree_storage_idx. Don't clear any fields on allocation failure. (free_workarea_compile): Free str_tree_storage chunks instead of free_bin_tree (dfa->str_tree). (parse): Call re_dfa_add_tree_node instead of re_dfa_add_node followed by create_tree. Add dfa argument to remaining create_tree calls. Remove new_idx variable. Remove calls to free_bin_tree. (parse_reg_exp, parse_branch, parse_expression, parse_sub_exp, parse_dup_op, parse_bracket_exp, build_charclass_op): Likewise. (duplicate_tree): Remove calls to free_bin_tree, add dfa argument to create_tree. * posix/regex_internal.h (BIN_TREE_STORAGE_SIZE): Define. (bin_tree_storage_t): New type. (re_dfa_t): Add str_tree_storage and str_tree_storage_idx fields. * posix/Makefile (tests): Add bug-regex21. (generated): Add bug-regex21-mem, bug-regex21.mtrace, tst-rxspencer-mem and tst-rxspencer.mtrace. (tests): Depend on $(objpfx)bug-regex21-mem and $(objpfx)tst-rxspencer-mem. (bug-regex21-ENV, tst-rxspencer-ENV): Set. ($(objpfx)bug-regex21-mem, $(objpfx)tst-rxspencer-mem): New. * posix/tst-rxspencer.c (main): Add call to mtrace. Free line at the end. * posix/bug-regex21.c: New test. * posix/regexec.c (get_subexp): After calling get_subexp_sub
2003-11-19 20:37:31 +01:00
#define BIN_TREE_STORAGE_SIZE \
((1024 - sizeof (void *)) / sizeof (bin_tree_t))
struct bin_tree_storage_t
{
struct bin_tree_storage_t *next;
bin_tree_t data[BIN_TREE_STORAGE_SIZE];
};
typedef struct bin_tree_storage_t bin_tree_storage_t;
#define CONTEXT_WORD 1
#define CONTEXT_NEWLINE (CONTEXT_WORD << 1)
#define CONTEXT_BEGBUF (CONTEXT_NEWLINE << 1)
#define CONTEXT_ENDBUF (CONTEXT_BEGBUF << 1)
#define IS_WORD_CONTEXT(c) ((c) & CONTEXT_WORD)
#define IS_NEWLINE_CONTEXT(c) ((c) & CONTEXT_NEWLINE)
#define IS_BEGBUF_CONTEXT(c) ((c) & CONTEXT_BEGBUF)
#define IS_ENDBUF_CONTEXT(c) ((c) & CONTEXT_ENDBUF)
#define IS_ORDINARY_CONTEXT(c) ((c) == 0)
#define IS_WORD_CHAR(ch) (isalnum (ch) || (ch) == '_')
#define IS_NEWLINE(ch) ((ch) == NEWLINE_CHAR)
#define IS_WIDE_WORD_CHAR(ch) (iswalnum (ch) || (ch) == L'_')
#define IS_WIDE_NEWLINE(ch) ((ch) == WIDE_NEWLINE_CHAR)
#define NOT_SATISFY_PREV_CONSTRAINT(constraint,context) \
((((constraint) & PREV_WORD_CONSTRAINT) && !IS_WORD_CONTEXT (context)) \
|| ((constraint & PREV_NOTWORD_CONSTRAINT) && IS_WORD_CONTEXT (context)) \
|| ((constraint & PREV_NEWLINE_CONSTRAINT) && !IS_NEWLINE_CONTEXT (context))\
|| ((constraint & PREV_BEGBUF_CONSTRAINT) && !IS_BEGBUF_CONTEXT (context)))
#define NOT_SATISFY_NEXT_CONSTRAINT(constraint,context) \
((((constraint) & NEXT_WORD_CONSTRAINT) && !IS_WORD_CONTEXT (context)) \
|| (((constraint) & NEXT_NOTWORD_CONSTRAINT) && IS_WORD_CONTEXT (context)) \
|| (((constraint) & NEXT_NEWLINE_CONSTRAINT) && !IS_NEWLINE_CONTEXT (context)) \
|| (((constraint) & NEXT_ENDBUF_CONSTRAINT) && !IS_ENDBUF_CONTEXT (context)))
struct re_dfastate_t
{
unsigned int hash;
re_node_set nodes;
re_node_set *entrance_nodes;
struct re_dfastate_t **trtable;
Update. 2004-01-02 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (re_node_set_insert): Remove unused variables. * posix/regex_internal.h (re_dfa_t): Add syntax field. * posix/regcomp.c (parse): Initialize dfa->syntax. * posix/regexec.c (acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_state_context, proceed_next_node, sift_states_iter_mb, sift_states_backward, update_cur_sifted_state, sift_states_bkref, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache, build_trtable): Remove preg argument, add dfa argument instead and remove dfa = preg->buffer initialization in the body. Adjust all callers. (check_node_accept_bytes, group_nodes_into_DFAstates, check_node_accept): Likewise. Use dfa->syntax instead of preg->syntax. (check_arrival_add_next_nodes): Remove preg argument. * posix/regex_internal.h (re_match_context_t): Make input re_string_t instead of a pointer to it. * posix/regex_internal.c (re_string_construct_common): Don't clear pstr here... (re_string_construct): ... but only here. * posix/regexec.c (match_ctx_init): Remove input argument. Don't initialize fields to zero. (re_search_internal): Move input into mctx.input. (acquire_init_state_context, check_matching, check_halt_state_context, proceed_next_node, clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, check_arrival, check_arrival_add_next_nodes, check_node_accept, extend_buffers): Change mctx->input into &mctx->input and mctx->input->field into mctx->input.field. 2004-01-02 Jakub Jelinek <jakub@redhat.com> Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_const_bitset_ptr_t): New type. (re_string_t): Add newline_anchor, word_char and word_ops_used fields. (re_dfa_t): Change word_char type to bitset. Add word_ops_used field. (re_string_context_at, re_string_reconstruct): Remove last argument. * posix/regex_internal.c (re_string_allocate): Initialize pstr->word_char and pstr->word_ops_used. (re_string_context_at): Remove newline_anchor argument. Use input->newline_anchor instead, swap && conditions. Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0. Use input->word_char bitmap instead of IS_WORD_CHAR. (re_string_reconstruct): Likewise. Adjust re_string_context_at caller. * posix/regexec.c (acquire_init_state_context, check_halt_state_context, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, check_arrival, check_node_accept): Adjust re_string_context_at and re_string_reconstruct callers. (re_search_internal): Likewise. Set input.newline_anchor. (build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR. * posix/regcomp.c (init_word_char): Change return type to void. Set dfa->word_ops_used. (free_dfa_content): Don't free dfa->word_char. (parse_expression): Remove error handling for init_word_char.
2004-01-02 22:20:51 +01:00
unsigned int context : 4;
unsigned int halt : 1;
/* If this state can accept `multi byte'.
Note that we refer to multibyte characters, and multi character
collating elements as `multi byte'. */
unsigned int accept_mb : 1;
/* If this state has backreference node(s). */
unsigned int has_backref : 1;
unsigned int has_constraint : 1;
unsigned int word_trtable : 1;
};
typedef struct re_dfastate_t re_dfastate_t;
typedef struct
{
/* start <= node < end */
int start;
int end;
} re_subexp_t;
struct re_state_table_entry
{
int num;
int alloc;
Update. 2002-03-11 Ulrich Drepper <drepper@redhat.com> * manual/examples/mkfsock.c: Include <string.h> as well. Patch by Alain De Carolis <alaind@wseurope.com>. 2002-03-06 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regexec.c (re_match): Fix incorrect register sizes. (re_search): Likewise. 2002-03-05 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (regfree): Remove a disused condition. * posix/regex_internal.c (re_acquire_state): Likewise. (re_acquire_state_context): Likewise. (register_state): Remove a redundant malloc invocation. * posix/regex_internal.h: (re_state_table_entry): Simplify the structure. 2002-03-05 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (regcomp): Add __builtin_expect to error handling conditions. (regerror): Likewise. (regfree): Likewise. (re_compile_internal): Likewise. (init_dfa): Likewise. (init_word_char): Likewise. (create_initial_state): Likewise. (analyze): Likewise. (analyze_tree): Likewise. (duplicate_node): Likewise. (calc_eclosure): Likewise. (calc_eclosure_iter): Likewise. (parse): Likewise. (parse_reg_exp): Likewise. (parse_branch): Likewise. (parse_expression): Likewise. (parse_subexp): Likewise. (parse_dup_op): Likewise. (parse_bracket_exp): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (build_word_op): Likewise. (fetch_number): Likewise. (create_tree): Likewise. (duplicate_tree): Likewise. * posix/regex.c (BE): New macro. * posix/regexec.c (re_match): Add __builtin_expect to error handling conditions. (re_match_2): Likewise. (re_search): Likewise. (re_search_internal): Likewise. (check_matching): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (build_trtable): Likewise. (group_nodes_into_DFAstates): Likewise. (match_ctx_init): Likewise. (match_ctx_add_entry): Likewise. * posix/regex_internal.c (re_string_construct): Add __builtin_expect to error handling conditions. (re_string_construct_toupper): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_node_set_alloc): Likewise. (re_node_set_init_1): Likewise. (re_node_set_init_2): Likewise. (re_node_set_init_copy): Likewise. (re_node_set_intersect): Likewise. (re_node_set_init_union): Likewise. (re_node_set_merge): Likewise. (re_node_set_insert): Likewise. (re_dfa_add_node): Likewise. (re_acquire_state): Likewise. (re_acquire_state_context): Likewise. (create_new_state_common): Likewise. (register_state): Likewise. (create_ci_new_state): Likewise. (create_cd_new_state): Likewise. (re_string_context_at): Remove redundant condition. 2002-01-16 Roger Sayle <roger@eyesopen.com> * sysdeps/i386/i686/strcmp.S: Avoid unconditional jump to a ret. * sysdeps/i386/i586/strlen.S: Fix typo in comment.
2002-03-12 03:04:08 +01:00
re_dfastate_t **array;
};
Update. 2002-11-27 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (parse_expression): Set the bit since the back reference is used in the regular expression. * posix/regex_internal.c (re_node_set_init_1): Make it clean in case of malloc failure. (re_node_set_init_copy): Likewise. * posix/regex_internal.h (state_array_t): New structure. (re_sub_match_last_t): Likewise. (re_sub_match_top_t): Likewise. (re_match_context_t): Add new members. (re_dfa_t): Likewise. * posix/regexec.c (re_search_internal): Invoke prune_impossible_nodes to check the matching is really correct, and retry if failed. Move the routin pruning the impossible nodes from here, ... (prune_impossible_nodes): To this function. (check_matching): Invoke check_subexp_matching_top, and replace redundant checking with transit_state_bkref invocation. (proceed_next_node): Replace strncmp with memcmp. Reported by Paolo Bonzini <bonzini@gnu.org>. (update_cur_sifted_state): Remove search_subexp invocation. (search_subexp): Remove this function. (check_dst_limits_calc_pos): Use search_cur_bkref_entry for optimization. (sift_states_bkref): Use search_cur_bkref_entry for optimization. Remove unused invocation of match_ctx_add_entry. (transit_state): Invoke check_subexp_matching_top. (check_subexp_matching_top): New function. (transit_state_bkref): Remove unused array. Merge transit_state_bkref_loop. (transit_state_bkref_loop): Use get_subexp instead of sift_states_backward. Use search_cur_bkref_entry for optimization. Merge this function to transit_state_bkref. (get_subexp): New function. (get_subexp_sub): Likewise. (find_subexp_node): Likewise. (check_arrival): Likewise. (check_arrival_expand_ecl): Likewise. (check_arrival_expand_ecl_sub): Likewise. (expand_bkref_cache): Likewise. (match_ctx_init): Initialize new members. (match_ctx_clean): New function. (match_ctx_free): Release new members. (match_ctx_free_subtops): New function. (match_ctx_add_entry): Fix indent. (search_cur_bkref_entry): New function. (match_ctx_add_subtop): Likewise. (match_ctx_add_sublast): Likewise.
2002-11-28 00:00:16 +01:00
/* Array type used in re_sub_match_last_t and re_sub_match_top_t. */
typedef struct
{
int next_idx;
int alloc;
re_dfastate_t **array;
} state_array_t;
/* Store information about the node NODE whose type is OP_CLOSE_SUBEXP. */
typedef struct
{
int node;
int str_idx; /* The position NODE match at. */
state_array_t path;
} re_sub_match_last_t;
/* Store information about the node NODE whose type is OP_OPEN_SUBEXP.
And information about the node, whose type is OP_CLOSE_SUBEXP,
corresponding to NODE is stored in LASTS. */
typedef struct
{
int str_idx;
int node;
int next_last_offset;
state_array_t *path;
int alasts; /* Allocation size of LASTS. */
int nlasts; /* The number of LASTS. */
re_sub_match_last_t **lasts;
} re_sub_match_top_t;
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
struct re_backref_cache_entry
{
int node;
int str_idx;
int subexp_from;
int subexp_to;
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
int flag;
};
typedef struct
{
Update. 2004-01-02 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (re_node_set_insert): Remove unused variables. * posix/regex_internal.h (re_dfa_t): Add syntax field. * posix/regcomp.c (parse): Initialize dfa->syntax. * posix/regexec.c (acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_state_context, proceed_next_node, sift_states_iter_mb, sift_states_backward, update_cur_sifted_state, sift_states_bkref, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache, build_trtable): Remove preg argument, add dfa argument instead and remove dfa = preg->buffer initialization in the body. Adjust all callers. (check_node_accept_bytes, group_nodes_into_DFAstates, check_node_accept): Likewise. Use dfa->syntax instead of preg->syntax. (check_arrival_add_next_nodes): Remove preg argument. * posix/regex_internal.h (re_match_context_t): Make input re_string_t instead of a pointer to it. * posix/regex_internal.c (re_string_construct_common): Don't clear pstr here... (re_string_construct): ... but only here. * posix/regexec.c (match_ctx_init): Remove input argument. Don't initialize fields to zero. (re_search_internal): Move input into mctx.input. (acquire_init_state_context, check_matching, check_halt_state_context, proceed_next_node, clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, check_arrival, check_arrival_add_next_nodes, check_node_accept, extend_buffers): Change mctx->input into &mctx->input and mctx->input->field into mctx->input.field. 2004-01-02 Jakub Jelinek <jakub@redhat.com> Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_const_bitset_ptr_t): New type. (re_string_t): Add newline_anchor, word_char and word_ops_used fields. (re_dfa_t): Change word_char type to bitset. Add word_ops_used field. (re_string_context_at, re_string_reconstruct): Remove last argument. * posix/regex_internal.c (re_string_allocate): Initialize pstr->word_char and pstr->word_ops_used. (re_string_context_at): Remove newline_anchor argument. Use input->newline_anchor instead, swap && conditions. Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0. Use input->word_char bitmap instead of IS_WORD_CHAR. (re_string_reconstruct): Likewise. Adjust re_string_context_at caller. * posix/regexec.c (acquire_init_state_context, check_halt_state_context, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, check_arrival, check_node_accept): Adjust re_string_context_at and re_string_reconstruct callers. (re_search_internal): Likewise. Set input.newline_anchor. (build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR. * posix/regcomp.c (init_word_char): Change return type to void. Set dfa->word_ops_used. (free_dfa_content): Don't free dfa->word_char. (parse_expression): Remove error handling for init_word_char.
2004-01-02 22:20:51 +01:00
/* The string object corresponding to the input string. */
re_string_t input;
2004-01-03 14:07:29 +01:00
#if defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
re_dfa_t *const dfa;
#else
re_dfa_t *dfa;
#endif
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
/* EFLAGS of the argument of regexec. */
int eflags;
/* Where the matching ends. */
int match_last;
int last_node;
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
/* The state log used by the matcher. */
re_dfastate_t **state_log;
int state_log_top;
/* Back reference cache. */
int nbkref_ents;
int abkref_ents;
struct re_backref_cache_entry *bkref_ents;
int max_mb_elem_len;
Update. 2002-11-27 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (parse_expression): Set the bit since the back reference is used in the regular expression. * posix/regex_internal.c (re_node_set_init_1): Make it clean in case of malloc failure. (re_node_set_init_copy): Likewise. * posix/regex_internal.h (state_array_t): New structure. (re_sub_match_last_t): Likewise. (re_sub_match_top_t): Likewise. (re_match_context_t): Add new members. (re_dfa_t): Likewise. * posix/regexec.c (re_search_internal): Invoke prune_impossible_nodes to check the matching is really correct, and retry if failed. Move the routin pruning the impossible nodes from here, ... (prune_impossible_nodes): To this function. (check_matching): Invoke check_subexp_matching_top, and replace redundant checking with transit_state_bkref invocation. (proceed_next_node): Replace strncmp with memcmp. Reported by Paolo Bonzini <bonzini@gnu.org>. (update_cur_sifted_state): Remove search_subexp invocation. (search_subexp): Remove this function. (check_dst_limits_calc_pos): Use search_cur_bkref_entry for optimization. (sift_states_bkref): Use search_cur_bkref_entry for optimization. Remove unused invocation of match_ctx_add_entry. (transit_state): Invoke check_subexp_matching_top. (check_subexp_matching_top): New function. (transit_state_bkref): Remove unused array. Merge transit_state_bkref_loop. (transit_state_bkref_loop): Use get_subexp instead of sift_states_backward. Use search_cur_bkref_entry for optimization. Merge this function to transit_state_bkref. (get_subexp): New function. (get_subexp_sub): Likewise. (find_subexp_node): Likewise. (check_arrival): Likewise. (check_arrival_expand_ecl): Likewise. (check_arrival_expand_ecl_sub): Likewise. (expand_bkref_cache): Likewise. (match_ctx_init): Initialize new members. (match_ctx_clean): New function. (match_ctx_free): Release new members. (match_ctx_free_subtops): New function. (match_ctx_add_entry): Fix indent. (search_cur_bkref_entry): New function. (match_ctx_add_subtop): Likewise. (match_ctx_add_sublast): Likewise.
2002-11-28 00:00:16 +01:00
int nsub_tops;
int asub_tops;
re_sub_match_top_t **sub_tops;
Update. 2002-04-22 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_internal): Adapt it to new interface of buffer building functions. * posix/regex_internal.c (re_string_allocate): New function. (re_string_realloc_buffers): New function. (re_string_skip_chars): New function. (re_string_reconstruct): New function. (re_string_construct): Adapt it to new interface of buffer building functions. (re_string_construct_common): Likewise. (build_wcs_buffer): Likewise. (build_wcs_upper_buffer): Likewise. (build_upper_buffer): Likewise. (re_string_translate_buffer): Likewise. (re_string_context_at): Adapt it to variable length buffers. * posix/regex_internal.h (re_string_t): Add new fields to handle variable length buffers. (re_match_context_t): Likewise. * posix/regexec.c (re_search_internal): Adapt it to new interface of re_string_t and re_match_context_t. (acquire_init_state_context): Likewise. (check_matching): Likewise. (check_halt_state_context): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (clean_state_log_if_need): Likewise. (sift_states_iter_mb): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref): Likewise. (transit_state_bkref_loop): Likewise. (check_node_accept): Likewise. (match_ctx_init): Likewise. (extend_buffers): New function. 2002-04-21 Bruno Haible <bruno@clisp.org> * iconvdata/tst-table.sh: For the second check, use the truncated GB18030 charmap table, like for the first check.
2002-04-24 23:54:53 +02:00
} re_match_context_t;
typedef struct
{
int cur_bkref;
int cls_subexp_idx;
re_dfastate_t **sifted_states;
re_dfastate_t **limited_states;
re_node_set limits;
int last_node;
int last_str_idx;
int check_subexp;
} re_sift_context_t;
struct re_fail_stack_ent_t
{
int idx;
int node;
regmatch_t *regs;
re_node_set eps_via_nodes;
};
struct re_fail_stack_t
{
int num;
int alloc;
struct re_fail_stack_ent_t *stack;
};
struct re_dfa_t
{
re_subexp_t *subexps;
re_token_t *nodes;
int nodes_alloc;
int nodes_len;
int *nexts;
int *org_indices;
re_node_set *edests;
re_node_set *eclosures;
re_node_set *inveclosures;
struct re_state_table_entry *state_table;
re_dfastate_t *init_state;
re_dfastate_t *init_state_word;
re_dfastate_t *init_state_nl;
re_dfastate_t *init_state_begbuf;
Update. 2003-11-19 Jakub Jelinek <jakub@redhat.com> * posix/regexec.c (extend_buffers): Don't allocate twice as big state_log as needed. Don't modify pstr->valid_len for mb_cur_max == 1 !icase !trans. * posix/regcomp.c (free_bin_tree): Removed. (create_tree): Add dfa argument. Don't call re_malloc for each tree, instead allocate from str_tree_storage. (re_dfa_add_tree_node): New function. (free_dfa_content): Handle freeing if dfa->nodes == NULL or dfa->state_table == NULL. (re_compile_internal): Call free_dfa_content if init_dfa fails. Call free_workarea_compile, re_string_destruct and free_dfa_content for most of the other failure paths. (init_dfa): Initialize str_tree_storage_idx. Don't clear any fields on allocation failure. (free_workarea_compile): Free str_tree_storage chunks instead of free_bin_tree (dfa->str_tree). (parse): Call re_dfa_add_tree_node instead of re_dfa_add_node followed by create_tree. Add dfa argument to remaining create_tree calls. Remove new_idx variable. Remove calls to free_bin_tree. (parse_reg_exp, parse_branch, parse_expression, parse_sub_exp, parse_dup_op, parse_bracket_exp, build_charclass_op): Likewise. (duplicate_tree): Remove calls to free_bin_tree, add dfa argument to create_tree. * posix/regex_internal.h (BIN_TREE_STORAGE_SIZE): Define. (bin_tree_storage_t): New type. (re_dfa_t): Add str_tree_storage and str_tree_storage_idx fields. * posix/Makefile (tests): Add bug-regex21. (generated): Add bug-regex21-mem, bug-regex21.mtrace, tst-rxspencer-mem and tst-rxspencer.mtrace. (tests): Depend on $(objpfx)bug-regex21-mem and $(objpfx)tst-rxspencer-mem. (bug-regex21-ENV, tst-rxspencer-ENV): Set. ($(objpfx)bug-regex21-mem, $(objpfx)tst-rxspencer-mem): New. * posix/tst-rxspencer.c (main): Add call to mtrace. Free line at the end. * posix/bug-regex21.c: New test. * posix/regexec.c (get_subexp): After calling get_subexp_sub
2003-11-19 20:37:31 +01:00
bin_tree_t *str_tree;
bin_tree_storage_t *str_tree_storage;
re_bitset_ptr_t sb_char;
Update. 2003-11-19 Jakub Jelinek <jakub@redhat.com> * posix/regexec.c (extend_buffers): Don't allocate twice as big state_log as needed. Don't modify pstr->valid_len for mb_cur_max == 1 !icase !trans. * posix/regcomp.c (free_bin_tree): Removed. (create_tree): Add dfa argument. Don't call re_malloc for each tree, instead allocate from str_tree_storage. (re_dfa_add_tree_node): New function. (free_dfa_content): Handle freeing if dfa->nodes == NULL or dfa->state_table == NULL. (re_compile_internal): Call free_dfa_content if init_dfa fails. Call free_workarea_compile, re_string_destruct and free_dfa_content for most of the other failure paths. (init_dfa): Initialize str_tree_storage_idx. Don't clear any fields on allocation failure. (free_workarea_compile): Free str_tree_storage chunks instead of free_bin_tree (dfa->str_tree). (parse): Call re_dfa_add_tree_node instead of re_dfa_add_node followed by create_tree. Add dfa argument to remaining create_tree calls. Remove new_idx variable. Remove calls to free_bin_tree. (parse_reg_exp, parse_branch, parse_expression, parse_sub_exp, parse_dup_op, parse_bracket_exp, build_charclass_op): Likewise. (duplicate_tree): Remove calls to free_bin_tree, add dfa argument to create_tree. * posix/regex_internal.h (BIN_TREE_STORAGE_SIZE): Define. (bin_tree_storage_t): New type. (re_dfa_t): Add str_tree_storage and str_tree_storage_idx fields. * posix/Makefile (tests): Add bug-regex21. (generated): Add bug-regex21-mem, bug-regex21.mtrace, tst-rxspencer-mem and tst-rxspencer.mtrace. (tests): Depend on $(objpfx)bug-regex21-mem and $(objpfx)tst-rxspencer-mem. (bug-regex21-ENV, tst-rxspencer-ENV): Set. ($(objpfx)bug-regex21-mem, $(objpfx)tst-rxspencer-mem): New. * posix/tst-rxspencer.c (main): Add call to mtrace. Free line at the end. * posix/bug-regex21.c: New test. * posix/regexec.c (get_subexp): After calling get_subexp_sub
2003-11-19 20:37:31 +01:00
int str_tree_storage_idx;
Update. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/tst-regex.c (umemlen): New variable. (test_expr): Add expectedicase argument. Test case insensitive searches as well as backwards searches (case sensitive and insensitive) too. (run_test): Add icase argument. Use it to compute regcomp flags. (run_test_backwards): New function. (main): Cast read to size_t to avoid warning. Set umemlen. Add expectedicase arguments to test_expr. * posix/regex_internal.c (re_string_reconstruct): If is_utf8, find previous character by walking back instead of converting all chars from beginning. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (struct re_string_t): Add is_utf8 and mb_cur_max fields. (struct re_dfa_t): Likewise. Reorder fields to make structure smaller on 64-bit arches. (re_string_allocate, re_string_construct): Add mb_cur_max and is_utf8 arguments. (re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max instead of MB_CUR_MAX. * posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max instead of MB_CUR_MAX. (re_compile_internal): Pass new arguments to re_string_construct. (init_dfa): Initialize mb_cur_max and is_utf8 fields. (peek_token, peek_token_bracket): Use input->mb_cur_max instead of MB_CUR_MAX. (parse_expression, parse_bracket_exp, parse_charclass_op): Use dfa->mb_cur_max instead of MB_CUR_MAX. * posix/regex_internal.c (re_string_construct_common): Add mb_cur_max and is_utf8 arguments. Initialize fields with them. (re_string_allocate, re_string_construct): Add mb_cur_max and is_utf8 arguments, pass them to re_string_construct_common. Use mb_cur_max instead of MB_CUR_MAX. (re_string_realloc_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX. (re_string_reconstruct): Likewise. (re_string_context_at): Use input->mb_cur_max instead of MB_CUR_MAX. (create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max instead of MB_CUR_MAX. * posix/regexec.c (re_search_internal): Likewise. Pass new arguments to re_string_allocate. (check_matching, transit_state_sb): Use dfa->mb_cur_max instead of MB_CUR_MAX. (extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/Makefile (tests): Add bug-regex19. (bug-regex19-ENV): Add LOCPATH. * posix/bug-regex19.c: New test.
2003-11-12 18:47:46 +01:00
/* number of subexpressions `re_nsub' is in regex_t. */
int subexps_alloc;
unsigned int state_hash_mask;
int states_alloc;
int init_node;
int nbackref; /* The number of backreference in this dfa. */
Update. 2002-11-27 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (parse_expression): Set the bit since the back reference is used in the regular expression. * posix/regex_internal.c (re_node_set_init_1): Make it clean in case of malloc failure. (re_node_set_init_copy): Likewise. * posix/regex_internal.h (state_array_t): New structure. (re_sub_match_last_t): Likewise. (re_sub_match_top_t): Likewise. (re_match_context_t): Add new members. (re_dfa_t): Likewise. * posix/regexec.c (re_search_internal): Invoke prune_impossible_nodes to check the matching is really correct, and retry if failed. Move the routin pruning the impossible nodes from here, ... (prune_impossible_nodes): To this function. (check_matching): Invoke check_subexp_matching_top, and replace redundant checking with transit_state_bkref invocation. (proceed_next_node): Replace strncmp with memcmp. Reported by Paolo Bonzini <bonzini@gnu.org>. (update_cur_sifted_state): Remove search_subexp invocation. (search_subexp): Remove this function. (check_dst_limits_calc_pos): Use search_cur_bkref_entry for optimization. (sift_states_bkref): Use search_cur_bkref_entry for optimization. Remove unused invocation of match_ctx_add_entry. (transit_state): Invoke check_subexp_matching_top. (check_subexp_matching_top): New function. (transit_state_bkref): Remove unused array. Merge transit_state_bkref_loop. (transit_state_bkref_loop): Use get_subexp instead of sift_states_backward. Use search_cur_bkref_entry for optimization. Merge this function to transit_state_bkref. (get_subexp): New function. (get_subexp_sub): Likewise. (find_subexp_node): Likewise. (check_arrival): Likewise. (check_arrival_expand_ecl): Likewise. (check_arrival_expand_ecl_sub): Likewise. (expand_bkref_cache): Likewise. (match_ctx_init): Initialize new members. (match_ctx_clean): New function. (match_ctx_free): Release new members. (match_ctx_free_subtops): New function. (match_ctx_add_entry): Fix indent. (search_cur_bkref_entry): New function. (match_ctx_add_subtop): Likewise. (match_ctx_add_sublast): Likewise.
2002-11-28 00:00:16 +01:00
/* Bitmap expressing which backreference is used. */
unsigned int used_bkref_map;
unsigned int has_plural_match : 1;
Update. 2002-11-27 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (parse_expression): Set the bit since the back reference is used in the regular expression. * posix/regex_internal.c (re_node_set_init_1): Make it clean in case of malloc failure. (re_node_set_init_copy): Likewise. * posix/regex_internal.h (state_array_t): New structure. (re_sub_match_last_t): Likewise. (re_sub_match_top_t): Likewise. (re_match_context_t): Add new members. (re_dfa_t): Likewise. * posix/regexec.c (re_search_internal): Invoke prune_impossible_nodes to check the matching is really correct, and retry if failed. Move the routin pruning the impossible nodes from here, ... (prune_impossible_nodes): To this function. (check_matching): Invoke check_subexp_matching_top, and replace redundant checking with transit_state_bkref invocation. (proceed_next_node): Replace strncmp with memcmp. Reported by Paolo Bonzini <bonzini@gnu.org>. (update_cur_sifted_state): Remove search_subexp invocation. (search_subexp): Remove this function. (check_dst_limits_calc_pos): Use search_cur_bkref_entry for optimization. (sift_states_bkref): Use search_cur_bkref_entry for optimization. Remove unused invocation of match_ctx_add_entry. (transit_state): Invoke check_subexp_matching_top. (check_subexp_matching_top): New function. (transit_state_bkref): Remove unused array. Merge transit_state_bkref_loop. (transit_state_bkref_loop): Use get_subexp instead of sift_states_backward. Use search_cur_bkref_entry for optimization. Merge this function to transit_state_bkref. (get_subexp): New function. (get_subexp_sub): Likewise. (find_subexp_node): Likewise. (check_arrival): Likewise. (check_arrival_expand_ecl): Likewise. (check_arrival_expand_ecl_sub): Likewise. (expand_bkref_cache): Likewise. (match_ctx_init): Initialize new members. (match_ctx_clean): New function. (match_ctx_free): Release new members. (match_ctx_free_subtops): New function. (match_ctx_add_entry): Fix indent. (search_cur_bkref_entry): New function. (match_ctx_add_subtop): Likewise. (match_ctx_add_sublast): Likewise.
2002-11-28 00:00:16 +01:00
/* If this dfa has "multibyte node", which is a backreference or
a node which can accept multibyte character or multi character
collating element. */
unsigned int has_mb_node : 1;
Update. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/tst-regex.c (umemlen): New variable. (test_expr): Add expectedicase argument. Test case insensitive searches as well as backwards searches (case sensitive and insensitive) too. (run_test): Add icase argument. Use it to compute regcomp flags. (run_test_backwards): New function. (main): Cast read to size_t to avoid warning. Set umemlen. Add expectedicase arguments to test_expr. * posix/regex_internal.c (re_string_reconstruct): If is_utf8, find previous character by walking back instead of converting all chars from beginning. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (struct re_string_t): Add is_utf8 and mb_cur_max fields. (struct re_dfa_t): Likewise. Reorder fields to make structure smaller on 64-bit arches. (re_string_allocate, re_string_construct): Add mb_cur_max and is_utf8 arguments. (re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max instead of MB_CUR_MAX. * posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max instead of MB_CUR_MAX. (re_compile_internal): Pass new arguments to re_string_construct. (init_dfa): Initialize mb_cur_max and is_utf8 fields. (peek_token, peek_token_bracket): Use input->mb_cur_max instead of MB_CUR_MAX. (parse_expression, parse_bracket_exp, parse_charclass_op): Use dfa->mb_cur_max instead of MB_CUR_MAX. * posix/regex_internal.c (re_string_construct_common): Add mb_cur_max and is_utf8 arguments. Initialize fields with them. (re_string_allocate, re_string_construct): Add mb_cur_max and is_utf8 arguments, pass them to re_string_construct_common. Use mb_cur_max instead of MB_CUR_MAX. (re_string_realloc_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX. (re_string_reconstruct): Likewise. (re_string_context_at): Use input->mb_cur_max instead of MB_CUR_MAX. (create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max instead of MB_CUR_MAX. * posix/regexec.c (re_search_internal): Likewise. Pass new arguments to re_string_allocate. (check_matching, transit_state_sb): Use dfa->mb_cur_max instead of MB_CUR_MAX. (extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/Makefile (tests): Add bug-regex19. (bug-regex19-ENV): Add LOCPATH. * posix/bug-regex19.c: New test.
2003-11-12 18:47:46 +01:00
unsigned int is_utf8 : 1;
unsigned int map_notascii : 1;
Update. 2004-01-02 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (re_node_set_insert): Remove unused variables. * posix/regex_internal.h (re_dfa_t): Add syntax field. * posix/regcomp.c (parse): Initialize dfa->syntax. * posix/regexec.c (acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_state_context, proceed_next_node, sift_states_iter_mb, sift_states_backward, update_cur_sifted_state, sift_states_bkref, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache, build_trtable): Remove preg argument, add dfa argument instead and remove dfa = preg->buffer initialization in the body. Adjust all callers. (check_node_accept_bytes, group_nodes_into_DFAstates, check_node_accept): Likewise. Use dfa->syntax instead of preg->syntax. (check_arrival_add_next_nodes): Remove preg argument. * posix/regex_internal.h (re_match_context_t): Make input re_string_t instead of a pointer to it. * posix/regex_internal.c (re_string_construct_common): Don't clear pstr here... (re_string_construct): ... but only here. * posix/regexec.c (match_ctx_init): Remove input argument. Don't initialize fields to zero. (re_search_internal): Move input into mctx.input. (acquire_init_state_context, check_matching, check_halt_state_context, proceed_next_node, clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, check_arrival, check_arrival_add_next_nodes, check_node_accept, extend_buffers): Change mctx->input into &mctx->input and mctx->input->field into mctx->input.field. 2004-01-02 Jakub Jelinek <jakub@redhat.com> Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_const_bitset_ptr_t): New type. (re_string_t): Add newline_anchor, word_char and word_ops_used fields. (re_dfa_t): Change word_char type to bitset. Add word_ops_used field. (re_string_context_at, re_string_reconstruct): Remove last argument. * posix/regex_internal.c (re_string_allocate): Initialize pstr->word_char and pstr->word_ops_used. (re_string_context_at): Remove newline_anchor argument. Use input->newline_anchor instead, swap && conditions. Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0. Use input->word_char bitmap instead of IS_WORD_CHAR. (re_string_reconstruct): Likewise. Adjust re_string_context_at caller. * posix/regexec.c (acquire_init_state_context, check_halt_state_context, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, check_arrival, check_node_accept): Adjust re_string_context_at and re_string_reconstruct callers. (re_search_internal): Likewise. Set input.newline_anchor. (build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR. * posix/regcomp.c (init_word_char): Change return type to void. Set dfa->word_ops_used. (free_dfa_content): Don't free dfa->word_char. (parse_expression): Remove error handling for init_word_char.
2004-01-02 22:20:51 +01:00
unsigned int word_ops_used : 1;
Update. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/tst-regex.c (umemlen): New variable. (test_expr): Add expectedicase argument. Test case insensitive searches as well as backwards searches (case sensitive and insensitive) too. (run_test): Add icase argument. Use it to compute regcomp flags. (run_test_backwards): New function. (main): Cast read to size_t to avoid warning. Set umemlen. Add expectedicase arguments to test_expr. * posix/regex_internal.c (re_string_reconstruct): If is_utf8, find previous character by walking back instead of converting all chars from beginning. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (struct re_string_t): Add is_utf8 and mb_cur_max fields. (struct re_dfa_t): Likewise. Reorder fields to make structure smaller on 64-bit arches. (re_string_allocate, re_string_construct): Add mb_cur_max and is_utf8 arguments. (re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max instead of MB_CUR_MAX. * posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max instead of MB_CUR_MAX. (re_compile_internal): Pass new arguments to re_string_construct. (init_dfa): Initialize mb_cur_max and is_utf8 fields. (peek_token, peek_token_bracket): Use input->mb_cur_max instead of MB_CUR_MAX. (parse_expression, parse_bracket_exp, parse_charclass_op): Use dfa->mb_cur_max instead of MB_CUR_MAX. * posix/regex_internal.c (re_string_construct_common): Add mb_cur_max and is_utf8 arguments. Initialize fields with them. (re_string_allocate, re_string_construct): Add mb_cur_max and is_utf8 arguments, pass them to re_string_construct_common. Use mb_cur_max instead of MB_CUR_MAX. (re_string_realloc_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX. (re_string_reconstruct): Likewise. (re_string_context_at): Use input->mb_cur_max instead of MB_CUR_MAX. (create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max instead of MB_CUR_MAX. * posix/regexec.c (re_search_internal): Likewise. Pass new arguments to re_string_allocate. (check_matching, transit_state_sb): Use dfa->mb_cur_max instead of MB_CUR_MAX. (extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/Makefile (tests): Add bug-regex19. (bug-regex19-ENV): Add LOCPATH. * posix/bug-regex19.c: New test.
2003-11-12 18:47:46 +01:00
int mb_cur_max;
Update. 2004-01-02 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (re_node_set_insert): Remove unused variables. * posix/regex_internal.h (re_dfa_t): Add syntax field. * posix/regcomp.c (parse): Initialize dfa->syntax. * posix/regexec.c (acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_state_context, proceed_next_node, sift_states_iter_mb, sift_states_backward, update_cur_sifted_state, sift_states_bkref, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache, build_trtable): Remove preg argument, add dfa argument instead and remove dfa = preg->buffer initialization in the body. Adjust all callers. (check_node_accept_bytes, group_nodes_into_DFAstates, check_node_accept): Likewise. Use dfa->syntax instead of preg->syntax. (check_arrival_add_next_nodes): Remove preg argument. * posix/regex_internal.h (re_match_context_t): Make input re_string_t instead of a pointer to it. * posix/regex_internal.c (re_string_construct_common): Don't clear pstr here... (re_string_construct): ... but only here. * posix/regexec.c (match_ctx_init): Remove input argument. Don't initialize fields to zero. (re_search_internal): Move input into mctx.input. (acquire_init_state_context, check_matching, check_halt_state_context, proceed_next_node, clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, check_arrival, check_arrival_add_next_nodes, check_node_accept, extend_buffers): Change mctx->input into &mctx->input and mctx->input->field into mctx->input.field. 2004-01-02 Jakub Jelinek <jakub@redhat.com> Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_const_bitset_ptr_t): New type. (re_string_t): Add newline_anchor, word_char and word_ops_used fields. (re_dfa_t): Change word_char type to bitset. Add word_ops_used field. (re_string_context_at, re_string_reconstruct): Remove last argument. * posix/regex_internal.c (re_string_allocate): Initialize pstr->word_char and pstr->word_ops_used. (re_string_context_at): Remove newline_anchor argument. Use input->newline_anchor instead, swap && conditions. Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0. Use input->word_char bitmap instead of IS_WORD_CHAR. (re_string_reconstruct): Likewise. Adjust re_string_context_at caller. * posix/regexec.c (acquire_init_state_context, check_halt_state_context, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, check_arrival, check_node_accept): Adjust re_string_context_at and re_string_reconstruct callers. (re_search_internal): Likewise. Set input.newline_anchor. (build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR. * posix/regcomp.c (init_word_char): Change return type to void. Set dfa->word_ops_used. (free_dfa_content): Don't free dfa->word_char. (parse_expression): Remove error handling for init_word_char.
2004-01-02 22:20:51 +01:00
bitset word_char;
reg_syntax_t syntax;
Update. 2003-11-19 Jakub Jelinek <jakub@redhat.com> * posix/regexec.c (extend_buffers): Don't allocate twice as big state_log as needed. Don't modify pstr->valid_len for mb_cur_max == 1 !icase !trans. * posix/regcomp.c (free_bin_tree): Removed. (create_tree): Add dfa argument. Don't call re_malloc for each tree, instead allocate from str_tree_storage. (re_dfa_add_tree_node): New function. (free_dfa_content): Handle freeing if dfa->nodes == NULL or dfa->state_table == NULL. (re_compile_internal): Call free_dfa_content if init_dfa fails. Call free_workarea_compile, re_string_destruct and free_dfa_content for most of the other failure paths. (init_dfa): Initialize str_tree_storage_idx. Don't clear any fields on allocation failure. (free_workarea_compile): Free str_tree_storage chunks instead of free_bin_tree (dfa->str_tree). (parse): Call re_dfa_add_tree_node instead of re_dfa_add_node followed by create_tree. Add dfa argument to remaining create_tree calls. Remove new_idx variable. Remove calls to free_bin_tree. (parse_reg_exp, parse_branch, parse_expression, parse_sub_exp, parse_dup_op, parse_bracket_exp, build_charclass_op): Likewise. (duplicate_tree): Remove calls to free_bin_tree, add dfa argument to create_tree. * posix/regex_internal.h (BIN_TREE_STORAGE_SIZE): Define. (bin_tree_storage_t): New type. (re_dfa_t): Add str_tree_storage and str_tree_storage_idx fields. * posix/Makefile (tests): Add bug-regex21. (generated): Add bug-regex21-mem, bug-regex21.mtrace, tst-rxspencer-mem and tst-rxspencer.mtrace. (tests): Depend on $(objpfx)bug-regex21-mem and $(objpfx)tst-rxspencer-mem. (bug-regex21-ENV, tst-rxspencer-ENV): Set. ($(objpfx)bug-regex21-mem, $(objpfx)tst-rxspencer-mem): New. * posix/tst-rxspencer.c (main): Add call to mtrace. Free line at the end. * posix/bug-regex21.c: New test. * posix/regexec.c (get_subexp): After calling get_subexp_sub
2003-11-19 20:37:31 +01:00
#ifdef DEBUG
char* re_str;
#endif
};
#ifndef RE_NO_INTERNAL_PROTOTYPES
Update. 2003-12-22 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c: Remove C99-ism. * posix/tst-rxspencer.c: Likewise. Based on a patch by Alex Davis <alex14641@yahoo.com>. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h [!_LIBC] (internal_function): Define. (re_string_allocate, re_string_construct, re_string_reconstruct, re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer, build_upper_buffer, re_string_translate_buffer, re_string_destruct, re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at, re_string_context_at, re_node_set_alloc, re_node_set_init_1 re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect, re_node_set_init_union, re_node_set_merge, re_node_set_insert re_node_set_compare, re_node_set_contains re_node_set_remove_at, re_dfa_add_node, re_acquire_state, re_acquire_state_context, free_state): Add internal_function to declaration. * posix/regexec.c (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_free_subtops, match_ctx_add_entry, search_cur_bkref_entry, match_ctx_clear_flag, match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init, re_search_internal, re_search_2_stub, re_search_stub, re_copy_regs, acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_node_context, check_halt_state_context update_regs, proceed_next_node, push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return, sift_states_iter_mb, sift_states_backward update_cur_sifted_state, add_epsilon_src_nodes, sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref, clean_state_log_if_need, merge_state_array, transit_state, check_subexp_matching_top, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node, check_arrival, check_arrival_add_next_nodes, find_collation_sequence_value, check_arrival_expand_ecl, check_arrival_expand_ecl_sub, expand_bkref_cache, build_trtable, check_node_accept_bytes, extend_buffers, group_nodes_into_DFAstates, check_node_accept): Likewise. * posix/regex_internal.c (re_string_construct_common, re_string_skip_chars, create_newstate_common, register_state, create_ci_newstate, create_cd_newstate, calc_state_hash): Likewise. (re_string_peek_byte_case, re_fetch_byte_case): Change declaration from ANSI to K&R. 2002-12-16 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (build_trtable): Don't allocate the trtable until state->word_trtable is known. Don't hardcode UINT_BITS iterations on each bitset item.
2003-12-23 03:29:44 +01:00
static reg_errcode_t re_node_set_alloc (re_node_set *set, int size) internal_function;
static reg_errcode_t re_node_set_init_1 (re_node_set *set, int elem) internal_function;
static reg_errcode_t re_node_set_init_2 (re_node_set *set, int elem1,
Update. 2003-12-22 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c: Remove C99-ism. * posix/tst-rxspencer.c: Likewise. Based on a patch by Alex Davis <alex14641@yahoo.com>. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h [!_LIBC] (internal_function): Define. (re_string_allocate, re_string_construct, re_string_reconstruct, re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer, build_upper_buffer, re_string_translate_buffer, re_string_destruct, re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at, re_string_context_at, re_node_set_alloc, re_node_set_init_1 re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect, re_node_set_init_union, re_node_set_merge, re_node_set_insert re_node_set_compare, re_node_set_contains re_node_set_remove_at, re_dfa_add_node, re_acquire_state, re_acquire_state_context, free_state): Add internal_function to declaration. * posix/regexec.c (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_free_subtops, match_ctx_add_entry, search_cur_bkref_entry, match_ctx_clear_flag, match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init, re_search_internal, re_search_2_stub, re_search_stub, re_copy_regs, acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_node_context, check_halt_state_context update_regs, proceed_next_node, push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return, sift_states_iter_mb, sift_states_backward update_cur_sifted_state, add_epsilon_src_nodes, sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref, clean_state_log_if_need, merge_state_array, transit_state, check_subexp_matching_top, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node, check_arrival, check_arrival_add_next_nodes, find_collation_sequence_value, check_arrival_expand_ecl, check_arrival_expand_ecl_sub, expand_bkref_cache, build_trtable, check_node_accept_bytes, extend_buffers, group_nodes_into_DFAstates, check_node_accept): Likewise. * posix/regex_internal.c (re_string_construct_common, re_string_skip_chars, create_newstate_common, register_state, create_ci_newstate, create_cd_newstate, calc_state_hash): Likewise. (re_string_peek_byte_case, re_fetch_byte_case): Change declaration from ANSI to K&R. 2002-12-16 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (build_trtable): Don't allocate the trtable until state->word_trtable is known. Don't hardcode UINT_BITS iterations on each bitset item.
2003-12-23 03:29:44 +01:00
int elem2) internal_function;
#define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))
static reg_errcode_t re_node_set_init_copy (re_node_set *dest,
Update. 2003-12-22 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c: Remove C99-ism. * posix/tst-rxspencer.c: Likewise. Based on a patch by Alex Davis <alex14641@yahoo.com>. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h [!_LIBC] (internal_function): Define. (re_string_allocate, re_string_construct, re_string_reconstruct, re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer, build_upper_buffer, re_string_translate_buffer, re_string_destruct, re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at, re_string_context_at, re_node_set_alloc, re_node_set_init_1 re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect, re_node_set_init_union, re_node_set_merge, re_node_set_insert re_node_set_compare, re_node_set_contains re_node_set_remove_at, re_dfa_add_node, re_acquire_state, re_acquire_state_context, free_state): Add internal_function to declaration. * posix/regexec.c (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_free_subtops, match_ctx_add_entry, search_cur_bkref_entry, match_ctx_clear_flag, match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init, re_search_internal, re_search_2_stub, re_search_stub, re_copy_regs, acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_node_context, check_halt_state_context update_regs, proceed_next_node, push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return, sift_states_iter_mb, sift_states_backward update_cur_sifted_state, add_epsilon_src_nodes, sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref, clean_state_log_if_need, merge_state_array, transit_state, check_subexp_matching_top, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node, check_arrival, check_arrival_add_next_nodes, find_collation_sequence_value, check_arrival_expand_ecl, check_arrival_expand_ecl_sub, expand_bkref_cache, build_trtable, check_node_accept_bytes, extend_buffers, group_nodes_into_DFAstates, check_node_accept): Likewise. * posix/regex_internal.c (re_string_construct_common, re_string_skip_chars, create_newstate_common, register_state, create_ci_newstate, create_cd_newstate, calc_state_hash): Likewise. (re_string_peek_byte_case, re_fetch_byte_case): Change declaration from ANSI to K&R. 2002-12-16 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (build_trtable): Don't allocate the trtable until state->word_trtable is known. Don't hardcode UINT_BITS iterations on each bitset item.
2003-12-23 03:29:44 +01:00
const re_node_set *src) internal_function;
static reg_errcode_t re_node_set_add_intersect (re_node_set *dest,
const re_node_set *src1,
Update. 2003-12-22 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c: Remove C99-ism. * posix/tst-rxspencer.c: Likewise. Based on a patch by Alex Davis <alex14641@yahoo.com>. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h [!_LIBC] (internal_function): Define. (re_string_allocate, re_string_construct, re_string_reconstruct, re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer, build_upper_buffer, re_string_translate_buffer, re_string_destruct, re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at, re_string_context_at, re_node_set_alloc, re_node_set_init_1 re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect, re_node_set_init_union, re_node_set_merge, re_node_set_insert re_node_set_compare, re_node_set_contains re_node_set_remove_at, re_dfa_add_node, re_acquire_state, re_acquire_state_context, free_state): Add internal_function to declaration. * posix/regexec.c (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_free_subtops, match_ctx_add_entry, search_cur_bkref_entry, match_ctx_clear_flag, match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init, re_search_internal, re_search_2_stub, re_search_stub, re_copy_regs, acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_node_context, check_halt_state_context update_regs, proceed_next_node, push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return, sift_states_iter_mb, sift_states_backward update_cur_sifted_state, add_epsilon_src_nodes, sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref, clean_state_log_if_need, merge_state_array, transit_state, check_subexp_matching_top, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node, check_arrival, check_arrival_add_next_nodes, find_collation_sequence_value, check_arrival_expand_ecl, check_arrival_expand_ecl_sub, expand_bkref_cache, build_trtable, check_node_accept_bytes, extend_buffers, group_nodes_into_DFAstates, check_node_accept): Likewise. * posix/regex_internal.c (re_string_construct_common, re_string_skip_chars, create_newstate_common, register_state, create_ci_newstate, create_cd_newstate, calc_state_hash): Likewise. (re_string_peek_byte_case, re_fetch_byte_case): Change declaration from ANSI to K&R. 2002-12-16 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (build_trtable): Don't allocate the trtable until state->word_trtable is known. Don't hardcode UINT_BITS iterations on each bitset item.
2003-12-23 03:29:44 +01:00
const re_node_set *src2) internal_function;
static reg_errcode_t re_node_set_init_union (re_node_set *dest,
const re_node_set *src1,
Update. 2003-12-22 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c: Remove C99-ism. * posix/tst-rxspencer.c: Likewise. Based on a patch by Alex Davis <alex14641@yahoo.com>. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h [!_LIBC] (internal_function): Define. (re_string_allocate, re_string_construct, re_string_reconstruct, re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer, build_upper_buffer, re_string_translate_buffer, re_string_destruct, re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at, re_string_context_at, re_node_set_alloc, re_node_set_init_1 re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect, re_node_set_init_union, re_node_set_merge, re_node_set_insert re_node_set_compare, re_node_set_contains re_node_set_remove_at, re_dfa_add_node, re_acquire_state, re_acquire_state_context, free_state): Add internal_function to declaration. * posix/regexec.c (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_free_subtops, match_ctx_add_entry, search_cur_bkref_entry, match_ctx_clear_flag, match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init, re_search_internal, re_search_2_stub, re_search_stub, re_copy_regs, acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_node_context, check_halt_state_context update_regs, proceed_next_node, push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return, sift_states_iter_mb, sift_states_backward update_cur_sifted_state, add_epsilon_src_nodes, sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref, clean_state_log_if_need, merge_state_array, transit_state, check_subexp_matching_top, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node, check_arrival, check_arrival_add_next_nodes, find_collation_sequence_value, check_arrival_expand_ecl, check_arrival_expand_ecl_sub, expand_bkref_cache, build_trtable, check_node_accept_bytes, extend_buffers, group_nodes_into_DFAstates, check_node_accept): Likewise. * posix/regex_internal.c (re_string_construct_common, re_string_skip_chars, create_newstate_common, register_state, create_ci_newstate, create_cd_newstate, calc_state_hash): Likewise. (re_string_peek_byte_case, re_fetch_byte_case): Change declaration from ANSI to K&R. 2002-12-16 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (build_trtable): Don't allocate the trtable until state->word_trtable is known. Don't hardcode UINT_BITS iterations on each bitset item.
2003-12-23 03:29:44 +01:00
const re_node_set *src2) internal_function;
static reg_errcode_t re_node_set_merge (re_node_set *dest,
Update. 2003-12-22 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c: Remove C99-ism. * posix/tst-rxspencer.c: Likewise. Based on a patch by Alex Davis <alex14641@yahoo.com>. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h [!_LIBC] (internal_function): Define. (re_string_allocate, re_string_construct, re_string_reconstruct, re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer, build_upper_buffer, re_string_translate_buffer, re_string_destruct, re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at, re_string_context_at, re_node_set_alloc, re_node_set_init_1 re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect, re_node_set_init_union, re_node_set_merge, re_node_set_insert re_node_set_compare, re_node_set_contains re_node_set_remove_at, re_dfa_add_node, re_acquire_state, re_acquire_state_context, free_state): Add internal_function to declaration. * posix/regexec.c (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_free_subtops, match_ctx_add_entry, search_cur_bkref_entry, match_ctx_clear_flag, match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init, re_search_internal, re_search_2_stub, re_search_stub, re_copy_regs, acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_node_context, check_halt_state_context update_regs, proceed_next_node, push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return, sift_states_iter_mb, sift_states_backward update_cur_sifted_state, add_epsilon_src_nodes, sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref, clean_state_log_if_need, merge_state_array, transit_state, check_subexp_matching_top, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node, check_arrival, check_arrival_add_next_nodes, find_collation_sequence_value, check_arrival_expand_ecl, check_arrival_expand_ecl_sub, expand_bkref_cache, build_trtable, check_node_accept_bytes, extend_buffers, group_nodes_into_DFAstates, check_node_accept): Likewise. * posix/regex_internal.c (re_string_construct_common, re_string_skip_chars, create_newstate_common, register_state, create_ci_newstate, create_cd_newstate, calc_state_hash): Likewise. (re_string_peek_byte_case, re_fetch_byte_case): Change declaration from ANSI to K&R. 2002-12-16 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (build_trtable): Don't allocate the trtable until state->word_trtable is known. Don't hardcode UINT_BITS iterations on each bitset item.
2003-12-23 03:29:44 +01:00
const re_node_set *src) internal_function;
static int re_node_set_insert (re_node_set *set, int elem) internal_function;
static int re_node_set_compare (const re_node_set *set1,
Update. 2003-12-22 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c: Remove C99-ism. * posix/tst-rxspencer.c: Likewise. Based on a patch by Alex Davis <alex14641@yahoo.com>. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h [!_LIBC] (internal_function): Define. (re_string_allocate, re_string_construct, re_string_reconstruct, re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer, build_upper_buffer, re_string_translate_buffer, re_string_destruct, re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at, re_string_context_at, re_node_set_alloc, re_node_set_init_1 re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect, re_node_set_init_union, re_node_set_merge, re_node_set_insert re_node_set_compare, re_node_set_contains re_node_set_remove_at, re_dfa_add_node, re_acquire_state, re_acquire_state_context, free_state): Add internal_function to declaration. * posix/regexec.c (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_free_subtops, match_ctx_add_entry, search_cur_bkref_entry, match_ctx_clear_flag, match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init, re_search_internal, re_search_2_stub, re_search_stub, re_copy_regs, acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_node_context, check_halt_state_context update_regs, proceed_next_node, push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return, sift_states_iter_mb, sift_states_backward update_cur_sifted_state, add_epsilon_src_nodes, sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref, clean_state_log_if_need, merge_state_array, transit_state, check_subexp_matching_top, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node, check_arrival, check_arrival_add_next_nodes, find_collation_sequence_value, check_arrival_expand_ecl, check_arrival_expand_ecl_sub, expand_bkref_cache, build_trtable, check_node_accept_bytes, extend_buffers, group_nodes_into_DFAstates, check_node_accept): Likewise. * posix/regex_internal.c (re_string_construct_common, re_string_skip_chars, create_newstate_common, register_state, create_ci_newstate, create_cd_newstate, calc_state_hash): Likewise. (re_string_peek_byte_case, re_fetch_byte_case): Change declaration from ANSI to K&R. 2002-12-16 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (build_trtable): Don't allocate the trtable until state->word_trtable is known. Don't hardcode UINT_BITS iterations on each bitset item.
2003-12-23 03:29:44 +01:00
const re_node_set *set2) internal_function;
static int re_node_set_contains (const re_node_set *set, int elem) internal_function;
static void re_node_set_remove_at (re_node_set *set, int idx) internal_function;
Update. 2002-10-11 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_fastmap_iter): Remove the handling OP_CONTEXT_NODE. (regfree): Likewise. (create_initial_state): Likewise. (analyze): Remove the substitutions which became useless. (calc_first): Likewise. (calc_epsdest): Use edests of OP_BACK_REF in case that it has epsilon destination. (duplicate_node_closure): New function. (duplicate_node): Remove the handling OP_CONTEXT_NODE. (calc_inveclosure): Likewise. (calc_eclosure): Likewise. (calc_eclosure_iter): Invoke duplicate_node_closure instead of direct invocation of duplicate_node. (parse): Don't use comma operator in the return to avoid compiler warning. (parse_reg_exp): Likewise. (parse_branch): Likewise. (parse_expression): Likewise. (parse_sub_exp): Likewise. (parse_dup_op): Likewise. * posix/regex_internal.c (re_dfa_add_node): Remove the substitutions which became useless. (create_ci_newstate): Remove the handling OP_CONTEXT_NODE. (create_cd_newstate): Likewise. * posix/regex_internal.h (re_token_type_t): Remove the obsolete type. (re_token_t): Likewise. (re_dfa_t): Likewise. (re_node_set_remove): New macro. * posix/regexec.c (check_matching): Remove the handling OP_CONTEXT_NODE. (check_halt_node_context): Likewise. (proceed_next_node): Likewise. (pop_fail_stack): Fix the memory leak. (set_regs): Likewise. (free_fail_stack_return): New function. (sift_states_backward): Fix the memory leak. Remove the handling OP_CONTEXT_NODE. (update_cur_sifted_state): Append some if clause to avoid redundant call. (sub_epsilon_src_nodes): Use IS_EPSILON_NODE since it might be a back reference. (check_dst_limits): Remove the handling OP_CONTEXT_NODE. (check_subexp_limits): Likewise. (search_subexp): Likewise. (sift_states_bkref): Likewise. (transit_state_mb): Likewise. (transit_state_bkref_loop): Likewise. (transit_state_bkref_loop): Likewise. (group_nodes_into_DFAstates): Likewise. (check_node_accept): Likewise. (sift_ctx_init): Add initializing. 2002-10-12 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/i386/sysdep.h (INLINE_SYSCALL): Use __builtin_expect.
2002-10-12 10:34:26 +02:00
#define re_node_set_remove(set,id) \
(re_node_set_remove_at (set, re_node_set_contains (set, id) - 1))
#define re_node_set_empty(p) ((p)->nelem = 0)
#define re_node_set_free(set) re_free ((set)->elems)
Update. 2003-12-22 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c: Remove C99-ism. * posix/tst-rxspencer.c: Likewise. Based on a patch by Alex Davis <alex14641@yahoo.com>. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h [!_LIBC] (internal_function): Define. (re_string_allocate, re_string_construct, re_string_reconstruct, re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer, build_upper_buffer, re_string_translate_buffer, re_string_destruct, re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at, re_string_context_at, re_node_set_alloc, re_node_set_init_1 re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect, re_node_set_init_union, re_node_set_merge, re_node_set_insert re_node_set_compare, re_node_set_contains re_node_set_remove_at, re_dfa_add_node, re_acquire_state, re_acquire_state_context, free_state): Add internal_function to declaration. * posix/regexec.c (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_free_subtops, match_ctx_add_entry, search_cur_bkref_entry, match_ctx_clear_flag, match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init, re_search_internal, re_search_2_stub, re_search_stub, re_copy_regs, acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_node_context, check_halt_state_context update_regs, proceed_next_node, push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return, sift_states_iter_mb, sift_states_backward update_cur_sifted_state, add_epsilon_src_nodes, sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref, clean_state_log_if_need, merge_state_array, transit_state, check_subexp_matching_top, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node, check_arrival, check_arrival_add_next_nodes, find_collation_sequence_value, check_arrival_expand_ecl, check_arrival_expand_ecl_sub, expand_bkref_cache, build_trtable, check_node_accept_bytes, extend_buffers, group_nodes_into_DFAstates, check_node_accept): Likewise. * posix/regex_internal.c (re_string_construct_common, re_string_skip_chars, create_newstate_common, register_state, create_ci_newstate, create_cd_newstate, calc_state_hash): Likewise. (re_string_peek_byte_case, re_fetch_byte_case): Change declaration from ANSI to K&R. 2002-12-16 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (build_trtable): Don't allocate the trtable until state->word_trtable is known. Don't hardcode UINT_BITS iterations on each bitset item.
2003-12-23 03:29:44 +01:00
static int re_dfa_add_node (re_dfa_t *dfa, re_token_t token, int mode) internal_function;
Update. 2002-02-28 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (regcomp): Remove a redundant condition. (init_word_char): Add a check on malloc failure. (create_initial_state): Likewise. (duplicate_node): Likewise. (calc_eclosure): Likewise. (calc_eclosure_iter): Likewise. (parse_expression): Likewise. (parse_bracket_exp): Remove unnecessary malloc invocations. (build_equiv_class): Likewise. (build_charclass): Likewise. * posix/regex_internal.c (re_node_set_intersect): Add a check on malloc failure. (re_node_set_add_intersect): Likewise. (re_node_set_merge): Likewise. (re_acquire_state): Likewise. (re_acquire_state_context): Likewise. (create_newstate_common): Likewise. (register_state): Likewise. (create_ci_newstate): Likewise. (create_cd_newstate): Likewise. * posix/regex_internal.h: Fix prototypes of re_acquire_state and re_acquire_state_context. * posix/regexec.c (regexec): Suit it to the error handling of re_search_internal. (re_match): Likewise. (re_search): Likewise. (re_search_internal): Add a check on malloc failure. (acquire_init_state_context): Likewise. (check_matching): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref_loop): Likewise. (build_trtable): Likewise. (group_nodes_into_DFAstates): Likewise. (match_ctx_init): Likewise. (match_ctx_add_entry): Likewise.
2002-02-28 08:43:13 +01:00
static re_dfastate_t *re_acquire_state (reg_errcode_t *err, re_dfa_t *dfa,
Update. 2003-12-22 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c: Remove C99-ism. * posix/tst-rxspencer.c: Likewise. Based on a patch by Alex Davis <alex14641@yahoo.com>. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h [!_LIBC] (internal_function): Define. (re_string_allocate, re_string_construct, re_string_reconstruct, re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer, build_upper_buffer, re_string_translate_buffer, re_string_destruct, re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at, re_string_context_at, re_node_set_alloc, re_node_set_init_1 re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect, re_node_set_init_union, re_node_set_merge, re_node_set_insert re_node_set_compare, re_node_set_contains re_node_set_remove_at, re_dfa_add_node, re_acquire_state, re_acquire_state_context, free_state): Add internal_function to declaration. * posix/regexec.c (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_free_subtops, match_ctx_add_entry, search_cur_bkref_entry, match_ctx_clear_flag, match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init, re_search_internal, re_search_2_stub, re_search_stub, re_copy_regs, acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_node_context, check_halt_state_context update_regs, proceed_next_node, push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return, sift_states_iter_mb, sift_states_backward update_cur_sifted_state, add_epsilon_src_nodes, sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref, clean_state_log_if_need, merge_state_array, transit_state, check_subexp_matching_top, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node, check_arrival, check_arrival_add_next_nodes, find_collation_sequence_value, check_arrival_expand_ecl, check_arrival_expand_ecl_sub, expand_bkref_cache, build_trtable, check_node_accept_bytes, extend_buffers, group_nodes_into_DFAstates, check_node_accept): Likewise. * posix/regex_internal.c (re_string_construct_common, re_string_skip_chars, create_newstate_common, register_state, create_ci_newstate, create_cd_newstate, calc_state_hash): Likewise. (re_string_peek_byte_case, re_fetch_byte_case): Change declaration from ANSI to K&R. 2002-12-16 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (build_trtable): Don't allocate the trtable until state->word_trtable is known. Don't hardcode UINT_BITS iterations on each bitset item.
2003-12-23 03:29:44 +01:00
const re_node_set *nodes) internal_function;
Update. 2002-02-28 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (regcomp): Remove a redundant condition. (init_word_char): Add a check on malloc failure. (create_initial_state): Likewise. (duplicate_node): Likewise. (calc_eclosure): Likewise. (calc_eclosure_iter): Likewise. (parse_expression): Likewise. (parse_bracket_exp): Remove unnecessary malloc invocations. (build_equiv_class): Likewise. (build_charclass): Likewise. * posix/regex_internal.c (re_node_set_intersect): Add a check on malloc failure. (re_node_set_add_intersect): Likewise. (re_node_set_merge): Likewise. (re_acquire_state): Likewise. (re_acquire_state_context): Likewise. (create_newstate_common): Likewise. (register_state): Likewise. (create_ci_newstate): Likewise. (create_cd_newstate): Likewise. * posix/regex_internal.h: Fix prototypes of re_acquire_state and re_acquire_state_context. * posix/regexec.c (regexec): Suit it to the error handling of re_search_internal. (re_match): Likewise. (re_search): Likewise. (re_search_internal): Add a check on malloc failure. (acquire_init_state_context): Likewise. (check_matching): Likewise. (proceed_next_node): Likewise. (set_regs): Likewise. (sift_states_backward): Likewise. (sift_states_iter_bkref): Likewise. (add_epsilon_backreference): Likewise. (transit_state): Likewise. (transit_state_sb): Likewise. (transit_state_mb): Likewise. (transit_state_bkref_loop): Likewise. (build_trtable): Likewise. (group_nodes_into_DFAstates): Likewise. (match_ctx_init): Likewise. (match_ctx_add_entry): Likewise.
2002-02-28 08:43:13 +01:00
static re_dfastate_t *re_acquire_state_context (reg_errcode_t *err,
re_dfa_t *dfa,
const re_node_set *nodes,
Update. 2003-12-22 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c: Remove C99-ism. * posix/tst-rxspencer.c: Likewise. Based on a patch by Alex Davis <alex14641@yahoo.com>. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h [!_LIBC] (internal_function): Define. (re_string_allocate, re_string_construct, re_string_reconstruct, re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer, build_upper_buffer, re_string_translate_buffer, re_string_destruct, re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at, re_string_context_at, re_node_set_alloc, re_node_set_init_1 re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect, re_node_set_init_union, re_node_set_merge, re_node_set_insert re_node_set_compare, re_node_set_contains re_node_set_remove_at, re_dfa_add_node, re_acquire_state, re_acquire_state_context, free_state): Add internal_function to declaration. * posix/regexec.c (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_free_subtops, match_ctx_add_entry, search_cur_bkref_entry, match_ctx_clear_flag, match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init, re_search_internal, re_search_2_stub, re_search_stub, re_copy_regs, acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_node_context, check_halt_state_context update_regs, proceed_next_node, push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return, sift_states_iter_mb, sift_states_backward update_cur_sifted_state, add_epsilon_src_nodes, sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref, clean_state_log_if_need, merge_state_array, transit_state, check_subexp_matching_top, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node, check_arrival, check_arrival_add_next_nodes, find_collation_sequence_value, check_arrival_expand_ecl, check_arrival_expand_ecl_sub, expand_bkref_cache, build_trtable, check_node_accept_bytes, extend_buffers, group_nodes_into_DFAstates, check_node_accept): Likewise. * posix/regex_internal.c (re_string_construct_common, re_string_skip_chars, create_newstate_common, register_state, create_ci_newstate, create_cd_newstate, calc_state_hash): Likewise. (re_string_peek_byte_case, re_fetch_byte_case): Change declaration from ANSI to K&R. 2002-12-16 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (build_trtable): Don't allocate the trtable until state->word_trtable is known. Don't hardcode UINT_BITS iterations on each bitset item.
2003-12-23 03:29:44 +01:00
unsigned int context) internal_function;
static void free_state (re_dfastate_t *state) internal_function;
#endif
typedef enum
{
SB_CHAR,
MB_CHAR,
EQUIV_CLASS,
COLL_SYM,
CHAR_CLASS
} bracket_elem_type;
typedef struct
{
bracket_elem_type type;
union
{
unsigned char ch;
2002-09-10 20:40:35 +02:00
unsigned char *name;
wchar_t wch;
} opr;
} bracket_elem_t;
/* Inline functions for bitset operation. */
static inline void
bitset_not (bitset set)
{
int bitset_i;
for (bitset_i = 0; bitset_i < BITSET_UINTS; ++bitset_i)
set[bitset_i] = ~set[bitset_i];
}
static inline void
bitset_merge (bitset dest, const bitset src)
{
int bitset_i;
for (bitset_i = 0; bitset_i < BITSET_UINTS; ++bitset_i)
dest[bitset_i] |= src[bitset_i];
}
static inline void
bitset_not_merge (bitset dest, const bitset src)
{
int i;
for (i = 0; i < BITSET_UINTS; ++i)
dest[i] |= ~src[i];
}
static inline void
bitset_mask (bitset dest, const bitset src)
{
int bitset_i;
for (bitset_i = 0; bitset_i < BITSET_UINTS; ++bitset_i)
dest[bitset_i] &= src[bitset_i];
}
#if defined RE_ENABLE_I18N && !defined RE_NO_INTERNAL_PROTOTYPES
/* Inline functions for re_string. */
static inline int
internal_function
re_string_char_size_at (const re_string_t *pstr, int idx)
{
int byte_idx;
Update. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/tst-regex.c (umemlen): New variable. (test_expr): Add expectedicase argument. Test case insensitive searches as well as backwards searches (case sensitive and insensitive) too. (run_test): Add icase argument. Use it to compute regcomp flags. (run_test_backwards): New function. (main): Cast read to size_t to avoid warning. Set umemlen. Add expectedicase arguments to test_expr. * posix/regex_internal.c (re_string_reconstruct): If is_utf8, find previous character by walking back instead of converting all chars from beginning. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (struct re_string_t): Add is_utf8 and mb_cur_max fields. (struct re_dfa_t): Likewise. Reorder fields to make structure smaller on 64-bit arches. (re_string_allocate, re_string_construct): Add mb_cur_max and is_utf8 arguments. (re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max instead of MB_CUR_MAX. * posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max instead of MB_CUR_MAX. (re_compile_internal): Pass new arguments to re_string_construct. (init_dfa): Initialize mb_cur_max and is_utf8 fields. (peek_token, peek_token_bracket): Use input->mb_cur_max instead of MB_CUR_MAX. (parse_expression, parse_bracket_exp, parse_charclass_op): Use dfa->mb_cur_max instead of MB_CUR_MAX. * posix/regex_internal.c (re_string_construct_common): Add mb_cur_max and is_utf8 arguments. Initialize fields with them. (re_string_allocate, re_string_construct): Add mb_cur_max and is_utf8 arguments, pass them to re_string_construct_common. Use mb_cur_max instead of MB_CUR_MAX. (re_string_realloc_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX. (re_string_reconstruct): Likewise. (re_string_context_at): Use input->mb_cur_max instead of MB_CUR_MAX. (create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max instead of MB_CUR_MAX. * posix/regexec.c (re_search_internal): Likewise. Pass new arguments to re_string_allocate. (check_matching, transit_state_sb): Use dfa->mb_cur_max instead of MB_CUR_MAX. (extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/Makefile (tests): Add bug-regex19. (bug-regex19-ENV): Add LOCPATH. * posix/bug-regex19.c: New test.
2003-11-12 18:47:46 +01:00
if (pstr->mb_cur_max == 1)
return 1;
for (byte_idx = 1; idx + byte_idx < pstr->valid_len; ++byte_idx)
if (pstr->wcs[idx + byte_idx] != WEOF)
break;
return byte_idx;
}
static inline wint_t
internal_function
re_string_wchar_at (const re_string_t *pstr, int idx)
{
Update. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/tst-regex.c (umemlen): New variable. (test_expr): Add expectedicase argument. Test case insensitive searches as well as backwards searches (case sensitive and insensitive) too. (run_test): Add icase argument. Use it to compute regcomp flags. (run_test_backwards): New function. (main): Cast read to size_t to avoid warning. Set umemlen. Add expectedicase arguments to test_expr. * posix/regex_internal.c (re_string_reconstruct): If is_utf8, find previous character by walking back instead of converting all chars from beginning. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (struct re_string_t): Add is_utf8 and mb_cur_max fields. (struct re_dfa_t): Likewise. Reorder fields to make structure smaller on 64-bit arches. (re_string_allocate, re_string_construct): Add mb_cur_max and is_utf8 arguments. (re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max instead of MB_CUR_MAX. * posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max instead of MB_CUR_MAX. (re_compile_internal): Pass new arguments to re_string_construct. (init_dfa): Initialize mb_cur_max and is_utf8 fields. (peek_token, peek_token_bracket): Use input->mb_cur_max instead of MB_CUR_MAX. (parse_expression, parse_bracket_exp, parse_charclass_op): Use dfa->mb_cur_max instead of MB_CUR_MAX. * posix/regex_internal.c (re_string_construct_common): Add mb_cur_max and is_utf8 arguments. Initialize fields with them. (re_string_allocate, re_string_construct): Add mb_cur_max and is_utf8 arguments, pass them to re_string_construct_common. Use mb_cur_max instead of MB_CUR_MAX. (re_string_realloc_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX. (re_string_reconstruct): Likewise. (re_string_context_at): Use input->mb_cur_max instead of MB_CUR_MAX. (create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max instead of MB_CUR_MAX. * posix/regexec.c (re_search_internal): Likewise. Pass new arguments to re_string_allocate. (check_matching, transit_state_sb): Use dfa->mb_cur_max instead of MB_CUR_MAX. (extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX. 2003-11-12 Jakub Jelinek <jakub@redhat.com> * posix/Makefile (tests): Add bug-regex19. (bug-regex19-ENV): Add LOCPATH. * posix/bug-regex19.c: New test.
2003-11-12 18:47:46 +01:00
if (pstr->mb_cur_max == 1)
return (wint_t) pstr->mbs[idx];
return (wint_t) pstr->wcs[idx];
}
static int
internal_function
re_string_elem_size_at (const re_string_t *pstr, int idx)
{
#ifdef _LIBC
2002-09-10 20:40:35 +02:00
const unsigned char *p, *extra;
const int32_t *table, *indirect;
int32_t tmp;
# include <locale/weight.h>
uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
if (nrules != 0)
{
table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
2002-09-10 20:40:35 +02:00
extra = (const unsigned char *)
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
_NL_COLLATE_INDIRECTMB);
p = pstr->mbs + idx;
2002-09-10 20:40:35 +02:00
tmp = findidx (&p);
Update. 2002-07-29 Steven Munroe <sjmunroe@us.ibm.com> * sysdeps/powerpc/__longjmp.S: Moved to... * sysdeps/powerpc/powerpc32/__longjmp.S: ...here. * sysdeps/powerpc/add_n.S: Moved to... * sysdeps/powerpc/powerpc32/add_n.S: ...here. * sysdeps/powerpc/addmul_1.S: Moved to... * sysdeps/powerpc/powerpc32/addmul_1.S: ...here. * sysdeps/powerpc/atomicity.h: Moved to... * sysdeps/powerpc/powerpc32/atomicity.h: ...here. * sysdeps/powerpc/backtrace.c: Moved to... * sysdeps/powerpc/powerpc32/backtrace.c: ...here. * sysdeps/powerpc/bp-asm.h: Moved to... * sysdeps/powerpc/powerpc32/bp-asm.h: ...here. * sysdeps/powerpc/bsd-_setjmp.S: Moved to... * sysdeps/powerpc/powerpc32/bsd-_setjmp.S: ...here. * sysdeps/powerpc/bsd-setjmp.S: Moved to... * sysdeps/powerpc/powerpc32/bsd-setjmp.S: ...here. * sysdeps/powerpc/dl-machine.c: Moved to... * sysdeps/powerpc/powerpc32/dl-machine.c: ...here. * sysdeps/powerpc/dl-machine.h: Moved to... * sysdeps/powerpc/powerpc32/dl-machine.h: ...here. * sysdeps/powerpc/dl-start.S: Moved to... * sysdeps/powerpc/powerpc32/dl-start.S: ...here. * sysdeps/powerpc/gprrest0.S: Moved to... * sysdeps/powerpc/powerpc32/gprrest0.S: ...here. * sysdeps/powerpc/gprrest1.S: Moved to... * sysdeps/powerpc/powerpc32/gprrest1.S: ...here. * sysdeps/powerpc/gprsave0.S: Moved to... * sysdeps/powerpc/powerpc32/gprsave0.S: ...here. * sysdeps/powerpc/gprsave1.S: Moved to... * sysdeps/powerpc/powerpc32/gprsave1.S: ...here. * sysdeps/powerpc/lshift.S: Moved to... * sysdeps/powerpc/powerpc32/lshift.S: ...here. * sysdeps/powerpc/memset.S: Moved to... * sysdeps/powerpc/powerpc32/memset.S: ...here. * sysdeps/powerpc/mul_1.S: Moved to... * sysdeps/powerpc/powerpc32/mul_1.S: ...here. * sysdeps/powerpc/ppc-mcount.S: Moved to... * sysdeps/powerpc/powerpc32/ppc-mcount.S: ...here. * sysdeps/powerpc/register-dump.h: Moved to... * sysdeps/powerpc/powerpc32/register-dump.h: ...here. * sysdeps/powerpc/rshift.S: Moved to... * sysdeps/powerpc/powerpc32/rshift.S: ...here. * sysdeps/powerpc/setjmp.S: Moved to... * sysdeps/powerpc/powerpc32/setjmp.S: ...here. * sysdeps/powerpc/stpcpy.S: Moved to... * sysdeps/powerpc/powerpc32/stpcpy.S: ...here. * sysdeps/powerpc/strchr.S: Moved to... * sysdeps/powerpc/powerpc32/strchr.S: ...here. * sysdeps/powerpc/strcmp.S: Moved to... * sysdeps/powerpc/powerpc32/strcmp.S: ...here. * sysdeps/powerpc/strcpy.S: Moved to... * sysdeps/powerpc/powerpc32/strcpy.S: ...here. * sysdeps/powerpc/strlen.S: Moved to... * sysdeps/powerpc/powerpc32/strlen.S: ...here. * sysdeps/powerpc/sub_n.S: Moved to... * sysdeps/powerpc/powerpc32/sub_n.S: ...here. * sysdeps/powerpc/submul_1.S: Moved to... * sysdeps/powerpc/powerpc32/submul_1.S: ...here. * sysdeps/powerpc/elf/bzero.S: Moved to... * sysdeps/powerpc/powerpc32/elf/bzero.S: ...here. * sysdeps/powerpc/elf/start.S: Moved to... * sysdeps/powerpc/powerpc32/elf/start.S: ...here. * sysdeps/powerpc/fpu/__longjmp.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/__longjmp.S: ...here. * sysdeps/powerpc/fpu/fprrest.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/fprrest.S: ...here. * sysdeps/powerpc/fpu/fprsave.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/fprsave.S: ...here. * sysdeps/powerpc/fpu/setjmp.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/setjmp.S: ...here. * sysdeps/powerpc/fpu/s_copysign.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/s_copysign.S: ...here. * sysdeps/powerpc/fpu/s_copysignf.S: Moved to... * sysdeps/powerpc/powerpc32/fpu/s_copysignf.S: ...here. * sysdeps/unix/sysv/linux/powerpc/brk.S: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S: ...here. * sysdeps/unix/sysv/linux/powerpc/clone.S: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: ...here. * sysdeps/unix/sysv/linux/powerpc/glob64.c: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/glob64.c: ...here. * sysdeps/unix/sysv/linux/powerpc/kernel_stat.h: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/kernel_stat.h: ...here. * sysdeps/unix/sysv/linux/powerpc/socket.S: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S: ...here. * sysdeps/unix/sysv/linux/powerpc/sysdep.h: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: ...here. * sysdeps/unix/sysv/linux/powerpc/syscalls.list: Moved to... * sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: ...here. Support PowerPC64. Separate powerpc into powerpc/powerpc32 and powerpc/powerpc64. 2002-07-29 Steven Munroe <sjmunroe@us.ibm.com> * FAQ.in: Add powerpc64 to supported targets list. Also state the minimum gcc version is 3.2 * README: Add powerpc64 to supported targets list. * configure.in: Change machine=powerpc to machine=powerpc/powerpc32. Add powerpc64 and machine=powerpc/powerpc64. (HAVE_ASM_GLOBAL_DOT_NAME): Define if linux*powerpc/powerpc64*. * shlib-versions: Set DEFAULT version to 2.2.5 for powerpc64. * sysdeps/powerpc/Dist: Remove dl-machine.c, dl-start.S, ppc-mcount.S, gprsave1.S, gprsave0.S, gprrest1.S, and gprrest0.S. * sysdeps/powerpc/powerpc32/Dist: New file. * sysdeps/powerpc/Implies: Remove wordsize-32 and powerpc/soft-fp. * sysdeps/powerpc/powerpc32/Implies: New file. * sysdeps/powerpc/Makefile(cflags): Remove powerpc32 specific cflags. ($(with-fp) = no): Move test to powerpc32/Makefile. ($(subdir) = misc): Move to powerpc32/Makefile. ($(build-shared) = yes): Move to powerpc32/Makefile. ($(subdir) = csu): Move to powerpc32/Makefile. (sysdep-rtld-routines): Remove dl-start. Moved these bits to ... * sysdeps/powerpc/powerpc32/Makefile: New file. * sysdeps/powerpc/Versions: Remove libgcc functions. * sysdeps/powerpc/powerpc32/Versions: New file. * sysdeps/powerpc/fpu/Makefile: Remove fprsave and fprrest. * sysdeps/powerpc/powerpc32/fpu/Makefile: New file. * sysdeps/unix/sysv/linux/configure.in (powerpc*): Set arch_minimum_kernel=2.4.19 for powerpc/powerpc64. Also set libc_cv_gcc_unwind_find_fde=yes only if !powerpc/powerpc64. ($machine): Add powerpc/powerpc64 to if ... | for libc_cv_slibdir=/libc64. (powerpc*): Set ldd_rewrite_script. * sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed: New file. * sysdeps/unix/sysv/linux/powerpc/Dist: Remove clone.S. * sysdeps/unix/sysv/linux/powerpc/powerpc32/Dist: New file. Add clone.S. * sysdeps/unix/sysv/linux/powerpc/Makefile: Remove oldgetrlimit64. * sysdeps/unix/sysv/linux/powerpc/Versions: Remove GLIBC_2.0 functions. Remove GLIBC_2.2 functions except getrlimit and setrlimit. Moved them to ... * sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions: New file. 2002-09-04 Ulrich Drepper <drepper@redhat.com> * libio/tst-atime.c: Include <errno.h>. (do_test): Only perform fstatvfs check if ST_NOATIME is defined. 2002-09-03 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (regcomp): Append "__restrict" modifier to avoid warnings of some compilers. (build_collating_symbol): Change the type of characters from "unsigned char" to "char", and append a cast to "char*" pointer in array subscript. (build_collating_symbol): Likewise. (build_equiv_class): Likewise. (build_charclass): Likewise. (re_compile_pattern): Remove incorrect cast. (re_compile_fastmap_iter): Change the type of characters from "unsigned char" to "char", and append a cast to "char*" pointer in array subscript. (parse_bracket_exp): Likewise. * posix/regex_internal.c (re_string_construct_common): Likewise. (re_string_allocate): Likewise. (re_string_construct): Likewise. (re_string_realloc_buffers): Likewise. (build_wcs_buffer): Likewise. (re_string_reconstruct): Likewise. * posix/regex_internal.h: Change the type of characters in re_string_t and bracket_elem_t from "unsigned char" to "char". * posix/regexec.c (regexec): Append "__restrict" modifier to avoid warnings of some compilers. (transit_state_bkref_loop): Change the type of characters from "unsigned char" to "char", and append a cast to "char*" pointer in array subscript. (check_node_accept_bytes): Likewise. (find_collation_sequence_value): Likewise.
2002-09-05 12:28:51 +02:00
return p - pstr->mbs - idx;
}
else
#endif /* _LIBC */
return 1;
}
#endif /* RE_ENABLE_I18N */
#endif /* _REGEX_INTERNAL_H */