3 /**********************************************************************
4 onigposix.h - Oniguruma (regular expression library)
5 **********************************************************************/
7 * Copyright (c) 2002-2005 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 #include "OnigurumaUefiPort.h"
38 #define REG_ICASE (1<<0)
39 #define REG_NEWLINE (1<<1)
40 #define REG_NOTBOL (1<<2)
41 #define REG_NOTEOL (1<<3)
42 #define REG_EXTENDED (1<<4) /* if not setted, Basic Onigular Expression */
43 #define REG_NOSUB (1<<5)
45 /* POSIX error codes */
48 #define REG_ECOLLATE 3
60 /* extended error codes */
61 #define REG_EONIG_INTERNAL 14
62 #define REG_EONIG_BADWC 15
63 #define REG_EONIG_BADARG 16
64 #define REG_EONIG_THREAD 17
66 /* character encodings (for reg_set_encoding()) */
67 #define REG_POSIX_ENCODING_ASCII 0
68 #define REG_POSIX_ENCODING_EUC_JP 1
69 #define REG_POSIX_ENCODING_SJIS 2
70 #define REG_POSIX_ENCODING_UTF8 3
71 #define REG_POSIX_ENCODING_UTF16_BE 4
72 #define REG_POSIX_ENCODING_UTF16_LE 5
84 void* onig
; /* Oniguruma regex_t* */
91 #if defined(__STDC__) || defined(_WIN32)
92 # define P_(args) args
99 #if defined(_WIN32) && !defined(__GNUC__)
101 #define ONIG_EXTERN extern __declspec(dllexport)
103 #define ONIG_EXTERN extern __declspec(dllimport)
109 #define ONIG_EXTERN extern
113 typedef unsigned int OnigOptionType
;
119 unsigned int behavior
;
120 OnigOptionType options
; /* default option */
123 ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixBasic
;
124 ONIG_EXTERN OnigSyntaxType OnigSyntaxPosixExtended
;
125 ONIG_EXTERN OnigSyntaxType OnigSyntaxEmacs
;
126 ONIG_EXTERN OnigSyntaxType OnigSyntaxGrep
;
127 ONIG_EXTERN OnigSyntaxType OnigSyntaxGnuRegex
;
128 ONIG_EXTERN OnigSyntaxType OnigSyntaxJava
;
129 ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl
;
130 ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby
;
132 /* predefined syntaxes (see regsyntax.c) */
133 #define ONIG_SYNTAX_POSIX_BASIC (&OnigSyntaxPosixBasic)
134 #define ONIG_SYNTAX_POSIX_EXTENDED (&OnigSyntaxPosixExtended)
135 #define ONIG_SYNTAX_EMACS (&OnigSyntaxEmacs)
136 #define ONIG_SYNTAX_GREP (&OnigSyntaxGrep)
137 #define ONIG_SYNTAX_GNU_REGEX (&OnigSyntaxGnuRegex)
138 #define ONIG_SYNTAX_JAVA (&OnigSyntaxJava)
139 #define ONIG_SYNTAX_PERL (&OnigSyntaxPerl)
140 #define ONIG_SYNTAX_RUBY (&OnigSyntaxRuby)
142 #define ONIG_SYNTAX_DEFAULT OnigDefaultSyntax
144 ONIG_EXTERN OnigSyntaxType
* OnigDefaultSyntax
;
146 ONIG_EXTERN
int onig_set_default_syntax
P_((OnigSyntaxType
* syntax
));
147 ONIG_EXTERN
void onig_copy_syntax
P_((OnigSyntaxType
* to
, OnigSyntaxType
* from
));
148 ONIG_EXTERN
const char* onig_version
P_((void));
149 ONIG_EXTERN
const char* onig_copyright
P_((void));
151 #endif /* ONIGURUMA_H */
154 ONIG_EXTERN
int regcomp
P_((regex_t
* reg
, const char* pat
, int options
));
155 ONIG_EXTERN
int regexec
P_((regex_t
* reg
, const char* str
, size_t nmatch
, regmatch_t
* matches
, int options
));
156 ONIG_EXTERN
void regfree
P_((regex_t
* reg
));
157 ONIG_EXTERN
size_t regerror
P_((int code
, const regex_t
* reg
, char* buf
, size_t size
));
160 ONIG_EXTERN
void reg_set_encoding
P_((int enc
));
161 ONIG_EXTERN
int reg_name_to_group_numbers
P_((regex_t
* reg
, const unsigned char* name
, const unsigned char* name_end
, int** nums
));
162 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
));
163 ONIG_EXTERN
int reg_number_of_names
P_((regex_t
* reg
));
169 #endif /* ONIGPOSIX_H */