Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals

regex.c File Reference

#include "config.h"
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
#include <stddef.h>
#include "defines.h"
#include <alloca.h>
#include "regex.h"
#include "util.h"

Go to the source code of this file.

Defines

#define PARAMS(args)   ()
#define volatile
#define args   args
#define RUBY
#define CHECK_INTS
#define FREE_VARIABLES()
#define FREE_AND_RETURN_VOID(stackb)
#define FREE_AND_RETURN(stackb, val)
#define DOUBLE_STACK(type)
#define RE_TALLOC(n, t)   ((t*)alloca((n)*sizeof(t)))
#define TMALLOC(n, t)   ((t*)xmalloc((n)*sizeof(t)))
#define TREALLOC(s, n, t)   (s=((t*)xrealloc(s,(n)*sizeof(t))))
#define EXPAND_FAIL_STACK()   DOUBLE_STACK(unsigned char*)
#define ENSURE_FAIL_STACK(n)
#define Sword   1
#define Sword2   2
#define SYNTAX(c)   re_syntax_table[c]
#define re_warning(x)   rb_warn(x)
#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 NFAILURES   160
#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 TRANSLATE_P()   ((options&RE_OPTION_IGNORECASE) && translate)
#define MAY_TRANSLATE()   ((bufp->options&(RE_OPTION_IGNORECASE|RE_MAY_IGNORECASE)) && translate)
#define PATFETCH(c)
#define PATFETCH_RAW(c)
#define PATUNFETCH   p--
#define MBC2WC(c, p)
#define PATFETCH_MBC(c)
#define WC2MBC1ST(c)   ((current_mbctype != MBCTYPE_UTF8) ? ((c<0x100) ? (c) : (((c)>>8)&0xff)) : utf8_firstbyte(c))
#define mbc_startpos(start, pos)   (*mbc_startpos_func[current_mbctype])((start), (pos))
#define INIT_BUF_SIZE   28
#define GET_BUFFER_SPACE(n)
#define BUFPUSH(ch)
#define EXTEND_BUFFER
#define SET_LIST_BIT(c)
#define GET_UNSIGNED_NUMBER(num)
#define STREQ(s1, s2)   ((strcmp(s1, s2) == 0))
#define CHAR_CLASS_MAX_LENGTH   6
#define IS_CHAR_CLASS(string)
#define STORE_MBC(p, c)
#define STORE_MBC_AND_INCR(p, c)
#define EXTRACT_MBC(p)
#define EXTRACT_MBC_AND_INCR(p)
#define EXTRACT_UNSIGNED(p)   ((unsigned char)(p)[0] | (unsigned char)(p)[1] << 8)
#define EXTRACT_UNSIGNED_AND_INCR(p)   ((p) += 2, (unsigned char)(p)[-2] | (unsigned char)(p)[-1] << 8)
#define ERROR_MSG_MAX_SIZE   200
#define trans_eq(c1, c2, translate)   (translate?(translate[c1]==translate[c2]):((c1)==(c2)))
#define IS_ACTIVE(R)   ((R).bits.is_active)
#define MATCHED_SOMETHING(R)   ((R).bits.matched_something)
#define NUM_REG_ITEMS   3
#define NUM_COUNT_ITEMS   2
#define NUM_NONREG_ITEMS   4
#define MAX_NUM_FAILURE_ITEMS   (num_regs * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
#define NUM_FAILURE_ITEMS   (last_used_reg * NUM_REG_ITEMS + NUM_NONREG_ITEMS + 1)
#define PUSH_FAILURE_COUNT(ptr)
#define PUSH_FAILURE_POINT(pattern_place, string_place)
#define NON_GREEDY   ((unsigned char*)1)
#define POP_FAILURE_COUNT()
#define POP_FAILURE_POINT()
#define REG_UNSET_VALUE   ((unsigned char*)-1)
#define REG_UNSET(e)   ((e) == REG_UNSET_VALUE)
#define PREFETCH   if (d == dend) goto fail
#define SET_REGS_MATCHED
#define AT_STRINGS_BEG(d)   ((d) == string)
#define AT_STRINGS_END(d)   ((d) == dend)
#define IS_A_LETTER(d)
#define PREV_IS_A_LETTER(d)
#define mbc_isfirst(t, c)   (t)[(unsigned char)(c)]
#define mbc_len(t, c)   ((t)[(unsigned char)(c)]+1)
#define euc_islead(c)   ((unsigned char)((c) - 0xa1) > 0xfe - 0xa1)
#define euc_mbclen(c)   mbc_len(mbctab_euc, (c))
#define sjis_isfirst(c)   mbc_isfirst(mbctab_sjis, (c))
#define sjis_istrail(c)   mbctab_sjis_trail[(unsigned char)(c)]
#define sjis_mbclen(c)   mbc_len(mbctab_sjis, (c))
#define utf8_islead(c)   ((unsigned char)((c) & 0xc0) != 0x80)
#define utf8_mbclen(c)   mbc_len(mbctab_utf8, (c))

