regex.c File Reference

#include <sys/types.h>
#include <strings.h>
#include "regex.h"
#include <ctype.h>
Include dependency graph for regex.c:

Go to the source code of this file.

Classes

struct  compile_stack_elt_t
struct  compile_stack_type
struct  fail_stack_type
union  register_info_type

Defines

#define _GNU_SOURCE
#define assert(e)
#define AT_STRINGS_BEG(d)   ((d) == (size1 ? string1 : string2) || !size2)
#define AT_STRINGS_END(d)   ((d) == end2)
#define AT_WORD_BOUNDARY(d)
#define BUF_PUSH(c)
#define BUF_PUSH_2(c1, c2)
#define BUF_PUSH_3(c1, c2, c3)
#define BYTEWIDTH   8
#define CHAR_CLASS_MAX_LENGTH   6
#define CHAR_SET_SIZE   256
#define COMPILE_STACK_EMPTY   (compile_stack.avail == 0)
#define COMPILE_STACK_FULL   (compile_stack.avail == compile_stack.size)
#define COMPILE_STACK_TOP   (compile_stack.stack[compile_stack.avail])
#define const
#define DEBUG_POP(item_addr)
#define DEBUG_PRINT1(x)
#define DEBUG_PRINT2(x1, x2)
#define DEBUG_PRINT3(x1, x2, x3)
#define DEBUG_PRINT4(x1, x2, x3, x4)
#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e)
#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2)
#define DEBUG_PUSH(item)
#define DEBUG_STATEMENT(e)
#define DOUBLE_FAIL_STACK(fail_stack)
#define EVER_MATCHED_SOMETHING(R)   ((R).bits.ever_matched_something)
#define EXTEND_BUFFER()
#define EXTRACT_NUMBER(destination, source)
#define EXTRACT_NUMBER_AND_INCR(destination, source)
#define FAIL_STACK_EMPTY()   (fail_stack.avail == 0)
#define FAIL_STACK_FULL()   (fail_stack.avail == fail_stack.size)
#define FAIL_STACK_PTR_EMPTY()   (fail_stack_ptr->avail == 0)
#define FAIL_STACK_TOP()   (fail_stack.stack[fail_stack.avail])
#define false   0
#define FIRST_STRING_P(ptr)   (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
#define FREE_VARIABLES()   alloca (0)
#define GET_BUFFER_SPACE(n)
#define GET_UNSIGNED_NUMBER(num)
#define INIT_BUF_SIZE   32
#define INIT_COMPILE_STACK_SIZE   32
#define INIT_FAIL_STACK()
#define INIT_FAILURE_ALLOC   5
#define INSERT_JUMP(op, loc, to)   insert_op1 (op, loc, (to) - (loc) - 3, b)
#define INSERT_JUMP2(op, loc, to, arg)   insert_op2 (op, loc, (to) - (loc) - 3, arg, b)
#define IS_ACTIVE(R)   ((R).bits.is_active)
#define IS_CHAR_CLASS(string)
#define ISALNUM(c)   (isascii (c) && isalnum (c))
#define ISALPHA(c)   (isascii (c) && isalpha (c))
#define isascii(c)   1
#define ISBLANK(c)   ((c) == ' ' || (c) == '\t')
#define ISCNTRL(c)   (isascii (c) && iscntrl (c))
#define ISDIGIT(c)   (isascii (c) && isdigit (c))
#define ISGRAPH(c)   (isascii (c) && isprint (c) && !isspace (c))
#define ISLOWER(c)   (isascii (c) && islower (c))
#define ISPRINT(c)   (isascii (c) && isprint (c))
#define ISPUNCT(c)   (isascii (c) && ispunct (c))
#define ISSPACE(c)   (isascii (c) && isspace (c))
#define ISUPPER(c)   (isascii (c) && isupper (c))
#define ISXDIGIT(c)   (isascii (c) && isxdigit (c))
#define MATCH_NULL_UNSET_VALUE   3
#define MATCHED_SOMETHING(R)   ((R).bits.matched_something)
#define MATCHING_IN_FIRST_STRING   (dend == end_match_1)
#define MAX(a, b)   ((a) > (b) ? (a) : (b))
#define MAX_BUF_SIZE   (1L << 16)
#define MAX_FAILURE_ITEMS   ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
#define MAX_REGNUM   255
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
#define NO_HIGHEST_ACTIVE_REG   (1 << BYTEWIDTH)
#define NO_LOWEST_ACTIVE_REG   (NO_HIGHEST_ACTIVE_REG + 1)
#define NULL   0
#define NUM_FAILURE_ITEMS
#define NUM_NONREG_ITEMS   4
#define NUM_REG_ITEMS   3
#define PATFETCH(c)
#define PATFETCH_RAW(c)
#define PATUNFETCH   p--
#define POINTER_TO_OFFSET(ptr)   (FIRST_STRING_P (ptr) ? (ptr) - string1 : (ptr) - string2 + size1)
#define POP_FAILURE_ITEM()   fail_stack.stack[--fail_stack.avail]
#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)
#define PREFETCH()
#define PUSH_FAILURE_ITEM(item)   fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item
#define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code)
#define PUSH_PATTERN_OP(pattern_op, fail_stack)
#define REG_MATCH_NULL_STRING_P(R)   ((R).bits.match_null_string_p)
#define REG_UNSET(e)   ((e) == REG_UNSET_VALUE)
#define REG_UNSET_VALUE   ((char *) -1)
#define REGEX_ALLOCATE   alloca
#define REGEX_REALLOCATE(source, osize, nsize)
#define REGEX_TALLOC(n, t)   ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
#define REMAINING_AVAIL_SLOTS   ((fail_stack).size - (fail_stack).avail)
#define RETALLOC(addr, n, t)   ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
#define SET_LIST_BIT(c)
#define SET_REGS_MATCHED()
#define SIGN_EXTEND_CHAR(c)   ((((unsigned char) (c)) ^ 128) - 128)
#define STORE_JUMP(op, loc, to)   store_op1 (op, loc, (to) - (loc) - 3)
#define STORE_JUMP2(op, loc, to, arg)   store_op2 (op, loc, (to) - (loc) - 3, arg)
#define STORE_NUMBER(destination, number)
#define STORE_NUMBER_AND_INCR(destination, number)
#define STREQ(s1, s2)   ((strcmp (s1, s2) == 0))
#define Sword   1
#define SYNTAX(c)   re_syntax_table[c]
#define TALLOC(n, t)   ((t *) malloc ((n) * sizeof (t)))
#define TRANSLATE(d)   (translate ? translate[(unsigned char) (d)] : (d))
#define true   1
#define WORDCHAR_P(d)

