]>
Commit | Line | Data |
---|---|---|
14b0e578 CS |
1 | #ifndef ONIGPOSIX_H\r |
2 | #define ONIGPOSIX_H\r | |
3 | /**********************************************************************\r | |
4 | onigposix.h - Oniguruma (regular expression library)\r | |
5 | **********************************************************************/\r | |
6 | /*-\r | |
b602265d | 7 | * Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>\r |
14b0e578 CS |
8 | * All rights reserved.\r |
9 | *\r | |
10 | * Redistribution and use in source and binary forms, with or without\r | |
11 | * modification, are permitted provided that the following conditions\r | |
12 | * are met:\r | |
13 | * 1. Redistributions of source code must retain the above copyright\r | |
14 | * notice, this list of conditions and the following disclaimer.\r | |
15 | * 2. Redistributions in binary form must reproduce the above copyright\r | |
16 | * notice, this list of conditions and the following disclaimer in the\r | |
17 | * documentation and/or other materials provided with the distribution.\r | |
18 | *\r | |
19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\r | |
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r | |
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r | |
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\r | |
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r | |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r | |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r | |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r | |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r | |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r | |
29 | * SUCH DAMAGE.\r | |
30 | */\r | |
31 | #include "OnigurumaUefiPort.h"\r | |
32 | \r | |
33 | #ifdef __cplusplus\r | |
34 | extern "C" {\r | |
35 | #endif\r | |
36 | \r | |
37 | /* options */\r | |
38 | #define REG_ICASE (1<<0)\r | |
39 | #define REG_NEWLINE (1<<1)\r | |
40 | #define REG_NOTBOL (1<<2)\r | |
41 | #define REG_NOTEOL (1<<3)\r | |
b602265d | 42 | #define REG_EXTENDED (1<<4) /* if not set, Basic Onigular Expression */\r |
14b0e578 CS |
43 | #define REG_NOSUB (1<<5)\r |
44 | \r | |
45 | /* POSIX error codes */\r | |
46 | #define REG_NOMATCH 1\r | |
47 | #define REG_BADPAT 2\r | |
48 | #define REG_ECOLLATE 3\r | |
49 | #define REG_ECTYPE 4\r | |
50 | #define REG_EESCAPE 5\r | |
51 | #define REG_ESUBREG 6\r | |
52 | #define REG_EBRACK 7\r | |
53 | #define REG_EPAREN 8\r | |
54 | #define REG_EBRACE 9\r | |
55 | #define REG_BADBR 10\r | |
56 | #define REG_ERANGE 11\r | |
57 | #define REG_ESPACE 12\r | |
58 | #define REG_BADRPT 13\r | |
59 | \r | |
60 | /* extended error codes */\r | |
61 | #define REG_EONIG_INTERNAL 14\r | |
62 | #define REG_EONIG_BADWC 15\r | |
63 | #define REG_EONIG_BADARG 16\r | |
b602265d | 64 | /* #define REG_EONIG_THREAD 17 */\r |
14b0e578 CS |
65 | \r |
66 | /* character encodings (for reg_set_encoding()) */\r | |
67 | #define REG_POSIX_ENCODING_ASCII 0\r | |
68 | #define REG_POSIX_ENCODING_EUC_JP 1\r | |
69 | #define REG_POSIX_ENCODING_SJIS 2\r | |
70 | #define REG_POSIX_ENCODING_UTF8 3\r | |
71 | #define REG_POSIX_ENCODING_UTF16_BE 4\r | |
72 | #define REG_POSIX_ENCODING_UTF16_LE 5\r | |
73 | \r | |
74 | \r | |
75 | typedef int regoff_t;\r | |
76 | \r | |
77 | typedef struct {\r | |
78 | regoff_t rm_so;\r | |
79 | regoff_t rm_eo;\r | |
80 | } regmatch_t;\r | |
81 | \r | |
82 | /* POSIX regex_t */\r | |
83 | typedef struct {\r | |
84 | void* onig; /* Oniguruma regex_t* */\r | |
85 | size_t re_nsub;\r | |
86 | int comp_options;\r | |
87 | } regex_t;\r | |
88 | \r | |
89 | \r | |
90 | #ifndef P_\r | |
91 | #if defined(__STDC__) || defined(_WIN32)\r | |
92 | # define P_(args) args\r | |
93 | #else\r | |
94 | # define P_(args) ()\r | |
95 | #endif\r | |
96 | #endif\r | |
97 | \r | |
98 | #ifndef ONIG_EXTERN\r | |
99 | #if defined(_WIN32) && !defined(__GNUC__)\r | |
b602265d | 100 | #if defined(ONIGURUMA_EXPORT)\r |
14b0e578 CS |
101 | #define ONIG_EXTERN extern __declspec(dllexport)\r |
102 | #else\r | |
103 | #define ONIG_EXTERN extern __declspec(dllimport)\r | |
104 | #endif\r | |
105 | #endif\r | |
106 | #endif\r | |
107 | \r | |
108 | #ifndef ONIG_EXTERN\r | |
109 | #define ONIG_EXTERN extern\r | |
110 | #endif\r | |
111 | \r | |
112 | #ifndef ONIGURUMA_H\r | |
113 | typedef unsigned int OnigOptionType;\r | |
114 | \r | |
115 | /* syntax */\r | |
116 | typedef struct {\r | |
117 | unsigned int op;\r | |
118 | unsigned int op2;\r | |
119 | unsigned int behavior;\r | |
120 | OnigOptionType options; /* default option */\r | |
121 | } OnigSyntaxType;\r | |
122 | \r | |
123 | ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixBasic;\r | |
124 | ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixExtended;\r | |
125 | ONIG_EXTERN OnigSyntaxType OnigSyntaxEmacs;\r | |
126 | ONIG_EXTERN OnigSyntaxType OnigSyntaxGrep;\r | |
127 | ONIG_EXTERN OnigSyntaxType OnigSyntaxGnuRegex;\r | |
128 | ONIG_EXTERN OnigSyntaxType OnigSyntaxJava;\r | |
129 | ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl;\r | |
130 | ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby;\r | |
b602265d | 131 | ONIG_EXTERN OnigSyntaxType OnigSyntaxOniguruma;\r |
14b0e578 CS |
132 | \r |
133 | /* predefined syntaxes (see regsyntax.c) */\r | |
134 | #define ONIG_SYNTAX_POSIX_BASIC (&OnigSyntaxPosixBasic)\r | |
135 | #define ONIG_SYNTAX_POSIX_EXTENDED (&OnigSyntaxPosixExtended)\r | |
136 | #define ONIG_SYNTAX_EMACS (&OnigSyntaxEmacs)\r | |
137 | #define ONIG_SYNTAX_GREP (&OnigSyntaxGrep)\r | |
138 | #define ONIG_SYNTAX_GNU_REGEX (&OnigSyntaxGnuRegex)\r | |
139 | #define ONIG_SYNTAX_JAVA (&OnigSyntaxJava)\r | |
140 | #define ONIG_SYNTAX_PERL (&OnigSyntaxPerl)\r | |
141 | #define ONIG_SYNTAX_RUBY (&OnigSyntaxRuby)\r | |
b602265d | 142 | #define ONIG_SYNTAX_ONIGURUMA (&OnigSyntaxOniguruma)\r |
14b0e578 CS |
143 | /* default syntax */\r |
144 | #define ONIG_SYNTAX_DEFAULT OnigDefaultSyntax\r | |
145 | \r | |
146 | ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax;\r | |
147 | \r | |
148 | ONIG_EXTERN int onig_set_default_syntax P_((OnigSyntaxType* syntax));\r | |
149 | ONIG_EXTERN void onig_copy_syntax P_((OnigSyntaxType* to, OnigSyntaxType* from));\r | |
150 | ONIG_EXTERN const char* onig_version P_((void));\r | |
151 | ONIG_EXTERN const char* onig_copyright P_((void));\r | |
b602265d | 152 | ONIG_EXTERN int onig_end P_((void));\r |
14b0e578 CS |
153 | \r |
154 | #endif /* ONIGURUMA_H */\r | |
155 | \r | |
156 | \r | |
157 | ONIG_EXTERN int regcomp P_((regex_t* reg, const char* pat, int options));\r | |
158 | ONIG_EXTERN int regexec P_((regex_t* reg, const char* str, size_t nmatch, regmatch_t* matches, int options));\r | |
159 | ONIG_EXTERN void regfree P_((regex_t* reg));\r | |
160 | ONIG_EXTERN size_t regerror P_((int code, const regex_t* reg, char* buf, size_t size));\r | |
161 | \r | |
162 | /* extended API */\r | |
163 | ONIG_EXTERN void reg_set_encoding P_((int enc));\r | |
164 | ONIG_EXTERN int reg_name_to_group_numbers P_((regex_t* reg, const unsigned char* name, const unsigned char* name_end, int** nums));\r | |
165 | ONIG_EXTERN int reg_foreach_name P_((regex_t* reg, int (*func)(const unsigned char*, const unsigned char*,int,int*,regex_t*,void*), void* arg));\r | |
166 | ONIG_EXTERN int reg_number_of_names P_((regex_t* reg));\r | |
167 | \r | |
168 | #ifdef __cplusplus\r | |
169 | }\r | |
170 | #endif\r | |
171 | \r | |
172 | #endif /* ONIGPOSIX_H */\r |