Typedefs

typedef unsigned int(* mbc_startpos_func_t )(const char *string, unsigned int pos)

Enumerations

enum  regexpcode {
  unused = 0, exactn = 1, begline, endline,
  begbuf, endbuf, endbuf2, begpos,
  jump, jump_past_alt, on_failure_jump, finalize_jump,
  maybe_finalize_jump, dummy_failure_jump, push_dummy_failure, succeed_n,
  jump_n, try_next, finalize_push, finalize_push_n,
  set_number_at, anychar, anychar_repeat, charset,
  charset_not, start_memory, stop_memory, start_paren,
  stop_paren, casefold_on, casefold_off, option_set,
  start_nowidth, stop_nowidth, pop_and_fail, stop_backtrack,
  duplicate, wordchar, notwordchar, wordbeg,
  wordend, wordbound, notwordbound
}

Functions

void rb_trap_exec (void)
void store_jump (char *, int, char *)
void insert_jump (int, char *, char *, char *)
void store_jump_n (char *, int, char *, unsigned)
void insert_jump_n (int, char *, char *, char *, unsigned)
void insert_op (int, char *, char *)
void insert_op_2 (int, char *, char *, int, int)
int memcmp_translate (unsigned char *, unsigned char *, int)
void init_syntax_once (void)
void init_regs (struct re_registers *, unsigned int)
void bm_init_skip (int *, unsigned char *, int, const unsigned char *)
void rb_warn (const char *,...)
void re_set_casetable (char *table) const
long re_set_syntax (long syntax)
unsigned int asc_startpos (const char *string, unsigned int pos)
unsigned int euc_startpos (const char *string, unsigned int pos)
unsigned int sjis_startpos (const char *string, unsigned int pos)
unsigned int utf8_startpos (const char *string, unsigned int pos)
unsigned int utf8_firstbyte (unsigned long c)
void print_mbc (unsigned int c)
void set_list_bits (unsigned long c1, unsigned long c2, unsigned char *b)
int is_in_list_sbc (unsigned long c, const unsigned char *b)
int is_in_list_mbc (unsigned long c, const unsigned char *b)
int is_in_list (unsigned long c, const unsigned char *b)
void print_partial_compiled_pattern (unsigned char *start, unsigned char *end)
void print_compiled_pattern (struct re_pattern_buffer *bufp)
char * calculate_must_string (char *start, char *end)
unsigned int read_backslash (int c)
unsigned int read_special (char *p, char *pend, char **pp) const
char * re_compile_pattern (char *pattern, int size, struct re_pattern_buffer *bufp) const
void re_free_pattern (struct re_pattern_buffer *bufp)
int slow_match (unsigned char *little, unsigned char *lend, const unsigned char *big, const unsigned char *bend, const unsigned char *translate) const
int slow_search (unsigned char *little, int llen, const unsigned char *big, int blen, const char *translate) const
int bm_search (unsigned char *little, int llen, const unsigned char *big, int blen, int *skip, const unsigned char *translate) const
void re_compile_fastmap (struct re_pattern_buffer *bufp)
int re_adjust_startpos (struct re_pattern_buffer *bufp, const char *string, int size, int startpos, int range)
int re_match_exec (struct re_pattern_buffer *, const char *, int, int, int, struct re_registers *)
int re_search (struct re_pattern_buffer *bufp, const char *string, int size, int startpos, int range, struct re_registers *regs)
int re_match (struct re_pattern_buffer *bufp, const char *string_arg, int size, int pos, struct re_registers *regs)
void re_copy_registers (struct re_registers *regs1, struct re_registers *regs2)
void re_free_registers (struct re_registers *regs)
void re_mbcinit (int mbctype)
unsigned int asc_startpos (char *string, unsigned int pos) const
unsigned int euc_startpos (char *string, unsigned int pos) const
unsigned int sjis_startpos (char *string, unsigned int pos) const
unsigned int utf8_startpos (char *string, unsigned int pos) const

