Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

regex.c File Reference

#include <sys/types.h>
#include <string.h>
#include "regex.h"
#include <ctype.h>

Go to the source code of this file.

Classes

struct  compile_stack_elt_t
struct  compile_stack_type
union  fail_stack_elt
struct  fail_stack_type
union  register_info_type

Defines

#define _GNU_SOURCE
#define gettext(msgid)   (msgid)
#define bcmp(s1, s2, n)   memcmp ((s1), (s2), (n))
#define bcopy(s, d, n)   memcpy ((d), (s), (n))
#define bzero(s, n)   memset ((s), 0, (n))
#define Sword   1
#define SWITCH_ENUM_CAST(x)   (x)
#define CHAR_SET_SIZE   256
#define SYNTAX(c)   re_syntax_table[c]
#define ISASCII(c)   1
#define ISBLANK(c)   ((c) == ' ' || (c) == '\t')
#define ISGRAPH(c)   (ISASCII (c) && isprint (c) && !isspace (c))
#define ISPRINT(c)   (ISASCII (c) && isprint (c))
#define ISDIGIT(c)   (ISASCII (c) && isdigit (c))
#define ISALNUM(c)   (ISASCII (c) && isalnum (c))
#define ISALPHA(c)   (ISASCII (c) && isalpha (c))
#define ISCNTRL(c)   (ISASCII (c) && iscntrl (c))
#define ISLOWER(c)   (ISASCII (c) && islower (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 NULL   (void *)0
#define SIGN_EXTEND_CHAR(c)   ((((unsigned char) (c)) ^ 128) - 128)
#define REGEX_ALLOCATE   alloca
#define REGEX_REALLOCATE(source, osize, nsize)
#define REGEX_FREE(arg)   ((void)0)
#define REGEX_ALLOCATE_STACK   alloca
#define REGEX_REALLOCATE_STACK(source, osize, nsize)   REGEX_REALLOCATE (source, osize, nsize)
#define REGEX_FREE_STACK(arg)
#define FIRST_STRING_P(ptr)   (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
#define TALLOC(n, t)   ((t *) malloc ((n) * sizeof (t)))
#define RETALLOC(addr, n, t)   ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
#define RETALLOC_IF(addr, n, t)   if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t)
#define REGEX_TALLOC(n, t)   ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
#define BYTEWIDTH   8
#define STREQ(s1, s2)   ((strcmp (s1, s2) == 0))
#define MAX(a, b)   ((a) > (b) ? (a) : (b))
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
#define false   0
#define true   1
#define STORE_NUMBER(destination, number)
#define STORE_NUMBER_AND_INCR(destination, number)
#define EXTRACT_NUMBER(destination, source)
#define EXTRACT_NUMBER_AND_INCR(destination, source)
#define assert(e)
#define DEBUG_STATEMENT(e)
#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 MATCH_MAY_ALLOCATE
#define INIT_FAILURE_ALLOC   5
#define FAIL_STACK_EMPTY()   (fail_stack.avail == 0)
#define FAIL_STACK_PTR_EMPTY()   (fail_stack_ptr->avail == 0)
#define FAIL_STACK_FULL()   (fail_stack.avail == fail_stack.size)
#define INIT_FAIL_STACK()
#define RESET_FAIL_STACK()   REGEX_FREE_STACK (fail_stack.stack)
#define DOUBLE_FAIL_STACK(fail_stack)
#define PUSH_PATTERN_OP(POINTER, FAIL_STACK)
#define PUSH_FAILURE_POINTER(item)   fail_stack.stack[fail_stack.avail++].pointer = (unsigned char *) (item)
#define PUSH_FAILURE_INT(item)   fail_stack.stack[fail_stack.avail++].integer = (item)
#define PUSH_FAILURE_ELT(item)   fail_stack.stack[fail_stack.avail++] = (item)
#define POP_FAILURE_POINTER()   fail_stack.stack[--fail_stack.avail].pointer
#define POP_FAILURE_INT()   fail_stack.stack[--fail_stack.avail].integer
#define POP_FAILURE_ELT()   fail_stack.stack[--fail_stack.avail]
#define DEBUG_PUSH(item)
#define DEBUG_POP(item_addr)
#define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code)
#define NUM_REG_ITEMS   3
#define NUM_NONREG_ITEMS   4
#define MAX_FAILURE_ITEMS   ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
#define NUM_FAILURE_ITEMS
#define REMAINING_AVAIL_SLOTS   ((fail_stack).size - (fail_stack).avail)
#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)
#define MATCH_NULL_UNSET_VALUE   3
#define REG_MATCH_NULL_STRING_P(R)   ((R).bits.match_null_string_p)
#define IS_ACTIVE(R)   ((R).bits.is_active)
#define MATCHED_SOMETHING(R)   ((R).bits.matched_something)
#define EVER_MATCHED_SOMETHING(R)   ((R).bits.ever_matched_something)
#define SET_REGS_MATCHED()
#define REG_UNSET_VALUE   (&reg_unset_dummy)
#define REG_UNSET(e)   ((e) == REG_UNSET_VALUE)
#define PATFETCH(c)
#define PATFETCH_RAW(c)
#define PATUNFETCH   p--
#define TRANSLATE(d)   (translate ? translate[(unsigned char) (d)] : (d))
#define INIT_BUF_SIZE   32
#define GET_BUFFER_SPACE(n)
#define BUF_PUSH(c)
#define BUF_PUSH_2(c1, c2)
#define BUF_PUSH_3(c1, c2, c3)
#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 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 MAX_BUF_SIZE   (1L << 16)
#define EXTEND_BUFFER()
#define MAX_REGNUM   255
#define INIT_COMPILE_STACK_SIZE   32
#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 SET_LIST_BIT(c)
#define GET_UNSIGNED_NUMBER(num)
#define CHAR_CLASS_MAX_LENGTH   6
#define IS_CHAR_CLASS(string)
#define FREE_STACK_RETURN(value)   return (free (compile_stack.stack), value)
#define POINTER_TO_OFFSET(ptr)
#define MATCHING_IN_FIRST_STRING   (dend == end_match_1)
#define PREFETCH()
#define AT_STRINGS_BEG(d)   ((d) == (size1 ? string1 : string2) || !size2)
#define AT_STRINGS_END(d)   ((d) == end2)
#define WORDCHAR_P(d)
#define AT_WORD_BOUNDARY(d)
#define FREE_VAR(var)   if (var) REGEX_FREE (var); var = NULL
#define FREE_VARIABLES()
#define NO_HIGHEST_ACTIVE_REG   (1 << BYTEWIDTH)
#define NO_LOWEST_ACTIVE_REG   (NO_HIGHEST_ACTIVE_REG + 1)

