]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regenc.h
MdeModulePkg: Regular expression protocol
[mirror_edk2.git] / MdeModulePkg / Universal / RegularExpressionDxe / Oniguruma / regenc.h
diff --git a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regenc.h b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/regenc.h
new file mode 100644 (file)
index 0000000..1d39f9c
--- /dev/null
@@ -0,0 +1,189 @@
+#ifndef REGENC_H\r
+#define REGENC_H\r
+/**********************************************************************\r
+  regenc.h -  Oniguruma (regular expression library)\r
+**********************************************************************/\r
+/*-\r
+ * Copyright (c) 2002-2008  K.Kosako  <sndgk393 AT ybb DOT ne DOT jp>\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ *    notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ *    notice, this list of conditions and the following disclaimer in the\r
+ *    documentation and/or other materials provided with the distribution.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ */\r
+\r
+#ifndef PACKAGE\r
+/* PACKAGE is defined in config.h */\r
+//#include "config.h"\r
+#endif\r
+\r
+#ifdef ONIG_ESCAPE_UCHAR_COLLISION\r
+#undef ONIG_ESCAPE_UCHAR_COLLISION\r
+#endif\r
+\r
+#include "oniguruma.h"\r
+\r
+typedef struct {\r
+  OnigCodePoint from;\r
+  OnigCodePoint to;\r
+} OnigPairCaseFoldCodes;\r
+\r
+\r
+#ifndef NULL\r
+#define NULL   ((void* )0)\r
+#endif\r
+\r
+#ifndef TRUE\r
+#define TRUE    1\r
+#endif\r
+\r
+#ifndef FALSE\r
+#define FALSE   0\r
+#endif\r
+\r
+#ifndef ARG_UNUSED\r
+#if defined(__GNUC__)\r
+#  define ARG_UNUSED  __attribute__ ((unused))\r
+#else\r
+#  define ARG_UNUSED\r
+#endif\r
+#endif\r
+\r
+#define ONIG_IS_NULL(p)                    (((void*)(p)) == (void*)0)\r
+#define ONIG_IS_NOT_NULL(p)                (((void*)(p)) != (void*)0)\r
+#define ONIG_CHECK_NULL_RETURN(p)          if (ONIG_IS_NULL(p)) return NULL\r
+#define ONIG_CHECK_NULL_RETURN_VAL(p,val)  if (ONIG_IS_NULL(p)) return (val)\r
+\r
+#define enclen(enc,p)      ONIGENC_MBC_ENC_LEN(enc,p)\r
+\r
+/* character types bit flag */\r
+#define BIT_CTYPE_NEWLINE  (1<< ONIGENC_CTYPE_NEWLINE)\r
+#define BIT_CTYPE_ALPHA    (1<< ONIGENC_CTYPE_ALPHA)\r
+#define BIT_CTYPE_BLANK    (1<< ONIGENC_CTYPE_BLANK)\r
+#define BIT_CTYPE_CNTRL    (1<< ONIGENC_CTYPE_CNTRL)\r
+#define BIT_CTYPE_DIGIT    (1<< ONIGENC_CTYPE_DIGIT)\r
+#define BIT_CTYPE_GRAPH    (1<< ONIGENC_CTYPE_GRAPH)\r
+#define BIT_CTYPE_LOWER    (1<< ONIGENC_CTYPE_LOWER)\r
+#define BIT_CTYPE_PRINT    (1<< ONIGENC_CTYPE_PRINT)\r
+#define BIT_CTYPE_PUNCT    (1<< ONIGENC_CTYPE_PUNCT)\r
+#define BIT_CTYPE_SPACE    (1<< ONIGENC_CTYPE_SPACE)\r
+#define BIT_CTYPE_UPPER    (1<< ONIGENC_CTYPE_UPPER)\r
+#define BIT_CTYPE_XDIGIT   (1<< ONIGENC_CTYPE_XDIGIT)\r
+#define BIT_CTYPE_WORD     (1<< ONIGENC_CTYPE_WORD)\r
+#define BIT_CTYPE_ALNUM    (1<< ONIGENC_CTYPE_ALNUM)\r
+#define BIT_CTYPE_ASCII    (1<< ONIGENC_CTYPE_ASCII)\r
+\r
+#define CTYPE_TO_BIT(ctype)  (1<<(ctype))\r
+#define CTYPE_IS_WORD_GRAPH_PRINT(ctype) \\r
+  ((ctype) == ONIGENC_CTYPE_WORD || (ctype) == ONIGENC_CTYPE_GRAPH ||\\r
+   (ctype) == ONIGENC_CTYPE_PRINT)\r
+\r
+\r
+typedef struct {\r
+  UChar    *name;\r
+  int       ctype;\r
+  short int len;\r
+} PosixBracketEntryType;\r
+\r
+\r
+/* #define USE_CRNL_AS_LINE_TERMINATOR */\r
+#define USE_UNICODE_PROPERTIES\r
+/* #define USE_UNICODE_CASE_FOLD_TURKISH_AZERI */\r
+/* #define USE_UNICODE_ALL_LINE_TERMINATORS */  /* see Unicode.org UTF#18 */\r
+\r
+\r
+#define ONIG_ENCODING_INIT_DEFAULT           ONIG_ENCODING_ASCII\r
+\r
+/* for encoding system implementation (internal) */\r
+ONIG_EXTERN int onigenc_ascii_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg));\r
+ONIG_EXTERN int onigenc_ascii_get_case_fold_codes_by_str P_((OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]));\r
+ONIG_EXTERN int onigenc_apply_all_case_fold_with_map P_((int map_size, const OnigPairCaseFoldCodes map[], int ess_tsett_flag, OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg));\r
+ONIG_EXTERN int onigenc_get_case_fold_codes_by_str_with_map P_((int map_size, const OnigPairCaseFoldCodes map[], int ess_tsett_flag, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]));\r
+ONIG_EXTERN int onigenc_not_support_get_ctype_code_range P_((OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[]));\r
+ONIG_EXTERN int onigenc_is_mbc_newline_0x0a P_((const UChar* p, const UChar* end));\r
+\r
+\r
+/* methods for single byte encoding */\r
+ONIG_EXTERN int onigenc_ascii_mbc_case_fold P_((OnigCaseFoldType flag, const UChar** p, const UChar* end, UChar* lower));\r
+ONIG_EXTERN int onigenc_single_byte_mbc_enc_len P_((const UChar* p));\r
+ONIG_EXTERN OnigCodePoint onigenc_single_byte_mbc_to_code P_((const UChar* p, const UChar* end));\r
+ONIG_EXTERN int onigenc_single_byte_code_to_mbclen P_((OnigCodePoint code));\r
+ONIG_EXTERN int onigenc_single_byte_code_to_mbc P_((OnigCodePoint code, UChar *buf));\r
+ONIG_EXTERN UChar* onigenc_single_byte_left_adjust_char_head P_((const UChar* start, const UChar* s));\r
+ONIG_EXTERN int onigenc_always_true_is_allowed_reverse_match P_((const UChar* s, const UChar* end));\r
+ONIG_EXTERN int onigenc_always_false_is_allowed_reverse_match P_((const UChar* s, const UChar* end));\r
+\r
+/* methods for multi byte encoding */\r
+ONIG_EXTERN OnigCodePoint onigenc_mbn_mbc_to_code P_((OnigEncoding enc, const UChar* p, const UChar* end));\r
+ONIG_EXTERN int onigenc_mbn_mbc_case_fold P_((OnigEncoding enc, OnigCaseFoldType flag, const UChar** p, const UChar* end, UChar* lower));\r
+ONIG_EXTERN int onigenc_mb2_code_to_mbclen P_((OnigCodePoint code));\r
+ONIG_EXTERN int onigenc_mb2_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));\r
+ONIG_EXTERN int onigenc_minimum_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end));\r
+ONIG_EXTERN int onigenc_unicode_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end));\r
+ONIG_EXTERN int onigenc_mb2_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));\r
+ONIG_EXTERN int onigenc_mb4_code_to_mbclen P_((OnigCodePoint code));\r
+ONIG_EXTERN int onigenc_mb4_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));\r
+ONIG_EXTERN int onigenc_mb4_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));\r
+\r
+\r
+/* in enc/unicode.c */\r
+ONIG_EXTERN int onigenc_unicode_is_code_ctype P_((OnigCodePoint code, unsigned int ctype));\r
+ONIG_EXTERN int onigenc_utf16_32_get_ctype_code_range P_((OnigCtype ctype, OnigCodePoint *sb_out, const OnigCodePoint* ranges[]));\r
+ONIG_EXTERN int onigenc_unicode_ctype_code_range P_((int ctype, const OnigCodePoint* ranges[]));\r
+ONIG_EXTERN int onigenc_unicode_get_case_fold_codes_by_str P_((OnigEncoding enc, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]));\r
+ONIG_EXTERN int onigenc_unicode_mbc_case_fold P_((OnigEncoding enc, OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* fold));\r
+ONIG_EXTERN int onigenc_unicode_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg));\r
+\r
+\r
+#define UTF16_IS_SURROGATE_FIRST(c)    (((c) & 0xfc) == 0xd8)\r
+#define UTF16_IS_SURROGATE_SECOND(c)   (((c) & 0xfc) == 0xdc)\r
+\r
+#define ONIGENC_ISO_8859_1_TO_LOWER_CASE(c) \\r
+  OnigEncISO_8859_1_ToLowerCaseTable[c]\r
+#define ONIGENC_ISO_8859_1_TO_UPPER_CASE(c) \\r
+  OnigEncISO_8859_1_ToUpperCaseTable[c]\r
+\r
+ONIG_EXTERN const UChar OnigEncISO_8859_1_ToLowerCaseTable[];\r
+ONIG_EXTERN const UChar OnigEncISO_8859_1_ToUpperCaseTable[];\r
+\r
+ONIG_EXTERN int\r
+onigenc_with_ascii_strncmp P_((OnigEncoding enc, const UChar* p, const UChar* end, const UChar* sascii /* ascii */, int n));\r
+ONIG_EXTERN UChar*\r
+onigenc_step P_((OnigEncoding enc, const UChar* p, const UChar* end, int n));\r
+\r
+/* defined in regexec.c, but used in enc/xxx.c */\r
+extern int  onig_is_in_code_range P_((const UChar* p, OnigCodePoint code));\r
+\r
+ONIG_EXTERN OnigEncoding  OnigEncDefaultCharEncoding;\r
+ONIG_EXTERN const UChar  OnigEncAsciiToLowerCaseTable[];\r
+ONIG_EXTERN const UChar  OnigEncAsciiToUpperCaseTable[];\r
+ONIG_EXTERN const unsigned short OnigEncAsciiCtypeTable[];\r
+\r
+#define ONIGENC_IS_ASCII_CODE(code)  ((code) < 0x80)\r
+#define ONIGENC_ASCII_CODE_TO_LOWER_CASE(c) OnigEncAsciiToLowerCaseTable[c]\r
+#define ONIGENC_ASCII_CODE_TO_UPPER_CASE(c) OnigEncAsciiToUpperCaseTable[c]\r
+#define ONIGENC_IS_ASCII_CODE_CTYPE(code,ctype) \\r
+  ((OnigEncAsciiCtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)\r
+#define ONIGENC_IS_ASCII_CODE_CASE_AMBIG(code) \\r
+ (ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_UPPER) ||\\r
+  ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_LOWER))\r
+   \r
+\r
+#endif /* REGENC_H */\r