osprey-gcc-4.2.0/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 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 (void)
static reg_errcode_t byte_regex_compile (const char *pattern, size_t size, reg_syntax_t syntax, struct re_pattern_buffer *bufp)
static int byte_re_match_2_internal (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 (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 (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 (const char *pattern, size_t length, struct re_pattern_buffer *bufp)
int regcomp (regex_t *preg, const char *pattern, int cflags)
int regexec (const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags)
size_t regerror (int errcode, const regex_t *preg ATTRIBUTE_UNUSED, 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 35 of file regex.c.

#define BYTE

Definition at line 636 of file regex.c.

#define BYTEWIDTH   8

Definition at line 395 of file regex.c.

#define CHAR_SET_SIZE   256

Definition at line 264 of file regex.c.

#define DEFINED_ONCE

Definition at line 8202 of file regex.c.

#define false   0

Definition at line 405 of file regex.c.

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

Definition at line 385 of file regex.c.

#define gettext ( msgid   )     (msgid)

Definition at line 103 of file regex.c.

#define gettext_noop ( String   )     String

Definition at line 109 of file regex.c.

#define INSIDE_RECURSION

Definition at line 637 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,
b   )     ((a) > (b) ? (a) : (b))

Definition at line 401 of file regex.c.

#define MB_LEN_MAX   1

Definition at line 189 of file regex.c.

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

Definition at line 160 of file regex.c.

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

Definition at line 163 of file regex.c.

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

Definition at line 402 of file regex.c.

#define NULL   (void *)0

Definition at line 247 of file regex.c.

#define REGEX_ALLOCATE   alloca

Definition at line 338 of file regex.c.

#define REGEX_ALLOCATE_STACK   alloca

Definition at line 371 of file regex.c.

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

Definition at line 346 of file regex.c.

#define REGEX_FREE_STACK ( arg   ) 

Definition at line 376 of file regex.c.

#define REGEX_REALLOCATE ( source,
osize,
nsize   ) 

Value:

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

Definition at line 341 of file regex.c.

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

Definition at line 373 of file regex.c.

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

Definition at line 393 of file regex.c.

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

Definition at line 390 of file regex.c.

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

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

#define SWITCH_ENUM_CAST (  )     (x)

Definition at line 179 of file regex.c.

#define Sword   1

Definition at line 173 of file regex.c.

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

Definition at line 297 of file regex.c.

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

Definition at line 389 of file regex.c.

#define TOLOWER ( c   )     tolower(c)

Definition at line 243 of file regex.c.

#define true   1

Definition at line 406 of file regex.c.

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

Definition at line 54 of file regex.c.


Typedef Documentation

typedef char boolean

Definition at line 404 of file regex.c.

typedef unsigned long int uintptr_t

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


Function Documentation

static int byte_re_compile_fastmap ( struct re_pattern_buffer bufp  )  [static]

Referenced by re_compile_fastmap().

static int byte_re_match_2_internal ( struct re_pattern_buffer bufp,
const char *  string1,
int  size1,
const char *  string2,
int  size2,
int  pos,
struct re_registers regs,
int  stop 
) [static]

Referenced by re_match(), and re_match_2().

static int byte_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 
) [static]

Referenced by re_search_2().

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

Referenced by re_compile_pattern(), and regcomp().

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

static void init_syntax_once ( void   )  [static]

Definition at line 277 of file regex.c.

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

char* malloc (  ) 

int re_compile_fastmap ( struct re_pattern_buffer bufp  ) 

Definition at line 4860 of file regex.c.

References byte_re_compile_fastmap().

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

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

Definition at line 5393 of file regex.c.

References alloca, byte_re_match_2_internal(), NULL, and result.

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

References alloca, byte_re_match_2_internal(), NULL, and result.

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

Definition at line 4916 of file regex.c.

References NULL, and re_search_2.

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

References byte_re_search_2().

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

reg_syntax_t re_set_syntax ( reg_syntax_t  syntax  ) 

Definition at line 1324 of file regex.c.

References debug, RE_DEBUG, and ret.

char* realloc (  ) 

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

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

Definition at line 8065 of file regex.c.

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

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

void regfree ( regex_t preg  ) 


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

Definition at line 1313 of file regex.c.

char re_syntax_table[CHAR_SET_SIZE] [static]

Definition at line 272 of file regex.c.


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