Typedefs

typedef char boolean
typedef fail_stack_elt fail_stack_elt_t
typedef unsigned regnum_t
typedef int pattern_offset_t

Enumerations

enum  re_opcode_t {
  no_op = 0, succeed, 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
}

Functions

char * malloc ()
char * realloc ()
char * alloca ()
reg_syntax_t re_set_syntax (reg_syntax_t syntax)
void store_op2 ()
void insert_op2 ()
boolean at_endline_loc_p ()
int re_compile_fastmap (struct re_pattern_buffer *bufp)
void re_set_registers (struct re_pattern_buffer *bufp, struct re_registers *regs, unsigned num_regs, regoff_t *starts, regoff_t *ends)
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)
boolean common_op_match_null_string_p ()
boolean group_match_null_string_p ()
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)
const char * re_compile_pattern (char *pattern, int length, struct re_pattern_buffer *bufp) const
int regcomp (regex_t *preg, const char *pattern, int cflags)
int regexec (regex_t *preg, const char *string, size_t nmatch, pmatch, int eflags) const
size_t regerror (int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
void regfree (regex_t *preg)

Variables

reg_syntax_t re_syntax_options
int re_max_failures = 200000


Define Documentation

#define _GNU_SOURCE
 

Definition at line 27 of file regex.c.

#define assert  ) 
 

Definition at line 882 of file regex.c.

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

Definition at line 3395 of file regex.c.

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

Definition at line 3396 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 3410 of file regex.c.

#define bcmp s1,
s2,
 )     memcmp ((s1), (s2), (n))
 

Definition at line 82 of file regex.c.

