merge from gcc
This commit is contained in:
parent
8391b9b130
commit
e064c173c6
5 changed files with 223 additions and 334 deletions
|
@ -434,32 +434,21 @@ typedef struct
|
||||||
unfortunately clutters up the declarations a bit, but I think it's
|
unfortunately clutters up the declarations a bit, but I think it's
|
||||||
worth it. */
|
worth it. */
|
||||||
|
|
||||||
#if __STDC__
|
|
||||||
|
|
||||||
# define _RE_ARGS(args) args
|
|
||||||
|
|
||||||
#else /* not __STDC__ */
|
|
||||||
|
|
||||||
# define _RE_ARGS(args) ()
|
|
||||||
|
|
||||||
#endif /* not __STDC__ */
|
|
||||||
|
|
||||||
/* Sets the current default syntax to SYNTAX, and return the old syntax.
|
/* Sets the current default syntax to SYNTAX, and return the old syntax.
|
||||||
You can also simply assign to the `re_syntax_options' variable. */
|
You can also simply assign to the `re_syntax_options' variable. */
|
||||||
extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
|
extern reg_syntax_t re_set_syntax (reg_syntax_t syntax);
|
||||||
|
|
||||||
/* Compile the regular expression PATTERN, with length LENGTH
|
/* Compile the regular expression PATTERN, with length LENGTH
|
||||||
and syntax given by the global `re_syntax_options', into the buffer
|
and syntax given by the global `re_syntax_options', into the buffer
|
||||||
BUFFER. Return NULL if successful, and an error string if not. */
|
BUFFER. Return NULL if successful, and an error string if not. */
|
||||||
extern const char *re_compile_pattern
|
extern const char *re_compile_pattern (const char *pattern, size_t length,
|
||||||
_RE_ARGS ((const char *pattern, size_t length,
|
struct re_pattern_buffer *buffer);
|
||||||
struct re_pattern_buffer *buffer));
|
|
||||||
|
|
||||||
|
|
||||||
/* Compile a fastmap for the compiled pattern in BUFFER; used to
|
/* Compile a fastmap for the compiled pattern in BUFFER; used to
|
||||||
accelerate searches. Return 0 if successful and -2 if was an
|
accelerate searches. Return 0 if successful and -2 if was an
|
||||||
internal error. */
|
internal error. */
|
||||||
extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
|
extern int re_compile_fastmap (struct re_pattern_buffer *buffer);
|
||||||
|
|
||||||
|
|
||||||
/* Search in the string STRING (with length LENGTH) for the pattern
|
/* Search in the string STRING (with length LENGTH) for the pattern
|
||||||
|
@ -467,31 +456,29 @@ extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
|
||||||
characters. Return the starting position of the match, -1 for no
|
characters. Return the starting position of the match, -1 for no
|
||||||
match, or -2 for an internal error. Also return register
|
match, or -2 for an internal error. Also return register
|
||||||
information in REGS (if REGS and BUFFER->no_sub are nonzero). */
|
information in REGS (if REGS and BUFFER->no_sub are nonzero). */
|
||||||
extern int re_search
|
extern int re_search (struct re_pattern_buffer *buffer, const char *string,
|
||||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
|
int length, int start, int range,
|
||||||
int length, int start, int range, struct re_registers *regs));
|
struct re_registers *regs);
|
||||||
|
|
||||||
|
|
||||||
/* Like `re_search', but search in the concatenation of STRING1 and
|
/* Like `re_search', but search in the concatenation of STRING1 and
|
||||||
STRING2. Also, stop searching at index START + STOP. */
|
STRING2. Also, stop searching at index START + STOP. */
|
||||||
extern int re_search_2
|
extern int re_search_2 (struct re_pattern_buffer *buffer, const char *string1,
|
||||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
int length1, const char *string2, int length2,
|
||||||
int length1, const char *string2, int length2,
|
int start, int range, struct re_registers *regs,
|
||||||
int start, int range, struct re_registers *regs, int stop));
|
int stop);
|
||||||
|
|
||||||
|
|
||||||
/* Like `re_search', but return how many characters in STRING the regexp
|
/* Like `re_search', but return how many characters in STRING the regexp
|
||||||
in BUFFER matched, starting at position START. */
|
in BUFFER matched, starting at position START. */
|
||||||
extern int re_match
|
extern int re_match (struct re_pattern_buffer *buffer, const char *string,
|
||||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
|
int length, int start, struct re_registers *regs);
|
||||||
int length, int start, struct re_registers *regs));
|
|
||||||
|
|
||||||
|
|
||||||
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
|
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
|
||||||
extern int re_match_2
|
extern int re_match_2 (struct re_pattern_buffer *buffer, const char *string1,
|
||||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
int length1, const char *string2, int length2,
|
||||||
int length1, const char *string2, int length2,
|
int start, struct re_registers *regs, int stop);
|
||||||
int start, struct re_registers *regs, int stop));
|
|
||||||
|
|
||||||
|
|
||||||
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
|
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
|
||||||
|
@ -506,15 +493,16 @@ extern int re_match_2
|
||||||
Unless this function is called, the first search or match using
|
Unless this function is called, the first search or match using
|
||||||
PATTERN_BUFFER will allocate its own register data, without
|
PATTERN_BUFFER will allocate its own register data, without
|
||||||
freeing the old data. */
|
freeing the old data. */
|
||||||
extern void re_set_registers
|
extern void re_set_registers (struct re_pattern_buffer *buffer,
|
||||||
_RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
|
struct re_registers *regs,
|
||||||
unsigned num_regs, regoff_t *starts, regoff_t *ends));
|
unsigned num_regs, regoff_t *starts,
|
||||||
|
regoff_t *ends);
|
||||||
|
|
||||||
#if defined _REGEX_RE_COMP || defined _LIBC
|
#if defined _REGEX_RE_COMP || defined _LIBC
|
||||||
# ifndef _CRAY
|
# ifndef _CRAY
|
||||||
/* 4.2 bsd compatibility. */
|
/* 4.2 bsd compatibility. */
|
||||||
extern char *re_comp _RE_ARGS ((const char *));
|
extern char *re_comp (const char *);
|
||||||
extern int re_exec _RE_ARGS ((const char *));
|
extern int re_exec (const char *);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -541,19 +529,19 @@ extern int re_exec _RE_ARGS ((const char *));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* POSIX compatibility. */
|
/* POSIX compatibility. */
|
||||||
extern int regcomp _RE_ARGS ((regex_t *__restrict __preg,
|
extern int regcomp (regex_t *__restrict __preg,
|
||||||
const char *__restrict __pattern,
|
const char *__restrict __pattern,
|
||||||
int __cflags));
|
int __cflags);
|
||||||
|
|
||||||
extern int regexec _RE_ARGS ((const regex_t *__restrict __preg,
|
extern int regexec (const regex_t *__restrict __preg,
|
||||||
const char *__restrict __string, size_t __nmatch,
|
const char *__restrict __string, size_t __nmatch,
|
||||||
regmatch_t __pmatch[__restrict_arr],
|
regmatch_t __pmatch[__restrict_arr],
|
||||||
int __eflags));
|
int __eflags);
|
||||||
|
|
||||||
extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg,
|
extern size_t regerror (int __errcode, const regex_t *__preg,
|
||||||
char *__errbuf, size_t __errbuf_size));
|
char *__errbuf, size_t __errbuf_size);
|
||||||
|
|
||||||
extern void regfree _RE_ARGS ((regex_t *__preg));
|
extern void regfree (regex_t *__preg);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -1,3 +1,25 @@
|
||||||
|
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||||
|
|
||||||
|
Convert libiberty to use ISO C prototype style 7/n.
|
||||||
|
* regex.c (PARAMS): Remove definition.
|
||||||
|
(PREFIX): Unconditionaly define using ISO C ## operator.
|
||||||
|
(init_syntax_once, extract_number, extract_number_and_incr,
|
||||||
|
print_fastmap, print_partial_compiled_pattern,
|
||||||
|
print_compiled_pattern, print_double_string, printchar,
|
||||||
|
convert_mbs_to_wcs, re_set_syntax, regex_grow_registers,
|
||||||
|
regex_compile, store_op1, store_op2, insert_op1, insert_op2,
|
||||||
|
at_begline_loc_p, at_endline_p, group_in_compile_stack,
|
||||||
|
insert_space, wcs_compile_range, byte_compile_range,
|
||||||
|
truncate_wchar, re_compile_fastmap, re_compile_fastmap,
|
||||||
|
re_set_registers, re_search, re_search_2, re_search_3, re_match,
|
||||||
|
re_match_2, count_mbs_length, wcs_re_match_2_internal,
|
||||||
|
byte_re_match_2_internal, group_match_null_string_p,
|
||||||
|
alt_match_null_string_p, common_op_match_null_string_p,
|
||||||
|
bcmp_translate, re_compile_pattern, re_comp, re_exec, regcomp,
|
||||||
|
regexec, regerror, regfree): Use ISO C prototype style.
|
||||||
|
* partition.c: (elem_compare): Likewise.
|
||||||
|
* cp-demangle.c (print_usage): Likewise.
|
||||||
|
|
||||||
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net>
|
||||||
|
|
||||||
Convert libiberty to use ISO C prototype style 5/n.
|
Convert libiberty to use ISO C prototype style 5/n.
|
||||||
|
|
|
@ -4144,7 +4144,7 @@ is_gnu_v3_mangled_dtor (const char *name)
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
#include "dyn-string.h"
|
#include "dyn-string.h"
|
||||||
|
|
||||||
static void print_usage PARAMS ((FILE* fp, int exit_value));
|
static void print_usage (FILE* fp, int exit_value);
|
||||||
|
|
||||||
#define IS_ALPHA(CHAR) \
|
#define IS_ALPHA(CHAR) \
|
||||||
(((CHAR) >= 'a' && (CHAR) <= 'z') \
|
(((CHAR) >= 'a' && (CHAR) <= 'z') \
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include "libiberty.h"
|
#include "libiberty.h"
|
||||||
#include "partition.h"
|
#include "partition.h"
|
||||||
|
|
||||||
static int elem_compare PARAMS ((const void *, const void *));
|
static int elem_compare (const void *, const void *);
|
||||||
|
|
||||||
/* Creates a partition of NUM_ELEMENTS elements. Initially each
|
/* Creates a partition of NUM_ELEMENTS elements. Initially each
|
||||||
element is in a class by itself. */
|
element is in a class by itself. */
|
||||||
|
|
|
@ -40,14 +40,6 @@
|
||||||
|
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
|
|
||||||
#ifndef PARAMS
|
|
||||||
# if defined __GNUC__ || (defined __STDC__ && __STDC__)
|
|
||||||
# define PARAMS(args) args
|
|
||||||
# else
|
|
||||||
# define PARAMS(args) ()
|
|
||||||
# endif /* GCC. */
|
|
||||||
#endif /* Not PARAMS. */
|
|
||||||
|
|
||||||
#ifndef INSIDE_RECURSION
|
#ifndef INSIDE_RECURSION
|
||||||
|
|
||||||
# if defined STDC_HEADERS && !defined emacs
|
# if defined STDC_HEADERS && !defined emacs
|
||||||
|
@ -277,10 +269,10 @@ extern char *re_syntax_table;
|
||||||
|
|
||||||
static char re_syntax_table[CHAR_SET_SIZE];
|
static char re_syntax_table[CHAR_SET_SIZE];
|
||||||
|
|
||||||
static void init_syntax_once PARAMS ((void));
|
static void init_syntax_once (void);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_syntax_once ()
|
init_syntax_once (void)
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
static int done = 0;
|
static int done = 0;
|
||||||
|
@ -411,44 +403,44 @@ typedef char boolean;
|
||||||
# define false 0
|
# define false 0
|
||||||
# define true 1
|
# define true 1
|
||||||
|
|
||||||
static reg_errcode_t byte_regex_compile _RE_ARGS ((const char *pattern, size_t size,
|
static reg_errcode_t byte_regex_compile (const char *pattern, size_t size,
|
||||||
reg_syntax_t syntax,
|
reg_syntax_t syntax,
|
||||||
struct re_pattern_buffer *bufp));
|
struct re_pattern_buffer *bufp);
|
||||||
|
|
||||||
static int byte_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp,
|
static int byte_re_match_2_internal (struct re_pattern_buffer *bufp,
|
||||||
const char *string1, int size1,
|
const char *string1, int size1,
|
||||||
const char *string2, int size2,
|
const char *string2, int size2,
|
||||||
int pos,
|
int pos,
|
||||||
struct re_registers *regs,
|
struct re_registers *regs,
|
||||||
int stop));
|
int stop);
|
||||||
static int byte_re_search_2 PARAMS ((struct re_pattern_buffer *bufp,
|
static int byte_re_search_2 (struct re_pattern_buffer *bufp,
|
||||||
const char *string1, int size1,
|
const char *string1, int size1,
|
||||||
const char *string2, int size2,
|
const char *string2, int size2,
|
||||||
int startpos, int range,
|
int startpos, int range,
|
||||||
struct re_registers *regs, int stop));
|
struct re_registers *regs, int stop);
|
||||||
static int byte_re_compile_fastmap PARAMS ((struct re_pattern_buffer *bufp));
|
static int byte_re_compile_fastmap (struct re_pattern_buffer *bufp);
|
||||||
|
|
||||||
#ifdef MBS_SUPPORT
|
#ifdef MBS_SUPPORT
|
||||||
static reg_errcode_t wcs_regex_compile _RE_ARGS ((const char *pattern, size_t size,
|
static reg_errcode_t wcs_regex_compile (const char *pattern, size_t size,
|
||||||
reg_syntax_t syntax,
|
reg_syntax_t syntax,
|
||||||
struct re_pattern_buffer *bufp));
|
struct re_pattern_buffer *bufp);
|
||||||
|
|
||||||
|
|
||||||
static int wcs_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp,
|
static int wcs_re_match_2_internal (struct re_pattern_buffer *bufp,
|
||||||
const char *cstring1, int csize1,
|
const char *cstring1, int csize1,
|
||||||
const char *cstring2, int csize2,
|
const char *cstring2, int csize2,
|
||||||
int pos,
|
int pos,
|
||||||
struct re_registers *regs,
|
struct re_registers *regs,
|
||||||
int stop,
|
int stop,
|
||||||
wchar_t *string1, int size1,
|
wchar_t *string1, int size1,
|
||||||
wchar_t *string2, int size2,
|
wchar_t *string2, int size2,
|
||||||
int *mbs_offset1, int *mbs_offset2));
|
int *mbs_offset1, int *mbs_offset2);
|
||||||
static int wcs_re_search_2 PARAMS ((struct re_pattern_buffer *bufp,
|
static int wcs_re_search_2 (struct re_pattern_buffer *bufp,
|
||||||
const char *string1, int size1,
|
const char *string1, int size1,
|
||||||
const char *string2, int size2,
|
const char *string2, int size2,
|
||||||
int startpos, int range,
|
int startpos, int range,
|
||||||
struct re_registers *regs, int stop));
|
struct re_registers *regs, int stop);
|
||||||
static int wcs_re_compile_fastmap PARAMS ((struct re_pattern_buffer *bufp));
|
static int wcs_re_compile_fastmap (struct re_pattern_buffer *bufp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* These are the command codes that appear in compiled regular
|
/* These are the command codes that appear in compiled regular
|
||||||
|
@ -616,11 +608,7 @@ typedef enum
|
||||||
# define UCHAR_T unsigned char
|
# define UCHAR_T unsigned char
|
||||||
# define COMPILED_BUFFER_VAR bufp->buffer
|
# define COMPILED_BUFFER_VAR bufp->buffer
|
||||||
# define OFFSET_ADDRESS_SIZE 2
|
# define OFFSET_ADDRESS_SIZE 2
|
||||||
# if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
|
# define PREFIX(name) byte_##name
|
||||||
# define PREFIX(name) byte_##name
|
|
||||||
# else
|
|
||||||
# define PREFIX(name) byte_/**/name
|
|
||||||
# endif
|
|
||||||
# define ARG_PREFIX(name) name
|
# define ARG_PREFIX(name) name
|
||||||
# define PUT_CHAR(c) putchar (c)
|
# define PUT_CHAR(c) putchar (c)
|
||||||
#else
|
#else
|
||||||
|
@ -630,13 +618,8 @@ typedef enum
|
||||||
# define COMPILED_BUFFER_VAR wc_buffer
|
# define COMPILED_BUFFER_VAR wc_buffer
|
||||||
# define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */
|
# define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */
|
||||||
# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_T)+1)
|
# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_T)+1)
|
||||||
# if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
|
# define PREFIX(name) wcs_##name
|
||||||
# define PREFIX(name) wcs_##name
|
# define ARG_PREFIX(name) c##name
|
||||||
# define ARG_PREFIX(name) c##name
|
|
||||||
# else
|
|
||||||
# define PREFIX(name) wcs_/**/name
|
|
||||||
# define ARG_PREFIX(name) c/**/name
|
|
||||||
# endif
|
|
||||||
/* Should we use wide stream?? */
|
/* Should we use wide stream?? */
|
||||||
# define PUT_CHAR(c) printf ("%C", c);
|
# define PUT_CHAR(c) printf ("%C", c);
|
||||||
# define TRUE 1
|
# define TRUE 1
|
||||||
|
@ -703,11 +686,9 @@ typedef enum
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef DEBUG
|
# ifdef DEBUG
|
||||||
static void PREFIX(extract_number) _RE_ARGS ((int *dest, UCHAR_T *source));
|
static void PREFIX(extract_number) (int *dest, UCHAR_T *source);
|
||||||
static void
|
static void
|
||||||
PREFIX(extract_number) (dest, source)
|
PREFIX(extract_number) (int *dest, UCHAR_T *source)
|
||||||
int *dest;
|
|
||||||
UCHAR_T *source;
|
|
||||||
{
|
{
|
||||||
# ifdef WCHAR
|
# ifdef WCHAR
|
||||||
*dest = *source;
|
*dest = *source;
|
||||||
|
@ -735,12 +716,10 @@ PREFIX(extract_number) (dest, source)
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
# ifdef DEBUG
|
# ifdef DEBUG
|
||||||
static void PREFIX(extract_number_and_incr) _RE_ARGS ((int *destination,
|
static void PREFIX(extract_number_and_incr) (int *destination,
|
||||||
UCHAR_T **source));
|
UCHAR_T **source);
|
||||||
static void
|
static void
|
||||||
PREFIX(extract_number_and_incr) (destination, source)
|
PREFIX(extract_number_and_incr) (int *destination, UCHAR_T **source)
|
||||||
int *destination;
|
|
||||||
UCHAR_T **source;
|
|
||||||
{
|
{
|
||||||
PREFIX(extract_number) (destination, *source);
|
PREFIX(extract_number) (destination, *source);
|
||||||
*source += OFFSET_ADDRESS_SIZE;
|
*source += OFFSET_ADDRESS_SIZE;
|
||||||
|
@ -791,8 +770,7 @@ static int debug;
|
||||||
|
|
||||||
# ifndef DEFINED_ONCE
|
# ifndef DEFINED_ONCE
|
||||||
void
|
void
|
||||||
print_fastmap (fastmap)
|
print_fastmap (char *fastmap)
|
||||||
char *fastmap;
|
|
||||||
{
|
{
|
||||||
unsigned was_a_range = 0;
|
unsigned was_a_range = 0;
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
|
@ -824,9 +802,7 @@ print_fastmap (fastmap)
|
||||||
the START pointer into it and ending just before the pointer END. */
|
the START pointer into it and ending just before the pointer END. */
|
||||||
|
|
||||||
void
|
void
|
||||||
PREFIX(print_partial_compiled_pattern) (start, end)
|
PREFIX(print_partial_compiled_pattern) (UCHAR_T *start, UCHAR_T *end)
|
||||||
UCHAR_T *start;
|
|
||||||
UCHAR_T *end;
|
|
||||||
{
|
{
|
||||||
int mcnt, mcnt2;
|
int mcnt, mcnt2;
|
||||||
UCHAR_T *p1;
|
UCHAR_T *p1;
|
||||||
|
@ -1159,8 +1135,7 @@ PREFIX(print_partial_compiled_pattern) (start, end)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PREFIX(print_compiled_pattern) (bufp)
|
PREFIX(print_compiled_pattern) (struct re_pattern_buffer *bufp)
|
||||||
struct re_pattern_buffer *bufp;
|
|
||||||
{
|
{
|
||||||
UCHAR_T *buffer = (UCHAR_T*) bufp->buffer;
|
UCHAR_T *buffer = (UCHAR_T*) bufp->buffer;
|
||||||
|
|
||||||
|
@ -1192,12 +1167,8 @@ PREFIX(print_compiled_pattern) (bufp)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PREFIX(print_double_string) (where, string1, size1, string2, size2)
|
PREFIX(print_double_string) (const CHAR_T *where, const CHAR_T *string1,
|
||||||
const CHAR_T *where;
|
int size1, const CHAR_T *string2, int size2)
|
||||||
const CHAR_T *string1;
|
|
||||||
const CHAR_T *string2;
|
|
||||||
int size1;
|
|
||||||
int size2;
|
|
||||||
{
|
{
|
||||||
int this_char;
|
int this_char;
|
||||||
|
|
||||||
|
@ -1230,8 +1201,7 @@ PREFIX(print_double_string) (where, string1, size1, string2, size2)
|
||||||
|
|
||||||
# ifndef DEFINED_ONCE
|
# ifndef DEFINED_ONCE
|
||||||
void
|
void
|
||||||
printchar (c)
|
printchar (int c)
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
putc (c, stderr);
|
putc (c, stderr);
|
||||||
}
|
}
|
||||||
|
@ -1268,11 +1238,8 @@ static size_t convert_mbs_to_wcs (CHAR_T *dest, const unsigned char* src,
|
||||||
size_t len, int *offset_buffer,
|
size_t len, int *offset_buffer,
|
||||||
char *is_binary);
|
char *is_binary);
|
||||||
static size_t
|
static size_t
|
||||||
convert_mbs_to_wcs (dest, src, len, offset_buffer, is_binary)
|
convert_mbs_to_wcs (CHAR_T *dest, const unsigned char*src, size_t len,
|
||||||
CHAR_T *dest;
|
int *offset_buffer, char *is_binary)
|
||||||
const unsigned char* src;
|
|
||||||
size_t len; /* the length of multibyte string. */
|
|
||||||
|
|
||||||
/* It hold correspondances between src(char string) and
|
/* It hold correspondances between src(char string) and
|
||||||
dest(wchar_t string) for optimization.
|
dest(wchar_t string) for optimization.
|
||||||
e.g. src = "xxxyzz"
|
e.g. src = "xxxyzz"
|
||||||
|
@ -1282,8 +1249,6 @@ convert_mbs_to_wcs (dest, src, len, offset_buffer, is_binary)
|
||||||
offset_buffer = {0, 0+3("xxx"), 0+3+1("y"), 0+3+1+2("zz")}
|
offset_buffer = {0, 0+3("xxx"), 0+3+1("y"), 0+3+1+2("zz")}
|
||||||
= {0, 3, 4, 6}
|
= {0, 3, 4, 6}
|
||||||
*/
|
*/
|
||||||
int *offset_buffer;
|
|
||||||
char *is_binary;
|
|
||||||
{
|
{
|
||||||
wchar_t *pdest = dest;
|
wchar_t *pdest = dest;
|
||||||
const unsigned char *psrc = src;
|
const unsigned char *psrc = src;
|
||||||
|
@ -1354,8 +1319,7 @@ reg_syntax_t re_syntax_options;
|
||||||
defined in regex.h. We return the old syntax. */
|
defined in regex.h. We return the old syntax. */
|
||||||
|
|
||||||
reg_syntax_t
|
reg_syntax_t
|
||||||
re_set_syntax (syntax)
|
re_set_syntax (reg_syntax_t syntax)
|
||||||
reg_syntax_t syntax;
|
|
||||||
{
|
{
|
||||||
reg_syntax_t ret = re_syntax_options;
|
reg_syntax_t ret = re_syntax_options;
|
||||||
|
|
||||||
|
@ -1874,35 +1838,35 @@ static CHAR_T PREFIX(reg_unset_dummy);
|
||||||
# define REG_UNSET(e) ((e) == REG_UNSET_VALUE)
|
# define REG_UNSET(e) ((e) == REG_UNSET_VALUE)
|
||||||
|
|
||||||
/* Subroutine declarations and macros for regex_compile. */
|
/* Subroutine declarations and macros for regex_compile. */
|
||||||
static void PREFIX(store_op1) _RE_ARGS ((re_opcode_t op, UCHAR_T *loc, int arg));
|
static void PREFIX(store_op1) (re_opcode_t op, UCHAR_T *loc, int arg);
|
||||||
static void PREFIX(store_op2) _RE_ARGS ((re_opcode_t op, UCHAR_T *loc,
|
static void PREFIX(store_op2) (re_opcode_t op, UCHAR_T *loc,
|
||||||
int arg1, int arg2));
|
int arg1, int arg2);
|
||||||
static void PREFIX(insert_op1) _RE_ARGS ((re_opcode_t op, UCHAR_T *loc,
|
static void PREFIX(insert_op1) (re_opcode_t op, UCHAR_T *loc,
|
||||||
int arg, UCHAR_T *end));
|
int arg, UCHAR_T *end);
|
||||||
static void PREFIX(insert_op2) _RE_ARGS ((re_opcode_t op, UCHAR_T *loc,
|
static void PREFIX(insert_op2) (re_opcode_t op, UCHAR_T *loc,
|
||||||
int arg1, int arg2, UCHAR_T *end));
|
int arg1, int arg2, UCHAR_T *end);
|
||||||
static boolean PREFIX(at_begline_loc_p) _RE_ARGS ((const CHAR_T *pattern,
|
static boolean PREFIX(at_begline_loc_p) (const CHAR_T *pattern,
|
||||||
const CHAR_T *p,
|
const CHAR_T *p,
|
||||||
reg_syntax_t syntax));
|
reg_syntax_t syntax);
|
||||||
static boolean PREFIX(at_endline_loc_p) _RE_ARGS ((const CHAR_T *p,
|
static boolean PREFIX(at_endline_loc_p) (const CHAR_T *p,
|
||||||
const CHAR_T *pend,
|
const CHAR_T *pend,
|
||||||
reg_syntax_t syntax));
|
reg_syntax_t syntax);
|
||||||
# ifdef WCHAR
|
# ifdef WCHAR
|
||||||
static reg_errcode_t wcs_compile_range _RE_ARGS ((CHAR_T range_start,
|
static reg_errcode_t wcs_compile_range (CHAR_T range_start,
|
||||||
const CHAR_T **p_ptr,
|
const CHAR_T **p_ptr,
|
||||||
const CHAR_T *pend,
|
const CHAR_T *pend,
|
||||||
char *translate,
|
char *translate,
|
||||||
reg_syntax_t syntax,
|
reg_syntax_t syntax,
|
||||||
UCHAR_T *b,
|
UCHAR_T *b,
|
||||||
CHAR_T *char_set));
|
CHAR_T *char_set);
|
||||||
static void insert_space _RE_ARGS ((int num, CHAR_T *loc, CHAR_T *end));
|
static void insert_space (int num, CHAR_T *loc, CHAR_T *end);
|
||||||
# else /* BYTE */
|
# else /* BYTE */
|
||||||
static reg_errcode_t byte_compile_range _RE_ARGS ((unsigned int range_start,
|
static reg_errcode_t byte_compile_range (unsigned int range_start,
|
||||||
const char **p_ptr,
|
const char **p_ptr,
|
||||||
const char *pend,
|
const char *pend,
|
||||||
char *translate,
|
char *translate,
|
||||||
reg_syntax_t syntax,
|
reg_syntax_t syntax,
|
||||||
unsigned char *b));
|
unsigned char *b);
|
||||||
# endif /* WCHAR */
|
# endif /* WCHAR */
|
||||||
|
|
||||||
/* Fetch the next character in the uncompiled pattern---translating it
|
/* Fetch the next character in the uncompiled pattern---translating it
|
||||||
|
@ -2260,8 +2224,7 @@ static PREFIX(register_info_type) *PREFIX(reg_info_dummy);
|
||||||
but don't make them smaller. */
|
but don't make them smaller. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PREFIX(regex_grow_registers) (num_regs)
|
PREFIX(regex_grow_registers) (int num_regs)
|
||||||
int num_regs;
|
|
||||||
{
|
{
|
||||||
if (num_regs > regs_allocated_size)
|
if (num_regs > regs_allocated_size)
|
||||||
{
|
{
|
||||||
|
@ -2282,9 +2245,8 @@ PREFIX(regex_grow_registers) (num_regs)
|
||||||
# endif /* not MATCH_MAY_ALLOCATE */
|
# endif /* not MATCH_MAY_ALLOCATE */
|
||||||
|
|
||||||
# ifndef DEFINED_ONCE
|
# ifndef DEFINED_ONCE
|
||||||
static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type
|
static boolean group_in_compile_stack (compile_stack_type compile_stack,
|
||||||
compile_stack,
|
regnum_t regnum);
|
||||||
regnum_t regnum));
|
|
||||||
# endif /* not DEFINED_ONCE */
|
# endif /* not DEFINED_ONCE */
|
||||||
|
|
||||||
/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
|
/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
|
||||||
|
@ -2315,11 +2277,9 @@ static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type
|
||||||
# endif /* WCHAR */
|
# endif /* WCHAR */
|
||||||
|
|
||||||
static reg_errcode_t
|
static reg_errcode_t
|
||||||
PREFIX(regex_compile) (ARG_PREFIX(pattern), ARG_PREFIX(size), syntax, bufp)
|
PREFIX(regex_compile) (const char *ARG_PREFIX(pattern),
|
||||||
const char *ARG_PREFIX(pattern);
|
size_t ARG_PREFIX(size), reg_syntax_t syntax,
|
||||||
size_t ARG_PREFIX(size);
|
struct re_pattern_buffer *bufp)
|
||||||
reg_syntax_t syntax;
|
|
||||||
struct re_pattern_buffer *bufp;
|
|
||||||
{
|
{
|
||||||
/* We fetch characters from PATTERN here. Even though PATTERN is
|
/* We fetch characters from PATTERN here. Even though PATTERN is
|
||||||
`char *' (i.e., signed), we declare these variables as unsigned, so
|
`char *' (i.e., signed), we declare these variables as unsigned, so
|
||||||
|
@ -4264,10 +4224,7 @@ PREFIX(regex_compile) (ARG_PREFIX(pattern), ARG_PREFIX(size), syntax, bufp)
|
||||||
/* ifdef WCHAR, integer parameter is 1 wchar_t. */
|
/* ifdef WCHAR, integer parameter is 1 wchar_t. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PREFIX(store_op1) (op, loc, arg)
|
PREFIX(store_op1) (re_opcode_t op, UCHAR_T *loc, int arg)
|
||||||
re_opcode_t op;
|
|
||||||
UCHAR_T *loc;
|
|
||||||
int arg;
|
|
||||||
{
|
{
|
||||||
*loc = (UCHAR_T) op;
|
*loc = (UCHAR_T) op;
|
||||||
STORE_NUMBER (loc + 1, arg);
|
STORE_NUMBER (loc + 1, arg);
|
||||||
|
@ -4278,10 +4235,7 @@ PREFIX(store_op1) (op, loc, arg)
|
||||||
/* ifdef WCHAR, integer parameter is 1 wchar_t. */
|
/* ifdef WCHAR, integer parameter is 1 wchar_t. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PREFIX(store_op2) (op, loc, arg1, arg2)
|
PREFIX(store_op2) (re_opcode_t op, UCHAR_T *loc, int arg1, int arg2)
|
||||||
re_opcode_t op;
|
|
||||||
UCHAR_T *loc;
|
|
||||||
int arg1, arg2;
|
|
||||||
{
|
{
|
||||||
*loc = (UCHAR_T) op;
|
*loc = (UCHAR_T) op;
|
||||||
STORE_NUMBER (loc + 1, arg1);
|
STORE_NUMBER (loc + 1, arg1);
|
||||||
|
@ -4294,11 +4248,7 @@ PREFIX(store_op2) (op, loc, arg1, arg2)
|
||||||
/* ifdef WCHAR, integer parameter is 1 wchar_t. */
|
/* ifdef WCHAR, integer parameter is 1 wchar_t. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PREFIX(insert_op1) (op, loc, arg, end)
|
PREFIX(insert_op1) (re_opcode_t op, UCHAR_T *loc, int arg, UCHAR_T *end)
|
||||||
re_opcode_t op;
|
|
||||||
UCHAR_T *loc;
|
|
||||||
int arg;
|
|
||||||
UCHAR_T *end;
|
|
||||||
{
|
{
|
||||||
register UCHAR_T *pfrom = end;
|
register UCHAR_T *pfrom = end;
|
||||||
register UCHAR_T *pto = end + 1 + OFFSET_ADDRESS_SIZE;
|
register UCHAR_T *pto = end + 1 + OFFSET_ADDRESS_SIZE;
|
||||||
|
@ -4314,11 +4264,8 @@ PREFIX(insert_op1) (op, loc, arg, end)
|
||||||
/* ifdef WCHAR, integer parameter is 1 wchar_t. */
|
/* ifdef WCHAR, integer parameter is 1 wchar_t. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
PREFIX(insert_op2) (op, loc, arg1, arg2, end)
|
PREFIX(insert_op2) (re_opcode_t op, UCHAR_T *loc, int arg1,
|
||||||
re_opcode_t op;
|
int arg2, UCHAR_T *end)
|
||||||
UCHAR_T *loc;
|
|
||||||
int arg1, arg2;
|
|
||||||
UCHAR_T *end;
|
|
||||||
{
|
{
|
||||||
register UCHAR_T *pfrom = end;
|
register UCHAR_T *pfrom = end;
|
||||||
register UCHAR_T *pto = end + 1 + 2 * OFFSET_ADDRESS_SIZE;
|
register UCHAR_T *pto = end + 1 + 2 * OFFSET_ADDRESS_SIZE;
|
||||||
|
@ -4335,9 +4282,8 @@ PREFIX(insert_op2) (op, loc, arg1, arg2, end)
|
||||||
least one character before the ^. */
|
least one character before the ^. */
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
PREFIX(at_begline_loc_p) (pattern, p, syntax)
|
PREFIX(at_begline_loc_p) (const CHAR_T *pattern, const CHAR_T *p,
|
||||||
const CHAR_T *pattern, *p;
|
reg_syntax_t syntax)
|
||||||
reg_syntax_t syntax;
|
|
||||||
{
|
{
|
||||||
const CHAR_T *prev = p - 2;
|
const CHAR_T *prev = p - 2;
|
||||||
boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
|
boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
|
||||||
|
@ -4354,9 +4300,8 @@ PREFIX(at_begline_loc_p) (pattern, p, syntax)
|
||||||
at least one character after the $, i.e., `P < PEND'. */
|
at least one character after the $, i.e., `P < PEND'. */
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
PREFIX(at_endline_loc_p) (p, pend, syntax)
|
PREFIX(at_endline_loc_p) (const CHAR_T *p, const CHAR_T *pend,
|
||||||
const CHAR_T *p, *pend;
|
reg_syntax_t syntax)
|
||||||
reg_syntax_t syntax;
|
|
||||||
{
|
{
|
||||||
const CHAR_T *next = p;
|
const CHAR_T *next = p;
|
||||||
boolean next_backslash = *next == '\\';
|
boolean next_backslash = *next == '\\';
|
||||||
|
@ -4377,9 +4322,7 @@ PREFIX(at_endline_loc_p) (p, pend, syntax)
|
||||||
false if it's not. */
|
false if it's not. */
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
group_in_compile_stack (compile_stack, regnum)
|
group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum)
|
||||||
compile_stack_type compile_stack;
|
|
||||||
regnum_t regnum;
|
|
||||||
{
|
{
|
||||||
int this_element;
|
int this_element;
|
||||||
|
|
||||||
|
@ -4399,10 +4342,7 @@ group_in_compile_stack (compile_stack, regnum)
|
||||||
/* This insert space, which size is "num", into the pattern at "loc".
|
/* This insert space, which size is "num", into the pattern at "loc".
|
||||||
"end" must point the end of the allocated buffer. */
|
"end" must point the end of the allocated buffer. */
|
||||||
static void
|
static void
|
||||||
insert_space (num, loc, end)
|
insert_space (int num, CHAR_T *loc, CHAR_T *end)
|
||||||
int num;
|
|
||||||
CHAR_T *loc;
|
|
||||||
CHAR_T *end;
|
|
||||||
{
|
{
|
||||||
register CHAR_T *pto = end;
|
register CHAR_T *pto = end;
|
||||||
register CHAR_T *pfrom = end - num;
|
register CHAR_T *pfrom = end - num;
|
||||||
|
@ -4414,13 +4354,9 @@ insert_space (num, loc, end)
|
||||||
|
|
||||||
#ifdef WCHAR
|
#ifdef WCHAR
|
||||||
static reg_errcode_t
|
static reg_errcode_t
|
||||||
wcs_compile_range (range_start_char, p_ptr, pend, translate, syntax, b,
|
wcs_compile_range (CHAR_T range_start_char, const CHAR_T **p_ptr,
|
||||||
char_set)
|
const CHAR_T *pend, RE_TRANSLATE_TYPE translate,
|
||||||
CHAR_T range_start_char;
|
reg_syntax_t syntax, CHAR_T *b, CHAR_T *char_set)
|
||||||
const CHAR_T **p_ptr, *pend;
|
|
||||||
CHAR_T *char_set, *b;
|
|
||||||
RE_TRANSLATE_TYPE translate;
|
|
||||||
reg_syntax_t syntax;
|
|
||||||
{
|
{
|
||||||
const CHAR_T *p = *p_ptr;
|
const CHAR_T *p = *p_ptr;
|
||||||
CHAR_T range_start, range_end;
|
CHAR_T range_start, range_end;
|
||||||
|
@ -4501,12 +4437,9 @@ wcs_compile_range (range_start_char, p_ptr, pend, translate, syntax, b,
|
||||||
`regex_compile' itself. */
|
`regex_compile' itself. */
|
||||||
|
|
||||||
static reg_errcode_t
|
static reg_errcode_t
|
||||||
byte_compile_range (range_start_char, p_ptr, pend, translate, syntax, b)
|
byte_compile_range (unsigned int range_start_char, const char **p_ptr,
|
||||||
unsigned int range_start_char;
|
const char *pend, RE_TRANSLATE_TYPE translate,
|
||||||
const char **p_ptr, *pend;
|
reg_syntax_t syntax, unsigned char *b)
|
||||||
RE_TRANSLATE_TYPE translate;
|
|
||||||
reg_syntax_t syntax;
|
|
||||||
unsigned char *b;
|
|
||||||
{
|
{
|
||||||
unsigned this_char;
|
unsigned this_char;
|
||||||
const char *p = *p_ptr;
|
const char *p = *p_ptr;
|
||||||
|
@ -4587,8 +4520,7 @@ byte_compile_range (range_start_char, p_ptr, pend, translate, syntax, b)
|
||||||
static unsigned char truncate_wchar (CHAR_T c);
|
static unsigned char truncate_wchar (CHAR_T c);
|
||||||
|
|
||||||
static unsigned char
|
static unsigned char
|
||||||
truncate_wchar (c)
|
truncate_wchar (CHAR_T c)
|
||||||
CHAR_T c;
|
|
||||||
{
|
{
|
||||||
unsigned char buf[MB_CUR_MAX];
|
unsigned char buf[MB_CUR_MAX];
|
||||||
mbstate_t state;
|
mbstate_t state;
|
||||||
|
@ -4604,8 +4536,7 @@ truncate_wchar (c)
|
||||||
#endif /* WCHAR */
|
#endif /* WCHAR */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
PREFIX(re_compile_fastmap) (bufp)
|
PREFIX(re_compile_fastmap) (struct re_pattern_buffer *bufp)
|
||||||
struct re_pattern_buffer *bufp;
|
|
||||||
{
|
{
|
||||||
int j, k;
|
int j, k;
|
||||||
#ifdef MATCH_MAY_ALLOCATE
|
#ifdef MATCH_MAY_ALLOCATE
|
||||||
|
@ -4924,8 +4855,7 @@ PREFIX(re_compile_fastmap) (bufp)
|
||||||
#else /* not INSIDE_RECURSION */
|
#else /* not INSIDE_RECURSION */
|
||||||
|
|
||||||
int
|
int
|
||||||
re_compile_fastmap (bufp)
|
re_compile_fastmap (struct re_pattern_buffer *bufp)
|
||||||
struct re_pattern_buffer *bufp;
|
|
||||||
{
|
{
|
||||||
# ifdef MBS_SUPPORT
|
# ifdef MBS_SUPPORT
|
||||||
if (MB_CUR_MAX != 1)
|
if (MB_CUR_MAX != 1)
|
||||||
|
@ -4953,11 +4883,9 @@ weak_alias (__re_compile_fastmap, re_compile_fastmap)
|
||||||
freeing the old data. */
|
freeing the old data. */
|
||||||
|
|
||||||
void
|
void
|
||||||
re_set_registers (bufp, regs, num_regs, starts, ends)
|
re_set_registers (struct re_pattern_buffer *bufp,
|
||||||
struct re_pattern_buffer *bufp;
|
struct re_registers *regs, unsigned num_regs,
|
||||||
struct re_registers *regs;
|
regoff_t *starts, regoff_t *ends)
|
||||||
unsigned num_regs;
|
|
||||||
regoff_t *starts, *ends;
|
|
||||||
{
|
{
|
||||||
if (num_regs)
|
if (num_regs)
|
||||||
{
|
{
|
||||||
|
@ -4983,11 +4911,8 @@ weak_alias (__re_set_registers, re_set_registers)
|
||||||
doesn't let you say where to stop matching. */
|
doesn't let you say where to stop matching. */
|
||||||
|
|
||||||
int
|
int
|
||||||
re_search (bufp, string, size, startpos, range, regs)
|
re_search (struct re_pattern_buffer *bufp, const char *string, int size,
|
||||||
struct re_pattern_buffer *bufp;
|
int startpos, int range, struct re_registers *regs)
|
||||||
const char *string;
|
|
||||||
int size, startpos, range;
|
|
||||||
struct re_registers *regs;
|
|
||||||
{
|
{
|
||||||
return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
|
return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
|
||||||
regs, size);
|
regs, size);
|
||||||
|
@ -5019,14 +4944,9 @@ weak_alias (__re_search, re_search)
|
||||||
stack overflow). */
|
stack overflow). */
|
||||||
|
|
||||||
int
|
int
|
||||||
re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
|
re_search_2 (struct re_pattern_buffer *bufp, const char *string1, int size1,
|
||||||
struct re_pattern_buffer *bufp;
|
const char *string2, int size2, int startpos, int range,
|
||||||
const char *string1, *string2;
|
struct re_registers *regs, int stop)
|
||||||
int size1, size2;
|
|
||||||
int startpos;
|
|
||||||
int range;
|
|
||||||
struct re_registers *regs;
|
|
||||||
int stop;
|
|
||||||
{
|
{
|
||||||
# ifdef MBS_SUPPORT
|
# ifdef MBS_SUPPORT
|
||||||
if (MB_CUR_MAX != 1)
|
if (MB_CUR_MAX != 1)
|
||||||
|
@ -5082,15 +5002,10 @@ weak_alias (__re_search_2, re_search_2)
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
PREFIX(re_search_2) (bufp, string1, size1, string2, size2, startpos, range,
|
PREFIX(re_search_2) (struct re_pattern_buffer *bufp, const char *string1,
|
||||||
regs, stop)
|
int size1, const char *string2, int size2,
|
||||||
struct re_pattern_buffer *bufp;
|
int startpos, int range,
|
||||||
const char *string1, *string2;
|
struct re_registers *regs, int stop)
|
||||||
int size1, size2;
|
|
||||||
int startpos;
|
|
||||||
int range;
|
|
||||||
struct re_registers *regs;
|
|
||||||
int stop;
|
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
register char *fastmap = bufp->fastmap;
|
register char *fastmap = bufp->fastmap;
|
||||||
|
@ -5473,11 +5388,8 @@ PREFIX(re_search_2) (bufp, string1, size1, string2, size2, startpos, range,
|
||||||
/* re_match is like re_match_2 except it takes only a single string. */
|
/* re_match is like re_match_2 except it takes only a single string. */
|
||||||
|
|
||||||
int
|
int
|
||||||
re_match (bufp, string, size, pos, regs)
|
re_match (struct re_pattern_buffer *bufp, const char *string,
|
||||||
struct re_pattern_buffer *bufp;
|
int size, int pos, struct re_registers *regs)
|
||||||
const char *string;
|
|
||||||
int size, pos;
|
|
||||||
struct re_registers *regs;
|
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
# ifdef MBS_SUPPORT
|
# ifdef MBS_SUPPORT
|
||||||
|
@ -5504,17 +5416,17 @@ weak_alias (__re_match, re_match)
|
||||||
#endif /* not INSIDE_RECURSION */
|
#endif /* not INSIDE_RECURSION */
|
||||||
|
|
||||||
#ifdef INSIDE_RECURSION
|
#ifdef INSIDE_RECURSION
|
||||||
static boolean PREFIX(group_match_null_string_p) _RE_ARGS ((UCHAR_T **p,
|
static boolean PREFIX(group_match_null_string_p) (UCHAR_T **p,
|
||||||
UCHAR_T *end,
|
UCHAR_T *end,
|
||||||
PREFIX(register_info_type) *reg_info));
|
PREFIX(register_info_type) *reg_info);
|
||||||
static boolean PREFIX(alt_match_null_string_p) _RE_ARGS ((UCHAR_T *p,
|
static boolean PREFIX(alt_match_null_string_p) (UCHAR_T *p,
|
||||||
UCHAR_T *end,
|
UCHAR_T *end,
|
||||||
PREFIX(register_info_type) *reg_info));
|
PREFIX(register_info_type) *reg_info);
|
||||||
static boolean PREFIX(common_op_match_null_string_p) _RE_ARGS ((UCHAR_T **p,
|
static boolean PREFIX(common_op_match_null_string_p) (UCHAR_T **p,
|
||||||
UCHAR_T *end,
|
UCHAR_T *end,
|
||||||
PREFIX(register_info_type) *reg_info));
|
PREFIX(register_info_type) *reg_info);
|
||||||
static int PREFIX(bcmp_translate) _RE_ARGS ((const CHAR_T *s1, const CHAR_T *s2,
|
static int PREFIX(bcmp_translate) (const CHAR_T *s1, const CHAR_T *s2,
|
||||||
int len, char *translate));
|
int len, char *translate);
|
||||||
#else /* not INSIDE_RECURSION */
|
#else /* not INSIDE_RECURSION */
|
||||||
|
|
||||||
/* re_match_2 matches the compiled pattern in BUFP against the
|
/* re_match_2 matches the compiled pattern in BUFP against the
|
||||||
|
@ -5531,13 +5443,9 @@ static int PREFIX(bcmp_translate) _RE_ARGS ((const CHAR_T *s1, const CHAR_T *s2,
|
||||||
matched substring. */
|
matched substring. */
|
||||||
|
|
||||||
int
|
int
|
||||||
re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
|
re_match_2 (struct re_pattern_buffer *bufp, const char *string1, int size1,
|
||||||
struct re_pattern_buffer *bufp;
|
const char *string2, int size2, int pos,
|
||||||
const char *string1, *string2;
|
struct re_registers *regs, int stop)
|
||||||
int size1, size2;
|
|
||||||
int pos;
|
|
||||||
struct re_registers *regs;
|
|
||||||
int stop;
|
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
# ifdef MBS_SUPPORT
|
# ifdef MBS_SUPPORT
|
||||||
|
@ -5566,7 +5474,7 @@ weak_alias (__re_match_2, re_match_2)
|
||||||
#ifdef INSIDE_RECURSION
|
#ifdef INSIDE_RECURSION
|
||||||
|
|
||||||
#ifdef WCHAR
|
#ifdef WCHAR
|
||||||
static int count_mbs_length PARAMS ((int *, int));
|
static int count_mbs_length (int *, int);
|
||||||
|
|
||||||
/* This check the substring (from 0, to length) of the multibyte string,
|
/* This check the substring (from 0, to length) of the multibyte string,
|
||||||
to which offset_buffer correspond. And count how many wchar_t_characters
|
to which offset_buffer correspond. And count how many wchar_t_characters
|
||||||
|
@ -5574,9 +5482,7 @@ static int count_mbs_length PARAMS ((int *, int));
|
||||||
See convert_mbs_to_wcs. */
|
See convert_mbs_to_wcs. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
count_mbs_length(offset_buffer, length)
|
count_mbs_length(int *offset_buffer, int length)
|
||||||
int *offset_buffer;
|
|
||||||
int length;
|
|
||||||
{
|
{
|
||||||
int upper, lower;
|
int upper, lower;
|
||||||
|
|
||||||
|
@ -5617,33 +5523,26 @@ count_mbs_length(offset_buffer, length)
|
||||||
afterwards. */
|
afterwards. */
|
||||||
#ifdef WCHAR
|
#ifdef WCHAR
|
||||||
static int
|
static int
|
||||||
wcs_re_match_2_internal (bufp, cstring1, csize1, cstring2, csize2, pos,
|
wcs_re_match_2_internal (struct re_pattern_buffer *bufp,
|
||||||
regs, stop, string1, size1, string2, size2,
|
const char *cstring1, int csize1,
|
||||||
mbs_offset1, mbs_offset2)
|
const char *cstring2, int csize2,
|
||||||
struct re_pattern_buffer *bufp;
|
int pos,
|
||||||
const char *cstring1, *cstring2;
|
struct re_registers *regs,
|
||||||
int csize1, csize2;
|
int stop,
|
||||||
int pos;
|
|
||||||
struct re_registers *regs;
|
|
||||||
int stop;
|
|
||||||
/* string1 == string2 == NULL means string1/2, size1/2 and
|
/* string1 == string2 == NULL means string1/2, size1/2 and
|
||||||
mbs_offset1/2 need seting up in this function. */
|
mbs_offset1/2 need seting up in this function. */
|
||||||
/* We need wchar_t* buffers correspond to cstring1, cstring2. */
|
/* We need wchar_t* buffers correspond to cstring1, cstring2. */
|
||||||
wchar_t *string1, *string2;
|
wchar_t *string1, int size1,
|
||||||
/* We need the size of wchar_t buffers correspond to csize1, csize2. */
|
wchar_t *string2, int size2,
|
||||||
int size1, size2;
|
|
||||||
/* offset buffer for optimizatoin. See convert_mbs_to_wc. */
|
/* offset buffer for optimizatoin. See convert_mbs_to_wc. */
|
||||||
int *mbs_offset1, *mbs_offset2;
|
int *mbs_offset1, int *mbs_offset2)
|
||||||
#else /* BYTE */
|
#else /* BYTE */
|
||||||
static int
|
static int
|
||||||
byte_re_match_2_internal (bufp, string1, size1,string2, size2, pos,
|
byte_re_match_2_internal (struct re_pattern_buffer *bufp,
|
||||||
regs, stop)
|
const char *string1, int size1,
|
||||||
struct re_pattern_buffer *bufp;
|
const char *string2, int size2,
|
||||||
const char *string1, *string2;
|
int pos,
|
||||||
int size1, size2;
|
struct re_registers *regs, int stop)
|
||||||
int pos;
|
|
||||||
struct re_registers *regs;
|
|
||||||
int stop;
|
|
||||||
#endif /* BYTE */
|
#endif /* BYTE */
|
||||||
{
|
{
|
||||||
/* General temporaries. */
|
/* General temporaries. */
|
||||||
|
@ -7593,9 +7492,8 @@ byte_re_match_2_internal (bufp, string1, size1,string2, size2, pos,
|
||||||
We don't handle duplicates properly (yet). */
|
We don't handle duplicates properly (yet). */
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
PREFIX(group_match_null_string_p) (p, end, reg_info)
|
PREFIX(group_match_null_string_p) (UCHAR_T **p, UCHAR_T *end,
|
||||||
UCHAR_T **p, *end;
|
PREFIX(register_info_type) *reg_info)
|
||||||
PREFIX(register_info_type) *reg_info;
|
|
||||||
{
|
{
|
||||||
int mcnt;
|
int mcnt;
|
||||||
/* Point to after the args to the start_memory. */
|
/* Point to after the args to the start_memory. */
|
||||||
|
@ -7705,9 +7603,8 @@ PREFIX(group_match_null_string_p) (p, end, reg_info)
|
||||||
byte past the last. The alternative can contain groups. */
|
byte past the last. The alternative can contain groups. */
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
PREFIX(alt_match_null_string_p) (p, end, reg_info)
|
PREFIX(alt_match_null_string_p) (UCHAR_T *p, UCHAR_T *end,
|
||||||
UCHAR_T *p, *end;
|
PREFIX(register_info_type) *reg_info)
|
||||||
PREFIX(register_info_type) *reg_info;
|
|
||||||
{
|
{
|
||||||
int mcnt;
|
int mcnt;
|
||||||
UCHAR_T *p1 = p;
|
UCHAR_T *p1 = p;
|
||||||
|
@ -7742,9 +7639,8 @@ PREFIX(alt_match_null_string_p) (p, end, reg_info)
|
||||||
Sets P to one after the op and its arguments, if any. */
|
Sets P to one after the op and its arguments, if any. */
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
PREFIX(common_op_match_null_string_p) (p, end, reg_info)
|
PREFIX(common_op_match_null_string_p) (UCHAR_T **p, UCHAR_T *end,
|
||||||
UCHAR_T **p, *end;
|
PREFIX(register_info_type) *reg_info)
|
||||||
PREFIX(register_info_type) *reg_info;
|
|
||||||
{
|
{
|
||||||
int mcnt;
|
int mcnt;
|
||||||
boolean ret;
|
boolean ret;
|
||||||
|
@ -7830,10 +7726,8 @@ PREFIX(common_op_match_null_string_p) (p, end, reg_info)
|
||||||
bytes; nonzero otherwise. */
|
bytes; nonzero otherwise. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
PREFIX(bcmp_translate) (s1, s2, len, translate)
|
PREFIX(bcmp_translate) (const CHAR_T *s1, const CHAR_T *s2, register int len,
|
||||||
const CHAR_T *s1, *s2;
|
RE_TRANSLATE_TYPE translate)
|
||||||
register int len;
|
|
||||||
RE_TRANSLATE_TYPE translate;
|
|
||||||
{
|
{
|
||||||
register const UCHAR_T *p1 = (const UCHAR_T *) s1;
|
register const UCHAR_T *p1 = (const UCHAR_T *) s1;
|
||||||
register const UCHAR_T *p2 = (const UCHAR_T *) s2;
|
register const UCHAR_T *p2 = (const UCHAR_T *) s2;
|
||||||
|
@ -7866,10 +7760,8 @@ PREFIX(bcmp_translate) (s1, s2, len, translate)
|
||||||
We call regex_compile to do the actual compilation. */
|
We call regex_compile to do the actual compilation. */
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
re_compile_pattern (pattern, length, bufp)
|
re_compile_pattern (const char *pattern, size_t length,
|
||||||
const char *pattern;
|
struct re_pattern_buffer *bufp)
|
||||||
size_t length;
|
|
||||||
struct re_pattern_buffer *bufp;
|
|
||||||
{
|
{
|
||||||
reg_errcode_t ret;
|
reg_errcode_t ret;
|
||||||
|
|
||||||
|
@ -7915,8 +7807,7 @@ char *
|
||||||
regcomp/regexec below without link errors. */
|
regcomp/regexec below without link errors. */
|
||||||
weak_function
|
weak_function
|
||||||
#endif
|
#endif
|
||||||
re_comp (s)
|
re_comp (const char *s)
|
||||||
const char *s;
|
|
||||||
{
|
{
|
||||||
reg_errcode_t ret;
|
reg_errcode_t ret;
|
||||||
|
|
||||||
|
@ -7964,8 +7855,7 @@ int
|
||||||
#ifdef _LIBC
|
#ifdef _LIBC
|
||||||
weak_function
|
weak_function
|
||||||
#endif
|
#endif
|
||||||
re_exec (s)
|
re_exec (const char *s)
|
||||||
const char *s;
|
|
||||||
{
|
{
|
||||||
const int len = strlen (s);
|
const int len = strlen (s);
|
||||||
return
|
return
|
||||||
|
@ -8014,10 +7904,7 @@ re_exec (s)
|
||||||
the return codes and their meanings.) */
|
the return codes and their meanings.) */
|
||||||
|
|
||||||
int
|
int
|
||||||
regcomp (preg, pattern, cflags)
|
regcomp (regex_t *preg, const char *pattern, int cflags)
|
||||||
regex_t *preg;
|
|
||||||
const char *pattern;
|
|
||||||
int cflags;
|
|
||||||
{
|
{
|
||||||
reg_errcode_t ret;
|
reg_errcode_t ret;
|
||||||
reg_syntax_t syntax
|
reg_syntax_t syntax
|
||||||
|
@ -8110,12 +7997,8 @@ weak_alias (__regcomp, regcomp)
|
||||||
We return 0 if we find a match and REG_NOMATCH if not. */
|
We return 0 if we find a match and REG_NOMATCH if not. */
|
||||||
|
|
||||||
int
|
int
|
||||||
regexec (preg, string, nmatch, pmatch, eflags)
|
regexec (const regex_t *preg, const char *string, size_t nmatch,
|
||||||
const regex_t *preg;
|
regmatch_t pmatch[], int eflags)
|
||||||
const char *string;
|
|
||||||
size_t nmatch;
|
|
||||||
regmatch_t pmatch[];
|
|
||||||
int eflags;
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct re_registers regs;
|
struct re_registers regs;
|
||||||
|
@ -8177,11 +8060,8 @@ weak_alias (__regexec, regexec)
|
||||||
from either regcomp or regexec. We don't use PREG here. */
|
from either regcomp or regexec. We don't use PREG here. */
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
regerror (errcode, preg, errbuf, errbuf_size)
|
regerror (int errcode, const regex_t *preg ATTRIBUTE_UNUSED,
|
||||||
int errcode;
|
char *errbuf, size_t errbuf_size)
|
||||||
const regex_t *preg ATTRIBUTE_UNUSED;
|
|
||||||
char *errbuf;
|
|
||||||
size_t errbuf_size;
|
|
||||||
{
|
{
|
||||||
const char *msg;
|
const char *msg;
|
||||||
size_t msg_size;
|
size_t msg_size;
|
||||||
|
@ -8224,8 +8104,7 @@ weak_alias (__regerror, regerror)
|
||||||
/* Free dynamically allocated space used by PREG. */
|
/* Free dynamically allocated space used by PREG. */
|
||||||
|
|
||||||
void
|
void
|
||||||
regfree (preg)
|
regfree (regex_t *preg)
|
||||||
regex_t *preg;
|
|
||||||
{
|
{
|
||||||
if (preg->buffer != NULL)
|
if (preg->buffer != NULL)
|
||||||
free (preg->buffer);
|
free (preg->buffer);
|
||||||
|
|
Loading…
Reference in a new issue