debase-ruby_core_source 0.10.15 → 0.10.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/debase-ruby_core_source.gemspec +1 -1
  4. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/addr2line.h +1 -1
  5. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/build_assert/build_assert.h +40 -0
  6. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/check_type/check_type.h +63 -0
  7. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/container_of/container_of.h +142 -0
  8. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/list/list.h +773 -0
  9. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ccan/str/str.h +16 -0
  10. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/constant.h +51 -0
  11. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/debug_counter.h +109 -0
  12. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/dln.h +10 -9
  13. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/encindex.h +69 -0
  14. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/eval_intern.h +334 -0
  15. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/gc.h +27 -10
  16. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/id.h +250 -0
  17. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/id_table.h +31 -0
  18. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/insns.inc +217 -0
  19. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/insns_info.inc +1570 -0
  20. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/internal.h +2036 -0
  21. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/iseq.h +308 -0
  22. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/known_errors.inc +16 -1
  23. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/method.h +218 -0
  24. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/node.h +115 -79
  25. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/node_name.inc +12 -22
  26. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/opt_sc.inc +1601 -0
  27. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/optinsn.inc +103 -0
  28. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/optunifs.inc +28 -83
  29. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/parse.h +74 -60
  30. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/probes_helper.h +43 -0
  31. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/regenc.h +254 -0
  32. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/regint.h +299 -211
  33. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/regparse.h +45 -37
  34. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/revision.h +1 -0
  35. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/ruby_assert.h +54 -0
  36. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/ruby_atomic.h +84 -26
  37. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/siphash.h +1 -1
  38. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/symbol.h +108 -0
  39. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/thread_pthread.h +14 -11
  40. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/thread_win32.h +2 -6
  41. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/timev.h +42 -0
  42. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/transcode_data.h +34 -12
  43. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/version.h +73 -0
  44. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm.inc +3667 -0
  45. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm_call_iseq_optimized.inc +213 -0
  46. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm_core.h +1768 -0
  47. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550/debug.h → ruby-2.5.4-p155/vm_debug.h} +4 -8
  48. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/vm_exec.h +38 -30
  49. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vm_insnhelper.h +255 -0
  50. data/lib/debase/ruby_core_source/{ruby-1.9.3-p550 → ruby-2.5.4-p155}/vm_opts.h +14 -9
  51. data/lib/debase/ruby_core_source/ruby-2.5.4-p155/vmtc.inc +214 -0
  52. data/lib/debase/ruby_core_source/version.rb +1 -1
  53. metadata +52 -42
  54. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/constant.h +0 -34
  55. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/encdb.h +0 -167
  56. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/eval_intern.h +0 -234
  57. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/id.h +0 -177
  58. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/insns.inc +0 -179
  59. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/insns_info.inc +0 -695
  60. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/internal.h +0 -242
  61. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/iseq.h +0 -126
  62. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/method.h +0 -105
  63. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/opt_sc.inc +0 -670
  64. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/optinsn.inc +0 -30
  65. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/regenc.h +0 -219
  66. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/revision.h +0 -1
  67. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/timev.h +0 -21
  68. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/transdb.h +0 -189
  69. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/version.h +0 -52
  70. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vm.inc +0 -3054
  71. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vm_core.h +0 -763
  72. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vm_insnhelper.h +0 -220
  73. data/lib/debase/ruby_core_source/ruby-1.9.3-p550/vmtc.inc +0 -97
@@ -1,10 +1,11 @@
1
- #ifndef ONIGURUMA_REGINT_H
2
- #define ONIGURUMA_REGINT_H
1
+ #ifndef ONIGMO_REGINT_H
2
+ #define ONIGMO_REGINT_H
3
3
  /**********************************************************************
4
- regint.h - Oniguruma (regular expression library)
4
+ regint.h - Onigmo (Oniguruma-mod) (regular expression library)
5
5
  **********************************************************************/
6
6
  /*-
7
- * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
7
+ * Copyright (c) 2002-2013 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
8
+ * Copyright (c) 2011-2016 K.Takata <kentkt AT csc DOT jp>
8
9
  * All rights reserved.
9
10
  *
10
11
  * Redistribution and use in source and binary forms, with or without
@@ -34,6 +35,7 @@
34
35
  /* #define ONIG_DEBUG_COMPILE */
35
36
  /* #define ONIG_DEBUG_SEARCH */
36
37
  /* #define ONIG_DEBUG_MATCH */
38
+ /* #define ONIG_DEBUG_MEMLEAK */
37
39
  /* #define ONIG_DONT_OPTIMIZE */
38
40
 
39
41
  /* for byte-code statistical data. */