Variables

int rb_prohibit_interrupt
int rb_trap_pending
char re_syntax_table [256]
const unsigned char * translate = 0
int current_mbctype = MBCTYPE_ASCII
const mbc_startpos_func_t mbc_startpos_func [4]
const unsigned char mbctab_ascii []
const unsigned char mbctab_euc []
const unsigned char mbctab_sjis []
const unsigned char mbctab_sjis_trail []
const unsigned char mbctab_utf8 []
const unsigned char * re_mbctab = mbctab_ascii


Define Documentation

#define args   args
 

Definition at line 59 of file regex.c.

#define AT_STRINGS_BEG  )     ((d) == string)
 

Definition at line 3465 of file regex.c.

Referenced by re_match_exec().

#define AT_STRINGS_END  )     ((d) == dend)
 

Definition at line 3466 of file regex.c.

Referenced by re_match_exec().

#define BUFPUSH ch   ) 
 

Value:

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

Definition at line 550 of file regex.c.

Referenced by re_compile_pattern().

#define CHAR_CLASS_MAX_LENGTH   6
 

Definition at line 601 of file regex.c.

Referenced by re_compile_pattern().

#define CHECK_INTS
 

Value:

do {\
    if (!rb_prohibit_interrupt) {\
        if (rb_trap_pending) rb_trap_exec();\
    }\
} while (0)

Definition at line 72 of file regex.c.

Referenced by load_wait(), rb_call0(), rb_eval(), rb_f_loop(), rb_yield_0(), and re_match_exec().

#define DOUBLE_STACK type   ) 
 

Value:

do {                                            \
  type *stackx;                                                         \
  unsigned int xlen = stacke - stackb;                                  \
  if (stackb == stacka) {                                               \
    stackx = (type*)xmalloc(2 * xlen * sizeof(type));                   \
    memcpy(stackx, stackb, xlen * sizeof (type));                       \
  }                                                                     \
  else {                                                                \
    stackx = (type*)xrealloc(stackb, 2 * xlen * sizeof(type));          \
  }                                                                     \
                                                \
  stackp = stackx + (stackp - stackb);                                  \
  stackb = stackx;                                                      \
  stacke = stackb + 2 * xlen;                                           \
} while (0)

Definition at line 122 of file regex.c.

Referenced by re_compile_pattern().

#define ENSURE_FAIL_STACK  ) 
 

Value:

do {                                                                    \
    if (stacke - stackp <= (n)) {                                       \
                                                                        \
                                                                        \
                                \
        EXPAND_FAIL_STACK();                                            \
      }                                                                 \
  } while (0)

Definition at line 143 of file regex.c.

#define ERROR_MSG_MAX_SIZE   200
 

Referenced by re_compile_pattern().

#define euc_islead  )     ((unsigned char)((c) - 0xa1) > 0xfe - 0xa1)
 

