Ruby 1.9.3p327(2012-11-10revision37606)
include/ruby/oniguruma.h
Go to the documentation of this file.
00001 #ifndef ONIGURUMA_H
00002 #define ONIGURUMA_H
00003 /**********************************************************************
00004   oniguruma.h - Oniguruma (regular expression library)
00005 **********************************************************************/
00006 /*-
00007  * Copyright (c) 2002-2008  K.Kosako  <sndgk393 AT ybb DOT ne DOT jp>
00008  * All rights reserved.
00009  *
00010  * Redistribution and use in source and binary forms, with or without
00011  * modification, are permitted provided that the following conditions
00012  * are met:
00013  * 1. Redistributions of source code must retain the above copyright
00014  *    notice, this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in the
00017  *    documentation and/or other materials provided with the distribution.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
00020  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
00023  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00024  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00025  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00026  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00027  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00028  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00029  * SUCH DAMAGE.
00030  */
00031 
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #if 0
00035 } /* satisfy cc-mode */
00036 #endif
00037 #endif
00038 
00039 #define ONIGURUMA
00040 #define ONIGURUMA_VERSION_MAJOR   5
00041 #define ONIGURUMA_VERSION_MINOR   9
00042 #define ONIGURUMA_VERSION_TEENY   2
00043 
00044 #ifdef __cplusplus
00045 # ifndef  HAVE_PROTOTYPES
00046 #  define HAVE_PROTOTYPES 1
00047 # endif
00048 # ifndef  HAVE_STDARG_PROTOTYPES
00049 #  define HAVE_STDARG_PROTOTYPES 1
00050 # endif
00051 #endif
00052 
00053 /* escape Mac OS X/Xcode 2.4/gcc 4.0.1 problem */
00054 #if defined(__APPLE__) && defined(__GNUC__) && __GNUC__ >= 4
00055 # ifndef  HAVE_STDARG_PROTOTYPES
00056 #  define HAVE_STDARG_PROTOTYPES 1
00057 # endif
00058 #endif
00059 
00060 #ifdef HAVE_STDARG_H
00061 # ifndef  HAVE_STDARG_PROTOTYPES
00062 #  define HAVE_STDARG_PROTOTYPES 1
00063 # endif
00064 #endif
00065 
00066 #ifndef P_
00067 #if defined(__STDC__) || defined(_WIN32)
00068 # define P_(args) args
00069 #else
00070 # define P_(args) ()
00071 #endif
00072 #endif
00073 
00074 #ifndef PV_
00075 #ifdef HAVE_STDARG_PROTOTYPES
00076 # define PV_(args) args
00077 #else
00078 # define PV_(args) ()
00079 #endif
00080 #endif
00081 
00082 #ifndef ONIG_EXTERN
00083 #ifdef RUBY_EXTERN
00084 #define ONIG_EXTERN   RUBY_EXTERN
00085 #else
00086 #if defined(_WIN32) && !defined(__GNUC__)
00087 #if defined(EXPORT) || defined(RUBY_EXPORT)
00088 #define ONIG_EXTERN   extern __declspec(dllexport)
00089 #else
00090 #define ONIG_EXTERN   extern __declspec(dllimport)
00091 #endif
00092 #endif
00093 #endif
00094 #endif
00095 
00096 #ifndef ONIG_EXTERN
00097 #define ONIG_EXTERN   extern
00098 #endif
00099 
00100 #if defined __GNUC__ && __GNUC__ >= 4
00101 #pragma GCC visibility push(default)
00102 #endif
00103 
00104 /* PART: character encoding */
00105 
00106 #ifndef ONIG_ESCAPE_UCHAR_COLLISION
00107 #define UChar OnigUChar
00108 #endif
00109 
00110 typedef unsigned char  OnigUChar;
00111 typedef unsigned int  OnigCodePoint;
00112 typedef unsigned int   OnigCtype;
00113 typedef size_t         OnigDistance;
00114 
00115 #define ONIG_INFINITE_DISTANCE  ~((OnigDistance )0)
00116 
00117 typedef unsigned int OnigCaseFoldType; /* case fold flag */
00118 
00119 ONIG_EXTERN OnigCaseFoldType OnigDefaultCaseFoldFlag;
00120 
00121 /* #define ONIGENC_CASE_FOLD_HIRAGANA_KATAKANA  (1<<1) */
00122 /* #define ONIGENC_CASE_FOLD_KATAKANA_WIDTH     (1<<2) */
00123 #define ONIGENC_CASE_FOLD_TURKISH_AZERI         (1<<20)
00124 #define INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR   (1<<30)
00125 
00126 #define ONIGENC_CASE_FOLD_MIN      INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR
00127 #define ONIGENC_CASE_FOLD_DEFAULT  OnigDefaultCaseFoldFlag
00128 
00129 
00130 #define ONIGENC_MAX_COMP_CASE_FOLD_CODE_LEN       3
00131 #define ONIGENC_GET_CASE_FOLD_CODES_MAX_NUM      13
00132 /* 13 => Unicode:0x1ffc */
00133 
00134 /* code range */
00135 #define ONIGENC_CODE_RANGE_NUM(range)     ((int )range[0])
00136 #define ONIGENC_CODE_RANGE_FROM(range,i)  range[((i)*2) + 1]
00137 #define ONIGENC_CODE_RANGE_TO(range,i)    range[((i)*2) + 2]
00138 
00139 typedef struct {
00140   int byte_len;  /* argument(original) character(s) byte length */
00141   int code_len;  /* number of code */
00142   OnigCodePoint code[ONIGENC_MAX_COMP_CASE_FOLD_CODE_LEN];
00143 } OnigCaseFoldCodeItem;
00144 
00145 typedef struct {
00146   OnigCodePoint esc;
00147   OnigCodePoint anychar;
00148   OnigCodePoint anytime;
00149   OnigCodePoint zero_or_one_time;
00150   OnigCodePoint one_or_more_time;
00151   OnigCodePoint anychar_anytime;
00152 } OnigMetaCharTableType;
00153 
00154 typedef int (*OnigApplyAllCaseFoldFunc)(OnigCodePoint from, OnigCodePoint* to, int to_len, void* arg);
00155 
00156 typedef struct OnigEncodingTypeST {
00157   int    (*precise_mbc_enc_len)(const OnigUChar* p,const OnigUChar* e, struct OnigEncodingTypeST* enc);
00158   const char*   name;
00159   int           max_enc_len;
00160   int           min_enc_len;
00161   int    (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
00162   OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
00163   int    (*code_to_mbclen)(OnigCodePoint code, struct OnigEncodingTypeST* enc);
00164   int    (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf, struct OnigEncodingTypeST* enc);
00165   int    (*mbc_case_fold)(OnigCaseFoldType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to, struct OnigEncodingTypeST* enc);
00166   int    (*apply_all_case_fold)(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg, struct OnigEncodingTypeST* enc);
00167   int    (*get_case_fold_codes_by_str)(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem acs[], struct OnigEncodingTypeST* enc);
00168   int    (*property_name_to_ctype)(struct OnigEncodingTypeST* enc, OnigUChar* p, OnigUChar* end);
00169   int    (*is_code_ctype)(OnigCodePoint code, OnigCtype ctype, struct OnigEncodingTypeST* enc);
00170   int    (*get_ctype_code_range)(OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[], struct OnigEncodingTypeST* enc);
00171   OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
00172   int    (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end, struct OnigEncodingTypeST* enc);
00173   int ruby_encoding_index;
00174 } OnigEncodingType;
00175 
00176 typedef OnigEncodingType* OnigEncoding;
00177 
00178 ONIG_EXTERN OnigEncodingType OnigEncodingASCII;
00179 
00180 #define ONIG_ENCODING_ASCII        (&OnigEncodingASCII)
00181 
00182 #define ONIG_ENCODING_UNDEF    ((OnigEncoding )0)
00183 
00184 
00185 /* work size */
00186 #define ONIGENC_CODE_TO_MBC_MAXLEN       7
00187 #define ONIGENC_MBC_CASE_FOLD_MAXLEN    18
00188 /* 18: 6(max-byte) * 3(case-fold chars) */
00189 
00190 /* character types */
00191 #define ONIGENC_CTYPE_NEWLINE   0
00192 #define ONIGENC_CTYPE_ALPHA     1
00193 #define ONIGENC_CTYPE_BLANK     2
00194 #define ONIGENC_CTYPE_CNTRL     3
00195 #define ONIGENC_CTYPE_DIGIT     4
00196 #define ONIGENC_CTYPE_GRAPH     5
00197 #define ONIGENC_CTYPE_LOWER     6
00198 #define ONIGENC_CTYPE_PRINT     7
00199 #define ONIGENC_CTYPE_PUNCT     8
00200 #define ONIGENC_CTYPE_SPACE     9
00201 #define ONIGENC_CTYPE_UPPER    10
00202 #define ONIGENC_CTYPE_XDIGIT   11
00203 #define ONIGENC_CTYPE_WORD     12
00204 #define ONIGENC_CTYPE_ALNUM    13  /* alpha || digit */
00205 #define ONIGENC_CTYPE_ASCII    14
00206 #define ONIGENC_MAX_STD_CTYPE  ONIGENC_CTYPE_ASCII
00207 #define ONIGENC_CTYPE_SPECIAL_MASK        256
00208 #define ONIGENC_CTYPE_S            /* [\t\n\v\f\r\s] */ \
00209     ONIGENC_CTYPE_SPECIAL_MASK | ONIGENC_CTYPE_SPACE
00210 #define ONIGENC_CTYPE_D            /* [0-9] */ \
00211     ONIGENC_CTYPE_SPECIAL_MASK | ONIGENC_CTYPE_DIGIT
00212 #define ONIGENC_CTYPE_W            /* [0-9A-Za-z_] */ \
00213     ONIGENC_CTYPE_SPECIAL_MASK | ONIGENC_CTYPE_WORD
00214 #define ONIGENC_CTYPE_SPECIAL_P(ctype) ((ctype) & ONIGENC_CTYPE_SPECIAL_MASK)
00215 
00216 
00217 #define onig_enc_len(enc,p,e)                ONIGENC_MBC_ENC_LEN(enc, p, e)
00218 
00219 #define ONIGENC_IS_UNDEF(enc)          ((enc) == ONIG_ENCODING_UNDEF)
00220 #define ONIGENC_IS_SINGLEBYTE(enc)     (ONIGENC_MBC_MAXLEN(enc) == 1)
00221 #define ONIGENC_IS_MBC_HEAD(enc,p,e)   (ONIGENC_MBC_ENC_LEN(enc,p,e) != 1)
00222 #define ONIGENC_IS_MBC_ASCII(p)           (*(p)   < 128)
00223 #define ONIGENC_IS_CODE_ASCII(code)       ((code) < 128)
00224 #define ONIGENC_IS_MBC_WORD(enc,s,end) \
00225    ONIGENC_IS_CODE_WORD(enc,ONIGENC_MBC_TO_CODE(enc,s,end))
00226 
00227 
00228 #define ONIGENC_NAME(enc)                      ((enc)->name)
00229 
00230 #define ONIGENC_MBC_CASE_FOLD(enc,flag,pp,end,buf) \
00231   (enc)->mbc_case_fold(flag,(const OnigUChar** )pp,end,buf,enc)
00232 #define ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc,s,end) \
00233         (enc)->is_allowed_reverse_match(s,end,enc)
00234 #define ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc,start,s,end) \
00235         (enc)->left_adjust_char_head(start, s, end, enc)
00236 #define ONIGENC_APPLY_ALL_CASE_FOLD(enc,case_fold_flag,f,arg) \
00237         (enc)->apply_all_case_fold(case_fold_flag,f,arg,enc)
00238 #define ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc,case_fold_flag,p,end,acs) \
00239        (enc)->get_case_fold_codes_by_str(case_fold_flag,p,end,acs,enc)
00240 #define ONIGENC_STEP_BACK(enc,start,s,end,n) \
00241         onigenc_step_back((enc),(start),(s),(end),(n))
00242 
00243 #define ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(n)   (n)
00244 #define ONIGENC_MBCLEN_CHARFOUND_P(r)           (0 < (r))
00245 #define ONIGENC_MBCLEN_CHARFOUND_LEN(r)         (r)
00246 
00247 #define ONIGENC_CONSTRUCT_MBCLEN_INVALID()      (-1)
00248 #define ONIGENC_MBCLEN_INVALID_P(r)             ((r) == -1)
00249 
00250 #define ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(n)    (-1-(n))
00251 #define ONIGENC_MBCLEN_NEEDMORE_P(r)            ((r) < -1)
00252 #define ONIGENC_MBCLEN_NEEDMORE_LEN(r)          (-1-(r))
00253 
00254 #define ONIGENC_PRECISE_MBC_ENC_LEN(enc,p,e)   (enc)->precise_mbc_enc_len(p,e,enc)
00255 
00256 ONIG_EXTERN
00257 int onigenc_mbclen_approximate P_((const OnigUChar* p,const OnigUChar* e, struct OnigEncodingTypeST* enc));
00258 
00259 #define ONIGENC_MBC_ENC_LEN(enc,p,e)           onigenc_mbclen_approximate(p,e,enc)
00260 #define ONIGENC_MBC_MAXLEN(enc)               ((enc)->max_enc_len)
00261 #define ONIGENC_MBC_MAXLEN_DIST(enc)           ONIGENC_MBC_MAXLEN(enc)
00262 #define ONIGENC_MBC_MINLEN(enc)               ((enc)->min_enc_len)
00263 #define ONIGENC_IS_MBC_NEWLINE(enc,p,end)      (enc)->is_mbc_newline((p),(end),enc)
00264 #define ONIGENC_MBC_TO_CODE(enc,p,end)         (enc)->mbc_to_code((p),(end),enc)
00265 #define ONIGENC_CODE_TO_MBCLEN(enc,code)       (enc)->code_to_mbclen(code,enc)
00266 #define ONIGENC_CODE_TO_MBC(enc,code,buf)      (enc)->code_to_mbc(code,buf,enc)
00267 #define ONIGENC_PROPERTY_NAME_TO_CTYPE(enc,p,end) \
00268   (enc)->property_name_to_ctype(enc,p,end)
00269 
00270 #define ONIGENC_IS_CODE_CTYPE(enc,code,ctype)  (enc)->is_code_ctype(code,ctype,enc)
00271 
00272 #define ONIGENC_IS_CODE_NEWLINE(enc,code) \
00273         ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_NEWLINE)
00274 #define ONIGENC_IS_CODE_GRAPH(enc,code) \
00275         ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_GRAPH)
00276 #define ONIGENC_IS_CODE_PRINT(enc,code) \
00277         ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_PRINT)
00278 #define ONIGENC_IS_CODE_ALNUM(enc,code) \
00279         ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_ALNUM)
00280 #define ONIGENC_IS_CODE_ALPHA(enc,code) \
00281         ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_ALPHA)
00282 #define ONIGENC_IS_CODE_LOWER(enc,code) \
00283         ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_LOWER)
00284 #define ONIGENC_IS_CODE_UPPER(enc,code) \
00285         ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_UPPER)
00286 #define ONIGENC_IS_CODE_CNTRL(enc,code) \
00287         ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_CNTRL)
00288 #define ONIGENC_IS_CODE_PUNCT(enc,code) \
00289         ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_PUNCT)
00290 #define ONIGENC_IS_CODE_SPACE(enc,code) \
00291         ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_SPACE)
00292 #define ONIGENC_IS_CODE_BLANK(enc,code) \
00293         ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_BLANK)
00294 #define ONIGENC_IS_CODE_DIGIT(enc,code) \
00295         ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_DIGIT)
00296 #define ONIGENC_IS_CODE_XDIGIT(enc,code) \
00297         ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_XDIGIT)
00298 #define ONIGENC_IS_CODE_WORD(enc,code) \
00299         ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_WORD)
00300 
00301 #define ONIGENC_GET_CTYPE_CODE_RANGE(enc,ctype,sbout,ranges) \
00302         (enc)->get_ctype_code_range(ctype,sbout,ranges,enc)
00303 
00304 ONIG_EXTERN
00305 OnigUChar* onigenc_step_back P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end, int n));
00306 
00307 
00308 /* encoding API */
00309 ONIG_EXTERN
00310 int onigenc_init P_((void));
00311 ONIG_EXTERN
00312 int onigenc_set_default_encoding P_((OnigEncoding enc));
00313 ONIG_EXTERN
00314 OnigEncoding onigenc_get_default_encoding P_((void));
00315 ONIG_EXTERN
00316 void  onigenc_set_default_caseconv_table P_((const OnigUChar* table));
00317 ONIG_EXTERN
00318 OnigUChar* onigenc_get_right_adjust_char_head_with_prev P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end, const OnigUChar** prev));
00319 ONIG_EXTERN
00320 OnigUChar* onigenc_get_prev_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end));
00321 ONIG_EXTERN
00322 OnigUChar* onigenc_get_left_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end));
00323 ONIG_EXTERN
00324 OnigUChar* onigenc_get_right_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end));
00325 ONIG_EXTERN
00326 int onigenc_strlen P_((OnigEncoding enc, const OnigUChar* p, const OnigUChar* end));
00327 ONIG_EXTERN
00328 int onigenc_strlen_null P_((OnigEncoding enc, const OnigUChar* p));
00329 ONIG_EXTERN
00330 int onigenc_str_bytelen_null P_((OnigEncoding enc, const OnigUChar* p));
00331 
00332 
00333 
00334 /* PART: regular expression */
00335 
00336 /* config parameters */
00337 #define ONIG_NREGION                          10
00338 #define ONIG_MAX_BACKREF_NUM                1000
00339 #define ONIG_MAX_REPEAT_NUM               100000
00340 #define ONIG_MAX_MULTI_BYTE_RANGES_NUM     10000
00341 /* constants */
00342 #define ONIG_MAX_ERROR_MESSAGE_LEN            90
00343 
00344 typedef unsigned int        OnigOptionType;
00345 
00346 #define ONIG_OPTION_DEFAULT            ONIG_OPTION_NONE
00347 
00348 /* options */
00349 #define ONIG_OPTION_NONE                 0U
00350 #define ONIG_OPTION_IGNORECASE           1U
00351 #define ONIG_OPTION_EXTEND               (ONIG_OPTION_IGNORECASE         << 1)
00352 #define ONIG_OPTION_MULTILINE            (ONIG_OPTION_EXTEND             << 1)
00353 #define ONIG_OPTION_SINGLELINE           (ONIG_OPTION_MULTILINE          << 1)
00354 #define ONIG_OPTION_FIND_LONGEST         (ONIG_OPTION_SINGLELINE         << 1)
00355 #define ONIG_OPTION_FIND_NOT_EMPTY       (ONIG_OPTION_FIND_LONGEST       << 1)
00356 #define ONIG_OPTION_NEGATE_SINGLELINE    (ONIG_OPTION_FIND_NOT_EMPTY     << 1)
00357 #define ONIG_OPTION_DONT_CAPTURE_GROUP   (ONIG_OPTION_NEGATE_SINGLELINE  << 1)
00358 #define ONIG_OPTION_CAPTURE_GROUP        (ONIG_OPTION_DONT_CAPTURE_GROUP << 1)
00359 /* options (search time) */
00360 #define ONIG_OPTION_NOTBOL               (ONIG_OPTION_CAPTURE_GROUP << 1)
00361 #define ONIG_OPTION_NOTEOL               (ONIG_OPTION_NOTBOL << 1)
00362 #define ONIG_OPTION_POSIX_REGION         (ONIG_OPTION_NOTEOL << 1)
00363 #define ONIG_OPTION_MAXBIT               ONIG_OPTION_POSIX_REGION  /* limit */
00364 
00365 #define ONIG_OPTION_ON(options,regopt)      ((options) |= (regopt))
00366 #define ONIG_OPTION_OFF(options,regopt)     ((options) &= ~(regopt))
00367 #define ONIG_IS_OPTION_ON(options,option)   ((options) & (option))
00368 
00369 /* syntax */
00370 typedef struct {
00371   unsigned int   op;
00372   unsigned int   op2;
00373   unsigned int   behavior;
00374   OnigOptionType options;   /* default option */
00375   OnigMetaCharTableType meta_char_table;
00376 } OnigSyntaxType;
00377 
00378 ONIG_EXTERN const OnigSyntaxType OnigSyntaxASIS;
00379 ONIG_EXTERN const OnigSyntaxType OnigSyntaxPosixBasic;
00380 ONIG_EXTERN const OnigSyntaxType OnigSyntaxPosixExtended;
00381 ONIG_EXTERN const OnigSyntaxType OnigSyntaxEmacs;
00382 ONIG_EXTERN const OnigSyntaxType OnigSyntaxGrep;
00383 ONIG_EXTERN const OnigSyntaxType OnigSyntaxGnuRegex;
00384 ONIG_EXTERN const OnigSyntaxType OnigSyntaxJava;
00385 ONIG_EXTERN const OnigSyntaxType OnigSyntaxPerl;
00386 ONIG_EXTERN const OnigSyntaxType OnigSyntaxPerl_NG;
00387 ONIG_EXTERN const OnigSyntaxType OnigSyntaxRuby;
00388 
00389 /* predefined syntaxes (see regsyntax.c) */
00390 #define ONIG_SYNTAX_ASIS               (&OnigSyntaxASIS)
00391 #define ONIG_SYNTAX_POSIX_BASIC        (&OnigSyntaxPosixBasic)
00392 #define ONIG_SYNTAX_POSIX_EXTENDED     (&OnigSyntaxPosixExtended)
00393 #define ONIG_SYNTAX_EMACS              (&OnigSyntaxEmacs)
00394 #define ONIG_SYNTAX_GREP               (&OnigSyntaxGrep)
00395 #define ONIG_SYNTAX_GNU_REGEX          (&OnigSyntaxGnuRegex)
00396 #define ONIG_SYNTAX_JAVA               (&OnigSyntaxJava)
00397 #define ONIG_SYNTAX_PERL               (&OnigSyntaxPerl)
00398 #define ONIG_SYNTAX_PERL_NG            (&OnigSyntaxPerl_NG)
00399 #define ONIG_SYNTAX_RUBY               (&OnigSyntaxRuby)
00400 
00401 /* default syntax */
00402 ONIG_EXTERN const OnigSyntaxType*   OnigDefaultSyntax;
00403 #define ONIG_SYNTAX_DEFAULT   OnigDefaultSyntax
00404 
00405 /* syntax (operators) */
00406 #define ONIG_SYN_OP_VARIABLE_META_CHARACTERS    (1U<<0)
00407 #define ONIG_SYN_OP_DOT_ANYCHAR                 (1U<<1)   /* . */
00408 #define ONIG_SYN_OP_ASTERISK_ZERO_INF           (1U<<2)   /* * */
00409 #define ONIG_SYN_OP_ESC_ASTERISK_ZERO_INF       (1U<<3)
00410 #define ONIG_SYN_OP_PLUS_ONE_INF                (1U<<4)   /* + */
00411 #define ONIG_SYN_OP_ESC_PLUS_ONE_INF            (1U<<5)
00412 #define ONIG_SYN_OP_QMARK_ZERO_ONE              (1U<<6)   /* ? */
00413 #define ONIG_SYN_OP_ESC_QMARK_ZERO_ONE          (1U<<7)
00414 #define ONIG_SYN_OP_BRACE_INTERVAL              (1U<<8)   /* {lower,upper} */
00415 #define ONIG_SYN_OP_ESC_BRACE_INTERVAL          (1U<<9)   /* \{lower,upper\} */
00416 #define ONIG_SYN_OP_VBAR_ALT                    (1U<<10)   /* | */
00417 #define ONIG_SYN_OP_ESC_VBAR_ALT                (1U<<11)  /* \| */
00418 #define ONIG_SYN_OP_LPAREN_SUBEXP               (1U<<12)  /* (...)   */
00419 #define ONIG_SYN_OP_ESC_LPAREN_SUBEXP           (1U<<13)  /* \(...\) */
00420 #define ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR           (1U<<14)  /* \A, \Z, \z */
00421 #define ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR  (1U<<15)  /* \G     */
00422 #define ONIG_SYN_OP_DECIMAL_BACKREF             (1U<<16)  /* \num   */
00423 #define ONIG_SYN_OP_BRACKET_CC                  (1U<<17)  /* [...]  */
00424 #define ONIG_SYN_OP_ESC_W_WORD                  (1U<<18)  /* \w, \W */
00425 #define ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END     (1U<<19)  /* <. > */
00426 #define ONIG_SYN_OP_ESC_B_WORD_BOUND            (1U<<20)  /* \b, \B */
00427 #define ONIG_SYN_OP_ESC_S_WHITE_SPACE           (1U<<21)  /* \s, \S */
00428 #define ONIG_SYN_OP_ESC_D_DIGIT                 (1U<<22)  /* \d, \D */
00429 #define ONIG_SYN_OP_LINE_ANCHOR                 (1U<<23)  /* ^, $   */
00430 #define ONIG_SYN_OP_POSIX_BRACKET               (1U<<24)  /* [:xxxx:] */
00431 #define ONIG_SYN_OP_QMARK_NON_GREEDY            (1U<<25)  /* ??,*?,+?,{n,m}? */
00432 #define ONIG_SYN_OP_ESC_CONTROL_CHARS           (1U<<26)  /* \n,\r,\t,\a ... */
00433 #define ONIG_SYN_OP_ESC_C_CONTROL               (1U<<27)  /* \cx  */
00434 #define ONIG_SYN_OP_ESC_OCTAL3                  (1U<<28)  /* \OOO */
00435 #define ONIG_SYN_OP_ESC_X_HEX2                  (1U<<29)  /* \xHH */
00436 #define ONIG_SYN_OP_ESC_X_BRACE_HEX8            (1U<<30)  /* \x{7HHHHHHH} */
00437 
00438 #define ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE        (1U<<0)  /* \Q...\E */
00439 #define ONIG_SYN_OP2_QMARK_GROUP_EFFECT         (1U<<1)  /* (?...) */
00440 #define ONIG_SYN_OP2_OPTION_PERL                (1U<<2)  /* (?imsx),(?-imsx) */
00441 #define ONIG_SYN_OP2_OPTION_RUBY                (1U<<3)  /* (?imx), (?-imx)  */
00442 #define ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT     (1U<<4)  /* ?+,*+,++ */
00443 #define ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL   (1U<<5)  /* {n,m}+   */
00444 #define ONIG_SYN_OP2_CCLASS_SET_OP              (1U<<6)  /* [...&&..[..]..] */
00445 #define ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP       (1U<<7)  /* (?<name>...) */
00446 #define ONIG_SYN_OP2_ESC_K_NAMED_BACKREF        (1U<<8)  /* \k<name> */
00447 #define ONIG_SYN_OP2_ESC_G_SUBEXP_CALL          (1U<<9)  /* \g<name>, \g<n> */
00448 #define ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY     (1U<<10) /* (?@..),(?@<x>..) */
00449 #define ONIG_SYN_OP2_ESC_CAPITAL_C_BAR_CONTROL  (1U<<11) /* \C-x */
00450 #define ONIG_SYN_OP2_ESC_CAPITAL_M_BAR_META     (1U<<12) /* \M-x */
00451 #define ONIG_SYN_OP2_ESC_V_VTAB                 (1U<<13) /* \v as VTAB */
00452 #define ONIG_SYN_OP2_ESC_U_HEX4                 (1U<<14) /* \uHHHH */
00453 #define ONIG_SYN_OP2_ESC_GNU_BUF_ANCHOR         (1U<<15) /* \`, \' */
00454 #define ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY  (1U<<16) /* \p{...}, \P{...} */
00455 #define ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT (1U<<17) /* \p{^..}, \P{^..} */
00456 /* #define ONIG_SYN_OP2_CHAR_PROPERTY_PREFIX_IS (1U<<18) */
00457 #define ONIG_SYN_OP2_ESC_H_XDIGIT               (1U<<19) /* \h, \H */
00458 #define ONIG_SYN_OP2_INEFFECTIVE_ESCAPE         (1U<<20) /* \ */
00459 
00460 /* syntax (behavior) */
00461 #define ONIG_SYN_CONTEXT_INDEP_ANCHORS           (1U<<31) /* not implemented */
00462 #define ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS        (1U<<0)  /* ?, *, +, {n,m} */
00463 #define ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS      (1U<<1)  /* error or ignore */
00464 #define ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP    (1U<<2)  /* ...)... */
00465 #define ONIG_SYN_ALLOW_INVALID_INTERVAL          (1U<<3)  /* {??? */
00466 #define ONIG_SYN_ALLOW_INTERVAL_LOW_ABBREV       (1U<<4)  /* {,n} => {0,n} */
00467 #define ONIG_SYN_STRICT_CHECK_BACKREF            (1U<<5)  /* /(\1)/,/\1()/ ..*/
00468 #define ONIG_SYN_DIFFERENT_LEN_ALT_LOOK_BEHIND   (1U<<6)  /* (?<=a|bc) */
00469 #define ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP        (1U<<7)  /* see doc/RE */
00470 #define ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME (1U<<8)  /* (?<x>)(?<x>) */
00471 #define ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY   (1U<<9)  /* a{n}?=(?:a{n})? */
00472 
00473 /* syntax (behavior) in char class [...] */
00474 #define ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC      (1U<<20) /* [^...] */
00475 #define ONIG_SYN_BACKSLASH_ESCAPE_IN_CC          (1U<<21) /* [..\w..] etc.. */
00476 #define ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC         (1U<<22)
00477 #define ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC     (1U<<23) /* [0-9-a]=[0-9\-a] */
00478 /* syntax (behavior) warning */
00479 #define ONIG_SYN_WARN_CC_OP_NOT_ESCAPED          (1U<<24) /* [,-,] */
00480 #define ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT    (1U<<25) /* (?:a*)+ */
00481 #define ONIG_SYN_WARN_CC_DUP                     (1U<<26) /* [aa] */
00482 
00483 /* meta character specifiers (onig_set_meta_char()) */
00484 #define ONIG_META_CHAR_ESCAPE               0
00485 #define ONIG_META_CHAR_ANYCHAR              1
00486 #define ONIG_META_CHAR_ANYTIME              2
00487 #define ONIG_META_CHAR_ZERO_OR_ONE_TIME     3
00488 #define ONIG_META_CHAR_ONE_OR_MORE_TIME     4
00489 #define ONIG_META_CHAR_ANYCHAR_ANYTIME      5
00490 
00491 #define ONIG_INEFFECTIVE_META_CHAR          0
00492 
00493 /* error codes */
00494 #define ONIG_IS_PATTERN_ERROR(ecode)   ((ecode) <= -100 && (ecode) > -1000)
00495 /* normal return */
00496 #define ONIG_NORMAL                                            0
00497 #define ONIG_MISMATCH                                         -1
00498 #define ONIG_NO_SUPPORT_CONFIG                                -2
00499 
00500 /* internal error */
00501 #define ONIGERR_MEMORY                                         -5
00502 #define ONIGERR_TYPE_BUG                                       -6
00503 #define ONIGERR_PARSER_BUG                                    -11
00504 #define ONIGERR_STACK_BUG                                     -12
00505 #define ONIGERR_UNDEFINED_BYTECODE                            -13
00506 #define ONIGERR_UNEXPECTED_BYTECODE                           -14
00507 #define ONIGERR_MATCH_STACK_LIMIT_OVER                        -15
00508 #define ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED                -21
00509 #define ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR  -22
00510 /* general error */
00511 #define ONIGERR_INVALID_ARGUMENT                              -30
00512 /* syntax error */
00513 #define ONIGERR_END_PATTERN_AT_LEFT_BRACE                    -100
00514 #define ONIGERR_END_PATTERN_AT_LEFT_BRACKET                  -101
00515 #define ONIGERR_EMPTY_CHAR_CLASS                             -102
00516 #define ONIGERR_PREMATURE_END_OF_CHAR_CLASS                  -103
00517 #define ONIGERR_END_PATTERN_AT_ESCAPE                        -104
00518 #define ONIGERR_END_PATTERN_AT_META                          -105
00519 #define ONIGERR_END_PATTERN_AT_CONTROL                       -106
00520 #define ONIGERR_META_CODE_SYNTAX                             -108
00521 #define ONIGERR_CONTROL_CODE_SYNTAX                          -109
00522 #define ONIGERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE             -110
00523 #define ONIGERR_CHAR_CLASS_VALUE_AT_START_OF_RANGE           -111
00524 #define ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS      -112
00525 #define ONIGERR_TARGET_OF_REPEAT_OPERATOR_NOT_SPECIFIED      -113
00526 #define ONIGERR_TARGET_OF_REPEAT_OPERATOR_INVALID            -114
00527 #define ONIGERR_NESTED_REPEAT_OPERATOR                       -115
00528 #define ONIGERR_UNMATCHED_CLOSE_PARENTHESIS                  -116
00529 #define ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS       -117
00530 #define ONIGERR_END_PATTERN_IN_GROUP                         -118
00531 #define ONIGERR_UNDEFINED_GROUP_OPTION                       -119
00532 #define ONIGERR_INVALID_POSIX_BRACKET_TYPE                   -121
00533 #define ONIGERR_INVALID_LOOK_BEHIND_PATTERN                  -122
00534 #define ONIGERR_INVALID_REPEAT_RANGE_PATTERN                 -123
00535 /* values error (syntax error) */
00536 #define ONIGERR_TOO_BIG_NUMBER                               -200
00537 #define ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE              -201
00538 #define ONIGERR_UPPER_SMALLER_THAN_LOWER_IN_REPEAT_RANGE     -202
00539 #define ONIGERR_EMPTY_RANGE_IN_CHAR_CLASS                    -203
00540 #define ONIGERR_MISMATCH_CODE_LENGTH_IN_CLASS_RANGE          -204
00541 #define ONIGERR_TOO_MANY_MULTI_BYTE_RANGES                   -205
00542 #define ONIGERR_TOO_SHORT_MULTI_BYTE_STRING                  -206
00543 #define ONIGERR_TOO_BIG_BACKREF_NUMBER                       -207
00544 #define ONIGERR_INVALID_BACKREF                              -208
00545 #define ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED         -209
00546 #define ONIGERR_TOO_LONG_WIDE_CHAR_VALUE                     -212
00547 #define ONIGERR_EMPTY_GROUP_NAME                             -214
00548 #define ONIGERR_INVALID_GROUP_NAME                           -215
00549 #define ONIGERR_INVALID_CHAR_IN_GROUP_NAME                   -216
00550 #define ONIGERR_UNDEFINED_NAME_REFERENCE                     -217
00551 #define ONIGERR_UNDEFINED_GROUP_REFERENCE                    -218
00552 #define ONIGERR_MULTIPLEX_DEFINED_NAME                       -219
00553 #define ONIGERR_MULTIPLEX_DEFINITION_NAME_CALL               -220
00554 #define ONIGERR_NEVER_ENDING_RECURSION                       -221
00555 #define ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY        -222
00556 #define ONIGERR_INVALID_CHAR_PROPERTY_NAME                   -223
00557 #define ONIGERR_INVALID_CODE_POINT_VALUE                     -400
00558 #define ONIGERR_INVALID_WIDE_CHAR_VALUE                      -400
00559 #define ONIGERR_TOO_BIG_WIDE_CHAR_VALUE                      -401
00560 #define ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION           -402
00561 #define ONIGERR_INVALID_COMBINATION_OF_OPTIONS               -403
00562 
00563 /* errors related to thread */
00564 #define ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT                -1001
00565 
00566 
00567 /* must be smaller than BIT_STATUS_BITS_NUM (unsigned int * 8) */
00568 #define ONIG_MAX_CAPTURE_HISTORY_GROUP   31
00569 #define ONIG_IS_CAPTURE_HISTORY_GROUP(r, i) \
00570   ((i) <= ONIG_MAX_CAPTURE_HISTORY_GROUP && (r)->list && (r)->list[i])
00571 
00572 typedef struct OnigCaptureTreeNodeStruct {
00573   int group;   /* group number */
00574   int beg;
00575   int end;
00576   int allocated;
00577   int num_childs;
00578   struct OnigCaptureTreeNodeStruct** childs;
00579 } OnigCaptureTreeNode;
00580 
00581 /* match result region type */
00582 struct re_registers {
00583   int  allocated;
00584   int  num_regs;
00585   int* beg;
00586   int* end;
00587   /* extended */
00588   OnigCaptureTreeNode* history_root;  /* capture history tree root */
00589 };
00590 
00591 /* capture tree traverse */
00592 #define ONIG_TRAVERSE_CALLBACK_AT_FIRST   1
00593 #define ONIG_TRAVERSE_CALLBACK_AT_LAST    2
00594 #define ONIG_TRAVERSE_CALLBACK_AT_BOTH \
00595   ( ONIG_TRAVERSE_CALLBACK_AT_FIRST | ONIG_TRAVERSE_CALLBACK_AT_LAST )
00596 
00597 
00598 #define ONIG_REGION_NOTPOS            -1
00599 
00600 typedef struct re_registers   OnigRegion;
00601 
00602 typedef struct {
00603   OnigEncoding enc;
00604   OnigUChar* par;
00605   OnigUChar* par_end;
00606 } OnigErrorInfo;
00607 
00608 typedef struct {
00609   int lower;
00610   int upper;
00611 } OnigRepeatRange;
00612 
00613 typedef void (*OnigWarnFunc) P_((const char* s));
00614 extern void onig_null_warn P_((const char* s));
00615 #define ONIG_NULL_WARN       onig_null_warn
00616 
00617 #define ONIG_CHAR_TABLE_SIZE   256
00618 
00619 /* regex_t state */
00620 #define ONIG_STATE_NORMAL              0
00621 #define ONIG_STATE_SEARCHING           1
00622 #define ONIG_STATE_COMPILING          -1
00623 #define ONIG_STATE_MODIFY             -2
00624 
00625 #define ONIG_STATE(reg) \
00626   ((reg)->state > 0 ? ONIG_STATE_SEARCHING : (reg)->state)
00627 
00628 typedef struct re_pattern_buffer {
00629   /* common members of BBuf(bytes-buffer) */
00630   unsigned char* p;         /* compiled pattern */
00631   unsigned int used;        /* used space for p */
00632   unsigned int alloc;       /* allocated space for p */
00633 
00634   int state;                     /* normal, searching, compiling */
00635   int num_mem;                   /* used memory(...) num counted from 1 */
00636   int num_repeat;                /* OP_REPEAT/OP_REPEAT_NG id-counter */
00637   int num_null_check;            /* OP_NULL_CHECK_START/END id counter */
00638   int num_comb_exp_check;        /* combination explosion check */
00639   int num_call;                  /* number of subexp call */
00640   unsigned int capture_history;  /* (?@...) flag (1-31) */
00641   unsigned int bt_mem_start;     /* need backtrack flag */
00642   unsigned int bt_mem_end;       /* need backtrack flag */
00643   int stack_pop_level;
00644   int repeat_range_alloc;
00645   OnigRepeatRange* repeat_range;
00646 
00647   OnigEncoding      enc;
00648   OnigOptionType    options;
00649   const OnigSyntaxType* syntax;
00650   OnigCaseFoldType  case_fold_flag;
00651   void*             name_table;
00652 
00653   /* optimization info (string search, char-map and anchors) */
00654   int            optimize;          /* optimize flag */
00655   int            threshold_len;     /* search str-length for apply optimize */
00656   int            anchor;            /* BEGIN_BUF, BEGIN_POS, (SEMI_)END_BUF */
00657   OnigDistance   anchor_dmin;       /* (SEMI_)END_BUF anchor distance */
00658   OnigDistance   anchor_dmax;       /* (SEMI_)END_BUF anchor distance */
00659   int            sub_anchor;        /* start-anchor for exact or map */
00660   unsigned char *exact;
00661   unsigned char *exact_end;
00662   unsigned char  map[ONIG_CHAR_TABLE_SIZE]; /* used as BM skip or char-map */
00663   int           *int_map;                   /* BM skip for exact_len > 255 */
00664   int           *int_map_backward;          /* BM skip for backward search */
00665   OnigDistance   dmin;                      /* min-distance of exact or map */
00666   OnigDistance   dmax;                      /* max-distance of exact or map */
00667 
00668   /* regex_t link chain */
00669   struct re_pattern_buffer* chain;  /* escape compile-conflict */
00670 } OnigRegexType;
00671 
00672 typedef OnigRegexType*  OnigRegex;
00673 
00674 #ifndef ONIG_ESCAPE_REGEX_T_COLLISION
00675   typedef OnigRegexType  regex_t;
00676 #endif
00677 
00678 
00679 typedef struct {
00680   int             num_of_elements;
00681   OnigEncoding    pattern_enc;
00682   OnigEncoding    target_enc;
00683   OnigSyntaxType* syntax;
00684   OnigOptionType  option;
00685   OnigCaseFoldType   case_fold_flag;
00686 } OnigCompileInfo;
00687 
00688 /* Oniguruma Native API */
00689 ONIG_EXTERN
00690 int onig_init P_((void));
00691 ONIG_EXTERN
00692 int onig_error_code_to_str PV_((OnigUChar* s, int err_code, ...));
00693 ONIG_EXTERN
00694 void onig_set_warn_func P_((OnigWarnFunc f));
00695 ONIG_EXTERN
00696 void onig_set_verb_warn_func P_((OnigWarnFunc f));
00697 ONIG_EXTERN
00698 int onig_new P_((OnigRegex*, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, const OnigSyntaxType* syntax, OnigErrorInfo* einfo));
00699 ONIG_EXTERN
00700 int  onig_reg_init P_((regex_t* reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, const OnigSyntaxType* syntax));
00701 ONIG_EXTERN
00702 int onig_new_without_alloc P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
00703 ONIG_EXTERN
00704 int onig_new_deluxe P_((OnigRegex* reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo));
00705 ONIG_EXTERN
00706 void onig_free P_((OnigRegex));
00707 ONIG_EXTERN
00708 void onig_free_body P_((OnigRegex));
00709 ONIG_EXTERN
00710 int onig_recompile P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
00711 ONIG_EXTERN
00712 int onig_recompile_deluxe P_((OnigRegex reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo));
00713 ONIG_EXTERN
00714 long onig_search P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option));
00715 ONIG_EXTERN
00716 long onig_match P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option));
00717 ONIG_EXTERN
00718 OnigRegion* onig_region_new P_((void));
00719 ONIG_EXTERN
00720 void onig_region_init P_((OnigRegion* region));
00721 ONIG_EXTERN
00722 void onig_region_free P_((OnigRegion* region, int free_self));
00723 ONIG_EXTERN
00724 void onig_region_copy P_((OnigRegion* to, OnigRegion* from));
00725 ONIG_EXTERN
00726 void onig_region_clear P_((OnigRegion* region));
00727 ONIG_EXTERN
00728 int onig_region_resize P_((OnigRegion* region, int n));
00729 ONIG_EXTERN
00730 int onig_region_set P_((OnigRegion* region, int at, int beg, int end));
00731 ONIG_EXTERN
00732 int onig_name_to_group_numbers P_((OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, int** nums));
00733 ONIG_EXTERN
00734 int onig_name_to_backref_number P_((OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, OnigRegion *region));
00735 ONIG_EXTERN
00736 int onig_foreach_name P_((OnigRegex reg, int (*func)(const OnigUChar*, const OnigUChar*,int,int*,OnigRegex,void*), void* arg));
00737 ONIG_EXTERN
00738 int onig_number_of_names P_((OnigRegex reg));
00739 ONIG_EXTERN
00740 int onig_number_of_captures P_((OnigRegex reg));
00741 ONIG_EXTERN
00742 int onig_number_of_capture_histories P_((OnigRegex reg));
00743 ONIG_EXTERN
00744 OnigCaptureTreeNode* onig_get_capture_tree P_((OnigRegion* region));
00745 ONIG_EXTERN
00746 int onig_capture_tree_traverse P_((OnigRegion* region, int at, int(*callback_func)(int,int,int,int,int,void*), void* arg));
00747 ONIG_EXTERN
00748 int onig_noname_group_capture_is_active P_((OnigRegex reg));
00749 ONIG_EXTERN
00750 OnigEncoding onig_get_encoding P_((OnigRegex reg));
00751 ONIG_EXTERN
00752 OnigOptionType onig_get_options P_((OnigRegex reg));
00753 ONIG_EXTERN
00754 OnigCaseFoldType onig_get_case_fold_flag P_((OnigRegex reg));
00755 ONIG_EXTERN
00756 const OnigSyntaxType* onig_get_syntax P_((OnigRegex reg));
00757 ONIG_EXTERN
00758 int onig_set_default_syntax P_((const OnigSyntaxType* syntax));
00759 ONIG_EXTERN
00760 void onig_copy_syntax P_((OnigSyntaxType* to, const OnigSyntaxType* from));
00761 ONIG_EXTERN
00762 unsigned int onig_get_syntax_op P_((OnigSyntaxType* syntax));
00763 ONIG_EXTERN
00764 unsigned int onig_get_syntax_op2 P_((OnigSyntaxType* syntax));
00765 ONIG_EXTERN
00766 unsigned int onig_get_syntax_behavior P_((OnigSyntaxType* syntax));
00767 ONIG_EXTERN
00768 OnigOptionType onig_get_syntax_options P_((OnigSyntaxType* syntax));
00769 ONIG_EXTERN
00770 void onig_set_syntax_op P_((OnigSyntaxType* syntax, unsigned int op));
00771 ONIG_EXTERN
00772 void onig_set_syntax_op2 P_((OnigSyntaxType* syntax, unsigned int op2));
00773 ONIG_EXTERN
00774 void onig_set_syntax_behavior P_((OnigSyntaxType* syntax, unsigned int behavior));
00775 ONIG_EXTERN
00776 void onig_set_syntax_options P_((OnigSyntaxType* syntax, OnigOptionType options));
00777 ONIG_EXTERN
00778 int onig_set_meta_char P_((OnigSyntaxType* syntax, unsigned int what, OnigCodePoint code));
00779 ONIG_EXTERN
00780 void onig_copy_encoding P_((OnigEncoding to, OnigEncoding from));
00781 ONIG_EXTERN
00782 OnigCaseFoldType onig_get_default_case_fold_flag P_((void));
00783 ONIG_EXTERN
00784 int onig_set_default_case_fold_flag P_((OnigCaseFoldType case_fold_flag));
00785 ONIG_EXTERN
00786 unsigned int onig_get_match_stack_limit_size P_((void));
00787 ONIG_EXTERN
00788 int onig_set_match_stack_limit_size P_((unsigned int size));
00789 ONIG_EXTERN
00790 int onig_end P_((void));
00791 ONIG_EXTERN
00792 const char* onig_version P_((void));
00793 ONIG_EXTERN
00794 const char* onig_copyright P_((void));
00795 
00796 #if defined __GNUC__ && __GNUC__ >= 4
00797 #pragma GCC visibility pop
00798 #endif
00799 
00800 #ifdef __cplusplus
00801 #if 0
00802 { /* satisfy cc-mode */
00803 #endif
00804 }
00805 #endif
00806 
00807 #endif /* ONIGURUMA_H */
00808