First cut at new v5 regex version, doesn't really work yet, but all the infrastructure is in place...

[SVN r22489]
This commit is contained in:
John Maddock
2004-03-12 13:22:44 +00:00
parent 99d5760d2b
commit 4d2d3a1450
65 changed files with 5155 additions and 7075 deletions
+7 -15
View File
@@ -43,7 +43,6 @@ const wchar_t* wnames[] = {L"REG_NOERROR", L"REG_NOMATCH", L"REG_BADPAT", L"REG_
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wchar_t* ptr, int f)
{
BOOST_RE_GUARD_STACK
if(expression->re_magic != wmagic_value)
{
expression->guts = 0;
@@ -62,7 +61,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wcha
#endif
}
// set default flags:
boost::uint_fast32_t flags = (f & REG_EXTENDED) ? wregex::extended : wregex::basic;
boost::uint_fast32_t flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? wregex::extended : wregex::basic);
expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : match_default;
// and translate those that are actually set:
@@ -82,13 +81,9 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wcha
if(f & REG_ICASE)
flags |= wregex::icase;
if(f & REG_ESCAPE_IN_LISTS)
flags |= wregex::escape_in_lists;
flags &= ~wregex::no_escape_in_lists;
if(f & REG_NEWLINE_ALT)
flags |= wregex::newline_alt;
#ifndef BOOST_REGEX_V3
if(f & REG_PERLEX)
flags |= wregex::perlex;
#endif
const wchar_t* p2;
if(f & REG_PEND)
@@ -118,7 +113,6 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wcha
BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW* e, wchar_t* buf, regsize_t buf_size)
{
BOOST_RE_GUARD_STACK
std::size_t result = 0;
if(code & REG_ITOA)
{
@@ -162,12 +156,12 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
pt = &static_cast<wregex*>(e->guts)->get_traits();
(void)pt; // warning suppression
std::string p = pt->error_string(code);
std::size_t len = pt->strwiden(static_cast<wchar_t*>(0), 0, p.c_str());
if(len < buf_size)
if(p.size() < buf_size)
{
pt->strwiden(buf, buf_size, p.c_str());
std::copy(p.begin(), p.end(), buf);
buf[p.size()] = 0;
}
return len + 1;
return p.size() + 1;
}
if(buf_size)
*buf = 0;
@@ -176,7 +170,6 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW* expression, const wchar_t* buf, regsize_t n, regmatch_t* array, int eflags)
{
BOOST_RE_GUARD_STACK
bool result = false;
match_flag_type flags = match_default | expression->eflags;
const wchar_t* end;
@@ -216,7 +209,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW* expression, cons
if(result)
{
// extract what matched:
unsigned int i;
std::size_t i;
for(i = 0; (i < n) && (i < expression->re_nsub + 1); ++i)
{
array[i].rm_so = (m[i].matched == false) ? -1 : (m[i].first - buf);
@@ -235,7 +228,6 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW* expression, cons
BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW* expression)
{
BOOST_RE_GUARD_STACK
if(expression->re_magic == wmagic_value)
{
delete static_cast<wregex*>(expression->guts);