Definition at line 4576 of file regex.c.

Referenced by euc_startpos().

#define euc_mbclen  )     mbc_len(mbctab_euc, (c))
 

Definition at line 4577 of file regex.c.

Referenced by euc_startpos().

 
#define EXPAND_FAIL_STACK  )     DOUBLE_STACK(unsigned char*)
 

Definition at line 142 of file regex.c.

Referenced by re_compile_fastmap().

#define EXTEND_BUFFER
 

Value:

do { char *old_buffer = bufp->buffer;                                   \
    if (bufp->allocated == (1L<<16)) goto too_big;                      \
    bufp->allocated *= 2;                                               \
    if (bufp->allocated > (1L<<16)) bufp->allocated = (1L<<16);         \
    bufp->buffer = (char*)xrealloc(bufp->buffer, bufp->allocated);      \
    if (bufp->buffer == 0)                                              \
      goto memory_exhausted;                                            \
    b = (b - 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;              \
    begalt = (begalt - old_buffer) + bufp->buffer;                      \
    if (pending_exact)                                                  \
      pending_exact = (pending_exact - old_buffer) + bufp->buffer;      \
  } while (0)

Definition at line 560 of file regex.c.

Referenced by re_compile_pattern().

#define EXTRACT_MBC  ) 
 

Value:

((unsigned int)((unsigned char)(p)[0] << 24 |                           \
                    (unsigned char)(p)[1] << 16 |                       \
                    (unsigned char)(p)[2] <<  8 |                       \
                    (unsigned char)(p)[3]))

Definition at line 627 of file regex.c.

Referenced by is_in_list_mbc(), re_compile_fastmap(), and set_list_bits().

#define EXTRACT_MBC_AND_INCR  ) 
 

Value:

((unsigned int)((p) += 4,                                               \
                    (unsigned char)(p)[-4] << 24 |                      \
                    (unsigned char)(p)[-3] << 16 |                      \
                    (unsigned char)(p)[-2] <<  8 |                      \
                    (unsigned char)(p)[-1]))

Definition at line 633 of file regex.c.

Referenced by print_partial_compiled_pattern().

#define EXTRACT_NUMBER destination,
source   ) 
 

Value:

do { (destination) = *(source) & 0377;                          \
    (destination) += SIGN_EXTEND_CHAR(*(char*)((source) + 1)) << 8; } while (0)

Definition at line 403 of file regex.c.

Referenced by re_compile_fastmap(), and re_match_exec().

#define EXTRACT_NUMBER_AND_INCR destination,
source   ) 
 

Value:

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

Definition at line 410 of file regex.c.

Referenced by calculate_must_string(), print_partial_compiled_pattern(), re_compile_fastmap(), and re_match_exec().

#define EXTRACT_UNSIGNED  )     ((unsigned char)(p)[0] | (unsigned char)(p)[1] << 8)
 

Definition at line 640 of file regex.c.

Referenced by is_in_list_mbc(), re_compile_fastmap(), re_compile_pattern(), re_match_exec(), and set_list_bits().

#define EXTRACT_UNSIGNED_AND_INCR  )     ((p) += 2, (unsigned char)(p)[-2] | (unsigned char)(p)[-1] << 8)
 

Definition at line 642 of file regex.c.

Referenced by calculate_must_string(), and print_partial_compiled_pattern().

#define FREE_AND_RETURN stackb,
val   ) 
 

Value:

do {                            \
  FREE_VARIABLES();                                                     \
  if (stackb != stacka) xfree(stackb);                                  \
  return(val);                                                          \
} while(0)

Definition at line 116 of file regex.c.

Referenced by re_compile_pattern(), and re_match_exec().

#define FREE_AND_RETURN_VOID stackb   ) 
 

Value:

do {                            \
  FREE_VARIABLES();                                                     \
  if (stackb != stacka) xfree(stackb);                                  \
  return;                                                               \
} while(0)

