Changeset 331 for EcnlProtoTool/trunk/onigmo-6.1.3/src/regint.h
- Timestamp:
- Jan 21, 2018, 12:10:09 AM (6 years ago)
- Location:
- EcnlProtoTool/trunk/onigmo-6.1.3
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/onigmo-6.1.3/src/regint.h
r321 r331 1 #ifndef REGINT_H2 #define REGINT_H1 #ifndef ONIGMO_REGINT_H 2 #define ONIGMO_REGINT_H 3 3 /********************************************************************** 4 4 regint.h - Onigmo (Oniguruma-mod) (regular expression library) … … 6 6 /*- 7 7 * Copyright (c) 2002-2013 K.Kosako <sndgk393 AT ybb DOT ne DOT jp> 8 * Copyright (c) 2011-201 4K.Takata <kentkt AT csc DOT jp>8 * Copyright (c) 2011-2016 K.Takata <kentkt AT csc DOT jp> 9 9 * All rights reserved. 10 10 * … … 36 36 /* #define ONIG_DEBUG_SEARCH */ 37 37 /* #define ONIG_DEBUG_MATCH */ 38 /* #define ONIG_DEBUG_MEMLEAK */ 38 39 /* #define ONIG_DONT_OPTIMIZE */ 39 40 … … 43 44 #if defined(ONIG_DEBUG_PARSE_TREE) || defined(ONIG_DEBUG_MATCH) || \ 44 45 defined(ONIG_DEBUG_SEARCH) || defined(ONIG_DEBUG_COMPILE) || \ 45 defined(ONIG_DEBUG_STATISTICS) 46 # ifndef ONIG_DEBUG47 # define ONIG_DEBUG48 # endif46 defined(ONIG_DEBUG_STATISTICS) || defined(ONIG_DEBUG_MEMLEAK) 47 # ifndef ONIG_DEBUG 48 # define ONIG_DEBUG 49 # endif 49 50 #endif 50 51 51 52 #ifndef UNALIGNED_WORD_ACCESS 52 # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \53 defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \54 defined(__powerpc64__) || \55 defined(__mc68020__)56 # define UNALIGNED_WORD_ACCESS 157 # else58 # define UNALIGNED_WORD_ACCESS 059 # endif53 # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ 54 defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \ 55 defined(__powerpc64__) || \ 56 defined(__mc68020__) 57 # define UNALIGNED_WORD_ACCESS 1 58 # else 59 # define UNALIGNED_WORD_ACCESS 0 60 # endif 60 61 #endif 61 62 62 63 #if UNALIGNED_WORD_ACCESS 63 # define PLATFORM_UNALIGNED_WORD_ACCESS64 # define PLATFORM_UNALIGNED_WORD_ACCESS 64 65 #endif 65 66 … … 74 75 #define USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE /* /\n$/ =~ "\n" */ 75 76 #define USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR 76 /* #define USE_RECOMPILE_API */77 77 /* !!! moved to regenc.h. */ /* #define USE_CRNL_AS_LINE_TERMINATOR */ 78 78 #define USE_NO_INVALID_QUANTIFIER 79 79 80 80 /* internal config */ 81 #define USE_PARSE_TREE_NODE_RECYCLE 82 #define USE_OP_PUSH_OR_JUMP_EXACT 81 /* #define USE_OP_PUSH_OR_JUMP_EXACT */ 83 82 #define USE_QTFR_PEEK_NEXT 84 83 #define USE_ST_LIBRARY 85 #define USE_SHARED_CCLASS_TABLE86 84 #define USE_SUNDAY_QUICK_SEARCH 87 85 88 86 #define INIT_MATCH_STACK_SIZE 160 89 87 #define DEFAULT_MATCH_STACK_LIMIT_SIZE 0 /* unlimited */ 88 #define DEFAULT_PARSE_DEPTH_LIMIT 4096 89 90 #define OPT_EXACT_MAXLEN 24 90 91 91 92 /* check config */ 92 93 #if defined(USE_PERL_SUBEXP_CALL) || defined(USE_CAPITAL_P_NAMED_GROUP) 93 # if !defined(USE_NAMED_GROUP) || !defined(USE_SUBEXP_CALL)94 # error USE_NAMED_GROUP and USE_SUBEXP_CALL must be defined.95 # endif94 # if !defined(USE_NAMED_GROUP) || !defined(USE_SUBEXP_CALL) 95 # error USE_NAMED_GROUP and USE_SUBEXP_CALL must be defined. 96 # endif 96 97 #endif 97 98 98 99 #if defined(__GNUC__) 99 # 100 # define ARG_UNUSED __attribute__ ((unused)) 100 101 #else 101 # define ARG_UNUSED 102 #endif 102 # define ARG_UNUSED 103 #endif 104 105 #if !defined(RUBY) && defined(RUBY_EXPORT) 106 # define RUBY 107 #endif 108 #ifdef RUBY 109 # ifndef RUBY_DEFINES_H 110 # include "ruby/ruby.h" 111 # undef xmalloc 112 # undef xrealloc 113 # undef xcalloc 114 # undef xfree 115 # endif 116 #else /* RUBY */ 117 # include "config.h" 118 # if SIZEOF_LONG_LONG > 0 119 # define LONG_LONG long long 120 # endif 121 #endif /* RUBY */ 122 123 #include <stdarg.h> 103 124 104 125 /* */ 105 126 /* escape other system UChar definition */ 106 #include "config.h"107 127 #ifdef ONIG_ESCAPE_UCHAR_COLLISION 108 # undef ONIG_ESCAPE_UCHAR_COLLISION128 # undef ONIG_ESCAPE_UCHAR_COLLISION 109 129 #endif 110 130 111 131 #define USE_WORD_BEGIN_END /* "\<": word-begin, "\>": word-end */ 112 #define USE_CAPTURE_HISTORY 132 #ifdef RUBY 133 # undef USE_CAPTURE_HISTORY 134 #else 135 # define USE_CAPTURE_HISTORY 136 #endif 113 137 #define USE_VARIABLE_META_CHARS 114 #define USE_POSIX_API_REGION_OPTION /* needed for POSIX API support */115 138 #define USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE 116 139 /* #define USE_COMBINATION_EXPLOSION_CHECK */ /* (X*)* */ 117 140 118 /* multithread config */119 /* #define USE_MULTI_THREAD_SYSTEM */120 /* #define USE_DEFAULT_MULTI_THREAD_SYSTEM */121 122 #if defined(USE_MULTI_THREAD_SYSTEM) \123 && defined(USE_DEFAULT_MULTI_THREAD_SYSTEM)124 125 #if defined(_WIN32) && !defined(MUSL_LIBC)126 #define WIN32_LEAN_AND_MEAN127 #include <windows.h>128 extern CRITICAL_SECTION gOnigMutex;129 #define THREAD_SYSTEM_INIT InitializeCriticalSection(&gOnigMutex)130 #define THREAD_SYSTEM_END DeleteCriticalSection(&gOnigMutex)131 #define THREAD_ATOMIC_START EnterCriticalSection(&gOnigMutex)132 #define THREAD_ATOMIC_END LeaveCriticalSection(&gOnigMutex)133 #define THREAD_PASS Sleep(0)134 #else /* _WIN32 */135 #include <pthread.h>136 #include <sched.h>137 extern pthread_mutex_t gOnigMutex;138 #define THREAD_SYSTEM_INIT pthread_mutex_init(&gOnigMutex, NULL)139 #define THREAD_SYSTEM_END pthread_mutex_destroy(&gOnigMutex)140 #define THREAD_ATOMIC_START pthread_mutex_lock(&gOnigMutex)141 #define THREAD_ATOMIC_END pthread_mutex_unlock(&gOnigMutex)142 #define THREAD_PASS sched_yield()143 #endif /* _WIN32 */144 145 #else /* USE_DEFAULT_MULTI_THREAD_SYSTEM */146 147 #ifndef THREAD_SYSTEM_INIT148 #define THREAD_SYSTEM_INIT /* depend on thread system */149 #endif150 #ifndef THREAD_SYSTEM_END151 #define THREAD_SYSTEM_END /* depend on thread system */152 #endif153 #ifndef THREAD_ATOMIC_START154 #define THREAD_ATOMIC_START /* depend on thread system */155 #endif156 #ifndef THREAD_ATOMIC_END157 #define THREAD_ATOMIC_END /* depend on thread system */158 #endif159 #ifndef THREAD_PASS160 #define THREAD_PASS /* depend on thread system */161 #endif162 163 #endif /* USE_DEFAULT_MULTI_THREAD_SYSTEM */164 141 165 142 #ifndef xmalloc 166 #define xmalloc malloc 167 #define xrealloc realloc 168 #define xcalloc calloc 169 #define xfree free 170 #endif 171 172 #define CHECK_INTERRUPT_IN_MATCH_AT 173 174 #define st_init_table onig_st_init_table 175 #define st_init_table_with_size onig_st_init_table_with_size 176 #define st_init_numtable onig_st_init_numtable 177 #define st_init_numtable_with_size onig_st_init_numtable_with_size 178 #define st_init_strtable onig_st_init_strtable 179 #define st_init_strtable_with_size onig_st_init_strtable_with_size 180 #define st_delete onig_st_delete 181 #define st_delete_safe onig_st_delete_safe 182 #define st_insert onig_st_insert 183 #define st_lookup onig_st_lookup 184 #define st_foreach onig_st_foreach 185 #define st_add_direct onig_st_add_direct 186 #define st_free_table onig_st_free_table 187 #define st_cleanup_safe onig_st_cleanup_safe 188 #define st_copy onig_st_copy 189 #define st_nothing_key_clone onig_st_nothing_key_clone 190 #define st_nothing_key_free onig_st_nothing_key_free 143 # define xmalloc malloc 144 # define xrealloc realloc 145 # define xcalloc calloc 146 # define xfree free 147 #endif 148 149 #ifdef RUBY 150 151 # define CHECK_INTERRUPT_IN_MATCH_AT rb_thread_check_ints() 152 # define onig_st_init_table st_init_table 153 # define onig_st_init_table_with_size st_init_table_with_size 154 # define onig_st_init_numtable st_init_numtable 155 # define onig_st_init_numtable_with_size st_init_numtable_with_size 156 # define onig_st_init_strtable st_init_strtable 157 # define onig_st_init_strtable_with_size st_init_strtable_with_size 158 # define onig_st_delete st_delete 159 # define onig_st_delete_safe st_delete_safe 160 # define onig_st_insert st_insert 161 # define onig_st_lookup st_lookup 162 # define onig_st_foreach st_foreach 163 # define onig_st_add_direct st_add_direct 164 # define onig_st_free_table st_free_table 165 # define onig_st_cleanup_safe st_cleanup_safe 166 # define onig_st_copy st_copy 167 # define onig_st_nothing_key_clone st_nothing_key_clone 168 # define onig_st_nothing_key_free st_nothing_key_free 169 # define onig_st_is_member st_is_member 170 171 # define USE_UPPER_CASE_TABLE 172 #else /* RUBY */ 173 174 # define CHECK_INTERRUPT_IN_MATCH_AT 175 176 # define st_init_table onig_st_init_table 177 # define st_init_table_with_size onig_st_init_table_with_size 178 # define st_init_numtable onig_st_init_numtable 179 # define st_init_numtable_with_size onig_st_init_numtable_with_size 180 # define st_init_strtable onig_st_init_strtable 181 # define st_init_strtable_with_size onig_st_init_strtable_with_size 182 # define st_delete onig_st_delete 183 # define st_delete_safe onig_st_delete_safe 184 # define st_insert onig_st_insert 185 # define st_lookup onig_st_lookup 186 # define st_foreach onig_st_foreach 187 # define st_add_direct onig_st_add_direct 188 # define st_free_table onig_st_free_table 189 # define st_cleanup_safe onig_st_cleanup_safe 190 # define st_copy onig_st_copy 191 # define st_nothing_key_clone onig_st_nothing_key_clone 192 # define st_nothing_key_free onig_st_nothing_key_free 191 193 /* */ 192 #define onig_st_is_member st_is_member 194 # define onig_st_is_member st_is_member 195 196 #endif /* RUBY */ 193 197 194 198 #define STATE_CHECK_STRING_THRESHOLD_LEN 7 195 199 #define STATE_CHECK_BUFF_MAX_SIZE 0x4000 196 200 197 #define THREAD_PASS_LIMIT_COUNT 8198 201 #define xmemset memset 199 202 #define xmemcpy memcpy 200 203 #define xmemmove memmove 201 204 202 #if defined(_WIN32) && !defined(__GNUC__) && !defined(MUSL_LIBC) 203 #define xalloca _alloca 204 #define xvsnprintf _vsnprintf 205 #if ((defined(RUBY_MSVCRT_VERSION) && RUBY_MSVCRT_VERSION >= 90) \ 206 || (!defined(RUBY_MSVCRT_VERSION) && defined(_WIN32))) \ 207 && !defined(__GNUC__) 208 # define xalloca _alloca 209 # define xvsnprintf(buf,size,fmt,args) _vsnprintf_s(buf,size,_TRUNCATE,fmt,args) 210 # define xsnprintf sprintf_s 211 # define xstrcat(dest,src,size) strcat_s(dest,size,src) 205 212 #else 206 /*#define xalloca alloca*/ 207 #define xvsnprintf vsnprintf 208 #endif 209 210 211 #if defined(USE_RECOMPILE_API) && defined(USE_MULTI_THREAD_SYSTEM) 212 #define ONIG_STATE_INC(reg) (reg)->state++ 213 #define ONIG_STATE_DEC(reg) (reg)->state-- 214 215 #define ONIG_STATE_INC_THREAD(reg) do {\ 216 THREAD_ATOMIC_START;\ 217 (reg)->state++;\ 218 THREAD_ATOMIC_END;\ 219 } while(0) 220 #define ONIG_STATE_DEC_THREAD(reg) do {\ 221 THREAD_ATOMIC_START;\ 222 (reg)->state--;\ 223 THREAD_ATOMIC_END;\ 224 } while(0) 225 #else 226 #define ONIG_STATE_INC(reg) /* Nothing */ 227 #define ONIG_STATE_DEC(reg) /* Nothing */ 228 #define ONIG_STATE_INC_THREAD(reg) /* Nothing */ 229 #define ONIG_STATE_DEC_THREAD(reg) /* Nothing */ 230 #endif /* USE_RECOMPILE_API && USE_MULTI_THREAD_SYSTEM */ 231 232 #ifdef HAVE_STDLIB_H 213 # define xalloca alloca 214 # define xvsnprintf vsnprintf 215 # define xsnprintf snprintf 216 # define xstrcat(dest,src,size) strcat(dest,src) 217 #endif 218 219 #if defined(ONIG_DEBUG_MEMLEAK) && defined(_MSC_VER) 220 # define _CRTDBG_MAP_ALLOC 221 # include <malloc.h> 222 # include <crtdbg.h> 223 #endif 224 233 225 #include <stdlib.h> 234 #endif235 226 236 227 #if defined(HAVE_ALLOCA_H) && (defined(_AIX) || !defined(__GNUC__)) 237 #include <alloca.h> 238 #endif 239 240 #ifdef HAVE_STRING_H 241 # include <string.h> 242 #else 243 # include <strings.h> 244 #endif 228 # include <alloca.h> 229 #endif 230 231 #include <string.h> 245 232 246 233 #include <ctype.h> 247 234 #ifdef HAVE_SYS_TYPES_H 248 # include <sys/types.h>235 # include <sys/types.h> 249 236 #endif 250 237 … … 257 244 #endif 258 245 259 #ifdef STDC_HEADERS 260 # include <stddef.h> 261 #endif 262 263 #if defined(_WIN32) && !defined(MUSL_LIBC) 264 #include <malloc.h> /* for alloca() */ 246 #include <stddef.h> 247 248 #ifdef _WIN32 249 # include <malloc.h> /* for alloca() */ 265 250 #endif 266 251 … … 269 254 #endif 270 255 271 #if defined(_WIN32) && !defined(MUSL_LIBC)272 # if defined(_MSC_VER) && (_MSC_VER < 1300)273 # ifndef _INTPTR_T_DEFINED274 # define _INTPTR_T_DEFINED256 #ifdef _WIN32 257 # if defined(_MSC_VER) && (_MSC_VER < 1300) 258 # ifndef _INTPTR_T_DEFINED 259 # define _INTPTR_T_DEFINED 275 260 typedef int intptr_t; 276 # endif277 # ifndef _UINTPTR_T_DEFINED278 # define _UINTPTR_T_DEFINED261 # endif 262 # ifndef _UINTPTR_T_DEFINED 263 # define _UINTPTR_T_DEFINED 279 264 typedef unsigned int uintptr_t; 280 # endif281 # endif265 # endif 266 # endif 282 267 #endif /* _WIN32 */ 283 268 284 269 #ifndef PRIdPTR 285 #ifdef _WIN64 286 #define PRIdPTR "I64d" 287 #define PRIuPTR "I64u" 288 #define PRIxPTR "I64x" 289 #else 290 #define PRIdPTR "ld" 291 #define PRIuPTR "lu" 292 #define PRIxPTR "lx" 293 #endif 270 # ifdef _WIN64 271 # define PRIdPTR "I64d" 272 # define PRIuPTR "I64u" 273 # define PRIxPTR "I64x" 274 # else 275 # define PRIdPTR "ld" 276 # define PRIuPTR "lu" 277 # define PRIxPTR "lx" 278 # endif 279 #endif 280 281 #ifndef PRIdPTRDIFF 282 # define PRIdPTRDIFF PRIdPTR 294 283 #endif 295 284 296 285 #include "regenc.h" 297 286 287 RUBY_SYMBOL_EXPORT_BEGIN 288 298 289 #ifdef MIN 299 # undef MIN290 # undef MIN 300 291 #endif 301 292 #ifdef MAX 302 # undef MAX293 # undef MAX 303 294 #endif 304 295 #define MIN(a,b) (((a)>(b))?(b):(a)) … … 315 306 #ifdef PLATFORM_UNALIGNED_WORD_ACCESS 316 307 317 # define PLATFORM_GET_INC(val,p,type) do{\308 # define PLATFORM_GET_INC(val,p,type) do{\ 318 309 val = *(type* )p;\ 319 310 (p) += sizeof(type);\ … … 322 313 #else 323 314 324 # define PLATFORM_GET_INC(val,p,type) do{\315 # define PLATFORM_GET_INC(val,p,type) do{\ 325 316 xmemcpy(&val, (p), sizeof(type));\ 326 317 (p) += sizeof(type);\ … … 328 319 329 320 /* sizeof(OnigCodePoint) */ 330 # define WORD_ALIGNMENT_SIZE SIZEOF_LONG331 332 # define GET_ALIGNMENT_PAD_SIZE(addr,pad_size) do {\321 # define WORD_ALIGNMENT_SIZE SIZEOF_LONG 322 323 # define GET_ALIGNMENT_PAD_SIZE(addr,pad_size) do {\ 333 324 (pad_size) = WORD_ALIGNMENT_SIZE \ 334 325 - ((uintptr_t )(addr) % WORD_ALIGNMENT_SIZE);\ … … 336 327 } while (0) 337 328 338 # define ALIGNMENT_RIGHT(addr) do {\329 # define ALIGNMENT_RIGHT(addr) do {\ 339 330 (addr) += (WORD_ALIGNMENT_SIZE - 1);\ 340 331 (addr) -= ((uintptr_t )(addr) % WORD_ALIGNMENT_SIZE);\ … … 400 391 #define IS_NOTBOS(option) ((option) & ONIG_OPTION_NOTBOS) 401 392 #define IS_NOTEOS(option) ((option) & ONIG_OPTION_NOTEOS) 402 #define IS_POSIX_REGION(option) ((option) & ONIG_OPTION_POSIX_REGION)403 393 #define IS_ASCII_RANGE(option) ((option) & ONIG_OPTION_ASCII_RANGE) 404 394 #define IS_POSIX_BRACKET_ALL_RANGE(option) ((option) & ONIG_OPTION_POSIX_BRACKET_ALL_RANGE) … … 583 573 OP_CCLASS_MB_NOT, 584 574 OP_CCLASS_MIX_NOT, 585 OP_CCLASS_NODE, /* pointer to CClassNode node */586 575 587 576 OP_ANYCHAR, /* "." */ … … 612 601 OP_SEMI_END_BUF, 613 602 OP_BEGIN_POSITION, 614 OP_BEGIN_POS_OR_LINE, /* used for implicit anchor optimization */615 603 616 604 OP_BACKREF1, … … 657 645 OP_PUSH_LOOK_BEHIND_NOT, /* (?<!...) start */ 658 646 OP_FAIL_LOOK_BEHIND_NOT, /* (?<!...) end */ 647 OP_PUSH_ABSENT_POS, /* (?~...) start */ 648 OP_ABSENT, /* (?~...) start of inner loop */ 649 OP_ABSENT_END, /* (?~...) end */ 659 650 660 651 OP_CALL, /* \g<name> */ … … 744 735 #define SIZE_OP_RETURN SIZE_OPCODE 745 736 #define SIZE_OP_CONDITION (SIZE_OPCODE + SIZE_MEMNUM + SIZE_RELADDR) 737 #define SIZE_OP_PUSH_ABSENT_POS SIZE_OPCODE 738 #define SIZE_OP_ABSENT (SIZE_OPCODE + SIZE_RELADDR) 739 #define SIZE_OP_ABSENT_END SIZE_OPCODE 746 740 747 741 #ifdef USE_COMBINATION_EXPLOSION_CHECK 748 # define SIZE_OP_STATE_CHECK(SIZE_OPCODE + SIZE_STATE_CHECK_NUM)749 # define SIZE_OP_STATE_CHECK_PUSH(SIZE_OPCODE + SIZE_STATE_CHECK_NUM + SIZE_RELADDR)750 # define SIZE_OP_STATE_CHECK_PUSH_OR_JUMP (SIZE_OPCODE + SIZE_STATE_CHECK_NUM + SIZE_RELADDR)751 # define SIZE_OP_STATE_CHECK_ANYCHAR_STAR (SIZE_OPCODE + SIZE_STATE_CHECK_NUM)742 # define SIZE_OP_STATE_CHECK (SIZE_OPCODE + SIZE_STATE_CHECK_NUM) 743 # define SIZE_OP_STATE_CHECK_PUSH (SIZE_OPCODE + SIZE_STATE_CHECK_NUM + SIZE_RELADDR) 744 # define SIZE_OP_STATE_CHECK_PUSH_OR_JUMP (SIZE_OPCODE + SIZE_STATE_CHECK_NUM + SIZE_RELADDR) 745 # define SIZE_OP_STATE_CHECK_ANYCHAR_STAR (SIZE_OPCODE + SIZE_STATE_CHECK_NUM) 752 746 #endif 753 747 … … 797 791 /* cclass node */ 798 792 #define FLAG_NCCLASS_NOT (1<<0) 799 #define FLAG_NCCLASS_SHARE (1<<1)800 793 801 794 #define NCCLASS_SET_NOT(nd) NCCLASS_FLAG_SET(nd, FLAG_NCCLASS_NOT) 802 #define NCCLASS_SET_SHARE(nd) NCCLASS_FLAG_SET(nd, FLAG_NCCLASS_SHARE)803 795 #define NCCLASS_CLEAR_NOT(nd) NCCLASS_FLAG_CLEAR(nd, FLAG_NCCLASS_NOT) 804 796 #define IS_NCCLASS_NOT(nd) IS_NCCLASS_FLAG_ON(nd, FLAG_NCCLASS_NOT) 805 #define IS_NCCLASS_SHARE(nd) IS_NCCLASS_FLAG_ON(nd, FLAG_NCCLASS_SHARE)806 797 807 798 typedef struct { … … 858 849 } call_frame; 859 850 #endif 851 struct { 852 UChar *abs_pstr; /* absent start position */ 853 const UChar *end_pstr; /* end position */ 854 } absent_pos; 860 855 } u; 861 856 } OnigStackType; … … 901 896 902 897 903 extern void onig_print_compiled_byte_code P_((FILE* f, UChar* bp, UChar** nextp, OnigEncoding enc)); 904 905 #ifdef ONIG_DEBUG_STATISTICS 906 extern void onig_statistics_init P_((void)); 907 extern void onig_print_statistics P_((FILE* f)); 908 #endif 909 #endif 910 911 extern UChar* onig_error_code_to_format P_((OnigPosition code)); 912 extern void onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, ...)); 913 extern int onig_bbuf_init P_((BBuf* buf, OnigDistance size)); 914 extern int onig_compile P_((regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo)); 915 extern void onig_chain_reduce P_((regex_t* reg)); 916 extern void onig_chain_link_add P_((regex_t* to, regex_t* add)); 917 extern void onig_transfer P_((regex_t* to, regex_t* from)); 918 extern int onig_is_code_in_cc P_((OnigEncoding enc, OnigCodePoint code, CClassNode* cc)); 919 extern int onig_is_code_in_cc_len P_((int enclen, OnigCodePoint code, CClassNode* cc)); 898 extern void onig_print_compiled_byte_code(FILE* f, UChar* bp, UChar* bpend, UChar** nextp, OnigEncoding enc); 899 900 # ifdef ONIG_DEBUG_STATISTICS 901 extern void onig_statistics_init(void); 902 extern void onig_print_statistics(FILE* f); 903 # endif 904 #endif 905 906 extern UChar* onig_error_code_to_format(OnigPosition code); 907 extern void onig_vsnprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, va_list args); 908 extern void onig_snprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, ...); 909 extern int onig_bbuf_init(BBuf* buf, OnigDistance size); 910 extern int onig_compile(regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo); 911 #ifdef RUBY 912 extern int onig_compile_ruby(regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo, const char *sourcefile, int sourceline); 913 #endif 914 extern void onig_transfer(regex_t* to, regex_t* from); 915 extern int onig_is_code_in_cc(OnigEncoding enc, OnigCodePoint code, CClassNode* cc); 916 extern int onig_is_code_in_cc_len(int enclen, OnigCodePoint code, CClassNode* cc); 920 917 921 918 /* strend hash */ 922 919 typedef void hash_table_type; 923 typedef uintptr_t hash_data_type; 924 925 extern hash_table_type* onig_st_init_strend_table_with_size P_((int size)); 926 extern int onig_st_lookup_strend P_((hash_table_type* table, const UChar* str_key, const UChar* end_key, hash_data_type *value)); 927 extern int onig_st_insert_strend P_((hash_table_type* table, const UChar* str_key, const UChar* end_key, hash_data_type value)); 928 929 /* encoding property management */ 930 #define PROPERTY_LIST_ADD_PROP(Name, CR) \ 931 r = onigenc_property_list_add_property((UChar* )Name, CR,\ 932 &PropertyNameTable, &PropertyList, &PropertyListNum,\ 933 &PropertyListSize);\ 934 if (r != 0) goto end 935 936 #define PROPERTY_LIST_INIT_CHECK \ 937 if (PropertyInited == 0) {\ 938 int r = onigenc_property_list_init(init_property_list);\ 939 if (r != 0) return r;\ 940 } 941 942 extern int onigenc_property_list_add_property P_((UChar* name, const OnigCodePoint* prop, hash_table_type **table, const OnigCodePoint*** plist, int *pnum, int *psize)); 943 944 typedef int (*ONIGENC_INIT_PROPERTY_LIST_FUNC_TYPE)(void); 945 946 extern int onigenc_property_list_init P_((ONIGENC_INIT_PROPERTY_LIST_FUNC_TYPE)); 947 948 extern size_t onig_memsize P_((const regex_t *reg)); 949 extern size_t onig_region_memsize P_((const struct re_registers *regs)); 950 951 #endif /* REGINT_H */ 920 #ifdef RUBY 921 # include "ruby/st.h" 922 #else 923 # include "st.h" 924 #endif 925 typedef st_data_t hash_data_type; 926 927 extern hash_table_type* onig_st_init_strend_table_with_size(st_index_t size); 928 extern int onig_st_lookup_strend(hash_table_type* table, const UChar* str_key, const UChar* end_key, hash_data_type *value); 929 extern int onig_st_insert_strend(hash_table_type* table, const UChar* str_key, const UChar* end_key, hash_data_type value); 930 931 #ifdef RUBY 932 extern size_t onig_memsize(const regex_t *reg); 933 extern size_t onig_region_memsize(const struct re_registers *regs); 934 #endif 935 936 RUBY_SYMBOL_EXPORT_END 937 938 #endif /* ONIGMO_REGINT_H */
Note:
See TracChangeset
for help on using the changeset viewer.