Ignore:
Timestamp:
Jan 21, 2018, 12:10:09 AM (6 years ago)
Author:
coas-nagasima
Message:

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

Location:
EcnlProtoTool/trunk/onigmo-6.1.3
Files:
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/onigmo-6.1.3/src/onigmo.h

    r321 r331  
    1 #ifndef ONIGURUMA_H
    2 #define ONIGURUMA_H
     1#ifndef ONIGMO_H
     2#define ONIGMO_H
    33/**********************************************************************
    4   oniguruma.h - Onigmo (Oniguruma-mod) (regular expression library)
     4  onigmo.h - Onigmo (Oniguruma-mod) (regular expression library)
    55**********************************************************************/
    66/*-
    77 * Copyright (c) 2002-2009  K.Kosako  <sndgk393 AT ybb DOT ne DOT jp>
    8  * Copyright (c) 2011-2014  K.Takata  <kentkt AT csc DOT jp>
     8 * Copyright (c) 2011-2017  K.Takata  <kentkt AT csc DOT jp>
    99 * All rights reserved.
    1010 *
     
    3333#ifdef __cplusplus
    3434extern "C" {
    35 #endif
    36 
    37 #define ONIGURUMA
    38 #define ONIGURUMA_VERSION_MAJOR   5
    39 #define ONIGURUMA_VERSION_MINOR   15
    40 #define ONIGURUMA_VERSION_TEENY   0
    41 
    42 #ifdef __cplusplus
    43 # ifndef  HAVE_PROTOTYPES
    44 #  define HAVE_PROTOTYPES 1
    45 # endif
    46 # ifndef  HAVE_STDARG_PROTOTYPES
    47 #  define HAVE_STDARG_PROTOTYPES 1
     35# if 0
     36} /* satisfy cc-mode */
    4837# endif
    4938#endif
    5039
    51 /* escape Mac OS X/Xcode 2.4/gcc 4.0.1 problem */
    52 #if defined(__APPLE__) && defined(__GNUC__) && __GNUC__ >= 4
    53 # ifndef  HAVE_STDARG_PROTOTYPES
    54 #  define HAVE_STDARG_PROTOTYPES 1
     40#define ONIGMO_VERSION_MAJOR   6
     41#define ONIGMO_VERSION_MINOR   1
     42#define ONIGMO_VERSION_TEENY   3
     43
     44#ifndef ONIG_EXTERN
     45# ifdef RUBY_EXTERN
     46#  define ONIG_EXTERN   RUBY_EXTERN
     47# else
     48#  if defined(_WIN32) && !defined(__GNUC__)
     49#   if defined(EXPORT) || defined(RUBY_EXPORT)
     50#    define ONIG_EXTERN   extern __declspec(dllexport)
     51#   else
     52#    define ONIG_EXTERN   extern __declspec(dllimport)
     53#   endif
     54#  endif
    5555# endif
    5656#endif
    5757
    58 #if defined(HAVE_STDARG_H) || defined(_WIN32)
    59 # ifndef  HAVE_STDARG_PROTOTYPES
    60 #  define HAVE_STDARG_PROTOTYPES 1
     58#ifndef ONIG_EXTERN
     59# define ONIG_EXTERN   extern
     60#endif
     61
     62#ifndef RUBY
     63# ifndef RUBY_SYMBOL_EXPORT_BEGIN
     64#  define RUBY_SYMBOL_EXPORT_BEGIN
     65#  define RUBY_SYMBOL_EXPORT_END
    6166# endif
    6267#endif
    6368
    64 #ifndef P_
    65 #if defined(__STDC__) || defined(_WIN32)
    66 # define P_(args) args
    67 #else
    68 # define P_(args) ()
    69 #endif
    70 #endif
    71 
    72 #ifndef PV_
    73 #ifdef HAVE_STDARG_PROTOTYPES
    74 # define PV_(args) args
    75 #else
    76 # define PV_(args) ()
    77 #endif
    78 #endif
    79 
    80 #ifndef ONIG_EXTERN
    81 #if defined(_WIN32) && !defined(__GNUC__)
    82 #if defined(EXPORT) || defined(RUBY_EXPORT)
    83 #define ONIG_EXTERN   extern __declspec(dllexport)
    84 #else
    85 #define ONIG_EXTERN   extern __declspec(dllimport)
    86 #endif
    87 #endif
    88 #endif
    89 
    90 #ifndef ONIG_EXTERN
    91 #define ONIG_EXTERN   extern
    92 #endif
     69RUBY_SYMBOL_EXPORT_BEGIN
    9370
    9471#include <stddef.h>             /* for size_t */
     
    9774
    9875#ifndef ONIG_ESCAPE_UCHAR_COLLISION
    99 #define UChar OnigUChar
     76# define UChar OnigUChar
    10077#endif
    10178
     
    10885#define ONIG_INFINITE_DISTANCE  ~((OnigDistance )0)
    10986
     87/*
     88 * Onig casefold/case mapping flags and related definitions
     89 *
     90 * Subfields (starting with 0 at LSB):
     91 *   0-2: Code point count in casefold.h
     92 *   3-12: Index into SpecialCaseMapping array in casefold.h
     93 *   13-22: Case folding/mapping flags
     94 */
    11095typedef unsigned int OnigCaseFoldType; /* case fold flag */
    11196
    11297ONIG_EXTERN OnigCaseFoldType OnigDefaultCaseFoldFlag;
    11398
    114 /* #define ONIGENC_CASE_FOLD_HIRAGANA_KATAKANA  (1<<1) */
    115 /* #define ONIGENC_CASE_FOLD_KATAKANA_WIDTH     (1<<2) */
    116 #define ONIGENC_CASE_FOLD_TURKISH_AZERI         (1<<20)
    117 #define INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR   (1<<30)
     99/* bits for actual code point count; 3 bits is more than enough, currently only 2 used */
     100#define OnigCodePointMaskWidth    3
     101#define OnigCodePointMask     ((1<<OnigCodePointMaskWidth)-1)
     102#define OnigCodePointCount(n) ((n)&OnigCodePointMask)
     103#define OnigCaseFoldFlags(n) ((n)&~OnigCodePointMask)
     104
     105/* #define ONIGENC_CASE_FOLD_HIRAGANA_KATAKANA  (1<<1) */ /* no longer usable with these values! */
     106/* #define ONIGENC_CASE_FOLD_KATAKANA_WIDTH     (1<<2) */ /* no longer usable with these values! */
     107
     108/* bits for index into table with separate titlecase mappings */
     109/* 10 bits provide 1024 values */
     110#define OnigSpecialIndexShift 3
     111#define OnigSpecialIndexWidth 10
     112
     113#define ONIGENC_CASE_UPCASE                     (1<<13) /* has/needs uppercase mapping */
     114#define ONIGENC_CASE_DOWNCASE                   (1<<14) /* has/needs lowercase mapping */
     115#define ONIGENC_CASE_TITLECASE                  (1<<15) /* has/needs (special) titlecase mapping */
     116#define ONIGENC_CASE_SPECIAL_OFFSET             3       /* offset in bits from ONIGENC_CASE to ONIGENC_CASE_SPECIAL */
     117#define ONIGENC_CASE_UP_SPECIAL                 (1<<16) /* has special upcase mapping */
     118#define ONIGENC_CASE_DOWN_SPECIAL               (1<<17) /* has special downcase mapping */
     119#define ONIGENC_CASE_MODIFIED                   (1<<18) /* data has been modified */
     120#define ONIGENC_CASE_FOLD                       (1<<19) /* has/needs case folding */
     121
     122#define ONIGENC_CASE_FOLD_TURKISH_AZERI         (1<<20) /* needs mapping specific to Turkic languages; better not change original value! */
     123
     124#define ONIGENC_CASE_FOLD_LITHUANIAN            (1<<21) /* needs Lithuanian-specific mapping */
     125#define ONIGENC_CASE_ASCII_ONLY                 (1<<22) /* only modify ASCII range */
     126#define ONIGENC_CASE_IS_TITLECASE               (1<<23) /* character itself is already titlecase */
     127
     128#define INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR   (1<<30) /* better not change original value! */
    118129
    119130#define ONIGENC_CASE_FOLD_MIN      INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR
     
    148159
    149160typedef struct OnigEncodingTypeST {
    150   int    (*mbc_enc_len)(const OnigUChar* p);
     161  int    (*precise_mbc_enc_len)(const OnigUChar* p,const OnigUChar* e, const struct OnigEncodingTypeST* enc);
    151162  const char*   name;
    152163  int           max_enc_len;
    153164  int           min_enc_len;
    154   int    (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end);
    155   OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end);
    156   int    (*code_to_mbclen)(OnigCodePoint code);
    157   int    (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf);
    158   int    (*mbc_case_fold)(OnigCaseFoldType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to);
    159   int    (*apply_all_case_fold)(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg);
    160   int    (*get_case_fold_codes_by_str)(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem acs[]);
    161   int    (*property_name_to_ctype)(struct OnigEncodingTypeST* enc, OnigUChar* p, OnigUChar* end);
    162   int    (*is_code_ctype)(OnigCodePoint code, OnigCtype ctype);
    163   int    (*get_ctype_code_range)(OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[]);
    164   OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p);
    165   int    (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end);
     165  int    (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end, const struct OnigEncodingTypeST* enc);
     166  OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end, const struct OnigEncodingTypeST* enc);
     167  int    (*code_to_mbclen)(OnigCodePoint code, const struct OnigEncodingTypeST* enc);
     168  int    (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf, const struct OnigEncodingTypeST* enc);
     169  int    (*mbc_case_fold)(OnigCaseFoldType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to, const struct OnigEncodingTypeST* enc);
     170  int    (*apply_all_case_fold)(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg, const struct OnigEncodingTypeST* enc);
     171  int    (*get_case_fold_codes_by_str)(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem acs[], const struct OnigEncodingTypeST* enc);
     172  int    (*property_name_to_ctype)(const struct OnigEncodingTypeST* enc, const OnigUChar* p, const OnigUChar* end);
     173  int    (*is_code_ctype)(OnigCodePoint code, OnigCtype ctype, const struct OnigEncodingTypeST* enc);
     174  int    (*get_ctype_code_range)(OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[], const struct OnigEncodingTypeST* enc);
     175  OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p, const OnigUChar* end, const struct OnigEncodingTypeST* enc);
     176  int    (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end, const struct OnigEncodingTypeST* enc);
     177  int    (*case_map)(OnigCaseFoldType* flagP, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to, OnigUChar* to_end, const struct OnigEncodingTypeST* enc);
     178  int ruby_encoding_index;
    166179  unsigned int  flags;
    167180} OnigEncodingType;
    168181
    169 typedef OnigEncodingType* OnigEncoding;
    170 
    171 ONIG_EXTERN OnigEncodingType OnigEncodingASCII;
    172 ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_1;
    173 ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_2;
    174 ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_3;
    175 ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_4;
    176 ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_5;
    177 ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_6;
    178 ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_7;
    179 ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_8;
    180 ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_9;
    181 ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_10;
    182 ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_11;
    183 ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_13;
    184 ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_14;
    185 ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_15;
    186 ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_16;
    187 ONIG_EXTERN OnigEncodingType OnigEncodingUTF8;
    188 ONIG_EXTERN OnigEncodingType OnigEncodingUTF16_BE;
    189 ONIG_EXTERN OnigEncodingType OnigEncodingUTF16_LE;
    190 ONIG_EXTERN OnigEncodingType OnigEncodingUTF32_BE;
    191 ONIG_EXTERN OnigEncodingType OnigEncodingUTF32_LE;
    192 ONIG_EXTERN OnigEncodingType OnigEncodingEUC_JP;
    193 ONIG_EXTERN OnigEncodingType OnigEncodingEUC_TW;
    194 ONIG_EXTERN OnigEncodingType OnigEncodingEUC_KR;
    195 ONIG_EXTERN OnigEncodingType OnigEncodingEUC_CN;
    196 ONIG_EXTERN OnigEncodingType OnigEncodingSJIS;
    197 ONIG_EXTERN OnigEncodingType OnigEncodingCP932;
    198 ONIG_EXTERN OnigEncodingType OnigEncodingKOI8;
    199 ONIG_EXTERN OnigEncodingType OnigEncodingKOI8_R;
    200 ONIG_EXTERN OnigEncodingType OnigEncodingCP1251;
    201 ONIG_EXTERN OnigEncodingType OnigEncodingBIG5;
    202 ONIG_EXTERN OnigEncodingType OnigEncodingGB18030;
     182typedef const OnigEncodingType* OnigEncoding;
     183
     184ONIG_EXTERN const OnigEncodingType OnigEncodingASCII;
     185#ifndef RUBY
     186ONIG_EXTERN const OnigEncodingType OnigEncodingISO_8859_1;
     187ONIG_EXTERN const OnigEncodingType OnigEncodingISO_8859_2;
     188ONIG_EXTERN const OnigEncodingType OnigEncodingISO_8859_3;
     189ONIG_EXTERN const OnigEncodingType OnigEncodingISO_8859_4;
     190ONIG_EXTERN const OnigEncodingType OnigEncodingISO_8859_5;
     191ONIG_EXTERN const OnigEncodingType OnigEncodingISO_8859_6;
     192ONIG_EXTERN const OnigEncodingType OnigEncodingISO_8859_7;
     193ONIG_EXTERN const OnigEncodingType OnigEncodingISO_8859_8;
     194ONIG_EXTERN const OnigEncodingType OnigEncodingISO_8859_9;
     195ONIG_EXTERN const OnigEncodingType OnigEncodingISO_8859_10;
     196ONIG_EXTERN const OnigEncodingType OnigEncodingISO_8859_11;
     197ONIG_EXTERN const OnigEncodingType OnigEncodingISO_8859_13;
     198ONIG_EXTERN const OnigEncodingType OnigEncodingISO_8859_14;
     199ONIG_EXTERN const OnigEncodingType OnigEncodingISO_8859_15;
     200ONIG_EXTERN const OnigEncodingType OnigEncodingISO_8859_16;
     201ONIG_EXTERN const OnigEncodingType OnigEncodingUTF_8;
     202ONIG_EXTERN const OnigEncodingType OnigEncodingUTF_16BE;
     203ONIG_EXTERN const OnigEncodingType OnigEncodingUTF_16LE;
     204ONIG_EXTERN const OnigEncodingType OnigEncodingUTF_32BE;
     205ONIG_EXTERN const OnigEncodingType OnigEncodingUTF_32LE;
     206ONIG_EXTERN const OnigEncodingType OnigEncodingEUC_JP;
     207ONIG_EXTERN const OnigEncodingType OnigEncodingEUC_TW;
     208ONIG_EXTERN const OnigEncodingType OnigEncodingEUC_KR;
     209ONIG_EXTERN const OnigEncodingType OnigEncodingEUC_CN;
     210ONIG_EXTERN const OnigEncodingType OnigEncodingShift_JIS;
     211ONIG_EXTERN const OnigEncodingType OnigEncodingWindows_31J;
     212/* ONIG_EXTERN const OnigEncodingType OnigEncodingKOI8; */
     213ONIG_EXTERN const OnigEncodingType OnigEncodingKOI8_R;
     214ONIG_EXTERN const OnigEncodingType OnigEncodingKOI8_U;
     215ONIG_EXTERN const OnigEncodingType OnigEncodingWindows_1250;
     216ONIG_EXTERN const OnigEncodingType OnigEncodingWindows_1251;
     217ONIG_EXTERN const OnigEncodingType OnigEncodingWindows_1252;
     218ONIG_EXTERN const OnigEncodingType OnigEncodingWindows_1253;
     219ONIG_EXTERN const OnigEncodingType OnigEncodingWindows_1254;
     220ONIG_EXTERN const OnigEncodingType OnigEncodingWindows_1257;
     221ONIG_EXTERN const OnigEncodingType OnigEncodingBIG5;
     222ONIG_EXTERN const OnigEncodingType OnigEncodingGB18030;
     223#endif /* RUBY */
    203224
    204225#define ONIG_ENCODING_ASCII        (&OnigEncodingASCII)
    205 #define ONIG_ENCODING_ISO_8859_1   (&OnigEncodingISO_8859_1)
    206 #define ONIG_ENCODING_ISO_8859_2   (&OnigEncodingISO_8859_2)
    207 #define ONIG_ENCODING_ISO_8859_3   (&OnigEncodingISO_8859_3)
    208 #define ONIG_ENCODING_ISO_8859_4   (&OnigEncodingISO_8859_4)
    209 #define ONIG_ENCODING_ISO_8859_5   (&OnigEncodingISO_8859_5)
    210 #define ONIG_ENCODING_ISO_8859_6   (&OnigEncodingISO_8859_6)
    211 #define ONIG_ENCODING_ISO_8859_7   (&OnigEncodingISO_8859_7)
    212 #define ONIG_ENCODING_ISO_8859_8   (&OnigEncodingISO_8859_8)
    213 #define ONIG_ENCODING_ISO_8859_9   (&OnigEncodingISO_8859_9)
    214 #define ONIG_ENCODING_ISO_8859_10  (&OnigEncodingISO_8859_10)
    215 #define ONIG_ENCODING_ISO_8859_11  (&OnigEncodingISO_8859_11)
    216 #define ONIG_ENCODING_ISO_8859_13  (&OnigEncodingISO_8859_13)
    217 #define ONIG_ENCODING_ISO_8859_14  (&OnigEncodingISO_8859_14)
    218 #define ONIG_ENCODING_ISO_8859_15  (&OnigEncodingISO_8859_15)
    219 #define ONIG_ENCODING_ISO_8859_16  (&OnigEncodingISO_8859_16)
    220 #define ONIG_ENCODING_UTF8         (&OnigEncodingUTF8)
    221 #define ONIG_ENCODING_UTF16_BE     (&OnigEncodingUTF16_BE)
    222 #define ONIG_ENCODING_UTF16_LE     (&OnigEncodingUTF16_LE)
    223 #define ONIG_ENCODING_UTF32_BE     (&OnigEncodingUTF32_BE)
    224 #define ONIG_ENCODING_UTF32_LE     (&OnigEncodingUTF32_LE)
    225 #define ONIG_ENCODING_EUC_JP       (&OnigEncodingEUC_JP)
    226 #define ONIG_ENCODING_EUC_TW       (&OnigEncodingEUC_TW)
    227 #define ONIG_ENCODING_EUC_KR       (&OnigEncodingEUC_KR)
    228 #define ONIG_ENCODING_EUC_CN       (&OnigEncodingEUC_CN)
    229 #define ONIG_ENCODING_SJIS         (&OnigEncodingSJIS)
    230 #define ONIG_ENCODING_CP932        (&OnigEncodingCP932)
    231 #define ONIG_ENCODING_KOI8         (&OnigEncodingKOI8)
    232 #define ONIG_ENCODING_KOI8_R       (&OnigEncodingKOI8_R)
    233 #define ONIG_ENCODING_CP1251       (&OnigEncodingCP1251)
    234 #define ONIG_ENCODING_BIG5         (&OnigEncodingBIG5)
    235 #define ONIG_ENCODING_GB18030      (&OnigEncodingGB18030)
     226#ifndef RUBY
     227# define ONIG_ENCODING_ISO_8859_1   (&OnigEncodingISO_8859_1)
     228# define ONIG_ENCODING_ISO_8859_2   (&OnigEncodingISO_8859_2)
     229# define ONIG_ENCODING_ISO_8859_3   (&OnigEncodingISO_8859_3)
     230# define ONIG_ENCODING_ISO_8859_4   (&OnigEncodingISO_8859_4)
     231# define ONIG_ENCODING_ISO_8859_5   (&OnigEncodingISO_8859_5)
     232# define ONIG_ENCODING_ISO_8859_6   (&OnigEncodingISO_8859_6)
     233# define ONIG_ENCODING_ISO_8859_7   (&OnigEncodingISO_8859_7)
     234# define ONIG_ENCODING_ISO_8859_8   (&OnigEncodingISO_8859_8)
     235# define ONIG_ENCODING_ISO_8859_9   (&OnigEncodingISO_8859_9)
     236# define ONIG_ENCODING_ISO_8859_10  (&OnigEncodingISO_8859_10)
     237# define ONIG_ENCODING_ISO_8859_11  (&OnigEncodingISO_8859_11)
     238# define ONIG_ENCODING_ISO_8859_13  (&OnigEncodingISO_8859_13)
     239# define ONIG_ENCODING_ISO_8859_14  (&OnigEncodingISO_8859_14)
     240# define ONIG_ENCODING_ISO_8859_15  (&OnigEncodingISO_8859_15)
     241# define ONIG_ENCODING_ISO_8859_16  (&OnigEncodingISO_8859_16)
     242# define ONIG_ENCODING_UTF_8        (&OnigEncodingUTF_8)
     243# define ONIG_ENCODING_UTF_16BE     (&OnigEncodingUTF_16BE)
     244# define ONIG_ENCODING_UTF_16LE     (&OnigEncodingUTF_16LE)
     245# define ONIG_ENCODING_UTF_32BE     (&OnigEncodingUTF_32BE)
     246# define ONIG_ENCODING_UTF_32LE     (&OnigEncodingUTF_32LE)
     247# define ONIG_ENCODING_EUC_JP       (&OnigEncodingEUC_JP)
     248# define ONIG_ENCODING_EUC_TW       (&OnigEncodingEUC_TW)
     249# define ONIG_ENCODING_EUC_KR       (&OnigEncodingEUC_KR)
     250# define ONIG_ENCODING_EUC_CN       (&OnigEncodingEUC_CN)
     251# define ONIG_ENCODING_SHIFT_JIS    (&OnigEncodingShift_JIS)
     252# define ONIG_ENCODING_WINDOWS_31J  (&OnigEncodingWindows_31J)
     253/* # define ONIG_ENCODING_KOI8         (&OnigEncodingKOI8) */
     254# define ONIG_ENCODING_KOI8_R       (&OnigEncodingKOI8_R)
     255# define ONIG_ENCODING_KOI8_U       (&OnigEncodingKOI8_U)
     256# define ONIG_ENCODING_WINDOWS_1250 (&OnigEncodingWindows_1250)
     257# define ONIG_ENCODING_WINDOWS_1251 (&OnigEncodingWindows_1251)
     258# define ONIG_ENCODING_WINDOWS_1252 (&OnigEncodingWindows_1252)
     259# define ONIG_ENCODING_WINDOWS_1253 (&OnigEncodingWindows_1253)
     260# define ONIG_ENCODING_WINDOWS_1254 (&OnigEncodingWindows_1254)
     261# define ONIG_ENCODING_WINDOWS_1257 (&OnigEncodingWindows_1257)
     262# define ONIG_ENCODING_BIG5         (&OnigEncodingBIG5)
     263# define ONIG_ENCODING_GB18030      (&OnigEncodingGB18030)
     264
     265/* old names */
     266# define ONIG_ENCODING_SJIS         ONIG_ENCODING_SHIFT_JIS
     267# define ONIG_ENCODING_CP932        ONIG_ENCODING_WINDOWS_31J
     268# define ONIG_ENCODING_CP1250       ONIG_ENCODING_WINDOWS_1250
     269# define ONIG_ENCODING_CP1251       ONIG_ENCODING_WINDOWS_1251
     270# define ONIG_ENCODING_CP1252       ONIG_ENCODING_WINDOWS_1252
     271# define ONIG_ENCODING_CP1253       ONIG_ENCODING_WINDOWS_1253
     272# define ONIG_ENCODING_CP1254       ONIG_ENCODING_WINDOWS_1254
     273# define ONIG_ENCODING_CP1257       ONIG_ENCODING_WINDOWS_1257
     274# define ONIG_ENCODING_UTF8         ONIG_ENCODING_UTF_8
     275# define ONIG_ENCODING_UTF16_BE     ONIG_ENCODING_UTF_16BE
     276# define ONIG_ENCODING_UTF16_LE     ONIG_ENCODING_UTF_16LE
     277# define ONIG_ENCODING_UTF32_BE     ONIG_ENCODING_UTF_32BE
     278# define ONIG_ENCODING_UTF32_LE     ONIG_ENCODING_UTF_32LE
     279#endif /* RUBY */
    236280
    237281#define ONIG_ENCODING_UNDEF    ((OnigEncoding )0)
     282
     283/* this declaration needs to be here because it is used in string.c in Ruby */
     284ONIG_EXTERN
     285int onigenc_ascii_only_case_map(OnigCaseFoldType* flagP, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to, OnigUChar* to_end, const struct OnigEncodingTypeST* enc);
    238286
    239287
     
    265313#define ONIGENC_FLAG_UNICODE    1U
    266314
    267 
    268 #define onig_enc_len(enc,p,end)        ONIGENC_MBC_ENC_LEN(enc,p)
     315#define onig_enc_len(enc,p,e)          ONIGENC_MBC_ENC_LEN(enc, p, e)
    269316
    270317#define ONIGENC_IS_UNDEF(enc)          ((enc) == ONIG_ENCODING_UNDEF)
    271318#define ONIGENC_IS_SINGLEBYTE(enc)     (ONIGENC_MBC_MAXLEN(enc) == 1)
    272 #define ONIGENC_IS_MBC_HEAD(enc,p)     (ONIGENC_MBC_ENC_LEN(enc,p) != 1)
     319#define ONIGENC_IS_MBC_HEAD(enc,p,e)   (ONIGENC_MBC_ENC_LEN(enc,p,e) != 1)
    273320#define ONIGENC_IS_MBC_ASCII(p)           (*(p)   < 128)
    274321#define ONIGENC_IS_CODE_ASCII(code)       ((code) < 128)
     
    277324#define ONIGENC_IS_MBC_ASCII_WORD(enc,s,end) \
    278325   onigenc_ascii_is_code_ctype( \
    279         ONIGENC_MBC_TO_CODE(enc,s,end),ONIGENC_CTYPE_WORD)
     326        ONIGENC_MBC_TO_CODE(enc,s,end),ONIGENC_CTYPE_WORD,enc)
    280327#define ONIGENC_IS_UNICODE(enc)        ((enc)->flags & ONIGENC_FLAG_UNICODE)
    281328
     
    284331
    285332#define ONIGENC_MBC_CASE_FOLD(enc,flag,pp,end,buf) \
    286   (enc)->mbc_case_fold(flag,(const OnigUChar** )pp,end,buf)
     333  (enc)->mbc_case_fold(flag,(const OnigUChar** )pp,end,buf,enc)
    287334#define ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc,s,end) \
    288         (enc)->is_allowed_reverse_match(s,end)
    289 #define ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc,start,s) \
    290         (enc)->left_adjust_char_head(start, s)
     335        (enc)->is_allowed_reverse_match(s,end,enc)
     336#define ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc,start,s,end) \
     337        (enc)->left_adjust_char_head(start, s, end, enc)
    291338#define ONIGENC_APPLY_ALL_CASE_FOLD(enc,case_fold_flag,f,arg) \
    292         (enc)->apply_all_case_fold(case_fold_flag,f,arg)
     339        (enc)->apply_all_case_fold(case_fold_flag,f,arg,enc)
    293340#define ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc,case_fold_flag,p,end,acs) \
    294        (enc)->get_case_fold_codes_by_str(case_fold_flag,p,end,acs)
    295 #define ONIGENC_STEP_BACK(enc,start,s,n) \
    296         onigenc_step_back((enc),(start),(s),(n))
    297 
    298 #define ONIGENC_MBC_ENC_LEN(enc,p)             (enc)->mbc_enc_len(p)
     341       (enc)->get_case_fold_codes_by_str(case_fold_flag,p,end,acs,enc)
     342#define ONIGENC_STEP_BACK(enc,start,s,end,n) \
     343        onigenc_step_back((enc),(start),(s),(end),(n))
     344
     345#define ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(n)   (n)
     346#define ONIGENC_MBCLEN_CHARFOUND_P(r)           (0 < (r))
     347#define ONIGENC_MBCLEN_CHARFOUND_LEN(r)         (r)
     348
     349#define ONIGENC_CONSTRUCT_MBCLEN_INVALID()      (-1)
     350#define ONIGENC_MBCLEN_INVALID_P(r)             ((r) == -1)
     351
     352#define ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE(n)    (-1-(n))
     353#define ONIGENC_MBCLEN_NEEDMORE_P(r)            ((r) < -1)
     354#define ONIGENC_MBCLEN_NEEDMORE_LEN(r)          (-1-(r))
     355
     356#define ONIGENC_PRECISE_MBC_ENC_LEN(enc,p,e)   (enc)->precise_mbc_enc_len(p,e,enc)
     357
     358ONIG_EXTERN
     359int onigenc_mbclen_approximate(const OnigUChar* p,const OnigUChar* e, const struct OnigEncodingTypeST* enc);
     360
     361#define ONIGENC_MBC_ENC_LEN(enc,p,e)           onigenc_mbclen_approximate(p,e,enc)
    299362#define ONIGENC_MBC_MAXLEN(enc)               ((enc)->max_enc_len)
    300363#define ONIGENC_MBC_MAXLEN_DIST(enc)           ONIGENC_MBC_MAXLEN(enc)
    301364#define ONIGENC_MBC_MINLEN(enc)               ((enc)->min_enc_len)
    302 #define ONIGENC_IS_MBC_NEWLINE(enc,p,end)      (enc)->is_mbc_newline((p),(end))
    303 #define ONIGENC_MBC_TO_CODE(enc,p,end)         (enc)->mbc_to_code((p),(end))
    304 #define ONIGENC_CODE_TO_MBCLEN(enc,code)       (enc)->code_to_mbclen(code)
    305 #define ONIGENC_CODE_TO_MBC(enc,code,buf)      (enc)->code_to_mbc(code,buf)
     365#define ONIGENC_IS_MBC_NEWLINE(enc,p,end)      (enc)->is_mbc_newline((p),(end),enc)
     366#define ONIGENC_MBC_TO_CODE(enc,p,end)         (enc)->mbc_to_code((p),(end),enc)
     367#define ONIGENC_CODE_TO_MBCLEN(enc,code)       (enc)->code_to_mbclen(code,enc)
     368#define ONIGENC_CODE_TO_MBC(enc,code,buf)      (enc)->code_to_mbc(code,buf,enc)
    306369#define ONIGENC_PROPERTY_NAME_TO_CTYPE(enc,p,end) \
    307370  (enc)->property_name_to_ctype(enc,p,end)
    308371
    309 #define ONIGENC_IS_CODE_CTYPE(enc,code,ctype)  (enc)->is_code_ctype(code,ctype)
     372#define ONIGENC_IS_CODE_CTYPE(enc,code,ctype)  (enc)->is_code_ctype(code,ctype,enc)
    310373
    311374#define ONIGENC_IS_CODE_NEWLINE(enc,code) \
     
    339402
    340403#define ONIGENC_GET_CTYPE_CODE_RANGE(enc,ctype,sbout,ranges) \
    341         (enc)->get_ctype_code_range(ctype,sbout,ranges)
    342 
    343 ONIG_EXTERN
    344 OnigUChar* onigenc_step_back P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, int n));
     404        (enc)->get_ctype_code_range(ctype,sbout,ranges,enc)
     405
     406ONIG_EXTERN
     407OnigUChar* onigenc_step_back(OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end, int n);
    345408
    346409
    347410/* encoding API */
    348411ONIG_EXTERN
    349 int onigenc_init P_((void));
    350 ONIG_EXTERN
    351 int onigenc_set_default_encoding P_((OnigEncoding enc));
    352 ONIG_EXTERN
    353 OnigEncoding onigenc_get_default_encoding P_((void));
    354 ONIG_EXTERN
    355 void  onigenc_set_default_caseconv_table P_((const OnigUChar* table));
    356 ONIG_EXTERN
    357 OnigUChar* onigenc_get_right_adjust_char_head_with_prev P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar** prev));
    358 ONIG_EXTERN
    359 OnigUChar* onigenc_get_prev_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s));
    360 ONIG_EXTERN
    361 OnigUChar* onigenc_get_left_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s));
    362 ONIG_EXTERN
    363 OnigUChar* onigenc_get_right_adjust_char_head P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s));
    364 ONIG_EXTERN
    365 int onigenc_strlen P_((OnigEncoding enc, const OnigUChar* p, const OnigUChar* end));
    366 ONIG_EXTERN
    367 int onigenc_strlen_null P_((OnigEncoding enc, const OnigUChar* p));
    368 ONIG_EXTERN
    369 int onigenc_str_bytelen_null P_((OnigEncoding enc, const OnigUChar* p));
     412int onigenc_init(void);
     413ONIG_EXTERN
     414int onigenc_set_default_encoding(OnigEncoding enc);
     415ONIG_EXTERN
     416OnigEncoding onigenc_get_default_encoding(void);
     417ONIG_EXTERN
     418OnigUChar* onigenc_get_right_adjust_char_head_with_prev(OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end, const OnigUChar** prev);
     419ONIG_EXTERN
     420OnigUChar* onigenc_get_prev_char_head(OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end);
     421ONIG_EXTERN
     422OnigUChar* onigenc_get_left_adjust_char_head(OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end);
     423ONIG_EXTERN
     424OnigUChar* onigenc_get_right_adjust_char_head(OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end);
     425ONIG_EXTERN
     426int onigenc_strlen(OnigEncoding enc, const OnigUChar* p, const OnigUChar* end);
     427ONIG_EXTERN
     428int onigenc_strlen_null(OnigEncoding enc, const OnigUChar* p);
     429ONIG_EXTERN
     430int onigenc_str_bytelen_null(OnigEncoding enc, const OnigUChar* p);
    370431
    371432
     
    375436/* config parameters */
    376437#define ONIG_NREGION                          10
     438#define ONIG_MAX_CAPTURE_GROUP_NUM         32767
    377439#define ONIG_MAX_BACKREF_NUM                1000
    378 #define ONIG_MAX_CAPTURE_GROUP_NUM         32767
    379440#define ONIG_MAX_REPEAT_NUM               100000
    380441#define ONIG_MAX_MULTI_BYTE_RANGES_NUM     10000
     
    401462#define ONIG_OPTION_NOTBOL               (ONIG_OPTION_CAPTURE_GROUP << 1)
    402463#define ONIG_OPTION_NOTEOL               (ONIG_OPTION_NOTBOL << 1)
    403 #define ONIG_OPTION_POSIX_REGION         (ONIG_OPTION_NOTEOL << 1)
     464#define ONIG_OPTION_NOTBOS               (ONIG_OPTION_NOTEOL << 1)
     465#define ONIG_OPTION_NOTEOS               (ONIG_OPTION_NOTBOS << 1)
    404466/* options (ctype range) */
    405 #define ONIG_OPTION_ASCII_RANGE          (ONIG_OPTION_POSIX_REGION << 1)
     467#define ONIG_OPTION_ASCII_RANGE          (ONIG_OPTION_NOTEOS << 1)
    406468#define ONIG_OPTION_POSIX_BRACKET_ALL_RANGE (ONIG_OPTION_ASCII_RANGE << 1)
    407469#define ONIG_OPTION_WORD_BOUND_ALL_RANGE    (ONIG_OPTION_POSIX_BRACKET_ALL_RANGE << 1)
    408470/* options (newline) */
    409471#define ONIG_OPTION_NEWLINE_CRLF         (ONIG_OPTION_WORD_BOUND_ALL_RANGE << 1)
    410 #define ONIG_OPTION_NOTBOS               (ONIG_OPTION_NEWLINE_CRLF << 1)
    411 #define ONIG_OPTION_NOTEOS               (ONIG_OPTION_NOTBOS << 1)
    412 #define ONIG_OPTION_MAXBIT               ONIG_OPTION_NOTEOS  /* limit */
     472#define ONIG_OPTION_MAXBIT               ONIG_OPTION_NEWLINE_CRLF  /* limit */
    413473
    414474#define ONIG_OPTION_ON(options,regopt)      ((options) |= (regopt))
     
    425485} OnigSyntaxType;
    426486
    427 ONIG_EXTERN OnigSyntaxType OnigSyntaxASIS;
    428 ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixBasic;
    429 ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixExtended;
    430 ONIG_EXTERN OnigSyntaxType OnigSyntaxEmacs;
    431 ONIG_EXTERN OnigSyntaxType OnigSyntaxGrep;
    432 ONIG_EXTERN OnigSyntaxType OnigSyntaxGnuRegex;
    433 ONIG_EXTERN OnigSyntaxType OnigSyntaxJava;
    434 ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl58;
    435 ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl58_NG;
    436 ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl;
    437 ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby;
    438 ONIG_EXTERN OnigSyntaxType OnigSyntaxPython;
     487ONIG_EXTERN const OnigSyntaxType OnigSyntaxASIS;
     488ONIG_EXTERN const OnigSyntaxType OnigSyntaxPosixBasic;
     489ONIG_EXTERN const OnigSyntaxType OnigSyntaxPosixExtended;
     490ONIG_EXTERN const OnigSyntaxType OnigSyntaxEmacs;
     491ONIG_EXTERN const OnigSyntaxType OnigSyntaxGrep;
     492ONIG_EXTERN const OnigSyntaxType OnigSyntaxGnuRegex;
     493ONIG_EXTERN const OnigSyntaxType OnigSyntaxJava;
     494ONIG_EXTERN const OnigSyntaxType OnigSyntaxPerl58;
     495ONIG_EXTERN const OnigSyntaxType OnigSyntaxPerl58_NG;
     496ONIG_EXTERN const OnigSyntaxType OnigSyntaxPerl;
     497ONIG_EXTERN const OnigSyntaxType OnigSyntaxRuby;
     498ONIG_EXTERN const OnigSyntaxType OnigSyntaxPython;
    439499
    440500/* predefined syntaxes (see regsyntax.c) */
     
    453513
    454514/* default syntax */
    455 ONIG_EXTERN OnigSyntaxType*   OnigDefaultSyntax;
     515ONIG_EXTERN const OnigSyntaxType*   OnigDefaultSyntax;
    456516#define ONIG_SYNTAX_DEFAULT   OnigDefaultSyntax
    457517
     
    488548#define ONIG_SYN_OP_ESC_X_HEX2                  (1U<<29)  /* \xHH */
    489549#define ONIG_SYN_OP_ESC_X_BRACE_HEX8            (1U<<30)  /* \x{7HHHHHHH} */
    490 #define ONIG_SYN_OP_ESC_O_BRACE_OCTAL           (1U<<31)  /* \o{OOO} */ /* NOTIMPL */
     550#define ONIG_SYN_OP_ESC_O_BRACE_OCTAL           (1U<<31)  /* \o{OOO} */
    491551
    492552#define ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE        (1U<<0)  /* \Q...\E */
     
    512572#define ONIG_SYN_OP2_INEFFECTIVE_ESCAPE         (1U<<20) /* \ */
    513573#define ONIG_SYN_OP2_ESC_CAPITAL_R_LINEBREAK    (1U<<21) /* \R as (?>\x0D\x0A|[\x0A-\x0D\x{85}\x{2028}\x{2029}]) */
    514 #define ONIG_SYN_OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER (1U<<22) /* \X as (?>\P{M}\p{M}*) */
     574#define ONIG_SYN_OP2_ESC_CAPITAL_X_EXTENDED_GRAPHEME_CLUSTER (1U<<22) /* \X */
    515575#define ONIG_SYN_OP2_ESC_V_VERTICAL_WHITESPACE   (1U<<23) /* \v, \V -- Perl */ /* NOTIMPL */
    516576#define ONIG_SYN_OP2_ESC_H_HORIZONTAL_WHITESPACE (1U<<24) /* \h, \H -- Perl */ /* NOTIMPL */
     
    521581#define ONIG_SYN_OP2_QMARK_LPAREN_CONDITION     (1U<<29) /* (?(cond)yes...|no...) */
    522582#define ONIG_SYN_OP2_QMARK_CAPITAL_P_NAMED_GROUP (1U<<30) /* (?P<name>...), (?P=name), (?P>name) -- Python/PCRE */
    523 #define ONIG_SYN_OP2_OPTION_JAVA                (1U<<31) /* (?idmsux), (?-idmsux) */ /* NOTIMPL */
     583#define ONIG_SYN_OP2_QMARK_TILDE_ABSENT         (1U<<31) /* (?~...) */
     584/* #define ONIG_SYN_OP2_OPTION_JAVA                (1U<<xx) */ /* (?idmsux), (?-idmsux) */ /* NOTIMPL */
    524585
    525586/* syntax (behavior) */
     
    536597#define ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY   (1U<<9)  /* a{n}?=(?:a{n})? */
    537598#define ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME_CALL (1U<<10)  /* (?<x>)(?<x>)(?&x) */
     599#define ONIG_SYN_USE_LEFT_MOST_NAMED_GROUP       (1U<<11) /* (?<x>)(?<x>)\k<x> */
    538600
    539601/* syntax (behavior) in char class [...] */
     
    545607#define ONIG_SYN_WARN_CC_OP_NOT_ESCAPED          (1U<<24) /* [,-,] */
    546608#define ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT    (1U<<25) /* (?:a*)+ */
     609#define ONIG_SYN_WARN_CC_DUP                     (1U<<26) /* [aa] */
    547610
    548611/* meta character specifiers (onig_set_meta_char()) */
     
    571634#define ONIGERR_UNEXPECTED_BYTECODE                           -14
    572635#define ONIGERR_MATCH_STACK_LIMIT_OVER                        -15
     636#define ONIGERR_PARSE_DEPTH_LIMIT_OVER                        -16
    573637#define ONIGERR_DEFAULT_ENCODING_IS_NOT_SET                   -21
    574638#define ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR  -22
     
    610674#define ONIGERR_INVALID_BACKREF                              -208
    611675#define ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED         -209
    612 #define ONIGERR_TOO_SHORT_DIGITS                             -210
     676#define ONIGERR_TOO_MANY_CAPTURE_GROUPS                      -210
     677#define ONIGERR_TOO_SHORT_DIGITS                             -211
    613678#define ONIGERR_TOO_LONG_WIDE_CHAR_VALUE                     -212
    614679#define ONIGERR_EMPTY_GROUP_NAME                             -214
     
    622687#define ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY        -222
    623688#define ONIGERR_INVALID_CHAR_PROPERTY_NAME                   -223
    624 #define ONIGERR_TOO_MANY_CAPTURE_GROUPS                      -224
    625689#define ONIGERR_INVALID_CODE_POINT_VALUE                     -400
    626690#define ONIGERR_INVALID_WIDE_CHAR_VALUE                      -400
     
    630694
    631695/* errors related to thread */
    632 #define ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT                -1001
     696/* #define ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT                -1001 */
    633697
    634698
     
    679743} OnigRepeatRange;
    680744
    681 typedef void (*OnigWarnFunc) P_((const char* s));
    682 extern void onig_null_warn P_((const char* s));
     745typedef void (*OnigWarnFunc)(const char* s);
     746extern void onig_null_warn(const char* s);
    683747#define ONIG_NULL_WARN       onig_null_warn
    684748
    685749#define ONIG_CHAR_TABLE_SIZE   256
    686 
    687 /* regex_t state */
    688 #define ONIG_STATE_NORMAL              0
    689 #define ONIG_STATE_SEARCHING           1
    690 #define ONIG_STATE_COMPILING          -1
    691 #define ONIG_STATE_MODIFY             -2
    692 
    693 #define ONIG_STATE(reg) \
    694   ((reg)->state > 0 ? ONIG_STATE_SEARCHING : (reg)->state)
    695750
    696751typedef struct re_pattern_buffer {
     
    700755  unsigned int alloc;       /* allocated space for p */
    701756
    702   int state;                     /* normal, searching, compiling */
    703757  int num_mem;                   /* used memory(...) num counted from 1 */
    704758  int num_repeat;                /* OP_REPEAT/OP_REPEAT_NG id-counter */
     
    711765  int stack_pop_level;
    712766  int repeat_range_alloc;
     767
     768  OnigOptionType    options;
     769
    713770  OnigRepeatRange* repeat_range;
    714771
    715772  OnigEncoding      enc;
    716   OnigOptionType    options;
    717   OnigSyntaxType*   syntax;
     773  const OnigSyntaxType* syntax;
     774  void*             name_table;
    718775  OnigCaseFoldType  case_fold_flag;
    719   void*             name_table;
    720776
    721777  /* optimization info (string search, char-map and anchors) */
     
    741797
    742798#ifndef ONIG_ESCAPE_REGEX_T_COLLISION
    743   typedef OnigRegexType  regex_t;
     799typedef OnigRegexType  regex_t;
    744800#endif
    745801
     
    749805  OnigEncoding    pattern_enc;
    750806  OnigEncoding    target_enc;
    751   OnigSyntaxType* syntax;
     807  const OnigSyntaxType* syntax;
    752808  OnigOptionType  option;
    753809  OnigCaseFoldType   case_fold_flag;
     
    756812/* Oniguruma Native API */
    757813ONIG_EXTERN
    758 int onig_init P_((void));
    759 ONIG_EXTERN
    760 int onig_error_code_to_str PV_((OnigUChar* s, OnigPosition err_code, ...));
    761 ONIG_EXTERN
    762 void onig_set_warn_func P_((OnigWarnFunc f));
    763 ONIG_EXTERN
    764 void onig_set_verb_warn_func P_((OnigWarnFunc f));
    765 ONIG_EXTERN
    766 int onig_new P_((OnigRegex*, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
    767 ONIG_EXTERN
    768 int onig_reg_init P_((OnigRegex reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, OnigSyntaxType* syntax));
    769 ONIG_EXTERN
    770 int onig_new_without_alloc P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
    771 ONIG_EXTERN
    772 int onig_new_deluxe P_((OnigRegex* reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo));
    773 ONIG_EXTERN
    774 void onig_free P_((OnigRegex));
    775 ONIG_EXTERN
    776 void onig_free_body P_((OnigRegex));
    777 ONIG_EXTERN
    778 int onig_recompile P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
    779 ONIG_EXTERN
    780 int onig_recompile_deluxe P_((OnigRegex reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo));
    781 ONIG_EXTERN
    782 OnigPosition onig_search P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option));
    783 ONIG_EXTERN
    784 OnigPosition onig_search_gpos P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* global_pos, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option));
    785 ONIG_EXTERN
    786 OnigPosition onig_match P_((OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option));
    787 ONIG_EXTERN
    788 OnigRegion* onig_region_new P_((void));
    789 ONIG_EXTERN
    790 void onig_region_init P_((OnigRegion* region));
    791 ONIG_EXTERN
    792 void onig_region_free P_((OnigRegion* region, int free_self));
    793 ONIG_EXTERN
    794 void onig_region_copy P_((OnigRegion* to, OnigRegion* from));
    795 ONIG_EXTERN
    796 void onig_region_clear P_((OnigRegion* region));
    797 ONIG_EXTERN
    798 int onig_region_resize P_((OnigRegion* region, int n));
    799 ONIG_EXTERN
    800 int onig_region_set P_((OnigRegion* region, int at, int beg, int end));
    801 ONIG_EXTERN
    802 int onig_name_to_group_numbers P_((OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, int** nums));
    803 ONIG_EXTERN
    804 int onig_name_to_backref_number P_((OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, OnigRegion *region));
    805 ONIG_EXTERN
    806 int onig_foreach_name P_((OnigRegex reg, int (*func)(const OnigUChar*, const OnigUChar*,int,int*,OnigRegex,void*), void* arg));
    807 ONIG_EXTERN
    808 int onig_number_of_names P_((OnigRegex reg));
    809 ONIG_EXTERN
    810 int onig_number_of_captures P_((OnigRegex reg));
    811 ONIG_EXTERN
    812 int onig_number_of_capture_histories P_((OnigRegex reg));
    813 ONIG_EXTERN
    814 OnigCaptureTreeNode* onig_get_capture_tree P_((OnigRegion* region));
    815 ONIG_EXTERN
    816 int onig_capture_tree_traverse P_((OnigRegion* region, int at, int(*callback_func)(int,OnigPosition,OnigPosition,int,int,void*), void* arg));
    817 ONIG_EXTERN
    818 int onig_noname_group_capture_is_active P_((OnigRegex reg));
    819 ONIG_EXTERN
    820 OnigEncoding onig_get_encoding P_((OnigRegex reg));
    821 ONIG_EXTERN
    822 OnigOptionType onig_get_options P_((OnigRegex reg));
    823 ONIG_EXTERN
    824 OnigCaseFoldType onig_get_case_fold_flag P_((OnigRegex reg));
    825 ONIG_EXTERN
    826 OnigSyntaxType* onig_get_syntax P_((OnigRegex reg));
    827 ONIG_EXTERN
    828 int onig_set_default_syntax P_((OnigSyntaxType* syntax));
    829 ONIG_EXTERN
    830 void onig_copy_syntax P_((OnigSyntaxType* to, const OnigSyntaxType* from));
    831 ONIG_EXTERN
    832 unsigned int onig_get_syntax_op P_((OnigSyntaxType* syntax));
    833 ONIG_EXTERN
    834 unsigned int onig_get_syntax_op2 P_((OnigSyntaxType* syntax));
    835 ONIG_EXTERN
    836 unsigned int onig_get_syntax_behavior P_((OnigSyntaxType* syntax));
    837 ONIG_EXTERN
    838 OnigOptionType onig_get_syntax_options P_((OnigSyntaxType* syntax));
    839 ONIG_EXTERN
    840 void onig_set_syntax_op P_((OnigSyntaxType* syntax, unsigned int op));
    841 ONIG_EXTERN
    842 void onig_set_syntax_op2 P_((OnigSyntaxType* syntax, unsigned int op2));
    843 ONIG_EXTERN
    844 void onig_set_syntax_behavior P_((OnigSyntaxType* syntax, unsigned int behavior));
    845 ONIG_EXTERN
    846 void onig_set_syntax_options P_((OnigSyntaxType* syntax, OnigOptionType options));
    847 ONIG_EXTERN
    848 int onig_set_meta_char P_((OnigSyntaxType* syntax, unsigned int what, OnigCodePoint code));
    849 ONIG_EXTERN
    850 void onig_copy_encoding P_((OnigEncoding to, OnigEncoding from));
    851 ONIG_EXTERN
    852 OnigCaseFoldType onig_get_default_case_fold_flag P_((void));
    853 ONIG_EXTERN
    854 int onig_set_default_case_fold_flag P_((OnigCaseFoldType case_fold_flag));
    855 ONIG_EXTERN
    856 unsigned int onig_get_match_stack_limit_size P_((void));
    857 ONIG_EXTERN
    858 int onig_set_match_stack_limit_size P_((unsigned int size));
    859 ONIG_EXTERN
    860 int onig_end P_((void));
    861 ONIG_EXTERN
    862 const char* onig_version P_((void));
    863 ONIG_EXTERN
    864 const char* onig_copyright P_((void));
     814int onig_initialize(OnigEncoding encodings[], int n);
     815ONIG_EXTERN
     816int onig_init(void);
     817ONIG_EXTERN
     818int onig_error_code_to_str(OnigUChar* s, OnigPosition err_code, ...);
     819ONIG_EXTERN
     820void onig_set_warn_func(OnigWarnFunc f);
     821ONIG_EXTERN
     822void onig_set_verb_warn_func(OnigWarnFunc f);
     823ONIG_EXTERN
     824int onig_new(OnigRegex*, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, const OnigSyntaxType* syntax, OnigErrorInfo* einfo);
     825ONIG_EXTERN
     826int onig_reg_init(OnigRegex reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, const OnigSyntaxType* syntax);
     827ONIG_EXTERN
     828int onig_new_without_alloc(OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, const OnigSyntaxType* syntax, OnigErrorInfo* einfo);
     829ONIG_EXTERN
     830int onig_new_deluxe(OnigRegex* reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo);
     831ONIG_EXTERN
     832void onig_free(OnigRegex);
     833ONIG_EXTERN
     834void onig_free_body(OnigRegex);
     835ONIG_EXTERN
     836OnigPosition onig_scan(OnigRegex reg, const OnigUChar* str, const OnigUChar* end, OnigRegion* region, OnigOptionType option, int (*scan_callback)(OnigPosition, OnigPosition, OnigRegion*, void*), void* callback_arg);
     837ONIG_EXTERN
     838OnigPosition onig_search(OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option);
     839ONIG_EXTERN
     840OnigPosition onig_search_gpos(OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* global_pos, const OnigUChar* start, const OnigUChar* range, OnigRegion* region, OnigOptionType option);
     841ONIG_EXTERN
     842OnigPosition onig_match(OnigRegex, const OnigUChar* str, const OnigUChar* end, const OnigUChar* at, OnigRegion* region, OnigOptionType option);
     843ONIG_EXTERN
     844OnigRegion* onig_region_new(void);
     845ONIG_EXTERN
     846void onig_region_init(OnigRegion* region);
     847ONIG_EXTERN
     848void onig_region_free(OnigRegion* region, int free_self);
     849ONIG_EXTERN
     850void onig_region_copy(OnigRegion* to, const OnigRegion* from);
     851ONIG_EXTERN
     852void onig_region_clear(OnigRegion* region);
     853ONIG_EXTERN
     854int onig_region_resize(OnigRegion* region, int n);
     855ONIG_EXTERN
     856int onig_region_set(OnigRegion* region, int at, int beg, int end);
     857ONIG_EXTERN
     858int onig_name_to_group_numbers(OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, int** nums);
     859ONIG_EXTERN
     860int onig_name_to_backref_number(OnigRegex reg, const OnigUChar* name, const OnigUChar* name_end, const OnigRegion *region);
     861ONIG_EXTERN
     862int onig_foreach_name(OnigRegex reg, int (*func)(const OnigUChar*, const OnigUChar*,int,int*,OnigRegex,void*), void* arg);
     863ONIG_EXTERN
     864int onig_number_of_names(const OnigRegexType *reg);
     865ONIG_EXTERN
     866int onig_number_of_captures(const OnigRegexType *reg);
     867ONIG_EXTERN
     868int onig_number_of_capture_histories(const OnigRegexType *reg);
     869ONIG_EXTERN
     870OnigCaptureTreeNode* onig_get_capture_tree(OnigRegion* region);
     871ONIG_EXTERN
     872int onig_capture_tree_traverse(OnigRegion* region, int at, int(*callback_func)(int,OnigPosition,OnigPosition,int,int,void*), void* arg);
     873ONIG_EXTERN
     874int onig_noname_group_capture_is_active(const OnigRegexType *reg);
     875ONIG_EXTERN
     876OnigEncoding onig_get_encoding(const OnigRegexType *reg);
     877ONIG_EXTERN
     878OnigOptionType onig_get_options(const OnigRegexType *reg);
     879ONIG_EXTERN
     880OnigCaseFoldType onig_get_case_fold_flag(const OnigRegexType *reg);
     881ONIG_EXTERN
     882const OnigSyntaxType* onig_get_syntax(const OnigRegexType *reg);
     883ONIG_EXTERN
     884int onig_set_default_syntax(const OnigSyntaxType* syntax);
     885ONIG_EXTERN
     886void onig_copy_syntax(OnigSyntaxType* to, const OnigSyntaxType* from);
     887ONIG_EXTERN
     888unsigned int onig_get_syntax_op(const OnigSyntaxType* syntax);
     889ONIG_EXTERN
     890unsigned int onig_get_syntax_op2(const OnigSyntaxType* syntax);
     891ONIG_EXTERN
     892unsigned int onig_get_syntax_behavior(const OnigSyntaxType* syntax);
     893ONIG_EXTERN
     894OnigOptionType onig_get_syntax_options(const OnigSyntaxType* syntax);
     895ONIG_EXTERN
     896void onig_set_syntax_op(OnigSyntaxType* syntax, unsigned int op);
     897ONIG_EXTERN
     898void onig_set_syntax_op2(OnigSyntaxType* syntax, unsigned int op2);
     899ONIG_EXTERN
     900void onig_set_syntax_behavior(OnigSyntaxType* syntax, unsigned int behavior);
     901ONIG_EXTERN
     902void onig_set_syntax_options(OnigSyntaxType* syntax, OnigOptionType options);
     903ONIG_EXTERN
     904int onig_set_meta_char(OnigSyntaxType* syntax, unsigned int what, OnigCodePoint code);
     905ONIG_EXTERN
     906void onig_copy_encoding(OnigEncodingType *to, OnigEncoding from);
     907ONIG_EXTERN
     908OnigCaseFoldType onig_get_default_case_fold_flag(void);
     909ONIG_EXTERN
     910int onig_set_default_case_fold_flag(OnigCaseFoldType case_fold_flag);
     911ONIG_EXTERN
     912unsigned int onig_get_match_stack_limit_size(void);
     913ONIG_EXTERN
     914int onig_set_match_stack_limit_size(unsigned int size);
     915ONIG_EXTERN
     916unsigned int onig_get_parse_depth_limit(void);
     917ONIG_EXTERN
     918int onig_set_parse_depth_limit(unsigned int depth);
     919ONIG_EXTERN
     920int onig_end(void);
     921ONIG_EXTERN
     922const char* onig_version(void);
     923ONIG_EXTERN
     924const char* onig_copyright(void);
     925
     926RUBY_SYMBOL_EXPORT_END
    865927
    866928#ifdef __cplusplus
     929# if 0
     930{ /* satisfy cc-mode */
     931# endif
    867932}
    868933#endif
    869934
    870 #endif /* ONIGURUMA_H */
     935#endif /* ONIGMO_H */
Note: See TracChangeset for help on using the changeset viewer.