Updated Boost libraries

This commit is contained in:
Sergii Pylypenko
2013-06-26 17:31:21 +03:00
parent cb4611925f
commit d62c91a533
2623 changed files with 177228 additions and 61242 deletions

View File

@@ -63,6 +63,8 @@ struct char_architype
// conversion to integral type:
operator long()const;
};
inline long hash_value(char_architype val)
{ return val; }
//
// char_architype can not be used with basic_string:
//

View File

@@ -170,7 +170,10 @@
# define BOOST_REGEX_HAS_OTHER_WCHAR_T
# ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable : 4251 4231 4660)
# pragma warning(disable : 4251 4231)
# if BOOST_MSVC < 1600
# pragma warning(disable : 4660)
# endif
# endif
# if defined(_DLL) && defined(BOOST_MSVC) && (BOOST_MSVC < 1600)
# include <string>

View File

@@ -151,7 +151,7 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k,
--s;
}
else
--pos;
++pos;
}
BOOST_ASSERT(s_data.index[k]->first.get() == result.get());
BOOST_ASSERT(&(s_data.index.find(k)->first) == s_data.cont.back().second);

View File

@@ -520,9 +520,26 @@ public:
}
void increment()
{
// We must not start with a continuation character:
if((static_cast<boost::uint8_t>(*m_position) & 0xC0) == 0x80)
invalid_sequence();
// skip high surrogate first if there is one:
unsigned c = detail::utf8_byte_count(*m_position);
std::advance(m_position, c);
if(m_value == pending_read)
{
// Since we haven't read in a value, we need to validate the code points:
for(unsigned i = 0; i < c; ++i)
{
++m_position;
// We must have a continuation byte:
if((i != c - 1) && ((static_cast<boost::uint8_t>(*m_position) & 0xC0) != 0x80))
invalid_sequence();
}
}
else
{
std::advance(m_position, c);
}
m_value = pending_read;
}
void decrement()
@@ -589,7 +606,7 @@ private:
// we must not have a continuation character:
if((m_value & 0xC0u) == 0x80u)
invalid_sequence();
// see how many extra byts we have:
// see how many extra bytes we have:
unsigned extra = detail::utf8_trailing_byte_count(*m_position);
// extract the extra bits, 6 from each extra byte:
BaseIterator next(m_position);
@@ -597,6 +614,9 @@ private:
{
++next;
m_value <<= 6;
// We must have a continuation byte:
if((static_cast<boost::uint8_t>(*next) & 0xC0) != 0x80)
invalid_sequence();
m_value += static_cast<boost::uint8_t>(*next) & 0x3Fu;
}
// we now need to remove a few of the leftmost bits, but how many depends

View File