@@ -41,198 +43,254 @@
41
43
 
42
44
  #if defined(ONIG_DEBUG_PARSE_TREE) || defined(ONIG_DEBUG_MATCH) || \
43
45
  defined(ONIG_DEBUG_SEARCH) || defined(ONIG_DEBUG_COMPILE) || \
44
- defined(ONIG_DEBUG_STATISTICS)
45
- #ifndef ONIG_DEBUG
46
- #define ONIG_DEBUG
46
+ defined(ONIG_DEBUG_STATISTICS) || defined(ONIG_DEBUG_MEMLEAK)
47
+ # ifndef ONIG_DEBUG
48
+ # define ONIG_DEBUG
49
+ # endif
47
50
  #endif
51
+
52
+ #ifndef UNALIGNED_WORD_ACCESS
53
+ # 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
48
61
  #endif
49
62
 
50
- #if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
51
- defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD86) || \
52
- defined(__mc68020__)
53
- #define PLATFORM_UNALIGNED_WORD_ACCESS
63
+ #if UNALIGNED_WORD_ACCESS
64
+ # define PLATFORM_UNALIGNED_WORD_ACCESS
54
65
  #endif
55
66
 
56
67
  /* config */
57
68
  /* spec. config */
58
69
  #define USE_NAMED_GROUP
59
70
  #define USE_SUBEXP_CALL
71
+ #define USE_PERL_SUBEXP_CALL
72
+ #define USE_CAPITAL_P_NAMED_GROUP
60
73
  #define USE_BACKREF_WITH_LEVEL /* \k<name+n>, \k<name-n> */
61
74
  #define USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT /* /(?:()|())*\2/ */
62
75
  #define USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE /* /\n$/ =~ "\n" */
63
76
  #define USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR
64
- /* #define USE_RECOMPILE_API */
65
77
  /* !!! moved to regenc.h. */ /* #define USE_CRNL_AS_LINE_TERMINATOR */
78
+ #define USE_NO_INVALID_QUANTIFIER
66
79
 
67
80
  /* internal config */
68
- #define USE_PARSE_TREE_NODE_RECYCLE
69
- #define USE_OP_PUSH_OR_JUMP_EXACT
81
+ /* #define USE_OP_PUSH_OR_JUMP_EXACT */
70
82
  #define USE_QTFR_PEEK_NEXT
71
83
  #define USE_ST_LIBRARY
72
- #define USE_SHARED_CCLASS_TABLE
84
+ #define USE_SUNDAY_QUICK_SEARCH
73
85
 
74
86
  #define INIT_MATCH_STACK_SIZE 160
75
87
  #define DEFAULT_MATCH_STACK_LIMIT_SIZE 0 /* unlimited */
88
+ #define DEFAULT_PARSE_DEPTH_LIMIT 4096
89
+
90
+ #define OPT_EXACT_MAXLEN 24
91
+
92
+ /* check config */
93
+ #if defined(USE_PERL_SUBEXP_CALL) || defined(USE_CAPITAL_P_NAMED_GROUP)
94
+ # if !defined(USE_NAMED_GROUP) || !defined(USE_SUBEXP_CALL)
95
+ # error USE_NAMED_GROUP and USE_SUBEXP_CALL must be defined.
96
+ # endif
97
+ #endif
76
98
 
77
99
  #if defined(__GNUC__)
78
- # define ARG_UNUSED __attribute__ ((unused))
100
+ # define ARG_UNUSED __attribute__ ((unused))
79
101
  #else
80
- # define ARG_UNUSED
102
+ # define ARG_UNUSED
81
103
  #endif
82
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>
124
+
83
125
  /* */
84
126
  /* escape other system UChar definition */
85
- #ifndef RUBY_DEFINES_H
86
- #include "ruby/ruby.h"
87
- #undef xmalloc
88
- #undef xrealloc
89
- #undef xcalloc
90
- #undef xfree
91
- #endif
92
127
  #ifdef ONIG_ESCAPE_UCHAR_COLLISION
93
- #undef ONIG_ESCAPE_UCHAR_COLLISION
128
+ # undef ONIG_ESCAPE_UCHAR_COLLISION
94
129
  #endif
95
- #undef USE_MATCH_RANGE_IS_COMPLETE_RANGE
96
- #undef USE_CAPTURE_HISTORY
97
- #define USE_VARIABLE_META_CHARS
130
+
98
131
  #define USE_WORD_BEGIN_END /* "\<": word-begin, "\>": word-end */
