The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
regex.c File Reference
#include <sys/types.h>
#include <string.h>
#include <regex.h>
#include <ctype.h>
#include "regex.c"
+ Include dependency graph for regex.c:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _GNU_SOURCE
 
#define BYTE
 
#define BYTEWIDTH   8 /* In bits. */
 
#define bzero(s, n)   (memset (s, '\0', n), (s))
 
#define CHAR_SET_SIZE   256
 
#define DEFINED_ONCE
 
#define false   0
 
#define FIRST_STRING_P(ptr)   (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
 
#define gettext(msgid)   (msgid)
 
#define gettext_noop(String)   String
 
#define HAVE_STRING_H
 
#define HAVE_UINTPTR_T
 
#define INSIDE_RECURSION
 
#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 MAX(a, b)   ((a) > (b) ? (a) : (b))
 
#define MB_LEN_MAX   1
 
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
 
#define NULL   (void *)0
 
#define PARAMS(args)   ()
 
#define REG_BADBR_IDX   (REG_EBRACE_IDX + sizeof "Unmatched \\{")
 
#define REG_BADPAT_IDX   (REG_NOMATCH_IDX + sizeof "No match")
 
#define REG_BADRPT_IDX   (REG_ESPACE_IDX + sizeof "Memory exhausted")
 
#define REG_EBRACE_IDX   (REG_EPAREN_IDX + sizeof "Unmatched ( or \\(")
 
#define REG_EBRACK_IDX   (REG_ESUBREG_IDX + sizeof "Invalid back reference")
 
#define REG_ECOLLATE_IDX   (REG_BADPAT_IDX + sizeof "Invalid regular expression")
 
#define REG_ECTYPE_IDX   (REG_ECOLLATE_IDX + sizeof "Invalid collation character")
 
#define REG_EEND_IDX   (REG_BADRPT_IDX + sizeof "Invalid preceding regular expression")
 
#define REG_EESCAPE_IDX   (REG_ECTYPE_IDX + sizeof "Invalid character class name")
 
#define REG_EPAREN_IDX   (REG_EBRACK_IDX + sizeof "Unmatched [ or [^")
 
#define REG_ERANGE_IDX   (REG_BADBR_IDX + sizeof "Invalid content of \\{\\}")
 
#define REG_ERPAREN_IDX   (REG_ESIZE_IDX + sizeof "Regular expression too big")
 
#define REG_ESIZE_IDX   (REG_EEND_IDX + sizeof "Premature end of regular expression")
 
#define REG_ESPACE_IDX   (REG_ERANGE_IDX + sizeof "Invalid range end")
 
#define REG_ESUBREG_IDX   (REG_EESCAPE_IDX + sizeof "Trailing backslash")
 
#define REG_NOERROR_IDX   0
 
#define REG_NOMATCH_IDX   (REG_NOERROR_IDX + sizeof "Success")
 
#define REGEX_ALLOCATE   alloca
 
#define REGEX_ALLOCATE_STACK   alloca
 
#define REGEX_FREE(arg)   ((void)0) /* Do nothing! But inhibit gcc warning. */
 
#define REGEX_FREE_STACK(arg)
 
#define REGEX_REALLOCATE(source, osize, nsize)
 
#define REGEX_REALLOCATE_STACK(source, osize, nsize)   REGEX_REALLOCATE (source, osize, nsize)
 
#define REGEX_TALLOC(n, t)   ((t *) REGEX_ALLOCATE ((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 SIGN_EXTEND_CHAR(c)   ((((unsigned char) (c)) ^ 128) - 128)
 
#define STREQ(s1, s2)   ((strcmp (s1, s2) == 0))
 
#define SWITCH_ENUM_CAST(x)   (x)
 
#define Sword   1
 
#define SYNTAX(c)   re_syntax_table[(unsigned char) (c)]
 
#define TALLOC(n, t)   ((t *) malloc ((n) * sizeof (t)))
 
#define TOLOWER(c)   tolower(c)
 
#define true   1
 
#define WIDE_CHAR_SUPPORT   (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
 

Typedefs

typedef char boolean
 

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

static reg_errcode_t
byte_regex_compile 
_RE_ARGS ((const char *pattern, size_t size, reg_syntax_t syntax, struct re_pattern_buffer *bufp))
 
 for (this_element=compile_stack.avail-1;this_element >=0;this_element--)
 
 free (preg->fastmap)
 
return gettext (re_error_msgid+re_error_msgid_idx[(int) ret])
 
 if (cflags &REG_ICASE)
 
 if (ret==REG_ERPAREN)
 
 if (errcode< 0||errcode >=(int)(sizeof(re_error_msgid_idx)/sizeof(re_error_msgid_idx[0])))
 
static void init_syntax_once ()
 
char * malloc ()
 
static void init_syntax_once PARAMS ((void))
 
static int byte_re_match_2_internal PARAMS ((struct re_pattern_buffer *bufp, const char *string1, int size1, const char *string2, int size2, int pos, struct re_registers *regs, int stop))
 
static int byte_re_search_2 PARAMS ((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))
 
static int byte_re_compile_fastmap PARAMS ((struct re_pattern_buffer *bufp))
 
char * realloc ()
 
 return (int)
 

Variables

preg allocated = 0
 
preg buffer = 0
 
void struct re_pattern_bufferbufp
 
int cflags
 
static boolean compile_stack_type compile_stack
 
regoff_tends
 
char * errbuf
 
size_t errbuf_size
 
size_t int errcode
 
preg fastmap = (char *) malloc (1 << BYTEWIDTH)
 
preg fastmap_accurate = 0
 
size_t length
 
size_t msg_size
 
bufp newline_anchor = 1
 
bufp no_sub = 0
 
return NULL
 
unsigned num_regs
 
const char *const char * pattern
 
int pos
 
int regex_tpreg
 
int range
 
static const char re_error_msgid []
 
static const size_t re_error_msgid_idx []
 
reg_syntax_t re_syntax_options = syntax
 
static char re_syntax_table [CHAR_SET_SIZE]
 
regnum_t regnum
 
struct re_registersregs
 
bufp regs_allocated = REGS_UNALLOCATED
 
 result
 