#define bcopy s,
d,
 )     memcpy ((d), (s), (n))
 

Definition at line 85 of file regex.c.

#define BUF_PUSH  ) 
 

Value:

do {                                                                    \
    GET_BUFFER_SPACE (1);                                               \
    *b++ = (unsigned char) (c);                                         \
  } while (0)

Definition at line 1399 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 1407 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 1416 of file regex.c.

#define BYTEWIDTH   8
 

Definition at line 305 of file regex.c.

Referenced by re_compile_fastmap().

#define bzero s,
 )     memset ((s), 0, (n))
 

Definition at line 88 of file regex.c.

Referenced by re_compile_fastmap().

#define CHAR_CLASS_MAX_LENGTH   6
 

Definition at line 1545 of file regex.c.

#define CHAR_SET_SIZE   256
 

Definition at line 116 of file regex.c.

Referenced by regcomp().

#define COMPILE_STACK_EMPTY   (compile_stack.avail == 0)
 

Definition at line 1515 of file regex.c.

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

Definition at line 1516 of file regex.c.

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

Definition at line 1519 of file regex.c.

#define DEBUG_POP item_addr   ) 
 

Definition at line 1112 of file regex.c.

#define DEBUG_PRINT1  ) 
 

Definition at line 885 of file regex.c.

#define DEBUG_PRINT2 x1,
x2   ) 
 

Definition at line 886 of file regex.c.

#define DEBUG_PRINT3 x1,
x2,
x3   ) 
 

Definition at line 887 of file regex.c.

#define DEBUG_PRINT4 x1,
x2,
x3,
x4   ) 
 

Definition at line 888 of file regex.c.

#define DEBUG_PRINT_COMPILED_PATTERN p,
s,
 ) 
 

Definition at line 889 of file regex.c.

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

Definition at line 890 of file regex.c.

#define DEBUG_PUSH item   ) 
 

Definition at line 1111 of file regex.c.

#define DEBUG_STATEMENT  ) 
 

