⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oniguruma.h

📁 Mac OS X 平台一文本编辑器的源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
#ifndef ONIGURUMA_H#define ONIGURUMA_H/**********************************************************************  oniguruma.h - Oniguruma (regular expression library)**********************************************************************//*- * Copyright (c) 2002-2006  K.Kosako  <sndgk393 AT ybb DOT ne DOT jp> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */#ifdef __cplusplusextern "C" {#endif#define ONIGURUMA#define ONIGURUMA_VERSION_MAJOR   4#define ONIGURUMA_VERSION_MINOR   0#define ONIGURUMA_VERSION_TEENY   1#ifdef __cplusplus# ifndef  HAVE_PROTOTYPES#  define HAVE_PROTOTYPES 1# endif# ifndef  HAVE_STDARG_PROTOTYPES#  define HAVE_STDARG_PROTOTYPES 1# endif#endif#ifndef P_#if defined(__STDC__) || defined(_WIN32)# define P_(args) args#else# define P_(args) ()#endif#endif#ifndef PV_#ifdef HAVE_STDARG_PROTOTYPES# define PV_(args) args#else# define PV_(args) ()#endif#endif#ifndef ONIG_EXTERN#if defined(_WIN32) && !defined(__GNUC__)#if defined(EXPORT) || defined(RUBY_EXPORT)#define ONIG_EXTERN   extern __declspec(dllexport)#else#define ONIG_EXTERN   extern __declspec(dllimport)#endif#endif#endif#ifndef ONIG_EXTERN#define ONIG_EXTERN   extern#endif/* PART: character encoding */#ifndef ONIG_ESCAPE_UCHAR_COLLISION#define UChar OnigUChar#endiftypedef unsigned char  OnigUChar;typedef unsigned long  OnigCodePoint;typedef unsigned int   OnigDistance;#define ONIG_INFINITE_DISTANCE  ~((OnigDistance )0)/* ambiguous match flag */typedef unsigned int OnigAmbigType;ONIG_EXTERN OnigAmbigType OnigDefaultAmbigFlag;#define ONIGENC_AMBIGUOUS_MATCH_NONE                   0#define ONIGENC_AMBIGUOUS_MATCH_ASCII_CASE            (1<<0)#define ONIGENC_AMBIGUOUS_MATCH_NONASCII_CASE         (1<<1)/* #define ONIGENC_AMBIGUOUS_MATCH_ACCENT             (1<<2) *//* #define ONIGENC_AMBIGUOUS_MATCH_HIRAGANA_KATAKANA  (1<<3) *//* #define ONIGENC_AMBIGUOUS_MATCH_KATAKANA_WIDTH     (1<<4) */#define ONIGENC_AMBIGUOUS_MATCH_LIMIT                 (1<<1)#define ONIGENC_AMBIGUOUS_MATCH_COMPOUND              (1<<30)#define ONIGENC_AMBIGUOUS_MATCH_FULL \  ( ONIGENC_AMBIGUOUS_MATCH_ASCII_CASE | \    ONIGENC_AMBIGUOUS_MATCH_NONASCII_CASE | \    ONIGENC_AMBIGUOUS_MATCH_COMPOUND )#define ONIGENC_AMBIGUOUS_MATCH_DEFAULT  OnigDefaultAmbigFlag#define ONIGENC_MAX_COMP_AMBIG_CODE_LEN       3#define ONIGENC_MAX_COMP_AMBIG_CODE_ITEM_NUM  4/* code range */#define ONIGENC_CODE_RANGE_NUM(range)     ((int )range[0])#define ONIGENC_CODE_RANGE_FROM(range,i)  range[((i)*2) + 1]#define ONIGENC_CODE_RANGE_TO(range,i)    range[((i)*2) + 2]typedef struct {  int len;  OnigCodePoint code[ONIGENC_MAX_COMP_AMBIG_CODE_LEN];} OnigCompAmbigCodeItem;typedef struct {  int n;  OnigCodePoint code;  OnigCompAmbigCodeItem items[ONIGENC_MAX_COMP_AMBIG_CODE_ITEM_NUM];} OnigCompAmbigCodes;typedef struct {  OnigCodePoint from;  OnigCodePoint to;} OnigPairAmbigCodes;typedef struct {  OnigCodePoint esc;  OnigCodePoint anychar;  OnigCodePoint anytime;  OnigCodePoint zero_or_one_time;  OnigCodePoint one_or_more_time;  OnigCodePoint anychar_anytime;} OnigMetaCharTableType;#if defined(RUBY_PLATFORM) && defined(M17N_H)#define ONIG_RUBY_M17Ntypedef m17n_encoding*        OnigEncoding;#elsetypedef struct {  int    (*mbc_enc_len)(const OnigUChar* p);  const char*   name;  int           max_enc_len;  int           min_enc_len;  OnigAmbigType support_ambig_flag;  OnigMetaCharTableType meta_char_table;  int    (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end);  OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end);  int    (*code_to_mbclen)(OnigCodePoint code);  int    (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf);  int    (*mbc_to_normalize)(OnigAmbigType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to);  int    (*is_mbc_ambiguous)(OnigAmbigType flag, const OnigUChar** pp, const OnigUChar* end);  int    (*get_all_pair_ambig_codes)(OnigAmbigType flag, const OnigPairAmbigCodes** acs);  int    (*get_all_comp_ambig_codes)(OnigAmbigType flag, const OnigCompAmbigCodes** acs);  int    (*is_code_ctype)(OnigCodePoint code, unsigned int ctype);  int    (*get_ctype_code_range)(int ctype, const OnigCodePoint* sb_range[], const OnigCodePoint* mb_range[]);  OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p);  int    (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end);} OnigEncodingType;typedef OnigEncodingType* OnigEncoding;ONIG_EXTERN OnigEncodingType OnigEncodingASCII;ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_1;ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_2;ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_3;ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_4;ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_5;ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_6;ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_7;ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_8;ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_9;ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_10;ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_11;ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_13;ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_14;ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_15;ONIG_EXTERN OnigEncodingType OnigEncodingISO_8859_16;ONIG_EXTERN OnigEncodingType OnigEncodingUTF8;ONIG_EXTERN OnigEncodingType OnigEncodingUTF16_BE;ONIG_EXTERN OnigEncodingType OnigEncodingUTF16_LE;ONIG_EXTERN OnigEncodingType OnigEncodingUTF32_BE;ONIG_EXTERN OnigEncodingType OnigEncodingUTF32_LE;ONIG_EXTERN OnigEncodingType OnigEncodingEUC_JP;ONIG_EXTERN OnigEncodingType OnigEncodingEUC_TW;ONIG_EXTERN OnigEncodingType OnigEncodingEUC_KR;ONIG_EXTERN OnigEncodingType OnigEncodingEUC_CN;ONIG_EXTERN OnigEncodingType OnigEncodingSJIS;ONIG_EXTERN OnigEncodingType OnigEncodingKOI8;ONIG_EXTERN OnigEncodingType OnigEncodingKOI8_R;ONIG_EXTERN OnigEncodingType OnigEncodingBIG5;ONIG_EXTERN OnigEncodingType OnigEncodingGB18030;#define ONIG_ENCODING_ASCII        (&OnigEncodingASCII)#define ONIG_ENCODING_ISO_8859_1   (&OnigEncodingISO_8859_1)#define ONIG_ENCODING_ISO_8859_2   (&OnigEncodingISO_8859_2)#define ONIG_ENCODING_ISO_8859_3   (&OnigEncodingISO_8859_3)#define ONIG_ENCODING_ISO_8859_4   (&OnigEncodingISO_8859_4)#define ONIG_ENCODING_ISO_8859_5   (&OnigEncodingISO_8859_5)#define ONIG_ENCODING_ISO_8859_6   (&OnigEncodingISO_8859_6)#define ONIG_ENCODING_ISO_8859_7   (&OnigEncodingISO_8859_7)#define ONIG_ENCODING_ISO_8859_8   (&OnigEncodingISO_8859_8)#define ONIG_ENCODING_ISO_8859_9   (&OnigEncodingISO_8859_9)#define ONIG_ENCODING_ISO_8859_10  (&OnigEncodingISO_8859_10)#define ONIG_ENCODING_ISO_8859_11  (&OnigEncodingISO_8859_11)#define ONIG_ENCODING_ISO_8859_13  (&OnigEncodingISO_8859_13)#define ONIG_ENCODING_ISO_8859_14  (&OnigEncodingISO_8859_14)#define ONIG_ENCODING_ISO_8859_15  (&OnigEncodingISO_8859_15)#define ONIG_ENCODING_ISO_8859_16  (&OnigEncodingISO_8859_16)#define ONIG_ENCODING_UTF8         (&OnigEncodingUTF8)#define ONIG_ENCODING_UTF16_BE     (&OnigEncodingUTF16_BE)#define ONIG_ENCODING_UTF16_LE     (&OnigEncodingUTF16_LE)#define ONIG_ENCODING_UTF32_BE     (&OnigEncodingUTF32_BE)#define ONIG_ENCODING_UTF32_LE     (&OnigEncodingUTF32_LE)#define ONIG_ENCODING_EUC_JP       (&OnigEncodingEUC_JP)#define ONIG_ENCODING_EUC_TW       (&OnigEncodingEUC_TW)#define ONIG_ENCODING_EUC_KR       (&OnigEncodingEUC_KR)#define ONIG_ENCODING_EUC_CN       (&OnigEncodingEUC_CN)#define ONIG_ENCODING_SJIS         (&OnigEncodingSJIS)#define ONIG_ENCODING_KOI8         (&OnigEncodingKOI8)#define ONIG_ENCODING_KOI8_R       (&OnigEncodingKOI8_R)#define ONIG_ENCODING_BIG5         (&OnigEncodingBIG5)#define ONIG_ENCODING_GB18030      (&OnigEncodingGB18030)#endif /* else RUBY && M17N */#define ONIG_ENCODING_UNDEF    ((OnigEncoding )0)/* work size */#define ONIGENC_CODE_TO_MBC_MAXLEN      7#define ONIGENC_MBC_NORMALIZE_MAXLEN    ONIGENC_CODE_TO_MBC_MAXLEN/* character types */#define ONIGENC_CTYPE_NEWLINE  (1<< 0)#define ONIGENC_CTYPE_ALPHA    (1<< 1)#define ONIGENC_CTYPE_BLANK    (1<< 2)#define ONIGENC_CTYPE_CNTRL    (1<< 3)#define ONIGENC_CTYPE_DIGIT    (1<< 4)#define ONIGENC_CTYPE_GRAPH    (1<< 5)#define ONIGENC_CTYPE_LOWER    (1<< 6)#define ONIGENC_CTYPE_PRINT    (1<< 7)#define ONIGENC_CTYPE_PUNCT    (1<< 8)#define ONIGENC_CTYPE_SPACE    (1<< 9)#define ONIGENC_CTYPE_UPPER    (1<<10)#define ONIGENC_CTYPE_XDIGIT   (1<<11)#define ONIGENC_CTYPE_WORD     (1<<12)#define ONIGENC_CTYPE_ASCII    (1<<13)#define ONIGENC_CTYPE_ALNUM    (ONIGENC_CTYPE_ALPHA | ONIGENC_CTYPE_DIGIT)#define enc_len(enc,p)                ONIGENC_MBC_ENC_LEN(enc, p)#define ONIGENC_IS_UNDEF(enc)          ((enc) == ONIG_ENCODING_UNDEF)#define ONIGENC_IS_SINGLEBYTE(enc)     (ONIGENC_MBC_MAXLEN(enc) == 1)#define ONIGENC_IS_MBC_HEAD(enc,p)     (ONIGENC_MBC_ENC_LEN(enc,p) != 1)#define ONIGENC_IS_MBC_ASCII(p)           (*(p)   < 128)#define ONIGENC_IS_CODE_ASCII(code)       ((code) < 128)#define ONIGENC_IS_CODE_SB_WORD(enc,code) \  (ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_WORD(enc,code))#define ONIGENC_IS_MBC_WORD(enc,s,end) \   ONIGENC_IS_CODE_WORD(enc,ONIGENC_MBC_TO_CODE(enc,s,end))#ifdef ONIG_RUBY_M17N#include <ctype.h> /* for isblank(), isgraph() */#define ONIGENC_MBC_TO_NORMALIZE(enc,flag,pp,end,buf) \        onigenc_mbc_to_normalize(enc,flag,pp,end,buf)#define ONIGENC_IS_MBC_AMBIGUOUS(enc,flag,pp,end) \        onigenc_is_mbc_ambiguous(enc,flag,pp,end)#define ONIGENC_SUPPORT_AMBIG_FLAG(enc)     ONIGENC_AMBIGUOUS_MATCH_ASCII_CASE#define ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc,s,end) \        onigenc_is_allowed_reverse_match(enc, s, end)#define ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc,start,s) \        onigenc_get_left_adjust_char_head(enc, start, s)#define ONIGENC_GET_ALL_PAIR_AMBIG_CODES(enc, ambig_flag, acs)    0#define ONIGENC_GET_ALL_COMP_AMBIG_CODES(enc, ambig_flag, acs)    0#define ONIGENC_GET_CTYPE_CODE_RANGE(enc,ctype,sbr,mbr) \        ONIG_NO_SUPPORT_CONFIG#define ONIGENC_MBC_ENC_LEN(enc,p)            m17n_mbclen(enc,(int )(*p))#define ONIGENC_MBC_MAXLEN(enc)               m17n_mbmaxlen(enc)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -