mirror of
https://github.com/boostorg/regex.git
synced 2025-07-13 04:16:37 +02:00
compiler specific fixes (mostly MWCW)
[SVN r8032]
This commit is contained in:
@ -72,6 +72,12 @@ Do not change this file unless you really really have to, add options to
|
|||||||
#if (defined(__WIN32__) || defined(_WIN32) || defined(WIN32)) && !defined(__GNUC__)
|
#if (defined(__WIN32__) || defined(_WIN32) || defined(WIN32)) && !defined(__GNUC__)
|
||||||
#define BOOST_RE_PLATFORM_W32
|
#define BOOST_RE_PLATFORM_W32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
// no std::maessages facet
|
||||||
|
#define BOOST_RE_NO_MESSAGES
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
|
|
||||||
#if __BORLANDC__ < 0x500
|
#if __BORLANDC__ < 0x500
|
||||||
|
@ -120,7 +120,7 @@ private:
|
|||||||
typename alloc_inst_type::pointer last;
|
typename alloc_inst_type::pointer last;
|
||||||
alloc_data(const Allocator& a) : alloc_inst_type(a){}
|
alloc_data(const Allocator& a) : alloc_inst_type(a){}
|
||||||
} alloc_inst;
|
} alloc_inst;
|
||||||
raw_storage<Allocator>::pointer start, end;
|
pointer start, end;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
raw_storage(const Allocator& a = Allocator());
|
raw_storage(const Allocator& a = Allocator());
|
||||||
|
@ -72,7 +72,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
data alloc_inst;
|
data alloc_inst;
|
||||||
mutable node* stack;
|
mutable node* m_stack;
|
||||||
mutable node* unused;
|
mutable node* unused;
|
||||||
node base;
|
node base;
|
||||||
size_type block_size;
|
size_type block_size;
|
||||||
@ -96,51 +96,51 @@ public:
|
|||||||
|
|
||||||
bool BOOST_RE_CALL empty()
|
bool BOOST_RE_CALL empty()
|
||||||
{
|
{
|
||||||
return (stack->start == stack->end) && (stack->next == 0);
|
return (m_stack->start == m_stack->end) && (m_stack->next == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BOOST_RE_CALL good()
|
bool BOOST_RE_CALL good()
|
||||||
{
|
{
|
||||||
return (stack->start != stack->end) || (stack->next != 0);
|
return (m_stack->start != m_stack->end) || (m_stack->next != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
T& BOOST_RE_CALL peek()
|
T& BOOST_RE_CALL peek()
|
||||||
{
|
{
|
||||||
if(stack->start == stack->end)
|
if(m_stack->start == m_stack->end)
|
||||||
pop_aux();
|
pop_aux();
|
||||||
return *stack->end;
|
return *m_stack->end;
|
||||||
}
|
}
|
||||||
|
|
||||||
const T& BOOST_RE_CALL peek()const
|
const T& BOOST_RE_CALL peek()const
|
||||||
{
|
{
|
||||||
if(stack->start == stack->end)
|
if(m_stack->start == m_stack->end)
|
||||||
pop_aux();
|
pop_aux();
|
||||||
return *stack->end;
|
return *m_stack->end;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BOOST_RE_CALL pop()
|
void BOOST_RE_CALL pop()
|
||||||
{
|
{
|
||||||
if(stack->start == stack->end)
|
if(m_stack->start == m_stack->end)
|
||||||
pop_aux();
|
pop_aux();
|
||||||
jm_destroy(stack->end);
|
jm_destroy(m_stack->end);
|
||||||
++(stack->end);
|
++(m_stack->end);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BOOST_RE_CALL pop(T& t)
|
void BOOST_RE_CALL pop(T& t)
|
||||||
{
|
{
|
||||||
if(stack->start == stack->end)
|
if(m_stack->start == m_stack->end)
|
||||||
pop_aux();
|
pop_aux();
|
||||||
t = *stack->end;
|
t = *m_stack->end;
|
||||||
jm_destroy(stack->end);
|
jm_destroy(m_stack->end);
|
||||||
++(stack->end);
|
++(m_stack->end);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BOOST_RE_CALL push(const T& t)
|
void BOOST_RE_CALL push(const T& t)
|
||||||
{
|
{
|
||||||
if(stack->end == stack->last)
|
if(m_stack->end == m_stack->last)
|
||||||
push_aux();
|
push_aux();
|
||||||
--(stack->end);
|
--(m_stack->end);
|
||||||
jm_construct(stack->end, t);
|
jm_construct(m_stack->end, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -151,7 +151,7 @@ jstack<T, Allocator>::jstack(size_type n, const Allocator& a)
|
|||||||
{
|
{
|
||||||
unused = 0;
|
unused = 0;
|
||||||
block_size = n;
|
block_size = n;
|
||||||
stack = &base;
|
m_stack = &base;
|
||||||
base.last = reinterpret_cast<T*>(alloc_inst.buf);
|
base.last = reinterpret_cast<T*>(alloc_inst.buf);
|
||||||
base.end = base.start = base.last + 16;
|
base.end = base.start = base.last + 16;
|
||||||
base.next = 0;
|
base.next = 0;
|
||||||
@ -166,14 +166,14 @@ void BOOST_RE_CALL jstack<T, Allocator>::push_aux()
|
|||||||
{
|
{
|
||||||
new_node = unused;
|
new_node = unused;
|
||||||
unused = new_node->next;
|
unused = new_node->next;
|
||||||
new_node->next = stack;
|
new_node->next = m_stack;
|
||||||
stack = new_node;
|
m_stack = new_node;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new_node = get_node();
|
new_node = get_node();
|
||||||
new_node->next = stack;
|
new_node->next = m_stack;
|
||||||
stack = new_node;
|
m_stack = new_node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,9 +182,9 @@ void BOOST_RE_CALL jstack<T, Allocator>::pop_aux()const
|
|||||||
{
|
{
|
||||||
// make sure that we have a valid item
|
// make sure that we have a valid item
|
||||||
// on TOS:
|
// on TOS:
|
||||||
jm_assert(stack->next);
|
jm_assert(m_stack->next);
|
||||||
register node* p = stack;
|
register node* p = m_stack;
|
||||||
stack = p->next;
|
m_stack = p->next;
|
||||||
p->next = unused;
|
p->next = unused;
|
||||||
unused = p;
|
unused = p;
|
||||||
}
|
}
|
||||||
@ -201,10 +201,10 @@ jstack<T, Allocator>::~jstack()
|
|||||||
unused = unused->next;
|
unused = unused->next;
|
||||||
alloc_inst.deallocate((unsigned char*)condemned, sizeof(node) + sizeof(T) * block_size);
|
alloc_inst.deallocate((unsigned char*)condemned, sizeof(node) + sizeof(T) * block_size);
|
||||||
}
|
}
|
||||||
while(stack != &base)
|
while(m_stack != &base)
|
||||||
{
|
{
|
||||||
condemned = stack;
|
condemned = m_stack;
|
||||||
stack = stack->next;
|
m_stack = m_stack->next;
|
||||||
alloc_inst.deallocate((unsigned char*)condemned, sizeof(node) + sizeof(T) * block_size);
|
alloc_inst.deallocate((unsigned char*)condemned, sizeof(node) + sizeof(T) * block_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -849,16 +849,16 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(char, Allocator) c_alloc;
|
typedef BOOST_RE_MAYBE_TYPENAME REBIND_TYPE(char, Allocator) c_alloc;
|
||||||
|
|
||||||
struct reference : public c_alloc
|
struct c_reference : public c_alloc
|
||||||
{
|
{
|
||||||
unsigned int cmatches;
|
unsigned int cmatches;
|
||||||
unsigned count;
|
unsigned count;
|
||||||
sub_match<iterator> head, tail, null;
|
sub_match<iterator> head, tail, null;
|
||||||
unsigned int lines;
|
unsigned int lines;
|
||||||
iterator line_pos, base;
|
iterator line_pos, base;
|
||||||
reference(const Allocator& a) : c_alloc(a) { }
|
c_reference(const Allocator& a) : c_alloc(a) { }
|
||||||
|
|
||||||
bool operator==(const reference& that)const
|
bool operator==(const c_reference& that)const
|
||||||
{
|
{
|
||||||
return (cmatches == that.cmatches) &&
|
return (cmatches == that.cmatches) &&
|
||||||
(count == that.count) &&
|
(count == that.count) &&
|
||||||
@ -867,11 +867,11 @@ protected:
|
|||||||
(lines == that.lines) &&
|
(lines == that.lines) &&
|
||||||
(base == that.base);
|
(base == that.base);
|
||||||
}
|
}
|
||||||
bool operator!=(const reference& that)const
|
bool operator!=(const c_reference& that)const
|
||||||
{ return !(*this == that); }
|
{ return !(*this == that); }
|
||||||
};
|
};
|
||||||
|
|
||||||
reference* ref;
|
c_reference* ref;
|
||||||
|
|
||||||
void BOOST_RE_CALL cow();
|
void BOOST_RE_CALL cow();
|
||||||
|
|
||||||
@ -904,7 +904,7 @@ public:
|
|||||||
const sub_match<iterator>& BOOST_RE_CALL operator[](int n) const
|
const sub_match<iterator>& BOOST_RE_CALL operator[](int n) const
|
||||||
{
|
{
|
||||||
if((n >= 0) && ((unsigned int)n < ref->cmatches))
|
if((n >= 0) && ((unsigned int)n < ref->cmatches))
|
||||||
return *(sub_match<iterator>*)((char*)ref + sizeof(reference) + sizeof(sub_match<iterator>)*n);
|
return *(sub_match<iterator>*)((char*)ref + sizeof(c_reference) + sizeof(sub_match<iterator>)*n);
|
||||||
return (n == -1) ? ref->head : (n == -2) ? ref->tail : ref->null;
|
return (n == -1) ? ref->head : (n == -2) ? ref->tail : ref->null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -956,7 +956,7 @@ public:
|
|||||||
|
|
||||||
void swap(match_results_base& that)
|
void swap(match_results_base& that)
|
||||||
{
|
{
|
||||||
reference* t = that.ref;
|
c_reference* t = that.ref;
|
||||||
that.ref = ref;
|
that.ref = ref;
|
||||||
ref = t;
|
ref = t;
|
||||||
}
|
}
|
||||||
@ -987,8 +987,8 @@ public:
|
|||||||
void BOOST_RE_CALL set_second(iterator i, size_t pos)
|
void BOOST_RE_CALL set_second(iterator i, size_t pos)
|
||||||
{
|
{
|
||||||
cow();
|
cow();
|
||||||
((sub_match<iterator>*)((char*)ref + sizeof(reference) + sizeof(sub_match<iterator>) * pos))->second = i;
|
((sub_match<iterator>*)((char*)ref + sizeof(c_reference) + sizeof(sub_match<iterator>) * pos))->second = i;
|
||||||
((sub_match<iterator>*)((char*)ref + sizeof(reference) + sizeof(sub_match<iterator>) * pos))->matched = true;
|
((sub_match<iterator>*)((char*)ref + sizeof(c_reference) + sizeof(sub_match<iterator>) * pos))->matched = true;
|
||||||
if(pos == 0)
|
if(pos == 0)
|
||||||
{
|
{
|
||||||
ref->tail.first = i;
|
ref->tail.first = i;
|
||||||
@ -1032,7 +1032,7 @@ template <class iterator, class Allocator>
|
|||||||
void BOOST_RE_CALL match_results_base<iterator, Allocator>::set_first(iterator i, size_t pos)
|
void BOOST_RE_CALL match_results_base<iterator, Allocator>::set_first(iterator i, size_t pos)
|
||||||
{
|
{
|
||||||
cow();
|
cow();
|
||||||
((sub_match<iterator>*)((char*)ref + sizeof(reference) + sizeof(sub_match<iterator>) * pos))->first = i;
|
((sub_match<iterator>*)((char*)ref + sizeof(c_reference) + sizeof(sub_match<iterator>) * pos))->first = i;
|
||||||
if(pos == 0)
|
if(pos == 0)
|
||||||
{
|
{
|
||||||
ref->head.second = i;
|
ref->head.second = i;
|
||||||
@ -1056,10 +1056,10 @@ void BOOST_RE_CALL match_results_base<iterator, Allocator>::set_first(iterator i
|
|||||||
template <class iterator, class Allocator>
|
template <class iterator, class Allocator>
|
||||||
match_results_base<iterator, Allocator>::match_results_base(const Allocator& a)
|
match_results_base<iterator, Allocator>::match_results_base(const Allocator& a)
|
||||||
{
|
{
|
||||||
ref = (reference*)c_alloc(a).allocate(sizeof(sub_match<iterator>) + sizeof(reference));
|
ref = (c_reference*)c_alloc(a).allocate(sizeof(sub_match<iterator>) + sizeof(c_reference));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
new (ref) reference(a);
|
new (ref) c_reference(a);
|
||||||
ref->cmatches = 1;
|
ref->cmatches = 1;
|
||||||
ref->count = 1;
|
ref->count = 1;
|
||||||
// construct the sub_match<iterator>:
|
// construct the sub_match<iterator>:
|
||||||
@ -1075,7 +1075,7 @@ match_results_base<iterator, Allocator>::match_results_base(const Allocator& a)
|
|||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
c_alloc(a).deallocate((char*)(void*)ref, sizeof(sub_match<iterator>) + sizeof(reference));
|
c_alloc(a).deallocate((char*)(void*)ref, sizeof(sub_match<iterator>) + sizeof(c_reference));
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1114,7 +1114,7 @@ void BOOST_RE_CALL match_results_base<iterator, Allocator>::free()
|
|||||||
++p1;
|
++p1;
|
||||||
}
|
}
|
||||||
jm_destroy(ref);
|
jm_destroy(ref);
|
||||||
a.deallocate((char*)(void*)ref, sizeof(sub_match<iterator>) * ref->cmatches + sizeof(reference));
|
a.deallocate((char*)(void*)ref, sizeof(sub_match<iterator>) * ref->cmatches + sizeof(c_reference));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1141,10 +1141,10 @@ void BOOST_RE_CALL match_results_base<iterator, Allocator>::set_size(size_type n
|
|||||||
{
|
{
|
||||||
if(ref->cmatches != n)
|
if(ref->cmatches != n)
|
||||||
{
|
{
|
||||||
reference* newref = (reference*)ref->allocate(sizeof(sub_match<iterator>) * n + sizeof(reference));
|
c_reference* newref = (c_reference*)ref->allocate(sizeof(sub_match<iterator>) * n + sizeof(c_reference));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
new (newref) reference(*ref);
|
new (newref) c_reference(*ref);
|
||||||
newref->count = 1;
|
newref->count = 1;
|
||||||
newref->cmatches = n;
|
newref->cmatches = n;
|
||||||
sub_match<iterator>* p1, *p2;
|
sub_match<iterator>* p1, *p2;
|
||||||
@ -1174,7 +1174,7 @@ void BOOST_RE_CALL match_results_base<iterator, Allocator>::set_size(size_type n
|
|||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
ref->deallocate((char*)(void*)newref, sizeof(sub_match<iterator>) * n + sizeof(reference));
|
ref->deallocate((char*)(void*)newref, sizeof(sub_match<iterator>) * n + sizeof(c_reference));
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1185,9 +1185,9 @@ void BOOST_RE_CALL match_results_base<iterator, Allocator>::set_size(size_type n
|
|||||||
{
|
{
|
||||||
if(ref->cmatches != n)
|
if(ref->cmatches != n)
|
||||||
{
|
{
|
||||||
reference* newref = (reference*)ref->allocate(sizeof(sub_match<iterator>) * n + sizeof(reference));;
|
c_reference* newref = (c_reference*)ref->allocate(sizeof(sub_match<iterator>) * n + sizeof(c_reference));;
|
||||||
try{
|
try{
|
||||||
new (newref) reference(*ref);
|
new (newref) c_reference(*ref);
|
||||||
newref->count = 1;
|
newref->count = 1;
|
||||||
newref->cmatches = n;
|
newref->cmatches = n;
|
||||||
sub_match<iterator>* p1 = (sub_match<iterator>*)(newref+1);
|
sub_match<iterator>* p1 = (sub_match<iterator>*)(newref+1);
|
||||||
@ -1216,7 +1216,7 @@ void BOOST_RE_CALL match_results_base<iterator, Allocator>::set_size(size_type n
|
|||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
ref->deallocate((char*)(void*)newref, sizeof(sub_match<iterator>) * n + sizeof(reference));
|
ref->deallocate((char*)(void*)newref, sizeof(sub_match<iterator>) * n + sizeof(c_reference));
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1291,9 +1291,9 @@ void BOOST_RE_CALL match_results_base<iterator, Allocator>::cow()
|
|||||||
{
|
{
|
||||||
if(ref->count > 1)
|
if(ref->count > 1)
|
||||||
{
|
{
|
||||||
reference* newref = (reference*)ref->allocate(sizeof(sub_match<iterator>) * ref->cmatches + sizeof(reference));
|
c_reference* newref = (c_reference*)ref->allocate(sizeof(sub_match<iterator>) * ref->cmatches + sizeof(c_reference));
|
||||||
try{
|
try{
|
||||||
new (newref) reference(*ref);
|
new (newref) c_reference(*ref);
|
||||||
newref->count = 1;
|
newref->count = 1;
|
||||||
sub_match<iterator>* p1 = (sub_match<iterator>*)(newref+1);
|
sub_match<iterator>* p1 = (sub_match<iterator>*)(newref+1);
|
||||||
sub_match<iterator>* p2 = p1 + newref->cmatches;
|
sub_match<iterator>* p2 = p1 + newref->cmatches;
|
||||||
@ -1322,7 +1322,7 @@ void BOOST_RE_CALL match_results_base<iterator, Allocator>::cow()
|
|||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
ref->deallocate((char*)(void*)newref, sizeof(sub_match<iterator>) * ref->cmatches + sizeof(reference));
|
ref->deallocate((char*)(void*)newref, sizeof(sub_match<iterator>) * ref->cmatches + sizeof(c_reference));
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1369,11 +1369,11 @@ match_results<iterator, Allocator>::match_results(const match_results<iterator,
|
|||||||
: re_detail::match_results_base<iterator, Allocator>(false)
|
: re_detail::match_results_base<iterator, Allocator>(false)
|
||||||
{
|
{
|
||||||
this->ref =
|
this->ref =
|
||||||
reinterpret_cast<typename re_detail::match_results_base<iterator, Allocator>::reference *>
|
reinterpret_cast<typename re_detail::match_results_base<iterator, Allocator>::c_reference *>
|
||||||
(m.ref->allocate(sizeof(sub_match<iterator>) * m.ref->cmatches +
|
(m.ref->allocate(sizeof(sub_match<iterator>) * m.ref->cmatches +
|
||||||
sizeof(typename re_detail::match_results_base<iterator, Allocator>::reference)));
|
sizeof(typename re_detail::match_results_base<iterator, Allocator>::c_reference)));
|
||||||
try{
|
try{
|
||||||
new (this->ref) typename re_detail::match_results_base<iterator, Allocator>::reference(*m.ref);
|
new (this->ref) typename re_detail::match_results_base<iterator, Allocator>::c_reference(*m.ref);
|
||||||
this->ref->count = 1;
|
this->ref->count = 1;
|
||||||
sub_match<iterator>* p1 = (sub_match<iterator>*)(this->ref+1);
|
sub_match<iterator>* p1 = (sub_match<iterator>*)(this->ref+1);
|
||||||
sub_match<iterator>* p2 = p1 + this->ref->cmatches;
|
sub_match<iterator>* p2 = p1 + this->ref->cmatches;
|
||||||
@ -1400,7 +1400,7 @@ match_results<iterator, Allocator>::match_results(const match_results<iterator,
|
|||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
m.ref->deallocate((char*)(void*)this->ref, sizeof(sub_match<iterator>) * m.ref->cmatches + sizeof(typename re_detail::match_results_base<iterator, Allocator>::reference));
|
m.ref->deallocate((char*)(void*)this->ref, sizeof(sub_match<iterator>) * m.ref->cmatches + sizeof(typename re_detail::match_results_base<iterator, Allocator>::c_reference));
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,6 +179,7 @@ public:
|
|||||||
template<>
|
template<>
|
||||||
class BOOST_RE_IX_DECL c_regex_traits<char> : public re_detail::c_traits_base
|
class BOOST_RE_IX_DECL c_regex_traits<char> : public re_detail::c_traits_base
|
||||||
{
|
{
|
||||||
|
typedef re_detail::c_traits_base base_type;
|
||||||
public:
|
public:
|
||||||
typedef char char_type;
|
typedef char char_type;
|
||||||
typedef unsigned char uchar_type;
|
typedef unsigned char uchar_type;
|
||||||
@ -263,6 +264,7 @@ private:
|
|||||||
template<>
|
template<>
|
||||||
class BOOST_RE_IX_DECL c_regex_traits<wchar_t> : public re_detail::c_traits_base
|
class BOOST_RE_IX_DECL c_regex_traits<wchar_t> : public re_detail::c_traits_base
|
||||||
{
|
{
|
||||||
|
typedef re_detail::c_traits_base base_type;
|
||||||
public:
|
public:
|
||||||
typedef wchar_t char_type;
|
typedef wchar_t char_type;
|
||||||
typedef unsigned short uchar_type;
|
typedef unsigned short uchar_type;
|
||||||
@ -384,6 +386,7 @@ class w32_regex_traits;
|
|||||||
template<>
|
template<>
|
||||||
class BOOST_RE_IX_DECL w32_regex_traits<char> : public re_detail::w32_traits_base
|
class BOOST_RE_IX_DECL w32_regex_traits<char> : public re_detail::w32_traits_base
|
||||||
{
|
{
|
||||||
|
typedef re_detail::w32_traits_base base_type;
|
||||||
public:
|
public:
|
||||||
typedef char char_type;
|
typedef char char_type;
|
||||||
typedef unsigned char uchar_type;
|
typedef unsigned char uchar_type;
|
||||||
@ -458,6 +461,7 @@ private:
|
|||||||
template<>
|
template<>
|
||||||
class BOOST_RE_IX_DECL w32_regex_traits<wchar_t> : public re_detail::w32_traits_base
|
class BOOST_RE_IX_DECL w32_regex_traits<wchar_t> : public re_detail::w32_traits_base
|
||||||
{
|
{
|
||||||
|
typedef re_detail::w32_traits_base base_type;
|
||||||
public:
|
public:
|
||||||
typedef wchar_t char_type;
|
typedef wchar_t char_type;
|
||||||
typedef unsigned short uchar_type;
|
typedef unsigned short uchar_type;
|
||||||
@ -583,6 +587,7 @@ class cpp_regex_traits;
|
|||||||
template<>
|
template<>
|
||||||
class BOOST_RE_IX_DECL cpp_regex_traits<char> : public re_detail::cpp_regex_traits_base
|
class BOOST_RE_IX_DECL cpp_regex_traits<char> : public re_detail::cpp_regex_traits_base
|
||||||
{
|
{
|
||||||
|
typedef re_detail::cpp_regex_traits_base base_type;
|
||||||
private:
|
private:
|
||||||
re_detail::message_data<char>* pmd;
|
re_detail::message_data<char>* pmd;
|
||||||
const unsigned char* psyntax;
|
const unsigned char* psyntax;
|
||||||
@ -667,6 +672,7 @@ public:
|
|||||||
template<>
|
template<>
|
||||||
class BOOST_RE_IX_DECL cpp_regex_traits<wchar_t> : public re_detail::cpp_regex_traits_base
|
class BOOST_RE_IX_DECL cpp_regex_traits<wchar_t> : public re_detail::cpp_regex_traits_base
|
||||||
{
|
{
|
||||||
|
typedef re_detail::cpp_regex_traits_base base_type;
|
||||||
public:
|
public:
|
||||||
typedef wchar_t char_type;
|
typedef wchar_t char_type;
|
||||||
typedef unsigned short uchar_type;
|
typedef unsigned short uchar_type;
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#include <boost/regex_traits.hpp>
|
#include <boost/regex_traits.hpp>
|
||||||
#include <boost/re_detail/regex_synch.hpp>
|
#include <boost/re_detail/regex_synch.hpp>
|
||||||
#include <boost/re_detail/regex_cstring.hpp>
|
#include <boost/re_detail/regex_cstring.hpp>
|
||||||
#include <wchar.h> // dwa 10/20/2000 - needed for definition of wcslen()
|
|
||||||
|
|
||||||
#include "primary_transform.hpp"
|
#include "primary_transform.hpp"
|
||||||
|
|
||||||
@ -560,7 +559,7 @@ bool BOOST_RE_CALL c_regex_traits<wchar_t>::lookup_collatename(std::basic_string
|
|||||||
scoped_array<char> buf(new char[len]);
|
scoped_array<char> buf(new char[len]);
|
||||||
strnarrow(buf.get(), len, s.c_str());
|
strnarrow(buf.get(), len, s.c_str());
|
||||||
std::string t_out;
|
std::string t_out;
|
||||||
bool result = re_detail::c_traits_base::do_lookup_collate(t_out, buf.get());
|
bool result = base_type::do_lookup_collate(t_out, buf.get());
|
||||||
if(t_out.size() == 0) result = false;
|
if(t_out.size() == 0) result = false;
|
||||||
if(result)
|
if(result)
|
||||||
{
|
{
|
||||||
@ -782,7 +781,7 @@ bool BOOST_RE_CALL c_regex_traits<wchar_t>::do_lookup_collate(std::basic_string<
|
|||||||
scoped_array<char> buf(new char[len]);
|
scoped_array<char> buf(new char[len]);
|
||||||
strnarrow(buf.get(), len, s.c_str());
|
strnarrow(buf.get(), len, s.c_str());
|
||||||
std::string t_out;
|
std::string t_out;
|
||||||
bool result = re_detail::c_traits_base::do_lookup_collate(t_out, buf.get());
|
bool result = base_type::do_lookup_collate(t_out, buf.get());
|
||||||
if(result)
|
if(result)
|
||||||
{
|
{
|
||||||
len = strwiden((wchar_t*)0, 0, t_out.c_str());
|
len = strwiden((wchar_t*)0, 0, t_out.c_str());
|
||||||
@ -1000,7 +999,7 @@ c_regex_traits<wchar_t> c_regex_traits<wchar_t>::init_;
|
|||||||
unsigned int BOOST_RE_CALL c_regex_traits<wchar_t>::strnarrow(char *s1, unsigned int len, const wchar_t *s2)
|
unsigned int BOOST_RE_CALL c_regex_traits<wchar_t>::strnarrow(char *s1, unsigned int len, const wchar_t *s2)
|
||||||
{
|
{
|
||||||
BOOST_RE_GUARD_STACK
|
BOOST_RE_GUARD_STACK
|
||||||
unsigned int size = wcslen(s2) + 1;
|
unsigned int size = std::wcslen(s2) + 1;
|
||||||
if(size > len)
|
if(size > len)
|
||||||
return size;
|
return size;
|
||||||
return std::wcstombs(s1, s2, len);
|
return std::wcstombs(s1, s2, len);
|
||||||
@ -1009,7 +1008,7 @@ unsigned int BOOST_RE_CALL c_regex_traits<wchar_t>::strnarrow(char *s1, unsigned
|
|||||||
unsigned int BOOST_RE_CALL c_regex_traits<wchar_t>::strwiden(wchar_t *s1, unsigned int len, const char *s2)
|
unsigned int BOOST_RE_CALL c_regex_traits<wchar_t>::strwiden(wchar_t *s1, unsigned int len, const char *s2)
|
||||||
{
|
{
|
||||||
BOOST_RE_GUARD_STACK
|
BOOST_RE_GUARD_STACK
|
||||||
unsigned int size = strlen(s2) + 1;
|
unsigned int size = std::strlen(s2) + 1;
|
||||||
if(size > len)
|
if(size > len)
|
||||||
return size;
|
return size;
|
||||||
size = std::mbstowcs(s1, s2, len);
|
size = std::mbstowcs(s1, s2, len);
|
||||||
|
@ -28,9 +28,6 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <boost/cregex.hpp>
|
#include <boost/cregex.hpp>
|
||||||
#include "primary_transform.hpp"
|
#include "primary_transform.hpp"
|
||||||
#include <locale> // dwa 10/20/2000 - needed for definition of std::messages
|
|
||||||
#include <wchar.h> // dwa 10/20/2000 - needed for wcscpy
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef BOOST_RE_NO_LOCALE_H
|
#ifndef BOOST_RE_NO_LOCALE_H
|
||||||
|
|
||||||
@ -188,9 +185,10 @@ message_data<char>::message_data(const std::locale& l, const std::string& regex_
|
|||||||
: is(&sbuf)
|
: is(&sbuf)
|
||||||
{
|
{
|
||||||
is.imbue(l);
|
is.imbue(l);
|
||||||
|
#ifndef BOOST_RE_NO_MESSAGES
|
||||||
const std::messages<char>* pm = &BOOST_RE_USE_FACET(l, std::messages<char>);
|
const std::messages<char>* pm = &BOOST_RE_USE_FACET(l, std::messages<char>);
|
||||||
std::messages<char>::catalog cat = regex_message_catalogue.size() ? pm->open(regex_message_catalogue, l) : -1;
|
std::messages<char>::catalog cat = regex_message_catalogue.size() ? pm->open(regex_message_catalogue, l) : -1;
|
||||||
|
#endif
|
||||||
std::memset(syntax_map, cpp_regex_traits<char>::syntax_char, 256);
|
std::memset(syntax_map, cpp_regex_traits<char>::syntax_char, 256);
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
scoped_array<char> a;
|
scoped_array<char> a;
|
||||||
@ -206,14 +204,17 @@ message_data<char>::message_data(const std::locale& l, const std::string& regex_
|
|||||||
}
|
}
|
||||||
re_get_default_message(a.get(), array_size, i+100);
|
re_get_default_message(a.get(), array_size, i+100);
|
||||||
std::string s = a.get();
|
std::string s = a.get();
|
||||||
|
#ifndef BOOST_RE_NO_MESSAGES
|
||||||
if((int)cat >= 0)
|
if((int)cat >= 0)
|
||||||
s = pm->get(cat, 0, i+100, s);
|
s = pm->get(cat, 0, i+100, s);
|
||||||
|
#endif
|
||||||
for(unsigned int j = 0; j < s.size(); ++j)
|
for(unsigned int j = 0; j < s.size(); ++j)
|
||||||
{
|
{
|
||||||
syntax_map[s[j]] = (unsigned char)(i);
|
syntax_map[s[j]] = (unsigned char)(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef BOOST_RE_NO_MESSAGES
|
||||||
// load any custom collate names:
|
// load any custom collate names:
|
||||||
std::string c1, c2;
|
std::string c1, c2;
|
||||||
i = 400;
|
i = 400;
|
||||||
@ -235,6 +236,7 @@ message_data<char>::message_data(const std::locale& l, const std::string& regex_
|
|||||||
++i;
|
++i;
|
||||||
c2 = pm->get(cat, 0, i, c1);
|
c2 = pm->get(cat, 0, i, c1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
std::string n("zero");
|
std::string n("zero");
|
||||||
std::map<std::string, std::string, std::less<std::string > >::const_iterator pos = collating_elements.find(n);
|
std::map<std::string, std::string, std::less<std::string > >::const_iterator pos = collating_elements.find(n);
|
||||||
@ -252,6 +254,7 @@ message_data<char>::message_data(const std::locale& l, const std::string& regex_
|
|||||||
*/
|
*/
|
||||||
std::string m;
|
std::string m;
|
||||||
std::string s;
|
std::string s;
|
||||||
|
#ifndef BOOST_RE_NO_MESSAGES
|
||||||
if((int)cat >= 0)
|
if((int)cat >= 0)
|
||||||
{
|
{
|
||||||
for(i = 0; i < re_classes_max; ++i)
|
for(i = 0; i < re_classes_max; ++i)
|
||||||
@ -266,9 +269,10 @@ message_data<char>::message_data(const std::locale& l, const std::string& regex_
|
|||||||
error_strings[i] = s;
|
error_strings[i] = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((int)cat >= 0)
|
if((int)cat >= 0)
|
||||||
pm->close(cat);
|
pm->close(cat);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cpp_regex_traits_base::set_message_catalogue(const std::string& l)
|
std::string cpp_regex_traits_base::set_message_catalogue(const std::string& l)
|
||||||
@ -512,7 +516,11 @@ std::wstring BOOST_RE_CALL to_wide(const std::string& is, const std::codecvt<wch
|
|||||||
template <>
|
template <>
|
||||||
struct message_data<wchar_t>
|
struct message_data<wchar_t>
|
||||||
{
|
{
|
||||||
|
#ifndef BOOST_RE_NO_MESSAGES
|
||||||
typedef std::messages<wchar_t>::string_type string_type;
|
typedef std::messages<wchar_t>::string_type string_type;
|
||||||
|
#else
|
||||||
|
typedef std::wstring string_type;
|
||||||
|
#endif
|
||||||
|
|
||||||
string_type name;
|
string_type name;
|
||||||
|
|
||||||
@ -541,9 +549,10 @@ message_data<wchar_t>::message_data(const std::locale& l, const std::string& reg
|
|||||||
syntax_map m;
|
syntax_map m;
|
||||||
typedef std::codecvt<wchar_t, char, std::mbstate_t> cvt_type;
|
typedef std::codecvt<wchar_t, char, std::mbstate_t> cvt_type;
|
||||||
const cvt_type& cvt = BOOST_RE_USE_FACET(l, cvt_type);
|
const cvt_type& cvt = BOOST_RE_USE_FACET(l, cvt_type);
|
||||||
|
#ifndef BOOST_RE_NO_MESSAGES
|
||||||
const std::messages<wchar_t>& msgs = BOOST_RE_USE_FACET(l, std::messages<wchar_t>);
|
const std::messages<wchar_t>& msgs = BOOST_RE_USE_FACET(l, std::messages<wchar_t>);
|
||||||
std::messages<wchar_t>::catalog cat = regex_message_catalogue.size() ? msgs.open(regex_message_catalogue, l) : -1;
|
std::messages<wchar_t>::catalog cat = regex_message_catalogue.size() ? msgs.open(regex_message_catalogue, l) : -1;
|
||||||
|
#endif
|
||||||
scoped_array<char> a;
|
scoped_array<char> a;
|
||||||
unsigned array_size = 0;
|
unsigned array_size = 0;
|
||||||
unsigned new_size;
|
unsigned new_size;
|
||||||
@ -560,8 +569,10 @@ message_data<wchar_t>::message_data(const std::locale& l, const std::string& reg
|
|||||||
re_get_default_message(a.get(), array_size, i+100);
|
re_get_default_message(a.get(), array_size, i+100);
|
||||||
std::string ns = a.get();
|
std::string ns = a.get();
|
||||||
string_type s = to_wide(ns, cvt);
|
string_type s = to_wide(ns, cvt);
|
||||||
|
#ifndef BOOST_RE_NO_MESSAGES
|
||||||
if((int)cat >= 0)
|
if((int)cat >= 0)
|
||||||
s = BOOST_RE_USE_FACET(l, std::messages<wchar_t>).get(cat, 0, i+100, s);
|
s = BOOST_RE_USE_FACET(l, std::messages<wchar_t>).get(cat, 0, i+100, s);
|
||||||
|
#endif
|
||||||
for(unsigned int j = 0; j < s.size(); ++j)
|
for(unsigned int j = 0; j < s.size(); ++j)
|
||||||
{
|
{
|
||||||
if((s[j] <= UCHAR_MAX) && (s[j] >= 0))
|
if((s[j] <= UCHAR_MAX) && (s[j] >= 0))
|
||||||
@ -575,6 +586,7 @@ message_data<wchar_t>::message_data(const std::locale& l, const std::string& reg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef BOOST_RE_NO_MESSAGES
|
||||||
// load any custom collate names:
|
// load any custom collate names:
|
||||||
string_type c1, c2;
|
string_type c1, c2;
|
||||||
i = 400;
|
i = 400;
|
||||||
@ -615,6 +627,7 @@ message_data<wchar_t>::message_data(const std::locale& l, const std::string& reg
|
|||||||
|
|
||||||
if((int)cat >= 0)
|
if((int)cat >= 0)
|
||||||
msgs.close(cat);
|
msgs.close(cat);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace re_detail
|
} // namespace re_detail
|
||||||
@ -784,7 +797,7 @@ unsigned int BOOST_RE_CALL cpp_regex_traits<wchar_t>::strwiden(wchar_t *s1, unsi
|
|||||||
std::string s(s2);
|
std::string s(s2);
|
||||||
std::wstring ws = re_detail::to_wide(s2, *pcdv);
|
std::wstring ws = re_detail::to_wide(s2, *pcdv);
|
||||||
if(len > ws.size())
|
if(len > ws.size())
|
||||||
wcscpy(s1, ws.c_str());
|
std::wcscpy(s1, ws.c_str());
|
||||||
return ws.size()+1;
|
return ws.size()+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +559,7 @@ bool BOOST_RE_CALL w32_regex_traits<wchar_t>::lookup_collatename(std::basic_stri
|
|||||||
scoped_array<char> buf(new char[len]);
|
scoped_array<char> buf(new char[len]);
|
||||||
strnarrow(buf.get(), len, s.c_str());
|
strnarrow(buf.get(), len, s.c_str());
|
||||||
std::string t_out;
|
std::string t_out;
|
||||||
bool result = re_detail::w32_traits_base::do_lookup_collate(t_out, buf.get());
|
bool result = base_type::do_lookup_collate(t_out, buf.get());
|
||||||
if(t_out.size() == 0) result = false;
|
if(t_out.size() == 0) result = false;
|
||||||
if(result)
|
if(result)
|
||||||
{
|
{
|
||||||
@ -599,7 +599,7 @@ bool BOOST_RE_CALL w32_regex_traits<wchar_t>::do_lookup_collate(std::basic_strin
|
|||||||
scoped_array<char> buf(new char[len]);
|
scoped_array<char> buf(new char[len]);
|
||||||
strnarrow(buf.get(), len, s.c_str());
|
strnarrow(buf.get(), len, s.c_str());
|
||||||
std::string t_out;
|
std::string t_out;
|
||||||
bool result = re_detail::w32_traits_base::do_lookup_collate(t_out, buf.get());
|
bool result = base_type::do_lookup_collate(t_out, buf.get());
|
||||||
if(result)
|
if(result)
|
||||||
{
|
{
|
||||||
len = strwiden((wchar_t*)0, 0, t_out.c_str());
|
len = strwiden((wchar_t*)0, 0, t_out.c_str());
|
||||||
|
Reference in New Issue
Block a user