3 * Copyright (c) 1998-2002
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)
13 * LOCATION: see http://www.boost.org for most recent version.
15 * VERSION see <boost/version.hpp>
16 * DESCRIPTION: Declares POSIX API functions
17 * + boost::RegEx high level wrapper.
20 #ifndef BOOST_RE_CREGEX_HPP_INCLUDED
21 #define BOOST_RE_CREGEX_HPP_INCLUDED
23 #ifndef BOOST_REGEX_CONFIG_HPP
24 #include <boost/regex/config.hpp>
26 #include <boost/regex/v5/match_flags.hpp>
27 #include <boost/regex/v5/error_type.hpp>
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
35 # ifdef BOOST_REGEX_DIAG
36 # define BOOST_LIB_DIAGNOSTIC
38 # include <boost/config/auto_link.hpp>
48 /* include these defs only for POSIX compatablity */
54 #if defined(__cplusplus)
55 typedef std::ptrdiff_t regoff_t;
56 typedef std::size_t regsize_t;
58 typedef ptrdiff_t regoff_t;
59 typedef size_t regsize_t;
64 unsigned int re_magic;
66 std::size_t re_nsub; /* number of parenthesized subexpressions */
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 :-) */
75 #ifndef BOOST_NO_WREGEX
78 unsigned int re_magic;
80 std::size_t re_nsub; /* number of parenthesized subexpressions */
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 :-) */
92 regoff_t rm_so; /* start of match */
93 regoff_t rm_eo; /* end of match */
106 REG_NOCOLLATE = 0400,
107 REG_ESCAPE_IN_LISTS = 01000,
108 REG_NEWLINE_ALT = 02000,
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,
118 REG_ATOI = 255, /* convert name to number (!) */
119 REG_ITOA = 0400 /* convert number to name (!) */
122 /* regexec() flags */
132 typedef unsigned reg_error_t;
133 typedef reg_error_t reg_errcode_t; /* backwards compatibility */
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). */
138 /* POSIX regcomp return error codes. (In the order listed in the
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. */
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*);
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*);
176 #define regcomp regcompW
177 #define regerror regerrorW
178 #define regexec regexecW
179 #define regfree regfreeW
180 #define regex_t regex_tW
182 #define regcomp regcompA
183 #define regerror regerrorA
184 #define regexec regexecA
185 #define regfree regfreeA
186 #define regex_t regex_tA
194 #endif /* include guard */