1 /**********************************************************************
2 
3   onigcmpt200.h - Oniguruma (regular expression library)
4 
5   Copyright (C) 2004  K.Kosako (kosako@sofnec.co.jp)
6 
7 **********************************************************************/
8 #ifndef ONIGCMPT200_H
9 #define ONIGCMPT200_H
10 
11 /* constants */
12 #define REG_MAX_ERROR_MESSAGE_LEN  ONIG_MAX_ERROR_MESSAGE_LEN
13 
14 #define RegCharEncoding           OnigEncoding
15 
16 #define REG_ENCODING_ASCII        ONIG_ENCODING_ASCII
17 #define REG_ENCODING_ISO_8859_1   ONIG_ENCODING_ISO_8859_1
18 #define REG_ENCODING_ISO_8859_15  ONIG_ENCODING_ISO_8859_15
19 #define REG_ENCODING_UTF8         ONIG_ENCODING_UTF8
20 #define REG_ENCODING_EUC_JP       ONIG_ENCODING_EUC_JP
21 #define REG_ENCODING_SJIS         ONIG_ENCODING_SJIS
22 #define REG_ENCODING_BIG5         ONIG_ENCODING_BIG5
23 #define REG_ENCODING_UNDEF        ONIG_ENCODING_UNDEF
24 
25 /* Don't use REGCODE_XXXX. (obsoleted) */
26 #define REGCODE_UNDEF         REG_ENCODING_UNDEF
27 #define REGCODE_ASCII         REG_ENCODING_ASCII
28 #define REGCODE_UTF8          REG_ENCODING_UTF8
29 #define REGCODE_EUCJP         REG_ENCODING_EUC_JP
30 #define REGCODE_SJIS          REG_ENCODING_SJIS
31 
32 /* Don't use REGCODE_XXXX. (obsoleted) */
33 #define MBCTYPE_ASCII         RE_MBCTYPE_ASCII
34 #define MBCTYPE_EUC           RE_MBCTYPE_EUC
35 #define MBCTYPE_SJIS          RE_MBCTYPE_SJIS
36 #define MBCTYPE_UTF8          RE_MBCTYPE_UTF8
37 
38 typedef unsigned char*   RegTransTableType;
39 #define RegOptionType    OnigOptionType
40 #define RegDistance      OnigDistance
41 
42 #define REG_OPTION_DEFAULT      ONIG_OPTION_DEFAULT
43 
44 /* options */
45 #define REG_OPTION_NONE                 ONIG_OPTION_NONE
46 #define REG_OPTION_SINGLELINE           ONIG_OPTION_SINGLELINE
47 #define REG_OPTION_MULTILINE            ONIG_OPTION_MULTILINE
48 #define REG_OPTION_IGNORECASE           ONIG_OPTION_IGNORECASE
49 #define REG_OPTION_EXTEND               ONIG_OPTION_EXTEND
50 #define REG_OPTION_FIND_LONGEST         ONIG_OPTION_FIND_LONGEST
51 #define REG_OPTION_FIND_NOT_EMPTY       ONIG_OPTION_FIND_NOT_EMPTY
52 #define REG_OPTION_NEGATE_SINGLELINE    ONIG_OPTION_NEGATE_SINGLELINE
53 #define REG_OPTION_DONT_CAPTURE_GROUP   ONIG_OPTION_DONT_CAPTURE_GROUP
54 #define REG_OPTION_CAPTURE_GROUP        ONIG_OPTION_CAPTURE_GROUP
55 #define REG_OPTION_NOTBOL               ONIG_OPTION_NOTBOL
56 #define REG_OPTION_NOTEOL               ONIG_OPTION_NOTEOL
57 #define REG_OPTION_POSIX_REGION         ONIG_OPTION_POSIX_REGION
58 
59 #define REG_OPTION_ON                   ONIG_OPTION_ON
60 #define REG_OPTION_OFF                  ONIG_OPTION_OFF
61 #define IS_REG_OPTION_ON                ONIG_IS_OPTION_ON
62 
63 /* syntax */
64 #define RegSyntaxType OnigSyntaxType
65 
66 #define RegSyntaxPosixBasic     OnigSyntaxPosixBasic
67 #define RegSyntaxPosixExtended  OnigSyntaxPosixExtended
68 #define RegSyntaxEmacs          OnigSyntaxEmacs
69 #define RegSyntaxGrep           OnigSyntaxGrep
70 #define RegSyntaxGnuRegex       OnigSyntaxGnuRegex
71 #define RegSyntaxJava           OnigSyntaxJava
72 #define RegSyntaxPerl           OnigSyntaxPerl
73 #define RegSyntaxRuby           OnigSyntaxRuby
74 
75 #define REG_SYNTAX_POSIX_BASIC     ONIG_SYNTAX_POSIX_BASIC
76 #define REG_SYNTAX_POSIX_EXTENDED  ONIG_SYNTAX_POSIX_EXTENDED
77 #define REG_SYNTAX_EMACS           ONIG_SYNTAX_EMACS
78 #define REG_SYNTAX_GREP            ONIG_SYNTAX_GREP
79 #define REG_SYNTAX_GNU_REGEX       ONIG_SYNTAX_GNU_REGEX
80 #define REG_SYNTAX_JAVA            ONIG_SYNTAX_JAVA
81 #define REG_SYNTAX_PERL            ONIG_SYNTAX_PERL
82 #define REG_SYNTAX_RUBY            ONIG_SYNTAX_RUBY
83 
84 #define REG_SYNTAX_DEFAULT         ONIG_SYNTAX_DEFAULT
85 #define RegDefaultSyntax           OnigDefaultSyntax
86 
87 /* syntax (operators) */
88 #define REG_SYN_OP_VARIABLE_META_CHARACTERS \
89        ONIG_SYN_OP_VARIABLE_META_CHARACTERS
90 #define REG_SYN_OP_DOT_ANYCHAR \
91        ONIG_SYN_OP_DOT_ANYCHAR
92 #define REG_SYN_OP_ASTERISK_ZERO_INF \
93        ONIG_SYN_OP_ASTERISK_ZERO_INF
94 #define REG_SYN_OP_ESC_ASTERISK_ZERO_INF \
95        ONIG_SYN_OP_ESC_ASTERISK_ZERO_INF
96 #define REG_SYN_OP_PLUS_ONE_INF \
97        ONIG_SYN_OP_PLUS_ONE_INF
98 #define REG_SYN_OP_ESC_PLUS_ONE_INF \
99        ONIG_SYN_OP_ESC_PLUS_ONE_INF
100 #define REG_SYN_OP_QMARK_ZERO_ONE \
101        ONIG_SYN_OP_QMARK_ZERO_ONE
102 #define REG_SYN_OP_ESC_QMARK_ZERO_ONE \
103        ONIG_SYN_OP_ESC_QMARK_ZERO_ONE
104 #define REG_SYN_OP_BRACE_INTERVAL \
105        ONIG_SYN_OP_BRACE_INTERVAL
106 #define REG_SYN_OP_ESC_BRACE_INTERVAL \
107        ONIG_SYN_OP_ESC_BRACE_INTERVAL
108 #define REG_SYN_OP_VBAR_ALT \
109        ONIG_SYN_OP_VBAR_ALT
110 #define REG_SYN_OP_ESC_VBAR_ALT \
111        ONIG_SYN_OP_ESC_VBAR_ALT
112 #define REG_SYN_OP_LPAREN_SUBEXP \
113        ONIG_SYN_OP_LPAREN_SUBEXP
114 #define REG_SYN_OP_ESC_LPAREN_SUBEXP \
115        ONIG_SYN_OP_ESC_LPAREN_SUBEXP
116 #define REG_SYN_OP_ESC_AZ_BUF_ANCHOR \
117        ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR
118 #define REG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR \
119        ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR
120 #define REG_SYN_OP_DECIMAL_BACKREF \
121        ONIG_SYN_OP_DECIMAL_BACKREF
122 #define REG_SYN_OP_BRACKET_CC \
123        ONIG_SYN_OP_BRACKET_CC
124 #define REG_SYN_OP_ESC_W_WORD \
125        ONIG_SYN_OP_ESC_W_WORD
126 #define REG_SYN_OP_ESC_LTGT_WORD_BEGIN_END \
127        ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END
128 #define REG_SYN_OP_ESC_B_WORD_BOUND \
129        ONIG_SYN_OP_ESC_B_WORD_BOUND
130 #define REG_SYN_OP_ESC_S_WHITE_SPACE \
131        ONIG_SYN_OP_ESC_S_WHITE_SPACE
132 #define REG_SYN_OP_ESC_D_DIGIT \
133        ONIG_SYN_OP_ESC_D_DIGIT
134 #define REG_SYN_OP_LINE_ANCHOR \
135        ONIG_SYN_OP_LINE_ANCHOR
136 #define REG_SYN_OP_POSIX_BRACKET \
137        ONIG_SYN_OP_POSIX_BRACKET
138 #define REG_SYN_OP_QMARK_NON_GREEDY \
139        ONIG_SYN_OP_QMARK_NON_GREEDY
140 #define REG_SYN_OP_ESC_CONTROL_CHARS \
141        ONIG_SYN_OP_ESC_CONTROL_CHARS
142 #define REG_SYN_OP_ESC_C_CONTROL \
143        ONIG_SYN_OP_ESC_C_CONTROL
144 #define REG_SYN_OP_ESC_OCTAL3 \
145        ONIG_SYN_OP_ESC_OCTAL3
146 #define REG_SYN_OP_ESC_X_HEX2 \
147        ONIG_SYN_OP_ESC_X_HEX2
148 #define REG_SYN_OP_ESC_X_BRACE_HEX8 \
149        ONIG_SYN_OP_ESC_X_BRACE_HEX8
150 
151 #define REG_SYN_OP2_ESC_CAPITAL_Q_QUOTE \
152        ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE
153 #define REG_SYN_OP2_QMARK_GROUP_EFFECT \
154        ONIG_SYN_OP2_QMARK_GROUP_EFFECT
155 #define REG_SYN_OP2_OPTION_PERL \
156        ONIG_SYN_OP2_OPTION_PERL
157 #define REG_SYN_OP2_OPTION_RUBY \
158        ONIG_SYN_OP2_OPTION_RUBY
159 #define REG_SYN_OP2_PLUS_POSSESSIVE_REPEAT \
160        ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT
161 #define REG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL \
162        ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL
163 #define REG_SYN_OP2_CCLASS_SET_OP \
164        ONIG_SYN_OP2_CCLASS_SET_OP
165 #define REG_SYN_OP2_QMARK_LT_NAMED_GROUP \
166        ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP
167 #define REG_SYN_OP2_ESC_K_NAMED_BACKREF \
168        ONIG_SYN_OP2_ESC_K_NAMED_BACKREF
169 #define REG_SYN_OP2_ESC_G_SUBEXP_CALL \
170        ONIG_SYN_OP2_ESC_G_SUBEXP_CALL
171 #define REG_SYN_OP2_ATMARK_CAPTURE_HISTORY \
172        ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY
173 #define REG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL \
174        ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL
175 #define REG_SYN_OP2_ESC_CAPITAL_M_BAR_META \
176        ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META
177 #define REG_SYN_OP2_ESC_V_VTAB \
178        ONIG_SYN_OP2_ESC_V_VTAB
179 #define REG_SYN_OP2_ESC_U_HEX4 \
180        ONIG_SYN_OP2_ESC_U_HEX4
181 #define REG_SYN_OP2_ESC_GNU_BUF_ANCHOR \
182        ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR
183 
184 #define REG_SYN_CONTEXT_INDEP_ANCHORS \
185        ONIG_SYN_CONTEXT_INDEP_ANCHORS
186 #define REG_SYN_CONTEXT_INDEP_REPEAT_OPS \
187        ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS
188 #define REG_SYN_CONTEXT_INVALID_REPEAT_OPS \
189        ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS
190 #define REG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP \
191        ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP
192 #define REG_SYN_ALLOW_INVALID_INTERVAL \
193        ONIG_SYN_ALLOW_INVALID_INTERVAL
194 #define REG_SYN_STRICT_CHECK_BACKREF \
195        ONIG_SYN_STRICT_CHECK_BACKREF
196 #define REG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND \
197        ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND
198 #define REG_SYN_CAPTURE_ONLY_NAMED_GROUP \
199        ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP
200 #define REG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME \
201        ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME
202 
203 #define REG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC \
204        ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC
205 #define REG_SYN_BACKSLASH_ESCAPE_IN_CC \
206        ONIG_SYN_BACKSLASH_ESCAPE_IN_CC
207 #define REG_SYN_ALLOW_EMPTY_RANGE_IN_CC \
208        ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC
209 #define REG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC \
210        ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC
211 #define REG_SYN_WARN_CC_OP_NOT_ESCAPED \
212        ONIG_SYN_WARN_CC_OP_NOT_ESCAPED
213 #define REG_SYN_WARN_REDUNDANT_NESTED_REPEAT \
214        ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT
215 
216 /* meta character specifiers (regex_set_meta_char()) */
217 #define REG_META_CHAR_ESCAPE            ONIG_META_CHAR_ESCAPE
218 #define REG_META_CHAR_ANYCHAR           ONIG_META_CHAR_ANYCHAR
219 #define REG_META_CHAR_ANYTIME           ONIG_META_CHAR_ANYTIME
220 #define REG_META_CHAR_ZERO_OR_ONE_TIME  ONIG_META_CHAR_ZERO_OR_ONE_TIME
221 #define REG_META_CHAR_ONE_OR_MORE_TIME  ONIG_META_CHAR_ONE_OR_MORE_TIME
222 #define REG_META_CHAR_ANYCHAR_ANYTIME   ONIG_META_CHAR_ANYCHAR_ANYTIME
223 
224 #define REG_INEFFECTIVE_META_CHAR       ONIG_INEFFECTIVE_META_CHAR
225 
226 /* error codes */
227 #define REG_IS_PATTERN_ERROR  ONIG_IS_PATTERN_ERROR
228 /* normal return */
229 #define REG_NORMAL               ONIG_NORMAL
230 #define REG_MISMATCH             ONIG_MISMATCH
231 #define REG_NO_SUPPORT_CONFIG    ONIG_NO_SUPPORT_CONFIG
232 /* internal error */
233 #define REGERR_MEMORY                    ONIGERR_MEMORY
234 #define REGERR_MATCH_STACK_LIMIT_OVER    ONIGERR_MATCH_STACK_LIMIT_OVER
235 #define REGERR_TYPE_BUG                  ONIGERR_TYPE_BUG
236 #define REGERR_PARSER_BUG                ONIGERR_PARSER_BUG
237 #define REGERR_STACK_BUG                 ONIGERR_STACK_BUG
238 #define REGERR_UNDEFINED_BYTECODE        ONIGERR_UNDEFINED_BYTECODE
239 #define REGERR_UNEXPECTED_BYTECODE       ONIGERR_UNEXPECTED_BYTECODE
240 #define REGERR_DEFAULT_ENCODING_IS_NOT_SETTED \
241        ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED
242 #define REGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR \
243        ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR
244 /* general error */
245 #define REGERR_INVALID_ARGUMENT     ONIGERR_INVALID_ARGUMENT
246 /* errors related to thread */
247 #define REGERR_OVER_THREAD_PASS_LIMIT_COUNT \
248        ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT
249 
250 
251 /* must be smaller than BIT_STATUS_BITS_NUM (unsigned int * 8) */
252 #define REG_MAX_CAPTURE_HISTORY_GROUP      ONIG_MAX_CAPTURE_HISTORY_GROUP
253 #define REG_IS_CAPTURE_HISTORY_GROUP       ONIG_IS_CAPTURE_HISTORY_GROUP
254 
255 #define REG_REGION_NOTPOS      ONIG_REGION_NOTPOS
256 
257 #define RegRegion        OnigRegion
258 #define RegErrorInfo     OnigErrorInfo
259 #define RegRepeatRange   OnigRepeatRange
260 
261 #define RegWarnFunc      OnigWarnFunc
262 #define regex_null_warn  onig_null_warn
263 #define REG_NULL_WARN    ONIG_NULL_WARN
264 
265 /* regex_t state */
266 #define REG_STATE_NORMAL      ONIG_STATE_NORMAL
267 #define REG_STATE_SEARCHING   ONIG_STATE_SEARCHING
268 #define REG_STATE_COMPILING   ONIG_STATE_COMPILING
269 #define REG_STATE_MODIFY      ONIG_STATE_MODIFY
270 
271 #define REG_STATE     ONIG_STATE
272 
273 /* Oniguruma Native API */
274 #define regex_init                   onig_init
275 #define regex_error_code_to_str      onig_error_code_to_str
276 #define regex_set_warn_func          onig_set_warn_func
277 #define regex_set_verb_warn_func     onig_set_verb_warn_func
278 #define regex_new                    onig_new
279 #define regex_free                   onig_free
280 #define regex_recompile              onig_recompile
281 #define regex_search                 onig_search
282 #define regex_match                  onig_match
283 #define regex_region_new             onig_region_new
284 #define regex_region_free            onig_region_free
285 #define regex_region_copy            onig_region_copy
286 #define regex_region_clear           onig_region_clear
287 #define regex_region_resize          onig_region_resize
288 #define regex_name_to_group_numbers  onig_name_to_group_numbers
289 #define regex_name_to_backref_number onig_name_to_backref_number
290 #define regex_foreach_name           onig_foreach_name
291 #define regex_number_of_names        onig_number_of_names
292 #define regex_get_encoding           onig_get_encoding
293 #define regex_get_options            onig_get_options
294 #define regex_get_syntax             onig_get_syntax
295 #define regex_set_default_syntax     onig_set_default_syntax
296 #define regex_copy_syntax            onig_copy_syntax
297 #define regex_set_meta_char          onig_set_meta_char
298 #define regex_end                    onig_end
299 #define regex_version                onig_version
300 
301 /* encoding API */
302 #define enc_get_prev_char_head          onigenc_get_prev_char_head
303 #define enc_get_left_adjust_char_head   onigenc_get_left_adjust_char_head
304 #define enc_get_right_adjust_char_head  onigenc_get_right_adjust_char_head
305 /* obsoleted API */
306 #define regex_get_prev_char_head         onigenc_get_prev_char_head
307 #define regex_get_left_adjust_char_head  onigenc_get_left_adjust_char_head
308 #define regex_get_right_adjust_char_head onigenc_get_right_adjust_char_head
309 
310 #endif /* ONIGCMPT200_H */
311