Definition at line 884 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_STACK ((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 1058 of file regex.c.

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

Definition at line 1324 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 (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 1453 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 482 of file regex.c.

#define EXTRACT_NUMBER_AND_INCR destination,
source   ) 
 

Value:

do {                                                                    \
    EXTRACT_NUMBER (destination, source);                               \
    (source) += 2;                                                      \
  } while (0)

Definition at line 509 of file regex.c.

Referenced by re_compile_fastmap().

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

Definition at line 1019 of file regex.c.

Referenced by re_compile_fastmap().

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

Definition at line 1021 of file regex.c.

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

Definition at line 1020 of file regex.c.

#define false   0
 

Definition at line 315 of file regex.c.

Referenced by x86asm::x86asm().

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

Definition at line 295 of file regex.c.

#define FREE_STACK_RETURN value   )     return (free (compile_stack.stack), value)
 

Definition at line 1622 of file regex.c.

#define FREE_VAR var   )     if (var) REGEX_FREE (var); var = NULL
 

Definition at line 3417 of file regex.c.

 
#define FREE_VARIABLES  ) 
 

Value:

do {                                                                    \
    REGEX_FREE_STACK (fail_stack.stack);                                \
    FREE_VAR (regstart);                                                \
    FREE_VAR (regend);                                                  \
    FREE_VAR (old_regstart);                                            \
    FREE_VAR (old_regend);                                              \
    FREE_VAR (best_regstart);                                           \
    FREE_VAR (best_regend);                                             \
    FREE_VAR (reg_info);                                                \
    FREE_VAR (reg_dummy);                                               \
    FREE_VAR (reg_info_dummy);                                          \
  } while (0)

Definition at line 3418 of file regex.c.

#define GET_BUFFER_SPACE  ) 
 

Value:

while (b - bufp->buffer + (n) > bufp->allocated)                        \
         EXTEND_BUFFER ()

Definition at line 1394 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 1529 of file regex.c.

#define gettext msgid   )     (msgid)
 

Definition at line 40 of file regex.c.

Referenced by re_compile_pattern(), and regerror().

#define INIT_BUF_SIZE   32
 

Definition at line 1391 of file regex.c.

#define INIT_COMPILE_STACK_SIZE   32
 

Definition at line 1513 of file regex.c.

 
#define INIT_FAIL_STACK  ) 
 

Value:

do {                                                                    \
    fail_stack.stack = (fail_stack_elt_t *)                             \
         REGEX_ALLOCATE_STACK (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 1028 of file regex.c.

Referenced by re_compile_fastmap().

#define INIT_FAILURE_ALLOC   5
 

Definition at line 991 of file regex.c.

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

Definition at line 1435 of file regex.c.

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

Definition at line 1439 of file regex.c.

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

Definition at line 1322 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 1547 of file regex.c.

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

Definition at line 187 of file regex.c.

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

Definition at line 188 of file regex.c.

#define ISASCII  )     1
 

Definition at line 169 of file regex.c.

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

Definition at line 177 of file regex.c.

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

Definition at line 189 of file regex.c.

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

Definition at line 186 of file regex.c.

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

Definition at line 182 of file regex.c.

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

Definition at line 190 of file regex.c.

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

Definition at line 185 of file regex.c.

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

Definition at line 191 of file regex.c.

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

Definition at line 192 of file regex.c.

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

Definition at line 193 of file regex.c.

Referenced by regcomp().

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

Definition at line 194 of file regex.c.

#define MATCH_MAY_ALLOCATE
 

Definition at line 964 of file regex.c.

#define MATCH_NULL_UNSET_VALUE   3
 

Definition at line 1313 of file regex.c.

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

Definition at line 1323 of file regex.c.

#define MATCHING_IN_FIRST_STRING   (dend == end_match_1)
 

Definition at line 3377 of file regex.c.

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

Definition at line 311 of file regex.c.

#define MAX_BUF_SIZE   (1L << 16)
 

Definition at line 1446 of file regex.c.

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

Definition at line 1212 of file regex.c.

#define MAX_REGNUM   255
 

Definition at line 1482 of file regex.c.

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

Definition at line 312 of file regex.c.

#define NO_HIGHEST_ACTIVE_REG   (1 << BYTEWIDTH)
 

Definition at line 3442 of file regex.c.

#define NO_LOWEST_ACTIVE_REG   (NO_HIGHEST_ACTIVE_REG + 1)
 

Definition at line 3443 of file regex.c.

#define NULL   (void *)0
 

Definition at line 197 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 1215 of file regex.c.

#define NUM_NONREG_ITEMS   4
 

Definition at line 1208 of file regex.c.

#define NUM_REG_ITEMS   3
 

Definition at line 1202 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 1364 of file regex.c.

#define PATFETCH_RAW  ) 
 

Value:

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

Definition at line 1372 of file regex.c.

#define PATUNFETCH   p--
 

Definition at line 1378 of file regex.c.

#define POINTER_TO_OFFSET ptr   ) 
 

Value:

(FIRST_STRING_P (ptr)                           \
   ? ((regoff_t) ((ptr) - string1))             \
   : ((regoff_t) ((ptr) - string2 + size1)))

Definition at line 3370 of file regex.c.

 
#define POP_FAILURE_ELT  )     fail_stack.stack[--fail_stack.avail]
 

Definition at line 1104 of file regex.c.

 
#define POP_FAILURE_INT  )     fail_stack.stack[--fail_stack.avail].integer
 

Definition at line 1103 of file regex.c.

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

Definition at line 1235 of file regex.c.

 
#define POP_FAILURE_POINTER  )     fail_stack.stack[--fail_stack.avail].pointer
 

Definition at line 1102 of file regex.c.

 
#define PREFETCH  ) 
 

Value:

while (d == dend)                                                       \
    {                                                                   \
                                                \
         if (dend == end_match_2)                                               \
           goto fail;                                                   \
                                \
         d = string2;                                                   \
         dend = end_match_2;                                            \
    }

Definition at line 3381 of file regex.c.

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

Definition at line 1097 of file regex.c.

#define PUSH_FAILURE_INT item   )     fail_stack.stack[fail_stack.avail++].integer = (item)
 

Definition at line 1091 of file regex.c.

#define PUSH_FAILURE_POINT pattern_place,
string_place,
failure_code   ) 
 

Definition at line 1125 of file regex.c.

#define PUSH_FAILURE_POINTER item   )     fail_stack.stack[fail_stack.avail++].pointer = (unsigned char *) (item)
 

Definition at line 1085 of file regex.c.

#define PUSH_PATTERN_OP POINTER,
FAIL_STACK   ) 
 

Value:

((FAIL_STACK_FULL ()                                                    \
    && !DOUBLE_FAIL_STACK (FAIL_STACK))                                 \
   ? 0                                                                  \
   : ((FAIL_STACK).stack[(FAIL_STACK).avail++].pointer = POINTER,       \
         1))

Definition at line 1075 of file regex.c.

Referenced by re_compile_fastmap().

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

Definition at line 1321 of file regex.c.

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

Definition at line 1350 of file regex.c.

#define REG_UNSET_VALUE   (&reg_unset_dummy)
 

Definition at line 1349 of file regex.c.

#define REGEX_ALLOCATE   alloca
 

Definition at line 248 of file regex.c.

#define REGEX_ALLOCATE_STACK   alloca
 

Definition at line 281 of file regex.c.

#define REGEX_FREE arg   )     ((void)0)
 

Definition at line 257 of file regex.c.

#define REGEX_FREE_STACK arg   ) 
 

Definition at line 286 of file regex.c.

#define REGEX_REALLOCATE source,
osize,
nsize   ) 
 

Value:

(destination = (char *) alloca (nsize),                         \
   bcopy (source, destination, osize),                                  \
   destination)

Definition at line 251 of file regex.c.

#define REGEX_REALLOCATE_STACK source,
osize,
nsize   )     REGEX_REALLOCATE (source, osize, nsize)
 

