version 1.1.1.1, 2012/02/21 17:26:12
|
version 1.1.1.2, 2016/11/02 10:09:11
|
Line 209 init_syntax_once ()
|
Line 209 init_syntax_once ()
|
# define SYNTAX(c) re_syntax_table[c] |
# define SYNTAX(c) re_syntax_table[c] |
|
|
#endif /* not emacs */ |
#endif /* not emacs */ |
| |
/* Get the interface, including the syntax bits. */ |
/* Get the interface, including the syntax bits. */ |
#include <regex-gnu.h> |
#include <regex-gnu.h> |
|
|
Line 279 init_syntax_once ()
|
Line 279 init_syntax_once ()
|
/* As in Harbison and Steele. */ |
/* As in Harbison and Steele. */ |
# define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128) |
# define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128) |
#endif |
#endif |
| |
/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we |
/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we |
use `alloca' instead of `malloc'. This is because using malloc in |
use `alloca' instead of `malloc'. This is because using malloc in |
re_search* or re_match* could cause memory leaks when C-g is used in |
re_search* or re_match* could cause memory leaks when C-g is used in |
Line 388 static int re_match_2_internal PARAMS ((struct re_patt
|
Line 388 static int re_match_2_internal PARAMS ((struct re_patt
|
int pos, |
int pos, |
struct re_registers *regs, |
struct re_registers *regs, |
int stop)); |
int stop)); |
| |
/* These are the command codes that appear in compiled regular |
/* These are the command codes that appear in compiled regular |
expressions. Some opcodes are followed by argument bytes. A |
expressions. Some opcodes are followed by argument bytes. A |
command code can specify any interpretation whatsoever for its |
command code can specify any interpretation whatsoever for its |
Line 527 typedef enum
|
Line 527 typedef enum
|
notsyntaxspec |
notsyntaxspec |
#endif /* emacs */ |
#endif /* emacs */ |
} re_opcode_t; |
} re_opcode_t; |
| |
/* Common operations on the compiled pattern. */ |
/* Common operations on the compiled pattern. */ |
|
|
/* Store NUMBER in two contiguous bytes starting at DESTINATION. */ |
/* Store NUMBER in two contiguous bytes starting at DESTINATION. */ |
Line 604 extract_number_and_incr (destination, source)
|
Line 604 extract_number_and_incr (destination, source)
|
# endif /* not EXTRACT_MACROS */ |
# endif /* not EXTRACT_MACROS */ |
|
|
#endif /* DEBUG */ |
#endif /* DEBUG */ |
| |
/* If DEBUG is defined, Regex prints many voluminous messages about what |
/* If DEBUG is defined, Regex prints many voluminous messages about what |
it is doing (if the variable `debug' is nonzero). If linked with the |
it is doing (if the variable `debug' is nonzero). If linked with the |
main program in `iregex.c', you can enter patterns and strings |
main program in `iregex.c', you can enter patterns and strings |
Line 977 printchar (c)
|
Line 977 printchar (c)
|
# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) |
# define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) |
|
|
#endif /* not DEBUG */ |
#endif /* not DEBUG */ |
| |
/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can |
/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can |
also be assigned to arbitrarily: each pattern buffer stores its own |
also be assigned to arbitrarily: each pattern buffer stores its own |
syntax, so it can be changed between regex compilations. */ |
syntax, so it can be changed between regex compilations. */ |
Line 1011 re_set_syntax (syntax)
|
Line 1011 re_set_syntax (syntax)
|
#ifdef _LIBC |
#ifdef _LIBC |
weak_alias (__re_set_syntax, re_set_syntax) |
weak_alias (__re_set_syntax, re_set_syntax) |
#endif |
#endif |
| |
/* This table gives an error message for each of the error codes listed |
/* This table gives an error message for each of the error codes listed |
in regex.h. Obviously the order here has to be same as there. |
in regex.h. Obviously the order here has to be same as there. |
POSIX doesn't require that we do anything for REG_NOERROR, |
POSIX doesn't require that we do anything for REG_NOERROR, |
Line 1091 static const size_t re_error_msgid_idx[] =
|
Line 1091 static const size_t re_error_msgid_idx[] =
|
REG_ESIZE_IDX, |
REG_ESIZE_IDX, |
REG_ERPAREN_IDX |
REG_ERPAREN_IDX |
}; |
}; |
| |
/* Avoiding alloca during matching, to placate r_alloc. */ |
/* Avoiding alloca during matching, to placate r_alloc. */ |
|
|
/* Define MATCH_MAY_ALLOCATE unless we need to make sure that the |
/* Define MATCH_MAY_ALLOCATE unless we need to make sure that the |
Line 1129 static const size_t re_error_msgid_idx[] =
|
Line 1129 static const size_t re_error_msgid_idx[] =
|
# undef MATCH_MAY_ALLOCATE |
# undef MATCH_MAY_ALLOCATE |
#endif |
#endif |
|
|
| |
/* Failure stack declarations and macros; both re_compile_fastmap and |
/* Failure stack declarations and macros; both re_compile_fastmap and |
re_match_2 use a failure stack. These have to be macros because of |
re_match_2 use a failure stack. These have to be macros because of |
REGEX_ALLOCATE_STACK. */ |
REGEX_ALLOCATE_STACK. */ |
Line 1495 typedef struct
|
Line 1495 typedef struct
|
} /* POP_FAILURE_POINT */ |
} /* POP_FAILURE_POINT */ |
|
|
|
|
| |
/* Structure for per-register (a.k.a. per-group) information. |
/* Structure for per-register (a.k.a. per-group) information. |
Other register information, such as the |
Other register information, such as the |
starting and ending positions (which are addresses), and the list of |
starting and ending positions (which are addresses), and the list of |
Line 1555 typedef union
|
Line 1555 typedef union
|
static char reg_unset_dummy; |
static char reg_unset_dummy; |
#define REG_UNSET_VALUE (®_unset_dummy) |
#define REG_UNSET_VALUE (®_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 reg_errcode_t regex_compile _RE_ARGS ((const char *pattern, size_t size, |
static reg_errcode_t regex_compile _RE_ARGS ((const char *pattern, size_t size, |
Line 1809 typedef struct
|
Line 1809 typedef struct
|
|| STREQ (string, "punct") || STREQ (string, "graph") \ |
|| STREQ (string, "punct") || STREQ (string, "graph") \ |
|| STREQ (string, "cntrl") || STREQ (string, "blank")) |
|| STREQ (string, "cntrl") || STREQ (string, "blank")) |
#endif |
#endif |
| |
#ifndef MATCH_MAY_ALLOCATE |
#ifndef MATCH_MAY_ALLOCATE |
|
|
/* If we cannot allocate large objects within re_match_2_internal, |
/* If we cannot allocate large objects within re_match_2_internal, |
Line 1857 regex_grow_registers (num_regs)
|
Line 1857 regex_grow_registers (num_regs)
|
} |
} |
|
|
#endif /* not MATCH_MAY_ALLOCATE */ |
#endif /* not MATCH_MAY_ALLOCATE */ |
| |
static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type |
static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type |
compile_stack, |
compile_stack, |
regnum_t regnum)); |
regnum_t regnum)); |
Line 2991 regex_compile (pattern, size, syntax, bufp)
|
Line 2991 regex_compile (pattern, size, syntax, bufp)
|
|
|
return REG_NOERROR; |
return REG_NOERROR; |
} /* regex_compile */ |
} /* regex_compile */ |
| |
/* Subroutines for `regex_compile'. */ |
/* Subroutines for `regex_compile'. */ |
|
|
/* Store OP at LOC followed by two-byte integer parameter ARG. */ |
/* Store OP at LOC followed by two-byte integer parameter ARG. */ |
Line 3178 compile_range (p_ptr, pend, translate, syntax, b)
|
Line 3178 compile_range (p_ptr, pend, translate, syntax, b)
|
|
|
return REG_NOERROR; |
return REG_NOERROR; |
} |
} |
| |
/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in |
/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in |
BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible |
BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible |
characters can start a string that matches the pattern. This fastmap |
characters can start a string that matches the pattern. This fastmap |
Line 3484 re_compile_fastmap (bufp)
|
Line 3484 re_compile_fastmap (bufp)
|
#ifdef _LIBC |
#ifdef _LIBC |
weak_alias (__re_compile_fastmap, re_compile_fastmap) |
weak_alias (__re_compile_fastmap, re_compile_fastmap) |
#endif |
#endif |
| |
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and |
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and |
ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use |
ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use |
this memory for recording register information. STARTS and ENDS |
this memory for recording register information. STARTS and ENDS |
Line 3522 re_set_registers (bufp, regs, num_regs, starts, ends)
|
Line 3522 re_set_registers (bufp, regs, num_regs, starts, ends)
|
#ifdef _LIBC |
#ifdef _LIBC |
weak_alias (__re_set_registers, re_set_registers) |
weak_alias (__re_set_registers, re_set_registers) |
#endif |
#endif |
| |
/* Searching routines. */ |
/* Searching routines. */ |
|
|
/* Like re_search_2, below, but only one string is specified, and |
/* Like re_search_2, below, but only one string is specified, and |
Line 3704 re_search_2 (bufp, string1, size1, string2, size2, sta
|
Line 3704 re_search_2 (bufp, string1, size1, string2, size2, sta
|
#ifdef _LIBC |
#ifdef _LIBC |
weak_alias (__re_search_2, re_search_2) |
weak_alias (__re_search_2, re_search_2) |
#endif |
#endif |
| |
/* This converts PTR, a pointer into one of the search strings `string1' |
/* This converts PTR, a pointer into one of the search strings `string1' |
and `string2' into an offset from the beginning of that string. */ |
and `string2' into an offset from the beginning of that string. */ |
#define POINTER_TO_OFFSET(ptr) \ |
#define POINTER_TO_OFFSET(ptr) \ |
Line 3783 weak_alias (__re_search_2, re_search_2)
|
Line 3783 weak_alias (__re_search_2, re_search_2)
|
to actually save any registers when none are active. */ |
to actually save any registers when none are active. */ |
#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH) |
#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH) |
#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1) |
#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1) |
| |
/* Matching routines. */ |
/* Matching routines. */ |
|
|
#ifndef emacs /* Emacs never uses this. */ |
#ifndef emacs /* Emacs never uses this. */ |
Line 5248 re_match_2_internal (bufp, string1, size1, string2, si
|
Line 5248 re_match_2_internal (bufp, string1, size1, string2, si
|
|
|
return -1; /* Failure to match. */ |
return -1; /* Failure to match. */ |
} /* re_match_2 */ |
} /* re_match_2 */ |
| |
/* Subroutine definitions for re_match_2. */ |
/* Subroutine definitions for re_match_2. */ |
|
|
|
|
Line 5511 bcmp_translate (s1, s2, len, translate)
|
Line 5511 bcmp_translate (s1, s2, len, translate)
|
} |
} |
return 0; |
return 0; |
} |
} |
| |
/* Entry points for GNU code. */ |
/* Entry points for GNU code. */ |
|
|
/* re_compile_pattern is the GNU regular expression compiler: it |
/* re_compile_pattern is the GNU regular expression compiler: it |
Line 5552 re_compile_pattern (pattern, length, bufp)
|
Line 5552 re_compile_pattern (pattern, length, bufp)
|
#ifdef _LIBC |
#ifdef _LIBC |
weak_alias (__re_compile_pattern, re_compile_pattern) |
weak_alias (__re_compile_pattern, re_compile_pattern) |
#endif |
#endif |
| |
/* Entry points compatible with 4.2 BSD regex library. We don't define |
/* Entry points compatible with 4.2 BSD regex library. We don't define |
them unless specifically requested. */ |
them unless specifically requested. */ |
|
|
Line 5623 re_exec (s)
|
Line 5623 re_exec (s)
|
} |
} |
|
|
#endif /* _REGEX_RE_COMP */ |
#endif /* _REGEX_RE_COMP */ |
| |
/* POSIX.2 functions. Don't define these for Emacs. */ |
/* POSIX.2 functions. Don't define these for Emacs. */ |
|
|
#ifndef emacs |
#ifndef emacs |