bindex 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +13 -33
  3. data/bindex.gemspec +1 -1
  4. data/ext/bindex/com/gsamokovarov/bindex/JRubyIntegration.java +2 -2
  5. data/ext/bindex/com/gsamokovarov/bindex/SetExceptionBindingsEventHook.java +4 -1
  6. data/ext/bindex/cruby.c +49 -15
  7. data/ext/bindex/extconf.rb +0 -15
  8. data/lib/bindex/jruby.rb +0 -1
  9. data/lib/bindex/jruby_internals.jar +0 -0
  10. data/lib/bindex/jruby_internals_9k.jar +0 -0
  11. data/lib/bindex/version.rb +1 -1
  12. metadata +4 -139
  13. data/ext/bindex/bindex.h +0 -11
  14. data/ext/bindex/bindings.c +0 -106
  15. data/ext/bindex/ruby_193.h +0 -101
  16. data/ext/bindex/ruby_193/addr2line.h +0 -21
  17. data/ext/bindex/ruby_193/constant.h +0 -34
  18. data/ext/bindex/ruby_193/debug.h +0 -41
  19. data/ext/bindex/ruby_193/dln.h +0 -50
  20. data/ext/bindex/ruby_193/encdb.h +0 -167
  21. data/ext/bindex/ruby_193/eval_intern.h +0 -234
  22. data/ext/bindex/ruby_193/gc.h +0 -99
  23. data/ext/bindex/ruby_193/id.h +0 -177
  24. data/ext/bindex/ruby_193/internal.h +0 -242
  25. data/ext/bindex/ruby_193/iseq.h +0 -126
  26. data/ext/bindex/ruby_193/method.h +0 -105
  27. data/ext/bindex/ruby_193/node.h +0 -504
  28. data/ext/bindex/ruby_193/parse.h +0 -302
  29. data/ext/bindex/ruby_193/probes.h +0 -369
  30. data/ext/bindex/ruby_193/regenc.h +0 -219
  31. data/ext/bindex/ruby_193/regint.h +0 -850
  32. data/ext/bindex/ruby_193/regparse.h +0 -362
  33. data/ext/bindex/ruby_193/revision.h +0 -1
  34. data/ext/bindex/ruby_193/ruby_atomic.h +0 -175
  35. data/ext/bindex/ruby_193/siphash.h +0 -48
  36. data/ext/bindex/ruby_193/thread_pthread.h +0 -51
  37. data/ext/bindex/ruby_193/thread_win32.h +0 -40
  38. data/ext/bindex/ruby_193/timev.h +0 -21
  39. data/ext/bindex/ruby_193/transcode_data.h +0 -117
  40. data/ext/bindex/ruby_193/transdb.h +0 -186
  41. data/ext/bindex/ruby_193/verconf.h +0 -12
  42. data/ext/bindex/ruby_193/version.h +0 -52
  43. data/ext/bindex/ruby_193/vm_core.h +0 -763
  44. data/ext/bindex/ruby_193/vm_exec.h +0 -184
  45. data/ext/bindex/ruby_193/vm_insnhelper.h +0 -220
  46. data/ext/bindex/ruby_193/vm_opts.h +0 -51
  47. data/ext/bindex/ruby_20.h +0 -142
  48. data/ext/bindex/ruby_20/addr2line.h +0 -21
  49. data/ext/bindex/ruby_20/constant.h +0 -36
  50. data/ext/bindex/ruby_20/dln.h +0 -50
  51. data/ext/bindex/ruby_20/encdb.h +0 -169
  52. data/ext/bindex/ruby_20/eval_intern.h +0 -241
  53. data/ext/bindex/ruby_20/gc.h +0 -104
  54. data/ext/bindex/ruby_20/id.h +0 -135
  55. data/ext/bindex/ruby_20/internal.h +0 -395
  56. data/ext/bindex/ruby_20/iseq.h +0 -140
  57. data/ext/bindex/ruby_20/method.h +0 -138
  58. data/ext/bindex/ruby_20/node.h +0 -541
  59. data/ext/bindex/ruby_20/parse.h +0 -292
  60. data/ext/bindex/ruby_20/probes.h +0 -369
  61. data/ext/bindex/ruby_20/probes_helper.h +0 -67
  62. data/ext/bindex/ruby_20/regenc.h +0 -227
  63. data/ext/bindex/ruby_20/regint.h +0 -915
  64. data/ext/bindex/ruby_20/regparse.h +0 -367
  65. data/ext/bindex/ruby_20/revision.h +0 -1
  66. data/ext/bindex/ruby_20/ruby_atomic.h +0 -170
  67. data/ext/bindex/ruby_20/siphash.h +0 -48
  68. data/ext/bindex/ruby_20/thread_pthread.h +0 -56
  69. data/ext/bindex/ruby_20/thread_win32.h +0 -45
  70. data/ext/bindex/ruby_20/timev.h +0 -21
  71. data/ext/bindex/ruby_20/transcode_data.h +0 -127
  72. data/ext/bindex/ruby_20/transdb.h +0 -190
  73. data/ext/bindex/ruby_20/verconf.h +0 -12
  74. data/ext/bindex/ruby_20/version.h +0 -52
  75. data/ext/bindex/ruby_20/vm_core.h +0 -1018
  76. data/ext/bindex/ruby_20/vm_debug.h +0 -41
  77. data/ext/bindex/ruby_20/vm_exec.h +0 -173
  78. data/ext/bindex/ruby_20/vm_insnhelper.h +0 -274
  79. data/ext/bindex/ruby_20/vm_opts.h +0 -56
  80. data/ext/bindex/ruby_21.h +0 -142
  81. data/ext/bindex/ruby_21/addr2line.h +0 -21
  82. data/ext/bindex/ruby_21/constant.h +0 -36
  83. data/ext/bindex/ruby_21/dln.h +0 -51
  84. data/ext/bindex/ruby_21/encdb.h +0 -170
  85. data/ext/bindex/ruby_21/eval_intern.h +0 -260
  86. data/ext/bindex/ruby_21/gc.h +0 -101
  87. data/ext/bindex/ruby_21/id.h +0 -210
  88. data/ext/bindex/ruby_21/internal.h +0 -889
  89. data/ext/bindex/ruby_21/iseq.h +0 -136
  90. data/ext/bindex/ruby_21/method.h +0 -142
  91. data/ext/bindex/ruby_21/node.h +0 -543
  92. data/ext/bindex/ruby_21/parse.h +0 -298
  93. data/ext/bindex/ruby_21/probes.h +0 -401
  94. data/ext/bindex/ruby_21/probes_helper.h +0 -67
  95. data/ext/bindex/ruby_21/regenc.h +0 -223
  96. data/ext/bindex/ruby_21/regint.h +0 -911
  97. data/ext/bindex/ruby_21/regparse.h +0 -363
  98. data/ext/bindex/ruby_21/revision.h +0 -1
  99. data/ext/bindex/ruby_21/ruby_atomic.h +0 -170
  100. data/ext/bindex/ruby_21/siphash.h +0 -48
  101. data/ext/bindex/ruby_21/thread_native.h +0 -23
  102. data/ext/bindex/ruby_21/thread_pthread.h +0 -56
  103. data/ext/bindex/ruby_21/thread_win32.h +0 -45
  104. data/ext/bindex/ruby_21/timev.h +0 -42
  105. data/ext/bindex/ruby_21/transcode_data.h +0 -123
  106. data/ext/bindex/ruby_21/transdb.h +0 -190
  107. data/ext/bindex/ruby_21/verconf.h +0 -13
  108. data/ext/bindex/ruby_21/version.h +0 -52
  109. data/ext/bindex/ruby_21/vm_core.h +0 -1043
  110. data/ext/bindex/ruby_21/vm_debug.h +0 -37
  111. data/ext/bindex/ruby_21/vm_exec.h +0 -182
  112. data/ext/bindex/ruby_21/vm_insnhelper.h +0 -273
  113. data/ext/bindex/ruby_21/vm_opts.h +0 -56
  114. data/ext/bindex/ruby_21preview.h +0 -146
  115. data/ext/bindex/ruby_21preview/addr2line.h +0 -21
  116. data/ext/bindex/ruby_21preview/constant.h +0 -36
  117. data/ext/bindex/ruby_21preview/dln.h +0 -51
  118. data/ext/bindex/ruby_21preview/encdb.h +0 -270
  119. data/ext/bindex/ruby_21preview/eval_intern.h +0 -217
  120. data/ext/bindex/ruby_21preview/gc.h +0 -100
  121. data/ext/bindex/ruby_21preview/id.h +0 -169
  122. data/ext/bindex/ruby_21preview/internal.h +0 -765
  123. data/ext/bindex/ruby_21preview/iseq.h +0 -136
  124. data/ext/bindex/ruby_21preview/method.h +0 -141
  125. data/ext/bindex/ruby_21preview/node.h +0 -543
  126. data/ext/bindex/ruby_21preview/parse.h +0 -298
  127. data/ext/bindex/ruby_21preview/probes.h +0 -385
  128. data/ext/bindex/ruby_21preview/probes_helper.h +0 -67
  129. data/ext/bindex/ruby_21preview/regenc.h +0 -223
  130. data/ext/bindex/ruby_21preview/regint.h +0 -911
  131. data/ext/bindex/ruby_21preview/regparse.h +0 -363
  132. data/ext/bindex/ruby_21preview/revision.h +0 -1
  133. data/ext/bindex/ruby_21preview/ruby_atomic.h +0 -130
  134. data/ext/bindex/ruby_21preview/siphash.h +0 -48
  135. data/ext/bindex/ruby_21preview/thread_native.h +0 -23
  136. data/ext/bindex/ruby_21preview/thread_pthread.h +0 -56
  137. data/ext/bindex/ruby_21preview/thread_win32.h +0 -45
  138. data/ext/bindex/ruby_21preview/timev.h +0 -42
  139. data/ext/bindex/ruby_21preview/transcode_data.h +0 -123
  140. data/ext/bindex/ruby_21preview/transdb.h +0 -190
  141. data/ext/bindex/ruby_21preview/verconf.h +0 -13
  142. data/ext/bindex/ruby_21preview/version.h +0 -53
  143. data/ext/bindex/ruby_21preview/vm_core.h +0 -1017
  144. data/ext/bindex/ruby_21preview/vm_debug.h +0 -37
  145. data/ext/bindex/ruby_21preview/vm_exec.h +0 -180
  146. data/ext/bindex/ruby_21preview/vm_insnhelper.h +0 -272
  147. data/ext/bindex/ruby_21preview/vm_opts.h +0 -56