Definition at line 110 of file regex.c.

Referenced by re_compile_fastmap().

 
#define FREE_VARIABLES  ) 
 

Definition at line 107 of file regex.c.

#define GET_BUFFER_SPACE  ) 
 

Value:

do {                                                                    \
    while (b - bufp->buffer + (n) >= bufp->allocated)                   \
      EXTEND_BUFFER;                                                    \
  } while (0)

Definition at line 543 of file regex.c.

Referenced by re_compile_pattern().

#define GET_UNSIGNED_NUMBER num   ) 
 

Value:

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

Definition at line 585 of file regex.c.

Referenced by re_compile_pattern().

#define INIT_BUF_SIZE   28
 

Definition at line 540 of file regex.c.

Referenced by re_compile_pattern().

#define IS_A_LETTER  ) 
 

Value:

(SYNTAX(*(d)) == Sword ||                       \
                        (current_mbctype ?                              \
                         (re_mbctab[*(d)] && ((d)+mbclen(*(d)))<=dend): \
                         SYNTAX(*(d)) == Sword2))

Definition at line 3468 of file regex.c.

Referenced by re_match_exec().

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

Definition at line 3354 of file regex.c.

Referenced by re_match_exec().

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

Referenced by re_compile_pattern().

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

Definition at line 258 of file regex.c.

Referenced by process_sflag(), rb_intern(), rb_str_succ(), and re_compile_pattern().

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

Definition at line 259 of file regex.c.

Referenced by pack_pack(), rb_proc_exec(), rb_symname_p(), re_compile_pattern(), and regx_options().

#define ISASCII  )     1
 

Definition at line 239 of file regex.c.

Referenced by rb_cstr_to_inum(), and rb_intern().

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

Definition at line 247 of file regex.c.

Referenced by re_compile_pattern().

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

Definition at line 260 of file regex.c.

Referenced by re_compile_pattern().

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

Definition at line 257 of file regex.c.

Referenced by flo_to_s(), is_special_global_name(), pack_pack(), pack_unpack(), rb_cstr_to_dbl(), rb_f_sprintf(), rb_intern(), rb_scan_args(), re_compile_pattern(), and ruby_strtod().

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

Definition at line 252 of file regex.c.

Referenced by re_compile_pattern().

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

Definition at line 261 of file regex.c.

Referenced by rb_str_capitalize_bang(), rb_str_swapcase_bang(), rb_str_upcase_bang(), and re_compile_pattern().

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

Definition at line 256 of file regex.c.

Referenced by proc_options(), rb_f_sprintf(), rb_reg_expr_str(), rb_str_dump(), rb_str_inspect(), and re_compile_pattern().

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

Definition at line 262 of file regex.c.

Referenced by re_compile_pattern().

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

Definition at line 263 of file regex.c.

Referenced by load_file(), moreswitches(), pack_pack(), pack_unpack(), parse_string(), proc_options(), rb_cstr_to_dbl(), rb_cstr_to_inum(), rb_proc_exec(), rb_reg_expr_str(), rb_str_lstrip_bang(), rb_str_rstrip_bang(), rb_str_split_m(), re_compile_pattern(), ruby_strtod(), tokadd_string(), and whole_match_p().

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

Definition at line 264 of file regex.c.

Referenced by rb_intern(), rb_str_capitalize_bang(), rb_str_downcase_bang(), rb_str_swapcase_bang(), rb_symname_p(), and re_compile_pattern().

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

Definition at line 265 of file regex.c.

Referenced by re_compile_pattern().

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

Definition at line 3355 of file regex.c.

Referenced by re_match_exec().

#define MAX_NUM_FAILURE_ITEMS   (num_regs * NUM_REG_ITEMS + NUM_NONREG_ITEMS)
 

Definition at line 3372 of file regex.c.

Referenced by re_match_exec().

 
#define MAY_TRANSLATE  )     ((bufp->options&(RE_OPTION_IGNORECASE|RE_MAY_IGNORECASE)) && translate)
 