reg_syntax_t ret = re_syntax_options
 
int size
 
int size1
 
int size2
 
int startpos
 
regoff_tstarts
 
int stop
 
const char * string
 
const char * string1
 
const char * string2
 
reg_syntax_t reg_syntax_t syntax
 
else preg translate = NULL
 
preg used = 0
 

Macro Definition Documentation

#define _GNU_SOURCE

Definition at line 29 of file regex.c.

#define BYTE

Definition at line 640 of file regex.c.

#define BYTEWIDTH   8 /* In bits. */

Definition at line 397 of file regex.c.

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

Definition at line 151 of file regex.c.

#define CHAR_SET_SIZE   256

Definition at line 265 of file regex.c.

#define DEFINED_ONCE

Definition at line 8383 of file regex.c.

#define false   0

Definition at line 407 of file regex.c.

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

Definition at line 387 of file regex.c.

#define gettext (   msgid)    (msgid)

Definition at line 101 of file regex.c.

#define gettext_noop (   String)    String

Definition at line 107 of file regex.c.

#define HAVE_STRING_H

Definition at line 145 of file regex.c.

#define HAVE_UINTPTR_T

Definition at line 302 of file regex.c.

#define INSIDE_RECURSION

Definition at line 641 of file regex.c.

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

Definition at line 231 of file regex.c.

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

Definition at line 232 of file regex.c.

#define ISASCII (   c)    1

Definition at line 212 of file regex.c.

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

Definition at line 220 of file regex.c.

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

Definition at line 233 of file regex.c.

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

Definition at line 230 of file regex.c.

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

Definition at line 225 of file regex.c.

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

Definition at line 234 of file regex.c.

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

Definition at line 229 of file regex.c.

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

Definition at line 235 of file regex.c.

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

Definition at line 236 of file regex.c.

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

Definition at line 237 of file regex.c.

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

Definition at line 238 of file regex.c.

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

Definition at line 403 of file regex.c.

#define MB_LEN_MAX   1

Definition at line 188 of file regex.c.

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

Definition at line 404 of file regex.c.

#define NULL   (void *)0

Definition at line 247 of file regex.c.

#define PARAMS (   args)    ()

Definition at line 39 of file regex.c.

#define REG_BADBR_IDX   (REG_EBRACE_IDX + sizeof "Unmatched \\{")
#define REG_BADPAT_IDX   (REG_NOMATCH_IDX + sizeof "No match")
#define REG_BADRPT_IDX   (REG_ESPACE_IDX + sizeof "Memory exhausted")
#define REG_EBRACE_IDX   (REG_EPAREN_IDX + sizeof "Unmatched ( or \\(")
#define REG_EBRACK_IDX   (REG_ESUBREG_IDX + sizeof "Invalid back reference")
#define REG_ECOLLATE_IDX   (REG_BADPAT_IDX + sizeof "Invalid regular expression")
#define REG_ECTYPE_IDX   (REG_ECOLLATE_IDX + sizeof "Invalid collation character")
#define REG_EEND_IDX   (REG_BADRPT_IDX + sizeof "Invalid preceding regular expression")
#define REG_EESCAPE_IDX   (REG_ECTYPE_IDX + sizeof "Invalid character class name")
#define REG_EPAREN_IDX   (REG_EBRACK_IDX + sizeof "Unmatched [ or [^")
#define REG_ERANGE_IDX   (REG_BADBR_IDX + sizeof "Invalid content of \\{\\}")
#define REG_ERPAREN_IDX   (REG_ESIZE_IDX + sizeof "Regular expression too big")
#define REG_ESIZE_IDX   (REG_EEND_IDX + sizeof "Premature end of regular expression")
#define REG_ESPACE_IDX   (REG_ERANGE_IDX + sizeof "Invalid range end")
#define REG_ESUBREG_IDX   (REG_EESCAPE_IDX + sizeof "Trailing backslash")
#define REG_NOERROR_IDX   0
#define REG_NOMATCH_IDX   (REG_NOERROR_IDX + sizeof "Success")
#define REGEX_ALLOCATE   alloca

Definition at line 340 of file regex.c.

#define REGEX_ALLOCATE_STACK   alloca

Definition at line 373 of file regex.c.

#define REGEX_FREE (   arg)    ((void)0) /* Do nothing! But inhibit gcc warning. */

Definition at line 348 of file regex.c.

#define REGEX_FREE_STACK (   arg)

Definition at line 378 of file regex.c.

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

Definition at line 343 of file regex.c.

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

Definition at line 375 of file regex.c.

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

Definition at line 395 of file regex.c.

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

Definition at line 392 of file regex.c.

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

Definition at line 393 of file regex.c.

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

Definition at line 259 of file regex.c.

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

Definition at line 399 of file regex.c.

#define SWITCH_ENUM_CAST (   x)    (x)

Definition at line 178 of file regex.c.

#define Sword   1

Definition at line 172 of file regex.c.

#define SYNTAX (   c)    re_syntax_table[(unsigned char) (c)]

Definition at line 298 of file regex.c.

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

Definition at line 391 of file regex.c.

#define TOLOWER (   c)    tolower(c)

Definition at line 243 of file regex.c.

#define true   1

Definition at line 408 of file regex.c.

#define WIDE_CHAR_SUPPORT   (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)

Definition at line 52 of file regex.c.

Typedef Documentation

typedef char boolean

Definition at line 406 of file regex.c.

Enumeration Type Documentation

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