99
- #define USE_POSIX_REGION_OPTION /* needed for POSIX API support */
132
+ #ifdef RUBY
133
+ # undef USE_CAPTURE_HISTORY
134
+ #else
135
+ # define USE_CAPTURE_HISTORY
136
+ #endif
137
+ #define USE_VARIABLE_META_CHARS
100
138
  #define USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
101
139
  /* #define USE_COMBINATION_EXPLOSION_CHECK */ /* (X*)* */
102
- /* #define USE_MULTI_THREAD_SYSTEM */
103
- #define THREAD_SYSTEM_INIT /* depend on thread system */
104
- #define THREAD_SYSTEM_END /* depend on thread system */
105
- #define THREAD_ATOMIC_START /* depend on thread system */
106
- #define THREAD_ATOMIC_END /* depend on thread system */
107
- #define THREAD_PASS /* depend on thread system */
140
+
141
+
108
142
  #ifndef xmalloc
109
- #define xmalloc malloc
110
- #define xrealloc realloc
111
- #define xcalloc calloc
112
- #define xfree free
143
+ # define xmalloc malloc
144
+ # define xrealloc realloc
145
+ # define xcalloc calloc
146
+ # define xfree free
113
147
  #endif
114
148
 
115
149
  #ifdef RUBY
116
150
 
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
136
-
137
- #define USE_UPPER_CASE_TABLE
138
- #else
139
-
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
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
157
193
  /* */
158
- #define onig_st_is_member st_is_member
194
+ # define onig_st_is_member st_is_member
159
195
 
160
- #define CHECK_INTERRUPT_IN_MATCH_AT
161
-
162
- #endif
196
+ #endif /* RUBY */
163
197
 
164
198
  #define STATE_CHECK_STRING_THRESHOLD_LEN 7
165
199
  #define STATE_CHECK_BUFF_MAX_SIZE 0x4000
166
200
 
167
- #define THREAD_PASS_LIMIT_COUNT 8
168
201
  #define xmemset memset
169
202
  #define xmemcpy memcpy
170
203
  #define xmemmove memmove
171
204
 
172
- #if defined(_WIN32) && !defined(__GNUC__)
173
- #define xalloca _alloca
174
- #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)
175
212
  #else
176
- #define xalloca alloca
177
- #define xvsnprintf vsnprintf
213
+ # define xalloca alloca
214
+ # define xvsnprintf vsnprintf
215
+ # define xsnprintf snprintf
216
+ # define xstrcat(dest,src,size) strcat(dest,src)
178
217
  #endif
179
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
180
224
 
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--
184
-
185
- #define ONIG_STATE_INC_THREAD(reg) do {\
186
- THREAD_ATOMIC_START;\
187
- (reg)->state++;\
188
- THREAD_ATOMIC_END;\
189
- } while(0)
190
- #define ONIG_STATE_DEC_THREAD(reg) do {\
191
- THREAD_ATOMIC_START;\
192
- (reg)->state--;\
193
- THREAD_ATOMIC_END;\
194
- } while(0)
195
- #else
196
- #define ONIG_STATE_INC(reg) /* Nothing */
197
- #define ONIG_STATE_DEC(reg) /* Nothing */
198
- #define ONIG_STATE_INC_THREAD(reg) /* Nothing */
199
- #define ONIG_STATE_DEC_THREAD(reg) /* Nothing */
200
- #endif /* USE_RECOMPILE_API && USE_MULTI_THREAD_SYSTEM */
201
-
202
- #ifdef HAVE_STDLIB_H
203
225
  #include <stdlib.h>
204
- #endif
205
226
 
206
227
  #if defined(HAVE_ALLOCA_H) && (defined(_AIX) || !defined(__GNUC__))
207
- #include <alloca.h>
228
+ # include <alloca.h>
208
229
  #endif
209
230
 
210
- #ifdef HAVE_STRING_H
211
- # include <string.h>
212
- #else
213
- # include <strings.h>
214
- #endif
231
+ #include <string.h>
215
232
 
216
233
  #include <ctype.h>
217
234
  #ifdef HAVE_SYS_TYPES_H
218
- #include <sys/types.h>
235
+ # include <sys/types.h>
236
+ #endif
237
+
238
+ #ifdef HAVE_STDINT_H
239
+ # include <stdint.h>
240
+ #endif
241
+
242
+ #ifdef HAVE_INTTYPES_H
243
+ # include <inttypes.h>
244
+ #endif
245
+
246
+ #include <stddef.h>
247
+
248
+ #ifdef _WIN32
249
+ # include <malloc.h> /* for alloca() */
219
250
  #endif
220
251
 
221
252
  #ifdef ONIG_DEBUG
222
253
  # include <stdio.h>