Typedefs

typedef char boolean
typedef const unsigned char * fail_stack_elt_t
typedef int pattern_offset_t
typedef unsigned regnum_t

Enumerations

enum  re_opcode_t {
  no_op = 0,
  exactn = 1,
  anychar,
  charset,
  charset_not,
  start_memory,
  stop_memory,
  duplicate,
  begline,
  endline,
  begbuf,
  endbuf,
  jump,
  jump_past_alt,
  on_failure_jump,
  on_failure_keep_string_jump,
  pop_failure_jump,
  maybe_pop_jump,
  dummy_failure_jump,
  push_dummy_failure,
  succeed_n,
  jump_n,
  set_number_at,
  wordchar,
  notwordchar,
  wordbeg,
  wordend,
  wordbound,
  notwordbound
}

Functions

char * alloca ()
static boolean alt_match_null_string_p (unsigned char *p, unsigned char *end, register_info_type *reg_info)
static boolean alt_match_null_string_p ()
static boolean at_begline_loc_p (char *pattern, char *p, reg_syntax_t syntax) const
static boolean at_begline_loc_p ()
static boolean at_endline_loc_p (char *p, char *pend, int syntax) const
static boolean at_endline_loc_p ()
static int bcmp_translate (unsigned char *s1, unsigned char *s2, int len, char *translate)
static int bcmp_translate ()
static boolean common_op_match_null_string_p (unsigned char **p, unsigned char *end, register_info_type *reg_info)
static boolean common_op_match_null_string_p ()
static reg_errcode_t compile_range (char **p_ptr, char *pend, char *translate, reg_syntax_t syntax, unsigned char *b) const
static reg_errcode_t compile_range ()
static boolean group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum)
static boolean group_in_compile_stack ()
static boolean group_match_null_string_p (unsigned char **p, unsigned char *end, register_info_type *reg_info)
static boolean group_match_null_string_p ()
static void init_syntax_once ()
static void insert_op1 (re_opcode_t op, unsigned char *loc, int arg, unsigned char *end)
static void insert_op1 ()
static void insert_op2 (re_opcode_t op, unsigned char *loc, int arg1, int arg2, unsigned char *end)
static void insert_op2 ()
char * malloc ()
char * re_comp (char *s) const
int re_compile_fastmap (struct re_pattern_buffer *bufp)
const char * re_compile_pattern (char *pattern, int length, struct re_pattern_buffer *bufp) const
int re_exec (char *s) const
int re_match (struct re_pattern_buffer *bufp, const char *string, int size, int pos, struct re_registers *regs)
int re_match_2 (struct re_pattern_buffer *bufp, const char *string1, int size1, const char *string2, int size2, int pos, struct re_registers *regs, int stop)
int re_search (struct re_pattern_buffer *bufp, const char *string, int size, int startpos, int range, struct re_registers *regs)
int re_search_2 (struct re_pattern_buffer *bufp, const char *string1, int size1, const char *string2, int size2, int startpos, int range, struct re_registers *regs, int stop)
void re_set_registers (struct re_pattern_buffer *bufp, struct re_registers *regs, unsigned num_regs, regoff_t *starts, regoff_t *ends)
reg_syntax_t re_set_syntax (reg_syntax_t syntax)
char * realloc ()
int regcomp (regex_t *preg, const char *pattern, int cflags)
size_t regerror (int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
static reg_errcode_t regex_compile (char const *pattern, int size, reg_syntax_t syntax, struct re_pattern_buffer *bufp)
int regexec (regex_t *preg, const char *string, size_t nmatch, pmatch, int eflags) const
int regexec1 (regex_t *preg, const char *string, int stringLength, size_t nmatch, pmatch, int eflags) const
void regfree (regex_t *preg)
static void store_op1 (re_opcode_t op, unsigned char *loc, int arg)
static void store_op1 ()
static void store_op2 (re_opcode_t op, unsigned char *loc, int arg1, int arg2)
static void store_op2 ()

Variables

static struct re_pattern_buffer re_comp_buf
static const char * re_error_msg []
int re_max_failures = 2000
reg_syntax_t re_syntax_options = RE_SYNTAX_EMACS
static char re_syntax_table [CHAR_SET_SIZE]

Define Documentation

#define _GNU_SOURCE

Definition at line 45 of file regex.c.

#define assert (  ) 

Definition at line 834 of file regex.c.

#define AT_STRINGS_BEG (  )     ((d) == (size1 ? string1 : string2) || !size2)

Definition at line 3222 of file regex.c.

#define AT_STRINGS_END (  )     ((d) == end2)

Definition at line 3223 of file regex.c.

#define AT_WORD_BOUNDARY (  ) 
Value:
(AT_STRINGS_BEG (d) || AT_STRINGS_END (d)                             \
   || WORDCHAR_P (d - 1) != WORDCHAR_P (d))

Definition at line 3237 of file regex.c.

#define BUF_PUSH (  ) 
Value:
do {                                                                  \
    GET_BUFFER_SPACE (1);                                               \
    *b++ = (unsigned char) (c);                                         \
  } while (0)

Definition at line 1024 of file regex.c.

#define BUF_PUSH_2 ( c1,
c2   ) 
Value:
do {                                                                  \
    GET_BUFFER_SPACE (2);                                               \
    *b++ = (unsigned char) (c1);                                        \
    *b++ = (unsigned char) (c2);                                        \
  } while (0)