457 {
458  no_op = 0,
459 
460  /* Succeed right away--no more backtracking. */
461  succeed,
462 
463  /* Followed by one byte giving n, then by n literal bytes. */
464  exactn,
465 
466 # ifdef MBS_SUPPORT
467  /* Same as exactn, but contains binary data. */
468  exactn_bin,
469 # endif
470 
471  /* Matches any (more or less) character. */
472  anychar,
473 
474  /* Matches any one char belonging to specified set. First
475  following byte is number of bitmap bytes. Then come bytes
476  for a bitmap saying which chars are in. Bits in each byte
477  are ordered low-bit-first. A character is in the set if its
478  bit is 1. A character too large to have a bit in the map is
479  automatically not in the set. */
480  /* ifdef MBS_SUPPORT, following element is length of character
481  classes, length of collating symbols, length of equivalence
482  classes, length of character ranges, and length of characters.
483  Next, character class element, collating symbols elements,
484  equivalence class elements, range elements, and character
485  elements follow.
486  See regex_compile function. */
487  charset,
488 
489  /* Same parameters as charset, but match any character that is
490  not one of those specified. */
491  charset_not,
492 
493  /* Start remembering the text that is matched, for storing in a
494  register. Followed by one byte with the register number, in
495  the range 0 to one less than the pattern buffer's re_nsub
496  field. Then followed by one byte with the number of groups
497  inner to this one. (This last has to be part of the
498  start_memory only because we need it in the on_failure_jump
499  of re_match_2.) */
500  start_memory,
501 
502  /* Stop remembering the text that is matched and store it in a
503  memory register. Followed by one byte with the register
504  number, in the range 0 to one less than `re_nsub' in the
505  pattern buffer, and one byte with the number of inner groups,
506  just like `start_memory'. (We need the number of inner
507  groups here because we don't have any easy way of finding the
508  corresponding start_memory when we're at a stop_memory.) */
509  stop_memory,
510 
511  /* Match a duplicate of something remembered. Followed by one
512  byte containing the register number. */
513  duplicate,
514 
515  /* Fail unless at beginning of line. */
516  begline,
517 
518  /* Fail unless at end of line. */
519  endline,
520 
521  /* Succeeds if at beginning of buffer (if emacs) or at beginning
522  of string to be matched (if not). */
523  begbuf,
524 
525  /* Analogously, for end of buffer/string. */
526  endbuf,
527 
528  /* Followed by two byte relative address to which to jump. */
529  jump,
530 
531  /* Same as jump, but marks the end of an alternative. */
533 
534  /* Followed by two-byte relative address of place to resume at
535  in case of failure. */
536  /* ifdef MBS_SUPPORT, the size of address is 1. */
538 
539  /* Like on_failure_jump, but pushes a placeholder instead of the
540  current string position when executed. */
542 
543  /* Throw away latest failure point and then jump to following
544  two-byte relative address. */
545  /* ifdef MBS_SUPPORT, the size of address is 1. */
547 
548  /* Change to pop_failure_jump if know won't have to backtrack to
549  match; otherwise change to jump. This is used to jump
550  back to the beginning of a repeat. If what follows this jump
551  clearly won't match what the repeat does, such that we can be
552  sure that there is no use backtracking out of repetitions
553  already matched, then we change it to a pop_failure_jump.
554  Followed by two-byte address. */
555  /* ifdef MBS_SUPPORT, the size of address is 1. */
557 
558  /* Jump to following two-byte address, and push a dummy failure
559  point. This failure point will be thrown away if an attempt
560  is made to use it for a failure. A `+' construct makes this
561  before the first repeat. Also used as an intermediary kind
562  of jump when compiling an alternative. */
563  /* ifdef MBS_SUPPORT, the size of address is 1. */
565 
566  /* Push a dummy failure point and continue. Used at the end of
567  alternatives. */
569 
570  /* Followed by two-byte relative address and two-byte number n.
571  After matching N times, jump to the address upon failure. */
572  /* ifdef MBS_SUPPORT, the size of address is 1. */
573  succeed_n,
574 
575  /* Followed by two-byte relative address, and two-byte number n.
576  Jump to the address N times, then fail. */
577  /* ifdef MBS_SUPPORT, the size of address is 1. */
578  jump_n,
579 
580  /* Set the following two-byte relative address to the
581  subsequent two-byte number. The address *includes* the two
582  bytes of number. */
583  /* ifdef MBS_SUPPORT, the size of address is 1. */
585 
586  wordchar, /* Matches any word-constituent character. */
587  notwordchar, /* Matches any char that is not a word-constituent. */
588 
589  wordbeg, /* Succeeds if at word beginning. */
590  wordend, /* Succeeds if at word end. */
591 
592  wordbound, /* Succeeds if at a word boundary. */
593  notwordbound /* Succeeds if not at a word boundary. */
594 
595 # ifdef emacs
596  ,before_dot, /* Succeeds if before point. */
597  at_dot, /* Succeeds if at point. */
598  after_dot, /* Succeeds if after point. */
599 
600  /* Matches any character whose syntax is specified. Followed by
601  a byte which contains a syntax code, e.g., Sword. */
602  syntaxspec,
603 
604  /* Matches any character whose syntax is not that specified. */
605  notsyntaxspec
606 # endif /* emacs */
607 } re_opcode_t;
Definition: regex.c:458
Definition: regex.c:464
Definition: regex.c:523
Definition: regex.c:516
Definition: regex.c:519
Definition: regex.c:487
Definition: regex.c:472
re_opcode_t
Definition: regex.c:456
Definition: regex.c:461
Definition: regex.c:526
Definition: regex.c:589
Definition: regex.c:529
Definition: regex.c:578
Definition: regex.c:590

Function Documentation