Definition at line 283 of file regex.c.

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

Definition at line 303 of file regex.c.

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

Definition at line 1220 of file regex.c.

 
#define RESET_FAIL_STACK  )     REGEX_FREE_STACK (fail_stack.stack)
 

Definition at line 1040 of file regex.c.

Referenced by re_compile_fastmap().

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

Definition at line 300 of file regex.c.

#define RETALLOC_IF addr,
n,
 )     if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t)
 

Definition at line 301 of file regex.c.

#define SET_LIST_BIT  ) 
 

Value:

(b[((unsigned char) (c)) / BYTEWIDTH]               \
   |= 1 << (((unsigned char) c) % BYTEWIDTH))

Definition at line 1523 of file regex.c.

 
#define SET_REGS_MATCHED  ) 
 

Value:

do                                                                      \
    {                                                                   \
         if (!set_regs_matched_done)                                    \
        {                                                               \
          unsigned r;                                                   \
          set_regs_matched_done = 1;                                    \
          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 1330 of file regex.c.

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

Definition at line 209 of file regex.c.

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

Definition at line 1427 of file regex.c.

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

Definition at line 1431 of file regex.c.

#define STORE_NUMBER destination,
number   ) 
 

Value:

do {                                                                    \
    (destination)[0] = (number) & 0377;                                 \
    (destination)[1] = (number) >> 8;                                   \
  } while (0)

Definition at line 463 of file regex.c.

#define STORE_NUMBER_AND_INCR destination,
number   ) 
 

Value:

do {                                                                    \
    STORE_NUMBER (destination, number);                                 \
    (destination) += 2;                                                 \
  } while (0)

Definition at line 473 of file regex.c.

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

Definition at line 307 of file regex.c.

#define SWITCH_ENUM_CAST  )     (x)
 

Definition at line 106 of file regex.c.

Referenced by re_compile_fastmap().

#define Sword   1
 

Definition at line 100 of file regex.c.

Referenced by re_compile_fastmap().

#define SYNTAX  )     re_syntax_table[c]
 

Definition at line 147 of file regex.c.

Referenced by re_compile_fastmap().

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

Definition at line 299 of file regex.c.

Referenced by regexec().

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

Definition at line 1385 of file regex.c.

Referenced by re_search_2().

#define true   1
 

Definition at line 316 of file regex.c.

#define WORDCHAR_P  ) 
 

Value:

(SYNTAX ((d) == end1 ? *string2                                 \
                 : (d) == string2 - 1 ? *(end1 - 1) : *(d))                     \
   == Sword)

Definition at line 3403 of file regex.c.


Typedef Documentation