@@ -36,7 +36,10 @@
namespace boost{
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable : 4251 4231 4660 4800)
#pragma warning(disable : 4251 4231 4800)
#if BOOST_MSVC < 1600
#pragma warning(disable : 4660)
#endif
#endif
namespace re_detail{
@@ -243,11 +246,11 @@ public:
// begin, end:
const_iterator BOOST_REGEX_CALL begin()const
{
return (!this->m_status ? 0 : this->m_expression);
return (this->m_status ? 0 : this->m_expression);
}
const_iterator BOOST_REGEX_CALL end()const
{
return (!this->m_status ? 0 : this->m_expression + this->m_expression_len);
return (this->m_status ? 0 : this->m_expression + this->m_expression_len);
}
flag_type BOOST_REGEX_CALL flags()const
{

View File

@@ -66,7 +66,7 @@ class basic_char_set
public:
typedef digraph<charT> digraph_type;
typedef typename traits::string_type string_type;
typedef typename traits::char_class_type mask_type;
typedef typename traits::char_class_type m_type;
basic_char_set()
{
@@ -100,12 +100,12 @@ public:
}
m_empty = false;
}
void add_class(mask_type m)
void add_class(m_type m)
{
m_classes |= m;
m_empty = false;
}
void add_negated_class(mask_type m)
void add_negated_class(m_type m)
{
m_negated_classes |= m;
m_empty = false;
@@ -162,11 +162,11 @@ public:
{
return m_equivalents.end();
}
mask_type classes()const
m_type classes()const
{
return m_classes;
}
mask_type negated_classes()const
m_type negated_classes()const
{
return m_negated_classes;
}
@@ -179,8 +179,8 @@ private:
std::vector<digraph_type> m_ranges; // a list of end points of our ranges
bool m_negate; // true if the set is to be negated
bool m_has_digraphs; // true if we have digraphs present
mask_type m_classes; // character classes to match
mask_type m_negated_classes; // negated character classes to match
m_type m_classes; // character classes to match
m_type m_negated_classes; // negated character classes to match
bool m_empty; // whether we've added anything yet
std::vector<digraph_type> m_equivalents; // a list of equivalence classes
};
@@ -367,9 +367,9 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
{
typedef typename traits::string_type string_type;
typedef typename basic_char_set<charT, traits>::list_iterator item_iterator;
typedef typename traits::char_class_type mask_type;
typedef typename traits::char_class_type m_type;
re_set_long<mask_type>* result = static_cast<re_set_long<mask_type>*>(append_state(syntax_element_long_set, sizeof(re_set_long<mask_type>)));
re_set_long<m_type>* result = static_cast<re_set_long<m_type>*>(append_state(syntax_element_long_set, sizeof(re_set_long<m_type>)));
//
// fill in the basics:
//
@@ -513,28 +513,23 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
//
// finally reset the address of our last state:
//
m_last_state = result = static_cast<re_set_long<mask_type>*>(getaddress(offset));
m_last_state = result = static_cast<re_set_long<m_type>*>(getaddress(offset));
return result;
}
namespace{
template<class T>
inline bool char_less(T t1, T t2)
{
return t1 < t2;
}
template<>
inline bool char_less<char>(char t1, char t2)
inline bool char_less(char t1, char t2)
{
return static_cast<unsigned char>(t1) < static_cast<unsigned char>(t2);
}
template<>
inline bool char_less<signed char>(signed char t1, signed char t2)
inline bool char_less(signed char t1, signed char t2)
{
return static_cast<unsigned char>(t1) < static_cast<unsigned char>(t2);
}
}
template <class charT, class traits>
re_syntax_base* basic_regex_creator<charT, traits>::append_set(
@@ -598,7 +593,7 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
}
else
{
if(char_less<charT>(c2, c1))
if(char_less(c2, c1))
{
// Oops error:
return 0;
@@ -610,8 +605,8 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
//
// and now the classes:
//
typedef typename traits::char_class_type mask_type;
mask_type m = char_set.classes();
typedef typename traits::char_class_type m_type;
m_type m = char_set.classes();
if(flags() & regbase::icase)
{
// adjust m as needed:
@@ -982,7 +977,7 @@ void basic_regex_creator<charT, traits>::create_startmaps(re_syntax_base* state)
template <class charT, class traits>
int basic_regex_creator<charT, traits>::calculate_backstep(re_syntax_base* state)
{
typedef typename traits::char_class_type mask_type;
typedef typename traits::char_class_type m_type;
int result = 0;
while(state)
{
@@ -1035,10 +1030,10 @@ int basic_regex_creator<charT, traits>::calculate_backstep(re_syntax_base* state
state = rep->alt.p;
continue;
}
else if((state->type == syntax_element_long_set_rep))
else if(state->type == syntax_element_long_set_rep)
{
BOOST_ASSERT(rep->next.p->type == syntax_element_long_set);
if(static_cast<re_set_long<mask_type>*>(rep->next.p)->singleton == 0)
if(static_cast<re_set_long<m_type>*>(rep->next.p)->singleton == 0)
return -1;
if(rep->max != rep->min)
return -1;
@@ -1049,7 +1044,7 @@ int basic_regex_creator<charT, traits>::calculate_backstep(re_syntax_base* state
}
return -1;
case syntax_element_long_set:
if(static_cast<re_set_long<mask_type>*>(state)->singleton == 0)
if(static_cast<re_set_long<m_type>*>(state)->singleton == 0)
return -1;
result += 1;
break;
@@ -1113,9 +1108,9 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
if(l_map)
{
l_map[0] |= mask_init;
l_map['\n'] |= mask;
l_map['\r'] |= mask;
l_map['\f'] |= mask;
l_map[static_cast<unsigned>('\n')] |= mask;
l_map[static_cast<unsigned>('\r')] |= mask;
l_map[static_cast<unsigned>('\f')] |= mask;
l_map[0x85] |= mask;
}
// now figure out if we can match a NULL string at this point:
@@ -1219,14 +1214,14 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
case syntax_element_long_set:
if(l_map)
{
typedef typename traits::char_class_type mask_type;
if(static_cast<re_set_long<mask_type>*>(state)->singleton)
typedef typename traits::char_class_type m_type;
if(static_cast<re_set_long<m_type>*>(state)->singleton)
{
l_map[0] |= mask_init;
for(unsigned int i = 0; i < (1u << CHAR_BIT); ++i)
{
charT c = static_cast<charT>(i);
if(&c != re_is_set_member(&c, &c + 1, static_cast<re_set_long<mask_type>*>(state), *m_pdata, l_icase))
if(&c != re_is_set_member(&c, &c + 1, static_cast<re_set_long<m_type>*>(state), *m_pdata, l_icase))
l_map[i] |= mask;
}
}
@@ -1302,8 +1297,8 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
if(l_map)
{
l_map[0] |= mask_init;
l_map['\n'] |= mask;
l_map['\r'] |= mask;
l_map[static_cast<unsigned>('\n')] |= mask;
l_map[static_cast<unsigned>('\r')] |= mask;
}
if(pnull)
*pnull |= mask;
@@ -1338,7 +1333,7 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
re_syntax_base* p = m_pdata->m_first_state;
while(p)
{
if((p->type == syntax_element_recurse))
if(p->type == syntax_element_recurse)
{
re_brace* p2 = static_cast<re_brace*>(static_cast<re_jump*>(p)->alt.p);
if((p2->type == syntax_element_startmark) && (p2->index == static_cast<re_brace*>(state)->index))
@@ -1469,7 +1464,7 @@ void basic_regex_creator<charT, traits>::set_bad_repeat(re_syntax_base* pt)
template <class charT, class traits>
syntax_element_type basic_regex_creator<charT, traits>::get_repeat_type(re_syntax_base* state)
{
typedef typename traits::char_class_type mask_type;
typedef typename traits::char_class_type m_type;
if(state->type == syntax_element_rep)
{
// check to see if we are repeating a single state:
@@ -1484,7 +1479,7 @@ syntax_element_type basic_regex_creator<charT, traits>::get_repeat_type(re_synta
case re_detail::syntax_element_set:
return re_detail::syntax_element_short_set_rep;
case re_detail::syntax_element_long_set:
if(static_cast<re_detail::re_set_long<mask_type>*>(state->next.p)->singleton)
if(static_cast<re_detail::re_set_long<m_type>*>(state->next.p)->singleton)
return re_detail::syntax_element_long_set_rep;
break;
default:

View File

@@ -191,6 +191,7 @@ void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_c
this->m_pdata->m_status = error_code;
m_position = m_end; // don't bother parsing anything else
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
//
// Augment error message with the regular expression text:
//
@@ -211,6 +212,7 @@ void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_c
}
message += "'.";
}
#endif
#ifndef BOOST_NO_EXCEPTIONS
if(0 == (this->flags() & regex_constants::no_except))
@@ -660,6 +662,11 @@ template <class charT, class traits>
bool basic_regex_parser<charT, traits>::parse_extended_escape()
{
++m_position;
if(m_position == m_end)
{
fail(regex_constants::error_escape, m_position - m_base, "Incomplete escape sequence found.");
return false;
}
bool negate = false; // in case this is a character class escape: \w \d etc
switch(this->m_traits.escape_syntax_type(*m_position))
{
@@ -669,8 +676,8 @@ bool basic_regex_parser<charT, traits>::parse_extended_escape()
case regex_constants::escape_type_class:
{
escape_type_class_jump:
typedef typename traits::char_class_type mask_type;
mask_type m = this->m_traits.lookup_classname(m_position, m_position+1);
typedef typename traits::char_class_type m_type;
m_type m = this->m_traits.lookup_classname(m_position, m_position+1);
if(m != 0)
{
basic_char_set<charT, traits> char_set;
@@ -1383,8 +1390,8 @@ bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, tr
++name_first;
negated = true;
}
typedef typename traits::char_class_type mask_type;
mask_type m = this->m_traits.lookup_classname(name_first, name_last);
typedef typename traits::char_class_type m_type;
m_type m = this->m_traits.lookup_classname(name_first, name_last);
if(m == 0)
{
if(char_set.empty() && (name_last - name_first == 1))
@@ -2089,6 +2096,14 @@ insert_recursion:
return false;
}
v = this->m_traits.toi(m_position, m_end, 10);
if(m_position == m_end)
{
// Rewind to start of (? sequence:
--m_position;
while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
fail(regex_constants::error_perl_extension, m_position - m_base);
return false;
}
if(*m_position == charT('R'))
{
if(++m_position == m_end)
@@ -2492,9 +2507,11 @@ option_group_jump:
this->m_pdata->m_data.align();
re_jump* jmp = static_cast<re_jump*>(this->getaddress(jump_offset));
jmp->alt.i = this->m_pdata->m_data.size() - this->getoffset(jmp);
if(this->m_last_state == jmp)
if((this->m_last_state == jmp) && (markid != -2))
{
// Oops... we didn't have anything inside the assertion:
// Oops... we didn't have anything inside the assertion.
// Note we don't get here for negated forward lookahead as (?!)
// does have some uses.
// Rewind to start of (? sequence:
--m_position;
while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;

View File

@@ -20,6 +20,7 @@
#define BOOST_CPP_REGEX_TRAITS_HPP_INCLUDED
#include <boost/config.hpp>
#include <boost/integer.hpp>
#ifndef BOOST_NO_STD_LOCALE
@@ -107,12 +108,14 @@ template<class charT, class traits>
typename parser_buf<charT, traits>::pos_type
parser_buf<charT, traits>::seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which)
{
typedef typename boost::int_t<sizeof(way) * CHAR_BIT>::least cast_type;
if(which & ::std::ios_base::out)
return pos_type(off_type(-1));
std::ptrdiff_t size = this->egptr() - this->eback();
std::ptrdiff_t pos = this->gptr() - this->eback();
charT* g = this->eback();
switch(way)
switch(static_cast<cast_type>(way))
{
case ::std::ios_base::beg:
if((off < 0) || (off > size))

View File

@@ -84,7 +84,10 @@ template class BOOST_REGEX_DECL ::boost::re_detail::perl_matcher<BOOST_REGEX_CHA
# ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable : 4251 4231 4660)
# pragma warning(disable : 4251 4231)
# if BOOST_MSVC < 1600
# pragma warning(disable : 4660)
# endif
# endif
template class BOOST_REGEX_TEMPLATE_DECL basic_regex< BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >;
@@ -118,7 +121,7 @@ template class BOOST_REGEX_TEMPLATE_DECL ::boost::re_detail::perl_matcher< std::
#undef BOOST_REGEX_TEMPLATE_DECL
#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || !defined(BOOST_NO_EXTERN_TEMPLATE)
#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || !defined(BOOST_NO_CXX11_EXTERN_TEMPLATE)
# ifndef BOOST_REGEX_INSTANTIATE
# ifdef __GNUC__

View File

@@ -33,7 +33,10 @@
namespace boost{
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable : 4251 4231 4660)
#pragma warning(disable : 4251 4231)
# if BOOST_MSVC < 1600
# pragma warning(disable : 4660)
# endif
#endif
namespace re_detail{

View File

@@ -344,7 +344,10 @@ struct recursion_info
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable : 4251 4231 4660)
#pragma warning(disable : 4251 4231)
# if BOOST_MSVC < 1600
# pragma warning(disable : 4660)
# endif
#endif
template <class BidiIterator, class Allocator, class traits>

View File

@@ -828,9 +828,9 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat()
#ifdef __BORLANDC__
#pragma option push -w-8008 -w-8066 -w-8004
#endif
typedef typename traits::char_class_type mask_type;
typedef typename traits::char_class_type m_type;
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
const re_set_long<mask_type>* set = static_cast<const re_set_long<mask_type>*>(pstate->next.p);
const re_set_long<m_type>* set = static_cast<const re_set_long<m_type>*>(pstate->next.p);
std::size_t count = 0;
//
// start by working out how much we can skip:
@@ -1268,6 +1268,9 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_fast_dot_repeat(bool
}while((count < rep->max) && (position != last) && !can_start(*position, rep->_map, mask_skip));
}
// remember where we got to if this is a leading repeat:
if((rep->leading) && (count < rep->max))
restart = position;
if(position == last)
{
// can't repeat any more, remove the pushed state:
@@ -1434,7 +1437,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_short_set_repeat(bool
template <class BidiIterator, class Allocator, class traits>
bool perl_matcher<BidiIterator, Allocator, traits>::unwind_long_set_repeat(bool r)
{
typedef typename traits::char_class_type mask_type;
typedef typename traits::char_class_type m_type;
saved_single_repeat<BidiIterator>* pmp = static_cast<saved_single_repeat<BidiIterator>*>(m_backup_state);
// if we have a match, just discard this state:
@@ -1447,7 +1450,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_long_set_repeat(bool
const re_repeat* rep = pmp->rep;
std::size_t count = pmp->count;
pstate = rep->next.p;
const re_set_long<mask_type>* set = static_cast<const re_set_long<mask_type>*>(pstate);
const re_set_long<m_type>* set = static_cast<const re_set_long<m_type>*>(pstate);
position = pmp->last_position;
BOOST_ASSERT(rep->type == syntax_element_long_set_rep);

View File

@@ -180,8 +180,14 @@ private:
}
inline int toi(ForwardIter& i, ForwardIter j, int base)
{
#if defined(_MSC_VER) && defined(__INTEL_COMPILER) && ((__INTEL_COMPILER == 9999) || (__INTEL_COMPILER == 1210))
// Workaround for Intel support issue #656654.
// See also https://svn.boost.org/trac/boost/ticket/6359
return toi(i, j, base, mpl::false_());
#else
typedef typename boost::is_convertible<ForwardIter, const char_type*&>::type tag_type;
return toi(i, j, base, tag_type());
#endif
}
const traits& m_traits; // the traits class for localised formatting operations

View File

@@ -68,7 +68,7 @@ public:
// flags |= match_prev_avail;
BidirectionalIterator next_start = what[0].second;
match_flag_type f(flags);
if(!what.length())
if(!what.length() || (f & regex_constants::match_posix))
f |= regex_constants::match_not_initial_null;
//if(base != next_start)
// f |= regex_constants::match_not_bob;