Almost complete compiler compatibility now...

[SVN r23103]
This commit is contained in:
John Maddock committed 2004-06-15 11:43:12 +00:00
1 parent 1d5a14164a
commit 89f635376a
25 files changed
+298 -108

No files matched your search

+1
View File
@@ -47,6 +47,7 @@ public:
{ return m_error_code; }
std::ptrdiff_t position()const
{ return m_position; }
void raise()const;
private:
regex_constants::error_type m_error_code;
std::ptrdiff_t m_position;
+8 -8
View File
@@ -265,7 +265,7 @@ public:
{
typedef typename traits::string_type seq_type;
seq_type a(arg_first, arg_last);
assign(&*a.begin(), &*a.end(), f);
assign(&*a.begin(), &*a.begin() + a.size(), f);
}
template <class ST, class SA>
@@ -290,7 +290,7 @@ public:
typedef typename traits::string_type seq_type;
seq_type a(arg_first, arg_last);
const charT* p1 = &*a.begin();
const charT* p2 = &*a.end();
const charT* p2 = &*a.begin() + a.size();
return assign(p1, p2, f);
}
#else
@@ -453,32 +453,32 @@ public:
//
const re_detail::re_syntax_base* get_first_state()const
{
assert(m_pimpl.get());
assert(0 != m_pimpl.get());
return m_pimpl->get_first_state();
}
unsigned get_restart_type()const
{
assert(m_pimpl.get());
assert(0 != m_pimpl.get());
return m_pimpl->get_restart_type();
}
const unsigned char* get_map()const
{
assert(m_pimpl.get());
assert(0 != m_pimpl.get());
return m_pimpl->get_map();
}
const ::boost::regex_traits_wrapper<traits>& get_traits()const
{
assert(m_pimpl.get());
assert(0 != m_pimpl.get());
return m_pimpl->get_traits();
}
bool can_be_null()const
{
assert(m_pimpl.get());
assert(0 != m_pimpl.get());
return m_pimpl->can_be_null();
}
const re_detail::regex_data<charT, traits>& get_data()const
{
assert(m_pimpl.get());
assert(0 != m_pimpl.get());
return m_pimpl->get_data();
}
+18 -12
View File
@@ -33,7 +33,8 @@ struct digraph : public std::pair<charT, charT>
{
digraph() : std::pair<charT, charT>(0, 0){}
digraph(charT c1) : std::pair<charT, charT>(c1, 0){}
digraph(charT c1, charT c2) : std::pair<charT, charT>(c1, c2){}
digraph(charT c1, charT c2) : std::pair<charT, charT>(c1, c2)
{}
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
digraph(const digraph<charT>& d) : std::pair<charT, charT>(d.first, d.second){}
#endif
@@ -407,11 +408,13 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
else
{
if(c1.second)
s1 = string_type(&c1.first, &c1.second+1);
{
s1.append(1, c1.first).append(1, c1.second);
}
else
s1 = string_type(1, c1.first);
if(c2.second)
s2 = string_type(&c2.first, &c2.second+1);
s2.append(1, c2.first).append(1, c2.second);
else
s2 = string_type(1, c2.first);
}
@@ -548,13 +551,8 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
while(first != last)
{
string_type s;
if(first->second)
{
charT cs[2] = { first->first, first->second, };
s = m_traits.transform_primary(cs, cs+2);
}
else
s = m_traits.transform_primary(&first->first, &first->first+1);
BOOST_ASSERT(static_cast<charT>(0) == first->second);
s = m_traits.transform_primary(&first->first, &first->first+1);
if(s.empty())
return 0; // invalid or unsupported equivalence class
for(unsigned i = 0; i < (1u << CHAR_BIT); ++i)
@@ -683,6 +681,13 @@ void basic_regex_creator<charT, traits>::create_startmaps(re_syntax_base* state)
// we need to calculate how big the backstep is:
static_cast<re_brace*>(state)->index
= this->calculate_backstep(state->next.p);
if(static_cast<re_brace*>(state)->index < 0)
{
// Oops error:
std::string message = this->m_pdata->m_ptraits->error_string(boost::regex_constants::error_brack);
boost::regex_error e(message, boost::regex_constants::error_brack, 0);
e.raise();
}
// fall through:
default:
state = state->next.p;
@@ -718,6 +723,7 @@ int basic_regex_creator<charT, traits>::calculate_backstep(re_syntax_base* state
if((static_cast<re_brace*>(state)->index == -1)
|| (static_cast<re_brace*>(state)->index == -2))
return result;
break;
case syntax_element_literal:
result += static_cast<re_literal*>(state)->length;
break;
@@ -1037,7 +1043,7 @@ bool basic_regex_creator<charT, traits>::is_bad_repeat(re_syntax_base* pt)
unsigned id = static_cast<re_repeat*>(pt)->id;
if(id > sizeof(m_bad_repeats) * CHAR_BIT)
return true; // run out of bits, assume we can't traverse this one.
return m_bad_repeats & (1u << id);
return m_bad_repeats & static_cast<boost::uintmax_t>(1uL << id);
}
default:
return false;
@@ -1057,7 +1063,7 @@ void basic_regex_creator<charT, traits>::set_bad_repeat(re_syntax_base* pt)
{
unsigned id = static_cast<re_repeat*>(pt)->id;
if(id <= sizeof(m_bad_repeats) * CHAR_BIT)
m_bad_repeats |= (1u << id);
m_bad_repeats |= static_cast<boost::uintmax_t>(1uL << id);
}
default:
break;
@@ -121,7 +121,7 @@ void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_c
{
std::string message = this->m_pdata->m_ptraits->error_string(error_code);
boost::regex_error e(message, error_code, position);
boost::throw_exception(e);
e.raise();
}
template <class charT, class traits>
@@ -1109,10 +1109,7 @@ charT basic_regex_parser<charT, traits>::unescape_character()
template <class charT, class traits>
bool basic_regex_parser<charT, traits>::parse_backref()
{
if(m_position == m_end)
{
fail(regex_constants::error_escape, m_position - m_end);
}
BOOST_ASSERT(m_position != m_end);
int i = this->m_traits.toi(m_position, m_position + 1, 10);
if((i > 0) && (this->m_backrefs & (1u << (i-1))))
{
+22 -4
View File
@@ -230,7 +230,7 @@ cpp_regex_traits_char_layer<charT>::cpp_regex_traits_char_layer(const std::local
{
std::string m("Unable to open message catalog: ");
std::runtime_error err(m + cat_name);
boost::throw_exception(err);
boost::re_detail::raise_runtime_error(err);
}
}
//
@@ -401,6 +401,24 @@ private:
char_class_type lookup_classname_imp(const charT* p1, const charT* p2) const;
};
#if !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)
template <class charT>
typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_blank;
template <class charT>
typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_word;
template <class charT>
typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_unicode;
#ifdef __GNUC__
template <class charT>
typename cpp_regex_traits_implementation<charT>::native_mask_type const cpp_regex_traits_implementation<charT>::mask_base;
#else
template <class charT>
typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_base;
#endif
#endif
template <class charT>
typename cpp_regex_traits_implementation<charT>::string_type
cpp_regex_traits_implementation<charT>::transform_primary(const charT* p1, const charT* p2) const
@@ -454,7 +472,7 @@ typename cpp_regex_traits_implementation<charT>::string_type
if(pos != m_custom_collate_names.end())
return pos->second;
}
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
std::string name(p1, p2);
#else
std::string name;
@@ -463,7 +481,7 @@ typename cpp_regex_traits_implementation<charT>::string_type
name.append(1, char(*p0++));
#endif
name = lookup_default_collate_name(name);
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
if(name.size())
return string_type(name.begin(), name.end());
#else
@@ -502,7 +520,7 @@ cpp_regex_traits_implementation<charT>::cpp_regex_traits_implementation(const st
{
std::string m("Unable to open message catalog: ");
std::runtime_error err(m + cat_name);
boost::throw_exception(err);
boost::re_detail::raise_runtime_error(err);
}
}
//
+1 -1
View File
@@ -106,7 +106,7 @@ public:
const sub_match<BidiIterator>& s = m_subs[sub];
if(s.matched)
{
result = s;
result = s.str();
}
}
return result;
@@ -38,7 +38,13 @@ inline void inplace_destroy(T* p)
struct saved_state
{
unsigned int id;
union{
unsigned int id;
// this padding ensures correct alignment on 64-bit platforms:
std::size_t padding1;
std::ptrdiff_t padding2;
void* padding3;
};
saved_state(unsigned i) : id(i) {}
};
@@ -629,7 +635,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat()
if(::boost::is_random_access_iterator<BidiIterator>::value)
{
BidiIterator end = position;
std::advance(end, (std::min)((unsigned)::boost::re_detail::distance(position, last), desired));
std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired));
BidiIterator origin(position);
while((position != end) && (traits_inst.translate(*position, icase) == what))
{
@@ -696,7 +702,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat()
if(::boost::is_random_access_iterator<BidiIterator>::value)
{
BidiIterator end = position;
std::advance(end, (std::min)((unsigned)::boost::re_detail::distance(position, last), desired));
std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired));
BidiIterator origin(position);
while((position != end) && map[static_cast<unsigned char>(traits_inst.translate(*position, icase))])
{
@@ -764,7 +770,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat()
if(::boost::is_random_access_iterator<BidiIterator>::value)
{
BidiIterator end = position;
std::advance(end, (std::min)((unsigned)::boost::re_detail::distance(position, last), desired));
std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired));
BidiIterator origin(position);
while((position != end) && (position != re_is_set_member(position, last, set, re.get_data(), icase)))
{
@@ -67,7 +67,8 @@ public:
: end(last), re(*p), flags(f), subs(v){}
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|| BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
template <class T>
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const T& submatches, match_flag_type f)
: end(last), re(*p), flags(f)
@@ -195,7 +196,8 @@ public:
}
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|| BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
template <class T>
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
const T& submatches, match_flag_type m = match_default)
+2 -2
View File
@@ -73,7 +73,7 @@ struct regex_traits : public implementationT
// required "standard" ones:
//
namespace re_detail{
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
BOOST_MPL_HAS_XXX_TRAIT_DEF(boost_extensions_tag)
#else
template<class T>
@@ -126,7 +126,7 @@ struct compute_wrapper_base
{
typedef BaseT type;
};
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
template <class BaseT>
struct compute_wrapper_base<BaseT, false>
{
@@ -83,7 +83,7 @@ inline bool is_combining<wchar_t>(wchar_t c)
{
return is_combining_implementation(static_cast<unsigned short>(c));
}
#elif defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
#elif !defined(__DECCXX) && defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
#if defined(WCHAR_MAX) && (WCHAR_MAX <= USHRT_MAX)
template<>
inline bool is_combining<wchar_t>(wchar_t c)
+1 -1
View File
@@ -46,7 +46,7 @@ struct sub_match : public std::pair<BidiIterator, BidiIterator>
template <class T, class A>
operator std::basic_string<value_type, T, A> ()const
{
return std::basic_string<value_type, T, A>(first, second);
return std::basic_string<value_type, T, A>(this->first, this->second);
}
#else
operator std::basic_string<value_type> ()const
+30 -11
View File
@@ -138,6 +138,14 @@ public:
}
return i->second;
}
charT tolower(charT c)const
{
return ::boost::re_detail::w32_tolower(c, this->m_locale);
}
bool isctype(boost::uint32_t mask, charT c)
{
return ::boost::re_detail::w32_is(this->m_locale, mask, c);
}
private:
string_type get_default_message(regex_constants::syntax_type);
@@ -160,7 +168,7 @@ w32_regex_traits_char_layer<charT>::w32_regex_traits_char_layer(::boost::re_deta
{
std::string m("Unable to open message catalog: ");
std::runtime_error err(m + cat_name);
boost::throw_exception(err);
boost::re_detail::raise_runtime_error(err);
}
}
//
@@ -227,9 +235,19 @@ public:
{
return m_char_map[static_cast<unsigned char>(c)];
}
char tolower(char c)const
{
return m_lower_map[static_cast<unsigned char>(c)];
}
bool isctype(boost::uint32_t mask, char c)
{
return m_type_map[static_cast<unsigned char>(c)] & mask;
}
private:
regex_constants::syntax_type m_char_map[1u << CHAR_BIT];
char m_lower_map[1u << CHAR_BIT];
boost::uint16_t m_type_map[1u << CHAR_BIT];
void init();
};
@@ -266,7 +284,7 @@ public:
typedef typename string_type::size_type size_type;
string_type temp(p1, p2);
for(size_type i = 0; i < temp.size(); ++i)
temp[i] = ::boost::re_detail::w32_tolower(temp[i], this->m_locale);
temp[i] = this->tolower(temp[i]);
result = lookup_classname_imp(&*temp.begin(), &*temp.begin() + temp.size());
}
return result;
@@ -307,7 +325,7 @@ typename w32_regex_traits_implementation<charT>::string_type
result.assign(p1, p2);
typedef typename string_type::size_type size_type;
for(size_type i = 0; i < result.size(); ++i)
result[i] = ::boost::re_detail::w32_tolower(result[i], this->m_locale);
result[i] = this->tolower(result[i]);
result = this->transform(&*result.begin(), &*result.begin() + result.size());
break;
}
@@ -344,7 +362,7 @@ typename w32_regex_traits_implementation<charT>::string_type
if(pos != m_custom_collate_names.end())
return pos->second;
}
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
std::string name(p1, p2);
#else
std::string name;
@@ -353,7 +371,7 @@ typename w32_regex_traits_implementation<charT>::string_type
name.append(1, char(*p0++));
#endif
name = lookup_default_collate_name(name);
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
if(name.size())
return string_type(name.begin(), name.end());
#else
@@ -386,7 +404,7 @@ w32_regex_traits_implementation<charT>::w32_regex_traits_implementation(::boost:
{
std::string m("Unable to open message catalog: ");
std::runtime_error err(m + cat_name);
boost::throw_exception(err);
boost::re_detail::raise_runtime_error(err);
}
}
//
@@ -534,15 +552,15 @@ public:
}
charT translate_nocase(charT c) const
{
return ::boost::re_detail::w32_tolower(c, this->m_pimpl->m_locale);
return this->m_pimpl->tolower(c);
}
charT translate(charT c, bool icase) const
{
return icase ? ::boost::re_detail::w32_tolower(c, this->m_pimpl->m_locale) : c;
return icase ? this->m_pimpl->tolower(c) : c;
}
charT tolower(charT c) const
{
return ::boost::re_detail::w32_tolower(c, this->m_pimpl->m_locale);
return this->m_pimpl->tolower(c);
}
charT toupper(charT c) const
{
@@ -567,7 +585,7 @@ public:
bool isctype(charT c, char_class_type f) const
{
if((f & re_detail::w32_regex_traits_implementation<charT>::mask_base)
&& (::boost::re_detail::w32_is(this->m_pimpl->m_locale, f & re_detail::w32_regex_traits_implementation<charT>::mask_base, c)))
&& (this->m_pimpl->isctype(f & re_detail::w32_regex_traits_implementation<charT>::mask_base, c)))
return true;
else if((f & re_detail::w32_regex_traits_implementation<charT>::mask_unicode) && re_detail::is_extended(c))
return true;
@@ -581,7 +599,8 @@ public:
}
int value(charT c, int radix)const
{
return ::boost::re_detail::global_value(c);
int result = ::boost::re_detail::global_value(c);
return result < radix ? result : -1;
}
locale_type imbue(locale_type l)
{