Definition at line 1032 of file regex.c.

#define BUF_PUSH_3 ( c1,
c2,
c3   ) 
Value:
do {                                                                  \
    GET_BUFFER_SPACE (3);                                               \
    *b++ = (unsigned char) (c1);                                        \
    *b++ = (unsigned char) (c2);                                        \
    *b++ = (unsigned char) (c3);                                        \
  } while (0)

Definition at line 1041 of file regex.c.

#define BYTEWIDTH   8

Definition at line 258 of file regex.c.

#define CHAR_CLASS_MAX_LENGTH   6

Definition at line 1144 of file regex.c.

#define CHAR_SET_SIZE   256

Definition at line 107 of file regex.c.

#define COMPILE_STACK_EMPTY   (compile_stack.avail == 0)

Definition at line 1114 of file regex.c.

#define COMPILE_STACK_FULL   (compile_stack.avail == compile_stack.size)

Definition at line 1115 of file regex.c.

#define COMPILE_STACK_TOP   (compile_stack.stack[compile_stack.avail])

Definition at line 1118 of file regex.c.

#define const

Definition at line 17 of file regex.c.

#define DEBUG_POP ( item_addr   ) 

Definition at line 2456 of file regex.c.

#define DEBUG_PRINT1 (  ) 

Definition at line 837 of file regex.c.

#define DEBUG_PRINT2 ( x1,
x2   ) 

Definition at line 838 of file regex.c.

#define DEBUG_PRINT3 ( x1,
x2,
x3   ) 

Definition at line 839 of file regex.c.

#define DEBUG_PRINT4 ( x1,
x2,
x3,
x4   ) 

Definition at line 840 of file regex.c.

#define DEBUG_PRINT_COMPILED_PATTERN ( p,
s,
 ) 

Definition at line 841 of file regex.c.

#define DEBUG_PRINT_DOUBLE_STRING ( w,
s1,
sz1,
s2,
sz2   ) 

Definition at line 842 of file regex.c.

#define DEBUG_PUSH ( item   ) 

