1 #ifndef ONIGURUMA_REGINT_H 2 #define ONIGURUMA_REGINT_H 42 #if defined(ONIG_DEBUG_PARSE_TREE) || defined(ONIG_DEBUG_MATCH) || \ 43 defined(ONIG_DEBUG_SEARCH) || defined(ONIG_DEBUG_COMPILE) || \ 44 defined(ONIG_DEBUG_STATISTICS) 50 #if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ 51 defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD86) || \ 53 #define PLATFORM_UNALIGNED_WORD_ACCESS 58 #define USE_NAMED_GROUP 59 #define USE_SUBEXP_CALL 60 #define USE_BACKREF_WITH_LEVEL 61 #define USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT 62 #define USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE 63 #define USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR 68 #define USE_PARSE_TREE_NODE_RECYCLE 69 #define USE_OP_PUSH_OR_JUMP_EXACT 70 #define USE_QTFR_PEEK_NEXT 71 #define USE_ST_LIBRARY 72 #define USE_SHARED_CCLASS_TABLE 74 #define INIT_MATCH_STACK_SIZE 160 75 #define DEFAULT_MATCH_STACK_LIMIT_SIZE 0 78 # define ARG_UNUSED __attribute__ ((unused)) 85 #ifndef RUBY_DEFINES_H 92 #ifdef ONIG_ESCAPE_UCHAR_COLLISION 93 #undef ONIG_ESCAPE_UCHAR_COLLISION 95 #undef USE_MATCH_RANGE_IS_COMPLETE_RANGE 96 #undef USE_CAPTURE_HISTORY 97 #define USE_VARIABLE_META_CHARS 98 #define USE_WORD_BEGIN_END 99 #define USE_POSIX_REGION_OPTION 100 #define USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE 103 #define THREAD_SYSTEM_INIT 104 #define THREAD_SYSTEM_END 105 #define THREAD_ATOMIC_START 106 #define THREAD_ATOMIC_END 109 #define xmalloc malloc 110 #define xrealloc realloc 111 #define xcalloc calloc 117 #define CHECK_INTERRUPT_IN_MATCH_AT rb_thread_check_ints() 118 #define onig_st_init_table st_init_table 119 #define onig_st_init_table_with_size st_init_table_with_size 120 #define onig_st_init_numtable st_init_numtable 121 #define onig_st_init_numtable_with_size st_init_numtable_with_size 122 #define onig_st_init_strtable st_init_strtable 123 #define onig_st_init_strtable_with_size st_init_strtable_with_size 124 #define onig_st_delete st_delete 125 #define onig_st_delete_safe st_delete_safe 126 #define onig_st_insert st_insert 127 #define onig_st_lookup st_lookup 128 #define onig_st_foreach st_foreach 129 #define onig_st_add_direct st_add_direct 130 #define onig_st_free_table st_free_table 131 #define onig_st_cleanup_safe st_cleanup_safe 132 #define onig_st_copy st_copy 133 #define onig_st_nothing_key_clone st_nothing_key_clone 134 #define onig_st_nothing_key_free st_nothing_key_free 135 #define onig_st_is_member st_is_member 137 #define USE_UPPER_CASE_TABLE 140 #define st_init_table onig_st_init_table 141 #define st_init_table_with_size onig_st_init_table_with_size 142 #define st_init_numtable onig_st_init_numtable 143 #define st_init_numtable_with_size onig_st_init_numtable_with_size 144 #define st_init_strtable onig_st_init_strtable 145 #define st_init_strtable_with_size onig_st_init_strtable_with_size 146 #define st_delete onig_st_delete 147 #define st_delete_safe onig_st_delete_safe 148 #define st_insert onig_st_insert 149 #define st_lookup onig_st_lookup 150 #define st_foreach onig_st_foreach 151 #define st_add_direct onig_st_add_direct 152 #define st_free_table onig_st_free_table 153 #define st_cleanup_safe onig_st_cleanup_safe 154 #define st_copy onig_st_copy 155 #define st_nothing_key_clone onig_st_nothing_key_clone 156 #define st_nothing_key_free onig_st_nothing_key_free 158 #define onig_st_is_member st_is_member 160 #define CHECK_INTERRUPT_IN_MATCH_AT 164 #define STATE_CHECK_STRING_THRESHOLD_LEN 7 165 #define STATE_CHECK_BUFF_MAX_SIZE 0x4000 167 #define THREAD_PASS_LIMIT_COUNT 8 168 #define xmemset memset 169 #define xmemcpy memcpy 170 #define xmemmove memmove 172 #if defined(_WIN32) && !defined(__GNUC__) 173 #define xalloca _alloca 174 #define xvsnprintf _vsnprintf 176 #define xalloca alloca 177 #define xvsnprintf vsnprintf 181 #if defined(USE_RECOMPILE_API) && defined(USE_MULTI_THREAD_SYSTEM) 182 #define ONIG_STATE_INC(reg) (reg)->state++ 183 #define ONIG_STATE_DEC(reg) (reg)->state-- 185 #define ONIG_STATE_INC_THREAD(reg) do {\ 186 THREAD_ATOMIC_START;\ 190 #define ONIG_STATE_DEC_THREAD(reg) do {\ 191 THREAD_ATOMIC_START;\ 196 #define ONIG_STATE_INC(reg) 197 #define ONIG_STATE_DEC(reg) 198 #define ONIG_STATE_INC_THREAD(reg) 199 #define ONIG_STATE_DEC_THREAD(reg) 206 #if defined(HAVE_ALLOCA_H) && (defined(_AIX) || !defined(__GNUC__)) 213 # include <strings.h> 217 #ifdef HAVE_SYS_TYPES_H 218 #include <sys/types.h> 227 #if defined __GNUC__ && __GNUC__ >= 4 228 #pragma GCC visibility push(default) 237 #define MIN(a,b) (((a)>(b))?(b):(a)) 238 #define MAX(a,b) (((a)<(b))?(b):(a)) 240 #define IS_NULL(p) (((void*)(p)) == (void*)0) 241 #define IS_NOT_NULL(p) (((void*)(p)) != (void*)0) 242 #define CHECK_NULL_RETURN(p) if (IS_NULL(p)) return NULL 243 #define CHECK_NULL_RETURN_MEMERR(p) if (IS_NULL(p)) return ONIGERR_MEMORY 244 #define NULL_UCHARP ((UChar* )0) 246 #ifdef PLATFORM_UNALIGNED_WORD_ACCESS 248 #define PLATFORM_GET_INC(val,p,type) do{\ 250 (p) += sizeof(type);\ 255 #define PLATFORM_GET_INC(val,p,type) do{\ 256 xmemcpy(&val, (p), sizeof(type));\ 257 (p) += sizeof(type);\ 261 #define WORD_ALIGNMENT_SIZE SIZEOF_LONG 263 #define GET_ALIGNMENT_PAD_SIZE(addr,pad_size) do {\ 264 (pad_size) = WORD_ALIGNMENT_SIZE \ 265 - ((uintptr_t )(addr) % WORD_ALIGNMENT_SIZE);\ 266 if ((pad_size) == WORD_ALIGNMENT_SIZE) (pad_size) = 0;\ 269 #define ALIGNMENT_RIGHT(addr) do {\ 270 (addr) += (WORD_ALIGNMENT_SIZE - 1);\ 271 (addr) -= ((uintptr_t )(addr) % WORD_ALIGNMENT_SIZE);\ 277 #define STACK_POP_LEVEL_FREE 0 278 #define STACK_POP_LEVEL_MEM_START 1 279 #define STACK_POP_LEVEL_ALL 2 282 #define ONIG_OPTIMIZE_NONE 0 283 #define ONIG_OPTIMIZE_EXACT 1 284 #define ONIG_OPTIMIZE_EXACT_BM 2 285 #define ONIG_OPTIMIZE_EXACT_BM_NOT_REV 3 286 #define ONIG_OPTIMIZE_EXACT_IC 4 287 #define ONIG_OPTIMIZE_MAP 5 292 #define BIT_STATUS_BITS_NUM (sizeof(BitStatusType) * 8) 293 #define BIT_STATUS_CLEAR(stats) (stats) = 0 294 #define BIT_STATUS_ON_ALL(stats) (stats) = ~((BitStatusType )0) 295 #define BIT_STATUS_AT(stats,n) \ 296 ((n) < (int )BIT_STATUS_BITS_NUM ? ((stats) & (1 << n)) : ((stats) & 1)) 298 #define BIT_STATUS_ON_AT(stats,n) do {\ 299 if ((n) < (int )BIT_STATUS_BITS_NUM) \ 300 (stats) |= (1 << (n));\ 305 #define BIT_STATUS_ON_AT_SIMPLE(stats,n) do {\ 306 if ((n) < (int )BIT_STATUS_BITS_NUM)\ 307 (stats) |= (1 << (n));\ 311 #define INT_MAX_LIMIT ((1UL << (SIZEOF_INT * 8 - 1)) - 1) 313 #define DIGITVAL(code) ((code) - '0') 314 #define ODIGITVAL(code) DIGITVAL(code) 315 #define XDIGITVAL(enc,code) \ 316 (ONIGENC_IS_CODE_DIGIT(enc,code) ? DIGITVAL(code) \ 317 : (ONIGENC_IS_CODE_UPPER(enc,code) ? (code) - 'A' + 10 : (code) - 'a' + 10)) 319 #define IS_SINGLELINE(option) ((option) & ONIG_OPTION_SINGLELINE) 320 #define IS_MULTILINE(option) ((option) & ONIG_OPTION_MULTILINE) 321 #define IS_IGNORECASE(option) ((option) & ONIG_OPTION_IGNORECASE) 322 #define IS_EXTEND(option) ((option) & ONIG_OPTION_EXTEND) 323 #define IS_FIND_LONGEST(option) ((option) & ONIG_OPTION_FIND_LONGEST) 324 #define IS_FIND_NOT_EMPTY(option) ((option) & ONIG_OPTION_FIND_NOT_EMPTY) 325 #define IS_FIND_CONDITION(option) ((option) & \ 326 (ONIG_OPTION_FIND_LONGEST | ONIG_OPTION_FIND_NOT_EMPTY)) 327 #define IS_NOTBOL(option) ((option) & ONIG_OPTION_NOTBOL) 328 #define IS_NOTEOL(option) ((option) & ONIG_OPTION_NOTEOL) 329 #define IS_POSIX_REGION(option) ((option) & ONIG_OPTION_POSIX_REGION) 336 #define IS_DYNAMIC_OPTION(option) 0 338 #define DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag) \ 339 ((case_fold_flag) & ~INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) 341 #define REPEAT_INFINITE -1 342 #define IS_REPEAT_INFINITE(n) ((n) == REPEAT_INFINITE) 345 #define BITS_PER_BYTE 8 346 #define SINGLE_BYTE_SIZE (1 << BITS_PER_BYTE) 347 #define BITS_IN_ROOM (sizeof(Bits) * BITS_PER_BYTE) 348 #define BITSET_SIZE (SINGLE_BYTE_SIZE / BITS_IN_ROOM) 350 #ifdef PLATFORM_UNALIGNED_WORD_ACCESS 351 typedef unsigned int Bits;
358 #define SIZE_BITSET (int)sizeof(BitSet) 360 #define BITSET_CLEAR(bs) do {\ 362 for (i = 0; i < (int )BITSET_SIZE; i++) { (bs)[i] = 0; } \ 365 #define BS_ROOM(bs,pos) (bs)[pos / BITS_IN_ROOM] 366 #define BS_BIT(pos) (1 << (pos % BITS_IN_ROOM)) 368 #define BITSET_AT(bs, pos) (BS_ROOM(bs,pos) & BS_BIT(pos)) 369 #define BITSET_SET_BIT(bs, pos) BS_ROOM(bs,pos) |= BS_BIT(pos) 370 #define BITSET_CLEAR_BIT(bs, pos) BS_ROOM(bs,pos) &= ~(BS_BIT(pos)) 371 #define BITSET_INVERT_BIT(bs, pos) BS_ROOM(bs,pos) ^= BS_BIT(pos) 380 #define BBUF_INIT(buf,size) onig_bbuf_init((BBuf* )(buf), (size)) 382 #define BBUF_SIZE_INC(buf,inc) do{\ 383 (buf)->alloc += (inc);\ 384 (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\ 385 if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\ 388 #define BBUF_EXPAND(buf,low) do{\ 389 do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\ 390 (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\ 391 if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\ 394 #define BBUF_ENSURE_SIZE(buf,size) do{\ 395 unsigned int new_alloc = (buf)->alloc;\ 396 while (new_alloc < (unsigned int )(size)) { new_alloc *= 2; }\ 397 if ((buf)->alloc != new_alloc) {\ 398 (buf)->p = (UChar* )xrealloc((buf)->p, new_alloc);\ 399 if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\ 400 (buf)->alloc = new_alloc;\ 404 #define BBUF_WRITE(buf,pos,bytes,n) do{\ 405 int used = (pos) + (int)(n);\ 406 if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\ 407 xmemcpy((buf)->p + (pos), (bytes), (n));\ 408 if ((buf)->used < (unsigned int )used) (buf)->used = used;\ 411 #define BBUF_WRITE1(buf,pos,byte) do{\ 412 int used = (pos) + 1;\ 413 if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\ 414 (buf)->p[(pos)] = (byte);\ 415 if ((buf)->used < (unsigned int )used) (buf)->used = used;\ 418 #define BBUF_ADD(buf,bytes,n) BBUF_WRITE((buf),(buf)->used,(bytes),(n)) 419 #define BBUF_ADD1(buf,byte) BBUF_WRITE1((buf),(buf)->used,(byte)) 420 #define BBUF_GET_ADD_ADDRESS(buf) ((buf)->p + (buf)->used) 421 #define BBUF_GET_OFFSET_POS(buf) ((buf)->used) 424 #define BBUF_MOVE_RIGHT(buf,from,to,n) do {\ 425 if ((unsigned int )((to)+(n)) > (buf)->alloc) BBUF_EXPAND((buf),(to) + (n));\ 426 xmemmove((buf)->p + (to), (buf)->p + (from), (n));\ 427 if ((unsigned int )((to)+(n)) > (buf)->used) (buf)->used = (to) + (n);\ 431 #define BBUF_MOVE_LEFT(buf,from,to,n) do {\ 432 xmemmove((buf)->p + (to), (buf)->p + (from), (n));\ 436 #define BBUF_MOVE_LEFT_REDUCE(buf,from,to) do {\ 437 xmemmove((buf)->p + (to), (buf)->p + (from), (buf)->used - (from));\ 438 (buf)->used -= (from - to);\ 441 #define BBUF_INSERT(buf,pos,bytes,n) do {\ 442 if (pos >= (buf)->used) {\ 443 BBUF_WRITE(buf,pos,bytes,n);\ 446 BBUF_MOVE_RIGHT((buf),(pos),(pos) + (n),((buf)->used - (pos)));\ 447 xmemcpy((buf)->p + (pos), (bytes), (n));\ 451 #define BBUF_GET_BYTE(buf, pos) (buf)->p[(pos)] 454 #define ANCHOR_BEGIN_BUF (1<<0) 455 #define ANCHOR_BEGIN_LINE (1<<1) 456 #define ANCHOR_BEGIN_POSITION (1<<2) 457 #define ANCHOR_END_BUF (1<<3) 458 #define ANCHOR_SEMI_END_BUF (1<<4) 459 #define ANCHOR_END_LINE (1<<5) 461 #define ANCHOR_WORD_BOUND (1<<6) 462 #define ANCHOR_NOT_WORD_BOUND (1<<7) 463 #define ANCHOR_WORD_BEGIN (1<<8) 464 #define ANCHOR_WORD_END (1<<9) 465 #define ANCHOR_PREC_READ (1<<10) 466 #define ANCHOR_PREC_READ_NOT (1<<11) 467 #define ANCHOR_LOOK_BEHIND (1<<12) 468 #define ANCHOR_LOOK_BEHIND_NOT (1<<13) 470 #define ANCHOR_ANYCHAR_STAR (1<<14) 471 #define ANCHOR_ANYCHAR_STAR_ML (1<<15) 587 #define SIZE_OPCODE 1 588 #define SIZE_RELADDR (int)sizeof(RelAddrType) 589 #define SIZE_ABSADDR (int)sizeof(AbsAddrType) 590 #define SIZE_LENGTH (int)sizeof(LengthType) 591 #define SIZE_MEMNUM (int)sizeof(MemNumType) 592 #define SIZE_STATE_CHECK_NUM (int)sizeof(StateCheckNumType) 593 #define SIZE_REPEATNUM (int)sizeof(RepeatNumType) 594 #define SIZE_OPTION (int)sizeof(OnigOptionType) 595 #define SIZE_CODE_POINT (int)sizeof(OnigCodePoint) 596 #define SIZE_POINTER (int)sizeof(PointerType) 599 #define GET_RELADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, RelAddrType) 600 #define GET_ABSADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, AbsAddrType) 601 #define GET_LENGTH_INC(len,p) PLATFORM_GET_INC(len, p, LengthType) 602 #define GET_MEMNUM_INC(num,p) PLATFORM_GET_INC(num, p, MemNumType) 603 #define GET_REPEATNUM_INC(num,p) PLATFORM_GET_INC(num, p, RepeatNumType) 604 #define GET_OPTION_INC(option,p) PLATFORM_GET_INC(option, p, OnigOptionType) 605 #define GET_POINTER_INC(ptr,p) PLATFORM_GET_INC(ptr, p, PointerType) 606 #define GET_STATE_CHECK_NUM_INC(num,p) PLATFORM_GET_INC(num, p, StateCheckNumType) 609 #define GET_CODE_POINT(code,p) code = *((OnigCodePoint* )(p)) 610 #define GET_BYTE_INC(byte,p) do{\ 617 #define SIZE_OP_ANYCHAR_STAR SIZE_OPCODE 618 #define SIZE_OP_ANYCHAR_STAR_PEEK_NEXT (SIZE_OPCODE + 1) 619 #define SIZE_OP_JUMP (SIZE_OPCODE + SIZE_RELADDR) 620 #define SIZE_OP_PUSH (SIZE_OPCODE + SIZE_RELADDR) 621 #define SIZE_OP_POP SIZE_OPCODE 622 #define SIZE_OP_PUSH_OR_JUMP_EXACT1 (SIZE_OPCODE + SIZE_RELADDR + 1) 623 #define SIZE_OP_PUSH_IF_PEEK_NEXT (SIZE_OPCODE + SIZE_RELADDR + 1) 624 #define SIZE_OP_REPEAT_INC (SIZE_OPCODE + SIZE_MEMNUM) 625 #define SIZE_OP_REPEAT_INC_NG (SIZE_OPCODE + SIZE_MEMNUM) 626 #define SIZE_OP_PUSH_POS SIZE_OPCODE 627 #define SIZE_OP_PUSH_POS_NOT (SIZE_OPCODE + SIZE_RELADDR) 628 #define SIZE_OP_POP_POS SIZE_OPCODE 629 #define SIZE_OP_FAIL_POS SIZE_OPCODE 630 #define SIZE_OP_SET_OPTION (SIZE_OPCODE + SIZE_OPTION) 631 #define SIZE_OP_SET_OPTION_PUSH (SIZE_OPCODE + SIZE_OPTION) 632 #define SIZE_OP_FAIL SIZE_OPCODE 633 #define SIZE_OP_MEMORY_START (SIZE_OPCODE + SIZE_MEMNUM) 634 #define SIZE_OP_MEMORY_START_PUSH (SIZE_OPCODE + SIZE_MEMNUM) 635 #define SIZE_OP_MEMORY_END_PUSH (SIZE_OPCODE + SIZE_MEMNUM) 636 #define SIZE_OP_MEMORY_END_PUSH_REC (SIZE_OPCODE + SIZE_MEMNUM) 637 #define SIZE_OP_MEMORY_END (SIZE_OPCODE + SIZE_MEMNUM) 638 #define SIZE_OP_MEMORY_END_REC (SIZE_OPCODE + SIZE_MEMNUM) 639 #define SIZE_OP_PUSH_STOP_BT SIZE_OPCODE 640 #define SIZE_OP_POP_STOP_BT SIZE_OPCODE 641 #define SIZE_OP_NULL_CHECK_START (SIZE_OPCODE + SIZE_MEMNUM) 642 #define SIZE_OP_NULL_CHECK_END (SIZE_OPCODE + SIZE_MEMNUM) 643 #define SIZE_OP_LOOK_BEHIND (SIZE_OPCODE + SIZE_LENGTH) 644 #define SIZE_OP_PUSH_LOOK_BEHIND_NOT (SIZE_OPCODE + SIZE_RELADDR + SIZE_LENGTH) 645 #define SIZE_OP_FAIL_LOOK_BEHIND_NOT SIZE_OPCODE 646 #define SIZE_OP_CALL (SIZE_OPCODE + SIZE_ABSADDR) 647 #define SIZE_OP_RETURN SIZE_OPCODE 649 #ifdef USE_COMBINATION_EXPLOSION_CHECK 650 #define SIZE_OP_STATE_CHECK (SIZE_OPCODE + SIZE_STATE_CHECK_NUM) 651 #define SIZE_OP_STATE_CHECK_PUSH (SIZE_OPCODE + SIZE_STATE_CHECK_NUM + SIZE_RELADDR) 652 #define SIZE_OP_STATE_CHECK_PUSH_OR_JUMP (SIZE_OPCODE + SIZE_STATE_CHECK_NUM + SIZE_RELADDR) 653 #define SIZE_OP_STATE_CHECK_ANYCHAR_STAR (SIZE_OPCODE + SIZE_STATE_CHECK_NUM) 656 #define MC_ESC(syn) (syn)->meta_char_table.esc 657 #define MC_ANYCHAR(syn) (syn)->meta_char_table.anychar 658 #define MC_ANYTIME(syn) (syn)->meta_char_table.anytime 659 #define MC_ZERO_OR_ONE_TIME(syn) (syn)->meta_char_table.zero_or_one_time 660 #define MC_ONE_OR_MORE_TIME(syn) (syn)->meta_char_table.one_or_more_time 661 #define MC_ANYCHAR_ANYTIME(syn) (syn)->meta_char_table.anychar_anytime 663 #define IS_MC_ESC_CODE(code, syn) \ 664 ((code) == MC_ESC(syn) && \ 665 !IS_SYNTAX_OP2((syn), ONIG_SYN_OP2_INEFFECTIVE_ESCAPE)) 668 #define SYN_POSIX_COMMON_OP \ 669 ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_POSIX_BRACKET | \ 670 ONIG_SYN_OP_DECIMAL_BACKREF | \ 671 ONIG_SYN_OP_BRACKET_CC | ONIG_SYN_OP_ASTERISK_ZERO_INF | \ 672 ONIG_SYN_OP_LINE_ANCHOR | \ 673 ONIG_SYN_OP_ESC_CONTROL_CHARS ) 675 #define SYN_GNU_REGEX_OP \ 676 ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_BRACKET_CC | \ 677 ONIG_SYN_OP_POSIX_BRACKET | ONIG_SYN_OP_DECIMAL_BACKREF | \ 678 ONIG_SYN_OP_BRACE_INTERVAL | ONIG_SYN_OP_LPAREN_SUBEXP | \ 679 ONIG_SYN_OP_VBAR_ALT | \ 680 ONIG_SYN_OP_ASTERISK_ZERO_INF | ONIG_SYN_OP_PLUS_ONE_INF | \ 681 ONIG_SYN_OP_QMARK_ZERO_ONE | \ 682 ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR | ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR | \ 683 ONIG_SYN_OP_ESC_W_WORD | \ 684 ONIG_SYN_OP_ESC_B_WORD_BOUND | ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END | \ 685 ONIG_SYN_OP_ESC_S_WHITE_SPACE | ONIG_SYN_OP_ESC_D_DIGIT | \ 686 ONIG_SYN_OP_LINE_ANCHOR ) 688 #define SYN_GNU_REGEX_BV \ 689 ( ONIG_SYN_CONTEXT_INDEP_ANCHORS | ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS | \ 690 ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS | ONIG_SYN_ALLOW_INVALID_INTERVAL | \ 691 ONIG_SYN_BACKSLASH_ESCAPE_IN_CC | ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC ) 694 #define NCCLASS_FLAGS(cc) ((cc)->flags) 695 #define NCCLASS_FLAG_SET(cc,flag) (NCCLASS_FLAGS(cc) |= (flag)) 696 #define NCCLASS_FLAG_CLEAR(cc,flag) (NCCLASS_FLAGS(cc) &= ~(flag)) 697 #define IS_NCCLASS_FLAG_ON(cc,flag) ((NCCLASS_FLAGS(cc) & (flag)) != 0) 700 #define FLAG_NCCLASS_NOT (1<<0) 701 #define FLAG_NCCLASS_SHARE (1<<1) 703 #define NCCLASS_SET_NOT(nd) NCCLASS_FLAG_SET(nd, FLAG_NCCLASS_NOT) 704 #define NCCLASS_SET_SHARE(nd) NCCLASS_FLAG_SET(nd, FLAG_NCCLASS_SHARE) 705 #define NCCLASS_CLEAR_NOT(nd) NCCLASS_FLAG_CLEAR(nd, FLAG_NCCLASS_NOT) 706 #define IS_NCCLASS_NOT(nd) IS_NCCLASS_FLAG_ON(nd, FLAG_NCCLASS_NOT) 707 #define IS_NCCLASS_SHARE(nd) IS_NCCLASS_FLAG_ON(nd, FLAG_NCCLASS_SHARE) 731 #ifdef USE_COMBINATION_EXPLOSION_CHECK 732 unsigned int state_check;
754 #ifdef USE_SUBEXP_CALL 770 #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE 774 #ifdef USE_COMBINATION_EXPLOSION_CHECK 775 void* state_check_buff;
776 int state_check_buff_size;
781 #define IS_CODE_SB_WORD(enc,code) \ 782 (ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_WORD(enc,code)) 792 extern OnigOpInfoType OnigOpInfo[];
796 #ifdef ONIG_DEBUG_STATISTICS 797 extern void onig_statistics_init
P_((
void));
798 extern void onig_print_statistics
P_((
FILE* f));
826 #define PROPERTY_LIST_ADD_PROP(Name, CR) \ 827 r = onigenc_property_list_add_property((UChar* )Name, CR,\ 828 &PropertyNameTable, &PropertyList, &PropertyListNum,\ 832 #define PROPERTY_LIST_INIT_CHECK \ 833 if (PropertyInited == 0) {\ 834 int r = onigenc_property_list_init(init_property_list);\ 835 if (r != 0) return r;\ 846 #if defined __GNUC__ && __GNUC__ >= 4 847 #pragma GCC visibility pop void onig_transfer(regex_t *to, regex_t *from)
unsigned int OnigCodePoint
int onig_st_lookup_strend(hash_table_type *table, const UChar *str_key, const UChar *end_key, hash_data_type *value)
struct _OnigStackType::@48::@50 repeat
size_t onig_memsize(const regex_t *reg)
hash_table_type * onig_st_init_strend_table_with_size(st_index_t size)
int onig_st_insert_strend(hash_table_type *table, const UChar *str_key, const UChar *end_key, hash_data_type value)
void onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar *pat, UChar *pat_end, const UChar *fmt,...))
struct _OnigStackType::@48::@53 null_check
struct _OnigStackType::@48::@54 call_frame
void onig_chain_link_add(regex_t *to, regex_t *add)
unsigned int OnigOptionType
unsigned int BitStatusType
int onig_compile(regex_t *reg, const UChar *pattern, const UChar *pattern_end, OnigErrorInfo *einfo, const char *sourcefile, int sourceline)
void onig_chain_reduce(regex_t *reg)
int onig_bbuf_init(BBuf *buf, OnigDistance size)
UChar *onig_error_code_to_format P_((int code))
void onig_snprintf_with_pattern(buf, int bufsize, OnigEncoding enc, UChar *pat, UChar *pat_end, const UChar *fmt, va_alist)
struct _OnigStackType::@48::@51 repeat_inc
short int StateCheckNumType
UChar * onig_error_code_to_format(int code)
int(* ONIGENC_INIT_PROPERTY_LIST_FUNC_TYPE)(void)
int onigenc_property_list_init(int(*f)(void))
unsigned char buf[MIME_BUF_SIZE]
int onig_is_code_in_cc(OnigEncoding enc, OnigCodePoint code, CClassNode *cc)
struct _OnigStackType::@48::@49 state
struct _OnigStackType::@48::@52 mem
unsigned long hash_data_type
int onig_is_code_in_cc_len(int elen, OnigCodePoint code, CClassNode *cc)
struct _OnigStackType OnigStackType
union _OnigStackType::@48 u
int onigenc_property_list_add_property(UChar *name, const OnigCodePoint *prop, hash_table_type **table, const OnigCodePoint ***plist, int *pnum, int *psize)
#define enclen(enc, p, e)