osprey/cygnus/libiberty/regex.c File Reference

#include <ansidecl.h>
#include <sys/types.h>
#include <strings.h>
#include "xregex.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.

Defines

#define _GNU_SOURCE
#define PARAMS(args)   ()
#define WIDE_CHAR_SUPPORT   (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
#define gettext(msgid)   (msgid)
#define gettext_noop(String)   String
#define memcmp(s1, s2, n)   bcmp (s1, s2, n)
#define memcpy(d, s, n)   (bcopy (s, d, n), (d))
#define Sword   1
#define SWITCH_ENUM_CAST(x)   (x)
#define MB_LEN_MAX   1
#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 TOLOWER(c)   tolower(c)
#define NULL   (void *)0
#define SIGN_EXTEND_CHAR(c)   ((((unsigned char) (c)) ^ 128) - 128)
#define CHAR_SET_SIZE   256
#define SYNTAX(c)   re_syntax_table[(unsigned char) (c)]
#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 BYTE
#define INSIDE_RECURSION
#define DEFINED_ONCE

Typedefs

typedef unsigned long int uintptr_t
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, 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,
  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, 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,
  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/Subroutines

char * malloc ()
char * realloc ()
static void init_syntax_once PARAMS ((void))
static void init_syntax_once ()
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 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))
reg_syntax_t re_set_syntax (reg_syntax_t syntax)
static boolean group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum)
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)
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, size_t 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, preg, char *errbuf, size_t errbuf_size)
void regfree (regex_t *preg)

Variables

static char re_syntax_table [CHAR_SET_SIZE]
reg_syntax_t re_syntax_options
static const char * re_error_msgid []


Define Documentation

#define _GNU_SOURCE

Definition at line 37 of file regex.c.

#define BYTE

Definition at line 655 of file regex.c.

#define BYTEWIDTH   8

Definition at line 405 of file regex.c.

Referenced by re_compile_fastmap(), re_match_2_internal(), regcomp(), and regex_compile().

#define CHAR_SET_SIZE   256

Definition at line 274 of file regex.c.

Referenced by init_syntax_once(), and regcomp().

#define DEFINED_ONCE

Definition at line 8325 of file regex.c.

#define false   0

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

Definition at line 395 of file regex.c.

Referenced by re_match_2_internal().

#define gettext ( msgid   )     (msgid)

Definition at line 113 of file regex.c.

#define gettext_noop ( String   )     String

Definition at line 119 of file regex.c.

#define INSIDE_RECURSION

Definition at line 656 of file regex.c.

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

Definition at line 241 of file regex.c.

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

Definition at line 242 of file regex.c.

#define ISASCII ( c   )     1

Definition at line 222 of file regex.c.

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

Definition at line 230 of file regex.c.

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

Definition at line 243 of file regex.c.

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

Definition at line 240 of file regex.c.

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

Definition at line 235 of file regex.c.

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

Definition at line 244 of file regex.c.

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

Definition at line 239 of file regex.c.

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

Definition at line 245 of file regex.c.

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

Definition at line 246 of file regex.c.

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

Definition at line 247 of file regex.c.

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

Definition at line 248 of file regex.c.

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

Definition at line 411 of file regex.c.

#define MB_LEN_MAX   1

Definition at line 199 of file regex.c.

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

Definition at line 170 of file regex.c.

Referenced by _bfd_ecoff_swap_rndx_in(), _bfd_ecoff_swap_rndx_out(), _bfd_ecoff_swap_tir_in(), _bfd_ecoff_swap_tir_out(), _bfd_elf_section_already_linked(), _bfd_link_section_stabs(), _cpp_equiv_tokens(), _cpp_expansions_different_trad(), _elf_arhdr(), _elf_check_type(), _elf_init_ar(), _fcd_cmp_eq(), _fcd_cmp_gt(), _fcd_cmp_lt(), _find_dupcnt(), _strip_mine(), bcmp(), bundle_state_eq_p(), c_common_valid_pch(), char_rep(), check_trad_stringification(), cie_compare(), compare_constant(), compare_constant_rtx(), cp_tree_equal(), cplus_demangle_opname(), cplus_mangle_opname(), cpp_string_eq(), cpp_valid_state(), create_go32_stub(), d_identifier(), default_pch_valid_p(), demangle_expression(), demangle_function_name(), dump_switch_p(), dump_switch_p_1(), elf32_frvfdpic_relax_section(), Evaluate_phi(), expand_builtin_memcmp(), ffetarget_cmp_character1(), ffetarget_cmp_hollerith(), ffetarget_eq_character1(), ffetarget_ge_character1(), ffetarget_gt_character1(), ffetarget_le_character1(), ffetarget_lt_character1(), ffetarget_ne_character1(), find_answer(), find_param_structure(), fold_build1_stat(), fold_build2_stat(), fold_build3_stat(), fold_builtin_memcmp(), get_base_file_bitmap(), get_file_basename(), get_output_file_with_visibility(), get_special_section(), ht_lookup(), ht_lookup_with_hash(), iq2000_elf_check_relocs(), is_suffix(), SUMMARY_ENTRY_CACHE::Lookup(), m32c_const_ok_for_constraint_p(), m32c_extra_constraint_p2(), m32c_reg_class_from_constraint(), name_is_method_p(), opcodes_eq(), operand_equal_p(), STR_TAB< STR >::equal::operator()(), eq_const_st::operator()(), eq_tcon::operator()(), operator==(), output_reserv_sets(), overloaded_jni_method_exists_p(), PARAMS(), pch_init(), pchf_compare(), pchf_save_compare(), pstrcmp(), re_match_2_internal(), s_cmp(), sbitmap_equal(), sec_merge_hash_lookup(), sh_pch_valid_p(), should_stack_file(), simple_cst_equal(), TB_get_command(), TB_get_tree_code(), and Values_are_cprop_equivalent().

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