223
254
  #endif
224
255
 
225
- #include "regenc.h"
256
+ #ifdef _WIN32
257
+ # if defined(_MSC_VER) && (_MSC_VER < 1300)
258
+ # ifndef _INTPTR_T_DEFINED
259
+ # define _INTPTR_T_DEFINED
260
+ typedef int intptr_t;
261
+ # endif
262
+ # ifndef _UINTPTR_T_DEFINED
263
+ # define _UINTPTR_T_DEFINED
264
+ typedef unsigned int uintptr_t;
265
+ # endif
266
+ # endif
267
+ #endif /* _WIN32 */
268
+
269
+ #ifndef PRIdPTR
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
226
280
 
227
- #if defined __GNUC__ && __GNUC__ >= 4
228
- #pragma GCC visibility push(default)
281
+ #ifndef PRIdPTRDIFF
282
+ # define PRIdPTRDIFF PRIdPTR
229
283
  #endif
230
284
 
285
+ #include "regenc.h"
286
+
287
+ RUBY_SYMBOL_EXPORT_BEGIN
288
+
231
289
  #ifdef MIN
232
- #undef MIN
290
+ # undef MIN
233
291
  #endif
234
292
  #ifdef MAX
235
- #undef MAX
293
+ # undef MAX
236
294
  #endif
237
295
  #define MIN(a,b) (((a)>(b))?(b):(a))
238
296
  #define MAX(a,b) (((a)<(b))?(b):(a))
@@ -243,30 +301,32 @@
243
301
  #define CHECK_NULL_RETURN_MEMERR(p) if (IS_NULL(p)) return ONIGERR_MEMORY
244
302
  #define NULL_UCHARP ((UChar* )0)
245
303
 
304
+ #define ONIG_LAST_CODE_POINT (~((OnigCodePoint )0))
305
+
246
306
  #ifdef PLATFORM_UNALIGNED_WORD_ACCESS
247
307
 
248
- #define PLATFORM_GET_INC(val,p,type) do{\
308
+ # define PLATFORM_GET_INC(val,p,type) do{\
249
309
  val = *(type* )p;\
250
310
  (p) += sizeof(type);\
251
311
  } while(0)
252
312
 
253
313
  #else
254
314
 
255
- #define PLATFORM_GET_INC(val,p,type) do{\
315
+ # define PLATFORM_GET_INC(val,p,type) do{\
256
316
  xmemcpy(&val, (p), sizeof(type));\
257
317
  (p) += sizeof(type);\
258
318
  } while(0)
259
319
 
260
320
  /* sizeof(OnigCodePoint) */
261
- #define WORD_ALIGNMENT_SIZE SIZEOF_LONG
321
+ # define WORD_ALIGNMENT_SIZE SIZEOF_LONG
262
322
 
263
- #define GET_ALIGNMENT_PAD_SIZE(addr,pad_size) do {\
323
+ # define GET_ALIGNMENT_PAD_SIZE(addr,pad_size) do {\
264
324
  (pad_size) = WORD_ALIGNMENT_SIZE \
265
325
  - ((uintptr_t )(addr) % WORD_ALIGNMENT_SIZE);\
266
326
  if ((pad_size) == WORD_ALIGNMENT_SIZE) (pad_size) = 0;\
267
327
  } while (0)
268
328
 
269
- #define ALIGNMENT_RIGHT(addr) do {\
329
+ # define ALIGNMENT_RIGHT(addr) do {\
270
330
  (addr) += (WORD_ALIGNMENT_SIZE - 1);\
271
331
  (addr) -= ((uintptr_t )(addr) % WORD_ALIGNMENT_SIZE);\
272
332
  } while (0)
@@ -282,9 +342,11 @@
282
342
  #define ONIG_OPTIMIZE_NONE 0
283
343
  #define ONIG_OPTIMIZE_EXACT 1 /* Slow Search */
284
344
  #define ONIG_OPTIMIZE_EXACT_BM 2 /* Boyer Moore Search */
285
- #define ONIG_OPTIMIZE_EXACT_BM_NOT_REV 3 /* BM (but not simple match) */
345
+ #define ONIG_OPTIMIZE_EXACT_BM_NOT_REV 3 /* BM (applied to a multibyte string) */
286
346
  #define ONIG_OPTIMIZE_EXACT_IC 4 /* Slow Search (ignore case) */
287
347
  #define ONIG_OPTIMIZE_MAP 5 /* char map */
348
+ #define ONIG_OPTIMIZE_EXACT_BM_IC 6 /* BM (ignore case) */
349
+ #define ONIG_OPTIMIZE_EXACT_BM_NOT_REV_IC 7 /* BM (applied to a multibyte string) (ignore case) */
288
350
 