typedef char boolean
 

Definition at line 314 of file regex.c.

typedef union fail_stack_elt fail_stack_elt_t
 

Definition at line 1010 of file regex.c.

Referenced by re_compile_fastmap().

typedef int pattern_offset_t
 

Definition at line 1493 of file regex.c.

typedef unsigned regnum_t
 

Definition at line 1486 of file regex.c.


Enumeration Type Documentation

enum re_opcode_t
 

Enumeration values:
no_op 
succeed 
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 325 of file regex.c.

Referenced by re_compile_fastmap(), and re_search_2().


Function Documentation

char* alloca  ) 
 

Referenced by re_match(), re_match_2(), and re_search_2().

boolean at_endline_loc_p  ) 
 

boolean common_op_match_null_string_p  ) 
 

boolean group_match_null_string_p  ) 
 

void insert_op2  ) 
 

char* malloc  ) 
 

Referenced by ht_uformat_viewer::address_input(), x86asm::alloc_insn(), attribute_read(), ht_elf::auto_relocate32(), drawbuf::b_setbounds(), screendrawbuf::b_setbounds(), binstr2cstr(), class_read(), clipboard_copy(), clipboard_paste(), ht_text_editor::clipboard_paste_cmd(), ht_undo_data_overwrite_string::combine(), ht_text_editor::concat_lines(), ht_ltextfile::copy_to(), ht_stream::copy_to(), ht_ne::create_fake_segment(), ht_static_treeview::create_node(), create_replace_bin_context(), create_search_bin_context(), create_sorted_stringtable(), ht_view::databuf_getdup(), ht_ltextfile::delete_chars(), delete_text_block(), ht_le::do_fixups(), ht_statictext::draw(), x86dis::duplicateInsn(), PPCDisassembler::duplicateInsn(), javadis::duplicateInsn(), ILDisassembler::duplicateInsn(), IA64Disassembler::duplicateInsn(), Alphadis::duplicateInsn(), exec_evalfunc(), export_to_sym(), ht_clist::extend_list(), ht_ltextfile::fetch_line_into_memory(), fgetstrz(), getstrp(), getstrw(), getstrz(), ht_undo_data_overwrite_string::gettext(), ht_undo_data_insert_string::gettext(), ht_undo_data_delete_string2::gettext(), ht_undo_data_delete_string::gettext(), ht_strinputfield::handlemsg(), ht_data_mem::ht_data_mem(), ht_fxbin_search_request::ht_fxbin_search_request(), ht_linear_func_readstring(), ht_mod_page::ht_mod_page(), ht_registry_data_raw::ht_registry_data_raw(), ht_undo_data_delete_string::ht_undo_data_delete_string(), ht_undo_data_delete_string2::ht_undo_data_delete_string2(), ht_undo_data_insert_block::ht_undo_data_insert_block(), ht_undo_data_insert_string::ht_undo_data_insert_string(), ht_undo_data_overwrite_string::ht_undo_data_overwrite_string(), ht_vasprintf(), ht_text_editor::indent(), ht_mem_file::init(), AnalyserOutput::init(), ht_xbe::init(), ht_pef::init(), ht_pe::init(), ht_ne::init(), ht_mz::init(), ht_macho::init(), ht_le::init(), ht_flt::init(), ht_elf::init(), ht_inputfield::init(), ht_clist::init(), ht_coff::init(), init_app(), init_cfg(), inputboxrect(), ht_ltextfile::insert_chars(), ht_ltextfile::insert_lines(), ht_text_listbox::insert_str(), ht_text_listbox::insert_str_extra(), ht_clist::load(), load_pal(), memndup(), OutLine::OutLine(), ht_le::read_objects(), ht_le::read_pagemap(), ht_info_viewer::readfile(), regcomp(), VfsListbox::reread(), ht_mem_file::resizebuf(), scalar_clone(), scalar_context_str(), scalar_create_str(), scalarlist_concat(), scalarlist_set(), ht_dtree::set_compare_keys(), ht_stree::set_compare_keys(), ht_lang_syntax_lexer::set_lexer_rules(), ht_listbox_title::setTextv(), smalloc(), smalloc0(), ht_text_listbox::sort(), ht_ltextfile::split_line(), ht_text_editor::split_line(), string_concat(), sys_findfirst(), tag_strdup(), and ht_treeview::update_r().