Definition at line 2455 of file regex.c.

#define DEBUG_STATEMENT (  ) 

Definition at line 836 of file regex.c.

#define DOUBLE_FAIL_STACK ( fail_stack   ) 
Value:
((fail_stack).size > re_max_failures * MAX_FAILURE_ITEMS              \
   ? 0                                                                  \
   : ((fail_stack).stack = (fail_stack_elt_t *)                         \
        REGEX_REALLOCATE ((fail_stack).stack,                           \
          (fail_stack).size * sizeof (fail_stack_elt_t),                \
          ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)),        \
                                                                        \
      (fail_stack).stack == NULL                                        \
      ? 0                                                               \
      : ((fail_stack).size <<= 1,                                       \
         1)))

Definition at line 2416 of file regex.c.

#define EVER_MATCHED_SOMETHING (  )     ((R).bits.ever_matched_something)

Definition at line 3172 of file regex.c.

 
#define EXTEND_BUFFER (  ) 
Value:
do {                                                                  \
    unsigned char *old_buffer = bufp->buffer;                           \
    if (bufp->allocated == MAX_BUF_SIZE)                                \
      return REG_ESIZE;                                                 \
    bufp->allocated <<= 1;                                              \
    if (bufp->allocated > MAX_BUF_SIZE)                                 \
      bufp->allocated = MAX_BUF_SIZE;                                   \
    bufp->buffer = (unsigned char *) realloc (bufp->buffer, bufp->allocated);\
    if (bufp->buffer == NULL)                                           \
      return REG_ESPACE;                                                \
    /* If the buffer moved, move all the pointers into it.  */          \
    if (old_buffer != bufp->buffer)                                     \
      {                                                                 \
        b = (b - old_buffer) + bufp->buffer;                            \
        begalt = (begalt - old_buffer) + bufp->buffer;                  \
        if (fixup_alt_jump)                                             \
          fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\
        if (laststart)                                                  \
          laststart = (laststart - old_buffer) + bufp->buffer;          \
        if (pending_exact)                                              \
          pending_exact = (pending_exact - old_buffer) + bufp->buffer;  \
      }                                                                 \
  } while (0)

Definition at line 1078 of file regex.c.

#define EXTRACT_NUMBER ( destination,
source   ) 
Value:
do {                                                                  \
    (destination) = *(source) & 0377;                                   \
    (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8;           \
  } while (0)

Definition at line 432 of file regex.c.

#define EXTRACT_NUMBER_AND_INCR ( destination,
source   ) 
Value:
do {                                                                  \
    EXTRACT_NUMBER (destination, source);                               \
    (source) += 2;                                                      \
  } while (0)

Definition at line 459 of file regex.c.

 
#define FAIL_STACK_EMPTY (  )     (fail_stack.avail == 0)

Definition at line 2388 of file regex.c.

 
#define FAIL_STACK_FULL (  )     (fail_stack.avail == fail_stack.size)

Definition at line 2390 of file regex.c.

 
#define FAIL_STACK_PTR_EMPTY (  )     (fail_stack_ptr->avail == 0)

Definition at line 2389 of file regex.c.

 
#define FAIL_STACK_TOP (  )     (fail_stack.stack[fail_stack.avail])

Definition at line 2391 of file regex.c.

#define false   0

Definition at line 266 of file regex.c.

#define FIRST_STRING_P ( ptr   )     (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)

Definition at line 250 of file regex.c.

 
#define FREE_VARIABLES (  )     alloca (0)

Definition at line 3260 of file regex.c.

#define GET_BUFFER_SPACE (  ) 
Value:
while (b - bufp->buffer + (n) > bufp->allocated)                    \
      EXTEND_BUFFER ()

Definition at line 1019 of file regex.c.

#define GET_UNSIGNED_NUMBER ( num   ) 
Value:
{ if (p != pend)                                                      \
     {                                                                  \
       PATFETCH (c);                                                    \
       while (ISDIGIT (c))                                              \
         {                                                              \
           if (num < 0)                                                 \
              num = 0;                                                  \
           num = num * 10 + c - '0';                                    \
           if (p == pend)                                               \
              break;                                                    \
           PATFETCH (c);                                                \
         }                                                              \
       }                                                                \
    }

Definition at line 1128 of file regex.c.

#define INIT_BUF_SIZE   32

Definition at line 1016 of file regex.c.

#define INIT_COMPILE_STACK_SIZE   32

Definition at line 1112 of file regex.c.

 
#define INIT_FAIL_STACK (  ) 
Value:
do {                                                                  \
    fail_stack.stack = (fail_stack_elt_t *)                             \
      REGEX_ALLOCATE (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t));  \
                                                                        \
    if (fail_stack.stack == NULL)                                       \
      return -2;                                                        \
                                                                        \
    fail_stack.size = INIT_FAILURE_ALLOC;                               \
    fail_stack.avail = 0;                                               \
  } while (0)