static reg_errcode_t byte_regex_compile _RE_ARGS ( (const char *pattern, size_t size, reg_syntax_t syntax, struct re_pattern_buffer *bufp )
static
for ( this_element  = compile_stack.avail - 1; this_element >= 0; this_element--)

Definition at line 4437 of file regex.c.

4457 {
4458  register CHAR_T *pto = end;
4459  register CHAR_T *pfrom = end - num;
4460 
4461  while (pfrom >= loc)
4462  *pto-- = *pfrom--;
4463 }
4464 #endif /* WCHAR */
4465 
4466 #ifdef WCHAR
4467 static reg_errcode_t
4468 wcs_compile_range (range_start_char, p_ptr, pend, translate, syntax, b,
4469  char_set)
4470  CHAR_T range_start_char;
4471  const CHAR_T **p_ptr, *pend;
4472  CHAR_T *char_set, *b;
4475 {
4476  const CHAR_T *p = *p_ptr;
4477  CHAR_T range_start, range_end;
4479 # ifdef _LIBC
4480  uint32_t nrules;
4481  uint32_t start_val, end_val;
4482 # endif
4483  if (p == pend)
4484  return REG_ERANGE;
4485 
4486 # ifdef _LIBC
4487  nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
4488  if (nrules != 0)
4489  {
4490  const char *collseq = (const char *) _NL_CURRENT(LC_COLLATE,
4491  _NL_COLLATE_COLLSEQWC);
4492  const unsigned char *extra = (const unsigned char *)
4493  _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB);
4494 
4495  if (range_start_char < -1)
4496  {
4497  /* range_start is a collating symbol. */
4498  int32_t *wextra;
4499  /* Retreive the index and get collation sequence value. */
4500  wextra = (int32_t*)(extra + char_set[-range_start_char]);
4501  start_val = wextra[1 + *wextra];
4502  }
4503  else
4504  start_val = collseq_table_lookup(collseq, TRANSLATE(range_start_char));
4505 
4506  end_val = collseq_table_lookup (collseq, TRANSLATE (p[0]));
4507 
4508  /* Report an error if the range is empty and the syntax prohibits
4509  this. */
4510  ret = ((syntax & RE_NO_EMPTY_RANGES)
4511  && (start_val > end_val))? REG_ERANGE : REG_NOERROR;
4512 
4513  /* Insert space to the end of the char_ranges. */
4514  insert_space(2, b - char_set[5] - 2, b - 1);
4515  *(b - char_set[5] - 2) = (wchar_t)start_val;
4516  *(b - char_set[5] - 1) = (wchar_t)end_val;
4517  char_set[4]++; /* ranges_index */
4518  }
4519  else
4520 # endif
4521  {
4522  range_start = (range_start_char >= 0)? TRANSLATE (range_start_char):
4523  range_start_char;
4524  range_end = TRANSLATE (p[0]);
4525  /* Report an error if the range is empty and the syntax prohibits
4526  this. */
4527  ret = ((syntax & RE_NO_EMPTY_RANGES)
4528  && (range_start > range_end))? REG_ERANGE : REG_NOERROR;
4529 
4530  /* Insert space to the end of the char_ranges. */
4531  insert_space(2, b - char_set[5] - 2, b - 1);
4532  *(b - char_set[5] - 2) = range_start;
4533  *(b - char_set[5] - 1) = range_end;
4534  char_set[4]++; /* ranges_index */
4535  }
4536  /* Have to increment the pointer into the pattern string, so the
4537  caller isn't still at the ending character. */
4538  (*p_ptr)++;
4539 
4540  return ret;
4541 }
4542 #else /* BYTE */
4543 /* Read the ending character of a range (in a bracket expression) from the
4544  uncompiled pattern *P_PTR (which ends at PEND). We assume the
4545  starting character is in `P[-2]'. (`P[-1]' is the character `-'.)
4546  Then we set the translation of all bits between the starting and
4547  ending characters (inclusive) in the compiled pattern B.
4548 
4549  Return an error code.
4550 
4551  We use these short variable names so we can use the same macros as
4552  `regex_compile' itself. */
4553 
4554 static reg_errcode_t
4555 byte_compile_range (range_start_char, p_ptr, pend, translate, syntax, b)
4556  unsigned int range_start_char;
4557  const char **p_ptr, *pend;
4558  RE_TRANSLATE_TYPE translate;
4559  reg_syntax_t syntax;
4560  unsigned char *b;
4561 {
4562  unsigned this_char;
4563  const char *p = *p_ptr;
4565 # if _LIBC
4566  const unsigned char *collseq;
4567  unsigned int start_colseq;
4568  unsigned int end_colseq;
4569 # else
4570  unsigned end_char;
4571 # endif
4572 
4573  if (p == pend)
4574  return REG_ERANGE;
4575 
4576  /* Have to increment the pointer into the pattern string, so the
4577  caller isn't still at the ending character. */
4578  (*p_ptr)++;
4579 
4580  /* Report an error if the range is empty and the syntax prohibits this. */
4581  ret = syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
4582 
4583 # if _LIBC
4584  collseq = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
4585  _NL_COLLATE_COLLSEQMB);
4586 
4587  start_colseq = collseq[(unsigned char) TRANSLATE (range_start_char)];
4588  end_colseq = collseq[(unsigned char) TRANSLATE (p[0])];
4589  for (this_char = 0; this_char <= (unsigned char) -1; ++this_char)
4590  {
4591  unsigned int this_colseq = collseq[(unsigned char) TRANSLATE (this_char)];
4592 
4593  if (start_colseq <= this_colseq && this_colseq <= end_colseq)
4594  {
4595  SET_LIST_BIT (TRANSLATE (this_char));
4596  ret = REG_NOERROR;
4597  }
4598  }
4599 # else
4600  /* Here we see why `this_char' has to be larger than an `unsigned
4601  char' -- we would otherwise go into an infinite loop, since all
4602  characters <= 0xff. */
4603  range_start_char = TRANSLATE (range_start_char);
4604  /* TRANSLATE(p[0]) is casted to char (not unsigned char) in TRANSLATE,
4605  and some compilers cast it to int implicitly, so following for_loop
4606  may fall to (almost) infinite loop.
4607  e.g. If translate[p[0]] = 0xff, end_char may equals to 0xffffffff.
4608  To avoid this, we cast p[0] to unsigned int and truncate it. */
4609  end_char = ((unsigned)TRANSLATE(p[0]) & ((1 << BYTEWIDTH) - 1));
4610 
4611  for (this_char = range_start_char; this_char <= end_char; ++this_char)
4612  {
4613  SET_LIST_BIT (TRANSLATE (this_char));
4614  ret = REG_NOERROR;
4615  }
4616 # endif
4617 
4618  return ret;
4619 }
4620 #endif /* WCHAR */
4621 
4622 
4623 /* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in
4624  BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible
4625  characters can start a string that matches the pattern. This fastmap
4626  is used by re_search to skip quickly over impossible starting points.
4627 
4628  The caller must supply the address of a (1 << BYTEWIDTH)-byte data
4629  area as BUFP->fastmap.
4630 
4631  We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in
4632  the pattern buffer.
4633 
4634  Returns 0 if we succeed, -2 if an internal error. */
4635 
4636 #ifdef WCHAR
4637 /* local function for re_compile_fastmap.
4638  truncate wchar_t character to char. */
4639 static unsigned char truncate_wchar (CHAR_T c);
4640 
4641 static unsigned char
4642 truncate_wchar (c)
4643  CHAR_T c;
4644 {
4645  unsigned char buf[MB_CUR_MAX];
4646  mbstate_t state;
4647  int retval;
4648  memset (&state, '\0', sizeof (state));
4649 # ifdef _LIBC
4650  retval = __wcrtomb (buf, c, &state);
4651 # else
4652  retval = wcrtomb (buf, c, &state);
4653 # endif
4654  return retval > 0 ? buf[0] : (unsigned char) c;
4655 }
4656 #endif /* WCHAR */
4657 
4658 static int
4659 PREFIX(re_compile_fastmap) (bufp)
4660  struct re_pattern_buffer *bufp;
4661 {
4662  int j, k;
4663 #ifdef MATCH_MAY_ALLOCATE
4664  PREFIX(fail_stack_type) fail_stack;
4665 #endif
4666 #ifndef REGEX_MALLOC
4667  char *destination;
4668 #endif
4669 
4670  register char *fastmap = bufp->fastmap;
4671 
4672 #ifdef WCHAR
4673  /* We need to cast pattern to (wchar_t*), because we casted this compiled
4674  pattern to (char*) in regex_compile. */
4675  UCHAR_T *pattern = (UCHAR_T*)bufp->buffer;
4676  register UCHAR_T *pend = (UCHAR_T*) (bufp->buffer + bufp->used);
4677 #else /* BYTE */
4678  UCHAR_T *pattern = bufp->buffer;
4679  register UCHAR_T *pend = pattern + bufp->used;
4680 #endif /* WCHAR */
4681  UCHAR_T *p = pattern;
4682 
4683 #ifdef REL_ALLOC
4684  /* This holds the pointer to the failure stack, when
4685  it is allocated relocatably. */
4686  fail_stack_elt_t *failure_stack_ptr;
4687 #endif
4688 
4689  /* Assume that each path through the pattern can be null until
4690  proven otherwise. We set this false at the bottom of switch
4691  statement, to which we get only if a particular path doesn't
4692  match the empty string. */
4693  boolean path_can_be_null = true;
4694 
4695  /* We aren't doing a `succeed_n' to begin with. */
4696  boolean succeed_n_p = false;
4697 
4698  assert (fastmap != NULL && p != NULL);
4699 
4700  INIT_FAIL_STACK ();
4701  bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */
4702  bufp->fastmap_accurate = 1; /* It will be when we're done. */
4703  bufp->can_be_null = 0;
4704 
4705  while (1)
4706  {
4707  if (p == pend || *p == succeed)
4708  {
4709  /* We have reached the (effective) end of pattern. */
4710  if (!FAIL_STACK_EMPTY ())
4711  {
4712  bufp->can_be_null |= path_can_be_null;
4713 
4714  /* Reset for next path. */
4715  path_can_be_null = true;
4716 
4717  p = fail_stack.stack[--fail_stack.avail].pointer;
4718 
4719  continue;
4720  }
4721  else
4722  break;
4723  }
4724 
4725  /* We should never be about to go beyond the end of the pattern. */
4726  assert (p < pend);
4727 
4728  switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
4729  {
4730 
4731  /* I guess the idea here is to simply not bother with a fastmap
4732  if a backreference is used, since it's too hard to figure out
4733  the fastmap for the corresponding group. Setting
4734  `can_be_null' stops `re_search_2' from using the fastmap, so
4735  that is all we do. */
4736  case duplicate:
4737  bufp->can_be_null = 1;
4738  goto done;
4739 
4740 
4741  /* Following are the cases which match a character. These end
4742  with `break'. */
4743 
4744 #ifdef WCHAR
4745  case exactn:
4746  fastmap[truncate_wchar(p[1])] = 1;
4747  break;
4748 #else /* BYTE */
4749  case exactn:
4750  fastmap[p[1]] = 1;
4751  break;
4752 #endif /* WCHAR */
4753 #ifdef MBS_SUPPORT
4754  case exactn_bin:
4755  fastmap[p[1]] = 1;
4756  break;
4757 #endif
4758 
4759 #ifdef WCHAR
4760  /* It is hard to distinguish fastmap from (multi byte) characters
4761  which depends on current locale. */
4762  case charset:
4763  case charset_not:
4764  case wordchar:
4765  case notwordchar:
4766  bufp->can_be_null = 1;
4767  goto done;
4768 #else /* BYTE */
4769  case charset:
4770  for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
4771  if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))
4772  fastmap[j] = 1;
4773  break;
4774 
4775 
4776  case charset_not:
4777  /* Chars beyond end of map must be allowed. */
4778  for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++)
4779  fastmap[j] = 1;
4780 
4781  for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--)
4782  if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))))
4783  fastmap[j] = 1;
4784  break;
4785 
4786 
4787  case wordchar:
4788  for (j = 0; j < (1 << BYTEWIDTH); j++)
4789  if (SYNTAX (j) == Sword)
4790  fastmap[j] = 1;
4791  break;
4792 
4793 
4794  case notwordchar:
4795  for (j = 0; j < (1 << BYTEWIDTH); j++)
4796  if (SYNTAX (j) != Sword)
4797  fastmap[j] = 1;
4798  break;
4799 #endif /* WCHAR */
4800 
4801  case anychar:
4802  {
4803  int fastmap_newline = fastmap['\n'];
4804 
4805  /* `.' matches anything ... */
4806  for (j = 0; j < (1 << BYTEWIDTH); j++)
4807  fastmap[j] = 1;
4808 
4809  /* ... except perhaps newline. */
4810  if (!(bufp->syntax & RE_DOT_NEWLINE))
4811  fastmap['\n'] = fastmap_newline;
4812 
4813  /* Return if we have already set `can_be_null'; if we have,
4814  then the fastmap is irrelevant. Something's wrong here. */
4815  else if (bufp->can_be_null)
4816  goto done;
4817 
4818  /* Otherwise, have to check alternative paths. */
4819  break;
4820  }
4821 
4822 #ifdef emacs
4823  case syntaxspec:
4824  k = *p++;
4825  for (j = 0; j < (1 << BYTEWIDTH); j++)
4826  if (SYNTAX (j) == (enum syntaxcode) k)
4827  fastmap[j] = 1;
4828  break;
4829 
4830 
4831  case notsyntaxspec:
4832  k = *p++;
4833  for (j = 0; j < (1 << BYTEWIDTH); j++)
4834  if (SYNTAX (j) != (enum syntaxcode) k)
4835  fastmap[j] = 1;
4836  break;
4837 
4838 
4839  /* All cases after this match the empty string. These end with
4840  `continue'. */
4841 
4842 
4843  case before_dot:
4844  case at_dot:
4845  case after_dot:
4846  continue;
4847 #endif /* emacs */
4848 
4849 
4850  case no_op:
4851  case begline:
4852  case endline:
4853  case begbuf:
4854  case endbuf:
4855  case wordbound:
4856  case notwordbound:
4857  case wordbeg:
4858  case wordend:
4859  case push_dummy_failure:
4860  continue;
4861 
4862 
4863  case jump_n:
4864  case pop_failure_jump:
4865  case maybe_pop_jump:
4866  case jump:
4867  case jump_past_alt:
4868  case dummy_failure_jump:
4869  EXTRACT_NUMBER_AND_INCR (j, p);
4870  p += j;
4871  if (j > 0)
4872  continue;
4873 
4874  /* Jump backward implies we just went through the body of a
4875  loop and matched nothing. Opcode jumped to should be
4876  `on_failure_jump' or `succeed_n'. Just treat it like an
4877  ordinary jump. For a * loop, it has pushed its failure
4878  point already; if so, discard that as redundant. */
4879  if ((re_opcode_t) *p != on_failure_jump
4880  && (re_opcode_t) *p != succeed_n)
4881  continue;
4882 
4883  p++;
4884  EXTRACT_NUMBER_AND_INCR (j, p);
4885  p += j;
4886 
4887  /* If what's on the stack is where we are now, pop it. */
4888  if (!FAIL_STACK_EMPTY ()
4889  && fail_stack.stack[fail_stack.avail - 1].pointer == p)
4890  fail_stack.avail--;
4891 
4892  continue;
4893 
4894 
4895  case on_failure_jump:
4897  handle_on_failure_jump:
4898  EXTRACT_NUMBER_AND_INCR (j, p);
4899 
4900  /* For some patterns, e.g., `(a?)?', `p+j' here points to the
4901  end of the pattern. We don't want to push such a point,
4902  since when we restore it above, entering the switch will
4903  increment `p' past the end of the pattern. We don't need
4904  to push such a point since we obviously won't find any more
4905  fastmap entries beyond `pend'. Such a pattern can match
4906  the null string, though. */
4907  if (p + j < pend)
4908  {
4909  if (!PUSH_PATTERN_OP (p + j, fail_stack))
4910  {
4911  RESET_FAIL_STACK ();
4912  return -2;
4913  }
4914  }
4915  else
4916  bufp->can_be_null = 1;
4917 
4918  if (succeed_n_p)
4919  {
4920  EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */
4921  succeed_n_p = false;
4922  }
4923 
4924  continue;
4925 
4926 
4927  case succeed_n:
4928  /* Get to the number of times to succeed. */
4929  p += OFFSET_ADDRESS_SIZE;
4930 
4931  /* Increment p past the n for when k != 0. */
4932  EXTRACT_NUMBER_AND_INCR (k, p);
4933  if (k == 0)
4934  {
4935  p -= 2 * OFFSET_ADDRESS_SIZE;
4936  succeed_n_p = true; /* Spaghetti code alert. */
4937  goto handle_on_failure_jump;
4938  }
4939  continue;
4940 
4941 
4942  case set_number_at:
4943  p += 2 * OFFSET_ADDRESS_SIZE;
4944  continue;
4945 
4946 
4947  case start_memory:
4948  case stop_memory:
4949  p += 2;
4950  continue;
4951 
4952 
4953  default:
4954  abort (); /* We have listed all the cases. */
4955  } /* switch *p++ */
4956 
4957  /* Getting here means we have found the possible starting
4958  characters for one path of the pattern -- and that the empty
4959  string does not match. We need not follow this path further.
4960  Instead, look at the next alternative (remembered on the
4961  stack), or quit if no more. The test at the top of the loop
4962  does these things. */
4963  path_can_be_null = false;
4964  p = pend;
4965  } /* while p */
4966 
4967  /* Set `can_be_null' for the last path (also the first path, if the
4968  pattern is empty). */
4969  bufp->can_be_null |= path_can_be_null;
4970 
4971  done:
4972  RESET_FAIL_STACK ();
4973  return 0;
4974 }
4975 
4976 #else /* not INSIDE_RECURSION */
4977 
4978 int
4979 re_compile_fastmap (bufp)
4980  struct re_pattern_buffer *bufp;
4981 {
4982 # ifdef MBS_SUPPORT
4983  if (MB_CUR_MAX != 1)
4984  return wcs_re_compile_fastmap(bufp);
4985  else
4986 # endif
4987  return byte_re_compile_fastmap(bufp);
4988 } /* re_compile_fastmap */
#define SWITCH_ENUM_CAST(x)
Definition: regex.c:178
Definition: regex.c:458
#define BYTEWIDTH
Definition: regex.c:397
Definition: regex.c:464
void struct re_pattern_buffer * bufp
Definition: regex.c:5010
Definition: regex.c:523
Definition: regex.c:516
char * fastmap
Definition: regex.h:348
Definition: regex.c:519
Definition: regex.c:487
Definition: regex.c:472
reg_syntax_t syntax
Definition: regex.h:343
re_opcode_t
Definition: regex.c:456
else preg translate
Definition: regex.c:8111
Definition: regex.c:461
#define bzero(s, n)
Definition: regex.c:151
Definition: regex.c:526
#define NULL
Definition: regex.c:247
Definition: regex.c:589
unsigned long int reg_syntax_t
Definition: regex.h:51
Definition: regex.c:529
reg_errcode_t
Definition: regex.h:288
reg_syntax_t reg_syntax_t syntax
Definition: regex.c:1349
#define RE_TRANSLATE_TYPE
Definition: regex.h:325
unsigned fastmap_accurate
Definition: regex.h:377
#define RE_NO_EMPTY_RANGES
Definition: regex.h:140
unsigned long int used
Definition: regex.h:340
preg fastmap
Definition: regex.c:8094
const char *const char * pattern
Definition: regex.c:7927
unsigned can_be_null
Definition: regex.h:364
unsigned char * buffer
Definition: regex.h:334
#define RE_DOT_NEWLINE
Definition: regex.h:96
Definition: regex.c:578
reg_syntax_t ret
Definition: regex.c:1351
#define SYNTAX(c)
Definition: regex.c:298
Definition: regex.c:590
#define const
Definition: zconf.h:85
#define Sword
Definition: regex.c:172
free ( preg->  fastmap)
return gettext ( re_error_msgid re_error_msgid_idx[(int) ret])
if ( cflags REG_ICASE)