int re_compile_fastmap struct re_pattern_buffer bufp  ) 
 

Definition at line 2874 of file regex.c.

References anychar, assert, fail_stack_type::avail, begbuf, begline, BYTEWIDTH, bzero, charset, charset_not, dummy_failure_jump, duplicate, endbuf, endline, exactn, EXTRACT_NUMBER_AND_INCR, fail_stack_elt_t, FAIL_STACK_EMPTY, INIT_FAIL_STACK, jump, jump_n, jump_past_alt, maybe_pop_jump, no_op, notwordbound, notwordchar, NULL, on_failure_jump, on_failure_keep_string_jump, pop_failure_jump, push_dummy_failure, PUSH_PATTERN_OP, RE_DOT_NEWLINE, re_opcode_t, RESET_FAIL_STACK, set_number_at, size, fail_stack_type::stack, start_memory, stop_memory, succeed, succeed_n, SWITCH_ENUM_CAST, Sword, SYNTAX, wordbeg, wordbound, wordchar, and wordend.

Referenced by re_search_2().

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

Definition at line 5084 of file regex.c.

References gettext, NULL, re_syntax_options, reg_errcode_t, and REGS_UNALLOCATED.

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

Definition at line 3451 of file regex.c.

References alloca(), NULL, size, and string.

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 3481 of file regex.c.

References alloca().

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

Definition at line 3207 of file regex.c.

References NULL, re_search_2(), size, and string.

Referenced by regexec().

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 3240 of file regex.c.

References alloca(), begbuf, re_compile_fastmap(), re_opcode_t, and TRANSLATE.

Referenced by re_search().

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 3180 of file regex.c.

References regoff_t, REGS_REALLOCATE, and REGS_UNALLOCATED.

reg_syntax_t re_set_syntax reg_syntax_t  syntax  ) 
 

Definition at line 910 of file regex.c.

References re_syntax_options, reg_syntax_t, and syntax().

char* realloc  ) 
 

Referenced by ht_undo_data_overwrite_string::combine(), ht_undo_data_insert_string::combine(), ht_undo_data_delete_string2::combine(), ht_undo_data_delete_string::combine(), and ht_elf::fake_undefined_symbols32().

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

Definition at line 5208 of file regex.c.

References CHAR_SET_SIZE, ISUPPER, malloc(), NULL, RE_DOT_NEWLINE, RE_HAT_LISTS_NOT_NEWLINE, RE_SYNTAX_POSIX_BASIC, RE_SYNTAX_POSIX_EXTENDED, REG_EPAREN, REG_ERPAREN, reg_errcode_t, REG_ESPACE, REG_EXTENDED, REG_ICASE, REG_NEWLINE, REG_NOSUB, regex_t, and syntax().

Referenced by ht_regex_search_request::ht_regex_search_request(), and ht_lang_syntax_lexer::set_lexer_rules().

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

Definition at line 5349 of file regex.c.

References gettext, and regex_t.

Referenced by ht_regex_search_exception::ht_regex_search_exception().

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

Definition at line 5284 of file regex.c.

References re_registers::end, len, NULL, re_registers::num_regs, re_search(), REG_NOERROR, REG_NOMATCH, REG_NOTBOL, REG_NOTEOL, regex_t, regoff_t, REGS_FIXED, regmatch_t::rm_eo, regmatch_t::rm_so, re_registers::start, string, and TALLOC.

Referenced by regmatch(), and ht_uformat_viewer::vsearch().

void regfree regex_t preg  ) 
 

Definition at line 5388 of file regex.c.

References NULL, and regex_t.

Referenced by ht_lang_syntax_lexer::free_lexer_rules(), and ht_regex_search_request::~ht_regex_search_request().

void store_op2  ) 
 


Variable Documentation

int re_max_failures = 200000
 

Definition at line 999 of file regex.c.

reg_syntax_t re_syntax_options
 

Definition at line 899 of file regex.c.

Referenced by re_compile_pattern(), and re_set_syntax().


Generated on Fri May 7 21:15:52 2004 by doxygen 1.3.5