Definition at line 2396 of file regex.c.

#define INIT_FAILURE_ALLOC   5

Definition at line 2370 of file regex.c.

#define INSERT_JUMP ( op,
loc,
to   )     insert_op1 (op, loc, (to) - (loc) - 3, b)

Definition at line 1060 of file regex.c.

#define INSERT_JUMP2 ( op,
loc,
to,
arg   )     insert_op2 (op, loc, (to) - (loc) - 3, arg, b)

Definition at line 1064 of file regex.c.

#define IS_ACTIVE (  )     ((R).bits.is_active)

Definition at line 3170 of file regex.c.

#define IS_CHAR_CLASS ( string   ) 
Value:
(STREQ (string, "alpha") || STREQ (string, "upper")                  \
    || STREQ (string, "lower") || STREQ (string, "digit")               \
    || STREQ (string, "alnum") || STREQ (string, "xdigit")              \
    || STREQ (string, "space") || STREQ (string, "print")               \
    || STREQ (string, "punct") || STREQ (string, "graph")               \
    || STREQ (string, "cntrl") || STREQ (string, "blank"))

Definition at line 1146 of file regex.c.

#define ISALNUM (  )     (isascii (c) && isalnum (c))

Definition at line 176 of file regex.c.

#define ISALPHA (  )     (isascii (c) && isalpha (c))

Definition at line 177 of file regex.c.

#define isascii (  )     1

Definition at line 160 of file regex.c.

#define ISBLANK (  )     ((c) == ' ' || (c) == '\t')

Definition at line 166 of file regex.c.

#define ISCNTRL (  )     (isascii (c) && iscntrl (c))

Definition at line 178 of file regex.c.

#define ISDIGIT (  )     (isascii (c) && isdigit (c))

Definition at line 175 of file regex.c.

#define ISGRAPH (  )     (isascii (c) && isprint (c) && !isspace (c))

Definition at line 171 of file regex.c.

#define ISLOWER (  )     (isascii (c) && islower (c))

Definition at line 179 of file regex.c.

#define ISPRINT (  )     (isascii (c) && isprint (c))

Definition at line 174 of file regex.c.

#define ISPUNCT (  )     (isascii (c) && ispunct (c))

Definition at line 180 of file regex.c.

#define ISSPACE (  )     (isascii (c) && isspace (c))

Definition at line 181 of file regex.c.

#define ISUPPER (  )     (isascii (c) && isupper (c))

Definition at line 182 of file regex.c.

#define ISXDIGIT (  )     (isascii (c) && isxdigit (c))

Definition at line 183 of file regex.c.

#define MATCH_NULL_UNSET_VALUE   3

Definition at line 3136 of file regex.c.

#define MATCHED_SOMETHING (  )     ((R).bits.matched_something)

Definition at line 3171 of file regex.c.

#define MATCHING_IN_FIRST_STRING   (dend == end_match_1)

Definition at line 3204 of file regex.c.

#define MAX ( a,
 )     ((a) > (b) ? (a) : (b))

Definition at line 262 of file regex.c.

#define MAX_BUF_SIZE   (1L << 16)

Definition at line 1071 of file regex.c.

#define MAX_FAILURE_ITEMS   ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS)

Definition at line 2554 of file regex.c.

#define MAX_REGNUM   255

Definition at line 1107 of file regex.c.

#define MIN ( a,
 )     ((a) < (b) ? (a) : (b))

Definition at line 263 of file regex.c.

#define NO_HIGHEST_ACTIVE_REG   (1 << BYTEWIDTH)

Definition at line 3271 of file regex.c.

#define NO_LOWEST_ACTIVE_REG   (NO_HIGHEST_ACTIVE_REG + 1)

Definition at line 3272 of file regex.c.

#define NULL   0

Definition at line 186 of file regex.c.

#define NUM_FAILURE_ITEMS
Value:
((highest_active_reg - lowest_active_reg + 1) * NUM_REG_ITEMS         \
    + NUM_NONREG_ITEMS)

Definition at line 2557 of file regex.c.

#define NUM_NONREG_ITEMS   4

Definition at line 2550 of file regex.c.

#define NUM_REG_ITEMS   3

Definition at line 2544 of file regex.c.

#define PATFETCH (  ) 
Value:
do {if (p == pend) return REG_EEND;                                   \
    c = (unsigned char) *p++;                                           \
    if (translate) c = translate[c];                                    \
  } while (0)

Definition at line 989 of file regex.c.