Definition at line 173 of file regex.c.

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

Definition at line 412 of file regex.c.

#define NULL   (void *)0

Definition at line 257 of file regex.c.

#define PARAMS ( args   )     ()

Definition at line 51 of file regex.c.

#define REGEX_ALLOCATE   alloca

Definition at line 348 of file regex.c.

#define REGEX_ALLOCATE_STACK   alloca

Definition at line 381 of file regex.c.

#define REGEX_FREE ( arg   )     ((void)0)

Definition at line 356 of file regex.c.

#define REGEX_FREE_STACK ( arg   ) 

Definition at line 386 of file regex.c.

#define REGEX_REALLOCATE ( source,
osize,
nsize   ) 

Value:

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

Definition at line 351 of file regex.c.

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

Definition at line 383 of file regex.c.

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

Definition at line 403 of file regex.c.

Referenced by re_match_2_internal().

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

Definition at line 400 of file regex.c.

Referenced by re_match_2_internal(), and regex_compile().

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

Definition at line 401 of file regex.c.

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

Definition at line 269 of file regex.c.

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

Definition at line 407 of file regex.c.

Referenced by regex_compile().

#define SWITCH_ENUM_CAST (  )     (x)

Definition at line 189 of file regex.c.

Referenced by re_compile_fastmap(), and re_match_2_internal().

#define Sword   1

Definition at line 183 of file regex.c.

Referenced by init_syntax_once(), re_compile_fastmap(), and re_match_2_internal().

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

Definition at line 307 of file regex.c.

Referenced by re_compile_fastmap(), and re_match_2_internal().

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

Definition at line 399 of file regex.c.

Referenced by re_match_2_internal(), regex_compile(), and regexec().

#define TOLOWER ( c   )     tolower(c)

Definition at line 253 of file regex.c.

#define true   1

Definition at line 416 of file regex.c.

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

Definition at line 64 of file regex.c.


Typedef Documentation

typedef char boolean

Definition at line 414 of file regex.c.

typedef unsigned long int uintptr_t

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


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]

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

Definition at line 4384 of file regex.c.

Referenced by regex_compile().

static void init_syntax_once ( void   )  [static]

Definition at line 287 of file regex.c.

References bzero(), c, CHAR_SET_SIZE, ISALNUM, re_syntax_table, and Sword.

Referenced by regex_compile().

char* malloc (  ) 

static int byte_re_compile_fastmap PARAMS ( (struct re_pattern_buffer *bufp)   )  [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_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 void init_syntax_once PARAMS ( (void  )  [static, read]

Definition at line 77 of file cplus-dem.c.

int re_compile_fastmap ( struct re_pattern_buffer bufp  ) 

Definition at line 4931 of file regex.c.

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

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

Definition at line 5480 of file regex.c.

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

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

Definition at line 4990 of file regex.c.

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

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

reg_syntax_t re_set_syntax ( reg_syntax_t  syntax  ) 

Definition at line 1361 of file regex.c.

char* realloc (  ) 

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

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

Definition at line 8184 of file regex.c.

References abort, gettext, memcpy, mempcpy(), msg, and strlen().

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

void regfree ( regex_t preg  ) 

Definition at line 8231 of file regex.c.


Variable Documentation

const char* re_error_msgid[] [static]

Initial value:

  {
    gettext_noop ("Success"), 
    gettext_noop ("No match"),  
    gettext_noop ("Invalid regular expression"), 
    gettext_noop ("Invalid collation character"), 
    gettext_noop ("Invalid character class name"), 
    gettext_noop ("Trailing backslash"), 
    gettext_noop ("Invalid back reference"), 
    gettext_noop ("Unmatched [ or [^"), 
    gettext_noop ("Unmatched ( or \\("), 
    gettext_noop ("Unmatched \\{"), 
    gettext_noop ("Invalid content of \\{\\}"), 
    gettext_noop ("Invalid range end"), 
    gettext_noop ("Memory exhausted"), 
    gettext_noop ("Invalid preceding regular expression"), 
    gettext_noop ("Premature end of regular expression"), 
    gettext_noop ("Regular expression too big"), 
    gettext_noop ("Unmatched ) or \\)") 
  }

Definition at line 1384 of file regex.c.

Definition at line 1350 of file regex.c.

char re_syntax_table[CHAR_SET_SIZE] [static]

Definition at line 282 of file regex.c.

Referenced by init_syntax_once().


Generated on Wed Apr 8 15:03:30 2009 for Open64 by  doxygen 1.5.6