Definition at line 8096 of file regex.c.

8097  {
8098  unsigned i;
8099 
8100  preg->translate
8102  * sizeof (*(RE_TRANSLATE_TYPE)0));
8103  if (preg->translate == NULL)
8104  return (int) REG_ESPACE;
8105 
8106  /* Map uppercase characters to corresponding lowercase ones. */
8107  for (i = 0; i < CHAR_SET_SIZE; i++)
8108  preg->translate[i] = ISUPPER (i) ? TOLOWER (i) : i;
8109  }
#define NULL
Definition: regex.c:247
char * malloc()
#define RE_TRANSLATE_TYPE
Definition: regex.h:325
int regex_t * preg
Definition: regex.c:8079
#define CHAR_SET_SIZE
Definition: regex.c:265
#define ISUPPER(c)
Definition: regex.c:237
RE_TRANSLATE_TYPE translate
Definition: regex.h:354
#define TOLOWER(c)
Definition: regex.c:243
if ( ret  = REG_ERPAREN)

Definition at line 8137 of file regex.c.

8140  {
8141  /* Compute the fastmap now, since regexec cannot modify the pattern
8142  buffer. */
8143  if (re_compile_fastmap (preg) == -2)
8144  {
8145  /* Some error occurred while computing the fastmap, just forget
8146  about it. */
8147  free (preg->fastmap);
8148  preg->fastmap = NULL;
8149  }
8150  }
char * fastmap
Definition: regex.h:348
#define NULL
Definition: regex.c:247
free(preg->fastmap)
int regex_t * preg
Definition: regex.c:8079
if ( errcode< 0||errcode = (int) (sizeof (re_error_msgid_idx)    / sizeof (re_error_msgid_idx[0])))