#define PATFETCH_RAW (  ) 
Value:
do {if (p == pend) return REG_EEND;                                   \
    c = (unsigned char) *p++;                                           \
  } while (0)

Definition at line 997 of file regex.c.

#define PATUNFETCH   p--

Definition at line 1003 of file regex.c.

#define POINTER_TO_OFFSET ( ptr   )     (FIRST_STRING_P (ptr) ? (ptr) - string1 : (ptr) - string2 + size1)

Definition at line 3194 of file regex.c.

 
#define POP_FAILURE_ITEM (  )     fail_stack.stack[--fail_stack.avail]

Definition at line 2448 of file regex.c.

#define POP_FAILURE_POINT ( str,
pat,
low_reg,
high_reg,
regstart,
regend,
reg_info   ) 

Definition at line 2577 of file regex.c.

 
#define PREFETCH (  ) 
Value:
while (d == dend)                                                     \
    {                                                                   \
      /* End of string2 => fail.  */                                    \
      if (dend == end_match_2)                                          \
        goto fail;                                                      \
      /* End of string1 => advance to string2.  */                      \
      d = string2;                                                      \
      dend = end_match_2;                                               \
    }

Definition at line 3208 of file regex.c.

#define PUSH_FAILURE_ITEM ( item   )     fail_stack.stack[fail_stack.avail++] = (fail_stack_elt_t) item

Definition at line 2444 of file regex.c.

#define PUSH_FAILURE_POINT ( pattern_place,
string_place,
failure_code   ) 

Definition at line 2469 of file regex.c.

#define PUSH_PATTERN_OP ( pattern_op,
fail_stack   ) 
Value:
((FAIL_STACK_FULL ()                                                  \
    && !DOUBLE_FAIL_STACK (fail_stack))                                 \
    ? 0                                                                 \
    : ((fail_stack).stack[(fail_stack).avail++] = pattern_op,           \
       1))

Definition at line 2434 of file regex.c.

#define REG_MATCH_NULL_STRING_P (  )     ((R).bits.match_null_string_p)

Definition at line 3169 of file regex.c.

#define REG_UNSET (  )     ((e) == REG_UNSET_VALUE)

Definition at line 3199 of file regex.c.

#define REG_UNSET_VALUE   ((char *) -1)

Definition at line 3198 of file regex.c.

#define REGEX_ALLOCATE   alloca

Definition at line 236 of file regex.c.

#define REGEX_REALLOCATE ( source,
osize,
nsize   ) 
Value:
(destination = (char *) alloca (nsize),                               \
   bcopy (source, destination, osize),                                  \
   destination)

Definition at line 239 of file regex.c.

#define REGEX_TALLOC ( n,
 )     ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))

Definition at line 256 of file regex.c.

#define REMAINING_AVAIL_SLOTS   ((fail_stack).size - (fail_stack).avail)

Definition at line 2562 of file regex.c.

#define RETALLOC ( addr,
n,
 )     ((addr) = (t *) realloc (addr, (n) * sizeof (t)))

Definition at line 255 of file regex.c.

#define SET_LIST_BIT (  ) 
Value:
(b[((unsigned char) (c)) / BYTEWIDTH]               \
   |= 1 << (((unsigned char) c) % BYTEWIDTH))

Definition at line 1122 of file regex.c.

 
#define SET_REGS_MATCHED (  ) 
Value:
do                                                                    \
    {                                                                   \
      unsigned r;                                                       \
      for (r = lowest_active_reg; r <= highest_active_reg; r++)         \
        {                                                               \
          MATCHED_SOMETHING (reg_info[r])                               \
            = EVER_MATCHED_SOMETHING (reg_info[r])                      \
            = 1;                                                        \
        }                                                               \
    }                                                                   \
  while (0)

Definition at line 3178 of file regex.c.

#define SIGN_EXTEND_CHAR (  )     ((((unsigned char) (c)) ^ 128) - 128)

Definition at line 198 of file regex.c.

#define STORE_JUMP ( op,
loc,
to   )     store_op1 (op, loc, (to) - (loc) - 3)

Definition at line 1052 of file regex.c.

#define STORE_JUMP2 ( op,
loc,
to,
arg   )     store_op2 (op, loc, (to) - (loc) - 3, arg)

Definition at line 1056 of file regex.c.

#define STORE_NUMBER ( destination,
number   ) 
Value:
do {                                                                  \
    (destination)[0] = (number) & 0377;                                 \
    (destination)[1] = (number) >> 8;                                   \
  } while (0)

Definition at line 413 of file regex.c.

#define STORE_NUMBER_AND_INCR ( destination,
number   ) 
Value:
do {                                                                  \
    STORE_NUMBER (destination, number);                                 \
    (destination) += 2;                                                 \
  } while (0)

Definition at line 423 of file regex.c.