Definition at line 433 of file regex.c.

Referenced by re_compile_pattern(), and re_search().

#define MBC2WC c,
 ) 
 

Value:

do {                                                                    \
    if (current_mbctype == MBCTYPE_UTF8) {                              \
      int n = mbclen(c) - 1;                                            \
      c &= (1<<(BYTEWIDTH-2-n)) - 1;                                    \
      while (n--) {                                                     \
        c = c << 6 | (*p++ & ((1<<6)-1));                               \
      }                                                                 \
    }                                                                   \
    else {                                                              \
      c <<= 8;                                                          \
      c |= (unsigned char)*(p)++;                                       \
    }                                                                   \
  } while (0)

Definition at line 454 of file regex.c.

Referenced by re_match_exec().

#define mbc_isfirst t,
 )     (t)[(unsigned char)(c)]
 

Definition at line 4565 of file regex.c.

#define mbc_len t,
 )     ((t)[(unsigned char)(c)]+1)
 

Definition at line 4566 of file regex.c.

#define mbc_startpos start,
pos   )     (*mbc_startpos_func[current_mbctype])((start), (pos))
 

Definition at line 489 of file regex.c.

Referenced by re_adjust_startpos().

#define NFAILURES   160
 

Definition at line 385 of file regex.c.

Referenced by re_compile_fastmap(), and re_match_exec().

#define NON_GREEDY   ((unsigned char*)1)
 

Definition at line 3421 of file regex.c.

Referenced by re_match_exec().

#define NULL   (void *)0
 

Definition at line 268 of file regex.c.

Referenced by calculate_must_string(), dir_close(), dir_each(), dir_initialize(), dir_s_alloc(), dln_find_1(), dln_load(), dln_strerror(), eval(), file_load_ok(), fnmatch(), glob_helper(), here_document(), Init_Hash(), Init_IO(), Init_process(), init_sigchld(), io_reopen(), load_file(), make_regexp(), print_partial_compiled_pattern(), proc_exec_v(), proc_setgroups(), proc_setsid(), range(), range_each(), rb_fdopen(), rb_fopen(), rb_io_flags_mode(), rb_io_fread(), rb_io_fwrite(), rb_io_modenum_mode(), rb_io_reopen(), rb_io_wait_readable(), rb_io_wait_writable(), rb_parser_realloc(), rb_path_last_separator(), rb_proc_exec(), rb_reg_prepare_re(), rb_remove_event_hook(), rb_stat_init(), rb_svar(), rb_thread_cleanup(), rb_thread_start_timer(), rb_thread_stop_timer(), rb_trap_restore_mask(), rb_waitpid(), ruby_init_loadpath(), ruby_strtod(), search_time_t(), set_arg0(), set_arg0space(), stat_new_0(), timeofday(), trap_ensure(), usage(), and yyparse().

#define NUM_COUNT_ITEMS   2
 

Definition at line 3364 of file regex.c.

#define NUM_FAILURE_ITEMS   (last_used_reg * NUM_REG_ITEMS + NUM_NONREG_ITEMS + 1)
 

Definition at line 3375 of file regex.c.

#define NUM_NONREG_ITEMS   4
 

Definition at line 3367 of file regex.c.

#define NUM_REG_ITEMS   3
 

Definition at line 3361 of file regex.c.

#define PARAMS args   )     ()
 

Definition at line 43 of file regex.c.

#define PATFETCH  ) 
 

Value:

do {if (p == pend) goto end_of_pattern;                         \
    c = (unsigned char) *p++;                                           \
    if (TRANSLATE_P()) c = (unsigned char)translate[c]; \
  } while (0)

Definition at line 438 of file regex.c.

Referenced by re_compile_pattern().

#define PATFETCH_MBC  ) 
 

Value:

do {                                                                    \
    if (p + mbclen(c) - 1 >= pend) goto end_of_pattern;                 \
    MBC2WC(c, p);                                                       \
  } while(0)

