]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/regex/v5/cregex.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / regex / v5 / cregex.hpp
1 /*
2 *
3 * Copyright (c) 1998-2002
4 * John Maddock
5 *
6 * Use, modification and distribution are subject to the
7 * Boost Software License, Version 1.0. (See accompanying file
8 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 *
10 */
11
12 /*
13 * LOCATION: see http://www.boost.org for most recent version.
14 * FILE cregex.cpp
15 * VERSION see <boost/version.hpp>
16 * DESCRIPTION: Declares POSIX API functions
17 * + boost::RegEx high level wrapper.
18 */
19
20 #ifndef BOOST_RE_CREGEX_HPP_INCLUDED
21 #define BOOST_RE_CREGEX_HPP_INCLUDED
22
23 #ifndef BOOST_REGEX_CONFIG_HPP
24 #include <boost/regex/config.hpp>
25 #endif
26 #include <boost/regex/v5/match_flags.hpp>
27 #include <boost/regex/v5/error_type.hpp>
28
29 #ifndef BOOST_REGEX_STANDALONE
30 #if !defined(BOOST_REGEX_NO_LIB) && !defined(BOOST_REGEX_SOURCE) && !defined(BOOST_ALL_NO_LIB) && defined(__cplusplus)
31 # define BOOST_LIB_NAME boost_regex
32 # if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
33 # define BOOST_DYN_LINK
34 # endif
35 # ifdef BOOST_REGEX_DIAG
36 # define BOOST_LIB_DIAGNOSTIC
37 # endif
38 # include <boost/config/auto_link.hpp>
39 #endif
40 #endif
41
42 #ifdef __cplusplus
43 #include <cstddef>
44 #else
45 #include <stddef.h>
46 #endif
47
48 /* include these defs only for POSIX compatablity */
49 #ifdef __cplusplus
50 namespace boost{
51 extern "C" {
52 #endif
53
54 #if defined(__cplusplus)
55 typedef std::ptrdiff_t regoff_t;
56 typedef std::size_t regsize_t;
57 #else
58 typedef ptrdiff_t regoff_t;
59 typedef size_t regsize_t;
60 #endif
61
62 typedef struct
63 {
64 unsigned int re_magic;
65 #ifdef __cplusplus
66 std::size_t re_nsub; /* number of parenthesized subexpressions */
67 #else
68 size_t re_nsub;
69 #endif
70 const char* re_endp; /* end pointer for REG_PEND */
71 void* guts; /* none of your business :-) */
72 match_flag_type eflags; /* none of your business :-) */
73 } regex_tA;
74
75 #ifndef BOOST_NO_WREGEX
76 typedef struct
77 {
78 unsigned int re_magic;
79 #ifdef __cplusplus
80 std::size_t re_nsub; /* number of parenthesized subexpressions */
81 #else
82 size_t re_nsub;
83 #endif
84 const wchar_t* re_endp; /* end pointer for REG_PEND */
85 void* guts; /* none of your business :-) */
86 match_flag_type eflags; /* none of your business :-) */
87 } regex_tW;
88 #endif
89
90 typedef struct
91 {
92 regoff_t rm_so; /* start of match */
93 regoff_t rm_eo; /* end of match */
94 } regmatch_t;
95
96 /* regcomp() flags */
97 typedef enum{
98 REG_BASIC = 0000,
99 REG_EXTENDED = 0001,
100 REG_ICASE = 0002,
101 REG_NOSUB = 0004,
102 REG_NEWLINE = 0010,
103 REG_NOSPEC = 0020,
104 REG_PEND = 0040,
105 REG_DUMP = 0200,
106 REG_NOCOLLATE = 0400,
107 REG_ESCAPE_IN_LISTS = 01000,
108 REG_NEWLINE_ALT = 02000,
109 REG_PERLEX = 04000,
110
111 REG_PERL = REG_EXTENDED | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS | REG_PERLEX,
112 REG_AWK = REG_EXTENDED | REG_ESCAPE_IN_LISTS,
113 REG_GREP = REG_BASIC | REG_NEWLINE_ALT,
114 REG_EGREP = REG_EXTENDED | REG_NEWLINE_ALT,
115
116 REG_ASSERT = 15,
117 REG_INVARG = 16,
118 REG_ATOI = 255, /* convert name to number (!) */
119 REG_ITOA = 0400 /* convert number to name (!) */
120 } reg_comp_flags;
121
122 /* regexec() flags */
123 typedef enum{
124 REG_NOTBOL = 00001,
125 REG_NOTEOL = 00002,
126 REG_STARTEND = 00004
127 } reg_exec_flags;
128
129 /*
130 * POSIX error codes:
131 */
132 typedef unsigned reg_error_t;
133 typedef reg_error_t reg_errcode_t; /* backwards compatibility */
134
135 static const reg_error_t REG_NOERROR = 0; /* Success. */
136 static const reg_error_t REG_NOMATCH = 1; /* Didn't find a match (for regexec). */
137
138 /* POSIX regcomp return error codes. (In the order listed in the
139 standard.) */
140 static const reg_error_t REG_BADPAT = 2; /* Invalid pattern. */
141 static const reg_error_t REG_ECOLLATE = 3; /* Undefined collating element. */
142 static const reg_error_t REG_ECTYPE = 4; /* Invalid character class name. */
143 static const reg_error_t REG_EESCAPE = 5; /* Trailing backslash. */
144 static const reg_error_t REG_ESUBREG = 6; /* Invalid back reference. */
145 static const reg_error_t REG_EBRACK = 7; /* Unmatched left bracket. */
146 static const reg_error_t REG_EPAREN = 8; /* Parenthesis imbalance. */
147 static const reg_error_t REG_EBRACE = 9; /* Unmatched \{. */
148 static const reg_error_t REG_BADBR = 10; /* Invalid contents of \{\}. */
149 static const reg_error_t REG_ERANGE = 11; /* Invalid range end. */
150 static const reg_error_t REG_ESPACE = 12; /* Ran out of memory. */
151 static const reg_error_t REG_BADRPT = 13; /* No preceding re for repetition op. */
152 static const reg_error_t REG_EEND = 14; /* unexpected end of expression */
153 static const reg_error_t REG_ESIZE = 15; /* expression too big */
154 static const reg_error_t REG_ERPAREN = 8; /* = REG_EPAREN : unmatched right parenthesis */
155 static const reg_error_t REG_EMPTY = 17; /* empty expression */
156 static const reg_error_t REG_E_MEMORY = 15; /* = REG_ESIZE : out of memory */
157 static const reg_error_t REG_ECOMPLEXITY = 18; /* complexity too high */
158 static const reg_error_t REG_ESTACK = 19; /* out of stack space */
159 static const reg_error_t REG_E_PERL = 20; /* Perl (?...) error */
160 static const reg_error_t REG_E_UNKNOWN = 21; /* unknown error */
161 static const reg_error_t REG_ENOSYS = 21; /* = REG_E_UNKNOWN : Reserved. */
162
163 BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA*, const char*, int);
164 BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int, const regex_tA*, char*, regsize_t);
165 BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA*, const char*, regsize_t, regmatch_t*, int);
166 BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeA(regex_tA*);
167
168 #ifndef BOOST_NO_WREGEX
169 BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW*, const wchar_t*, int);
170 BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int, const regex_tW*, wchar_t*, regsize_t);
171 BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW*, const wchar_t*, regsize_t, regmatch_t*, int);
172 BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW*);
173 #endif
174
175 #ifdef UNICODE
176 #define regcomp regcompW
177 #define regerror regerrorW
178 #define regexec regexecW
179 #define regfree regfreeW
180 #define regex_t regex_tW
181 #else
182 #define regcomp regcompA
183 #define regerror regerrorA
184 #define regexec regexecA
185 #define regfree regfreeA
186 #define regex_t regex_tA
187 #endif
188
189 #ifdef __cplusplus
190 } /* extern "C" */
191 } /* namespace */
192 #endif
193
194 #endif /* include guard */
195