#define STREQ ( s1,
s2   )     ((strcmp (s1, s2) == 0))

Definition at line 260 of file regex.c.

#define Sword   1

Definition at line 97 of file regex.c.

#define SYNTAX (  )     re_syntax_table[c]

Definition at line 138 of file regex.c.

#define TALLOC ( n,
 )     ((t *) malloc ((n) * sizeof (t)))

Definition at line 254 of file regex.c.

#define TRANSLATE (  )     (translate ? translate[(unsigned char) (d)] : (d))

Definition at line 1010 of file regex.c.

#define true   1

Definition at line 267 of file regex.c.

#define WORDCHAR_P (  ) 
Value:
(SYNTAX ((d) == end1 ? *string2                                       \
           : (d) == string2 - 1 ? *(end1 - 1) : *(d))                   \
   == Sword)

Definition at line 3230 of file regex.c.


Typedef Documentation

typedef char boolean

Definition at line 265 of file regex.c.

typedef const unsigned char* fail_stack_elt_t

Definition at line 2379 of file regex.c.

typedef int pattern_offset_t

Definition at line 897 of file regex.c.

typedef unsigned regnum_t

Definition at line 901 of file regex.c.


Enumeration Type Documentation

Enumerator:
no_op 
exactn 
anychar 
charset 
charset_not 
start_memory 
stop_memory 
duplicate 
begline 
endline 
begbuf 
endbuf 
jump 
jump_past_alt 
on_failure_jump 
on_failure_keep_string_jump 
pop_failure_jump 
maybe_pop_jump 
dummy_failure_jump 
push_dummy_failure 
succeed_n 
jump_n 
set_number_at 
wordchar 
notwordchar 
wordbeg 
wordend 
wordbound 
notwordbound 

Definition at line 278 of file regex.c.


Function Documentation

char* alloca (  ) 
static boolean alt_match_null_string_p ( unsigned char *  p,
unsigned char *  end,
register_info_type reg_info 
) [static]

Definition at line 4614 of file regex.c.

Here is the call graph for this function:

static boolean alt_match_null_string_p (  )  [static]

Here is the caller graph for this function:

static boolean at_begline_loc_p ( char *  pattern,
char *  p,
reg_syntax_t  syntax 
) const [static]

Definition at line 2248 of file regex.c.

static boolean at_begline_loc_p (  )  [static]

Here is the caller graph for this function:

static boolean at_endline_loc_p ( char *  p,
char *  pend,
int  syntax 
) const [static]

Definition at line 2267 of file regex.c.

Here is the call graph for this function:

static boolean at_endline_loc_p (  )  [static]

Here is the caller graph for this function:

static int bcmp_translate ( unsigned char *  s1,
unsigned char *  s2,
int  len,
char *  translate 
) [static]

Definition at line 4739 of file regex.c.

static int bcmp_translate (  )  [static]

Here is the caller graph for this function:

static boolean common_op_match_null_string_p ( unsigned char **  p,
unsigned char *  end,
register_info_type reg_info 
) [static]

Definition at line 4651 of file regex.c.

Here is the call graph for this function:

static boolean common_op_match_null_string_p (  )  [static]

Here is the caller graph for this function:

static reg_errcode_t compile_range ( char **  p_ptr,
char *  pend,
char *  translate,
reg_syntax_t  syntax,
unsigned char *  b 
) const [static]

Definition at line 2317 of file regex.c.

static reg_errcode_t compile_range (  )  [static]

Here is the caller graph for this function:

static boolean group_in_compile_stack ( compile_stack_type  compile_stack,
regnum_t  regnum 
) [static]

Definition at line 2289 of file regex.c.

static boolean group_in_compile_stack (  )  [static]

Here is the caller graph for this function:

static boolean group_match_null_string_p ( unsigned char **  p,
unsigned char *  end,
register_info_type reg_info 
) [static]

Definition at line 4505 of file regex.c.

Here is the call graph for this function:

static boolean group_match_null_string_p (  )  [static]

Here is the caller graph for this function:

static void init_syntax_once (  )  [static]

Definition at line 112 of file regex.c.

Here is the caller graph for this function:

static void insert_op1 ( re_opcode_t  op,
unsigned char *  loc,
int  arg,
unsigned char *  end 
) [static]

Definition at line 2208 of file regex.c.

Here is the call graph for this function:

static void insert_op1 (  )  [static]
static void insert_op2 ( re_opcode_t  op,
unsigned char *  loc,
int  arg1,
int  arg2,
unsigned char *  end 
) [static]

Definition at line 2227 of file regex.c.

Here is the call graph for this function:

static void insert_op2 (  )  [static]

Here is the caller graph for this function:

char* malloc (  ) 