289
351
  /* bit status */
290
352
  typedef unsigned int BitStatusType;
@@ -293,17 +355,17 @@ typedef unsigned int BitStatusType;
293
355
  #define BIT_STATUS_CLEAR(stats) (stats) = 0
294
356
  #define BIT_STATUS_ON_ALL(stats) (stats) = ~((BitStatusType )0)
295
357
  #define BIT_STATUS_AT(stats,n) \
296
- ((n) < (int )BIT_STATUS_BITS_NUM ? ((stats) & (1 << n)) : ((stats) & 1))
358
+ ((n) < (int )BIT_STATUS_BITS_NUM ? ((stats) & ((BitStatusType )1 << n)) : ((stats) & 1))
297
359
 
298
360
  #define BIT_STATUS_ON_AT(stats,n) do {\
299
- if ((n) < (int )BIT_STATUS_BITS_NUM) \
361
+ if ((n) < (int )BIT_STATUS_BITS_NUM)\
300
362
  (stats) |= (1 << (n));\
301
363
  else\
302
364
  (stats) |= 1;\
303
365
  } while (0)
304
366
 
305
367
  #define BIT_STATUS_ON_AT_SIMPLE(stats,n) do {\
306
- if ((n) < (int )BIT_STATUS_BITS_NUM)\
368
+ if ((n) < (int )BIT_STATUS_BITS_NUM)\
307
369
  (stats) |= (1 << (n));\
308
370
  } while (0)
309
371
 
@@ -326,7 +388,12 @@ typedef unsigned int BitStatusType;
326
388
  (ONIG_OPTION_FIND_LONGEST | ONIG_OPTION_FIND_NOT_EMPTY))
327
389
  #define IS_NOTBOL(option) ((option) & ONIG_OPTION_NOTBOL)
328
390
  #define IS_NOTEOL(option) ((option) & ONIG_OPTION_NOTEOL)
329
- #define IS_POSIX_REGION(option) ((option) & ONIG_OPTION_POSIX_REGION)
391
+ #define IS_NOTBOS(option) ((option) & ONIG_OPTION_NOTBOS)
392
+ #define IS_NOTEOS(option) ((option) & ONIG_OPTION_NOTEOS)
393
+ #define IS_ASCII_RANGE(option) ((option) & ONIG_OPTION_ASCII_RANGE)
394
+ #define IS_POSIX_BRACKET_ALL_RANGE(option) ((option) & ONIG_OPTION_POSIX_BRACKET_ALL_RANGE)
395
+ #define IS_WORD_BOUND_ALL_RANGE(option) ((option) & ONIG_OPTION_WORD_BOUND_ALL_RANGE)
396
+ #define IS_NEWLINE_CRLF(option) ((option) & ONIG_OPTION_NEWLINE_CRLF)
330
397
 
331
398
  /* OP_SET_OPTION is required for these options.
332
399
  #define IS_DYNAMIC_OPTION(option) \
@@ -344,7 +411,7 @@ typedef unsigned int BitStatusType;
344
411
  /* bitset */
345
412
  #define BITS_PER_BYTE 8
346
413
  #define SINGLE_BYTE_SIZE (1 << BITS_PER_BYTE)
347
- #define BITS_IN_ROOM (sizeof(Bits) * BITS_PER_BYTE)
414
+ #define BITS_IN_ROOM ((int )sizeof(Bits) * BITS_PER_BYTE)
348
415
  #define BITSET_SIZE (SINGLE_BYTE_SIZE / BITS_IN_ROOM)
349
416
 
350
417
  #ifdef PLATFORM_UNALIGNED_WORD_ACCESS
@@ -355,15 +422,15 @@ typedef unsigned char Bits;
355
422
  typedef Bits BitSet[BITSET_SIZE];
356
423
  typedef Bits* BitSetRef;
357
424
 
358
- #define SIZE_BITSET (int)sizeof(BitSet)
425
+ #define SIZE_BITSET (int )sizeof(BitSet)
359
426
 
360
427
  #define BITSET_CLEAR(bs) do {\
361
428
  int i;\
362
- for (i = 0; i < (int )BITSET_SIZE; i++) { (bs)[i] = 0; } \
429
+ for (i = 0; i < BITSET_SIZE; i++) { (bs)[i] = 0; } \
363
430
  } while (0)
364
431
 