Definition at line 8250 of file regex.c.

8264  {
8265  if (msg_size > errbuf_size)
8266  {
8267 #if defined HAVE_MEMPCPY || defined _LIBC
8268  *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
8269 #else
8270  memcpy (errbuf, msg, errbuf_size - 1);
8271  errbuf[errbuf_size - 1] = 0;
8272 #endif
8273  }
8274  else
8275  memcpy (errbuf, msg, msg_size);
8276  }
size_t msg_size
Definition: regex.c:8246
char * errbuf
Definition: regex.c:8244
size_t errbuf_size
Definition: regex.c:8245
static void init_syntax_once ( )
static

Definition at line 278 of file regex.c.

279 {
280  register int c;
281  static int done = 0;
282 
283  if (done)
284  return;
286 
287  for (c = 0; c < CHAR_SET_SIZE; ++c)
288  if (ISALNUM (c))
289  re_syntax_table[c] = Sword;
290 
291  re_syntax_table['_'] = Sword;
292 
293  done = 1;
294 }
static char re_syntax_table[CHAR_SET_SIZE]
Definition: regex.c:273
#define bzero(s, n)
Definition: regex.c:151
#define ISALNUM(c)
Definition: regex.c:231
#define CHAR_SET_SIZE
Definition: regex.c:265
#define Sword
Definition: regex.c:172
char* malloc ( )
static void init_syntax_once PARAMS ( (void)  )
static
static int byte_re_match_2_internal PARAMS ( (struct re_pattern_buffer *bufp, const char *string1, int size1, const char *string2, int size2, int pos, struct re_registers *regs, int stop )
static
static int byte_re_search_2 PARAMS ( (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 )
static
static int byte_re_compile_fastmap PARAMS ( (struct re_pattern_buffer *bufp )
static
char* realloc ( )
return ( int  )

Definition at line 8152 of file regex.c.

8180 {
8181  int ret;
8182  struct re_registers regs;
8183  regex_t private_preg;
8184  int len = strlen (string);
8185  boolean want_reg_info = !preg->no_sub && nmatch > 0;
8186 
8187  private_preg = *preg;
8188 
8189  private_preg.not_bol = !!(eflags & REG_NOTBOL);
8190  private_preg.not_eol = !!(eflags & REG_NOTEOL);
8191 
8192  /* The user has told us exactly how many registers to return
8193  information about, via `nmatch'. We have to pass that on to the
8194  matching routines. */
8195  private_preg.regs_allocated = REGS_FIXED;
8196 
8197  if (want_reg_info)
8198  {
8199  regs.num_regs = nmatch;
8200  regs.start = TALLOC (nmatch * 2, regoff_t);
8201  if (regs.start == NULL)
8202  return (int) REG_NOMATCH;
8203  regs.end = regs.start + nmatch;
8204  }
8205 
8206  /* Perform the searching operation. */
8207  ret = re_search (&private_preg, string, len,
8208  /* start: */ 0, /* range: */ len,
8209  want_reg_info ? &regs : (struct re_registers *) 0);
8210 
8211  /* Copy the register information to the POSIX structure. */
8212  if (want_reg_info)
8213  {
8214  if (ret >= 0)
8215  {
8216  unsigned r;
8217 
8218  for (r = 0; r < nmatch; r++)
8219  {
8220  pmatch[r].rm_so = regs.start[r];
8221  pmatch[r].rm_eo = regs.end[r];
8222  }
8223  }
8224 
8225  /* If we needed the temporary register info, free the space now. */
8226  free (regs.start);
8227  }
8228 
8229  /* We want zero return to mean success, unlike `re_search'. */
8230  return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH;
8231 }
regoff_t * end
Definition: regex.h:408
struct re_registers * regs
Definition: regex.c:5011
#define REGS_FIXED
Definition: regex.h:372
#define REG_NOTBOL
Definition: regex.h:280
#define NULL
Definition: regex.c:247
#define TALLOC(n, t)
Definition: regex.c:391
free(preg->fastmap)
unsigned num_regs
Definition: regex.h:406
regoff_t * start
Definition: regex.h:407
unsigned not_bol
Definition: regex.h:385
int regex_t * preg
Definition: regex.c:8079
reg_syntax_t ret
Definition: regex.c:1351
int regoff_t
Definition: regex.h:399
unsigned no_sub
Definition: regex.h:381
#define REG_NOTEOL
Definition: regex.h:283

Variable Documentation

preg allocated = 0

Definition at line 8090 of file regex.c.

preg buffer = 0

Definition at line 8089 of file regex.c.

struct re_pattern_buffer * bufp
Initial value:
{
return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
struct re_registers * regs
Definition: regex.c:5011
void struct re_pattern_buffer * bufp
Definition: regex.c:5010
int range
Definition: regex.c:5043
#define NULL
Definition: regex.c:247
int size
Definition: regex.c:5043
int startpos
Definition: regex.c:5043

Definition at line 5010 of file regex.c.

int cflags

Definition at line 8081 of file regex.c.

boolean compile_stack_type compile_stack
static

Definition at line 4432 of file regex.c.

regoff_t * ends

Definition at line 5013 of file regex.c.

char* errbuf

Definition at line 8244 of file regex.c.

size_t errbuf_size

Definition at line 8245 of file regex.c.

size_t int errcode

Definition at line 8242 of file regex.c.

preg fastmap = (char *) malloc (1 << BYTEWIDTH)

Definition at line 8094 of file regex.c.

preg fastmap_accurate = 0

Definition at line 8301 of file regex.c.

size_t length

Definition at line 7928 of file regex.c.

return msg_size
Initial value:
{
const char *msg

Definition at line 8246 of file regex.c.

else preg newline_anchor = 1

Definition at line 7943 of file regex.c.

preg no_sub = 0

Definition at line 7940 of file regex.c.

return NULL

Definition at line 7953 of file regex.c.

unsigned num_regs

Definition at line 5012 of file regex.c.

const char * pattern

Definition at line 7927 of file regex.c.

int pos

Definition at line 5534 of file regex.c.

void regex_t * preg

Definition at line 8079 of file regex.c.

int range

Definition at line 5043 of file regex.c.

const char re_error_msgid[]
static

Definition at line 1372 of file regex.c.

const size_t re_error_msgid_idx[]
static
Initial value:
=
{
}
#define REG_BADBR_IDX
#define REG_ESIZE_IDX
#define REG_ESUBREG_IDX
#define REG_BADRPT_IDX
#define REG_ECOLLATE_IDX
#define REG_EPAREN_IDX
#define REG_EEND_IDX
#define REG_ERPAREN_IDX
#define REG_NOMATCH_IDX
#define REG_ESPACE_IDX
#define REG_ECTYPE_IDX
#define REG_BADPAT_IDX
#define REG_NOERROR_IDX
#define REG_EESCAPE_IDX
#define REG_ERANGE_IDX
#define REG_EBRACK_IDX
#define REG_EBRACE_IDX

Definition at line 1426 of file regex.c.

re_syntax_options = syntax

Definition at line 1337 of file regex.c.

char re_syntax_table[CHAR_SET_SIZE]
static

Definition at line 273 of file regex.c.

regnum_t regnum

Definition at line 4433 of file regex.c.

struct re_registers * regs

Definition at line 5011 of file regex.c.

bufp regs_allocated = REGS_UNALLOCATED

Definition at line 7935 of file regex.c.

return result
Initial value:
= byte_re_match_2_internal (bufp, NULL, 0, string, size,
struct re_registers * regs
Definition: regex.c:5011
int pos
Definition: regex.c:5534
void struct re_pattern_buffer * bufp
Definition: regex.c:5010
#define NULL
Definition: regex.c:247
int size
Definition: regex.c:5043

Definition at line 5545 of file regex.c.

Definition at line 1351 of file regex.c.

int size

Definition at line 5043 of file regex.c.

int size1

Definition at line 5079 of file regex.c.

int size2

Definition at line 5079 of file regex.c.

int startpos

Definition at line 5043 of file regex.c.

regoff_t* starts

Definition at line 5013 of file regex.c.

int stop

Definition at line 5083 of file regex.c.

const char * string
Initial value:
{
if (num_regs)
{
}
else
{
regs->num_regs = 0;
regs->start = regs->end = (regoff_t *) 0;
}
}
int
regoff_t * end
Definition: regex.h:408
struct re_registers * regs
Definition: regex.c:5011
void struct re_pattern_buffer * bufp
Definition: regex.c:5010
unsigned num_regs
Definition: regex.h:406
#define REGS_UNALLOCATED
Definition: regex.h:370
regoff_t * start
Definition: regex.h:407
regoff_t * starts
Definition: regex.c:5013
#define REGS_REALLOCATE
Definition: regex.h:371
int regoff_t
Definition: regex.h:399
unsigned num_regs
Definition: regex.c:5012
unsigned regs_allocated
Definition: regex.h:373
regoff_t * ends
Definition: regex.c:5013

Definition at line 5014 of file regex.c.

const char * string1

Definition at line 5078 of file regex.c.

const char * string2

Definition at line 5078 of file regex.c.

reg_syntax_t syntax
Initial value:
#define RE_SYNTAX_POSIX_BASIC
Definition: regex.h:219
int cflags
Definition: regex.c:8081
#define REG_EXTENDED
Definition: regex.h:257
#define RE_SYNTAX_POSIX_EXTENDED
Definition: regex.h:228

Definition at line 1349 of file regex.c.

preg translate = NULL

Definition at line 8111 of file regex.c.

preg used = 0

Definition at line 8091 of file regex.c.