Here is the caller graph for this function:

char* re_comp ( char *  s  )  const

Definition at line 4798 of file regex.c.

int re_compile_fastmap ( struct re_pattern_buffer *  bufp  ) 

Definition at line 2646 of file regex.c.

Here is the caller graph for this function:

const char* re_compile_pattern ( char *  pattern,
int  length,
struct re_pattern_buffer *  bufp 
) const

Definition at line 4765 of file regex.c.

Here is the call graph for this function:

int re_exec ( char *  s  )  const

Definition at line 4836 of file regex.c.

Here is the call graph for this function:

int re_match ( struct re_pattern_buffer *  bufp,
const char *  string,
int  size,
int  pos,
struct re_registers *  regs 
)

Definition at line 3280 of file regex.c.

Here is the call graph for this function:

int re_match_2 ( struct re_pattern_buffer *  bufp,
const char *  string1,
int  size1,
const char *  string2,
int  size2,
int  pos,
struct re_registers *  regs,
int  stop 
)

Definition at line 3305 of file regex.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int re_search ( struct re_pattern_buffer *  bufp,
const char *  string,
int  size,
int  startpos,
int  range,
struct re_registers *  regs 
)

Definition at line 2958 of file regex.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int re_search_2 ( struct re_pattern_buffer *  bufp,
const char *  string1,
int  size1,
const char *  string2,
int  size2,
int  startpos,
int  range,
struct re_registers *  regs,
int  stop 
)

Definition at line 2991 of file regex.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void re_set_registers ( struct re_pattern_buffer *  bufp,
struct re_registers *  regs,
unsigned  num_regs,
regoff_t *  starts,
regoff_t *  ends 
)

Definition at line 2931 of file regex.c.

reg_syntax_t re_set_syntax ( reg_syntax_t  syntax  ) 

Definition at line 860 of file regex.c.

Here is the caller graph for this function:

char* realloc (  ) 

Here is the caller graph for this function:

int regcomp ( regex_t *  preg,
const char *  pattern,
int  cflags 
)

Definition at line 4884 of file regex.c.

Here is the call graph for this function:

Here is the caller graph for this function:

size_t regerror ( int  errcode,
const regex_t *  preg,
char *  errbuf,
size_t  errbuf_size 
)

Definition at line 5086 of file regex.c.

static reg_errcode_t regex_compile ( char const*  pattern,
int  size,
reg_syntax_t  syntax,
struct re_pattern_buffer *  bufp 
) [static]

Definition at line 1177 of file regex.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int regexec ( regex_t *  preg,
const char *  string,
size_t  nmatch,
pmatch  ,
int  eflags 
) const

Definition at line 4959 of file regex.c.

Here is the call graph for this function:

int regexec1 ( regex_t *  preg,
const char *  string,
int  stringLength,
size_t  nmatch,
pmatch  ,
int  eflags 
) const

Definition at line 5020 of file regex.c.

Here is the caller graph for this function:

void regfree ( regex_t *  preg  ) 

Definition at line 5130 of file regex.c.

Here is the caller graph for this function:

static void store_op1 ( re_opcode_t  op,
unsigned char *  loc,
int  arg 
) [static]

Definition at line 2180 of file regex.c.

static void store_op1 (  )  [static]

Here is the caller graph for this function:

static void store_op2 ( re_opcode_t  op,
unsigned char *  loc,
int  arg1,
int  arg2 
) [static]

Definition at line 2193 of file regex.c.

static void store_op2 (  )  [static]

Here is the caller graph for this function:


Variable Documentation

struct re_pattern_buffer re_comp_buf [static]

Definition at line 4795 of file regex.c.

const char* re_error_msg[] [static]
Initial value:
  { NULL,                                       
    "No match",                                 
    "Invalid regular expression",               
    "Invalid collation character",              
    "Invalid character class name",             
    "Trailing backslash",                       
    "Invalid back reference",                   
    "Unmatched [ or [^",                        
    "Unmatched ( or \\(",                       
    "Unmatched \\{",                            
    "Invalid content of \\{\\}",                
    "Invalid range end",                        
    "Memory exhausted",                         
    "Invalid preceding regular expression",     
    "Premature end of regular expression",      
    "Regular expression too big",               
    "Unmatched ) or \\)",                       
  }

Definition at line 872 of file regex.c.

int re_max_failures = 2000

Definition at line 2377 of file regex.c.

reg_syntax_t re_syntax_options = RE_SYNTAX_EMACS

Definition at line 849 of file regex.c.

char re_syntax_table[CHAR_SET_SIZE] [static]

Definition at line 109 of file regex.c.

Generated on Wed Feb 29 22:51:30 2012 for CXXUtilities by  doxygen 1.6.3