365
- #define BS_ROOM(bs,pos) (bs)[pos / BITS_IN_ROOM]
366
- #define BS_BIT(pos) (1 << (pos % BITS_IN_ROOM))
432
+ #define BS_ROOM(bs,pos) (bs)[(int )(pos) / BITS_IN_ROOM]
433
+ #define BS_BIT(pos) (1U << ((int )(pos) % BITS_IN_ROOM))
367
434
 
368
435
  #define BITSET_AT(bs, pos) (BS_ROOM(bs,pos) & BS_BIT(pos))
369
436
  #define BITSET_SET_BIT(bs, pos) BS_ROOM(bs,pos) |= BS_BIT(pos)
@@ -380,29 +447,35 @@ typedef struct _BBuf {
380
447
  #define BBUF_INIT(buf,size) onig_bbuf_init((BBuf* )(buf), (size))
381
448
 
382
449
  #define BBUF_SIZE_INC(buf,inc) do{\
450
+ UChar *tmp;\
383
451
  (buf)->alloc += (inc);\
384
- (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
385
- if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
452
+ tmp = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
453
+ if (IS_NULL(tmp)) return(ONIGERR_MEMORY);\
454
+ (buf)->p = tmp;\
386
455
  } while (0)
387
456
 
388
457
  #define BBUF_EXPAND(buf,low) do{\
458
+ UChar *tmp;\
389
459
  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);\
460
+ tmp = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
461
+ if (IS_NULL(tmp)) return(ONIGERR_MEMORY);\
462
+ (buf)->p = tmp;\
392
463
  } while (0)
393
464
 
394
465
  #define BBUF_ENSURE_SIZE(buf,size) do{\
395
466
  unsigned int new_alloc = (buf)->alloc;\
396
467
  while (new_alloc < (unsigned int )(size)) { new_alloc *= 2; }\
397
468
  if ((buf)->alloc != new_alloc) {\
398
- (buf)->p = (UChar* )xrealloc((buf)->p, new_alloc);\
399
- if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
469
+ UChar *tmp;\
470
+ tmp = (UChar* )xrealloc((buf)->p, new_alloc);\
471
+ if (IS_NULL(tmp)) return(ONIGERR_MEMORY);\
472
+ (buf)->p = tmp;\
400
473
  (buf)->alloc = new_alloc;\
401
474
  }\
402
475
  } while (0)
403
476
 
404
477
  #define BBUF_WRITE(buf,pos,bytes,n) do{\
405
- int used = (pos) + (int)(n);\
478
+ int used = (pos) + (int )(n);\
406
479
  if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
407
480
  xmemcpy((buf)->p + (pos), (bytes), (n));\
408
481
  if ((buf)->used < (unsigned int )used) (buf)->used = used;\
@@ -411,7 +484,7 @@ typedef struct _BBuf {
411
484
  #define BBUF_WRITE1(buf,pos,byte) do{\
412
485
  int used = (pos) + 1;\
413
486
  if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
414
- (buf)->p[(pos)] = (byte);\
487
+ (buf)->p[(pos)] = (UChar )(byte);\
415
488
  if ((buf)->used < (unsigned int )used) (buf)->used = used;\
416
489
  } while (0)
417
490
 