Definition at line 469 of file regex.c.

Referenced by re_compile_pattern().

#define PATFETCH_RAW  ) 
 

Value:

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

Definition at line 446 of file regex.c.

Referenced by re_compile_pattern(), and read_special().

#define PATUNFETCH   p--
 

Definition at line 452 of file regex.c.

Referenced by re_compile_pattern().

 
#define POP_FAILURE_COUNT  ) 
 

Value:

do {                                                                    \
    unsigned char *ptr = *--stackp;                                     \
    int count = (long)*--stackp;                                        \
    STORE_NUMBER(ptr, count);                                           \
  } while (0)

Definition at line 3423 of file regex.c.

Referenced by re_match_exec().

 
#define POP_FAILURE_POINT  ) 
 

Value:

do {                                                                    \
    long temp;                                                          \
    stackp -= NUM_NONREG_ITEMS;         \
    temp = (long)*--stackp;                     \
    temp *= NUM_REG_ITEMS;              \
    stackp -= temp;                     \
    temp = (long)*--stackp;             \
    while (temp--) {                                                    \
      POP_FAILURE_COUNT();                      \
    }                                                                   \
    num_failure_counts = 0;             \
  } while(0)

Definition at line 3432 of file regex.c.

Referenced by re_match_exec().

#define PREFETCH   if (d == dend) goto fail
 

Definition at line 3450 of file regex.c.

Referenced by re_match_exec().

#define PREV_IS_A_LETTER  ) 
 

Value:

((current_mbctype == MBCTYPE_SJIS)?             \
                             IS_A_LETTER((d)-(!AT_STRINGS_BEG((d)-1)&&  \
                                              ismbchar((d)[-2])?2:1)):  \
                             ((current_mbctype && ((d)[-1] >= 0x80)) || \
                              IS_A_LETTER((d)-1)))

Definition at line 3473 of file regex.c.

Referenced by re_match_exec().

#define PUSH_FAILURE_COUNT ptr   ) 
 

Value:

do {                                                                    \
    int c;                                                              \
    EXTRACT_NUMBER(c, ptr);                                             \
    ENSURE_FAIL_STACK(NUM_COUNT_ITEMS);                                 \
    *stackp++ = (unsigned char*)(long)c;                                \
    *stackp++ = (ptr);                                                  \
    num_failure_counts++;                                               \
  } while (0)

Definition at line 3378 of file regex.c.

Referenced by re_match_exec().

#define PUSH_FAILURE_POINT pattern_place,
string_place   ) 
 

Value:

do {                                                                    \
    long last_used_reg, this_reg;                                       \
                                                                        \
        \
    for (last_used_reg = num_regs-1; last_used_reg > 0; last_used_reg--)\
      if (!REG_UNSET(regstart[last_used_reg]))                          \
        break;                                                          \
                                                                        \
    ENSURE_FAIL_STACK(NUM_FAILURE_ITEMS);                               \
    *stackp++ = (unsigned char*)(long)num_failure_counts;               \
    num_failure_counts = 0;                                             \
                                                                        \
                \
    for (this_reg = 1; this_reg <= last_used_reg; this_reg++) {         \
      *stackp++ = regstart[this_reg];                                   \
      *stackp++ = regend[this_reg];                                     \
      *stackp++ = reg_info[this_reg].word;                              \
    }                                                                   \
                                                                        \
                                \
    *stackp++ = (unsigned char*)last_used_reg;                          \
                                                                        \
    *stackp++ = pattern_place;                                          \
    *stackp++ = string_place;                                           \
    *stackp++ = (unsigned char*)(long)options;          \
    *stackp++ = (unsigned char*)0;              \
  } while(0)

Definition at line 3391 of file regex.c.

Referenced by re_match_exec().

#define RE_TALLOC n,
 )     ((t*)alloca((n)*sizeof(t)))
  <