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

Generated on Wed Aug 10 09:17:07 2011 for Ruby by  doxygen 1.4.7