@@ -1,67 +0,0 @@
1
- #ifndef RUBY_PROBES_HELPER_H
2
- #define RUBY_PROBES_HELPER_H
3
-
4
- #include "ruby/ruby.h"
5
- #include "probes.h"
6
-
7
- VALUE rb_class_path_no_cache(VALUE _klass);
8
-
9
- #define RUBY_DTRACE_HOOK(name, th, klazz, id) \
10
- do { \
11
- if (RUBY_DTRACE_##name##_ENABLED()) { \
12
- VALUE _klass = (klazz); \
13
- VALUE _id = (id); \
14
- const char * classname; \
15
- const char * methodname; \
16
- const char * filename; \
17
- if (!_klass) { \
18
- rb_thread_method_id_and_class((th), &_id, &_klass); \
19
- } \
20
- if (_klass) { \
21
- if (RB_TYPE_P(_klass, T_ICLASS)) { \
22
- _klass = RBASIC(_klass)->klass; \
23
- } \
24
- else if (FL_TEST(_klass, FL_SINGLETON)) { \
25
- _klass = rb_iv_get(_klass, "__attached__"); \
26
- } \
27
- switch (TYPE(_klass)) { \
28
- case T_CLASS: \
29
- case T_ICLASS: \
30
- case T_MODULE: \
31
- { \
32
- VALUE _name = rb_class_path_no_cache(_klass); \
33
- if (!NIL_P(_name)) { \
34
- classname = StringValuePtr(_name); \
35
- } \
36
- else { \
37
- classname = "<unknown>"; \
38
- } \
39
- methodname = rb_id2name(_id); \
40
- filename = rb_sourcefile(); \
41
- if (classname && methodname && filename) { \
42
- RUBY_DTRACE_##name( \
43
- classname, \
44
- methodname, \
45
- filename, \
46
- rb_sourceline()); \
47
- } \
48
- break; \
49
- } \
50
- } \
51
- } \
52
- } \
53
- } while (0)
54
-
55
- #define RUBY_DTRACE_METHOD_ENTRY_HOOK(th, klass, id) \
56
- RUBY_DTRACE_HOOK(METHOD_ENTRY, th, klass, id)
57
-
58
- #define RUBY_DTRACE_METHOD_RETURN_HOOK(th, klass, id) \
59
- RUBY_DTRACE_HOOK(METHOD_RETURN, th, klass, id)
60
-
61
- #define RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, klass, id) \
62
- RUBY_DTRACE_HOOK(CMETHOD_ENTRY, th, klass, id)
63
-
64
- #define RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, klass, id) \
65
- RUBY_DTRACE_HOOK(CMETHOD_RETURN, th, klass, id)
66
-
67
- #endif /* RUBY_PROBES_HELPER_H */
@@ -1,223 +0,0 @@
1
- #ifndef ONIGURUMA_REGENC_H
2
- #define ONIGURUMA_REGENC_H
3
- /**********************************************************************
4
- regenc.h - Onigmo (Oniguruma-mod) (regular expression library)
5
- **********************************************************************/
6
- /*-
7
- * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
8
- * Copyright (c) 2011 K.Takata <kentkt AT csc DOT jp>
9
- * All rights reserved.
10
- *
11
- * Redistribution and use in source and binary forms, with or without
12
- * modification, are permitted provided that the following conditions
13
- * are met:
14
- * 1. Redistributions of source code must retain the above copyright
15
- * notice, this list of conditions and the following disclaimer.
16
- * 2. Redistributions in binary form must reproduce the above copyright
17
- * notice, this list of conditions and the following disclaimer in the
18
- * documentation and/or other materials provided with the distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30
- * SUCH DAMAGE.
31
- */
32
- #ifndef REGINT_H
33
- #ifndef RUBY_EXTERN
34
- #include "ruby/config.h"
35
- #include "ruby/defines.h"
36
- #endif
37
- #ifdef ONIG_ESCAPE_UCHAR_COLLISION
38
- #undef ONIG_ESCAPE_UCHAR_COLLISION
39
- #endif
40
- #endif
41
- #include "ruby/oniguruma.h"
42
-
43
- RUBY_SYMBOL_EXPORT_BEGIN
44
-
45
- typedef struct {
46
- OnigCodePoint from;
47
- OnigCodePoint to;
48
- } OnigPairCaseFoldCodes;
49
-
50
-
51
- #ifndef NULL
52
- #define NULL ((void* )0)
53
- #endif
54
-
55
- #ifndef TRUE
56
- #define TRUE 1
57
- #endif
58
-
59
- #ifndef FALSE
60
- #define FALSE 0
61
- #endif
62
-
63
- #ifndef ARG_UNUSED
64
- #if defined(__GNUC__)
65
- # define ARG_UNUSED __attribute__ ((unused))
66
- #else
67
- # define ARG_UNUSED
68
- #endif
69
- #endif
70
-
71
- #define ONIG_IS_NULL(p) (((void*)(p)) == (void*)0)
72
- #define ONIG_IS_NOT_NULL(p) (((void*)(p)) != (void*)0)
73
- #define ONIG_CHECK_NULL_RETURN(p) if (ONIG_IS_NULL(p)) return NULL
74
- #define ONIG_CHECK_NULL_RETURN_VAL(p,val) if (ONIG_IS_NULL(p)) return (val)
75
-
76
- #define enclen(enc,p,e) ((enc->max_enc_len == enc->min_enc_len) ? enc->min_enc_len : ONIGENC_MBC_ENC_LEN(enc,p,e))
77
-
78
- /* character types bit flag */
79
- #define BIT_CTYPE_NEWLINE (1<< ONIGENC_CTYPE_NEWLINE)
80
- #define BIT_CTYPE_ALPHA (1<< ONIGENC_CTYPE_ALPHA)
81
- #define BIT_CTYPE_BLANK (1<< ONIGENC_CTYPE_BLANK)
82
- #define BIT_CTYPE_CNTRL (1<< ONIGENC_CTYPE_CNTRL)
83
- #define BIT_CTYPE_DIGIT (1<< ONIGENC_CTYPE_DIGIT)
84
- #define BIT_CTYPE_GRAPH (1<< ONIGENC_CTYPE_GRAPH)
85
- #define BIT_CTYPE_LOWER (1<< ONIGENC_CTYPE_LOWER)
86
- #define BIT_CTYPE_PRINT (1<< ONIGENC_CTYPE_PRINT)
87
- #define BIT_CTYPE_PUNCT (1<< ONIGENC_CTYPE_PUNCT)
88
- #define BIT_CTYPE_SPACE (1<< ONIGENC_CTYPE_SPACE)
89
- #define BIT_CTYPE_UPPER (1<< ONIGENC_CTYPE_UPPER)
90
- #define BIT_CTYPE_XDIGIT (1<< ONIGENC_CTYPE_XDIGIT)
91
- #define BIT_CTYPE_WORD (1<< ONIGENC_CTYPE_WORD)
92
- #define BIT_CTYPE_ALNUM (1<< ONIGENC_CTYPE_ALNUM)
93
- #define BIT_CTYPE_ASCII (1<< ONIGENC_CTYPE_ASCII)
94
-
95
- #define CTYPE_TO_BIT(ctype) (1<<(ctype))
96
- #define CTYPE_IS_WORD_GRAPH_PRINT(ctype) \
97
- ((ctype) == ONIGENC_CTYPE_WORD || (ctype) == ONIGENC_CTYPE_GRAPH ||\
98
- (ctype) == ONIGENC_CTYPE_PRINT)
99
-
100
-
101
- typedef struct {
102
- const UChar *name;
103
- int ctype;
104
- short int len;
105
- } PosixBracketEntryType;
106
-
107
- #define PosixBracketEntryInit(name, ctype) {(const UChar *)name, ctype, (short int)(sizeof(name) - 1)}
108
-
109
- #define USE_CRNL_AS_LINE_TERMINATOR
110
- #define USE_UNICODE_PROPERTIES
111
- /* #define USE_UNICODE_CASE_FOLD_TURKISH_AZERI */
112
- /* #define USE_UNICODE_ALL_LINE_TERMINATORS */ /* see Unicode.org UTS #18 */
113
-
114
-
115
- #define ONIG_ENCODING_INIT_DEFAULT ONIG_ENCODING_ASCII
116
-
117
- /* for encoding system implementation (internal) */
118
- ONIG_EXTERN int onigenc_ascii_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg, OnigEncoding enc));
119
- ONIG_EXTERN int onigenc_ascii_get_case_fold_codes_by_str P_((OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[], OnigEncoding enc));
120
- ONIG_EXTERN int onigenc_apply_all_case_fold_with_map P_((int map_size, const OnigPairCaseFoldCodes map[], int ess_tsett_flag, OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg));
121
- ONIG_EXTERN int onigenc_get_case_fold_codes_by_str_with_map P_((int map_size, const OnigPairCaseFoldCodes map[], int ess_tsett_flag, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]));
122
- ONIG_EXTERN int onigenc_not_support_get_ctype_code_range P_((OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[], OnigEncoding enc));
123
- ONIG_EXTERN int onigenc_is_mbc_newline_0x0a P_((const UChar* p, const UChar* end, OnigEncoding enc));
124
-
125
-
126
- /* methods for single byte encoding */
127
- ONIG_EXTERN int onigenc_ascii_mbc_case_fold P_((OnigCaseFoldType flag, const UChar** p, const UChar* end, UChar* lower, OnigEncoding enc));
128
- ONIG_EXTERN int onigenc_single_byte_mbc_enc_len P_((const UChar* p, const UChar* e, OnigEncoding enc));
129
- ONIG_EXTERN OnigCodePoint onigenc_single_byte_mbc_to_code P_((const UChar* p, const UChar* end, OnigEncoding enc));
130
- ONIG_EXTERN int onigenc_single_byte_code_to_mbclen P_((OnigCodePoint code, OnigEncoding enc));
131
- ONIG_EXTERN int onigenc_single_byte_code_to_mbc P_((OnigCodePoint code, UChar *buf, OnigEncoding enc));
132
- ONIG_EXTERN UChar* onigenc_single_byte_left_adjust_char_head P_((const UChar* start, const UChar* s, const OnigUChar* end, OnigEncoding enc));
133
- ONIG_EXTERN int onigenc_always_true_is_allowed_reverse_match P_((const UChar* s, const UChar* end, OnigEncoding enc));
134
- ONIG_EXTERN int onigenc_always_false_is_allowed_reverse_match P_((const UChar* s, const UChar* end, OnigEncoding enc));
135
- ONIG_EXTERN int onigenc_ascii_is_code_ctype P_((OnigCodePoint code, unsigned int ctype, OnigEncoding enc));
136
-
137
- /* methods for multi byte encoding */
138
- ONIG_EXTERN OnigCodePoint onigenc_mbn_mbc_to_code P_((OnigEncoding enc, const UChar* p, const UChar* end));
139
- ONIG_EXTERN int onigenc_mbn_mbc_case_fold P_((OnigEncoding enc, OnigCaseFoldType flag, const UChar** p, const UChar* end, UChar* lower));
140
- ONIG_EXTERN int onigenc_mb2_code_to_mbclen P_((OnigCodePoint code, OnigEncoding enc));
141
- ONIG_EXTERN int onigenc_mb2_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
142
- ONIG_EXTERN int onigenc_minimum_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end));
143
- ONIG_EXTERN int onigenc_unicode_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end));
144
- ONIG_EXTERN int onigenc_mb2_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));
145
- ONIG_EXTERN int onigenc_mb4_code_to_mbclen P_((OnigCodePoint code, OnigEncoding enc));
146
- ONIG_EXTERN int onigenc_mb4_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
147
- ONIG_EXTERN int onigenc_mb4_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));
148
-
149
-
150
- /* in enc/unicode.c */
151
- ONIG_EXTERN int onigenc_unicode_is_code_ctype P_((OnigCodePoint code, unsigned int ctype, OnigEncoding enc));
152
- ONIG_EXTERN int onigenc_utf16_32_get_ctype_code_range P_((OnigCtype ctype, OnigCodePoint *sb_out, const OnigCodePoint* ranges[], OnigEncoding enc));
153
- ONIG_EXTERN int onigenc_unicode_ctype_code_range P_((int ctype, const OnigCodePoint* ranges[]));
154
- ONIG_EXTERN int onigenc_unicode_get_case_fold_codes_by_str P_((OnigEncoding enc, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]));
155
- ONIG_EXTERN int onigenc_unicode_mbc_case_fold P_((OnigEncoding enc, OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* fold));
156
- ONIG_EXTERN int onigenc_unicode_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg, OnigEncoding enc));
157
-
158
-
159
- #define UTF16_IS_SURROGATE_FIRST(c) (((c) & 0xfc) == 0xd8)
160
- #define UTF16_IS_SURROGATE_SECOND(c) (((c) & 0xfc) == 0xdc)
161
-
162
- #define ONIGENC_ISO_8859_1_TO_LOWER_CASE(c) \
163
- OnigEncISO_8859_1_ToLowerCaseTable[c]
164
- #define ONIGENC_ISO_8859_1_TO_UPPER_CASE(c) \
165
- OnigEncISO_8859_1_ToUpperCaseTable[c]
166
-
167
- ONIG_EXTERN const UChar OnigEncISO_8859_1_ToLowerCaseTable[];
168
- ONIG_EXTERN const UChar OnigEncISO_8859_1_ToUpperCaseTable[];
169
-
170
- ONIG_EXTERN int
171
- onigenc_with_ascii_strncmp P_((OnigEncoding enc, const UChar* p, const UChar* end, const UChar* sascii /* ascii */, int n));
172
- ONIG_EXTERN int
173
- onigenc_with_ascii_strnicmp P_((OnigEncoding enc, const UChar* p, const UChar* end, const UChar* sascii /* ascii */, int n));
174
- ONIG_EXTERN UChar*
175
- onigenc_step P_((OnigEncoding enc, const UChar* p, const UChar* end, int n));
176
-
177
- /* defined in regexec.c, but used in enc/xxx.c */
178
- extern int onig_is_in_code_range P_((const UChar* p, OnigCodePoint code));
179
-
180
- ONIG_EXTERN OnigEncoding OnigEncDefaultCharEncoding;
181
- ONIG_EXTERN const UChar OnigEncAsciiToLowerCaseTable[];
182
- ONIG_EXTERN const UChar OnigEncAsciiToUpperCaseTable[];
183
- ONIG_EXTERN const unsigned short OnigEncAsciiCtypeTable[];
184
-
185
- #define ONIGENC_IS_ASCII_CODE(code) ((code) < 0x80)
186
- #define ONIGENC_ASCII_CODE_TO_LOWER_CASE(c) OnigEncAsciiToLowerCaseTable[c]
187
- #define ONIGENC_ASCII_CODE_TO_UPPER_CASE(c) OnigEncAsciiToUpperCaseTable[c]
188
- #define ONIGENC_IS_ASCII_CODE_CTYPE(code,ctype) \
189
- ((OnigEncAsciiCtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
190
- #define ONIGENC_IS_ASCII_CODE_CASE_AMBIG(code) \
191
- (ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_UPPER) ||\
192
- ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_LOWER))
193
-
194
- /* Check if the code is in the range. (from <= code && code <= to) */
195
- #define ONIGENC_IS_IN_RANGE(code, from, to) \
196
- ((OnigCodePoint )((code) - (from)) <= (OnigCodePoint )((to) - (from)))
197
-
198
-
199
- #ifdef ONIG_ENC_REGISTER
200
- extern int ONIG_ENC_REGISTER(const char *, OnigEncodingType*);
201
- #define OnigEncodingName(n) encoding_##n
202
- #define OnigEncodingDeclare(n) static OnigEncodingType OnigEncodingName(n)
203
- #define OnigEncodingDefine(f,n) \
204
- OnigEncodingDeclare(n); \
205
- void Init_##f(void) { \
206
- ONIG_ENC_REGISTER(OnigEncodingName(n).name, \
207
- &OnigEncodingName(n)); \
208
- } \
209
- OnigEncodingDeclare(n)
210
- #else
211
- #define OnigEncodingName(n) OnigEncoding##n
212
- #define OnigEncodingDeclare(n) OnigEncodingType OnigEncodingName(n)
213
- #define OnigEncodingDefine(f,n) OnigEncodingDeclare(n)
214
- #endif
215
-
216
- /* macros for define replica encoding and encoding alias */
217
- #define ENC_REPLICATE(name, orig)
218
- #define ENC_ALIAS(name, orig)
219
- #define ENC_DUMMY(name)
220
-
221
- RUBY_SYMBOL_EXPORT_END
222
-
223
- #endif /* ONIGURUMA_REGENC_H */
@@ -1,911 +0,0 @@
1
- #ifndef ONIGURUMA_REGINT_H
2
- #define ONIGURUMA_REGINT_H
3
- /**********************************************************************
4
- regint.h - Onigmo (Oniguruma-mod) (regular expression library)
5
- **********************************************************************/
6
- /*-
7
- * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
8
- * Copyright (c) 2011-2012 K.Takata <kentkt AT csc DOT jp>
9
- * All rights reserved.
10
- *
11
- * Redistribution and use in source and binary forms, with or without
12
- * modification, are permitted provided that the following conditions
13
- * are met:
14
- * 1. Redistributions of source code must retain the above copyright
15
- * notice, this list of conditions and the following disclaimer.
16
- * 2. Redistributions in binary form must reproduce the above copyright
17
- * notice, this list of conditions and the following disclaimer in the
18
- * documentation and/or other materials provided with the distribution.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30
- * SUCH DAMAGE.
31
- */
32
-
33
- /* for debug */
34
- /* #define ONIG_DEBUG_PARSE_TREE */
35
- /* #define ONIG_DEBUG_COMPILE */
36
- /* #define ONIG_DEBUG_SEARCH */
37
- /* #define ONIG_DEBUG_MATCH */
38
- /* #define ONIG_DONT_OPTIMIZE */
39
-
40
- /* for byte-code statistical data. */
41
- /* #define ONIG_DEBUG_STATISTICS */
42
-
43
- #if defined(ONIG_DEBUG_PARSE_TREE) || defined(ONIG_DEBUG_MATCH) || \
44
- defined(ONIG_DEBUG_SEARCH) || defined(ONIG_DEBUG_COMPILE) || \
45
- defined(ONIG_DEBUG_STATISTICS)
46
- #ifndef ONIG_DEBUG
47
- #define ONIG_DEBUG
48
- #endif
49
- #endif
50
-
51
- #if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
52
- defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \
53
- defined(__mc68020__)
54
- #define PLATFORM_UNALIGNED_WORD_ACCESS
55
- #endif
56
-
57
- /* config */
58
- /* spec. config */
59
- #define USE_NAMED_GROUP
60
- #define USE_SUBEXP_CALL
61
- #define USE_PERL_SUBEXP_CALL
62
- #define USE_CAPITAL_P_NAMED_GROUP
63
- #define USE_BACKREF_WITH_LEVEL /* \k<name+n>, \k<name-n> */
64
- #define USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT /* /(?:()|())*\2/ */
65
- #define USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE /* /\n$/ =~ "\n" */
66
- #define USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR
67
- /* #define USE_RECOMPILE_API */
68
- /* !!! moved to regenc.h. */ /* #define USE_CRNL_AS_LINE_TERMINATOR */
69
- #define USE_NO_INVALID_QUANTIFIER
70
-
71
- /* internal config */
72
- #define USE_PARSE_TREE_NODE_RECYCLE
73
- #define USE_OP_PUSH_OR_JUMP_EXACT
74
- #define USE_QTFR_PEEK_NEXT
75
- #define USE_ST_LIBRARY
76
- #define USE_SHARED_CCLASS_TABLE
77
- #define USE_SUNDAY_QUICK_SEARCH
78
-
79
- #define INIT_MATCH_STACK_SIZE 160
80
- #define DEFAULT_MATCH_STACK_LIMIT_SIZE 0 /* unlimited */
81
-
82
- /* check config */
83
- #if defined(USE_PERL_SUBEXP_CALL) || defined(USE_CAPITAL_P_NAMED_GROUP)
84
- #if !defined(USE_NAMED_GROUP) || !defined(USE_SUBEXP_CALL)
85
- #error USE_NAMED_GROUP and USE_SUBEXP_CALL must be defined.
86
- #endif
87
- #endif
88
-
89
- #if defined(__GNUC__)
90
- # define ARG_UNUSED __attribute__ ((unused))
91
- #else
92
- # define ARG_UNUSED
93
- #endif
94
-
95
- /* */
96
- /* escape other system UChar definition */
97
- #ifndef RUBY_DEFINES_H
98
- #include "ruby/ruby.h"
99
- #undef xmalloc
100
- #undef xrealloc
101
- #undef xcalloc
102
- #undef xfree
103
- #endif
104
- #ifdef ONIG_ESCAPE_UCHAR_COLLISION
105
- #undef ONIG_ESCAPE_UCHAR_COLLISION
106
- #endif
107
- #define USE_WORD_BEGIN_END /* "\<": word-begin, "\>": word-end */
108
- #undef USE_MATCH_RANGE_IS_COMPLETE_RANGE
109
- #undef USE_CAPTURE_HISTORY
110
- #define USE_VARIABLE_META_CHARS
111
- #define USE_POSIX_API_REGION_OPTION /* needed for POSIX API support */
112
- #define USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
113
- /* #define USE_COMBINATION_EXPLOSION_CHECK */ /* (X*)* */
114
-
115
- /* #define USE_MULTI_THREAD_SYSTEM */
116
- #define THREAD_SYSTEM_INIT /* depend on thread system */
117
- #define THREAD_SYSTEM_END /* depend on thread system */
118
- #define THREAD_ATOMIC_START /* depend on thread system */
119
- #define THREAD_ATOMIC_END /* depend on thread system */
120
- #define THREAD_PASS /* depend on thread system */
121
- #ifndef xmalloc
122
- #define xmalloc malloc
123
- #define xrealloc realloc
124
- #define xcalloc calloc
125
- #define xfree free
126
- #endif
127
-
128
- #ifdef RUBY
129
-
130
- #define CHECK_INTERRUPT_IN_MATCH_AT rb_thread_check_ints()
131
- #define onig_st_init_table st_init_table
132
- #define onig_st_init_table_with_size st_init_table_with_size
133
- #define onig_st_init_numtable st_init_numtable
134
- #define onig_st_init_numtable_with_size st_init_numtable_with_size
135
- #define onig_st_init_strtable st_init_strtable
136
- #define onig_st_init_strtable_with_size st_init_strtable_with_size
137
- #define onig_st_delete st_delete
138
- #define onig_st_delete_safe st_delete_safe
139
- #define onig_st_insert st_insert
140
- #define onig_st_lookup st_lookup
141
- #define onig_st_foreach st_foreach
142
- #define onig_st_add_direct st_add_direct
143
- #define onig_st_free_table st_free_table
144
- #define onig_st_cleanup_safe st_cleanup_safe
145
- #define onig_st_copy st_copy
146
- #define onig_st_nothing_key_clone st_nothing_key_clone
147
- #define onig_st_nothing_key_free st_nothing_key_free
148
- #define onig_st_is_member st_is_member
149
-
150
- #define USE_UPPER_CASE_TABLE
151
- #else
152
-
153
- #define st_init_table onig_st_init_table
154
- #define st_init_table_with_size onig_st_init_table_with_size
155
- #define st_init_numtable onig_st_init_numtable
156
- #define st_init_numtable_with_size onig_st_init_numtable_with_size
157
- #define st_init_strtable onig_st_init_strtable
158
- #define st_init_strtable_with_size onig_st_init_strtable_with_size
159
- #define st_delete onig_st_delete
160
- #define st_delete_safe onig_st_delete_safe
161
- #define st_insert onig_st_insert
162
- #define st_lookup onig_st_lookup
163
- #define st_foreach onig_st_foreach
164
- #define st_add_direct onig_st_add_direct
165
- #define st_free_table onig_st_free_table
166
- #define st_cleanup_safe onig_st_cleanup_safe
167
- #define st_copy onig_st_copy
168
- #define st_nothing_key_clone onig_st_nothing_key_clone
169
- #define st_nothing_key_free onig_st_nothing_key_free
170
- /* */
171
- #define onig_st_is_member st_is_member
172
-
173
- #define CHECK_INTERRUPT_IN_MATCH_AT
174
-
175
- #endif
176
-
177
- #define STATE_CHECK_STRING_THRESHOLD_LEN 7
178
- #define STATE_CHECK_BUFF_MAX_SIZE 0x4000
179
-
180
- #define THREAD_PASS_LIMIT_COUNT 8
181
- #define xmemset memset
182
- #define xmemcpy memcpy
183
- #define xmemmove memmove
184
-
185
- #if defined(_WIN32) && !defined(__GNUC__)
186
- #define xalloca _alloca
187
- #define xvsnprintf _vsnprintf
188
- #else
189
- #define xalloca alloca
190
- #define xvsnprintf vsnprintf
191
- #endif
192
-
193
-
194
- #if defined(USE_RECOMPILE_API) && defined(USE_MULTI_THREAD_SYSTEM)
195
- #define ONIG_STATE_INC(reg) (reg)->state++
196
- #define ONIG_STATE_DEC(reg) (reg)->state--
197
-
198
- #define ONIG_STATE_INC_THREAD(reg) do {\
199
- THREAD_ATOMIC_START;\
200
- (reg)->state++;\
201
- THREAD_ATOMIC_END;\
202
- } while(0)
203
- #define ONIG_STATE_DEC_THREAD(reg) do {\
204
- THREAD_ATOMIC_START;\
205
- (reg)->state--;\
206
- THREAD_ATOMIC_END;\
207
- } while(0)
208
- #else
209
- #define ONIG_STATE_INC(reg) /* Nothing */
210
- #define ONIG_STATE_DEC(reg) /* Nothing */
211
- #define ONIG_STATE_INC_THREAD(reg) /* Nothing */
212
- #define ONIG_STATE_DEC_THREAD(reg) /* Nothing */
213
- #endif /* USE_RECOMPILE_API && USE_MULTI_THREAD_SYSTEM */
214
-
215
- #ifdef HAVE_STDLIB_H
216
- #include <stdlib.h>
217
- #endif
218
-
219
- #if defined(HAVE_ALLOCA_H) && (defined(_AIX) || !defined(__GNUC__))
220
- #include <alloca.h>
221
- #endif
222
-
223
- #ifdef HAVE_STRING_H
224
- # include <string.h>
225
- #else
226
- # include <strings.h>
227
- #endif
228
-
229
- #include <ctype.h>
230
- #ifdef HAVE_SYS_TYPES_H
231
- #include <sys/types.h>
232
- #endif
233
-
234
- #ifdef HAVE_STDINT_H
235
- # include <stdint.h>
236
- #endif
237
-
238
- #ifdef STDC_HEADERS
239
- # include <stddef.h>
240
- #endif
241
-
242
- #ifdef __BORLANDC__
243
- #include <malloc.h>
244
- #endif
245
-
246
- #ifdef ONIG_DEBUG
247
- # include <stdio.h>
248
- #endif
249
-
250
- #ifdef _WIN32
251
- #if defined(_MSC_VER) && (_MSC_VER < 1300)
252
- #ifndef _INTPTR_T_DEFINED
253
- #define _INTPTR_T_DEFINED
254
- typedef int intptr_t;
255
- #endif
256
- #ifndef _UINTPTR_T_DEFINED
257
- #define _UINTPTR_T_DEFINED
258
- typedef unsigned int uintptr_t;
259
- #endif
260
- #endif
261
- #endif /* _WIN32 */
262
-
263
- #include "regenc.h"
264
-
265
- RUBY_SYMBOL_EXPORT_BEGIN
266
-
267
- #ifdef MIN
268
- #undef MIN
269
- #endif
270
- #ifdef MAX
271
- #undef MAX
272
- #endif
273
- #define MIN(a,b) (((a)>(b))?(b):(a))
274
- #define MAX(a,b) (((a)<(b))?(b):(a))
275
-
276
- #define IS_NULL(p) (((void*)(p)) == (void*)0)
277
- #define IS_NOT_NULL(p) (((void*)(p)) != (void*)0)
278
- #define CHECK_NULL_RETURN(p) if (IS_NULL(p)) return NULL
279
- #define CHECK_NULL_RETURN_MEMERR(p) if (IS_NULL(p)) return ONIGERR_MEMORY
280
- #define NULL_UCHARP ((UChar* )0)
281
-
282
- #define ONIG_LAST_CODE_POINT (~((OnigCodePoint )0))
283
-
284
- #ifdef PLATFORM_UNALIGNED_WORD_ACCESS
285
-
286
- #define PLATFORM_GET_INC(val,p,type) do{\
287
- val = *(type* )p;\
288
- (p) += sizeof(type);\
289
- } while(0)
290
-
291
- #else
292
-
293
- #define PLATFORM_GET_INC(val,p,type) do{\
294
- xmemcpy(&val, (p), sizeof(type));\
295
- (p) += sizeof(type);\
296
- } while(0)
297
-
298
- /* sizeof(OnigCodePoint) */
299
- #define WORD_ALIGNMENT_SIZE SIZEOF_LONG
300
-
301
- #define GET_ALIGNMENT_PAD_SIZE(addr,pad_size) do {\
302
- (pad_size) = WORD_ALIGNMENT_SIZE \
303
- - ((uintptr_t )(addr) % WORD_ALIGNMENT_SIZE);\
304
- if ((pad_size) == WORD_ALIGNMENT_SIZE) (pad_size) = 0;\
305
- } while (0)
306
-
307
- #define ALIGNMENT_RIGHT(addr) do {\
308
- (addr) += (WORD_ALIGNMENT_SIZE - 1);\
309
- (addr) -= ((uintptr_t )(addr) % WORD_ALIGNMENT_SIZE);\
310
- } while (0)
311
-
312
- #endif /* PLATFORM_UNALIGNED_WORD_ACCESS */
313
-
314
- /* stack pop level */
315
- #define STACK_POP_LEVEL_FREE 0
316
- #define STACK_POP_LEVEL_MEM_START 1
317
- #define STACK_POP_LEVEL_ALL 2
318
-
319
- /* optimize flags */
320
- #define ONIG_OPTIMIZE_NONE 0
321
- #define ONIG_OPTIMIZE_EXACT 1 /* Slow Search */
322
- #define ONIG_OPTIMIZE_EXACT_BM 2 /* Boyer Moore Search */
323
- #define ONIG_OPTIMIZE_EXACT_BM_NOT_REV 3 /* BM (applied to a multibyte string) */
324
- #define ONIG_OPTIMIZE_EXACT_IC 4 /* Slow Search (ignore case) */
325
- #define ONIG_OPTIMIZE_MAP 5 /* char map */
326
- #define ONIG_OPTIMIZE_EXACT_BM_IC 6 /* BM (ignore case) */
327
- #define ONIG_OPTIMIZE_EXACT_BM_NOT_REV_IC 7 /* BM (applied to a multibyte string) (ignore case) */
328
-
329
- /* bit status */
330
- typedef unsigned int BitStatusType;
331
-
332
- #define BIT_STATUS_BITS_NUM (sizeof(BitStatusType) * 8)
333
- #define BIT_STATUS_CLEAR(stats) (stats) = 0
334
- #define BIT_STATUS_ON_ALL(stats) (stats) = ~((BitStatusType )0)
335
- #define BIT_STATUS_AT(stats,n) \
336
- ((n) < (int )BIT_STATUS_BITS_NUM ? ((stats) & (1 << n)) : ((stats) & 1))
337
-
338
- #define BIT_STATUS_ON_AT(stats,n) do {\
339
- if ((n) < (int )BIT_STATUS_BITS_NUM) \
340
- (stats) |= (1 << (n));\
341
- else\
342
- (stats) |= 1;\
343
- } while (0)
344
-
345
- #define BIT_STATUS_ON_AT_SIMPLE(stats,n) do {\
346
- if ((n) < (int )BIT_STATUS_BITS_NUM)\
347
- (stats) |= (1 << (n));\
348
- } while (0)
349
-
350
-
351
- #define INT_MAX_LIMIT ((1UL << (SIZEOF_INT * 8 - 1)) - 1)
352
-
353
- #define DIGITVAL(code) ((code) - '0')
354
- #define ODIGITVAL(code) DIGITVAL(code)
355
- #define XDIGITVAL(enc,code) \
356
- (ONIGENC_IS_CODE_DIGIT(enc,code) ? DIGITVAL(code) \
357
- : (ONIGENC_IS_CODE_UPPER(enc,code) ? (code) - 'A' + 10 : (code) - 'a' + 10))
358
-
359
- #define IS_SINGLELINE(option) ((option) & ONIG_OPTION_SINGLELINE)
360
- #define IS_MULTILINE(option) ((option) & ONIG_OPTION_MULTILINE)
361
- #define IS_IGNORECASE(option) ((option) & ONIG_OPTION_IGNORECASE)
362
- #define IS_EXTEND(option) ((option) & ONIG_OPTION_EXTEND)
363
- #define IS_FIND_LONGEST(option) ((option) & ONIG_OPTION_FIND_LONGEST)
364
- #define IS_FIND_NOT_EMPTY(option) ((option) & ONIG_OPTION_FIND_NOT_EMPTY)
365
- #define IS_FIND_CONDITION(option) ((option) & \
366
- (ONIG_OPTION_FIND_LONGEST | ONIG_OPTION_FIND_NOT_EMPTY))
367
- #define IS_NOTBOL(option) ((option) & ONIG_OPTION_NOTBOL)
368
- #define IS_NOTEOL(option) ((option) & ONIG_OPTION_NOTEOL)
369
- #define IS_POSIX_REGION(option) ((option) & ONIG_OPTION_POSIX_REGION)
370
- #define IS_ASCII_RANGE(option) ((option) & ONIG_OPTION_ASCII_RANGE)
371
- #define IS_POSIX_BRACKET_ALL_RANGE(option) ((option) & ONIG_OPTION_POSIX_BRACKET_ALL_RANGE)
372
- #define IS_WORD_BOUND_ALL_RANGE(option) ((option) & ONIG_OPTION_WORD_BOUND_ALL_RANGE)
373
- #define IS_NEWLINE_CRLF(option) ((option) & ONIG_OPTION_NEWLINE_CRLF)
374
-
375
- /* OP_SET_OPTION is required for these options.
376
- #define IS_DYNAMIC_OPTION(option) \
377
- (((option) & (ONIG_OPTION_MULTILINE | ONIG_OPTION_IGNORECASE)) != 0)
378
- */
379
- /* ignore-case and multibyte status are included in compiled code. */
380
- #define IS_DYNAMIC_OPTION(option) 0
381
-
382
- #define DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag) \
383
- ((case_fold_flag) & ~INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR)
384
-
385
- #define REPEAT_INFINITE -1
386
- #define IS_REPEAT_INFINITE(n) ((n) == REPEAT_INFINITE)
387
-
388
- /* bitset */
389
- #define BITS_PER_BYTE 8
390
- #define SINGLE_BYTE_SIZE (1 << BITS_PER_BYTE)
391
- #define BITS_IN_ROOM ((int )sizeof(Bits) * BITS_PER_BYTE)
392
- #define BITSET_SIZE (SINGLE_BYTE_SIZE / BITS_IN_ROOM)
393
-
394
- #ifdef PLATFORM_UNALIGNED_WORD_ACCESS
395
- typedef unsigned int Bits;
396
- #else
397
- typedef unsigned char Bits;
398
- #endif
399
- typedef Bits BitSet[BITSET_SIZE];
400
- typedef Bits* BitSetRef;
401
-
402
- #define SIZE_BITSET (int )sizeof(BitSet)
403
-
404
- #define BITSET_CLEAR(bs) do {\
405
- int i;\
406
- for (i = 0; i < BITSET_SIZE; i++) { (bs)[i] = 0; } \
407
- } while (0)
408
-
409
- #define BS_ROOM(bs,pos) (bs)[(int )(pos) / BITS_IN_ROOM]
410
- #define BS_BIT(pos) (1 << ((int )(pos) % BITS_IN_ROOM))
411
-
412
- #define BITSET_AT(bs, pos) (BS_ROOM(bs,pos) & BS_BIT(pos))
413
- #define BITSET_SET_BIT(bs, pos) BS_ROOM(bs,pos) |= BS_BIT(pos)
414
- #define BITSET_CLEAR_BIT(bs, pos) BS_ROOM(bs,pos) &= ~(BS_BIT(pos))
415
- #define BITSET_INVERT_BIT(bs, pos) BS_ROOM(bs,pos) ^= BS_BIT(pos)
416
-
417
- /* bytes buffer */
418
- typedef struct _BBuf {
419
- UChar* p;
420
- unsigned int used;
421
- unsigned int alloc;
422
- } BBuf;
423
-
424
- #define BBUF_INIT(buf,size) onig_bbuf_init((BBuf* )(buf), (size))
425
-
426
- #define BBUF_SIZE_INC(buf,inc) do{\
427
- (buf)->alloc += (inc);\
428
- (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
429
- if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
430
- } while (0)
431
-
432
- #define BBUF_EXPAND(buf,low) do{\
433
- do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\
434
- (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
435
- if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
436
- } while (0)
437
-
438
- #define BBUF_ENSURE_SIZE(buf,size) do{\
439
- unsigned int new_alloc = (buf)->alloc;\
440
- while (new_alloc < (unsigned int )(size)) { new_alloc *= 2; }\
441
- if ((buf)->alloc != new_alloc) {\
442
- (buf)->p = (UChar* )xrealloc((buf)->p, new_alloc);\
443
- if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
444
- (buf)->alloc = new_alloc;\
445
- }\
446
- } while (0)
447
-
448
- #define BBUF_WRITE(buf,pos,bytes,n) do{\
449
- int used = (pos) + (int )(n);\
450
- if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
451
- xmemcpy((buf)->p + (pos), (bytes), (n));\
452
- if ((buf)->used < (unsigned int )used) (buf)->used = used;\
453
- } while (0)
454
-
455
- #define BBUF_WRITE1(buf,pos,byte) do{\
456
- int used = (pos) + 1;\
457
- if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
458
- (buf)->p[(pos)] = (UChar )(byte);\
459
- if ((buf)->used < (unsigned int )used) (buf)->used = used;\
460
- } while (0)
461
-
462
- #define BBUF_ADD(buf,bytes,n) BBUF_WRITE((buf),(buf)->used,(bytes),(n))
463
- #define BBUF_ADD1(buf,byte) BBUF_WRITE1((buf),(buf)->used,(byte))
464
- #define BBUF_GET_ADD_ADDRESS(buf) ((buf)->p + (buf)->used)
465
- #define BBUF_GET_OFFSET_POS(buf) ((buf)->used)
466
-
467
- /* from < to */
468
- #define BBUF_MOVE_RIGHT(buf,from,to,n) do {\
469
- if ((unsigned int )((to)+(n)) > (buf)->alloc) BBUF_EXPAND((buf),(to) + (n));\
470
- xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
471
- if ((unsigned int )((to)+(n)) > (buf)->used) (buf)->used = (to) + (n);\
472
- } while (0)
473
-
474
- /* from > to */
475
- #define BBUF_MOVE_LEFT(buf,from,to,n) do {\
476
- xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
477
- } while (0)
478
-
479
- /* from > to */
480
- #define BBUF_MOVE_LEFT_REDUCE(buf,from,to) do {\
481
- xmemmove((buf)->p + (to), (buf)->p + (from), (buf)->used - (from));\
482
- (buf)->used -= (from - to);\
483
- } while (0)
484
-
485
- #define BBUF_INSERT(buf,pos,bytes,n) do {\
486
- if (pos >= (buf)->used) {\
487
- BBUF_WRITE(buf,pos,bytes,n);\
488
- }\
489
- else {\
490
- BBUF_MOVE_RIGHT((buf),(pos),(pos) + (n),((buf)->used - (pos)));\
491
- xmemcpy((buf)->p + (pos), (bytes), (n));\
492
- }\
493
- } while (0)
494
-
495
- #define BBUF_GET_BYTE(buf, pos) (buf)->p[(pos)]
496
-
497
-
498
- #define ANCHOR_BEGIN_BUF (1<<0)
499
- #define ANCHOR_BEGIN_LINE (1<<1)
500
- #define ANCHOR_BEGIN_POSITION (1<<2)
501
- #define ANCHOR_END_BUF (1<<3)
502
- #define ANCHOR_SEMI_END_BUF (1<<4)
503
- #define ANCHOR_END_LINE (1<<5)
504
-
505
- #define ANCHOR_WORD_BOUND (1<<6)
506
- #define ANCHOR_NOT_WORD_BOUND (1<<7)
507
- #define ANCHOR_WORD_BEGIN (1<<8)
508
- #define ANCHOR_WORD_END (1<<9)
509
- #define ANCHOR_PREC_READ (1<<10)
510
- #define ANCHOR_PREC_READ_NOT (1<<11)
511
- #define ANCHOR_LOOK_BEHIND (1<<12)
512
- #define ANCHOR_LOOK_BEHIND_NOT (1<<13)
513
-
514
- #define ANCHOR_ANYCHAR_STAR (1<<14) /* ".*" optimize info */
515
- #define ANCHOR_ANYCHAR_STAR_ML (1<<15) /* ".*" optimize info (multi-line) */
516
-
517
- #define ANCHOR_KEEP (1<<16)
518
-
519
- /* operation code */
520
- enum OpCode {
521
- OP_FINISH = 0, /* matching process terminator (no more alternative) */
522
- OP_END = 1, /* pattern code terminator (success end) */
523
-
524
- OP_EXACT1 = 2, /* single byte, N = 1 */
525
- OP_EXACT2, /* single byte, N = 2 */
526
- OP_EXACT3, /* single byte, N = 3 */
527
- OP_EXACT4, /* single byte, N = 4 */
528
- OP_EXACT5, /* single byte, N = 5 */
529
- OP_EXACTN, /* single byte */
530
- OP_EXACTMB2N1, /* mb-length = 2 N = 1 */
531
- OP_EXACTMB2N2, /* mb-length = 2 N = 2 */
532
- OP_EXACTMB2N3, /* mb-length = 2 N = 3 */
533
- OP_EXACTMB2N, /* mb-length = 2 */
534
- OP_EXACTMB3N, /* mb-length = 3 */
535
- OP_EXACTMBN, /* other length */
536
-
537
- OP_EXACT1_IC, /* single byte, N = 1, ignore case */
538
- OP_EXACTN_IC, /* single byte, ignore case */
539
-
540
- OP_CCLASS,
541
- OP_CCLASS_MB,
542
- OP_CCLASS_MIX,
543
- OP_CCLASS_NOT,
544
- OP_CCLASS_MB_NOT,
545
- OP_CCLASS_MIX_NOT,
546
- OP_CCLASS_NODE, /* pointer to CClassNode node */
547
-
548
- OP_ANYCHAR, /* "." */
549
- OP_ANYCHAR_ML, /* "." multi-line */
550
- OP_ANYCHAR_STAR, /* ".*" */
551
- OP_ANYCHAR_ML_STAR, /* ".*" multi-line */
552
- OP_ANYCHAR_STAR_PEEK_NEXT,
553
- OP_ANYCHAR_ML_STAR_PEEK_NEXT,
554
-
555
- OP_WORD,
556
- OP_NOT_WORD,
557
- OP_WORD_BOUND,
558
- OP_NOT_WORD_BOUND,
559
- OP_WORD_BEGIN,
560
- OP_WORD_END,
561
-
562
- OP_ASCII_WORD,
563
- OP_NOT_ASCII_WORD,
564
- OP_ASCII_WORD_BOUND,
565
- OP_NOT_ASCII_WORD_BOUND,
566
- OP_ASCII_WORD_BEGIN,
567
- OP_ASCII_WORD_END,
568
-
569
- OP_BEGIN_BUF,
570
- OP_END_BUF,
571
- OP_BEGIN_LINE,
572
- OP_END_LINE,
573
- OP_SEMI_END_BUF,
574
- OP_BEGIN_POSITION,
575
- OP_BEGIN_POS_OR_LINE, /* used for implicit anchor optimization */
576
-
577
- OP_BACKREF1,
578
- OP_BACKREF2,
579
- OP_BACKREFN,
580
- OP_BACKREFN_IC,
581
- OP_BACKREF_MULTI,
582
- OP_BACKREF_MULTI_IC,
583
- OP_BACKREF_WITH_LEVEL, /* \k<xxx+n>, \k<xxx-n> */
584
-
585
- OP_MEMORY_START,
586
- OP_MEMORY_START_PUSH, /* push back-tracker to stack */
587
- OP_MEMORY_END_PUSH, /* push back-tracker to stack */
588
- OP_MEMORY_END_PUSH_REC, /* push back-tracker to stack */
589
- OP_MEMORY_END,
590
- OP_MEMORY_END_REC, /* push marker to stack */
591
-
592
- OP_KEEP,
593
-
594
- OP_FAIL, /* pop stack and move */
595
- OP_JUMP,
596
- OP_PUSH,
597
- OP_POP,
598
- OP_PUSH_OR_JUMP_EXACT1, /* if match exact then push, else jump. */
599
- OP_PUSH_IF_PEEK_NEXT, /* if match exact then push, else none. */
600
- OP_REPEAT, /* {n,m} */
601
- OP_REPEAT_NG, /* {n,m}? (non greedy) */
602
- OP_REPEAT_INC,
603
- OP_REPEAT_INC_NG, /* non greedy */
604
- OP_REPEAT_INC_SG, /* search and get in stack */
605
- OP_REPEAT_INC_NG_SG, /* search and get in stack (non greedy) */
606
- OP_NULL_CHECK_START, /* null loop checker start */
607
- OP_NULL_CHECK_END, /* null loop checker end */
608
- OP_NULL_CHECK_END_MEMST, /* null loop checker end (with capture status) */
609
- OP_NULL_CHECK_END_MEMST_PUSH, /* with capture status and push check-end */
610
-
611
- OP_PUSH_POS, /* (?=...) start */
612
- OP_POP_POS, /* (?=...) end */
613
- OP_PUSH_POS_NOT, /* (?!...) start */
614
- OP_FAIL_POS, /* (?!...) end */
615
- OP_PUSH_STOP_BT, /* (?>...) start */
616
- OP_POP_STOP_BT, /* (?>...) end */
617
- OP_LOOK_BEHIND, /* (?<=...) start (no needs end opcode) */
618
- OP_PUSH_LOOK_BEHIND_NOT, /* (?<!...) start */
619
- OP_FAIL_LOOK_BEHIND_NOT, /* (?<!...) end */
620
-
621
- OP_CALL, /* \g<name> */
622
- OP_RETURN,
623
-
624
- OP_CONDITION,
625
-
626
- OP_STATE_CHECK_PUSH, /* combination explosion check and push */
627
- OP_STATE_CHECK_PUSH_OR_JUMP, /* check ok -> push, else jump */
628
- OP_STATE_CHECK, /* check only */
629
- OP_STATE_CHECK_ANYCHAR_STAR,
630
- OP_STATE_CHECK_ANYCHAR_ML_STAR,
631
-
632
- /* no need: IS_DYNAMIC_OPTION() == 0 */
633
- OP_SET_OPTION_PUSH, /* set option and push recover option */
634
- OP_SET_OPTION /* set option */
635
- };
636
-
637
- typedef int RelAddrType;
638
- typedef int AbsAddrType;
639
- typedef int LengthType;
640
- typedef int RepeatNumType;
641
- typedef short int MemNumType;
642
- typedef short int StateCheckNumType;
643
- typedef void* PointerType;
644
-
645
- #define SIZE_OPCODE 1
646
- #define SIZE_RELADDR (int )sizeof(RelAddrType)
647
- #define SIZE_ABSADDR (int )sizeof(AbsAddrType)
648
- #define SIZE_LENGTH (int )sizeof(LengthType)
649
- #define SIZE_MEMNUM (int )sizeof(MemNumType)
650
- #define SIZE_STATE_CHECK_NUM (int )sizeof(StateCheckNumType)
651
- #define SIZE_REPEATNUM (int )sizeof(RepeatNumType)
652
- #define SIZE_OPTION (int )sizeof(OnigOptionType)
653
- #define SIZE_CODE_POINT (int )sizeof(OnigCodePoint)
654
- #define SIZE_POINTER (int )sizeof(PointerType)
655
-
656
-
657
- #define GET_RELADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, RelAddrType)
658
- #define GET_ABSADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, AbsAddrType)
659
- #define GET_LENGTH_INC(len,p) PLATFORM_GET_INC(len, p, LengthType)
660
- #define GET_MEMNUM_INC(num,p) PLATFORM_GET_INC(num, p, MemNumType)
661
- #define GET_REPEATNUM_INC(num,p) PLATFORM_GET_INC(num, p, RepeatNumType)
662
- #define GET_OPTION_INC(option,p) PLATFORM_GET_INC(option, p, OnigOptionType)
663
- #define GET_POINTER_INC(ptr,p) PLATFORM_GET_INC(ptr, p, PointerType)
664
- #define GET_STATE_CHECK_NUM_INC(num,p) PLATFORM_GET_INC(num, p, StateCheckNumType)
665
-
666
- /* code point's address must be aligned address. */
667
- #define GET_CODE_POINT(code,p) code = *((OnigCodePoint* )(p))
668
- #define GET_BYTE_INC(byte,p) do{\
669
- byte = *(p);\
670
- (p)++;\
671
- } while(0)
672
-
673
-
674
- /* op-code + arg size */
675
- #define SIZE_OP_ANYCHAR_STAR SIZE_OPCODE
676
- #define SIZE_OP_ANYCHAR_STAR_PEEK_NEXT (SIZE_OPCODE + 1)
677
- #define SIZE_OP_JUMP (SIZE_OPCODE + SIZE_RELADDR)
678
- #define SIZE_OP_PUSH (SIZE_OPCODE + SIZE_RELADDR)
679
- #define SIZE_OP_POP SIZE_OPCODE
680
- #define SIZE_OP_PUSH_OR_JUMP_EXACT1 (SIZE_OPCODE + SIZE_RELADDR + 1)
681
- #define SIZE_OP_PUSH_IF_PEEK_NEXT (SIZE_OPCODE + SIZE_RELADDR + 1)
682
- #define SIZE_OP_REPEAT_INC (SIZE_OPCODE + SIZE_MEMNUM)
683
- #define SIZE_OP_REPEAT_INC_NG (SIZE_OPCODE + SIZE_MEMNUM)
684
- #define SIZE_OP_PUSH_POS SIZE_OPCODE
685
- #define SIZE_OP_PUSH_POS_NOT (SIZE_OPCODE + SIZE_RELADDR)
686
- #define SIZE_OP_POP_POS SIZE_OPCODE
687
- #define SIZE_OP_FAIL_POS SIZE_OPCODE
688
- #define SIZE_OP_SET_OPTION (SIZE_OPCODE + SIZE_OPTION)
689
- #define SIZE_OP_SET_OPTION_PUSH (SIZE_OPCODE + SIZE_OPTION)
690
- #define SIZE_OP_FAIL SIZE_OPCODE
691
- #define SIZE_OP_MEMORY_START (SIZE_OPCODE + SIZE_MEMNUM)
692
- #define SIZE_OP_MEMORY_START_PUSH (SIZE_OPCODE + SIZE_MEMNUM)
693
- #define SIZE_OP_MEMORY_END_PUSH (SIZE_OPCODE + SIZE_MEMNUM)
694
- #define SIZE_OP_MEMORY_END_PUSH_REC (SIZE_OPCODE + SIZE_MEMNUM)
695
- #define SIZE_OP_MEMORY_END (SIZE_OPCODE + SIZE_MEMNUM)
696
- #define SIZE_OP_MEMORY_END_REC (SIZE_OPCODE + SIZE_MEMNUM)
697
- #define SIZE_OP_PUSH_STOP_BT SIZE_OPCODE
698
- #define SIZE_OP_POP_STOP_BT SIZE_OPCODE
699
- #define SIZE_OP_NULL_CHECK_START (SIZE_OPCODE + SIZE_MEMNUM)
700
- #define SIZE_OP_NULL_CHECK_END (SIZE_OPCODE + SIZE_MEMNUM)
701
- #define SIZE_OP_LOOK_BEHIND (SIZE_OPCODE + SIZE_LENGTH)
702
- #define SIZE_OP_PUSH_LOOK_BEHIND_NOT (SIZE_OPCODE + SIZE_RELADDR + SIZE_LENGTH)
703
- #define SIZE_OP_FAIL_LOOK_BEHIND_NOT SIZE_OPCODE
704
- #define SIZE_OP_CALL (SIZE_OPCODE + SIZE_ABSADDR)
705
- #define SIZE_OP_RETURN SIZE_OPCODE
706
- #define SIZE_OP_CONDITION (SIZE_OPCODE + SIZE_MEMNUM + SIZE_RELADDR)
707
-
708
- #ifdef USE_COMBINATION_EXPLOSION_CHECK
709
- #define SIZE_OP_STATE_CHECK (SIZE_OPCODE + SIZE_STATE_CHECK_NUM)
710
- #define SIZE_OP_STATE_CHECK_PUSH (SIZE_OPCODE + SIZE_STATE_CHECK_NUM + SIZE_RELADDR)
711
- #define SIZE_OP_STATE_CHECK_PUSH_OR_JUMP (SIZE_OPCODE + SIZE_STATE_CHECK_NUM + SIZE_RELADDR)
712
- #define SIZE_OP_STATE_CHECK_ANYCHAR_STAR (SIZE_OPCODE + SIZE_STATE_CHECK_NUM)
713
- #endif
714
-
715
- #define MC_ESC(syn) (syn)->meta_char_table.esc
716
- #define MC_ANYCHAR(syn) (syn)->meta_char_table.anychar
717
- #define MC_ANYTIME(syn) (syn)->meta_char_table.anytime
718
- #define MC_ZERO_OR_ONE_TIME(syn) (syn)->meta_char_table.zero_or_one_time
719
- #define MC_ONE_OR_MORE_TIME(syn) (syn)->meta_char_table.one_or_more_time
720
- #define MC_ANYCHAR_ANYTIME(syn) (syn)->meta_char_table.anychar_anytime
721
-
722
- #define IS_MC_ESC_CODE(code, syn) \
723
- ((code) == MC_ESC(syn) && \
724
- !IS_SYNTAX_OP2((syn), ONIG_SYN_OP2_INEFFECTIVE_ESCAPE))
725
-
726
-
727
- #define SYN_POSIX_COMMON_OP \
728
- ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_POSIX_BRACKET | \
729
- ONIG_SYN_OP_DECIMAL_BACKREF | \
730
- ONIG_SYN_OP_BRACKET_CC | ONIG_SYN_OP_ASTERISK_ZERO_INF | \
731
- ONIG_SYN_OP_LINE_ANCHOR | \
732
- ONIG_SYN_OP_ESC_CONTROL_CHARS )
733
-
734
- #define SYN_GNU_REGEX_OP \
735
- ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_BRACKET_CC | \
736
- ONIG_SYN_OP_POSIX_BRACKET | ONIG_SYN_OP_DECIMAL_BACKREF | \
737
- ONIG_SYN_OP_BRACE_INTERVAL | ONIG_SYN_OP_LPAREN_SUBEXP | \
738
- ONIG_SYN_OP_VBAR_ALT | \
739
- ONIG_SYN_OP_ASTERISK_ZERO_INF | ONIG_SYN_OP_PLUS_ONE_INF | \
740
- ONIG_SYN_OP_QMARK_ZERO_ONE | \
741
- ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR | ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR | \
742
- ONIG_SYN_OP_ESC_W_WORD | \
743
- ONIG_SYN_OP_ESC_B_WORD_BOUND | ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END | \
744
- ONIG_SYN_OP_ESC_S_WHITE_SPACE | ONIG_SYN_OP_ESC_D_DIGIT | \
745
- ONIG_SYN_OP_LINE_ANCHOR )
746
-
747
- #define SYN_GNU_REGEX_BV \
748
- ( ONIG_SYN_CONTEXT_INDEP_ANCHORS | ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS | \
749
- ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS | ONIG_SYN_ALLOW_INVALID_INTERVAL | \
750
- ONIG_SYN_BACKSLASH_ESCAPE_IN_CC | ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC )
751
-
752
-
753
- #define NCCLASS_FLAGS(cc) ((cc)->flags)
754
- #define NCCLASS_FLAG_SET(cc,flag) (NCCLASS_FLAGS(cc) |= (flag))
755
- #define NCCLASS_FLAG_CLEAR(cc,flag) (NCCLASS_FLAGS(cc) &= ~(flag))
756
- #define IS_NCCLASS_FLAG_ON(cc,flag) ((NCCLASS_FLAGS(cc) & (flag)) != 0)
757
-
758
- /* cclass node */
759
- #define FLAG_NCCLASS_NOT (1<<0)
760
- #define FLAG_NCCLASS_SHARE (1<<1)
761
-
762
- #define NCCLASS_SET_NOT(nd) NCCLASS_FLAG_SET(nd, FLAG_NCCLASS_NOT)
763
- #define NCCLASS_SET_SHARE(nd) NCCLASS_FLAG_SET(nd, FLAG_NCCLASS_SHARE)
764
- #define NCCLASS_CLEAR_NOT(nd) NCCLASS_FLAG_CLEAR(nd, FLAG_NCCLASS_NOT)
765
- #define IS_NCCLASS_NOT(nd) IS_NCCLASS_FLAG_ON(nd, FLAG_NCCLASS_NOT)
766
- #define IS_NCCLASS_SHARE(nd) IS_NCCLASS_FLAG_ON(nd, FLAG_NCCLASS_SHARE)
767
-
768
- typedef struct {
769
- int type;
770
- /* struct _Node* next; */
771
- /* unsigned int flags; */
772
- } NodeBase;
773
-
774
- typedef struct {
775
- NodeBase base;
776
- unsigned int flags;
777
- BitSet bs;
778
- BBuf* mbuf; /* multi-byte info or NULL */
779
- } CClassNode;
780
-
781
- typedef intptr_t OnigStackIndex;
782
-
783
- typedef struct _OnigStackType {
784
- unsigned int type;
785
- union {
786
- struct {
787
- UChar *pcode; /* byte code position */
788
- UChar *pstr; /* string position */
789
- UChar *pstr_prev; /* previous char position of pstr */
790
- #ifdef USE_COMBINATION_EXPLOSION_CHECK
791
- unsigned int state_check;
792
- #endif
793
- UChar *pkeep; /* keep pattern position */
794
- } state;
795
- struct {
796
- int count; /* for OP_REPEAT_INC, OP_REPEAT_INC_NG */
797
- UChar *pcode; /* byte code position (head of repeated target) */
798
- int num; /* repeat id */
799
- } repeat;
800
- struct {
801
- OnigStackIndex si; /* index of stack */
802
- } repeat_inc;
803
- struct {
804
- int num; /* memory num */
805
- UChar *pstr; /* start/end position */
806
- /* Following information is set, if this stack type is MEM-START */
807
- OnigStackIndex start; /* prev. info (for backtrack "(...)*" ) */
808
- OnigStackIndex end; /* prev. info (for backtrack "(...)*" ) */
809
- } mem;
810
- struct {
811
- int num; /* null check id */
812
- UChar *pstr; /* start position */
813
- } null_check;
814
- #ifdef USE_SUBEXP_CALL
815
- struct {
816
- UChar *ret_addr; /* byte code position */
817
- int num; /* null check id */
818
- UChar *pstr; /* string position */
819
- } call_frame;
820
- #endif
821
- } u;
822
- } OnigStackType;
823
-
824
- typedef struct {
825
- void* stack_p;
826
- size_t stack_n;
827
- OnigOptionType options;
828
- OnigRegion* region;
829
- const UChar* start; /* search start position */
830
- const UChar* gpos; /* global position (for \G: BEGIN_POSITION) */
831
- #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
832
- OnigPosition best_len; /* for ONIG_OPTION_FIND_LONGEST */
833
- UChar* best_s;
834
- #endif
835
- #ifdef USE_COMBINATION_EXPLOSION_CHECK
836
- void* state_check_buff;
837
- int state_check_buff_size;
838
- #endif
839
- } OnigMatchArg;
840
-
841
-
842
- #define IS_CODE_SB_WORD(enc,code) \
843
- (ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_WORD(enc,code))
844
-
845
- #ifdef ONIG_DEBUG
846
-
847
- typedef struct {
848
- short int opcode;
849
- const char* name;
850
- short int arg_type;
851
- } OnigOpInfoType;
852
-
853
- extern OnigOpInfoType OnigOpInfo[];
854
-
855
- /* extern void onig_print_compiled_byte_code P_((FILE* f, UChar* bp, UChar* bpend, UChar** nextp, OnigEncoding enc)); */
856
-
857
- #ifdef ONIG_DEBUG_STATISTICS
858
- extern void onig_statistics_init P_((void));
859
- extern void onig_print_statistics P_((FILE* f));
860
- #endif
861
- #endif
862
-
863
- extern UChar* onig_error_code_to_format P_((OnigPosition code));
864
- extern void onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, ...));
865
- extern int onig_bbuf_init P_((BBuf* buf, OnigDistance size));
866
- extern int onig_compile P_((regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo, const char *sourcefile, int sourceline));
867
- extern void onig_chain_reduce P_((regex_t* reg));
868
- extern void onig_chain_link_add P_((regex_t* to, regex_t* add));
869
- extern void onig_transfer P_((regex_t* to, regex_t* from));
870
- extern int onig_is_code_in_cc P_((OnigEncoding enc, OnigCodePoint code, CClassNode* cc));
871
- extern int onig_is_code_in_cc_len P_((int enclen, OnigCodePoint code, CClassNode* cc));
872
-
873
- /* strend hash */
874
- typedef void hash_table_type;
875
- #ifdef RUBY
876
- #include "ruby/st.h"
877
- typedef st_data_t hash_data_type;
878
- #else
879
- #include "st.h"
880
- typedef uintptr_t hash_data_type;
881
- #endif
882
-
883
- extern hash_table_type* onig_st_init_strend_table_with_size P_((st_index_t size));
884
- extern int onig_st_lookup_strend P_((hash_table_type* table, const UChar* str_key, const UChar* end_key, hash_data_type *value));
885
- extern int onig_st_insert_strend P_((hash_table_type* table, const UChar* str_key, const UChar* end_key, hash_data_type value));
886
-
887
- /* encoding property management */
888
- #define PROPERTY_LIST_ADD_PROP(Name, CR) \
889
- r = onigenc_property_list_add_property((UChar* )Name, CR,\
890
- &PropertyNameTable, &PropertyList, &PropertyListNum,\
891
- &PropertyListSize);\
892
- if (r != 0) goto end
893
-
894
- #define PROPERTY_LIST_INIT_CHECK \
895
- if (PropertyInited == 0) {\
896
- int r = onigenc_property_list_init(init_property_list);\
897
- if (r != 0) return r;\
898
- }
899
-
900
- extern int onigenc_property_list_add_property P_((UChar* name, const OnigCodePoint* prop, hash_table_type **table, const OnigCodePoint*** plist, int *pnum, int *psize));
901
-
902
- typedef int (*ONIGENC_INIT_PROPERTY_LIST_FUNC_TYPE)(void);
903
-
904
- extern int onigenc_property_list_init P_((ONIGENC_INIT_PROPERTY_LIST_FUNC_TYPE));
905
-
906
- extern size_t onig_memsize P_((const regex_t *reg));
907
- extern size_t onig_region_memsize P_((const struct re_registers *regs));
908
-
909
- RUBY_SYMBOL_EXPORT_END
910
-
911
- #endif /* ONIGURUMA_REGINT_H */