@@ -470,6 +543,8 @@ typedef struct _BBuf {
470
543
  #define ANCHOR_ANYCHAR_STAR (1<<14) /* ".*" optimize info */
471
544
  #define ANCHOR_ANYCHAR_STAR_ML (1<<15) /* ".*" optimize info (multi-line) */
472
545
 
546
+ #define ANCHOR_KEEP (1<<16)
547
+
473
548
  /* operation code */
474
549
  enum OpCode {
475
550
  OP_FINISH = 0, /* matching process terminator (no more alternative) */
@@ -497,7 +572,6 @@ enum OpCode {
497
572
  OP_CCLASS_NOT,
498
573
  OP_CCLASS_MB_NOT,
499
574
  OP_CCLASS_MIX_NOT,
500
- OP_CCLASS_NODE, /* pointer to CClassNode node */
501
575
 
502
576
  OP_ANYCHAR, /* "." */
503
577
  OP_ANYCHAR_ML, /* "." multi-line */
@@ -513,6 +587,13 @@ enum OpCode {
513
587
  OP_WORD_BEGIN,
514
588
  OP_WORD_END,
515
589
 
590
+ OP_ASCII_WORD,
591
+ OP_NOT_ASCII_WORD,
592
+ OP_ASCII_WORD_BOUND,
593
+ OP_NOT_ASCII_WORD_BOUND,
594
+ OP_ASCII_WORD_BEGIN,
595
+ OP_ASCII_WORD_END,
596
+
516
597
  OP_BEGIN_BUF,
517
598
  OP_END_BUF,
518
599
  OP_BEGIN_LINE,
@@ -535,6 +616,8 @@ enum OpCode {
535
616
  OP_MEMORY_END,
536
617
  OP_MEMORY_END_REC, /* push marker to stack */
537
618
 
619
+ OP_KEEP,
620
+
538
621
  OP_FAIL, /* pop stack and move */
539
622
  OP_JUMP,
540
623
  OP_PUSH,
@@ -561,10 +644,15 @@ enum OpCode {
561
644
  OP_LOOK_BEHIND, /* (?<=...) start (no needs end opcode) */
562
645
  OP_PUSH_LOOK_BEHIND_NOT, /* (?<!...) start */
563
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 */
564
650
 
565
651
  OP_CALL, /* \g<name> */
566
652
  OP_RETURN,
567
653
 
654
+ OP_CONDITION,
655
+
568
656
  OP_STATE_CHECK_PUSH, /* combination explosion check and push */
569
657
  OP_STATE_CHECK_PUSH_OR_JUMP, /* check ok -> push, else jump */
570
658
  OP_STATE_CHECK, /* check only */
@@ -585,15 +673,15 @@ typedef short int StateCheckNumType;
585
673
  typedef void* PointerType;
586
674
 
587
675
  #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)
676
+ #define SIZE_RELADDR (int )sizeof(RelAddrType)
677
+ #define SIZE_ABSADDR (int )sizeof(AbsAddrType)
678
+ #define SIZE_LENGTH (int )sizeof(LengthType)
679
+ #define SIZE_MEMNUM (int )sizeof(MemNumType)
680
+ #define SIZE_STATE_CHECK_NUM (int )sizeof(StateCheckNumType)
681
+ #define SIZE_REPEATNUM (int )sizeof(RepeatNumType)
682
+ #define SIZE_OPTION (int )sizeof(OnigOptionType)
683
+ #define SIZE_CODE_POINT (int )sizeof(OnigCodePoint)
684
+ #define SIZE_POINTER (int )sizeof(PointerType)
597
685
 
598
686
 
599
687
  #define GET_RELADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, RelAddrType)
@@ -645,12 +733,16 @@ typedef void* PointerType;
645
733
  #define SIZE_OP_FAIL_LOOK_BEHIND_NOT SIZE_OPCODE
646
734
  #define SIZE_OP_CALL (SIZE_OPCODE + SIZE_ABSADDR)
647
735
  #define SIZE_OP_RETURN SIZE_OPCODE
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
648
740
 
649
741
  #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)
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)
654
746
  #endif
655
747
 
656
748
  #define MC_ESC(syn) (syn)->meta_char_table.esc
@@ -698,13 +790,10 @@ typedef void* PointerType;
698
790
 
699
791
  /* cclass node */
700
792
  #define FLAG_NCCLASS_NOT (1<<0)
701
- #define FLAG_NCCLASS_SHARE (1<<1)
702
793
 
703
794
  #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
795
  #define NCCLASS_CLEAR_NOT(nd) NCCLASS_FLAG_CLEAR(nd, FLAG_NCCLASS_NOT)
706
796
  #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)
708
797
 
709
798
  typedef struct {
710
799
  int type;
@@ -731,6 +820,7 @@ typedef struct _OnigStackType {
731
820
  #ifdef USE_COMBINATION_EXPLOSION_CHECK
732
821
  unsigned int state_check;
733
822
  #endif
823
+ UChar *pkeep; /* keep pattern position */
734
824
  } state;
735
825
  struct {
736
826
  int count; /* for OP_REPEAT_INC, OP_REPEAT_INC_NG */
@@ -743,7 +833,7 @@ typedef struct _OnigStackType {
743
833
  struct {
744
834
  int num; /* memory num */
745
835
  UChar *pstr; /* start/end position */
746
- /* Following information is setted, if this stack type is MEM-START */
836
+ /* Following information is set, if this stack type is MEM-START */
747
837
  OnigStackIndex start; /* prev. info (for backtrack "(...)*" ) */
748
838
  OnigStackIndex end; /* prev. info (for backtrack "(...)*" ) */
749
839
  } mem;
@@ -758,6 +848,10 @@ typedef struct _OnigStackType {
758
848
  UChar *pstr; /* string position */
759
849
  } call_frame;
760
850
  #endif
851
+ struct {
852
+ UChar *abs_pstr; /* absent start position */
853
+ const UChar *end_pstr; /* end position */
854
+ } absent_pos;
761
855
  } u;
762
856
  } OnigStackType;
763
857
 
@@ -766,9 +860,10 @@ typedef struct {
766
860
  size_t stack_n;
767
861
  OnigOptionType options;
768
862
  OnigRegion* region;
769
- const UChar* start; /* search start position (for \G: BEGIN_POSITION) */
863
+ const UChar* start; /* search start position */
864
+ const UChar* gpos; /* global position (for \G: BEGIN_POSITION) */
770
865
  #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
771
- int best_len; /* for ONIG_OPTION_FIND_LONGEST */
866
+ OnigPosition best_len; /* for ONIG_OPTION_FIND_LONGEST */
772
867
  UChar* best_s;
773
868
  #endif
774
869
  #ifdef USE_COMBINATION_EXPLOSION_CHECK
@@ -781,6 +876,14 @@ typedef struct {
781
876
  #define IS_CODE_SB_WORD(enc,code) \
782
877
  (ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_WORD(enc,code))
783
878
 
879
+ typedef struct OnigEndCallListItem {
880
+ struct OnigEndCallListItem* next;
881
+ void (*func)(void);
882
+ } OnigEndCallListItemType;
883
+
884
+ extern void onig_add_end_call(void (*func)(void));
885
+
886
+
784
887
  #ifdef ONIG_DEBUG
785
888
 
786
889
  typedef struct {
@@ -791,60 +894,45 @@ typedef struct {
791
894
 
792
895
  extern OnigOpInfoType OnigOpInfo[];
793
896
 
794
- /* extern void onig_print_compiled_byte_code P_((FILE* f, UChar* bp, UChar* bpend, UChar** nextp, OnigEncoding enc)); */
795
897
 
796
- #ifdef ONIG_DEBUG_STATISTICS
797
- extern void onig_statistics_init P_((void));
798
- extern void onig_print_statistics P_((FILE* f));
799
- #endif
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
800
904
  #endif
801
905
 
802
- extern UChar* onig_error_code_to_format P_((int code));
803
- extern void onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, ...));
804
- extern int onig_bbuf_init P_((BBuf* buf, OnigDistance size));
805
- extern int onig_compile P_((regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo, const char *sourcefile, int sourceline));
806
- extern void onig_chain_reduce P_((regex_t* reg));
807
- extern void onig_chain_link_add P_((regex_t* to, regex_t* add));
808
- extern void onig_transfer P_((regex_t* to, regex_t* from));
809
- extern int onig_is_code_in_cc P_((OnigEncoding enc, OnigCodePoint code, CClassNode* cc));
810
- extern int onig_is_code_in_cc_len P_((int enclen, OnigCodePoint code, CClassNode* cc));
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);
811
917
 
812
918
  /* strend hash */
813
919
  typedef void hash_table_type;
814
920
  #ifdef RUBY
815
- #include "ruby/st.h"
816
- typedef st_data_t hash_data_type;
921
+ # include "ruby/st.h"
817
922
  #else
818
- typedef unsigned long hash_data_type;
923
+ # include "st.h"
819
924
  #endif
925
+ typedef st_data_t hash_data_type;
820
926
 
821
- extern hash_table_type* onig_st_init_strend_table_with_size P_((st_index_t size));
822
- extern int onig_st_lookup_strend P_((hash_table_type* table, const UChar* str_key, const UChar* end_key, hash_data_type *value));
823
- extern int onig_st_insert_strend P_((hash_table_type* table, const UChar* str_key, const UChar* end_key, hash_data_type value));
824
-
825
- /* encoding property management */
826
- #define PROPERTY_LIST_ADD_PROP(Name, CR) \
827
- r = onigenc_property_list_add_property((UChar* )Name, CR,\
828
- &PropertyNameTable, &PropertyList, &PropertyListNum,\
829
- &PropertyListSize);\
830
- if (r != 0) goto end
831
-
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;\
836
- }
837
-
838
- extern int onigenc_property_list_add_property P_((UChar* name, const OnigCodePoint* prop, hash_table_type **table, const OnigCodePoint*** plist, int *pnum, int *psize));
839
-
840
- typedef int (*ONIGENC_INIT_PROPERTY_LIST_FUNC_TYPE)(void);
841
-
842
- extern int onigenc_property_list_init P_((ONIGENC_INIT_PROPERTY_LIST_FUNC_TYPE));
843
-
844
- extern size_t onig_memsize P_((const regex_t *reg));
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);
845
930
 
846
- #if defined __GNUC__ && __GNUC__ >= 4
847
- #pragma GCC visibility pop
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);
848
934
  #endif
849
935
 
850
- #endif /* ONIGURUMA_REGINT_H */
936
+ RUBY_SYMBOL_EXPORT_END
937
+
938
+ #endif /* ONIGMO_REGINT_H */