source: EcnlProtoTool/trunk/onigmo-6.1.3/src/onigmoposix.h@ 331

Last change on this file since 331 was 331, checked in by coas-nagasima, 6 years ago

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

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