+2006-03-05 Lars Gullik Bjøøonnes<larsbj@lyx.org>
+
+ * Upgrade to version 1.33.1 of boost.
+
2006-02-21 Lars Gullik Bjønnes <larsbj@lyx.org>
* boost/bind.hpp: include visit_each.hpp to fix a gcc 4.1 compile
--- /dev/null
+//-----------------------------------------------------------------------------
+// boost aligned_storage.hpp header file
+// See http://www.boost.org for updates, documentation, and revision history.
+//-----------------------------------------------------------------------------
+//
+// Copyright (c) 2002-2003
+// Eric Friedman, Itay Maman
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_ALIGNED_STORAGE_HPP
+#define BOOST_ALIGNED_STORAGE_HPP
+
+#include <cstddef> // for std::size_t
+
+#include "boost/config.hpp"
+#include "boost/detail/workaround.hpp"
+#include "boost/type_traits/alignment_of.hpp"
+#include "boost/type_traits/type_with_alignment.hpp"
+#include "boost/type_traits/is_pod.hpp"
+
+#include "boost/mpl/eval_if.hpp"
+#include "boost/mpl/identity.hpp"
+
+#include "boost/type_traits/detail/bool_trait_def.hpp"
+
+namespace boost {
+
+namespace detail { namespace aligned_storage {
+
+BOOST_STATIC_CONSTANT(
+ std::size_t
+ , alignment_of_max_align = ::boost::alignment_of<max_align>::value
+ );
+
+//
+// To be TR1 conforming this must be a POD type:
+//
+template <
+ std::size_t size_
+ , std::size_t alignment_
+>
+struct aligned_storage_imp
+{
+ union data_t
+ {
+ char buf[size_];
+
+ typename mpl::eval_if_c<
+ alignment_ == std::size_t(-1)
+ , mpl::identity<detail::max_align>
+ , type_with_alignment<alignment_>
+ >::type align_;
+ } data_;
+};
+
+}} // namespace detail::aligned_storage
+
+template <
+ std::size_t size_
+ , std::size_t alignment_ = std::size_t(-1)
+>
+class aligned_storage
+{
+private: // representation
+
+ detail::aligned_storage::aligned_storage_imp<size_, alignment_> data_;
+
+public: // constants
+
+ typedef detail::aligned_storage::aligned_storage_imp<size_, alignment_> type;
+
+ BOOST_STATIC_CONSTANT(
+ std::size_t
+ , size = size_
+ );
+ BOOST_STATIC_CONSTANT(
+ std::size_t
+ , alignment = (
+ alignment_ == std::size_t(-1)
+ ? ::boost::detail::aligned_storage::alignment_of_max_align
+ : alignment_
+ )
+ );
+
+#if defined(__GNUC__) &&\
+ (__GNUC__ > 3) ||\
+ (__GNUC__ == 3 && (__GNUC_MINOR__ > 2 ||\
+ (__GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ >=3)))
+
+private: // noncopyable
+
+ aligned_storage(const aligned_storage&);
+ aligned_storage& operator=(const aligned_storage&);
+
+#else // gcc less than 3.2.3
+
+public: // _should_ be noncopyable, but GCC compiler emits error
+
+ aligned_storage(const aligned_storage&);
+ aligned_storage& operator=(const aligned_storage&);
+
+#endif // gcc < 3.2.3 workaround
+
+public: // structors
+
+ aligned_storage()
+ {
+ }
+
+ ~aligned_storage()
+ {
+ }
+
+public: // accessors
+
+ void* address()
+ {
+ return this;
+ }
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
+
+ const void* address() const
+ {
+ return this;
+ }
+
+#else // MSVC6
+
+ const void* address() const;
+
+#endif // MSVC6 workaround
+
+};
+
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
+
+// MSVC6 seems not to like inline functions with const void* returns, so we
+// declare the following here:
+
+template <std::size_t S, std::size_t A>
+const void* aligned_storage<S,A>::address() const
+{
+ return const_cast< aligned_storage<S,A>* >(this)->address();
+}
+
+#endif // MSVC6 workaround
+
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+//
+// Make sure that is_pod recognises aligned_storage<>::type
+// as a POD (Note that aligned_storage<> itself is not a POD):
+//
+template <std::size_t size_, std::size_t alignment_>
+struct is_pod<boost::detail::aligned_storage::aligned_storage_imp<size_,alignment_> >
+ BOOST_TT_AUX_BOOL_C_BASE(true)
+{
+ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(true)
+};
+#endif
+
+
+} // namespace boost
+
+#include "boost/type_traits/detail/bool_trait_undef.hpp"
+
+#endif // BOOST_ALIGNED_STORAGE_HPP
#include <typeinfo>
#include "boost/config.hpp"
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/is_reference.hpp>
#include <boost/throw_exception.hpp>
+#include <boost/static_assert.hpp>
namespace boost
{
class placeholder
{
public: // structors
-
+
virtual ~placeholder()
{
}
virtual const std::type_info & type() const = 0;
virtual placeholder * clone() const = 0;
-
+
};
template<typename ValueType>
template<typename ValueType>
friend ValueType * any_cast(any *);
+ template<typename ValueType>
+ friend ValueType * unsafe_any_cast(any *);
+
#else
public: // representation (public so any_cast can be non-friend)
template<typename ValueType>
ValueType any_cast(const any & operand)
{
- const ValueType * result = any_cast<ValueType>(&operand);
+ typedef BOOST_DEDUCED_TYPENAME remove_reference<ValueType>::type nonref;
+
+#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ // If 'nonref' is still reference type, it means the user has not
+ // specialized 'remove_reference'.
+
+ // Please use BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION macro
+ // to generate specialization of remove_reference for your class
+ // See type traits library documentation for details
+ BOOST_STATIC_ASSERT(!is_reference<nonref>::value);
+#endif
+
+ const nonref * result = any_cast<nonref>(&operand);
+ if(!result)
+ boost::throw_exception(bad_any_cast());
+ return *result;
+ }
+
+ template<typename ValueType>
+ ValueType any_cast(any & operand)
+ {
+ typedef BOOST_DEDUCED_TYPENAME remove_reference<ValueType>::type nonref;
+
+#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ // The comment in the above version of 'any_cast' explains when this
+ // assert is fired and what to do.
+ BOOST_STATIC_ASSERT(!is_reference<nonref>::value);
+#endif
+
+ nonref * result = any_cast<nonref>(&operand);
if(!result)
boost::throw_exception(bad_any_cast());
return *result;
}
+ // Note: The "unsafe" versions of any_cast are not part of the
+ // public interface and may be removed at any time. They are
+ // required where we know what type is stored in the any and can't
+ // use typeid() comparison, e.g., when our types may travel across
+ // different shared libraries.
+ template<typename ValueType>
+ ValueType * unsafe_any_cast(any * operand)
+ {
+ return &static_cast<any::holder<ValueType> *>(operand->content)->held;
+ }
+
+ template<typename ValueType>
+ const ValueType * unsafe_any_cast(const any * operand)
+ {
+ return any_cast<ValueType>(const_cast<any *>(operand));
+ }
}
// Copyright Kevlin Henney, 2000, 2001, 2002. All rights reserved.
#define BOOST_ASSERT(expr) ((expr)? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__))
#else
-# include <assert.h>
+# include <assert.h> // .h to support old libraries w/o <cassert> - effect is the same
# define BOOST_ASSERT(expr) assert(expr)
#endif
//
// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd.
// Copyright (c) 2001 David Abrahams
+// Copyright (c) 2005 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
return f->get();
}
-#if !( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, <= 0x3003) )
+#if !( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, <= 0x3004) )
template<class R, class T> inline _mfi::dm<R, T> unwrap(R T::* * pm, int)
{
list0() {}
- template<class T> T & operator[] (value<T> & v) const { return v.get(); }
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
- template<class T> T const & operator[] (value<T> const & v) const { return v.get(); }
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
A1 operator[] (boost::arg<1> (*) ()) const { return a1_; }
- template<class T> T & operator[] (value<T> & v) const { return v.get(); }
+ template<class T> T & operator[] ( _bi::value<T> & v ) const { return v.get(); }
- template<class T> T const & operator[] (value<T> const & v) const { return v.get(); }
+ template<class T> T const & operator[] ( _bi::value<T> const & v ) const { return v.get(); }
template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
A1 operator[] (boost::arg<1> (*) ()) const { return a1_; }
A2 operator[] (boost::arg<2> (*) ()) const { return a2_; }
- template<class T> T & operator[] (value<T> & v) const { return v.get(); }
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
- template<class T> T const & operator[] (value<T> const & v) const { return v.get(); }
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
A2 operator[] (boost::arg<2> (*) ()) const { return a2_; }
A3 operator[] (boost::arg<3> (*) ()) const { return a3_; }
- template<class T> T & operator[] (value<T> & v) const { return v.get(); }
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
- template<class T> T const & operator[] (value<T> const & v) const { return v.get(); }
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
A3 operator[] (boost::arg<3> (*) ()) const { return a3_; }
A4 operator[] (boost::arg<4> (*) ()) const { return a4_; }
- template<class T> T & operator[] (value<T> & v) const { return v.get(); }
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
- template<class T> T const & operator[] (value<T> const & v) const { return v.get(); }
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
A4 operator[] (boost::arg<4> (*) ()) const { return a4_; }
A5 operator[] (boost::arg<5> (*) ()) const { return a5_; }
- template<class T> T & operator[] (value<T> & v) const { return v.get(); }
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
- template<class T> T const & operator[] (value<T> const & v) const { return v.get(); }
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
A5 operator[] (boost::arg<5> (*) ()) const { return a5_; }
A6 operator[] (boost::arg<6> (*) ()) const { return a6_; }
- template<class T> T & operator[] (value<T> & v) const { return v.get(); }
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
- template<class T> T const & operator[] (value<T> const & v) const { return v.get(); }
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
A6 operator[] (boost::arg<6> (*) ()) const { return a6_; }
A7 operator[] (boost::arg<7> (*) ()) const { return a7_; }
- template<class T> T & operator[] (value<T> & v) const { return v.get(); }
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
- template<class T> T const & operator[] (value<T> const & v) const { return v.get(); }
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
A7 operator[] (boost::arg<7> (*) ()) const { return a7_; }
A8 operator[] (boost::arg<8> (*) ()) const { return a8_; }
- template<class T> T & operator[] (value<T> & v) const { return v.get(); }
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
- template<class T> T const & operator[] (value<T> const & v) const { return v.get(); }
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
A8 operator[] (boost::arg<8> (*) ()) const { return a8_; }
A9 operator[] (boost::arg<9> (*) ()) const { return a9_; }
- template<class T> T & operator[] (value<T> & v) const { return v.get(); }
+ template<class T> T & operator[] (_bi::value<T> & v) const { return v.get(); }
- template<class T> T const & operator[] (value<T> const & v) const { return v.get(); }
+ template<class T> T const & operator[] (_bi::value<T> const & v) const { return v.get(); }
template<class T> T & operator[] (reference_wrapper<T> const & v) const { return v.get(); }
#endif
-// bind_t::operator==
+// function_equal
-template<class R, class F, class L> bool operator==(bind_t<R, F, L> const & a, bind_t<R, F, L> const & b)
+#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+
+// put overloads in _bi, rely on ADL
+
+# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+
+template<class R, class F, class L> bool function_equal( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b )
{
return a.compare(b);
}
-template<class R, class F, class L> bool operator!=(bind_t<R, F, L> const & a, bind_t<R, F, L> const & b)
+# else
+
+template<class R, class F, class L> bool function_equal_impl( bind_t<R, F, L> const & a, bind_t<R, F, L> const & b, int )
{
- return !a.compare(b);
+ return a.compare(b);
}
+# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+
+#else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+
+// put overloads in boost
+
+} // namespace _bi
+
+# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+
+template<class R, class F, class L> bool function_equal( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b )
+{
+ return a.compare(b);
+}
+
+# else
+
+template<class R, class F, class L> bool function_equal_impl( _bi::bind_t<R, F, L> const & a, _bi::bind_t<R, F, L> const & b, int )
+{
+ return a.compare(b);
+}
+
+# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+
+namespace _bi
+{
+
+#endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
+
// add_value
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530)
template<class T> struct add_value
{
- typedef value<T> type;
+ typedef _bi::value<T> type;
};
template<class T> struct add_value< value<T> >
{
- typedef value<T> type;
+ typedef _bi::value<T> type;
};
template<class T> struct add_value< reference_wrapper<T> >
typedef list9<B1, B2, B3, B4, B5, B6, B7, B8, B9> type;
};
+// operator!
+
+struct logical_not
+{
+ template<class V> bool operator()(V const & v) const { return !v; }
+};
+
+template<class R, class F, class L>
+ bind_t< bool, logical_not, list1< bind_t<R, F, L> > >
+ operator! (bind_t<R, F, L> const & f)
+{
+ typedef list1< bind_t<R, F, L> > list_type;
+ return bind_t<bool, logical_not, list_type> ( logical_not(), list_type(f) );
+}
+
+// relational operators
+
+#define BOOST_BIND_OPERATOR( op, name ) \
+\
+struct name \
+{ \
+ template<class V, class W> bool operator()(V const & v, W const & w) const { return v op w; } \
+}; \
+ \
+template<class R, class F, class L, class A2> \
+ bind_t< bool, name, list2< bind_t<R, F, L>, typename add_value<A2>::type > > \
+ operator op (bind_t<R, F, L> const & f, A2 a2) \
+{ \
+ typedef typename add_value<A2>::type B2; \
+ typedef list2< bind_t<R, F, L>, B2> list_type; \
+ return bind_t<bool, name, list_type> ( name(), list_type(f, a2) ); \
+}
+
+BOOST_BIND_OPERATOR( ==, equal )
+BOOST_BIND_OPERATOR( !=, not_equal )
+
+BOOST_BIND_OPERATOR( <, less )
+BOOST_BIND_OPERATOR( <=, less_equal )
+
+BOOST_BIND_OPERATOR( >, greater )
+BOOST_BIND_OPERATOR( >=, greater_equal )
+
+#undef BOOST_BIND_OPERATOR
+
+#if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3)
+
+// resolve ambiguity with rel_ops
+
+#define BOOST_BIND_OPERATOR( op, name ) \
+\
+template<class R, class F, class L> \
+ bind_t< bool, name, list2< bind_t<R, F, L>, bind_t<R, F, L> > > \
+ operator op (bind_t<R, F, L> const & f, bind_t<R, F, L> const & g) \
+{ \
+ typedef list2< bind_t<R, F, L>, bind_t<R, F, L> > list_type; \
+ return bind_t<bool, name, list_type> ( name(), list_type(f, g) ); \
+}
+
+BOOST_BIND_OPERATOR( !=, not_equal )
+BOOST_BIND_OPERATOR( <=, less_equal )
+BOOST_BIND_OPERATOR( >, greater )
+BOOST_BIND_OPERATOR( >=, greater_equal )
+
+#endif
+
} // namespace _bi
// visit_each
#undef BOOST_BIND_MF_NAME
#undef BOOST_BIND_MF_CC
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_BIND_MF_NAME(X) X##_cdecl
+#define BOOST_BIND_MF_CC __cdecl
+
+#include <boost/bind/bind_mf_cc.hpp>
+
+#undef BOOST_BIND_MF_NAME
+#undef BOOST_BIND_MF_CC
+
+#endif
+
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
#define BOOST_BIND_MF_NAME(X) X##_stdcall
// boost cast.hpp header file ----------------------------------------------//
-// (C) Copyright Kevlin Henney and Dave Abrahams 1999.
+// (C) Copyright Kevlin Henney and Dave Abrahams 1999.
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/conversion for Documentation.
// Revision History
-// 02 Apr 01 Removed BOOST_NO_LIMITS workarounds and included
-// <boost/limits.hpp> instead (the workaround did not
-// actually compile when BOOST_NO_LIMITS was defined in
+// 23 JUn 05 numeric_cast removed and redirected to the new verion (Fernando Cacciola)
+// 02 Apr 01 Removed BOOST_NO_LIMITS workarounds and included
+// <boost/limits.hpp> instead (the workaround did not
+// actually compile when BOOST_NO_LIMITS was defined in
// any case, so we loose nothing). (John Maddock)
// 21 Jan 01 Undid a bug I introduced yesterday. numeric_cast<> never
// worked with stock GCC; trying to get it to do that broke
// (Dave Abrahams)
// 30 Jun 00 More MSVC6 wordarounds. See comments below. (Dave Abrahams)
// 28 Jun 00 Removed implicit_cast<>. See comment below. (Beman Dawes)
-// 27 Jun 00 More MSVC6 workarounds
+// 27 Jun 00 More MSVC6 workarounds
// 15 Jun 00 Add workarounds for MSVC6
// 2 Feb 00 Remove bad_numeric_cast ";" syntax error (Doncho Angelov)
// 26 Jan 00 Add missing throw() to bad_numeric_cast::what(0 (Adam Levar)
// 29 Dec 99 Change using declarations so usages in other namespaces work
// correctly (Dave Abrahams)
// 23 Sep 99 Change polymorphic_downcast assert to also detect M.I. errors
-// as suggested Darin Adler and improved by Valentin Bonnard.
+// as suggested Darin Adler and improved by Valentin Bonnard.
// 2 Sep 99 Remove controversial asserts, simplify, rename.
// 30 Aug 99 Move to cast.hpp, replace value_cast with numeric_cast,
// place in nested namespace.
// polymorphic_cast --------------------------------------------------------//
// Runtime checked polymorphic downcasts and crosscasts.
- // Suggested in The C++ Programming Language, 3rd Ed, Bjarne Stroustrup,
+ // Suggested in The C++ Programming Language, 3rd Ed, Bjarne Stroustrup,
// section 15.8 exercise 1, page 425.
template <class Target, class Source>
return static_cast<Target>(x);
}
-// implicit_cast -----------------------------------------------------------//
-//
-// Removed due to uncertain purpose. Use either numeric_cast (see below)
-// or static_cast according to the need.
-
-// numeric_cast and related exception --------------------------------------//
-
-// Contributed by Kevlin Henney
-
-// bad_numeric_cast --------------------------------------------------------//
-
- // exception used to indicate runtime numeric_cast failure
- class bad_numeric_cast : public std::bad_cast
- {
- public:
- // constructors, destructors and assignment operator defaulted
-
- // function inlined for brevity and consistency with rest of library
- virtual const char *what() const throw()
- {
- return "bad numeric cast: loss of range in numeric_cast";
- }
- };
-
-// numeric_cast ------------------------------------------------------------//
-
-#if !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_SGI_CPP_LIMITS)
-
- namespace detail
- {
- template <class T>
- struct signed_numeric_limits : std::numeric_limits<T>
- {
- static inline T min BOOST_PREVENT_MACRO_SUBSTITUTION ()
- {
- return (std::numeric_limits<T>::min)() >= 0
- // unary minus causes integral promotion, thus the static_cast<>
- ? static_cast<T>(-(std::numeric_limits<T>::max)())
- : (std::numeric_limits<T>::min)();
- };
- };
-
- // Move to namespace boost in utility.hpp?
- template <class T, bool specialized>
- struct fixed_numeric_limits_base
- : public if_true< std::numeric_limits<T>::is_signed >
- ::BOOST_NESTED_TEMPLATE then< signed_numeric_limits<T>,
- std::numeric_limits<T>
- >::type
- {};
-
- template <class T>
- struct fixed_numeric_limits
- : fixed_numeric_limits_base<T,(std::numeric_limits<T>::is_specialized)>
- {};
-
-# ifdef BOOST_HAS_LONG_LONG
- // cover implementations which supply no specialization for long
- // long / unsigned long long. Not intended to be full
- // numeric_limits replacements, but good enough for numeric_cast<>
- template <>
- struct fixed_numeric_limits_base< ::boost::long_long_type, false>
- {
- BOOST_STATIC_CONSTANT(bool, is_specialized = true);
- BOOST_STATIC_CONSTANT(bool, is_signed = true);
- static ::boost::long_long_type max BOOST_PREVENT_MACRO_SUBSTITUTION ()
- {
-# ifdef LONGLONG_MAX
- return LONGLONG_MAX;
-# else
- return 9223372036854775807LL; // hope this is portable
-# endif
- }
-
- static ::boost::long_long_type min BOOST_PREVENT_MACRO_SUBSTITUTION ()
- {
-# ifdef LONGLONG_MIN
- return LONGLONG_MIN;
-# else
- return -( 9223372036854775807LL )-1; // hope this is portable
-# endif
- }
- };
-
- template <>
- struct fixed_numeric_limits_base< ::boost::ulong_long_type, false>
- {
- BOOST_STATIC_CONSTANT(bool, is_specialized = true);
- BOOST_STATIC_CONSTANT(bool, is_signed = false);
- static ::boost::ulong_long_type max BOOST_PREVENT_MACRO_SUBSTITUTION ()
- {
-# ifdef ULONGLONG_MAX
- return ULONGLONG_MAX;
-# else
- return 0xffffffffffffffffULL; // hope this is portable
-# endif
- }
-
- static ::boost::ulong_long_type min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; }
- };
-# endif
- } // namespace detail
-
-// less_than_type_min -
- // x_is_signed should be numeric_limits<X>::is_signed
- // y_is_signed should be numeric_limits<Y>::is_signed
- // y_min should be numeric_limits<Y>::min()
- //
- // check(x, y_min) returns true iff x < y_min without invoking comparisons
- // between signed and unsigned values.
- //
- // "poor man's partial specialization" is in use here.
- template <bool x_is_signed, bool y_is_signed>
- struct less_than_type_min
- {
- template <class X, class Y>
- static bool check(X x, Y y_min)
- { return x < y_min; }
- };
-
- template <>
- struct less_than_type_min<false, true>
- {
- template <class X, class Y>
- static bool check(X, Y)
- { return false; }
- };
-
- template <>
- struct less_than_type_min<true, false>
- {
- template <class X, class Y>
- static bool check(X x, Y)
- { return x < 0; }
- };
-
- // greater_than_type_max -
- // same_sign should be:
- // numeric_limits<X>::is_signed == numeric_limits<Y>::is_signed
- // y_max should be numeric_limits<Y>::max()
- //
- // check(x, y_max) returns true iff x > y_max without invoking comparisons
- // between signed and unsigned values.
- //
- // "poor man's partial specialization" is in use here.
- template <bool same_sign, bool x_is_signed>
- struct greater_than_type_max;
-
- template<>
- struct greater_than_type_max<true, true>
- {
- template <class X, class Y>
- static inline bool check(X x, Y y_max)
- { return x > y_max; }
- };
-
- template <>
- struct greater_than_type_max<false, true>
- {
- // What does the standard say about this? I think it's right, and it
- // will work with every compiler I know of.
- template <class X, class Y>
- static inline bool check(X x, Y)
- { return x >= 0 && static_cast<X>(static_cast<Y>(x)) != x; }
-
-# if defined(BOOST_MSVC) && BOOST_MSVC <= 1200
- // MSVC6 can't static_cast unsigned __int64 -> floating types
-# define BOOST_UINT64_CAST(src_type) \
- static inline bool check(src_type x, unsigned __int64) \
- { \
- if (x < 0) return false; \
- unsigned __int64 y = static_cast<unsigned __int64>(x); \
- bool odd = y & 0x1; \
- __int64 div2 = static_cast<__int64>(y >> 1); \
- return ((static_cast<src_type>(div2) * 2.0) + odd) != x; \
- }
-
- BOOST_UINT64_CAST(long double);
- BOOST_UINT64_CAST(double);
- BOOST_UINT64_CAST(float);
-# undef BOOST_UINT64_CAST
-# endif
- };
-
- template<>
- struct greater_than_type_max<true, false>
- {
- template <class X, class Y>
- static inline bool check(X x, Y y_max)
- { return x > y_max; }
- };
-
- template <>
- struct greater_than_type_max<false, false>
- {
- // What does the standard say about this? I think it's right, and it
- // will work with every compiler I know of.
- template <class X, class Y>
- static inline bool check(X x, Y)
- { return static_cast<X>(static_cast<Y>(x)) != x; }
- };
-
-#else // use #pragma hacks if available
-
- namespace detail
- {
-# if BOOST_MSVC
-# pragma warning(push)
-# pragma warning(disable : 4018)
-# pragma warning(disable : 4146)
-#elif defined(__BORLANDC__)
-# pragma option push -w-8041
-# endif
-
- // Move to namespace boost in utility.hpp?
- template <class T>
- struct fixed_numeric_limits : public std::numeric_limits<T>
- {
- static inline T min BOOST_PREVENT_MACRO_SUBSTITUTION ()
- {
- return std::numeric_limits<T>::is_signed && (std::numeric_limits<T>::min)() >= 0
- ? T(-(std::numeric_limits<T>::max)()) : (std::numeric_limits<T>::min)();
- }
- };
-
-# if BOOST_MSVC
-# pragma warning(pop)
-#elif defined(__BORLANDC__)
-# pragma option pop
-# endif
- } // namespace detail
-
-#endif
-
- template<typename Target, typename Source>
- inline Target numeric_cast(Source arg BOOST_EXPLICIT_DEFAULT_TARGET)
- {
- // typedefs abbreviating respective trait classes
- typedef detail::fixed_numeric_limits<Source> arg_traits;
- typedef detail::fixed_numeric_limits<Target> result_traits;
-
-#if defined(BOOST_STRICT_CONFIG) \
- || (!defined(__HP_aCC) || __HP_aCC > 33900) \
- && (!defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) \
- || defined(BOOST_SGI_CPP_LIMITS))
- // typedefs that act as compile time assertions
- // (to be replaced by boost compile time assertions
- // as and when they become available and are stable)
- typedef bool argument_must_be_numeric[arg_traits::is_specialized];
- typedef bool result_must_be_numeric[result_traits::is_specialized];
-
- const bool arg_is_signed = arg_traits::is_signed;
- const bool result_is_signed = result_traits::is_signed;
- const bool same_sign = arg_is_signed == result_is_signed;
-
- if (less_than_type_min<arg_is_signed, result_is_signed>::check(arg, (result_traits::min)())
- || greater_than_type_max<same_sign, arg_is_signed>::check(arg, (result_traits::max)())
- )
-
-#else // We need to use #pragma hacks if available
-
-# if BOOST_MSVC
-# pragma warning(push)
-# pragma warning(disable : 4018)
-#elif defined(__BORLANDC__)
-#pragma option push -w-8012
-# endif
- if ((arg < 0 && !result_traits::is_signed) // loss of negative range
- || (arg_traits::is_signed && arg < (result_traits::min)()) // underflow
- || arg > (result_traits::max)()) // overflow
-# if BOOST_MSVC
-# pragma warning(pop)
-#elif defined(__BORLANDC__)
-#pragma option pop
-# endif
-#endif
- {
- throw bad_numeric_cast();
- }
- return static_cast<Target>(arg);
- } // numeric_cast
-
# undef BOOST_EXPLICIT_DEFAULT_TARGET
} // namespace boost
+# include <boost/numeric/conversion/cast.hpp>
+
#endif // BOOST_CAST_HPP
function_requires< AssignableConcept<Container> >();
const_constraints(c);
}
- void const_constraints(const Container& c) {
- i = c.begin();
- i = c.end();
- n = c.size();
- n = c.max_size();
- b = c.empty();
+ void const_constraints(const Container& cc) {
+ i = cc.begin();
+ i = cc.end();
+ n = cc.size();
+ n = cc.max_size();
+ b = cc.empty();
}
Container c;
bool b;
BidirectionalIteratorConcept<const_reverse_iterator> >();
const_constraints(c);
}
- void const_constraints(const ReversibleContainer& c) {
- const_reverse_iterator i = c.rbegin();
- i = c.rend();
+ void const_constraints(const ReversibleContainer& cc) {
+ const_reverse_iterator i = cc.rbegin();
+ i = cc.rend();
}
ReversibleContainer c;
};
const_constraints(c);
}
- void const_constraints(const RandomAccessContainer& c) {
- const_reference r = c[n];
+ void const_constraints(const RandomAccessContainer& cc) {
+ const_reference r = cc[n];
ignore_unused_variable_warning(r);
}
RandomAccessContainer c;
reference r = c.back();
ignore_unused_variable_warning(r);
}
- void const_constraints(const BackInsertionSequence& c) {
- const_reference r = c.back();
+ void const_constraints(const BackInsertionSequence& cc) {
+ const_reference r = cc.back();
ignore_unused_variable_warning(r);
};
BackInsertionSequence c;
c.erase(r.first, r.second);
const_constraints(c);
}
- void const_constraints(const AssociativeContainer& c) {
- ci = c.find(k);
- n = c.count(k);
- cr = c.equal_range(k);
+ void const_constraints(const AssociativeContainer& cc) {
+ ci = cc.find(k);
+ n = cc.count(k);
+ cr = cc.equal_range(k);
}
typedef typename AssociativeContainer::iterator iterator;
typedef typename AssociativeContainer::const_iterator const_iterator;
Before including this header you must define one or more of define the following macros:
-BOOST_LIB_NAME: Required: A string containing the basename of the library,
- for example boost_regex.
-BOOST_DYN_LINK: Optional: when set link to dll rather than static library.
-BOOST_LIB_DIAGNOSTIC: Optional: when set the header will print out the name
- of the library selected (useful for debugging).
+BOOST_LIB_NAME: Required: A string containing the basename of the library,
+ for example boost_regex.
+BOOST_LIB_TOOLSET: Optional: the base name of the toolset.
+BOOST_DYN_LINK: Optional: when set link to dll rather than static library.
+BOOST_LIB_DIAGNOSTIC: Optional: when set the header will print out the name
+ of the library selected (useful for debugging).
+BOOST_AUTO_LINK_NOMANGLE: Specifies that we should link to BOOST_LIB_NAME.lib,
+ rather than a mangled-name version.
These macros will be undef'ed at the end of the header, further this header
has no include guards - so be sure to include it only once from your library!
# error "Incompatible build options"
#endif
//
-// select toolset:
+// select toolset if not defined already:
//
+#ifndef BOOST_LIB_TOOLSET
#if defined(BOOST_MSVC) && (BOOST_MSVC == 1200)
// vc6:
# define BOOST_LIB_TOOLSET "cw9"
#endif
+#endif // BOOST_LIB_TOOLSET
//
// select thread opt:
//
// figure out whether we want the debug builds or not:
//
+#if __BORLANDC__ > 0x561
#pragma defineonoption BOOST_BORLAND_DEBUG -v
+#endif
//
// sanity check:
//
&& defined(BOOST_LIB_RT_OPT) \
&& defined(BOOST_LIB_VERSION)
+#ifndef BOOST_AUTO_LINK_NOMANGLE
# pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib")
-#ifdef BOOST_LIB_DIAGNOSTIC
-# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib")
+# ifdef BOOST_LIB_DIAGNOSTIC
+# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib")
+# endif
+#else
+# pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
+# ifdef BOOST_LIB_DIAGNOSTIC
+# pragma message ("Linking to lib file: " BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib")
+# endif
#endif
#else
#if defined(BOOST_LIB_NAME)
# undef BOOST_LIB_NAME
#endif
-#if defined(BOOST_LIB_TOOLSET)
-# undef BOOST_LIB_TOOLSET
-#endif
+// Don't undef this one: it can be set by the user and should be the
+// same for all libraries:
+//#if defined(BOOST_LIB_TOOLSET)
+//# undef BOOST_LIB_TOOLSET
+//#endif
#if defined(BOOST_LIB_THREAD_OPT)
# undef BOOST_LIB_THREAD_OPT
#endif
#if defined(BOOST_DYN_LINK)
# undef BOOST_DYN_LINK
#endif
+#if defined(BOOST_AUTO_LINK_NOMANGLE)
+# undef BOOST_AUTO_LINK_NOMANGLE
+#endif
+
+
#endif
#endif
-#if (__BORLANDC__ <= 0x564)
-# define BOOST_NO_SFINAE
-#endif
-
// Version 7.0 (Kylix) and below:
#if (__BORLANDC__ <= 0x570)
+# define BOOST_NO_SFINAE
# define BOOST_NO_INTEGRAL_INT64_T
# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
# define BOOST_NO_PRIVATE_IN_AGGREGATE
// without it, this needs more investigation:
# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
+# define BOOST_NO_IS_ABSTRACT
# ifdef NDEBUG
// fix broken <cstring> so that Boost.test works:
# include <cstring>
#if (__COMO_VERSION__ <= 4245)
-# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
-
# if defined(_MSC_VER) && _MSC_VER <= 1300
# if _MSC_VER > 100
// only set this in non-strict mode:
// (C) Copyright Jens Maurer 2001.
// (C) Copyright David Abrahams 2002.
// (C) Copyright Aleksey Gurtovoy 2002.
+// (C) Copyright Markus Schoepflin 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# define BOOST_NO_TEMPLATE_TEMPLATES
#endif
+#if (__EDG_VERSION__ < 300) && !defined(BOOST_NO_IS_ABSTRACT)
+# define BOOST_NO_IS_ABSTRACT
+#endif
+
+#if (__EDG_VERSION__ <= 303) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL)
+# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
+#endif
+
// See also kai.hpp which checks a Kai-specific symbol for EH
# if !defined(__KCC) && !defined(__EXCEPTIONS)
# define BOOST_NO_EXCEPTIONS
// versions check:
// Nothing to do here?
-# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
// GNU C++ compiler setup:
-# if __GNUC__ == 2 && __GNUC_MINOR__ == 91
+#if __GNUC__ < 3
+# if __GNUC_MINOR__ == 91
// egcs 1.1 won't parse shared_ptr.hpp without this:
# define BOOST_NO_AUTO_PTR
# endif
-# if __GNUC__ == 2 && __GNUC_MINOR__ < 95
+# if __GNUC_MINOR__ < 95
//
// Prior to gcc 2.95 member templates only partly
// work - define BOOST_MSVC6_MEMBER_TEMPLATES
# endif
# endif
-# if __GNUC__ == 2 && __GNUC_MINOR__ < 96
+# if __GNUC_MINOR__ < 96
# define BOOST_NO_SFINAE
# endif
-# if __GNUC__ == 2 && __GNUC_MINOR__ <= 97
+# if __GNUC_MINOR__ <= 97
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
# define BOOST_NO_OPERATORS_IN_NAMESPACE
# endif
-# if __GNUC__ < 3
-# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
-# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
-# endif
+# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
+# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
+# define BOOST_NO_IS_ABSTRACT
+#elif __GNUC__ == 3
+ //
+ // gcc-3.x problems:
+ //
+ // Bug specific to gcc 3.1 and 3.2:
+ //
+# if ((__GNUC_MINOR__ == 1) || (__GNUC_MINOR__ == 2))
+# define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
+# endif
+# if __GNUC_MINOR__ < 4
+# define BOOST_NO_IS_ABSTRACT
+# endif
+#endif
#ifndef __EXCEPTIONS
# define BOOST_NO_EXCEPTIONS
#endif
-//
-// Bug specific to gcc 3.1 and 3.2:
-//
-#if (__GNUC__ == 3) && ((__GNUC_MINOR__ == 1) || (__GNUC_MINOR__ == 2))
-# define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
-#endif
//
// Threading support: Turn this on unconditionally here (except for
# error "Compiler not configured - please reconfigure"
#endif
//
-// last known and checked version is 3.4:
+// last known and checked version is 4.0 (Pre-release):
#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 0))
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
# else
-# warning "Unknown compiler version - please run the configure tests and report the results"
+// we don't emit warnings here anymore since there are no defect macros defined for
+// gcc post 3.4, so any failures are gcc regressions...
+//# warning "Unknown compiler version - please run the configure tests and report the results"
# endif
#endif
# define BOOST_NO_TEMPLATE_TEMPLATES
# define BOOST_NO_SWPRINTF
# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
+# define BOOST_NO_IS_ABSTRACT
// std lib config should set this one already:
//# define BOOST_NO_STD_ALLOCATOR
#endif
# endif
#endif
+#if defined(__GNUC__) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL)
+//
+// Figure out when Intel is emulating this gcc bug:
+//
+# if ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)) || (BOOST_INTEL <= 900)
+# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
+# endif
+#endif
+
//
// Verify that we have actually got BOOST_NO_INTRINSIC_WCHAR_T
// set correctly, if we don't do this now, we will get errors later
template<> struct assert_intrinsic_wchar_t<unsigned short> {};
#endif
-
-#if (BOOST_INTEL_CXX_VERSION <= 800) || !defined(BOOST_STRICT_CONFIG)
-# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
-#endif
-
#if _MSC_VER+0 >= 1000
# if _MSC_VER >= 1200
# define BOOST_HAS_MS_INT64
#endif
//
// last known and checked version:
-#if (BOOST_INTEL_CXX_VERSION > 810)
+#if (BOOST_INTEL_CXX_VERSION > 900)
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
# elif defined(_MSC_VER)
# define BOOST_NO_SFINAE
# endif
-# if(__MWERKS__ <= 0x3204) // 9.3
+// the "|| !defined(BOOST_STRICT_CONFIG)" part should apply to the last
+// tested version *only*:
+# if(__MWERKS__ <= 0x3206) || !defined(BOOST_STRICT_CONFIG) // 9.5
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+# define BOOST_NO_IS_ABSTRACT
# endif
#if !__option(wchar_type)
# define BOOST_COMPILER_VERSION 9.2
# elif __MWERKS__ == 0x3204
# define BOOST_COMPILER_VERSION 9.3
+# elif __MWERKS__ == 0x3205
+# define BOOST_COMPILER_VERSION 9.4
+# elif __MWERKS__ == 0x3206
+# define BOOST_COMPILER_VERSION 9.5
# else
# define BOOST_COMPILER_VERSION __MWERKS__
# endif
#endif
//
// last known and checked version:
-#if (__MWERKS__ > 0x3204)
+#if (__MWERKS__ > 0x3205)
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
# endif
# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
# endif
-# if (__SUNPRO_CC <= 0x530) || !defined(BOOST_STRICT_CONFIG)
+# if (__SUNPRO_CC <= 0x530)
// Requesting debug info (-g) with Boost.Python results
// in an internal compiler error for "static const"
// initialized in-class.
# define BOOST_NO_INTEGRAL_INT64_T
# endif
-# if (__SUNPRO_CC <= 0x540) || !defined(BOOST_STRICT_CONFIG)
+# if (__SUNPRO_CC < 0x570)
# define BOOST_NO_TEMPLATE_TEMPLATES
// see http://lists.boost.org/MailArchives/boost/msg47184.php
// and http://lists.boost.org/MailArchives/boost/msg47220.php
# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
# define BOOST_NO_SFINAE
# define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS
+# define BOOST_NO_IS_ABSTRACT
# endif
#define BOOST_COMPILER "Sun compiler version " BOOST_STRINGIZE(__SUNPRO_CC)
#error "Compiler not supported or configured - please reconfigure"
#endif
//
-// last known and checked version is 0x530:
-#if (__SUNPRO_CC > 0x530)
+// last known and checked version is 0x570:
+#if (__SUNPRO_CC > 0x570)
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
# endif
// turn off the warnings before we #include anything
#pragma warning( disable : 4503 ) // warning: decorated name length exceeded
-#if _MSC_VER < 1300 // 1200 == VC++ 6.0, 1201 == EVC4.2
-#pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info
+#if _MSC_VER < 1300 // 1200 == VC++ 6.0, 1200-1202 == eVC++4
+# pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info
# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
# define BOOST_NO_VOID_RETURNS
# define BOOST_NO_EXCEPTION_STD_NAMESPACE
#if (_MSC_VER <= 1300) // 1300 == VC++ 7.0
-#if !defined(_MSC_EXTENSIONS) && !defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) // VC7 bug with /Za
-# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
-#endif
+# if !defined(_MSC_EXTENSIONS) && !defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) // VC7 bug with /Za
+# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
+# endif
# define BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
# define BOOST_NO_TEMPLATE_TEMPLATES
# define BOOST_NO_SFINAE
# define BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS
+# define BOOST_NO_IS_ABSTRACT
+// TODO: what version is meant here? Have there really been any fixes in cl 12.01 (as e.g. shipped with eVC4)?
# if (_MSC_VER > 1200)
# define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS
# endif
# define BOOST_ABI_SUFFIX "boost/config/abi/msvc_suffix.hpp"
#endif
-# if _MSC_VER == 1200
-# define BOOST_COMPILER_VERSION 6.0
-# elif _MSC_VER == 1300
-# define BOOST_COMPILER_VERSION 7.0
-# elif _MSC_VER == 1310
-# define BOOST_COMPILER_VERSION 7.1
-# elif _MSC_VER == 1400
-# define BOOST_COMPILER_VERSION 8.0
+// TODO:
+// these things are mostly bogus. 1200 means version 12.0 of the compiler. The
+// artificial versions assigned to them only refer to the versions of some IDE
+// these compilers have been shipped with, and even that is not all of it. Some
+// were shipped with freely downloadable SDKs, others as crosscompilers in eVC.
+// IOW, you can't use these 'versions' in any sensible way. Sorry.
+# if defined(UNDER_CE)
+# if _MSC_VER < 1200
+ // Note: these are so far off, they are not really supported
+# elif _MSC_VER < 1300 // eVC++ 4 comes with 1200-1202
+# define BOOST_COMPILER_VERSION evc4.0
+# error unknown CE compiler
+# else
+# error unknown CE compiler
+# endif
# else
-# define BOOST_COMPILER_VERSION _MSC_VER
+# if _MSC_VER < 1200
+ // Note: these are so far off, they are not really supported
+# define BOOST_COMPILER_VERSION 5.0
+# elif _MSC_VER < 1300
+# define BOOST_COMPILER_VERSION 6.0
+# elif _MSC_VER == 1300
+# define BOOST_COMPILER_VERSION 7.0
+# elif _MSC_VER == 1310
+# define BOOST_COMPILER_VERSION 7.1
+# elif _MSC_VER == 1400
+# define BOOST_COMPILER_VERSION 8.0
+# else
+# define BOOST_COMPILER_VERSION _MSC_VER
+# endif
# endif
#define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION)
#error "Compiler not supported or configured - please reconfigure"
#endif
//
-// last known and checked version is 1310:
+// last known and checked version is 1400 (VC8):
#if (_MSC_VER > 1400)
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
//
// No wide character support in the BSD header files:
//
-#define BOOST_NO_CWCHAR
-
+#if !(defined(__FreeBSD__) && (__FreeBSD__ >= 5))
+# define BOOST_NO_CWCHAR
+#endif
//
// The BSD <ctype.h> has macros only, no functions:
//
#define BOOST_NO_SWPRINTF
#define BOOST_NO_CWCTYPE
-#ifdef __GNUC__
- // GNU C on HP-UX does not support threads (checked up to gcc 3.3)
-# define BOOST_DISABLE_THREADS
+#if defined(__GNUC__)
+# if (__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3))
+ // GNU C on HP-UX does not support threads (checked up to gcc 3.3)
+# define BOOST_DISABLE_THREADS
+# elif !defined(BOOST_DISABLE_THREADS)
+ // threads supported from gcc-3.3 onwards:
+# define BOOST_HAS_THREADS
+# define BOOST_HAS_PTHREADS
+# endif
#endif
// boilerplate code:
# ifndef BOOST_HAS_UNISTD_H
# define BOOST_HAS_UNISTD_H
# endif
-// boilerplate code:
-# ifndef TARGET_CARBON
-# include <boost/config/posix_features.hpp>
-# endif
+//
+// Begin by including our boilerplate code for POSIX
+// feature detection, this is safe even when using
+// the MSL as Metrowerks supply their own <unistd.h>
+// to replace the platform-native BSD one. G++ users
+// should also always be able to do this on MaxOS X.
+//
+# include <boost/config/posix_features.hpp>
# ifndef BOOST_HAS_STDINT_H
# define BOOST_HAS_STDINT_H
# endif
// We will eventually support threads in non-Carbon builds, but we do
// not support this yet.
-# if TARGET_CARBON
+# if ( defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON ) || ( defined(TARGET_CARBON) && TARGET_CARBON )
+# if !defined(BOOST_HAS_PTHREADS)
# define BOOST_HAS_MPTASKS
+# elif ( __dest_os == __mac_os_x )
+// We are doing a Carbon/Mach-O/MSL build which has pthreads, but only the
+// gettimeofday and no posix.
+# define BOOST_HAS_GETTIMEOFDAY
+# endif
// The MP task implementation of Boost Threads aims to replace MP-unsafe
// parts of the MSL, so we turn on threads unconditionally.
// (C) Copyright John Maddock 2001 - 2003.
// (C) Copyright Bill Kempf 2001.
// (C) Copyright Aleksey Gurtovoy 2003.
+// (C) Copyright Rene Rivera 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#define BOOST_PLATFORM "Win32"
+// Get the information about the MinGW runtime, i.e. __MINGW32_*VERSION.
+#if defined(__MINGW32__)
+# include <_mingw.h>
+#endif
+
#if defined(__GNUC__) && !defined(BOOST_NO_SWPRINTF)
# define BOOST_NO_SWPRINTF
#endif
# define BOOST_HAS_DECLSPEC
#endif
-#if defined(__MINGW32__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
+#if defined(__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 2) || ((__MINGW32_MAJOR_VERSION == 2) && (__MINGW32_MINOR_VERSION >= 0)))
# define BOOST_HAS_STDINT_H
# define __STDC_LIMIT_MACROS
+# define BOOST_HAS_DIRENT_H
+# define BOOST_HAS_UNISTD_H
#endif
//
// MacOS
# define BOOST_PLATFORM_CONFIG "boost/config/platform/macos.hpp"
-#elif defined(__IBMCPP__)
+#elif defined(__IBMCPP__) || defined(_AIX)
// IBM
# define BOOST_PLATFORM_CONFIG "boost/config/platform/aix.hpp"
-// (C) Copyright John Maddock 2001.
-// (C) Copyright Jens Maurer 2001.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright John Maddock 2001.
+// (C) Copyright Jens Maurer 2001.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for most recent version.
# define BOOST_NO_STD_WSTREAMBUF
#endif
-#if defined(__osf__) && !defined(_REENTRANT) && defined(_GLIBCXX_HAVE_GTHR_DEFAULT)
-// GCC 3.4 on Tru64 forces the definition of _REENTRANT when any std lib header
+#if defined(__osf__) && !defined(_REENTRANT) \
+ && ( defined(_GLIBCXX_HAVE_GTHR_DEFAULT) || defined(_GLIBCPP_HAVE_GTHR_DEFAULT) )
+// GCC 3 on Tru64 forces the definition of _REENTRANT when any std lib header
// file is included, therefore for consistency we define it here as well.
# define _REENTRANT
#endif
#ifdef __GLIBCXX__ // gcc 3.4 and greater:
-# ifdef _GLIBCXX_HAVE_GTHR_DEFAULT
- //
+# if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
+ || defined(_GLIBCXX__PTHREADS)
+ //
// If the std lib has thread support turned on, then turn it on in Boost
// as well. We do this because some gcc-3.4 std lib headers define _REENTANT
// while others do not...
- //
+ //
# define BOOST_HAS_THREADS
# else
# define BOOST_DISABLE_THREADS
# endif
+#elif defined(__GLIBCPP__) \
+ && !defined(_GLIBCPP_HAVE_GTHR_DEFAULT) \
+ && !defined(_GLIBCPP__PTHREADS)
+ // disable thread support if the std lib was built single threaded:
+# define BOOST_DISABLE_THREADS
#endif
-
+#if (defined(linux) || defined(__linux) || defined(__linux__)) && defined(__arm__) && defined(_GLIBCPP_HAVE_GTHR_DEFAULT)
+// linux on arm apparently doesn't define _REENTRANT
+// so just turn on threading support whenever the std lib is thread safe:
+# define BOOST_HAS_THREADS
+#endif
+
+
#if !defined(_GLIBCPP_USE_LONG_LONG) \
&& !defined(_GLIBCXX_USE_LONG_LONG)\
&& defined(BOOST_HAS_LONG_LONG)
# define BOOST_HAS_THREADS
#endif
+#ifdef _MSL_NO_EXPLICIT_FUNC_TEMPLATE_ARG
+# define BOOST_NO_STD_USE_FACET
+# define BOOST_HAS_TWO_ARG_USE_FACET
+#endif
+
#define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__)
# define BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN
#endif
-
-
+//
+// Disable BOOST_HAS_LONG_LONG when the library has no support for it.
+//
+#if !defined(_RWSTD_LONG_LONG) && defined(BOOST_HAS_LONG_LONG)
+# undef BOOST_HAS_LONG_LONG
+#endif
// then the io stream facets are not available in namespace std::
//
#ifdef _STLPORT_VERSION
-# if !defined(_STLP_OWN_IOSTREAMS) && defined(_STLP_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) && !defined(__BORLANDC__)
+# if !(_STLPORT_VERSION >= 0x500) && !defined(_STLP_OWN_IOSTREAMS) && defined(_STLP_USE_NAMESPACES) && defined(BOOST_NO_USING_TEMPLATE) && !defined(__BORLANDC__)
# define BOOST_NO_STD_LOCALE
# endif
#else
//
#define BOOST_HAS_PARTIAL_STD_ALLOCATOR
-#if !defined(_STLP_MEMBER_TEMPLATE_CLASSES)
+#if !defined(_STLP_MEMBER_TEMPLATE_CLASSES) || defined(_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
# define BOOST_NO_STD_ALLOCATOR
#endif
// Boost config.hpp configuration header file ------------------------------//
-// (C) Copyright John Maddock 2001 - 2003.
-// (C) Copyright Darin Adler 2001.
-// (C) Copyright Peter Dimov 2001.
-// (C) Copyright Bill Kempf 2002.
-// (C) Copyright Jens Maurer 2002.
-// (C) Copyright David Abrahams 2002 - 2003.
-// (C) Copyright Gennaro Prota 2003.
-// (C) Copyright Eric Friedman 2003.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
+// (C) Copyright John Maddock 2001 - 2003.
+// (C) Copyright Darin Adler 2001.
+// (C) Copyright Peter Dimov 2001.
+// (C) Copyright Bill Kempf 2002.
+// (C) Copyright Jens Maurer 2002.
+// (C) Copyright David Abrahams 2002 - 2003.
+// (C) Copyright Gennaro Prota 2003.
+// (C) Copyright Eric Friedman 2003.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for most recent version.
//
#include <limits.h>
# if !defined(BOOST_HAS_LONG_LONG) \
- && !(defined(BOOST_MSVC) && BOOST_MSVC <=1300) && !defined(__BORLANDC__) \
+ && !defined(BOOST_MSVC) && !defined(__BORLANDC__) \
&& (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
# define BOOST_HAS_LONG_LONG
#endif
-#if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_INTEGRAL_INT64_T)
+
+// TODO: Remove the following lines after the 1.33 release because the presence
+// of an integral 64 bit type has nothing to do with support for long long.
+
+#if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(__DECCXX_VER)
# define BOOST_NO_INTEGRAL_INT64_T
#endif
// Because std::size_t usage is so common, even in boost headers which do not
// otherwise use the C library, the <cstddef> workaround is included here so
// that ugly workaround code need not appear in many other boost headers.
-// NOTE WELL: This is a workaround for non-conforming compilers; <cstddef>
+// NOTE WELL: This is a workaround for non-conforming compilers; <cstddef>
// must still be #included in the usual places so that <cstddef> inclusion
// works as expected with standard conforming compilers. The resulting
// double inclusion of <cstddef> is harmless.
#ifndef BOOST_NO_DEDUCED_TYPENAME
# define BOOST_DEDUCED_TYPENAME typename
-#else
+#else
# define BOOST_DEDUCED_TYPENAME
#endif
//
// Helper macro BOOST_JOIN:
-// The following piece of macro magic joins the two
+// The following piece of macro magic joins the two
// arguments together, even when one of the arguments is
// itself a macro (see 16.3.1 in C++ standard). The key
// is that macro expansion of macro arguments does not
#else
BOOST_STATIC_CONSTANT( least, sig_bits = (~( ~(least( 0u )) << Bits )) );
#endif
+#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2
+ // Work around a weird bug that ICEs the compiler in build_c_cast
+ BOOST_STATIC_CONSTANT( fast, sig_bits_fast = static_cast<fast>(sig_bits) );
+#else
BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) );
-
+#endif
}; // boost::detail::mask_uint_t
template < >
typedef typename masking_type::fast value_type;
#if defined(__BORLANDC__) && defined(_M_IX86) && (__BORLANDC__ == 0x560)
// for some reason Borland's command line compiler (version 0x560)
- // chokes over this unless we do the calculation for it:
+ // chokes over this unless we do the calculation for it:
typedef value_type table_type[ 0x100 ];
#else
typedef value_type table_type[ byte_combos ];
// a full polynominal division step is done when the highest bit is one
bool const do_poly_div = static_cast<bool>( rem_ & high_bit_mask );
- // shift out the highest bit
+ // shift out the highest bit
rem_ <<= 1;
// carry out the division, if needed
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#include <boost/regex/config.hpp>
#endif
-#ifdef BOOST_REGEX_V3
-#include <boost/regex/v3/cregex.hpp>
-#else
#include <boost/regex/v4/cregex.hpp>
-#endif
#endif /* include guard */
# include <inttypes.h>
# else
# include <stdint.h>
+
+// There is a bug in Cygwin two _C macros
+# if defined(__STDC_CONSTANT_MACROS) && defined(__CYGWIN__)
+# undef INTMAX_C
+# undef UINTMAX_C
+# define INTMAX_C(c) c##LL
+# define UINTMAX_C(c) c##ULL
+# endif
+
# endif
+#ifdef __QNX__
+
+// QNX (Dinkumware stdlib) defines these as non-standard names.
+// Reflect to the standard names.
+
+typedef ::intleast8_t int_least8_t;
+typedef ::intfast8_t int_fast8_t;
+typedef ::uintleast8_t uint_least8_t;
+typedef ::uintfast8_t uint_fast8_t;
+
+typedef ::intleast16_t int_least16_t;
+typedef ::intfast16_t int_fast16_t;
+typedef ::uintleast16_t uint_least16_t;
+typedef ::uintfast16_t uint_fast16_t;
+
+typedef ::intleast32_t int_least32_t;
+typedef ::intfast32_t int_fast32_t;
+typedef ::uintleast32_t uint_least32_t;
+typedef ::uintfast32_t uint_fast32_t;
+
+# ifndef BOOST_NO_INT64_T
+
+typedef ::intleast64_t int_least64_t;
+typedef ::intfast64_t int_fast64_t;
+typedef ::uintleast64_t uint_least64_t;
+typedef ::uintfast64_t uint_fast64_t;
+
+# endif
+
+#endif
+
namespace boost
{
// are called driven by smart_ptr interface...
//
-// Note: atomic_count_linux.hpp has been disabled by default; see the
-// comments inside for more info.
-
#include <boost/config.hpp>
#ifndef BOOST_HAS_THREADS
}
-#elif defined(BOOST_USE_ASM_ATOMIC_H)
-# include <boost/detail/atomic_count_linux.hpp>
#elif defined(BOOST_AC_USE_PTHREADS)
# include <boost/detail/atomic_count_pthreads.hpp>
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# include <boost/detail/atomic_count_win32.hpp>
-#elif defined(__GLIBCPP__)
+#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
# include <boost/detail/atomic_count_gcc.hpp>
#elif defined(BOOST_HAS_PTHREADS)
# define BOOST_AC_USE_PTHREADS
//
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
// Copyright (c) 2002 Lars Gullik Bjønnes <larsbj@lyx.org>
+// Copyright 2003-2005 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
namespace detail
{
+#if defined(__GLIBCXX__) // g++ 3.4+
+
+using __gnu_cxx::__atomic_add;
+using __gnu_cxx::__exchange_and_add;
+
+#endif
+
class atomic_count
{
public:
+++ /dev/null
-#ifndef BOOST_DETAIL_ATOMIC_COUNT_LINUX_HPP_INCLUDED
-#define BOOST_DETAIL_ATOMIC_COUNT_LINUX_HPP_INCLUDED
-
-//
-// boost/detail/atomic_count_linux.hpp
-//
-// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-
-//
-// This implementation uses <asm/atomic.h>. This is a kernel header;
-// using kernel headers in a user program may cause a number of problems,
-// and not all flavors of Linux provide the atomic instructions.
-//
-// This file is only provided because the performance of this implementation
-// is significantly higher than the pthreads version. Use at your own risk
-// (by defining BOOST_USE_ASM_ATOMIC_H.)
-//
-
-#include <asm/atomic.h>
-
-namespace boost
-{
-
-namespace detail
-{
-
-class atomic_count
-{
-public:
-
- explicit atomic_count(long v)
- {
- atomic_t init = ATOMIC_INIT(v);
- value_ = init;
- }
-
- void operator++()
- {
- atomic_inc(&value_);
- }
-
- long operator--()
- {
- return !atomic_dec_and_test(&value_);
- }
-
- operator long() const
- {
- return atomic_read(&value_);
- }
-
-private:
-
- atomic_count(atomic_count const &);
- atomic_count & operator=(atomic_count const &);
-
- atomic_t value_;
-};
-
-} // namespace detail
-
-} // namespace boost
-
-#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_LINUX_HPP_INCLUDED
//
// boost/detail/atomic_count_win32.hpp
//
-// Copyright (c) 2001, 2002, 2003 Peter Dimov
+// Copyright (c) 2001-2005 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
-#ifdef BOOST_USE_WINDOWS_H
-# include <windows.h>
-#endif
+#include <boost/detail/interlocked.hpp>
namespace boost
{
namespace detail
{
-#ifndef BOOST_USE_WINDOWS_H
-
-#ifdef _WIN64
-
-// Intel 6.0 on Win64 version, posted by Tim Fenders to [boost-users]
-
-extern "C" long_type __cdecl _InterlockedIncrement(long volatile *);
-extern "C" long_type __cdecl _InterlockedDecrement(long volatile *);
-
-#pragma intrinsic(_InterlockedIncrement)
-#pragma intrinsic(_InterlockedDecrement)
-
-inline long InterlockedIncrement(long volatile * lp)
-{
- return _InterlockedIncrement(lp);
-}
-
-inline long InterlockedDecrement(long volatile* lp)
-{
- return _InterlockedDecrement(lp);
-}
-
-#else // _WIN64
-
-extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement(long volatile *);
-extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement(long volatile *);
-
-#endif // _WIN64
-
-#endif // #ifndef BOOST_USE_WINDOWS_H
-
class atomic_count
{
public:
- explicit atomic_count(long v): value_(v)
+ explicit atomic_count( long v ): value_( v )
{
}
long operator++()
{
- // Some older <windows.h> versions do not accept volatile
- return InterlockedIncrement(const_cast<long*>(&value_));
+ return BOOST_INTERLOCKED_INCREMENT( &value_ );
}
long operator--()
{
- return InterlockedDecrement(const_cast<long*>(&value_));
+ return BOOST_INTERLOCKED_DECREMENT( &value_ );
}
operator long() const
{
- return value_;
+ return static_cast<long const volatile &>( value_ );
}
private:
- atomic_count(atomic_count const &);
- atomic_count & operator=(atomic_count const &);
+ atomic_count( atomic_count const & );
+ atomic_count & operator=( atomic_count const & );
- volatile long value_;
+ long value_;
};
} // namespace detail
--- /dev/null
+#ifndef BOOST_BAD_WEAK_PTR_HPP_INCLUDED
+#define BOOST_BAD_WEAK_PTR_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// detail/bad_weak_ptr.hpp
+//
+// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#include <exception>
+
+#ifdef __BORLANDC__
+# pragma warn -8026 // Functions with excep. spec. are not expanded inline
+#endif
+
+namespace boost
+{
+
+// The standard library that comes with Borland C++ 5.5.1, 5.6.4
+// defines std::exception and its members as having C calling
+// convention (-pc). When the definition of bad_weak_ptr
+// is compiled with -ps, the compiler issues an error.
+// Hence, the temporary #pragma option -pc below.
+
+#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564
+# pragma option push -pc
+#endif
+
+class bad_weak_ptr: public std::exception
+{
+public:
+
+ virtual char const * what() const throw()
+ {
+ return "boost::bad_weak_ptr";
+ }
+};
+
+#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564
+# pragma option pop
+#endif
+
+} // namespace boost
+
+#ifdef __BORLANDC__
+# pragma warn .8026 // Functions with excep. spec. are not expanded inline
+#endif
+
+#endif // #ifndef BOOST_BAD_WEAK_PTR_HPP_INCLUDED
#include <boost/type_traits/is_arithmetic.hpp>
#include <boost/type_traits/is_pointer.hpp>
+#include <boost/detail/workaround.hpp>
namespace boost{
typedef T& param_type; // hh removed const
};
-#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x560)
+#if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x570 ) )
// these are illegal specialisations; cv-qualifies applied to
// references have no effect according to [8.3.2p1],
// C++ Builder requires them though as it treats cv-qualified
template <class T1, class T2>
class compressed_pair_imp<T1, T2, 1>
- : private T1
+ : private ::boost::remove_cv<T1>::type
{
public:
typedef T1 first_type;
template <class T1, class T2>
class compressed_pair_imp<T1, T2, 2>
- : private T2
+ : private ::boost::remove_cv<T2>::type
{
public:
typedef T1 first_type;
template <class T1, class T2>
class compressed_pair_imp<T1, T2, 3>
- : private T1,
- private T2
+ : private ::boost::remove_cv<T1>::type,
+ private ::boost::remove_cv<T2>::type
{
public:
typedef T1 first_type;
// but reuses T1 base class for both first() and second().
template <class T1, class T2>
class compressed_pair_imp<T1, T2, 4>
- : private T1
+ : private ::boost::remove_cv<T1>::type
{
public:
typedef T1 first_type;
#endif // BOOST_DETAIL_COMPRESSED_PAIR_HPP
-
-
# include <boost/type_traits/is_const.hpp>
# include <boost/type_traits/is_volatile.hpp>
# include <boost/type_traits/is_member_function_pointer.hpp>
+# include <boost/type_traits/is_member_pointer.hpp>
# include <boost/type_traits/remove_cv.hpp>
# include <boost/type_traits/remove_reference.hpp>
# include <boost/type_traits/remove_pointer.hpp>
# include <boost/type_traits/detail/ice_and.hpp>
# include <boost/detail/workaround.hpp>
+# include <boost/mpl/eval_if.hpp>
# include <boost/mpl/if.hpp>
# include <boost/mpl/bool.hpp>
# include <boost/mpl/and.hpp>
static T t;
BOOST_STATIC_CONSTANT(
bool, value = sizeof(detail::is_function_ref_tester(t,0)) == sizeof(::boost::type_traits::yes_type));
+ typedef mpl::bool_<value> type;
};
template <class T>
BOOST_STATIC_CONSTANT(
bool, value
= sizeof(reference_to_const_helper(t)) == sizeof(inner_no_type));
+
+ typedef mpl::bool_<value> type;
};
};
struct is_reference_to_non_const
: is_reference_to_non_const_helper1<is_reference<T>::value>::template apply<T>
{
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_non_const,(T))
};
BOOST_STATIC_CONSTANT(
bool, value
= sizeof(reference_to_volatile_helper(t)) == sizeof(inner_yes_type));
+ typedef mpl::bool_<value> type;
};
};
= (is_reference<T>::value
&& sizeof((reference_to_pointer_helper)(t)) == sizeof(inner_yes_type))
);
+
+ typedef mpl::bool_<value> type;
+
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_pointer,(T))
};
template <class T>
struct is_reference_to_function_pointer
: mpl::if_<
- is_reference<T>
+ is_reference<T>
, is_pointer_to_function_aux<T>
, mpl::bool_<false>
>::type
= (is_pointer<T>::value
&& sizeof(pointer_to_class_helper(t)) == sizeof(inner_yes_type))
);
+ typedef mpl::bool_<value> type;
};
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
#ifndef IS_INCREMENTABLE_DWA200415_HPP
# define IS_INCREMENTABLE_DWA200415_HPP
+# include <boost/type_traits/detail/bool_trait_def.hpp>
+# include <boost/type_traits/detail/template_arity_spec.hpp>
# include <boost/type_traits/remove_cv.hpp>
+# include <boost/mpl/aux_/lambda_support.hpp>
# include <boost/mpl/bool.hpp>
# include <boost/detail/workaround.hpp>
struct any { template <class T> any(T const&); };
// This is a last-resort operator++ for when none other is found
+# if BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2
+
+}
+
+namespace is_incrementable_2
+{
+ is_incrementable_::tag operator++(is_incrementable_::any const&);
+ is_incrementable_::tag operator++(is_incrementable_::any const&,int);
+}
+using namespace is_incrementable_2;
+
+namespace is_incrementable_
+{
+
+# else
+
tag operator++(any const&);
tag operator++(any const&,int);
+
+# endif
# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \
|| BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
template <class T>
struct impl
{
- static typename remove_cv<T>::type& x;
+ static typename boost::remove_cv<T>::type& x;
BOOST_STATIC_CONSTANT(
bool
template <class T>
struct postfix_impl
{
- static typename remove_cv<T>::type& x;
+ static typename boost::remove_cv<T>::type& x;
BOOST_STATIC_CONSTANT(
bool
# undef BOOST_comma
-template <class T>
-struct is_incrementable
- : mpl::bool_< ::boost::detail::is_incrementable_::impl<T>::value>
-{
+template<typename T>
+struct is_incrementable
+BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
+{
+ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::impl<T>::value)
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_incrementable,(T))
};
-template <class T>
-struct is_postfix_incrementable
- : mpl::bool_< ::boost::detail::is_incrementable_::postfix_impl<T>::value>
-{
+template<typename T>
+struct is_postfix_incrementable
+BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
+{
+ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::postfix_impl<T>::value)
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_postfix_incrementable,(T))
};
-}} // namespace boost::detail
+} // namespace detail
+
+BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_incrementable)
+BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_postfix_incrementable)
+
+} // namespace boost
+
#endif // IS_INCREMENTABLE_DWA200415_HPP
//
// typedef <unspecified> boost::detail::lightweight_mutex;
//
-// boost::detail::lightweight_mutex meets a subset of the Mutex concept
-// requirements: http://www.boost.org/libs/thread/doc/mutex_concept.html#Mutex
+// boost::detail::lightweight_mutex is a header-only implementation of
+// a subset of the Mutex concept requirements:
//
-// * Used by the smart pointer library
-// * Performance oriented
-// * Header-only implementation
-// * Small memory footprint
-// * Not a general purpose mutex, use boost::mutex, CRITICAL_SECTION or
-// pthread_mutex instead.
-// * Never spin in a tight lock/do-something/unlock loop, since
-// lightweight_mutex does not guarantee fairness.
-// * Never keep a lightweight_mutex locked for long periods.
+// http://www.boost.org/doc/html/threads/concepts.html#threads.concepts.Mutex
//
-// The current implementation can use a pthread_mutex, a CRITICAL_SECTION,
-// or a platform-specific spinlock.
+// It maps to a CRITICAL_SECTION on Windows or a pthread_mutex on POSIX.
//
-// You can force a particular implementation by defining BOOST_LWM_USE_PTHREADS,
-// BOOST_LWM_USE_CRITICAL_SECTION, or BOOST_LWM_USE_SPINLOCK.
-//
-// If neither macro has been defined, the default is to use a spinlock on Win32,
-// and a pthread_mutex otherwise.
-//
-// Note that a spinlock is not a general synchronization primitive. In particular,
-// it is not guaranteed to be a memory barrier, and it is possible to "livelock"
-// if a lower-priority thread has acquired the spinlock but a higher-priority
-// thread is spinning trying to acquire the same lock.
-//
-// For these reasons, spinlocks have been disabled by default except on Windows,
-// where a spinlock can be several orders of magnitude faster than a CRITICAL_SECTION.
-
-
-// Note: lwm_linux.hpp has been disabled by default; see the comments
-// inside for more info.
-
#include <boost/config.hpp>
-// Note to implementors: if you write a platform-specific spinlock
-// for a platform that supports pthreads, be sure to test its performance
-// against the pthreads-based version using shared_ptr_timing_test.cpp and
-// shared_ptr_mt_test.cpp. Custom versions are usually not worth the trouble
-// _unless_ the performance gains are substantial.
-//
-// Be sure to compare against a "real" pthreads library;
-// shared_ptr_timing_test.cpp will compile succesfully with a stub do-nothing
-// pthreads library, since it doesn't create any threads.
-
-#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) && !defined(BOOST_LWM_USE_CRITICAL_SECTION) && !defined(BOOST_LWM_USE_PTHREADS)
-# define BOOST_LWM_WIN32
-#endif
-
#if !defined(BOOST_HAS_THREADS)
-# if defined(BOOST_LWM_WIN32)
-# include <boost/detail/lwm_win32_nt.hpp>
-# else
-# include <boost/detail/lwm_nop.hpp>
-# endif
-#elif defined(BOOST_LWM_USE_SPINLOCK) && defined(BOOST_USE_ASM_ATOMIC_H)
-# include <boost/detail/lwm_linux.hpp>
-#elif defined(BOOST_LWM_USE_CRITICAL_SECTION)
+# include <boost/detail/lwm_nop.hpp>
+#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# include <boost/detail/lwm_win32_cs.hpp>
-#elif defined(BOOST_LWM_USE_PTHREADS)
-# include <boost/detail/lwm_pthreads.hpp>
-#elif defined(BOOST_LWM_WIN32)
-# include <boost/detail/lwm_win32.hpp>
-#elif defined(BOOST_LWM_USE_SPINLOCK) && defined(__sgi)
-# include <boost/detail/lwm_irix.hpp>
-#elif defined(BOOST_LWM_USE_SPINLOCK) && defined(__GLIBCPP__)
-# include <boost/detail/lwm_gcc.hpp>
#elif defined(BOOST_HAS_PTHREADS)
-# define BOOST_LWM_USE_PTHREADS
# include <boost/detail/lwm_pthreads.hpp>
#else
// Use #define BOOST_DISABLE_THREADS to avoid the error
#include <climits>
#include <cfloat>
#include <boost/config.hpp>
+#include <boost/detail/endian.hpp>
#ifndef BOOST_NO_CWCHAR
#include <cwchar> // for WCHAR_MIN and WCHAR_MAX
#endif
-// The macros are not named appropriately. We don't care about integer
-// bit layout, but about floating-point NaN (etc.) bit patterns.
-#if defined(__sparc) || defined(__sparc__) || defined(__powerpc__) || defined(__ppc__) || defined(__hppa) || defined(_MIPSEB) || defined(_POWER)
-#define BOOST_BIG_ENDIAN
-#elif defined(__i386__) || defined(__alpha__) || defined(__ia64) || defined(__ia64__)
-#define BOOST_LITTLE_ENDIAN
-#else
-#error The file boost/detail/limits.hpp needs to be set up for your CPU type.
-#endif
-
namespace std {
enum float_round_style {
+++ /dev/null
-#ifndef BOOST_DETAIL_LWM_GCC_HPP_INCLUDED
-#define BOOST_DETAIL_LWM_GCC_HPP_INCLUDED
-
-//
-// boost/detail/lwm_gcc.hpp
-//
-// lightweight_mutex for GNU libstdc++ v3
-//
-// http://gcc.gnu.org/onlinedocs/porting/Thread-safety.html
-//
-// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
-// Copyright (c) 2002 Lars Gullik Bjønnes <larsbj@lyx.org>
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#include <bits/atomicity.h>
-#include <sched.h>
-
-namespace boost
-{
-
-namespace detail
-{
-
-class lightweight_mutex
-{
-private:
-
- _Atomic_word a_;
-
- lightweight_mutex(lightweight_mutex const &);
- lightweight_mutex & operator=(lightweight_mutex const &);
-
-public:
-
- lightweight_mutex(): a_(0)
- {
- }
-
- class scoped_lock;
- friend class scoped_lock;
-
- class scoped_lock
- {
- private:
-
- lightweight_mutex & m_;
-
- scoped_lock(scoped_lock const &);
- scoped_lock & operator=(scoped_lock const &);
-
- public:
-
- explicit scoped_lock(lightweight_mutex & m): m_(m)
- {
- while( __exchange_and_add(&m_.a_, 1) )
- {
- __atomic_add(&m_.a_, -1);
- sched_yield();
- }
- }
-
- ~scoped_lock()
- {
- __atomic_add(&m_.a_, -1);
- }
- };
-};
-
-} // namespace detail
-
-} // namespace boost
-
-#endif // #ifndef BOOST_DETAIL_LWM_GCC_HPP_INCLUDED
+++ /dev/null
-#ifndef BOOST_DETAIL_LWM_IRIX_HPP_INCLUDED
-#define BOOST_DETAIL_LWM_IRIX_HPP_INCLUDED
-
-//
-// boost/detail/lwm_irix.hpp
-//
-// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
-// Copyright (c) 2002 Dan Gohman
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#include <sgidefs.h>
-#include <mutex.h>
-#include <sched.h>
-
-namespace boost
-{
-
-namespace detail
-{
-
-class lightweight_mutex
-{
-private:
-
- __uint32_t l_;
-
- lightweight_mutex(lightweight_mutex const &);
- lightweight_mutex & operator=(lightweight_mutex const &);
-
-public:
-
- lightweight_mutex(): l_(0)
- {
- }
-
- class scoped_lock;
- friend class scoped_lock;
-
- class scoped_lock
- {
- private:
-
- lightweight_mutex & m_;
-
- scoped_lock(scoped_lock const &);
- scoped_lock & operator=(scoped_lock const &);
-
- public:
-
- explicit scoped_lock(lightweight_mutex & m): m_(m)
- {
- while( test_and_set32(&m_.l_, 1) )
- {
- sched_yield();
- }
- }
-
- ~scoped_lock()
- {
- m_.l_ = 0;
- }
- };
-};
-
-} // namespace detail
-
-} // namespace boost
-
-#endif // #ifndef BOOST_DETAIL_LWM_IRIX_HPP_INCLUDED
+++ /dev/null
-#ifndef BOOST_DETAIL_LWM_LINUX_HPP_INCLUDED
-#define BOOST_DETAIL_LWM_LINUX_HPP_INCLUDED
-
-//
-// boost/detail/lwm_linux.hpp
-//
-// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-
-//
-// This implementation uses <asm/atomic.h>. This is a kernel header;
-// using kernel headers in a user program may cause a number of problems,
-// and not all flavors of Linux provide the atomic instructions.
-//
-// This file is only provided because the performance of this implementation
-// is about 3.5 times higher than the pthreads version. Use at your own risk
-// (by defining BOOST_USE_ASM_ATOMIC_H.)
-//
-
-#include <asm/atomic.h>
-#include <sched.h>
-
-namespace boost
-{
-
-namespace detail
-{
-
-class lightweight_mutex
-{
-private:
-
- atomic_t a_;
-
- lightweight_mutex(lightweight_mutex const &);
- lightweight_mutex & operator=(lightweight_mutex const &);
-
-public:
-
- lightweight_mutex()
- {
- atomic_t a = ATOMIC_INIT(1);
- a_ = a;
- }
-
- class scoped_lock;
- friend class scoped_lock;
-
- class scoped_lock
- {
- private:
-
- lightweight_mutex & m_;
-
- scoped_lock(scoped_lock const &);
- scoped_lock & operator=(scoped_lock const &);
-
- public:
-
- explicit scoped_lock(lightweight_mutex & m): m_(m)
- {
- while( !atomic_dec_and_test(&m_.a_) )
- {
- atomic_inc(&m_.a_);
- sched_yield();
- }
- }
-
- ~scoped_lock()
- {
- atomic_inc(&m_.a_);
- }
- };
-};
-
-} // namespace detail
-
-} // namespace boost
-
-#endif // #ifndef BOOST_DETAIL_LWM_LINUX_HPP_INCLUDED
+++ /dev/null
-#ifndef BOOST_DETAIL_LWM_WIN32_HPP_INCLUDED
-#define BOOST_DETAIL_LWM_WIN32_HPP_INCLUDED
-
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// boost/detail/lwm_win32.hpp
-//
-// Copyright (c) 2002, 2003 Peter Dimov
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifdef BOOST_USE_WINDOWS_H
-# include <windows.h>
-#endif
-
-#ifdef __BORLANDC__
-# pragma warn -8027 // Functions containing while are not expanded inline
-#endif
-
-namespace boost
-{
-
-namespace detail
-{
-
-#ifndef BOOST_USE_WINDOWS_H
-
-#ifdef _WIN64
-
-// Intel 6.0 on Win64 version, posted by Tim Fenders to [boost-users]
-
-extern "C" long_type __cdecl _InterlockedExchange(long volatile *, long);
-
-#pragma intrinsic(_InterlockedExchange)
-
-inline long InterlockedExchange(long volatile* lp, long l)
-{
- return _InterlockedExchange(lp, l);
-}
-
-#else // _WIN64
-
-extern "C" __declspec(dllimport) long __stdcall InterlockedExchange(long volatile *, long);
-
-#endif // _WIN64
-
-extern "C" __declspec(dllimport) void __stdcall Sleep(unsigned long);
-
-#endif // #ifndef BOOST_USE_WINDOWS_H
-
-class lightweight_mutex
-{
-private:
-
- long l_;
-
- lightweight_mutex(lightweight_mutex const &);
- lightweight_mutex & operator=(lightweight_mutex const &);
-
-public:
-
- lightweight_mutex(): l_(0)
- {
- }
-
- class scoped_lock;
- friend class scoped_lock;
-
- class scoped_lock
- {
- private:
-
- lightweight_mutex & m_;
-
- scoped_lock(scoped_lock const &);
- scoped_lock & operator=(scoped_lock const &);
-
- public:
-
- explicit scoped_lock(lightweight_mutex & m): m_(m)
- {
- while( InterlockedExchange(&m_.l_, 1) )
- {
- // Note: changed to Sleep(1) from Sleep(0).
- // According to MSDN, Sleep(0) will never yield
- // to a lower-priority thread, whereas Sleep(1)
- // will. Performance seems not to be affected.
-
- Sleep(1);
- }
- }
-
- ~scoped_lock()
- {
- InterlockedExchange(&m_.l_, 0);
-
- // Note: adding a yield here will make
- // the spinlock more fair and will increase the overall
- // performance of some applications substantially in
- // high contention situations, but will penalize the
- // low contention / single thread case up to 5x
- }
- };
-};
-
-} // namespace detail
-
-} // namespace boost
-
-#ifdef __BORLANDC__
-# pragma warn .8027 // Functions containing while are not expanded inline
-#endif
-
-#endif // #ifndef BOOST_DETAIL_LWM_WIN32_HPP_INCLUDED
+++ /dev/null
-#ifndef BOOST_DETAIL_LWM_WIN32_NT_HPP_INCLUDED
-#define BOOST_DETAIL_LWM_WIN32_NT_HPP_INCLUDED
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
-//
-// boost/detail/lwm_win32_nt.hpp
-//
-// Copyright (c) 2002, 2003 Peter Dimov
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// "No threads" version of lwm_win32.hpp; binary compatible but no-op.
-//
-
-namespace boost
-{
-
-namespace detail
-{
-
-class lightweight_mutex
-{
-private:
-
- long l_;
-
- lightweight_mutex(lightweight_mutex const &);
- lightweight_mutex & operator=(lightweight_mutex const &);
-
-public:
-
- lightweight_mutex(): l_(0)
- {
- }
-
- class scoped_lock;
- friend class scoped_lock;
-
- class scoped_lock
- {
- private:
-
- scoped_lock(scoped_lock const &);
- scoped_lock & operator=(scoped_lock const &);
-
- public:
-
- explicit scoped_lock(lightweight_mutex &)
- {
- }
- };
-};
-
-} // namespace detail
-
-} // namespace boost
-
-#endif // #ifndef BOOST_DETAIL_LWM_WIN32_NT_HPP_INCLUDED
--- /dev/null
+#ifndef BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_
+#define BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+//----------------------------------------------------------------------
+// (C) Copyright 2004 Pavel Vozenilek.
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+//
+// This file contains helper macros used when exception support may be
+// disabled (as indicated by macro BOOST_NO_EXCEPTIONS).
+//
+// Before picking up these macros you may consider using RAII techniques
+// to deal with exceptions - their syntax can be always the same with
+// or without exception support enabled.
+//
+
+/* Example of use:
+
+void foo() {
+ BOOST_TRY {
+ ...
+ } BOOST_CATCH(const std::bad_alloc&) {
+ ...
+ BOOST_RETHROW
+ } BOOST_CATCH(const std::exception& e) {
+ ...
+ }
+ BOOST_CATCH_END
+}
+
+With exception support enabled it will expand into:
+
+void foo() {
+ { try {
+ ...
+ } catch (const std::bad_alloc&) {
+ ...
+ throw;
+ } catch (const std::exception& e) {
+ ...
+ }
+ }
+}
+
+With exception support disabled it will expand into:
+
+void foo() {
+ { if(true) {
+ ...
+ } else if (false) {
+ ...
+ } else if (false) {
+ ...
+ }
+ }
+}
+*/
+//----------------------------------------------------------------------
+
+#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
+
+#if !(defined BOOST_NO_EXCEPTIONS)
+# define BOOST_TRY { try
+# define BOOST_CATCH(x) catch(x)
+# define BOOST_RETHROW throw;
+# define BOOST_CATCH_END }
+#else
+# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
+# define BOOST_TRY { if ("")
+# define BOOST_CATCH(x) else if (!"")
+# else
+# define BOOST_TRY { if (true)
+# define BOOST_CATCH(x) else if (false)
+# endif
+# define BOOST_RETHROW
+# define BOOST_CATCH_END }
+#endif
+
+
+#endif
// detail/shared_count.hpp
//
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
+// Copyright 2004-2005 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
-#include <boost/config.hpp>
-
-#if defined(BOOST_SP_USE_STD_ALLOCATOR) && defined(BOOST_SP_USE_QUICK_ALLOCATOR)
-# error BOOST_SP_USE_STD_ALLOCATOR and BOOST_SP_USE_QUICK_ALLOCATOR are incompatible.
+#ifdef __BORLANDC__
+# pragma warn -8027 // Functions containing try are not expanded inline
#endif
+#include <boost/config.hpp>
#include <boost/checked_delete.hpp>
#include <boost/throw_exception.hpp>
-#include <boost/detail/lightweight_mutex.hpp>
-
-#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
-#include <boost/detail/quick_allocator.hpp>
-#endif
+#include <boost/detail/bad_weak_ptr.hpp>
+#include <boost/detail/sp_counted_base.hpp>
+#include <boost/detail/sp_counted_impl.hpp>
#include <memory> // std::auto_ptr, std::allocator
#include <functional> // std::less
-#include <exception> // std::exception
#include <new> // std::bad_alloc
#include <typeinfo> // std::type_info in get_deleter
-#include <cstddef> // std::size_t
-
-#ifdef __BORLANDC__
-# pragma warn -8026 // Functions with excep. spec. are not expanded inline
-# pragma warn -8027 // Functions containing try are not expanded inline
-#endif
namespace boost
{
-// Debug hooks
-
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
-
-void sp_scalar_constructor_hook(void * px, std::size_t size, void * pn);
-void sp_array_constructor_hook(void * px);
-void sp_scalar_destructor_hook(void * px, std::size_t size, void * pn);
-void sp_array_destructor_hook(void * px);
-
-#endif
-
-
-// The standard library that comes with Borland C++ 5.5.1
-// defines std::exception and its members as having C calling
-// convention (-pc). When the definition of bad_weak_ptr
-// is compiled with -ps, the compiler issues an error.
-// Hence, the temporary #pragma option -pc below. The version
-// check is deliberately conservative.
-
-#if defined(__BORLANDC__) && __BORLANDC__ == 0x551
-# pragma option push -pc
-#endif
-
-class bad_weak_ptr: public std::exception
-{
-public:
-
- virtual char const * what() const throw()
- {
- return "boost::bad_weak_ptr";
- }
-};
-
-#if defined(__BORLANDC__) && __BORLANDC__ == 0x551
-# pragma option pop
-#endif
-
namespace detail
{
-class sp_counted_base
-{
-private:
-
- typedef detail::lightweight_mutex mutex_type;
-
-public:
-
- sp_counted_base(): use_count_(1), weak_count_(1)
- {
- }
-
- virtual ~sp_counted_base() // nothrow
- {
- }
-
- // dispose() is called when use_count_ drops to zero, to release
- // the resources managed by *this.
-
- virtual void dispose() = 0; // nothrow
-
- // destruct() is called when weak_count_ drops to zero.
-
- virtual void destruct() // nothrow
- {
- delete this;
- }
-
- virtual void * get_deleter(std::type_info const & ti) = 0;
-
- void add_ref_copy()
- {
-#if defined(BOOST_HAS_THREADS)
- mutex_type::scoped_lock lock(mtx_);
-#endif
- ++use_count_;
- }
-
- void add_ref_lock()
- {
-#if defined(BOOST_HAS_THREADS)
- mutex_type::scoped_lock lock(mtx_);
-#endif
- if(use_count_ == 0) boost::throw_exception(boost::bad_weak_ptr());
- ++use_count_;
- }
-
- void release() // nothrow
- {
- {
-#if defined(BOOST_HAS_THREADS)
- mutex_type::scoped_lock lock(mtx_);
-#endif
- long new_use_count = --use_count_;
-
- if(new_use_count != 0) return;
- }
-
- dispose();
- weak_release();
- }
-
- void weak_add_ref() // nothrow
- {
-#if defined(BOOST_HAS_THREADS)
- mutex_type::scoped_lock lock(mtx_);
-#endif
- ++weak_count_;
- }
-
- void weak_release() // nothrow
- {
- long new_weak_count;
-
- {
-#if defined(BOOST_HAS_THREADS)
- mutex_type::scoped_lock lock(mtx_);
-#endif
- new_weak_count = --weak_count_;
- }
-
- if(new_weak_count == 0)
- {
- destruct();
- }
- }
-
- long use_count() const // nothrow
- {
-#if defined(BOOST_HAS_THREADS)
- mutex_type::scoped_lock lock(mtx_);
-#endif
- return use_count_;
- }
-
-private:
-
- sp_counted_base(sp_counted_base const &);
- sp_counted_base & operator= (sp_counted_base const &);
-
- long use_count_; // #shared
- long weak_count_; // #weak + (#shared != 0)
-
-#if defined(BOOST_HAS_THREADS) || defined(BOOST_LWM_WIN32)
- mutable mutex_type mtx_;
-#endif
-};
-
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
-
-template<class T> void cbi_call_constructor_hook(sp_counted_base * pn, T * px, checked_deleter<T> const &, int)
-{
- boost::sp_scalar_constructor_hook(px, sizeof(T), pn);
-}
-
-template<class T> void cbi_call_constructor_hook(sp_counted_base *, T * px, checked_array_deleter<T> const &, int)
-{
- boost::sp_array_constructor_hook(px);
-}
-
-template<class P, class D> void cbi_call_constructor_hook(sp_counted_base *, P const &, D const &, long)
-{
-}
-
-template<class T> void cbi_call_destructor_hook(sp_counted_base * pn, T * px, checked_deleter<T> const &, int)
-{
- boost::sp_scalar_destructor_hook(px, sizeof(T), pn);
-}
-
-template<class T> void cbi_call_destructor_hook(sp_counted_base *, T * px, checked_array_deleter<T> const &, int)
-{
- boost::sp_array_destructor_hook(px);
-}
-
-template<class P, class D> void cbi_call_destructor_hook(sp_counted_base *, P const &, D const &, long)
-{
-}
-
-#endif
-
-//
-// Borland's Codeguard trips up over the -Vx- option here:
-//
-#ifdef __CODEGUARD__
-# pragma option push -Vx-
-#endif
-
-template<class P, class D> class sp_counted_base_impl: public sp_counted_base
-{
-private:
-
- P ptr; // copy constructor must not throw
- D del; // copy constructor must not throw
-
- sp_counted_base_impl(sp_counted_base_impl const &);
- sp_counted_base_impl & operator= (sp_counted_base_impl const &);
-
- typedef sp_counted_base_impl<P, D> this_type;
-
-public:
-
- // pre: initial_use_count <= initial_weak_count, d(p) must not throw
-
- sp_counted_base_impl(P p, D d): ptr(p), del(d)
- {
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- detail::cbi_call_constructor_hook(this, p, d, 0);
-#endif
- }
-
- virtual void dispose() // nothrow
- {
-#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
- detail::cbi_call_destructor_hook(this, ptr, del, 0);
-#endif
- del(ptr);
- }
-
- virtual void * get_deleter(std::type_info const & ti)
- {
- return ti == typeid(D)? &del: 0;
- }
-
-#if defined(BOOST_SP_USE_STD_ALLOCATOR)
-
- void * operator new(std::size_t)
- {
- return std::allocator<this_type>().allocate(1, static_cast<this_type *>(0));
- }
-
- void operator delete(void * p)
- {
- std::allocator<this_type>().deallocate(static_cast<this_type *>(p), 1);
- }
-
-#endif
-
-#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
-
- void * operator new(std::size_t)
- {
- return quick_allocator<this_type>::alloc();
- }
-
- void operator delete(void * p)
- {
- quick_allocator<this_type>::dealloc(p);
- }
-
-#endif
-};
-
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
int const shared_count_id = 0x2C35F101;
{
}
+ template<class Y> explicit shared_count( Y * p ): pi_( 0 )
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ , id_(shared_count_id)
+#endif
+ {
+#ifndef BOOST_NO_EXCEPTIONS
+
+ try
+ {
+ pi_ = new sp_counted_impl_p<Y>( p );
+ }
+ catch(...)
+ {
+ boost::checked_delete( p );
+ throw;
+ }
+
+#else
+
+ pi_ = new sp_counted_impl_p<Y>( p );
+
+ if( pi_ == 0 )
+ {
+ boost::checked_delete( p );
+ boost::throw_exception( std::bad_alloc() );
+ }
+
+#endif
+ }
+
template<class P, class D> shared_count(P p, D d): pi_(0)
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
, id_(shared_count_id)
try
{
- pi_ = new sp_counted_base_impl<P, D>(p, d);
+ pi_ = new sp_counted_impl_pd<P, D>(p, d);
}
catch(...)
{
#else
- pi_ = new sp_counted_base_impl<P, D>(p, d);
+ pi_ = new sp_counted_impl_pd<P, D>(p, d);
if(pi_ == 0)
{
// auto_ptr<Y> is special cased to provide the strong guarantee
template<class Y>
- explicit shared_count(std::auto_ptr<Y> & r): pi_(new sp_counted_base_impl< Y *, checked_deleter<Y> >(r.get(), checked_deleter<Y>()))
+ explicit shared_count( std::auto_ptr<Y> & r ): pi_( new sp_counted_impl_p<Y>( r.get() ) )
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
, id_(shared_count_id)
#endif
{
+#ifdef BOOST_NO_EXCEPTIONS
+
+ if( pi_ == 0 )
+ {
+ boost::throw_exception(std::bad_alloc());
+ }
+
+#endif
+
r.release();
}
~shared_count() // nothrow
{
- if(pi_ != 0) pi_->release();
+ if( pi_ != 0 ) pi_->release();
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
id_ = 0;
#endif
, id_(shared_count_id)
#endif
{
- if(pi_ != 0) pi_->add_ref_copy();
+ if( pi_ != 0 ) pi_->add_ref_copy();
}
explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0
{
sp_counted_base * tmp = r.pi_;
- if(tmp != pi_)
+ if( tmp != pi_ )
{
- if(tmp != 0) tmp->add_ref_copy();
- if(pi_ != 0) pi_->release();
+ if( tmp != 0 ) tmp->add_ref_copy();
+ if( pi_ != 0 ) pi_->release();
pi_ = tmp;
}
friend inline bool operator<(shared_count const & a, shared_count const & b)
{
- return std::less<sp_counted_base *>()(a.pi_, b.pi_);
+ return std::less<sp_counted_base *>()( a.pi_, b.pi_ );
}
void * get_deleter(std::type_info const & ti) const
{
- return pi_? pi_->get_deleter(ti): 0;
+ return pi_? pi_->get_deleter( ti ): 0;
}
};
-#ifdef __CODEGUARD__
-# pragma option pop
-#endif
-
class weak_count
{
}
};
-inline shared_count::shared_count(weak_count const & r): pi_(r.pi_)
+inline shared_count::shared_count( weak_count const & r ): pi_( r.pi_ )
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
, id_(shared_count_id)
#endif
{
- if(pi_ != 0)
- {
- pi_->add_ref_lock();
- }
- else
+ if( pi_ == 0 || !pi_->add_ref_lock() )
{
- boost::throw_exception(boost::bad_weak_ptr());
+ boost::throw_exception( boost::bad_weak_ptr() );
}
}
#ifdef __BORLANDC__
# pragma warn .8027 // Functions containing try are not expanded inline
-# pragma warn .8026 // Functions with excep. spec. are not expanded inline
#endif
#endif // #ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED
--- /dev/null
+#ifndef BOOST_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED
+#define BOOST_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// detail/sp_counted_base.hpp
+//
+// Copyright 2005 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#include <boost/config.hpp>
+
+#if defined( BOOST_SP_DISABLE_THREADS )
+
+# include <boost/detail/sp_counted_base_nt.hpp>
+
+#elif defined( BOOST_SP_USE_PTHREADS )
+
+# include <boost/detail/sp_counted_base_pt.hpp>
+
+#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
+
+# include <boost/detail/sp_counted_base_gcc_x86.hpp>
+
+//~ #elif defined( __MWERKS__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
+
+//~ # include <boost/detail/sp_counted_base_cw_x86.hpp>
+
+#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER )
+
+# include <boost/detail/sp_counted_base_gcc_ia64.hpp>
+
+#elif defined( __MWERKS__ ) && defined( __POWERPC__ )
+
+# include <boost/detail/sp_counted_base_cw_ppc.hpp>
+
+#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) )
+
+# include <boost/detail/sp_counted_base_gcc_ppc.hpp>
+
+#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
+
+# include <boost/detail/sp_counted_base_w32.hpp>
+
+#elif !defined( BOOST_HAS_THREADS )
+
+# include <boost/detail/sp_counted_base_nt.hpp>
+
+#elif defined( BOOST_HAS_PTHREADS )
+
+# include <boost/detail/sp_counted_base_pt.hpp>
+
+#else
+
+// Use #define BOOST_DISABLE_THREADS to avoid the error
+# error Unrecognized threading platform
+
+#endif
+
+#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED
--- /dev/null
+#ifndef BOOST_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED
+#define BOOST_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// detail/sp_counted_base_cw_ppc.hpp - CodeWarrior on PowerPC
+//
+// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
+// Copyright 2004-2005 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+//
+// Lock-free algorithm by Alexander Terekhov
+//
+// Thanks to Ben Hitchings for the #weak + (#shared != 0)
+// formulation
+//
+
+#include <typeinfo>
+
+namespace boost
+{
+
+namespace detail
+{
+
+inline void atomic_increment( register long * pw )
+{
+ register int a;
+
+ asm
+ {
+loop:
+
+ lwarx a, 0, pw
+ addi a, a, 1
+ stwcx. a, 0, pw
+ bne- loop
+ }
+}
+
+inline long atomic_decrement( register long * pw )
+{
+ register int a;
+
+ asm
+ {
+ sync
+
+loop:
+
+ lwarx a, 0, pw
+ addi a, a, -1
+ stwcx. a, 0, pw
+ bne- loop
+
+ isync
+ }
+
+ return a;
+}
+
+inline long atomic_conditional_increment( register long * pw )
+{
+ register int a;
+
+ asm
+ {
+loop:
+
+ lwarx a, 0, pw
+ cmpwi a, 0
+ beq store
+
+ addi a, a, 1
+
+store:
+
+ stwcx. a, 0, pw
+ bne- loop
+ }
+
+ return a;
+}
+
+class sp_counted_base
+{
+private:
+
+ sp_counted_base( sp_counted_base const & );
+ sp_counted_base & operator= ( sp_counted_base const & );
+
+ long use_count_; // #shared
+ long weak_count_; // #weak + (#shared != 0)
+
+public:
+
+ sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
+ {
+ }
+
+ virtual ~sp_counted_base() // nothrow
+ {
+ }
+
+ // dispose() is called when use_count_ drops to zero, to release
+ // the resources managed by *this.
+
+ virtual void dispose() = 0; // nothrow
+
+ // destroy() is called when weak_count_ drops to zero.
+
+ virtual void destroy() // nothrow
+ {
+ delete this;
+ }
+
+ virtual void * get_deleter( std::type_info const & ti ) = 0;
+
+ void add_ref_copy()
+ {
+ atomic_increment( &use_count_ );
+ }
+
+ bool add_ref_lock() // true on success
+ {
+ return atomic_conditional_increment( &use_count_ ) != 0;
+ }
+
+ void release() // nothrow
+ {
+ if( atomic_decrement( &use_count_ ) == 0 )
+ {
+ dispose();
+ weak_release();
+ }
+ }
+
+ void weak_add_ref() // nothrow
+ {
+ atomic_increment( &weak_count_ );
+ }
+
+ void weak_release() // nothrow
+ {
+ if( atomic_decrement( &weak_count_ ) == 0 )
+ {
+ destroy();
+ }
+ }
+
+ long use_count() const // nothrow
+ {
+ return static_cast<long const volatile &>( use_count_ );
+ }
+};
+
+} // namespace detail
+
+} // namespace boost
+
+#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED
--- /dev/null
+#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED
+#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// detail/sp_counted_base_gcc_ppc.hpp - g++ on PowerPC
+//
+// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
+// Copyright 2004-2005 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+//
+// Lock-free algorithm by Alexander Terekhov
+//
+// Thanks to Ben Hitchings for the #weak + (#shared != 0)
+// formulation
+//
+
+#include <typeinfo>
+
+namespace boost
+{
+
+namespace detail
+{
+
+inline void atomic_increment( int * pw )
+{
+ // ++*pw;
+
+ int tmp;
+
+ __asm__
+ (
+ "0:\n\t"
+ "lwarx %1, 0, %2\n\t"
+ "addi %1, %1, 1\n\t"
+ "stwcx. %1, 0, %2\n\t"
+ "bne- 0b":
+
+ "=m"( *pw ), "=&b"( tmp ):
+ "r"( pw ):
+ "cc"
+ );
+}
+
+inline int atomic_decrement( int * pw )
+{
+ // return --*pw;
+
+ int rv;
+
+ __asm__ __volatile__
+ (
+ "sync\n\t"
+ "0:\n\t"
+ "lwarx %1, 0, %2\n\t"
+ "addi %1, %1, -1\n\t"
+ "stwcx. %1, 0, %2\n\t"
+ "bne- 0b\n\t"
+ "isync":
+
+ "=m"( *pw ), "=&b"( rv ):
+ "r"( pw ):
+ "memory", "cc"
+ );
+
+ return rv;
+}
+
+inline int atomic_conditional_increment( int * pw )
+{
+ // if( *pw != 0 ) ++*pw;
+ // return *pw;
+
+ int rv;
+
+ __asm__
+ (
+ "0:\n\t"
+ "lwarx %1, 0, %2\n\t"
+ "cmpwi %1, 0\n\t"
+ "beq 1f\n\t"
+ "addi %1, %1, 1\n\t"
+ "1:\n\t"
+ "stwcx. %1, 0, %2\n\t"
+ "bne- 0b":
+
+ "=m"( *pw ), "=&b"( rv ):
+ "r"( pw ):
+ "cc"
+ );
+
+ return rv;
+}
+
+class sp_counted_base
+{
+private:
+
+ sp_counted_base( sp_counted_base const & );
+ sp_counted_base & operator= ( sp_counted_base const & );
+
+ int use_count_; // #shared
+ int weak_count_; // #weak + (#shared != 0)
+
+public:
+
+ sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
+ {
+ }
+
+ virtual ~sp_counted_base() // nothrow
+ {
+ }
+
+ // dispose() is called when use_count_ drops to zero, to release
+ // the resources managed by *this.
+
+ virtual void dispose() = 0; // nothrow
+
+ // destroy() is called when weak_count_ drops to zero.
+
+ virtual void destroy() // nothrow
+ {
+ delete this;
+ }
+
+ virtual void * get_deleter( std::type_info const & ti ) = 0;
+
+ void add_ref_copy()
+ {
+ atomic_increment( &use_count_ );
+ }
+
+ bool add_ref_lock() // true on success
+ {
+ return atomic_conditional_increment( &use_count_ ) != 0;
+ }
+
+ void release() // nothrow
+ {
+ if( atomic_decrement( &use_count_ ) == 0 )
+ {
+ dispose();
+ weak_release();
+ }
+ }
+
+ void weak_add_ref() // nothrow
+ {
+ atomic_increment( &weak_count_ );
+ }
+
+ void weak_release() // nothrow
+ {
+ if( atomic_decrement( &weak_count_ ) == 0 )
+ {
+ destroy();
+ }
+ }
+
+ long use_count() const // nothrow
+ {
+ return static_cast<int const volatile &>( use_count_ );
+ }
+};
+
+} // namespace detail
+
+} // namespace boost
+
+#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED
--- /dev/null
+#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED
+#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// detail/sp_counted_base_gcc_x86.hpp - g++ on 486+ or AMD64
+//
+// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
+// Copyright 2004-2005 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+//
+// Lock-free algorithm by Alexander Terekhov
+//
+// Thanks to Ben Hitchings for the #weak + (#shared != 0)
+// formulation
+//
+
+#include <typeinfo>
+
+namespace boost
+{
+
+namespace detail
+{
+
+inline int atomic_exchange_and_add( int * pw, int dv )
+{
+ // int r = *pw;
+ // *pw += dv;
+ // return r;
+
+ int r;
+
+ __asm__ __volatile__
+ (
+ "lock\n\t"
+ "xadd %1, %0":
+ "=m"( *pw ), "=r"( r ): // outputs (%0, %1)
+ "m"( *pw ), "1"( dv ): // inputs (%2, %3 == %1)
+ "memory", "cc" // clobbers
+ );
+
+ return r;
+}
+
+inline void atomic_increment( int * pw )
+{
+ //atomic_exchange_and_add( pw, 1 );
+
+ __asm__
+ (
+ "lock\n\t"
+ "incl %0":
+ "=m"( *pw ): // output (%0)
+ "m"( *pw ): // input (%1)
+ "cc" // clobbers
+ );
+}
+
+inline int atomic_conditional_increment( int * pw )
+{
+ // int rv = *pw;
+ // if( rv != 0 ) ++*pw;
+ // return rv;
+
+ int rv, tmp;
+
+ __asm__
+ (
+ "movl %0, %%eax\n\t"
+ "0:\n\t"
+ "test %%eax, %%eax\n\t"
+ "je 1f\n\t"
+ "movl %%eax, %2\n\t"
+ "incl %2\n\t"
+ "lock\n\t"
+ "cmpxchgl %2, %0\n\t"
+ "jne 0b\n\t"
+ "1:":
+ "=m"( *pw ), "=&a"( rv ), "=&r"( tmp ): // outputs (%0, %1, %2)
+ "m"( *pw ): // input (%3)
+ "cc" // clobbers
+ );
+
+ return rv;
+}
+
+class sp_counted_base
+{
+private:
+
+ sp_counted_base( sp_counted_base const & );
+ sp_counted_base & operator= ( sp_counted_base const & );
+
+ int use_count_; // #shared
+ int weak_count_; // #weak + (#shared != 0)
+
+public:
+
+ sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
+ {
+ }
+
+ virtual ~sp_counted_base() // nothrow
+ {
+ }
+
+ // dispose() is called when use_count_ drops to zero, to release
+ // the resources managed by *this.
+
+ virtual void dispose() = 0; // nothrow
+
+ // destroy() is called when weak_count_ drops to zero.
+
+ virtual void destroy() // nothrow
+ {
+ delete this;
+ }
+
+ virtual void * get_deleter( std::type_info const & ti ) = 0;
+
+ void add_ref_copy()
+ {
+ atomic_increment( &use_count_ );
+ }
+
+ bool add_ref_lock() // true on success
+ {
+ return atomic_conditional_increment( &use_count_ ) != 0;
+ }
+
+ void release() // nothrow
+ {
+ if( atomic_exchange_and_add( &use_count_, -1 ) == 1 )
+ {
+ dispose();
+ weak_release();
+ }
+ }
+
+ void weak_add_ref() // nothrow
+ {
+ atomic_increment( &weak_count_ );
+ }
+
+ void weak_release() // nothrow
+ {
+ if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 )
+ {
+ destroy();
+ }
+ }
+
+ long use_count() const // nothrow
+ {
+ return static_cast<int const volatile &>( use_count_ );
+ }
+};
+
+} // namespace detail
+
+} // namespace boost
+
+#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED
--- /dev/null
+#ifndef BOOST_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED
+#define BOOST_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// detail/sp_counted_base_nt.hpp
+//
+// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
+// Copyright 2004-2005 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#include <typeinfo>
+
+namespace boost
+{
+
+namespace detail
+{
+
+class sp_counted_base
+{
+private:
+
+ sp_counted_base( sp_counted_base const & );
+ sp_counted_base & operator= ( sp_counted_base const & );
+
+ long use_count_; // #shared
+ long weak_count_; // #weak + (#shared != 0)
+
+public:
+
+ sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
+ {
+ }
+
+ virtual ~sp_counted_base() // nothrow
+ {
+ }
+
+ // dispose() is called when use_count_ drops to zero, to release
+ // the resources managed by *this.
+
+ virtual void dispose() = 0; // nothrow
+
+ // destroy() is called when weak_count_ drops to zero.
+
+ virtual void destroy() // nothrow
+ {
+ delete this;
+ }
+
+ virtual void * get_deleter( std::type_info const & ti ) = 0;
+
+ void add_ref_copy()
+ {
+ ++use_count_;
+ }
+
+ bool add_ref_lock() // true on success
+ {
+ if( use_count_ == 0 ) return false;
+ ++use_count_;
+ return true;
+ }
+
+ void release() // nothrow
+ {
+ if( --use_count_ == 0 )
+ {
+ dispose();
+ weak_release();
+ }
+ }
+
+ void weak_add_ref() // nothrow
+ {
+ ++weak_count_;
+ }
+
+ void weak_release() // nothrow
+ {
+ if( --weak_count_ == 0 )
+ {
+ destroy();
+ }
+ }
+
+ long use_count() const // nothrow
+ {
+ return use_count_;
+ }
+};
+
+} // namespace detail
+
+} // namespace boost
+
+#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED
--- /dev/null
+#ifndef BOOST_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED
+#define BOOST_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// detail/sp_counted_base_pt.hpp
+//
+// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
+// Copyright 2004-2005 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#include <typeinfo>
+#include <pthread.h>
+
+namespace boost
+{
+
+namespace detail
+{
+
+class sp_counted_base
+{
+private:
+
+ sp_counted_base( sp_counted_base const & );
+ sp_counted_base & operator= ( sp_counted_base const & );
+
+ long use_count_; // #shared
+ long weak_count_; // #weak + (#shared != 0)
+
+ mutable pthread_mutex_t m_;
+
+public:
+
+ sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
+ {
+// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init
+
+#if defined(__hpux) && defined(_DECTHREADS_)
+ pthread_mutex_init( &m_, pthread_mutexattr_default );
+#else
+ pthread_mutex_init( &m_, 0 );
+#endif
+ }
+
+ virtual ~sp_counted_base() // nothrow
+ {
+ pthread_mutex_destroy( &m_ );
+ }
+
+ // dispose() is called when use_count_ drops to zero, to release
+ // the resources managed by *this.
+
+ virtual void dispose() = 0; // nothrow
+
+ // destroy() is called when weak_count_ drops to zero.
+
+ virtual void destroy() // nothrow
+ {
+ delete this;
+ }
+
+ virtual void * get_deleter( std::type_info const & ti ) = 0;
+
+ void add_ref_copy()
+ {
+ pthread_mutex_lock( &m_ );
+ ++use_count_;
+ pthread_mutex_unlock( &m_ );
+ }
+
+ bool add_ref_lock() // true on success
+ {
+ pthread_mutex_lock( &m_ );
+ bool r = use_count_ == 0? false: ( ++use_count_, true );
+ pthread_mutex_unlock( &m_ );
+ return r;
+ }
+
+ void release() // nothrow
+ {
+ pthread_mutex_lock( &m_ );
+ long new_use_count = --use_count_;
+ pthread_mutex_unlock( &m_ );
+
+ if( new_use_count == 0 )
+ {
+ dispose();
+ weak_release();
+ }
+ }
+
+ void weak_add_ref() // nothrow
+ {
+ pthread_mutex_lock( &m_ );
+ ++weak_count_;
+ pthread_mutex_unlock( &m_ );
+ }
+
+ void weak_release() // nothrow
+ {
+ pthread_mutex_lock( &m_ );
+ long new_weak_count = --weak_count_;
+ pthread_mutex_unlock( &m_ );
+
+ if( new_weak_count == 0 )
+ {
+ destroy();
+ }
+ }
+
+ long use_count() const // nothrow
+ {
+ pthread_mutex_lock( &m_ );
+ long r = use_count_;
+ pthread_mutex_unlock( &m_ );
+
+ return r;
+ }
+};
+
+} // namespace detail
+
+} // namespace boost
+
+#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED
--- /dev/null
+#ifndef BOOST_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED
+#define BOOST_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// detail/sp_counted_base_w32.hpp
+//
+// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
+// Copyright 2004-2005 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+//
+// Lock-free algorithm by Alexander Terekhov
+//
+// Thanks to Ben Hitchings for the #weak + (#shared != 0)
+// formulation
+//
+
+#include <boost/detail/interlocked.hpp>
+#include <typeinfo>
+
+namespace boost
+{
+
+namespace detail
+{
+
+class sp_counted_base
+{
+private:
+
+ sp_counted_base( sp_counted_base const & );
+ sp_counted_base & operator= ( sp_counted_base const & );
+
+ long use_count_; // #shared
+ long weak_count_; // #weak + (#shared != 0)
+
+public:
+
+ sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
+ {
+ }
+
+ virtual ~sp_counted_base() // nothrow
+ {
+ }
+
+ // dispose() is called when use_count_ drops to zero, to release
+ // the resources managed by *this.
+
+ virtual void dispose() = 0; // nothrow
+
+ // destroy() is called when weak_count_ drops to zero.
+
+ virtual void destroy() // nothrow
+ {
+ delete this;
+ }
+
+ virtual void * get_deleter( std::type_info const & ti ) = 0;
+
+ void add_ref_copy()
+ {
+ BOOST_INTERLOCKED_INCREMENT( &use_count_ );
+ }
+
+ bool add_ref_lock() // true on success
+ {
+ for( ;; )
+ {
+ long tmp = static_cast< long const volatile& >( use_count_ );
+ if( tmp == 0 ) return false;
+ if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true;
+ }
+ }
+
+ void release() // nothrow
+ {
+ if( BOOST_INTERLOCKED_DECREMENT( &use_count_ ) == 0 )
+ {
+ dispose();
+ weak_release();
+ }
+ }
+
+ void weak_add_ref() // nothrow
+ {
+ BOOST_INTERLOCKED_INCREMENT( &weak_count_ );
+ }
+
+ void weak_release() // nothrow
+ {
+ if( BOOST_INTERLOCKED_DECREMENT( &weak_count_ ) == 0 )
+ {
+ destroy();
+ }
+ }
+
+ long use_count() const // nothrow
+ {
+ return static_cast<long const volatile &>( use_count_ );
+ }
+};
+
+} // namespace detail
+
+} // namespace boost
+
+#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED
--- /dev/null
+#ifndef BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
+#define BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
+
+// MS compatible compilers support #pragma once
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+//
+// detail/sp_counted_impl.hpp
+//
+// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
+// Copyright 2004-2005 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#include <boost/config.hpp>
+
+#if defined(BOOST_SP_USE_STD_ALLOCATOR) && defined(BOOST_SP_USE_QUICK_ALLOCATOR)
+# error BOOST_SP_USE_STD_ALLOCATOR and BOOST_SP_USE_QUICK_ALLOCATOR are incompatible.
+#endif
+
+#include <boost/checked_delete.hpp>
+#include <boost/detail/sp_counted_base.hpp>
+
+#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
+#include <boost/detail/quick_allocator.hpp>
+#endif
+
+#include <memory> // std::allocator
+#include <typeinfo> // std::type_info in get_deleter
+#include <cstddef> // std::size_t
+
+namespace boost
+{
+
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+
+void sp_scalar_constructor_hook( void * px, std::size_t size, void * pn );
+void sp_scalar_destructor_hook( void * px, std::size_t size, void * pn );
+
+#endif
+
+namespace detail
+{
+
+template<class X> class sp_counted_impl_p: public sp_counted_base
+{
+private:
+
+ X * px_;
+
+ sp_counted_impl_p( sp_counted_impl_p const & );
+ sp_counted_impl_p & operator= ( sp_counted_impl_p const & );
+
+ typedef sp_counted_impl_p<X> this_type;
+
+public:
+
+ explicit sp_counted_impl_p( X * px ): px_( px )
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_scalar_constructor_hook( px, sizeof(X), this );
+#endif
+ }
+
+ virtual void dispose() // nothrow
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_scalar_destructor_hook( px_, sizeof(X), this );
+#endif
+ boost::checked_delete( px_ );
+ }
+
+ virtual void * get_deleter( std::type_info const & )
+ {
+ return 0;
+ }
+
+#if defined(BOOST_SP_USE_STD_ALLOCATOR)
+
+ void * operator new( std::size_t )
+ {
+ return std::allocator<this_type>().allocate( 1, static_cast<this_type *>(0) );
+ }
+
+ void operator delete( void * p )
+ {
+ std::allocator<this_type>().deallocate( static_cast<this_type *>(p), 1 );
+ }
+
+#endif
+
+#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
+
+ void * operator new( std::size_t )
+ {
+ return quick_allocator<this_type>::alloc();
+ }
+
+ void operator delete( void * p )
+ {
+ quick_allocator<this_type>::dealloc( p );
+ }
+
+#endif
+};
+
+//
+// Borland's Codeguard trips up over the -Vx- option here:
+//
+#ifdef __CODEGUARD__
+# pragma option push -Vx-
+#endif
+
+template<class P, class D> class sp_counted_impl_pd: public sp_counted_base
+{
+private:
+
+ P ptr; // copy constructor must not throw
+ D del; // copy constructor must not throw
+
+ sp_counted_impl_pd( sp_counted_impl_pd const & );
+ sp_counted_impl_pd & operator= ( sp_counted_impl_pd const & );
+
+ typedef sp_counted_impl_pd<P, D> this_type;
+
+public:
+
+ // pre: d(p) must not throw
+
+ sp_counted_impl_pd( P p, D d ): ptr(p), del(d)
+ {
+ }
+
+ virtual void dispose() // nothrow
+ {
+ del( ptr );
+ }
+
+ virtual void * get_deleter( std::type_info const & ti )
+ {
+ return ti == typeid(D)? &del: 0;
+ }
+
+#if defined(BOOST_SP_USE_STD_ALLOCATOR)
+
+ void * operator new( std::size_t )
+ {
+ return std::allocator<this_type>().allocate( 1, static_cast<this_type *>(0) );
+ }
+
+ void operator delete( void * p )
+ {
+ std::allocator<this_type>().deallocate( static_cast<this_type *>(p), 1 );
+ }
+
+#endif
+
+#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
+
+ void * operator new( std::size_t )
+ {
+ return quick_allocator<this_type>::alloc();
+ }
+
+ void operator delete( void * p )
+ {
+ quick_allocator<this_type>::dealloc( p );
+ }
+
+#endif
+};
+
+#ifdef __CODEGUARD__
+# pragma option pop
+#endif
+
+} // namespace detail
+
+} // namespace boost
+
+#endif // #ifndef BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
// enable dynamic linking on Windows ---------------------------------------//
+# if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)) && defined(__BORLANDC__) && defined(__WIN32__)
+# error Dynamic linking Boost.Filesystem does not work for Borland; use static linking instead
+# endif
+
#ifdef BOOST_HAS_DECLSPEC // defined in config system
// we need to import/export our code only if the user has specifically
// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
reference dereference() const { return m_name; }
bool equal( const iterator & rhs ) const
{ return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos; }
- void increment();
- void decrement();
+ BOOST_FILESYSTEM_DECL void increment();
+ BOOST_FILESYSTEM_DECL void decrement();
std::string m_name; // cache current element.
const path * m_path_ptr; // path being iterated over.
typedef typename compat_traits_type::off_type off_type;
typedef Alloc allocator_type;
typedef ::std::basic_string<Ch, Tr, Alloc> string_type;
+ typedef typename string_type::size_type size_type;
typedef ::std::streamsize streamsize;
// 0-copy access :
Ch * begin() const;
- streamsize size() const;
- streamsize cur_size() const; // stop at current pointer
+ size_type size() const;
+ size_type cur_size() const; // stop at current pointer
Ch * pend() const // the highest position reached by pptr() since creation
{ return ((putend_ < pptr()) ? pptr() : putend_); }
- streamsize pcount() const
- { return static_cast<streamsize>( pptr() - pbase()) ;}
+ size_type pcount() const
+ { return static_cast<size_type>( pptr() - pbase()) ;}
// copy buffer to string :
string_type str() const
basic_altstringbuf<Ch,Tr, Alloc> > >
pbase_type;
typedef ::std::basic_string<Ch, Tr, Alloc> string_type;
+ typedef typename string_type::size_type size_type;
typedef basic_altstringbuf<Ch, Tr, Alloc> stringbuf_t;
public:
typedef Alloc allocator_type;
// 0-copy access :
Ch * begin() const
{ return rdbuf()->begin(); }
- ::std::streamsize size() const
+ size_type size() const
{ return rdbuf()->size(); }
- ::std::streamsize cur_size() const // stops at current position
+ size_type cur_size() const // stops at current position
{ return rdbuf()->cur_size(); }
// copy buffer to string :
{ return rdbuf()->str(); }
string_type cur_str() const // [pbase, pptr[
{ return rdbuf()->cur_str(); }
+ void str(const string_type& s)
+ { rdbuf()->str(s); }
};
} // N.S. io
template<class Ch, class Tr, class Alloc>
void basic_altstringbuf<Ch, Tr, Alloc>::
str (const string_type& s) {
- std::size_t sz=s.size();
+ size_type sz=s.size();
if(sz != 0 && mode_ & (::std::ios_base::in | ::std::ios_base::out) ) {
Ch *new_ptr = alloc_.allocate(sz, is_allocated_? eback() : 0);
// if this didnt throw, we're safe, update the buffer
dealloc();
- sz = s.copy(new_ptr);
+ sz = s.copy(new_ptr, sz);
putend_ = new_ptr + sz;
if(mode_ & ::std::ios_base::in)
streambuf_t::setg(new_ptr, new_ptr, new_ptr + sz);
if(mode_ & ::std::ios_base::out) {
streambuf_t::setp(new_ptr, new_ptr + sz);
if(mode_ & (::std::ios_base::app | ::std::ios_base::ate))
- streambuf_t::pbump(sz);
+ streambuf_t::pbump(static_cast<int>(sz));
if(gptr() == NULL)
streambuf_t::setg(new_ptr, NULL, new_ptr);
}
}
template<class Ch, class Tr, class Alloc>
- std::streamsize basic_altstringbuf<Ch, Tr, Alloc>::
+ typename std::basic_string<Ch,Tr,Alloc>::size_type
+ basic_altstringbuf<Ch, Tr, Alloc>::
size () const {
if(mode_ & ::std::ios_base::out && pptr())
- return static_cast<streamsize>( pend() - pbase());
+ return static_cast<size_type>(pend() - pbase());
else if(mode_ & ::std::ios_base::in && gptr())
- return static_cast<streamsize>( egptr() - eback());
+ return static_cast<size_type>(egptr() - eback());
else
return 0;
}
template<class Ch, class Tr, class Alloc>
- std::streamsize basic_altstringbuf<Ch, Tr, Alloc>::
+ typename std::basic_string<Ch,Tr,Alloc>::size_type
+ basic_altstringbuf<Ch, Tr, Alloc>::
cur_size () const {
if(mode_ & ::std::ios_base::out && pptr())
return static_cast<streamsize>( pptr() - pbase());
if(which & ::std::ios_base::in && gptr() != NULL) {
// get area
if(way == ::std::ios_base::end)
- off += putend_ - eback();
- else if(way == ::std::ios_base::cur && (which & ::std::ios_base::out) == 0)
- off += gptr() - eback();
- else if(way != ::std::ios_base::beg)
- off = off_type(-1);
- if(0 <= off && off <= putend_ - eback()) {
+ off += static_cast<off_type>(putend_ - gptr());
+ else if(way == ::std::ios_base::beg)
+ off += static_cast<off_type>(eback() - gptr());
+ else if(way != ::std::ios_base::cur || (which & ::std::ios_base::out) )
+ // (altering in&out is only supported if way is beg or end, not cur)
+ return pos_type(off_type(-1));
+ if(eback() <= off+gptr() && off+gptr() <= putend_ ) {
// set gptr
- streambuf_t::gbump(off + (eback() - gptr()));
+ streambuf_t::gbump(off);
if(which & ::std::ios_base::out && pptr() != NULL)
// update pptr to match gptr
- streambuf_t::pbump(gptr()-pptr());
+ streambuf_t::pbump(static_cast<int>(gptr()-pptr()));
}
else
off = off_type(-1);
else if(which & ::std::ios_base::out && pptr() != NULL) {
// put area
if(way == ::std::ios_base::end)
- off += putend_ - eback();
- else if(way == ::std::ios_base::cur)
- off += pptr() - eback();
+ off += static_cast<off_type>(putend_ - pptr());
+ else if(way == ::std::ios_base::beg)
+ off += static_cast<off_type>(pbase() - pptr());
else if(way != ::std::ios_base::beg)
- off = off_type(-1);
-
- if(0 <= off && off <= putend_ - eback())
+ return pos_type(off_type(-1));
+ if(pbase() <= off+pptr() && off+pptr() <= putend_)
// set pptr
- streambuf_t::pbump((int)(eback() - pptr() + off));
+ streambuf_t::pbump(off);
else
off = off_type(-1);
}
if(which & ::std::ios_base::in && gptr() != NULL) {
// get area
if(0 <= off && off <= putend_ - eback()) {
- streambuf_t::gbump((int)(eback() - gptr() + off));
+ streambuf_t::gbump(static_cast<int>(eback() - gptr() + off));
if(which & ::std::ios_base::out && pptr() != NULL) {
// update pptr to match gptr
- streambuf_t::pbump(gptr()-pptr());
+ streambuf_t::pbump(static_cast<int>(gptr()-pptr()));
}
}
else
else if(which & ::std::ios_base::out && pptr() != NULL) {
// put area
if(0 <= off && off <= putend_ - eback())
- streambuf_t::pbump(eback() - pptr() + off);
+ streambuf_t::pbump(static_cast<int>(eback() - pptr() + off));
else
off = off_type(-1);
}
}
else { // update pointers
putend_ = putend_ - oldptr + newptr;
- int pptr_count = pptr()-pbase();
- int gptr_count = gptr()-eback();
+ int pptr_count = static_cast<int>(pptr()-pbase());
+ int gptr_count = static_cast<int>(gptr()-eback());
streambuf_t::setp(pbase() - oldptr + newptr, newptr + new_size);
streambuf_t::pbump(pptr_count);
if(mode_ & ::std::ios_base::in)
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT( 0x570 ) ) )
// some future __BORLANDC__ >0x564 versions might not need this
// 0x570 is Borland's kylix branch
-#define BOOST_NO_LOCALE_ISIDIGIT
+#define BOOST_NO_LOCALE_ISDIGIT
#endif
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570) ) || BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1300))
#ifndef BOOST_MSVC_DISAMBIGUATER_HPP
#define BOOST_MSVC_DISAMBIGUATER_HPP
-#if BOOST_WORKAROUND( BOOST_MSVC, <= 1300)
+#if BOOST_WORKAROUND( BOOST_MSVC, <= 1300) || \
+ BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
// this whole header is specifically for msvc up to 7.0
#include <boost/format/group.hpp>
#ifdef BOOST_NO_OVERLOAD_FOR_NON_CONST
#undef BOOST_NO_OVERLOAD_FOR_NON_CONST
#endif
-#ifdef BOOST_NO_LOCALE_ISIDIGIT
-#undef BOOST_NO_LOCALE_ISIDIGIT
+#ifdef BOOST_NO_LOCALE_ISDIGIT
+#undef BOOST_NO_LOCALE_ISDIGIT
#endif
#ifdef BOOST_IO_STD
#undef BOOST_IO_STD
template<class Ch, class Tr, class Alloc>
void mk_str( std::basic_string<Ch,Tr, Alloc> & res,
const Ch * beg,
- std::streamsize size,
+ typename std::basic_string<Ch,Tr,Alloc>::size_type size,
std::streamsize w,
const Ch fill_char,
std::ios_base::fmtflags f,
// applies centered/left/right padding to the string [beg, beg+size[
// Effects : the result is placed in res.
{
+ typedef typename std::basic_string<Ch,Tr,Alloc>::size_type size_type;
res.resize(0);
- std::streamsize n=w-size-!!prefix_space;
- std::streamsize n_after = 0, n_before = 0;
-
- if(n<=0) { // no need to pad.
+ if(w<=0 || static_cast<size_type>(w) <=size) {
+ // no need to pad.
res.reserve(size + !!prefix_space);
+ if(prefix_space)
+ res.append(1, prefix_space);
+ res.append(beg, size);
}
else {
+ std::streamsize n=static_cast<std::streamsize>(w-size-!!prefix_space);
+ std::streamsize n_after = 0, n_before = 0;
res.reserve(w); // allocate once for the 2 inserts
if(center)
n_after = n/2, n_before = n - n_after;
n_after = n;
else
n_before = n;
+ // now make the res string :
+ if(n_before) res.append(n_before, fill_char);
+ if(prefix_space)
+ res.append(1, prefix_space);
+ res.append(beg, size);
+ if(n_after) res.append(n_after, fill_char);
}
- // now make the res string :
- if(n_before) res.append(n_before, fill_char);
- if(prefix_space)
- res.append(1, prefix_space);
- res.append(beg, size);
- if(n_after) res.append(n_after, fill_char);
} // -mk_str(..)
-#if BOOST_WORKAROUND( BOOST_MSVC, <= 1300)
+#if BOOST_WORKAROUND( BOOST_MSVC, <= 1300) || \
+ BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
// MSVC needs to be tricked to disambiguate this simple overload..
// the trick is in "boost/format/msvc_disambiguater.hpp"
if(buf.pcount()== 0 ||
(res_beg[0] !=oss.widen('+') && res_beg[0] !=oss.widen('-') ))
prefix_space = oss.widen(' ');
- std::streamsize res_size = (std::min)(
- static_cast<std::streamsize>(specs.truncate_ - !!prefix_space),
+ size_type res_size = (std::min)(
+ static_cast<size_type>(specs.truncate_ - !!prefix_space),
buf.pcount() );
mk_str(res, res_beg, res_size, w, oss.fill(), fl,
prefix_space, (specs.pad_scheme_ & format_item_t::centered) !=0 );
// but spacepad or truncate might be mixed with internal (using manipulator)
put_last( oss, x); // may pad
const Ch * res_beg = buf.pbase();
- std::streamsize res_size = buf.pcount();
+ size_type res_size = buf.pcount();
bool prefix_space=false;
if(specs.pad_scheme_ & format_item_t::spacepad)
if(buf.pcount()== 0 ||
(res_beg[0] !=oss.widen('+') && res_beg[0] !=oss.widen('-') ))
prefix_space = true;
- if(res_size == w && w<=specs.truncate_ && !prefix_space) {
+ if(res_size == static_cast<size_type>(w) && w<=specs.truncate_ && !prefix_space) {
// okay, only one thing was printed and padded, so res is fine
res.assign(res_beg, res_size);
}
}
// we now have the minimal-length output
const Ch * tmp_beg = buf.pbase();
- std::streamsize tmp_size = (std::min)(static_cast<std::streamsize>(specs.truncate_),
- buf.pcount() );
+ size_type tmp_size = (std::min)(static_cast<size_type>(specs.truncate_),
+ buf.pcount() );
- std::streamsize d;
- if( (d=w - tmp_size) <=0 ) {
+
+ if(static_cast<size_type>(w) <= tmp_size) {
// minimal length is already >= w, so no padding (cool!)
res.assign(tmp_beg, tmp_size);
}
else { // hum.. we need to pad (multi_output, or spacepad present)
- std::streamsize i = prefix_space;
//find where we should pad
- std::streamsize sz = (std::min)(res_size+prefix_space, tmp_size);
+ size_type sz = (std::min)(res_size+prefix_space, tmp_size);
+ size_type i = prefix_space;
for(; i<sz && tmp_beg[i] == res[i-prefix_space]; ++i) {}
if(i>=tmp_size) i=prefix_space;
res.assign(tmp_beg, i);
- if(d>0) res.append(static_cast<size_type>( d ), oss2.fill());
+ std::streamsize d = w - static_cast<std::streamsize>(tmp_size);
+ BOOST_ASSERT(d>0);
+ res.append(static_cast<size_type>( d ), oss2.fill());
res.append(tmp_beg+i, tmp_size-i);
- BOOST_ASSERT(i+(tmp_size-i)+(std::max)(d,(std::streamsize)0) == w);
- BOOST_ASSERT(res.size() == (std::size_t)w);
+ BOOST_ASSERT(i+(tmp_size-i)+(std::max)(d,(std::streamsize)0)
+ == static_cast<size_type>(w));
+ BOOST_ASSERT(res.size() == static_cast<size_type>(w));
}
}
}
#if !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS ) \
&& !BOOST_WORKAROUND(__BORLANDC__, <= 0x570) \
&& !BOOST_WORKAROUND( _CRAYC, != 0) \
- && !BOOST_WORKAROUND(__DECCXX_VER, <= 60590041)
+ && !BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
// use friend templates and private members only if supported
#ifndef BOOST_NO_TEMPLATE_STD_STREAM
res += item.res_;
if( item.argN_ == format_item_t::argN_tabulation) {
BOOST_ASSERT( item.pad_scheme_ & format_item_t::tabulation);
- std::streamsize n = item.fmtstate_.width_ - res.size();
- if( n > 0 )
- res.append( n, item.fmtstate_.fill_ );
+ if( static_cast<size_type>(item.fmtstate_.width_) > res.size() )
+ res.append( static_cast<size_type>(item.fmtstate_.width_) - res.size(),
+ item.fmtstate_.fill_ );
}
res += item.appendix_;
}
return res;
}
template< class Ch, class Tr, class Alloc>
- typename basic_format<Ch, Tr, Alloc>::size_type basic_format<Ch,Tr, Alloc>::
+ typename std::basic_string<Ch, Tr, Alloc>::size_type basic_format<Ch,Tr, Alloc>::
size () const {
BOOST_USING_STD_MAX();
- std::streamsize sz = prefix_.size();
+ size_type sz = prefix_.size();
unsigned long i;
for(i=0; i < items_.size(); ++i) {
const format_item_t& item = items_[i];
sz += item.res_.size();
if( item.argN_ == format_item_t::argN_tabulation)
- sz = max BOOST_PREVENT_MACRO_SUBSTITUTION (sz, item.fmtstate_.width_);
- sz += + item.appendix_.size();
+ sz = max BOOST_PREVENT_MACRO_SUBSTITUTION (sz,
+ static_cast<size_type>(item.fmtstate_.width_) );
+ sz += item.appendix_.size();
}
- return static_cast<typename string_type::size_type> (sz);
+ return sz;
}
namespace io {
template<class Ch, class Facet> inline
bool wrap_isdigit(const Facet& fac, Ch c) {
-#if ! defined( BOOST_NO_LOCALE_ISIDIGIT )
+#if ! defined( BOOST_NO_LOCALE_ISDIGIT )
return fac.is(std::ctype<Ch>::digit, c);
# else
using namespace std;
#include <boost/function/detail/prologue.hpp>
// Visual Age C++ doesn't handle the file iteration well
-#if BOOST_WORKAROUND(__IBMCPP__, <= 600)
+#if BOOST_WORKAROUND(__IBMCPP__, >= 500)
# if BOOST_FUNCTION_MAX_ARGS >= 0
# include <boost/function/function0.hpp>
# endif
# define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
#endif
-#define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \
- typename ::boost::enable_if_c<(::boost::type_traits::ice_not< \
- (::boost::is_integral<Functor>::value)>::value), \
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600)
+# define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \
+ typename ::boost::enable_if_c<(::boost::type_traits::ice_not< \
+ (::boost::is_integral<Functor>::value)>::value), \
+ Type>::type
+#else
+// BCC doesn't recognize this depends on a template argument and complains
+// about the use of 'typename'
+# define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \
+ ::boost::enable_if_c<(::boost::type_traits::ice_not< \
+ (::boost::is_integral<Functor>::value)>::value), \
Type>::type
-
+#endif
#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX)
namespace boost {
}
template<typename Functor>
+
+#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ const Functor* target( Functor * = 0 ) const
+#else
const Functor* target() const
+#endif
{
if (!manager) return 0;
if (!result.obj_ptr) return 0;
else {
typedef typename detail::function::get_function_tag<Functor>::type tag;
+
+#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ return get_functor_pointer(tag(), 0, (Functor*)0);
+#else
return get_functor_pointer<Functor>(tag(), 0);
+#endif
}
}
template<typename F>
bool contains(const F& f) const
{
+#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ if (const F* fp = this->target( (F*)0 )) {
+#else
if (const F* fp = this->template target<F>()) {
+#endif
return function_equal(*fp, f);
} else {
return false;
private:
template<typename Functor>
+#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ Functor* get_functor_pointer(detail::function::function_ptr_tag, int, Functor * = 0)
+#else
Functor* get_functor_pointer(detail::function::function_ptr_tag, int)
+#endif
{ return reinterpret_cast<Functor*>(&functor.func_ptr); }
template<typename Functor, typename Tag>
+#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ Functor* get_functor_pointer(Tag, long, Functor * = 0)
+#else
Functor* get_functor_pointer(Tag, long)
+#endif
{ return static_cast<Functor*>(functor.obj_ptr); }
template<typename Functor>
const Functor*
+#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ get_functor_pointer(detail::function::function_ptr_tag, int, Functor * = 0) const
+#else
get_functor_pointer(detail::function::function_ptr_tag, int) const
+#endif
{ return reinterpret_cast<const Functor*>(&functor.func_ptr); }
template<typename Functor, typename Tag>
+#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ const Functor* get_functor_pointer(Tag, long, Functor * = 0) const
+#else
const Functor* get_functor_pointer(Tag, long) const
+#endif
{ return static_cast<const Functor*>(functor.const_obj_ptr); }
};
#define BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER \
BOOST_JOIN(get_stateless_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS)
+#ifndef BOOST_NO_VOID_RETURNS
+# define BOOST_FUNCTION_VOID_RETURN_TYPE void
+# define BOOST_FUNCTION_RETURN(X) X
+#else
+# define BOOST_FUNCTION_VOID_RETURN_TYPE ::boost::detail::function::unusable
+# define BOOST_FUNCTION_RETURN(X) X; return BOOST_FUNCTION_VOID_RETURN_TYPE ()
+#endif
+
namespace boost {
namespace detail {
namespace function {
>
struct BOOST_FUNCTION_VOID_FUNCTION_INVOKER
{
- static unusable invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA
- BOOST_FUNCTION_PARMS)
+ static BOOST_FUNCTION_VOID_RETURN_TYPE
+ invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA
+ BOOST_FUNCTION_PARMS)
{
FunctionPtr f = reinterpret_cast<FunctionPtr>(function_ptr.func_ptr);
- f(BOOST_FUNCTION_ARGS);
- return unusable();
+ BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS));
}
};
>
struct BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER
{
- static unusable invoke(any_pointer function_obj_ptr
- BOOST_FUNCTION_COMMA
- BOOST_FUNCTION_PARMS)
+ static BOOST_FUNCTION_VOID_RETURN_TYPE
+ invoke(any_pointer function_obj_ptr BOOST_FUNCTION_COMMA
+ BOOST_FUNCTION_PARMS)
{
FunctionObj* f = (FunctionObj*)(function_obj_ptr.obj_ptr);
- (*f)(BOOST_FUNCTION_ARGS);
- return unusable();
+ BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS));
}
};
>
struct BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER
{
- static unusable invoke(any_pointer BOOST_FUNCTION_COMMA
- BOOST_FUNCTION_PARMS)
+ static BOOST_FUNCTION_VOID_RETURN_TYPE
+ invoke(any_pointer BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS)
{
FunctionObj f = FunctionObj();
- f(BOOST_FUNCTION_ARGS);
- return unusable();
+ BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS));
}
};
class BOOST_FUNCTION_FUNCTION : public function_base
{
public:
- typedef typename detail::function::function_return_type<R>::type
- internal_result_type;
+#ifndef BOOST_NO_VOID_RETURNS
+ typedef R result_type;
+#else
+ typedef typename detail::function::function_return_type<R>::type
+ result_type;
+#endif // BOOST_NO_VOID_RETURNS
private:
struct clear_type {};
template<typename Args>
struct sig
{
- typedef internal_result_type type;
+ typedef result_type type;
};
#if BOOST_FUNCTION_NUM_ARGS == 1
BOOST_STATIC_CONSTANT(int, arity = BOOST_FUNCTION_NUM_ARGS);
BOOST_FUNCTION_ARG_TYPES
-#ifndef BOOST_NO_VOID_RETURNS
- typedef R result_type;
-#else
- typedef internal_result_type result_type;
-#endif // BOOST_NO_VOID_RETURNS
typedef Allocator allocator_type;
typedef BOOST_FUNCTION_FUNCTION self_type;
if (this->empty())
boost::throw_exception(bad_function_call());
- internal_result_type result = invoker(this->functor
- BOOST_FUNCTION_COMMA
- BOOST_FUNCTION_ARGS);
-
-#ifndef BOOST_NO_VOID_RETURNS
- return static_cast<result_type>(result);
-#else
- return result;
-#endif // BOOST_NO_VOID_RETURNS
+ return invoker(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
}
#else
result_type operator()(BOOST_FUNCTION_PARMS) const;
template<typename FunctionObj>
void assign_to(FunctionObj f, detail::function::function_obj_tag)
{
- if (!detail::function::has_empty_target(addressof(f))) {
+ if (!detail::function::has_empty_target(boost::addressof(f))) {
typedef
typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER<
FunctionObj,
this->functor = detail::function::make_any_pointer(this);
}
- typedef internal_result_type (*invoker_type)(detail::function::any_pointer
- BOOST_FUNCTION_COMMA
- BOOST_FUNCTION_TEMPLATE_ARGS);
+ typedef result_type (*invoker_type)(detail::function::any_pointer
+ BOOST_FUNCTION_COMMA
+ BOOST_FUNCTION_TEMPLATE_ARGS);
invoker_type invoker;
};
Allocator>
::operator()(BOOST_FUNCTION_PARMS) const
{
- if (this->empty())
- boost::throw_exception(bad_function_call());
-
- internal_result_type result = invoker(this->functor
- BOOST_FUNCTION_COMMA
- BOOST_FUNCTION_ARGS);
-
-# ifndef BOOST_NO_VOID_RETURNS
- return static_cast<result_type>(result);
-# else
- return result;
-# endif // BOOST_NO_VOID_RETURNS
- }
+ if (this->empty())
+ boost::throw_exception(bad_function_call());
+
+ return invoker(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
+ }
#endif
// Poison comparisons between boost::function objects of the same type.
#undef BOOST_FUNCTION_ARGS
#undef BOOST_FUNCTION_ARG_TYPE
#undef BOOST_FUNCTION_ARG_TYPES
+#undef BOOST_FUNCTION_VOID_RETURN_TYPE
+#undef BOOST_FUNCTION_RETURN
-// Copyright Douglas Gregor 2004. Use, modification and
-// distribution is subject to the Boost Software License, Version
-// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// Copyright Douglas Gregor 2004.
+// Copyright 2005 Peter Dimov
+
+// Use, modification and distribution is subject to
+// the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
namespace boost {
-namespace detail {
- template<typename F, typename G>
- bool function_equal_impl(const F& f, const G& g, long)
- { return f == g; }
-} // end namespace boost::function
+template<typename F, typename G>
+ bool function_equal_impl(const F& f, const G& g, long)
+ { return f == g; }
+
+// function_equal_impl needs to be unqualified to pick
+// user overloads on two-phase compilers
template<typename F, typename G>
bool function_equal(const F& f, const G& g)
- { return ::boost::detail::function_equal_impl(f, g, 0); }
+ { return function_equal_impl(f, g, 0); }
} // end namespace boost
--- /dev/null
+// Copyright David Abrahams 2003.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+#ifndef IMPLICIT_CAST_DWA200356_HPP
+# define IMPLICIT_CAST_DWA200356_HPP
+
+# include <boost/mpl/identity.hpp>
+
+namespace boost {
+
+// implementation originally suggested by C. Green in
+// http://lists.boost.org/MailArchives/boost/msg00886.php
+
+// The use of identity creates a non-deduced form, so that the
+// explicit template argument must be supplied
+template <typename T>
+inline T implicit_cast (typename mpl::identity<T>::type x) {
+ return x;
+}
+
+// incomplete return type now is here
+//template <typename T>
+//void implicit_cast (...);
+
+// Macro for when you need a constant expression (Gennaro Prota)
+#define BOOST_IMPLICIT_CAST(dst_type, expr) \
+ ( sizeof( implicit_cast<dst_type>(expr) ) \
+ , \
+ static_cast<dst_type>(expr) \
+ )
+
+} // namespace boost
+
+#endif // IMPLICIT_CAST_DWA200356_HPP
-// Copyright David Abrahams 2004. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef INDIRECT_REFERENCE_DWA200415_HPP
# define INDIRECT_REFERENCE_DWA200415_HPP
-// dereferenceable_traits provides access to the value_type and
-// reference of a Dereferenceable type.
+//
+// Copyright David Abrahams 2004. Use, modification and distribution is
+// subject to the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// typename indirect_reference<P>::type provides the type of *p.
+//
+// http://www.boost.org/libs/iterator/doc/pointee.html
+//
# include <boost/detail/is_incrementable.hpp>
# include <boost/iterator/iterator_traits.hpp>
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
- * $Id: integer_traits.hpp,v 1.25 2004/09/04 10:34:47 johnmaddock Exp $
+ * $Id: integer_traits.hpp,v 1.27.2.1 2005/08/24 15:45:17 johnmaddock Exp $
*
* Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers
*/
// These are an implementation detail and not part of the interface
#include <limits.h>
-#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && !defined(BOOST_NO_CWCHAR)
+// we need wchar.h for WCHAR_MAX/MIN but not all platforms provide it,
+// and some may have <wchar.h> but not <cwchar> ...
+#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && (!defined(BOOST_NO_CWCHAR) || defined(sun) || defined(__sun))
#include <wchar.h>
#endif
template<>
class integer_traits<wchar_t>
: public std::numeric_limits<wchar_t>,
-#if defined(WCHAR_MIN) && defined(WCHAR_MAX)
+ // Don't trust WCHAR_MIN and WCHAR_MAX with Mac OS X's native
+ // library: they are wrong!
+#if defined(WCHAR_MIN) && defined(WCHAR_MAX) && !defined(__APPLE__)
public detail::integer_traits_base<wchar_t, WCHAR_MIN, WCHAR_MAX>
#elif defined(__BORLANDC__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__BEOS__) && defined(__GNUC__))
// No WCHAR_MIN and WCHAR_MAX, whar_t is short and unsigned:
# define BOOST_ITERATOR_CONFIG_DEF
#endif
-#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
+// We enable this always now. Otherwise, the simple case in
+// libs/iterator/test/constant_iterator_arrow.cpp fails to compile
+// because the operator-> return is improperly deduced as a non-const
+// pointer.
+#if 1 || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531))
// Recall that in general, compilers without partial specialization
// end up using a proxy for operator[] when we otherwise shouldn't.
// Using reference constness gives it an extra hint that it can
// return the value_type from operator[] directly, but is not
-// strictly neccessary. Not sure how best to resolve this one.
+// strictly necessary. Not sure how best to resolve this one.
# define BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY 1
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x531)) \
- || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER))
+ || (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) && defined(_MSC_VER)) \
+ || BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
# define BOOST_NO_LVALUE_RETURN_DETECTION
# if 0 // test code
, typename mpl::if_<
is_convertible<
typename iterator_traversal<Iterator>::type
- , bidirectional_traversal_tag
+ , random_access_traversal_tag
>
- , forward_traversal_tag
+ , bidirectional_traversal_tag
, use_default
>::type
> type;
{
}
+ typedef Base base_type;
+
Base const& base() const
{ return m_iterator; }
#ifndef BOOST_ITERATOR_FACADE_23022003THW_HPP
#define BOOST_ITERATOR_FACADE_23022003THW_HPP
-#include <boost/static_assert.hpp>
-
#include <boost/iterator.hpp>
#include <boost/iterator/interoperable.hpp>
#include <boost/iterator/iterator_traits.hpp>
#include <boost/iterator/detail/facade_iterator_category.hpp>
#include <boost/iterator/detail/enable_if.hpp>
+#include <boost/implicit_cast.hpp>
+#include <boost/static_assert.hpp>
+
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_pointer.hpp>
typedef typename mpl::eval_if<
detail::iterator_writability_disabled<ValueParam,Reference>
- , add_pointer<typename add_const<value_type>::type>
+ , add_pointer<const value_type>
, add_pointer<value_type>
>::type pointer;
struct postfix_increment_result
: mpl::eval_if<
mpl::and_<
- // A proxy is only needed for readable iterators
- is_convertible<Reference,Value>
+ // A proxy is only needed for readable iterators
+ is_convertible<Reference,Value const&>
// No multipass iterator can have values that disappear
// before positions can be re-visited
static type make(Reference x)
{
- return type(&x);
+ return implicit_cast<type>(&x);
}
};
// with additional fixes and suggestions from Gennaro Prota,
// Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov,
// and other Boosters
-// when: November 2000, March 2003
+// when: November 2000, March 2003, June 2005
+#include <cstddef>
#include <string>
#include <typeinfo>
#include <boost/config.hpp>
#if defined(BOOST_NO_STRINGSTREAM) || \
defined(BOOST_NO_STD_WSTRING) || \
- defined(BOOST_NO_STD_LOCALE) || \
- defined(BOOST_NO_INTRINSIC_WCHAR_T)
+ defined(BOOST_NO_STD_LOCALE)
#define DISABLE_WIDE_CHAR_SUPPORT
#endif
{
}
bad_lexical_cast(
- const std::type_info &s,
- const std::type_info &t) :
- source(&s), target(&t)
+ const std::type_info &source_type,
+ const std::type_info &target_type) :
+ source(&source_type), target(&target_type)
{
}
const std::type_info &source_type() const
};
#ifndef DISABLE_WIDE_CHAR_SUPPORT
+#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
template<>
struct stream_char<wchar_t>
{
typedef wchar_t type;
};
+#endif
template<>
struct stream_char<wchar_t *>
template<typename Target, typename Source>
class lexical_stream
{
+ private:
+ typedef typename widest_char<
+ typename stream_char<Target>::type,
+ typename stream_char<Source>::type>::type char_type;
+
public:
lexical_stream()
{
{
return !is_pointer<InputStreamable>::value &&
stream >> output &&
- (stream >> std::ws).eof();
+ stream.get() ==
+#if defined(__GNUC__) && (__GNUC__<3) && defined(BOOST_NO_STD_WSTRING)
+// GCC 2.9x lacks std::char_traits<>::eof().
+// We use BOOST_NO_STD_WSTRING to filter out STLport and libstdc++-v3
+// configurations, which do provide std::char_traits<>::eof().
+
+ EOF;
+#else
+ std::char_traits<char_type>::eof();
+#endif
}
bool operator>>(std::string &output)
{
}
#endif
private:
- typedef typename widest_char<
- typename stream_char<Target>::type,
- typename stream_char<Source>::type>::type char_type;
-
#if defined(BOOST_NO_STRINGSTREAM)
std::strstream stream;
#elif defined(BOOST_NO_STD_LOCALE)
};
}
+ #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ // call-by-const reference version
+
+ namespace detail
+ {
+ template<class T>
+ struct array_to_pointer_decay
+ {
+ typedef T type;
+ };
+
+ template<class T, std::size_t N>
+ struct array_to_pointer_decay<T[N]>
+ {
+ typedef const T * type;
+ };
+ }
+
+ template<typename Target, typename Source>
+ Target lexical_cast(const Source &arg)
+ {
+ typedef typename detail::array_to_pointer_decay<Source>::type NewSource;
+
+ detail::lexical_stream<Target, NewSource> interpreter;
+ Target result;
+
+ if(!(interpreter << arg && interpreter >> result))
+ throw_exception(bad_lexical_cast(typeid(NewSource), typeid(Target)));
+ return result;
+ }
+
+ #else
+
+ // call-by-value fallback version (deprecated)
+
template<typename Target, typename Source>
Target lexical_cast(Source arg)
{
Target result;
if(!(interpreter << arg && interpreter >> result))
- throw_exception(bad_lexical_cast(typeid(Target), typeid(Source)));
+ throw_exception(bad_lexical_cast(typeid(Source), typeid(Target)));
return result;
}
+
+ #endif
}
-// Copyright Kevlin Henney, 2000-2003. All rights reserved.
+// Copyright Kevlin Henney, 2000-2005. All rights reserved.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
#undef DISABLE_WIDE_CHAR_SUPPORT
#endif
-
//
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
// Copyright (c) 2001 David Abrahams
+// Copyright (c) 2003-2005 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
#undef BOOST_MEM_FN_CC
#undef BOOST_MEM_FN_NAME
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl
+#define BOOST_MEM_FN_CC __cdecl
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
#undef BOOST_MEM_FN_CC
#undef BOOST_MEM_FN_NAME
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl
+#define BOOST_MEM_FN_CC __cdecl
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
#undef BOOST_MEM_FN_NAME2
#undef BOOST_MEM_FN_CC
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_MEM_FN_NAME(X) X##_cdecl
+#define BOOST_MEM_FN_NAME2(X) inner_##X##_cdecl
+#define BOOST_MEM_FN_CC __cdecl
+
+#include <boost/bind/mem_fn_vw.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_NAME2
+#undef BOOST_MEM_FN_CC
+
+#endif
+
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
#define BOOST_MEM_FN_NAME(X) X##_stdcall
#undef BOOST_MEM_FN_CC
#undef BOOST_MEM_FN_NAME
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_MEM_FN_NAME(X) X##_cdecl
+#define BOOST_MEM_FN_CC __cdecl
+
+#include <boost/bind/mem_fn_template.hpp>
+
+#undef BOOST_MEM_FN_CC
+#undef BOOST_MEM_FN_NAME
+
+#endif
+
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
#define BOOST_MEM_FN_NAME(X) X##_stdcall
#undef BOOST_MEM_FN_NAME
#undef BOOST_MEM_FN_CC
+#ifdef BOOST_MEM_FN_ENABLE_CDECL
+
+#define BOOST_MEM_FN_NAME(X) X##_cdecl
+#define BOOST_MEM_FN_CC __cdecl
+
+#include <boost/bind/mem_fn_cc.hpp>
+
+#undef BOOST_MEM_FN_NAME
+#undef BOOST_MEM_FN_CC
+
+#endif
+
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
#define BOOST_MEM_FN_NAME(X) X##_stdcall
return call(u, &u);
}
-#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__MWERKS__, < 0x3200)
R & operator()(T & t) const
{
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/boost/boost/boost/mpl/aux_/arity_spec.hpp,v $
-// $Date: 2004/10/30 06:10:35 $
-// $Revision: 1.5.2.2 $
+// $Date: 2004/11/28 02:04:02 $
+// $Revision: 1.7 $
#include <boost/mpl/int.hpp>
#include <boost/mpl/limits/arity.hpp>
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/boost/boost/boost/mpl/aux_/lambda_support.hpp,v $
-// $Date: 2004/10/30 08:21:50 $
-// $Revision: 1.11.2.1 $
+// $Date: 2004/11/28 01:37:05 $
+// $Revision: 1.12 $
#include <boost/mpl/aux_/config/lambda.hpp>
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/boost/boost/boost/mpl/aux_/msvc_eti_base.hpp,v $
-// $Date: 2004/11/10 23:38:09 $
-// $Revision: 1.6.2.1 $
+// $Date: 2004/11/28 01:37:05 $
+// $Revision: 1.7 $
#include <boost/mpl/aux_/is_msvc_eti_arg.hpp>
#include <boost/mpl/aux_/config/eti.hpp>
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/boost/boost/boost/mpl/aux_/na.hpp,v $
-// $Date: 2004/10/30 08:21:50 $
-// $Revision: 1.5.2.1 $
+// $Date: 2004/11/28 01:37:30 $
+// $Revision: 1.6 $
#include <boost/mpl/bool.hpp>
#include <boost/mpl/aux_/na_fwd.hpp>
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/boost/boost/boost/mpl/aux_/na_assert.hpp,v $
-// $Date: 2004/09/28 13:56:59 $
-// $Revision: 1.2 $
+// $Date: 2005/07/13 13:13:38 $
+// $Revision: 1.6 $
#include <boost/mpl/aux_/na.hpp>
#include <boost/mpl/aux_/config/msvc.hpp>
#include <boost/mpl/aux_/config/workaround.hpp>
-#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+#if !BOOST_WORKAROUND(_MSC_FULL_VER, <= 140050601) \
+ && !BOOST_WORKAROUND(__EDG_VERSION__, <= 243)
# include <boost/mpl/assert.hpp>
# define BOOST_MPL_AUX_ASSERT_NOT_NA(x) \
BOOST_MPL_ASSERT_NOT((boost::mpl::is_na<type>)) \
//
// See http://www.boost.org/libs/mpl for documentation.
-// $Source: /cvsroot/boost/boost/boost/mpl/aux_/Attic/na_fwd.hpp,v $
-// $Date: 2004/10/30 08:22:23 $
-// $Revision: 1.1.2.1 $
+// $Source: /cvsroot/boost/boost/boost/mpl/aux_/na_fwd.hpp,v $
+// $Date: 2004/11/28 01:37:30 $
+// $Revision: 1.2 $
#include <boost/mpl/aux_/adl_barrier.hpp>
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/boost/boost/boost/mpl/aux_/na_spec.hpp,v $
-// $Date: 2004/11/08 18:23:49 $
-// $Revision: 1.2.2.1 $
+// $Date: 2004/11/28 01:38:15 $
+// $Revision: 1.3 $
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
# include <boost/mpl/lambda_fwd.hpp>
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/boost/boost/boost/mpl/aux_/nttp_decl.hpp,v $
-// $Date: 2004/09/02 15:40:44 $
-// $Revision: 1.1 $
+// $Date: 2004/12/16 22:43:05 $
+// $Revision: 1.2 $
#include <boost/mpl/aux_/config/nttp.hpp>
#if defined(BOOST_MPL_CFG_NTTP_BUG)
-typedef int _mpl_nttp_int;
-typedef long _mpl_nttp_long;
+typedef bool _mpl_nttp_bool;
+typedef int _mpl_nttp_int;
+typedef unsigned _mpl_nttp_unsigned;
+typedef long _mpl_nttp_long;
# include <boost/preprocessor/cat.hpp>
# define BOOST_MPL_AUX_NTTP_DECL(T, x) BOOST_PP_CAT(_mpl_nttp_,T) x /**/
// http://www.boost.org/LICENSE_1_0.txt)
//
-// Preprocessed version of "boost/mpl/Attic/deque.hpp" header
+// Preprocessed version of "boost/mpl/deque.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct equal_to
+
: equal_to_impl<
typename equal_to_tag<N1>::type
, typename equal_to_tag<N2>::type
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct greater
+
: greater_impl<
typename greater_tag<N1>::type
, typename greater_tag<N2>::type
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct greater_equal
+
: greater_equal_impl<
typename greater_equal_tag<N1>::type
, typename greater_equal_tag<N2>::type
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct less
+
: less_impl<
typename less_tag<N1>::type
, typename less_tag<N2>::type
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct less_equal
+
: less_equal_impl<
typename less_equal_tag<N1>::type
, typename less_equal_tag<N2>::type
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct modulus
+
: modulus_impl<
typename modulus_tag<N1>::type
, typename modulus_tag<N2>::type
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct not_equal_to
+
: not_equal_to_impl<
typename not_equal_to_tag<N1>::type
, typename not_equal_to_tag<N2>::type
// http://www.boost.org/LICENSE_1_0.txt)
//
-// Preprocessed version of "boost/mpl/Attic/set_c.hpp" header
+// Preprocessed version of "boost/mpl/set_c.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct shift_left
+
: shift_left_impl<
typename shift_left_tag<N1>::type
, typename shift_left_tag<N2>::type
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct shift_right
+
: shift_right_impl<
typename shift_right_tag<N1>::type
, typename shift_right_tag<N2>::type
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/boost/boost/boost/mpl/aux_/value_wknd.hpp,v $
-// $Date: 2004/09/28 13:56:59 $
-// $Revision: 1.13 $
+// $Date: 2004/12/20 17:51:57 $
+// $Revision: 1.14 $
#include <boost/mpl/aux_/static_cast.hpp>
#include <boost/mpl/aux_/config/integral.hpp>
/**/
#endif
+
+namespace boost { namespace mpl { namespace aux {
+
+template< typename T > struct value_type_wknd
+{
+ typedef typename T::value_type type;
+};
+
+#if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
+template<> struct value_type_wknd<int>
+{
+ typedef int type;
+};
+#endif
+
+}}}
+
#endif // BOOST_MPL_AUX_VALUE_WKND_HPP_INCLUDED
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/boost/boost/boost/mpl/bind.hpp,v $
-// $Date: 2004/10/26 14:57:26 $
-// $Revision: 1.12.2.1 $
+// $Date: 2004/10/26 14:51:04 $
+// $Revision: 1.13 $
#if !defined(BOOST_MPL_PREPROCESSING_MODE)
# include <boost/mpl/bind_fwd.hpp>
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/boost/boost/boost/mpl/eval_if.hpp,v $
-// $Date: 2004/11/15 13:12:51 $
-// $Revision: 1.2.2.1 $
+// $Date: 2004/11/28 01:54:10 $
+// $Revision: 1.3 $
#include <boost/mpl/if.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/boost/boost/boost/mpl/has_xxx.hpp,v $
-// $Date: 2004/09/03 15:56:55 $
-// $Revision: 1.3 $
+// $Date: 2005/06/15 10:43:23 $
+// $Revision: 1.4 $
#include <boost/mpl/bool.hpp>
#include <boost/mpl/aux_/type_wrapper.hpp>
// MSVC 7.1+
+// agurt, 15/jun/05: replace overload-based SFINAE implementation with SFINAE
+// applied to partial specialization to fix some apparently random failures
+// (thanks to Daniel Wallin for researching this!)
+
+namespace boost { namespace mpl { namespace aux {
+template< typename T > struct msvc71_sfinae_helper { typedef void type; };
+}}}
+
# define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, default_) \
-template< typename T > struct BOOST_PP_CAT(trait,_wrapper_); \
-template< typename T > \
-boost::mpl::aux::yes_tag BOOST_PP_CAT(trait,_helper_)( \
- BOOST_PP_CAT(trait,_wrapper_)<T> const volatile* \
- , BOOST_PP_CAT(trait,_wrapper_)<BOOST_MSVC_TYPENAME T::name>* = 0 \
- ); \
+template< typename T, typename U = void > \
+struct BOOST_PP_CAT(trait,_impl_) \
+{ \
+ BOOST_STATIC_CONSTANT(bool, value = false); \
+ typedef boost::mpl::bool_<value> type; \
+}; \
\
-boost::mpl::aux::no_tag BOOST_PP_CAT(trait,_helper_)(...); \
+template< typename T > \
+struct BOOST_PP_CAT(trait,_impl_)< \
+ T \
+ , typename boost::mpl::aux::msvc71_sfinae_helper< typename T::name >::type \
+ > \
+{ \
+ BOOST_STATIC_CONSTANT(bool, value = true); \
+ typedef boost::mpl::bool_<value> type; \
+}; \
\
template< typename T, typename fallback_ = boost::mpl::bool_<default_> > \
struct trait \
+ : BOOST_PP_CAT(trait,_impl_)<T> \
{ \
- typedef BOOST_PP_CAT(trait,_wrapper_)<T> t_; \
- BOOST_STATIC_CONSTANT(bool, value = \
- sizeof((BOOST_PP_CAT(trait,_helper_))(static_cast<t_*>(0))) \
- == sizeof(boost::mpl::aux::yes_tag) \
- ); \
- typedef boost::mpl::bool_<value> type; \
}; \
/**/
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/boost/boost/boost/mpl/integral_c.hpp,v $
-// $Date: 2004/09/07 08:51:31 $
-// $Revision: 1.21 $
+// $Date: 2005/07/19 04:03:12 $
+// $Revision: 1.22 $
#include <boost/mpl/integral_c_fwd.hpp>
#include <boost/mpl/aux_/config/ctps.hpp>
struct integral_c<bool, C>
{
BOOST_STATIC_CONSTANT(bool, value = C);
+ typedef integral_c_tag tag;
typedef integral_c type;
+ typedef bool value_type;
operator bool() const { return this->value; }
};
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
--- /dev/null
+
+#ifndef BOOST_MPL_INTEGRAL_C_FWD_HPP_INCLUDED
+#define BOOST_MPL_INTEGRAL_C_FWD_HPP_INCLUDED
+
+// Copyright Aleksey Gurtovoy 2000-2004
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/mpl for documentation.
+
+// $Source: /cvsroot/boost/boost/boost/mpl/integral_c_fwd.hpp,v $
+// $Date: 2004/09/28 13:56:58 $
+// $Revision: 1.4 $
+
+#include <boost/mpl/aux_/config/workaround.hpp>
+#include <boost/mpl/aux_/adl_barrier.hpp>
+
+BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
+
+#if BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800))
+// the type of non-type template arguments may not depend on template arguments
+template< typename T, long N > struct integral_c;
+#else
+template< typename T, T N > struct integral_c;
+#endif
+
+BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
+BOOST_MPL_AUX_ADL_BARRIER_DECL(integral_c)
+
+#endif // BOOST_MPL_INTEGRAL_C_FWD_HPP_INCLUDED
multi_array(const multi_array& rhs) :
super_type(rhs), allocator_(rhs.allocator_) {
allocate_space();
- boost::copy_n(rhs.base_,rhs.num_elements(),base_);
+ boost::detail::multi_array::copy_n(rhs.base_,rhs.num_elements(),base_);
}
#include "boost/iterator.hpp"
namespace boost {
-
+namespace detail {
+namespace multi_array {
//--------------------------------------------------
// copy_n (not part of the C++ standard)
#if 1
}
#endif // 1
-
+} // namespace multi_array
+} // namespace detail
} // namespace boost
#endif // BOOST_ALGORITHM_RG071801_HPP
array_iterator() {}
- array_iterator(int idx, TPtr base, const size_type* extents,
+ array_iterator(index idx, TPtr base, const size_type* extents,
const index* strides,
const index* index_base) :
idx_(idx), base_(base), extents_(extents),
void reindex(const BaseList& values) {
boost::function_requires<
detail::multi_array::CollectionConcept<BaseList> >();
- boost::copy_n(values.begin(),num_dimensions(),index_base_list_.begin());
+ boost::detail::multi_array::
+ copy_n(values.begin(),num_dimensions(),index_base_list_.begin());
origin_offset_ =
this->calculate_origin_offset(stride_list_,extent_list_,
storage_,index_base_list_);
}
const_iterator end() const {
- return const_iterator(*index_bases()+*shape(),origin(),
+ return const_iterator(*index_bases()+(index)*shape(),origin(),
shape(),strides(),index_bases());
}
// If index_bases or extents is null, then initialize the corresponding
// private data to zeroed lists.
if(index_bases) {
- boost::copy_n(index_bases,NumDims,index_base_list_.begin());
+ boost::detail::multi_array::
+ copy_n(index_bases,NumDims,index_base_list_.begin());
} else {
std::fill_n(index_base_list_.begin(),NumDims,0);
}
void init_multi_array_ref(InputIterator extents_iter) {
boost::function_requires<InputIteratorConcept<InputIterator> >();
- boost::copy_n(extents_iter,num_dimensions(),extent_list_.begin());
+ boost::detail::multi_array::
+ copy_n(extents_iter,num_dimensions(),extent_list_.begin());
// Calculate the array size
num_elements_ = std::accumulate(extent_list_.begin(),extent_list_.end(),
- 1,std::multiplies<index>());
+ size_type(1),std::multiplies<size_type>());
this->compute_strides(stride_list_,extent_list_,storage_);
}
iterator end() {
- return iterator(*this->index_bases()+*this->shape(),origin(),
+ return iterator(*this->index_bases()+(index)*this->shape(),origin(),
this->shape(),this->strides(),
this->index_bases());
}
template <typename OrderingIter, typename AscendingIter>
general_storage_order(OrderingIter ordering,
AscendingIter ascending) {
- boost::copy_n(ordering,NumDims,ordering_.begin());
- boost::copy_n(ascending,NumDims,ascending_.begin());
+ boost::detail::multi_array::copy_n(ordering,NumDims,ordering_.begin());
+ boost::detail::multi_array::copy_n(ascending,NumDims,ascending_.begin());
}
// RG - ideally these would not be necessary, but some compilers
}
const_iterator end() const {
- return const_iterator(*index_bases()+*shape(),origin(),
+ return const_iterator(*index_bases()+(index)*shape(),origin(),
shape(),strides(),index_bases());
}
}
iterator end() {
- return iterator(*this->index_bases()+*this->shape(),origin(),
+ return iterator(*this->index_bases()+(index)*this->shape(),origin(),
this->shape(),this->strides(),this->index_bases());
}
template <class BaseList>
void reindex(const BaseList& values) {
- boost::copy_n(values.begin(),num_dimensions(),index_base_list_.begin());
+ boost::detail::multi_array::
+ copy_n(values.begin(),num_dimensions(),index_base_list_.begin());
origin_offset_ =
this->calculate_indexing_offset(stride_list_,index_base_list_);
}
}
const_iterator end() const {
- return const_iterator(*index_bases()+*shape(),origin(),
+ return const_iterator(*index_bases()+(index)*shape(),origin(),
shape(),strides(),index_bases());
}
index_base_list_.assign(0);
// Get the extents and strides
- boost::copy_n(extents.begin(),NumDims,extent_list_.begin());
- boost::copy_n(strides.begin(),NumDims,stride_list_.begin());
+ boost::detail::multi_array::
+ copy_n(extents.begin(),NumDims,extent_list_.begin());
+ boost::detail::multi_array::
+ copy_n(strides.begin(),NumDims,stride_list_.begin());
// Calculate the array size
num_elements_ = std::accumulate(extent_list_.begin(),extent_list_.end(),
}
iterator end() {
- return iterator(*this->index_bases()+*this->shape(),origin(),
+ return iterator(*this->index_bases()+(index)*this->shape(),origin(),
this->shape(),this->strides(),
this->index_bases());
}
--- /dev/null
+// Copyright (C) 2003, Fernando Luis Cacciola Carballal.
+//
+// Use, modification, and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/lib/optional for documentation.
+//
+// You are welcome to contact the author at:
+// fernando_cacciola@hotmail.com
+//
+#ifndef BOOST_NONE_T_17SEP2003_HPP
+#define BOOST_NONE_T_17SEP2003_HPP
+
+namespace boost {
+
+namespace detail { struct none_helper{}; }
+
+typedef int detail::none_helper::*none_t ;
+
+} // namespace boost
+
+#endif
+
// Here's where we put it all together, defining the xxxx forms of the templates
// in namespace boost. We also define specializations of is_chained_base<> for
// the xxxx, xxxx1, and xxxx2 templates, importing them into boost:: as
-// neccessary.
+// necessary.
//
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
} // namespace boost
-// Import a 4-type-argument operator template into boost (if neccessary) and
+// Import a 4-type-argument operator template into boost (if necessary) and
// provide a specialization of 'is_chained_base<>' for it.
# define BOOST_OPERATOR_TEMPLATE4(template_name4) \
BOOST_IMPORT_TEMPLATE4(template_name4) \
typedef ::boost::detail::true_t value; \
};
-// Import a 3-type-argument operator template into boost (if neccessary) and
+// Import a 3-type-argument operator template into boost (if necessary) and
// provide a specialization of 'is_chained_base<>' for it.
# define BOOST_OPERATOR_TEMPLATE3(template_name3) \
BOOST_IMPORT_TEMPLATE3(template_name3) \
typedef ::boost::detail::true_t value; \
};
-// Import a 2-type-argument operator template into boost (if neccessary) and
+// Import a 2-type-argument operator template into boost (if necessary) and
// provide a specialization of 'is_chained_base<>' for it.
# define BOOST_OPERATOR_TEMPLATE2(template_name2) \
BOOST_IMPORT_TEMPLATE2(template_name2) \
typedef ::boost::detail::true_t value; \
};
-// Import a 1-type-argument operator template into boost (if neccessary) and
+// Import a 1-type-argument operator template into boost (if necessary) and
// provide a specialization of 'is_chained_base<>' for it.
# define BOOST_OPERATOR_TEMPLATE1(template_name1) \
BOOST_IMPORT_TEMPLATE1(template_name1) \
#include "boost/mpl/bool.hpp"
#include "boost/mpl/not.hpp"
#include "boost/detail/reference_content.hpp"
-#include "boost/detail/none_t.hpp"
+#include "boost/none_t.hpp"
#include "boost/utility/compare_pointees.hpp"
+#include "boost/optional/optional_fwd.hpp"
+
#if BOOST_WORKAROUND(BOOST_MSVC, == 1200)
// VC6.0 has the following bug:
// When a templated assignment operator exist, an implicit conversion
// Creates an optional<T> uninitialized.
// No-throw
- optional_base ( detail::none_t const& )
+ optional_base ( none_t const& )
:
m_initialized(false) {}
~optional_base() { destroy() ; }
// Assigns from another optional<T> (deep-copies the rhs value)
- // Basic Guarantee: If T::T( T const& ) throws, this is left UNINITIALIZED
void assign ( optional_base const& rhs )
+ {
+ if (is_initialized())
+ {
+ if ( rhs.is_initialized() )
+ assign_value(rhs.get_impl(), is_reference_predicate() );
+ else destroy();
+ }
+ else
{
- destroy();
if ( rhs.is_initialized() )
construct(rhs.get_impl());
}
+ }
- // Assigns from a T (deep-copies the rhs value)
- // Basic Guarantee: If T::( T const& ) throws, this is left UNINITIALIZED
- void assign ( argument_type val )
+ // Assigns from another _convertible_ optional<U> (deep-copies the rhs value)
+ template<class U>
+ void assign ( optional<U> const& rhs )
+ {
+ if (is_initialized())
{
- destroy();
- construct(val);
+ if ( rhs.is_initialized() )
+ assign_value(static_cast<value_type>(rhs.get()), is_reference_predicate() );
+ else destroy();
+ }
+ else
+ {
+ if ( rhs.is_initialized() )
+ construct(static_cast<value_type>(rhs.get()));
}
+ }
+
+ // Assigns from a T (deep-copies the rhs value)
+ void assign ( argument_type val )
+ {
+ if (is_initialized())
+ assign_value(val, is_reference_predicate() );
+ else construct(val);
+ }
// Assigns from "none", destroying the current value, if any, leaving this UNINITIALIZED
// No-throw (assuming T::~T() doesn't)
- void assign ( detail::none_t const& ) { destroy(); }
+ void assign ( none_t const& ) { destroy(); }
#ifndef BOOST_OPTIONAL_NO_INPLACE_FACTORY_SUPPORT
template<class Expr>
void assign_expr ( Expr const& expr, Expr const* tag )
{
- destroy();
- construct(expr,tag);
+ if (is_initialized())
+ assign_expr_to_initialized(expr,tag);
+ else construct(expr,tag);
}
#endif
void reset() { destroy(); }
// Replaces the current value -if any- with 'val'
- // Basic Guarantee: If T::T( T const& ) throws this is left UNINITIALIZED.
void reset ( argument_type val ) { assign(val); }
// Returns a pointer to the value if this is initialized, otherwise,
factory.apply(m_storage.address()) ;
m_initialized = true ;
}
+
+ template<class Expr>
+ void assign_expr_to_initialized ( Expr const& factory, in_place_factory_base const* tag )
+ {
+ destroy();
+ construct(factory,tag);
+ }
+
+ // Constructs in-place using the given typed factory
+ template<class Expr>
+ void assign_expr_to_initialized ( Expr const& factory, typed_in_place_factory_base const* tag )
+ {
+ destroy();
+ construct(factory,tag);
+ }
#endif
// Constructs using any expression implicitely convertible to the single argument
m_initialized = true ;
}
+ // Assigns using a form any expression implicitely convertible to the single argument
+ // of a T's assignment operator.
+ // Converting assignments of optional<T> from optional<U> uses this function with
+ // 'Expr' being of type 'U' and relying on a converting assignment of T from U.
+ template<class Expr>
+ void assign_expr_to_initialized ( Expr const& expr, void const* )
+ {
+ assign_value(expr, is_reference_predicate());
+ }
+
#ifdef BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
// BCB5.64 (and probably lower versions) workaround.
// The in-place factories are supported by means of catch-all constructors
}
#endif
+ void assign_value ( argument_type val, is_not_reference_tag ) { get_impl() = val; }
+ void assign_value ( argument_type val, is_reference_tag ) { construct(val); }
+
void destroy()
- {
- if ( m_initialized )
- destroy_impl(is_reference_predicate()) ;
- }
+ {
+ if ( m_initialized )
+ destroy_impl(is_reference_predicate()) ;
+ }
unspecified_bool_type safe_bool() const { return m_initialized ? &this_type::is_initialized : 0 ; }
// Creates an optional<T> uninitialized.
// No-throw
- optional( detail::none_t const& none_ ) : base(none_) {}
+ optional( none_t const& none_ ) : base(none_) {}
// Creates an optional<T> initialized with 'val'.
// Can throw if T::T(T const&) does
}
#endif
+
#ifndef BOOST_OPTIONAL_NO_CONVERTING_ASSIGNMENT
// Assigns from another convertible optional<U> (converts && deep-copies the rhs value)
// Requires a valid conversion from U to T.
template<class U>
optional& operator= ( optional<U> const& rhs )
{
- this->destroy(); // no-throw
-
- if ( rhs.is_initialized() )
- {
- // An exception can be thrown here.
- // It it happens, THIS will be left uninitialized.
- this->assign(rhs.get());
- }
+ this->assign(rhs);
return *this ;
}
#endif
// Assigns from a "none"
// Which destroys the current value, if any, leaving this UNINITIALIZED
// No-throw (assuming T::~T() doesn't)
- optional& operator= ( detail::none_t const& none_ )
+ optional& operator= ( none_t const& none_ )
{
this->assign( none_ ) ;
return *this ;
template<class T>
inline
-bool operator == ( optional<T> const& x, detail::none_t const& )
+bool operator == ( optional<T> const& x, none_t const& )
{ return equal_pointees(x, optional<T>() ); }
template<class T>
inline
-bool operator < ( optional<T> const& x, detail::none_t const& )
+bool operator < ( optional<T> const& x, none_t const& )
{ return less_pointees(x,optional<T>() ); }
template<class T>
inline
-bool operator != ( optional<T> const& x, detail::none_t const& y )
+bool operator != ( optional<T> const& x, none_t const& y )
{ return !( x == y ) ; }
template<class T>
inline
-bool operator > ( optional<T> const& x, detail::none_t const& y )
+bool operator > ( optional<T> const& x, none_t const& y )
{ return y < x ; }
template<class T>
inline
-bool operator <= ( optional<T> const& x, detail::none_t const& y )
+bool operator <= ( optional<T> const& x, none_t const& y )
{ return !( y < x ) ; }
template<class T>
inline
-bool operator >= ( optional<T> const& x, detail::none_t const& y )
+bool operator >= ( optional<T> const& x, none_t const& y )
{ return !( x < y ) ; }
template<class T>
inline
-bool operator == ( detail::none_t const& x, optional<T> const& y )
+bool operator == ( none_t const& x, optional<T> const& y )
{ return equal_pointees(optional<T>() ,y); }
template<class T>
inline
-bool operator < ( detail::none_t const& x, optional<T> const& y )
+bool operator < ( none_t const& x, optional<T> const& y )
{ return less_pointees(optional<T>() ,y); }
template<class T>
inline
-bool operator != ( detail::none_t const& x, optional<T> const& y )
+bool operator != ( none_t const& x, optional<T> const& y )
{ return !( x == y ) ; }
template<class T>
inline
-bool operator > ( detail::none_t const& x, optional<T> const& y )
+bool operator > ( none_t const& x, optional<T> const& y )
{ return y < x ; }
template<class T>
inline
-bool operator <= ( detail::none_t const& x, optional<T> const& y )
+bool operator <= ( none_t const& x, optional<T> const& y )
{ return !( y < x ) ; }
template<class T>
inline
-bool operator >= ( detail::none_t const& x, optional<T> const& y )
+bool operator >= ( none_t const& x, optional<T> const& y )
{ return !( x < y ) ; }
//
#endif
// optional's swap:
-// If both are initialized, calls swap(T&, T&), with whatever exception guarantess are given there.
-// If only one is initialized, calls I.reset() and U.reset(*I), with the Basic Guarantee
+// If both are initialized, calls swap(T&, T&). If this swap throws, both will remain initialized but their values are now unspecified.
+// If only one is initialized, calls U.reset(*I), THEN I.reset().
+// If U.reset(*I) throws, both are left UNCHANGED (U is kept uinitialized and I is never reset)
// If both are uninitialized, do nothing (no-throw)
template<class T>
inline
{
if ( !x && !!y )
{
- x.reset(*y); // Basic guarantee.
+ x.reset(*y);
y.reset();
}
else if ( !!x && !y )
{
- y.reset(*x); // Basic guarantee.
+ y.reset(*x);
x.reset();
}
else if ( !!x && !!y )
optional_detail::optional_swap(x,y);
}
+template<class T> inline optional<T> make_optional ( T const& v )
+{
+ return optional<T>(v);
+}
+
} // namespace boost
#endif
problem.
*/
+#include <boost/type_traits/integral_constant.hpp> // true_type and false_type
+
namespace boost {
struct ct_if_error { };
- struct true_type { enum { value = true }; };
- struct false_type { enum { value = false }; };
-
template <class A, class B>
struct ct_and { typedef false_type type; };
template <> struct ct_and<true_type,true_type> { typedef true_type type; };
-// Copyright David Abrahams 2004. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef POINTEE_DWA200415_HPP
# define POINTEE_DWA200415_HPP
-// dereferenceable_traits provides access to the value_type and
-// reference of a Dereferenceable type.
+//
+// Copyright David Abrahams 2004. Use, modification and distribution is
+// subject to the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// typename pointee<P>::type provides the pointee type of P.
+//
+// For example, it is T for T* and X for shared_ptr<X>.
+//
+// http://www.boost.org/libs/iterator/doc/pointee.html
+//
# include <boost/detail/is_incrementable.hpp>
# include <boost/iterator/iterator_traits.hpp>
#
# /* BOOST_PP_STRINGIZE */
#
-# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
-# define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_I(text)
-# else
+# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
+# define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_A((text))
+# define BOOST_PP_STRINGIZE_A(arg) BOOST_PP_STRINGIZE_B ## (arg)
+# define BOOST_PP_STRINGIZE_B(arg) BOOST_PP_STRINGIZE_I ## arg
+# elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
# define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_OO((text))
# define BOOST_PP_STRINGIZE_OO(par) BOOST_PP_STRINGIZE_I ## par
+# else
+# define BOOST_PP_STRINGIZE(text) BOOST_PP_STRINGIZE_I(text)
# endif
#
# define BOOST_PP_STRINGIZE_I(text) #text
inline safe_iterator_property_map(
RandomAccessIterator first,
- std::size_t n = 0,
+ std::size_t n_ = 0,
const IndexMap& _id = IndexMap() )
- : iter(first), n(n), index(_id) { }
+ : iter(first), n(n_), index(_id) { }
inline safe_iterator_property_map() { }
inline R operator[](key_type v) const {
assert(get(index, v) < n);
decrementable < rational<IntType>
> > > > > > > > > > > > > > > >
{
- typedef IntType int_type;
typedef typename boost::call_traits<IntType>::param_type param_type;
-
public:
+ typedef IntType int_type;
rational() : num(0), den(1) {}
rational(param_type n) : num(n), den(1) {}
rational(param_type n, param_type d) : num(n), den(d) { normalize(); }
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
* LOCATION: see http://www.boost.org/libs/regex for documentation.
* FILE regex.cpp
* VERSION see <boost/version.hpp>
- * DESCRIPTION: Declares boost::reg_expression<> and associated
+ * DESCRIPTION: Declares boost::basic_regex<> and associated
* functions and classes. This header is the main
* entry point for the template regex code.
*/
#include <boost/regex/config.hpp>
#endif
-#ifdef BOOST_REGEX_V3
-#include <boost/regex/v3/regex.hpp>
-#else
#include <boost/regex/v4/regex.hpp>
-#endif
#endif // include
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#ifndef BOOST_REGEX_CONFIG_HPP
#define BOOST_REGEX_CONFIG_HPP
/*
- Borland C++ Fix/error check
- this has to go *before* we include any std lib headers:
-*/
+ * Borland C++ Fix/error check
+ * this has to go *before* we include any std lib headers:
+ */
#if defined(__BORLANDC__)
# include <boost/regex/config/borland.hpp>
#endif
# include BOOST_REGEX_USER_CONFIG
-# include <cstdlib>
-# include <cstddef>
-# include <cstdio>
-# include <clocale>
-# include <cassert>
-# include <string>
-# include <stdexcept>
-# include <iterator>
-# include <iosfwd>
-# include <vector>
# include <boost/config.hpp>
-# include <boost/cstdint.hpp>
-# include <boost/regex/config/allocator.hpp>
-# include <boost/regex/config/cstring.hpp>
-# include <boost/throw_exception.hpp>
-# include <boost/scoped_ptr.hpp>
-# ifndef BOOST_NO_STD_LOCALE
-# include <locale>
-# endif
+
#else
/*
- * C build,
- * don't include <boost/config.hpp> because that may
- * do C++ specific things in future...
- */
+ * C build,
+ * don't include <boost/config.hpp> because that may
+ * do C++ specific things in future...
+ */
# include <stdlib.h>
# include <stddef.h>
# ifdef _MSC_VER
#endif
/*
-* If there isn't good enough wide character support then there will
-* be no wide character regular expressions:
-*/
+ * Fix for gcc prior to 3.4: std::ctype<wchar_t> doesn't allow
+ * masks to be combined, for example:
+ * std::use_facet<std::ctype<wchar_t> >.is(std::ctype_base::lower|std::ctype_base::upper, L'a');
+ * returns *false*.
+ */
+#ifdef __GLIBCPP__
+# define BOOST_REGEX_BUGGY_CTYPE_FACET
+#endif
+
+/*
+ * Intel C++ before 8.0 ends up with unresolved externals unless we turn off
+ * extern template support:
+ */
+#if defined(BOOST_INTEL) && defined(__cplusplus) && (BOOST_INTEL <= 800)
+# define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
+#endif
+
+/*
+ * If there isn't good enough wide character support then there will
+ * be no wide character regular expressions:
+ */
#if (defined(BOOST_NO_CWCHAR) || defined(BOOST_NO_CWCTYPE) || defined(BOOST_NO_STD_WSTRING))
# if !defined(BOOST_NO_WREGEX)
# define BOOST_NO_WREGEX
#else
# if defined(__sgi) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
/* STLPort on IRIX is misconfigured: <cwctype> does not compile
- * as a temporary fix include <wctype.h> instead and prevent inclusion
- * of STLPort version of <cwctype> */
+ * as a temporary fix include <wctype.h> instead and prevent inclusion
+ * of STLPort version of <cwctype> */
# include <wctype.h>
# define __STLPORT_CWCTYPE
# define _STLP_CWCTYPE
#endif
/*
-* If Win32 support has been disabled for boost in general, then
-* it is for regex in particular:
-*/
+ * If Win32 support has been disabled for boost in general, then
+ * it is for regex in particular:
+ */
#if defined(BOOST_DISABLE_WIN32) && !defined(BOOST_REGEX_NO_W32)
# define BOOST_REGEX_NO_W32
#endif
-/* some versions of gcc can't merge template instances: */
-#if defined(__CYGWIN__)
-# define BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE
-#endif
-
-/* fix problems with bool as a macro,
-* this probably doesn't affect any current compilers: */
-#if defined(bool) || defined(true) || defined(false)
-# define BOOST_REGEX_NO_BOOL
-#endif
-
-/* We don't make our templates external if the compiler
- can't handle it: */
-#if (defined(BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS) || defined(__HP_aCC) || defined(__MWERKS__) || defined(__COMO__) || defined(BOOST_INTEL))\
- && !defined(BOOST_MSVC) && !defined(__BORLANDC__)
-# define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
-#endif
-
/* disable our own file-iterators and mapfiles if we can't
- support them: */
+ * support them: */
#if !defined(BOOST_HAS_DIRENT_H) && !(defined(_WIN32) && !defined(BOOST_REGEX_NO_W32))
# define BOOST_REGEX_NO_FILEITER
#endif
-#ifdef __cplusplus
-#ifndef MB_CUR_MAX
-// yuk!
-// better make a conservative guess!
-#define MB_CUR_MAX 10
-#endif
-
-namespace boost{ namespace re_detail{
-#ifdef BOOST_NO_STD_DISTANCE
-template <class T>
-std::ptrdiff_t distance(const T& x, const T& y)
-{ return y - x; }
-#else
-using std::distance;
-#endif
-}}
-
-
-#ifdef BOOST_REGEX_NO_BOOL
-# define BOOST_REGEX_MAKE_BOOL(x) static_cast<bool>((x) ? true : false)
-#else
-# ifdef BOOST_MSVC
- // warning suppression with VC6:
-# pragma warning(disable: 4800)
-# endif
-# define BOOST_REGEX_MAKE_BOOL(x) static_cast<bool>(x)
-#endif
-#endif /* __cplusplus */
-
/* backwards compatibitity: */
#if defined(BOOST_RE_NO_LIB)
# define BOOST_REGEX_NO_LIB
#endif
#if defined(__GNUC__) && (defined(_WIN32) || defined(__CYGWIN__))
-// gcc on win32 has problems merging switch statements in templates:
-# define BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE
-// gcc on win32 has problems if you include <windows.h>
-// (sporadically generates bad code).
-# define BOOST_REGEX_USE_C_LOCALE
+/* gcc on win32 has problems if you include <windows.h>
+ (sporadically generates bad code). */
# define BOOST_REGEX_NO_W32
#endif
#if defined(__COMO__) && !defined(BOOST_REGEX_NO_W32) && !defined(_MSC_EXTENSIONS)
*
****************************************************************************/
-#ifdef __cplusplus
-#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1300) && !defined(BOOST_REGEX_V3) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
-# define BOOST_REGEX_HAS_SHORT_WCHAR_T
-namespace boost{ typedef __wchar_t regex_wchar_type; }
-#else
-namespace boost{ typedef wchar_t regex_wchar_type; }
-#endif
+/*
+ * define BOOST_REGEX_HAS_OTHER_WCHAR_T when wchar_t is a native type, but the users
+ * code may be built with wchar_t as unsigned short: basically when we're building
+ * with MSVC and the /Zc:wchar_t option we place some extra unsigned short versions
+ * of the non-inline functions in the library, so that users can still link to the lib,
+ * irrespective of whether their own code is built with /Zc:wchar_t.
+ */
+#if defined(__cplusplus) && (defined(BOOST_MSVC) || defined(__ICL)) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) && defined(BOOST_WINDOWS) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
+# define BOOST_REGEX_HAS_OTHER_WCHAR_T
+# ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable : 4251 4231 4660)
+# endif
+# ifdef _DLL
+# include <string>
+ extern template class __declspec(dllimport) std::basic_string<unsigned short>;
+# endif
+# ifdef BOOST_MSVC
+# pragma warning(pop)
+# endif
#endif
# if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
# define BOOST_DYN_LINK
# endif
-#ifdef BOOST_REGEX_DIAG
-# define BOOST_LIB_DIAGNOSTIC
-#endif
+# ifdef BOOST_REGEX_DIAG
+# define BOOST_LIB_DIAGNOSTIC
+# endif
# include <boost/config/auto_link.hpp>
#endif
#if defined(_WIN32) && !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE) && !defined(BOOST_REGEX_NO_W32)
# define BOOST_REGEX_USE_WIN32_LOCALE
#endif
-/* otherwise use C locale: */
+/* otherwise use C++ locale if supported: */
+#if !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE) && !defined(BOOST_NO_STD_LOCALE)
+# define BOOST_REGEX_USE_CPP_LOCALE
+#endif
+/* otherwise use C+ locale: */
#if !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE)
# define BOOST_REGEX_USE_C_LOCALE
#endif
-#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
-# include <windows.h>
-#endif
-
-#ifdef MAXPATH
-# define BOOST_REGEX_MAX_PATH MAXPATH
-#elif defined(MAX_PATH)
-# define BOOST_REGEX_MAX_PATH MAX_PATH
-#elif defined(FILENAME_MAX)
-# define BOOST_REGEX_MAX_PATH FILENAME_MAX
-#else
-# define BOOST_REGEX_MAX_PATH 200
-#endif
-
#ifndef BOOST_REGEX_MAX_STATE_COUNT
# define BOOST_REGEX_MAX_STATE_COUNT 100000000
#endif
#ifdef BOOST_NO_EXCEPTIONS
/*
-* If there are no exceptions then we must report critical-errors
-* the only way we know how; by terminating.
-*/
+ * If there are no exceptions then we must report critical-errors
+ * the only way we know how; by terminating.
+ */
+#include <stdexcept>
+#include <string>
+#include <boost/throw_exception.hpp>
+
# define BOOST_REGEX_NOEH_ASSERT(x)\
if(0 == (x))\
{\
}
#else
/*
-* With exceptions then error handling is taken care of and
-* there is no need for these checks:
-*/
+ * With exceptions then error handling is taken care of and
+ * there is no need for these checks:
+ */
# define BOOST_REGEX_NOEH_ASSERT(x)
#endif
-/*****************************************************************************
- *
- * Debugging / tracing support:
- *
- ****************************************************************************/
-
-#if defined(BOOST_REGEX_DEBUG) && defined(__cplusplus)
-
-# include <iostream>
-using std::cout;
-using std::cin;
-using std::cerr;
-using std::endl;
-using std::hex;
-using std::dec;
-
-# ifndef jm_assert
-# define jm_assert(x) assert(x)
-# endif
-# ifndef jm_trace
-# define jm_trace(x) cerr << x << endl;
-# endif
-# ifndef jm_instrument
-# define jm_instrument jm_trace(__FILE__<<"#"<<__LINE__)
-# endif
-
-namespace boost{
- namespace re_detail{
-class debug_guard
-{
-public:
- char g1[32];
- const char* pc;
- char* pnc;
- const char* file;
- int line;
- char g2[32];
- debug_guard(const char* f, int l, const char* p1 = 0, char* p2 = 0);
- ~debug_guard();
-};
-
-# define BOOST_RE_GUARD_STACK boost::re_detail::debug_guard sg(__FILE__, __LINE__);
-# define BOOST_RE_GUARD_GLOBAL(x) const char g1##x[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, }; char g2##x[32]; boost::debug_guard g3##x(__FILE__, __LINE__, g1##x, g2##x);
-
- } // namespace re_detail
-} // namespace boost
-
-#else
-
-# define jm_assert(x)
-# define jm_trace(x)
-# define BOOST_RE_GUARD_STACK
-# define BOOST_RE_GUARD_GLOBAL(x)
-# ifndef jm_instrument
-# define jm_instrument
-# endif
-#endif
/*****************************************************************************
*
#endif
-/*****************************************************************************
- *
- * Error handling:
- *
- ****************************************************************************/
-
-#if defined(__cplusplus)
-
-namespace boost{
-namespace re_detail{
-
-BOOST_REGEX_DECL void BOOST_REGEX_CALL raise_regex_exception(const std::string& s);
-
-template <class traits>
-void raise_error(const traits& t, unsigned code)
-{
- (void)t; // warning suppression
- raise_regex_exception(t.error_string(code));
-}
-
-}
-}
-
-#endif
-
/*****************************************************************************
*
* Algorithm selection and configuration:
****************************************************************************/
#if !defined(BOOST_REGEX_RECURSIVE) && !defined(BOOST_REGEX_NON_RECURSIVE)
-# if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && !defined(_STLP_DEBUG) && !defined(__STL_DEBUG)
+# if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && !defined(_STLP_DEBUG) && !defined(__STL_DEBUG) && !(defined(BOOST_MSVC) && (BOOST_MSVC >= 1400))
# define BOOST_REGEX_RECURSIVE
# else
# define BOOST_REGEX_NON_RECURSIVE
#endif
-/*****************************************************************************
- *
- * Fix broken compilers that wrongly #define some symbols:
- *
- ****************************************************************************/
-
-#ifdef __cplusplus
-
-// the following may be defined as macros; this is
-// incompatable with std::something syntax, we have
-// no choice but to undef them?
-
-#ifdef sprintf
-#undef sprintf
-#endif
-#ifdef swprintf
-#undef swprintf
-#endif
-#endif
-
-/*****************************************************************************
- *
- * Fix broken broken namespace support:
- *
- ****************************************************************************/
-
-#if defined(BOOST_NO_STDC_NAMESPACE) && defined(__cplusplus)
-
-namespace std{
- using ::ptrdiff_t;
- using ::size_t;
- using ::sprintf;
- using ::abs;
- using ::setlocale;
-# ifndef BOOST_NO_WREGEX
-# ifndef BOOST_NO_SWPRINTF
- using ::swprintf;
-# endif
- using ::wcstombs;
- using ::mbstowcs;
-# if !defined(BOOST_NO_STD_LOCALE) && !defined (__STL_NO_NATIVE_MBSTATE_T) && !defined(_STLP_NO_NATIVE_MBSTATE_T)
- using ::mbstate_t;
-# endif
-# endif /* BOOST_NO_WREGEX */
- using ::fseek;
- using ::fread;
- using ::ftell;
- using ::fopen;
- using ::fclose;
- using ::FILE;
-#ifdef BOOST_NO_EXCEPTIONS
- using ::fprintf;
- using ::abort;
-#endif
-}
-
-#endif
-
-/*****************************************************************************
- *
- * helper functions pointer_construct/pointer_destroy:
- *
- ****************************************************************************/
-
-#ifdef __cplusplus
-namespace boost{ namespace re_detail{
-
-#ifdef BOOST_MSVC
-#pragma warning (push)
-#pragma warning (disable : 4100)
-#endif
-
-template <class T>
-inline void pointer_destroy(T* p)
-{ p->~T(); (void)p; }
-
-#ifdef BOOST_MSVC
-#pragma warning (pop)
-#endif
-
-template <class T>
-inline void pointer_construct(T* p, const T& t)
-{ new (p) T(t); }
-
-}} // namespaces
-#endif
-
/*****************************************************************************
*
* helper memory allocation functions:
BOOST_REGEX_DECL void* BOOST_REGEX_CALL get_mem_block();
BOOST_REGEX_DECL void BOOST_REGEX_CALL put_mem_block(void*);
-}} // namespaces
+}} /* namespaces */
#endif
/*****************************************************************************
#endif
#if defined(BOOST_REGEX_DIAG)
-# pragma message ("BOOST_REGEX_DECL set as: " BOOST_STRINGIZE(BOOST_REGEX_DECL))
-# pragma message ("BOOST_REGEX_CALL set as: " BOOST_STRINGIZE(BOOST_REGEX_CALL))
-# pragma message ("BOOST_REGEX_CCALL set as: " BOOST_STRINGIZE(BOOST_REGEX_CCALL))
+# pragma message ("BOOST_REGEX_DECL" BOOST_STRINGIZE(=BOOST_REGEX_DECL))
+# pragma message ("BOOST_REGEX_CALL" BOOST_STRINGIZE(=BOOST_REGEX_CALL))
+# pragma message ("BOOST_REGEX_CCALL" BOOST_STRINGIZE(=BOOST_REGEX_CCALL))
#ifdef BOOST_REGEX_USE_C_LOCALE
# pragma message ("Using C locale in regex traits class")
#elif BOOST_REGEX_USE_CPP_LOCALE
#else
# pragma message ("Using Win32 locale in regex traits class")
#endif
-#ifdef BOOST_REGEX_DYN_LINK
+#if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
# pragma message ("Dynamic linking enabled")
#endif
-#ifdef BOOST_REGEX_NO_LIB
+#if defined(BOOST_REGEX_NO_LIB) || defined(BOOST_ALL_NO_LIB)
# pragma message ("Auto-linking disabled")
#endif
#ifdef BOOST_REGEX_NO_EXTERNAL_TEMPLATES
# pragma message ("Extern templates disabled")
#endif
-#ifdef BOOST_REGEX_V3
-# pragma message ("Using Version 3 regex code")
-#else
-# pragma message ("Using Version 4 regex code")
-#endif
#endif
+++ /dev/null
-/*
- *
- * Copyright (c) 2001
- * Dr John Maddock
- *
- * Use, modification and distribution are subject to the
- * Boost Software License, Version 1.0. (See accompanying file
- * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- *
- */
-
-#ifndef BOOST_DETAIL_ALLOCATOR_HPP
-#define BOOST_DETAIL_ALLOCATOR_HPP
-
-#include <boost/config.hpp>
-#include <cstdlib>
-#include <new>
-#include <assert.h>
-#if defined(BOOST_NO_STDC_NAMESPACE)
-namespace std{
-using ::ptrdiff_t;
-using ::size_t;
-}
-#endif
-
-// see if we have SGI alloc class:
-#if defined(BOOST_NO_STD_ALLOCATOR) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__GLIBCPP__) || defined(__STL_CONFIG_H))
-# define BOOST_HAVE_SGI_ALLOCATOR
-# include <memory>
-# if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
-namespace boost{ namespace detail{
- typedef std::__sgi_alloc alloc_type;
-}}
-# else
-namespace boost{ namespace detail{
- typedef std::alloc alloc_type;
-}}
-# endif
-#endif
-
-
-namespace boost{ namespace detail{
-
-template <class T>
-void allocator_construct(T* p, const T& t)
-{ new (p) T(t); }
-
-template <class T>
-void allocator_destroy(T* p)
-{
- (void)p; // warning suppression
- p->~T();
-}
-
-} }
-
-#if !defined(BOOST_NO_STD_ALLOCATOR)
-
-#include <memory>
-
-#define BOOST_DEFAULT_ALLOCATOR(T) std::allocator< T >
-
-namespace boost{ namespace detail{
-
-template <class T, class A>
-struct rebind_allocator
-{
- typedef typename A::template rebind<T> binder;
- typedef typename binder::other type;
-};
-
-} // namespace detail
-} // namespace boost
-
-#elif !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__SUNPRO_CC)
-
-// no std::allocator, but the compiler supports the necessary syntax,
-// write our own allocator instead:
-
-#define BOOST_DEFAULT_ALLOCATOR(T) ::boost::detail::allocator< T >
-
-namespace boost{ namespace detail{
-
-template <class T>
-class allocator
-{
-public:
-
- typedef T value_type;
- typedef value_type * pointer;
- typedef const T* const_pointer;
- typedef T& reference;
- typedef const T& const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
-
- template <class U>
- struct rebind
- {
- typedef allocator<U> other;
- };
-
- allocator(){}
-
- template <class U>
- allocator(const allocator<U>&){}
-
- allocator(const allocator&){}
-
- template <class U>
- allocator& operator=(const allocator<U>&)
- { return *this; }
-
- ~allocator(){}
-
- pointer address(reference x) { return &x; }
-
- const_pointer address(const_reference x) const { return &x; }
-
- pointer allocate(size_type n, const void* = 0)
- {
- #ifdef BOOST_HAVE_SGI_ALLOCATOR
- return n != 0 ?
- reinterpret_cast<pointer>(alloc_type::allocate(n * sizeof(value_type)))
- : 0;
- #else
- return n != 0 ?
- reinterpret_cast<pointer>(::operator new(n * sizeof(value_type)))
- : 0;
- #endif
- }
-
- void deallocate(pointer p, size_type n)
- {
- #ifdef BOOST_HAVE_SGI_ALLOCATOR
- assert( (p == 0) == (n == 0) );
- if (p != 0)
- alloc_type::deallocate((void*)p, n);
- #else
- assert( (p == 0) == (n == 0) );
- if (p != 0)
- ::operator delete((void*)p);
- #endif
- }
-
- size_type max_size() const
- { return size_t(-1) / sizeof(value_type); }
-
- void construct(pointer p, const T& val) const
- { allocator_construct(p, val); }
-
- void destroy(pointer p) const
- { allocator_destroy(p); }
-};
-
-template <class T, class A>
-struct rebind_allocator
-{
- typedef typename A::template rebind<T> binder;
- typedef typename binder::other type;
-};
-
-} // namespace detail
-} // namespace boost
-
-#else
-
-// no std::allocator, use workaround version instead,
-// each allocator class must derive from a base class
-// that allocates blocks of bytes:
-
-#define BOOST_DEFAULT_ALLOCATOR(T) ::boost::detail::allocator_adapter<T, ::boost::detail::simple_alloc>
-
-namespace boost{ namespace detail{
-
-class simple_alloc
-{
-public:
-
- typedef void value_type;
- typedef value_type * pointer;
- typedef const void* const_pointer;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
-
- simple_alloc(){}
- simple_alloc(const simple_alloc&){}
-
- ~simple_alloc(){}
-
- pointer allocate(size_type n, const void* = 0)
- {
- #ifdef BOOST_HAVE_SGI_ALLOCATOR
- return n != 0 ?
- reinterpret_cast<pointer>(alloc_type::allocate(n))
- : 0;
- #else
- return n != 0 ?
- reinterpret_cast<pointer>(::operator new(n))
- : 0;
- #endif
- }
-
- void deallocate(pointer p, size_type n)
- {
- #ifdef BOOST_HAVE_SGI_ALLOCATOR
- assert( (p == 0) == (n == 0) );
- if (p != 0)
- alloc_type::deallocate((void*)p, n);
- #else
- assert( (p == 0) == (n == 0) );
- if (p != 0)
- ::operator delete((void*)p);
- #endif
- }
-};
-
-template <class T, class Base>
-class allocator_adapter : public Base
-{
-public:
-
- typedef T value_type;
- typedef value_type * pointer;
- typedef const T* const_pointer;
- typedef T& reference;
- typedef const T& const_reference;
- typedef size_t size_type;
- typedef std::ptrdiff_t difference_type;
- typedef Base base_type;
-
- allocator_adapter(){}
- allocator_adapter(const base_type& x) : Base(x){}
- allocator_adapter& operator=(const base_type& x)
- {
- *(static_cast<base_type*>(this)) = x;
- return *this;
- }
-
- ~allocator_adapter(){}
-
- pointer address(reference x) { return &x; }
-
- const_pointer address(const_reference x) const { return &x; }
-
- pointer allocate(size_type n, const void* = 0)
- {
- return n != 0 ?
- reinterpret_cast<pointer>(base_type::allocate(n * sizeof(value_type)))
- : 0;
- }
-
- void deallocate(pointer p, size_type n)
- {
- assert( (p == 0) == (n == 0) );
- if (p != 0)
- static_cast<base_type*>(this)->deallocate((void*)p, n * sizeof(value_type));
- }
-
- size_type max_size() const
- { return size_t(-1) / sizeof(value_type); }
-
- void construct(pointer p, const T& val) const
- { allocator_construct(p, val); }
-
- void destroy(pointer p) const
- { allocator_destroy(p); }
-};
-
-template <class T, class A>
-struct rebind_allocator
-{
- typedef allocator_adapter<T, typename A::base_type> type;
-};
-
-} // namespace detail
-} // namespace boost
-
-#endif
-
-#endif // include guard
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
# endif
# endif
+#if __BORLANDC__ < 0x600
+//
+// string workarounds:
+//
+#include <cstring>
+#undef strcmp
+#undef strcpy
+#endif
+
#endif
+++ /dev/null
-/*
- *
- * Copyright (c) 1998-2002
- * Dr John Maddock
- *
- * Use, modification and distribution are subject to the
- * Boost Software License, Version 1.0. (See accompanying file
- * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- *
- */
-
- /*
- * LOCATION: see http://www.boost.org for most recent version.
- * FILE boost/regex/config/cstring.hpp
- * VERSION see <boost/version.hpp>
- * DESCRIPTION: regex narrow character string fixes.
- */
-
-#ifndef BOOST_REGEX_CONFIG_CSTRING_HPP
-#define BOOST_REGEX_CONFIG_CSTRING_HPP
-
-#include <cstring>
-#include <cctype>
-#ifndef __sgi
-#ifdef __KCC
-#include <ios>
-#endif
-#include <boost/config.hpp>
-
-namespace std{
-
-#ifdef __BORLANDC__
-#pragma option push -w-8008 -w-8066 -w-8004
-#endif
-
-#ifdef BOOST_NO_STDC_NAMESPACE
-
-// Any function that is a macro is converted into an inline function:
-#ifdef memcmp
-inline int boost_memcmp(const void * p1, const void * p2, size_t s)
-{ return memcmp(p1, p2, s); }
-#undef memcmp
-inline int memcmp(const void * p1, const void * p2, size_t s)
-{ return boost_memcmp(p1, p2, s); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::memcmp;
-#endif
-
-#ifdef memcpy
-inline void *boost_memcpy(void * p1, const void *p2, size_t s)
-{ return memcpy(p1, p2, s); }
-#undef memcpy
-inline void *memcpy(void * p1, const void *p2, size_t s)
-{ return boost_memcpy(p1, p2, s); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::memcpy;
-#endif
-
-#ifdef memmove
-inline void *(memmove)(void *, const void *, size_t)
-{ return memmove(p1,p2,s); }
-#undef memmove
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::memmove;
-#endif
-
-#ifdef memset
-inline void *(boost_memset)(void *p, int a, size_t b)
-{ return memset(p,a,b); }
-#undef memset
-inline void *(memset)(void *p, int a, size_t b)
-{ return boost_memset(p,a,b); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::memset;
-#endif
-
-#ifdef strcat
-inline char *(boost_strcat)(char *p1, const char *p2)
-{ return strcat(p1,p2); }
-#undef strcat
-inline char *(strcat)(char *p1, const char *p2)
-{ return boost_strcat(p1,p2); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::strcat;
-#endif
-
-#ifdef strcmp
-inline int (boost_strcmp)(const char *p1, const char *p2)
-{ return strcmp(p1,p2); }
-#undef strcmp
-inline int (strcmp)(const char *p1, const char *p2)
-{ return boost_strcmp(p1,p2); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::strcmp;
-#endif
-
-#ifdef strcoll
-inline int (boost_strcoll) (const char *p1, const char *p2)
-{ return strcoll(p1,p2); }
-#undef strcoll
-inline int (strcoll) (const char *p1, const char *p2)
-{ return boost_strcoll(p1,p2); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::strcoll;
-#endif
-
-#ifdef strcpy
-inline char *(boost_strcpy)(char *p1, const char *p2)
-{ return strcpy(p1,p2); }
-#undef strcpy
-inline char *(strcpy)(char *p1, const char *p2)
-{ return boost_strcpy(p1,p2); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::strcpy;
-#endif
-
-#ifdef strlen
-inline size_t (boost_strlen)(const char *p)
-{ return strlen(p); }
-#undef strlen
-inline size_t (strlen)(const char *p)
-{ return boost_strlen(p); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::strlen;
-#endif
-
-#ifdef strxfrm
-inline size_t (boost_strxfrm)(char *p1, const char *p2, size_t s)
-{ return strxfrm(p1,p2,s); }
-#undef strxfrm
-inline size_t (strxfrm)(char *p1, const char *p2, size_t s)
-{ return boost_strxfrm(p1,p2,s); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::strxfrm;
-#endif
-
-#ifdef isalnum
-inline int (boost_isalnum)(int i)
-{ return isalnum(i); }
-#undef isalnum
-inline int (isalnum)(int i)
-{ return boost_isalnum(i); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::isalnum;
-#endif
-
-#ifdef isalpha
-inline int (boost_isalpha)(int i)
-{ return isalpha(i); }
-#undef isalpha
-inline int (isalpha)(int i)
-{ return boost_isalpha(i); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::isalpha;
-#endif
-
-#ifdef iscntrl
-inline int (boost_iscntrl)(int i)
-{ return iscntrl(i); }
-#undef iscntrl
-inline int (iscntrl)(int i)
-{ return boost_iscntrl(i); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::iscntrl;
-#endif
-
-#ifdef isdigit
-inline int (boost_isdigit)(int i)
-{ return isdigit(i); }
-#undef isdigit
-inline int (isdigit)(int i)
-{ return boost_isdigit(i); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::isdigit;
-#endif
-
-#ifdef isgraph
-inline int (boost_isgraph)(int i)
-{ return isgraph(i); }
-#undef isgraph
-inline int (isgraph)(int i)
-{ return boost_isgraph(i); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::isgraph;
-#endif
-
-#ifdef islower
-inline int (boost_islower)(int i)
-{ return islower(i); }
-#undef islower
-inline int (islower)(int i)
-{ return boost_islower(i); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::islower;
-#endif
-
-#ifdef isprint
-inline int (boost_isprint)(int i)
-{ return isprint(i); }
-#undef isprint
-inline int (isprint)(int i)
-{ return boost_isprint(i); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::isprint;
-#endif
-
-#ifdef ispunct
-inline int (boost_ispunct)(int i)
-{ return ispunct(i); }
-#undef ispunct
-inline int (ispunct)(int i)
-{ return boost_ispunct(i); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::ispunct;
-#endif
-
-#ifdef isspace
-inline int (isspace)(int i)
-{ return isspace(i); }
-#undef isspace
-inline int (boost_isspace)(int i)
-{ return boost_isspace(i); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::isspace;
-#endif
-
-#ifdef isupper
-inline int (isupper)(int i)
-{ return isupper(i); }
-#undef isupper
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::isupper;
-#endif
-
-#ifdef isxdigit
-inline int (isxdigit)(int i)
-{ return isxdigit(i); }
-#undef isxdigit
-inline int (boost_isxdigit)(int i)
-{ return boost_isxdigit(i); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::isxdigit;
-#endif
-
-#ifdef tolower
-inline int (boost_tolower)(int i)
-{ return tolower(i); }
-#undef tolower
-inline int (tolower)(int i)
-{ return boost_tolower(i); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::tolower;
-#endif
-
-#ifdef toupper
-inline int (boost_toupper)(int i)
-{ return toupper(i); }
-#undef toupper
-inline int (toupper)(int i)
-{ return boost_toupper(i); }
-#elif defined(BOOST_NO_STDC_NAMESPACE)
-using ::toupper;
-#endif
-
-#else
-
-#undef memcmp
-#undef memcpy
-#undef memmove
-#undef memset
-#undef strcat
-#undef strcmp
-#undef strcoll
-#undef strcpy
-#undef strlen
-#undef strxfrm
-#undef isalnum
-#undef isalpha
-#undef iscntrl
-#undef isdigit
-#undef isgraph
-#undef islower
-#undef isprint
-#undef ispunct
-#undef isspace
-#undef isupper
-#undef isxdigit
-#undef tolower
-#undef toupper
-
-#endif
-
-
-#ifdef __BORLANDC__
-#pragma option pop
-#endif
-
-} // namespace std
-
-#endif // __sgi
-
-#endif
-
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
+++ /dev/null
-/*
- *
- * Copyright (c) 1998-2002
- * Dr John Maddock
- *
- * Use, modification and distribution are subject to the
- * Boost Software License, Version 1.0. (See accompanying file
- * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- *
- */
-
- /*
- * LOCATION: see http://www.boost.org for most recent version.
- * FILE regex_libary_include.hpp
- * VERSION see <boost/version.hpp>
- * DESCRIPTION: Automatic library inclusion for Borland/Microsoft compilers.
- * Note this is an internal header file included
- * by regex.hpp, do not include on its own.
- */
-
-/*************************************************************************
-
-Libraries for Borland and Microsoft compilers are automatically
-selected here, the name of the lib is selected according to the following
-formula:
-
-BOOST_LIB_PREFIX
- + BOOST_LIB_NAME
- + "_"
- + BOOST_LIB_TOOLSET
- + "_"
- + BOOST_LIB_THREAD_OPT
- + BOOST_LIB_RT_OPT
- + BOOST_LIB_DEBUG_OPT
-
-These are defined as:
-
-BOOST_LIB_PREFIX: "lib" for static libraries otherwise "".
-
-BOOST_LIB_NAME: The base name of the lib (boost_regex).
-
-BOOST_LIB_TOOLSET: The compiler toolset name (vc6, vc7, bcb5 etc).
-
-BOOST_LIB_THREAD_OPT: "s" for single thread builds,
- "m" for multithread builds.
-
-BOOST_LIB_RT_OPT: "s" for static runtime,
- "d" for dynamic runtime.
-
-BOOST_LIB_DEBUG_OPT: nothing for release builds,
- "d" for debug builds,
- "dd" for debug-diagnostic builds (_STLP_DEBUG).
-
-***************************************************************************/
-
-#if !defined(BOOST_REGEX_LIBRARY_INCLUDE_HPP) && !defined(BOOST_REGEX_NO_LIB)
-#define BOOST_REGEX_LIBRARY_INCLUDE_HPP
-
-#define BOOST_LIB_NAME "boost_regex"
-
-//
-// select toolset:
-//
-#if defined(BOOST_MSVC) && (BOOST_MSVC == 1200) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
-
- // vc6-stlport:
-# define BOOST_LIB_TOOLSET "vc6-stlport"
-
-#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1200)
-
- // vc6:
-# define BOOST_LIB_TOOLSET "vc6"
-
-#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
-
- // vc6-stlport:
-# define BOOST_LIB_TOOLSET "vc7-stlport"
-
-#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300)
-
- // vc7:
-# define BOOST_LIB_TOOLSET "vc7"
-
-#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1310) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
-
- // vc71-stlport:
-# define BOOST_LIB_TOOLSET "vc71-stlport"
-
-#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1310)
-
- // vc71:
-# define BOOST_LIB_TOOLSET "vc71"
-
-#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x560)
-
- // CBuilder 6:
-# define BOOST_LIB_TOOLSET "bcb6"
-
-#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
-
- // CBuilder 6:
-# define BOOST_LIB_TOOLSET "bcb5"
-
-#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x540)
-
- // CBuilder 6:
-# define BOOST_LIB_TOOLSET "bcb4"
-
-#endif
-
-//
-// select thread opt:
-//
-#if defined(_MT) || defined(__MT__)
-# define BOOST_LIB_THREAD_OPT "m"
-#else
-# define BOOST_LIB_THREAD_OPT "s"
-#endif
-
-//
-// select runtime opt:
-//
-#if defined(_DLL) || defined(_RTLDLL)
-# define BOOST_LIB_RT_OPT "d"
-#else
-# define BOOST_LIB_RT_OPT "s"
-#endif
-
-//
-// select linkage opt:
-//
-#if defined(BOOST_REGEX_STATIC_LINK) && defined(BOOST_REGEX_DYN_LINK)
-# undef BOOST_REGEX_STATIC_LINK
-#endif
-#if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_REGEX_DYN_LINK)
-# define BOOST_LIB_PREFIX
-#else
-# define BOOST_LIB_PREFIX "lib"
-#endif
-
-//
-// select debug opt:
-//
-#if defined(BOOST_MSVC) && defined(_DEBUG) && (defined(_STLP_DEBUG) || defined(__STL_DEBUG))
-# define BOOST_LIB_DEBUG_OPT "dd"
-#elif defined(BOOST_MSVC) && defined(_DEBUG)
-# define BOOST_LIB_DEBUG_OPT "d"
-#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (defined(_STLP_DEBUG) || defined(__STL_DEBUG))
-# define BOOST_LIB_DEBUG_OPT "dd"
-#else
-# define BOOST_LIB_DEBUG_OPT
-#endif
-
-//
-// now include the lib:
-//
-#if defined(BOOST_LIB_NAME) \
- && defined(BOOST_LIB_PREFIX) \
- && defined(BOOST_LIB_TOOLSET) \
- && defined(BOOST_LIB_THREAD_OPT) \
- && defined(BOOST_LIB_RT_OPT) \
- && defined(BOOST_LIB_DEBUG_OPT)
-
-# pragma comment(lib, BOOST_LIB_PREFIX BOOST_LIB_NAME "_" BOOST_LIB_TOOLSET "_" BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT BOOST_LIB_DEBUG_OPT ".lib")
-#ifdef BOOST_REGEX_DIAG
-# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_LIB_NAME "_" BOOST_LIB_TOOLSET "_" BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT BOOST_LIB_DEBUG_OPT ".lib")
-#endif
-
-#endif
-
-//
-// finally undef any macros we may have set:
-//
-#if defined(BOOST_LIB_NAME)
-# undef BOOST_LIB_NAME
-#endif
-#if defined(BOOST_LIB_TOOLSET)
-# undef BOOST_LIB_TOOLSET
-#endif
-#if defined(BOOST_LIB_THREAD_OPT)
-# undef BOOST_LIB_THREAD_OPT
-#endif
-#if defined(BOOST_LIB_RT_OPT)
-# undef BOOST_LIB_RT_OPT
-#endif
-#if defined(BOOST_LIB_LINK_OPT)
-# undef BOOST_LIB_LINK_OPT
-#endif
-#if defined(BOOST_LIB_DEBUG_OPT)
-# undef BOOST_LIB_DEBUG_OPT
-#endif
-
-
-#endif // BOOST_REGEX_LIBRARY_INCLUDE_HPP
-
-
-
-
-
-
-
-
-
-
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#include <boost/regex/config.hpp>
#endif
+#include <stdexcept>
+#include <cstddef>
+#include <boost/regex/v4/error_type.hpp>
+
namespace boost{
#ifdef BOOST_HAS_ABI_HEADERS
#pragma warning(push)
#pragma warning(disable : 4275)
#endif
-class BOOST_REGEX_DECL bad_pattern : public std::runtime_error
+ class BOOST_REGEX_DECL regex_error : public std::runtime_error
{
public:
- explicit bad_pattern(const std::string& s) : std::runtime_error(s){};
- ~bad_pattern() throw();
+ explicit regex_error(const std::string& s, regex_constants::error_type err = regex_constants::error_unknown, std::ptrdiff_t pos = 0);
+ explicit regex_error(regex_constants::error_type err);
+ ~regex_error() throw();
+ regex_constants::error_type code()const
+ { 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;
};
-#ifdef BOOST_MSVC
-#pragma warning(pop)
-#endif
-class BOOST_REGEX_DECL bad_expression : public bad_pattern
+typedef regex_error bad_pattern;
+typedef regex_error bad_expression;
+
+namespace re_detail{
+
+BOOST_REGEX_DECL void BOOST_REGEX_CALL raise_runtime_error(const std::runtime_error& ex);
+
+template <class traits>
+void raise_error(const traits& t, regex_constants::error_type code)
{
-public:
- explicit bad_expression(const std::string& s) : bad_pattern(s) {}
- ~bad_expression() throw();
-};
+ (void)t; // warning suppression
+ std::runtime_error e(t.error_string(code));
+ ::boost::re_detail::raise_runtime_error(e);
+}
+
+}
+
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
--- /dev/null
+/*
+ *
+ * Copyright (c) 2004
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE object_cache.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Implements a generic object cache.
+ */
+
+#ifndef BOOST_REGEX_OBJECT_CACHE_HPP
+#define BOOST_REGEX_OBJECT_CACHE_HPP
+
+#include <map>
+#include <list>
+#include <stdexcept>
+#include <string>
+#include <boost/config.hpp>
+#include <boost/shared_ptr.hpp>
+#ifdef BOOST_HAS_THREADS
+#include <boost/regex/pending/static_mutex.hpp>
+#endif
+
+namespace boost{
+
+template <class Key, class Object>
+class object_cache
+{
+public:
+ typedef std::pair< ::boost::shared_ptr<Object>, Key const*> value_type;
+ typedef std::list<value_type> list_type;
+ typedef typename list_type::iterator list_iterator;
+ typedef std::map<Key, list_iterator> map_type;
+ typedef typename map_type::iterator map_iterator;
+ typedef typename list_type::size_type size_type;
+ static boost::shared_ptr<Object> get(const Key& k, size_type max_cache_size);
+
+private:
+ static boost::shared_ptr<Object> do_get(const Key& k, size_type max_cache_size);
+
+ struct data
+ {
+ list_type cont;
+ map_type index;
+ };
+
+ // Needed by compilers not implementing the resolution to DR45. For reference,
+ // see http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#45.
+ friend struct data;
+};
+
+template <class Key, class Object>
+boost::shared_ptr<Object> object_cache<Key, Object>::get(const Key& k, size_type max_cache_size)
+{
+#ifdef BOOST_HAS_THREADS
+ static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT;
+
+ boost::static_mutex::scoped_lock l(mut);
+ if(l)
+ {
+ return do_get(k, max_cache_size);
+ }
+ //
+ // what do we do if the lock fails?
+ // for now just throw, but we should never really get here...
+ //
+ ::boost::throw_exception(std::runtime_error("Error in thread safety code: could not acquire a lock"));
+ return boost::shared_ptr<Object>();
+#else
+ return do_get(k, max_cache_size);
+#endif
+}
+
+template <class Key, class Object>
+boost::shared_ptr<Object> object_cache<Key, Object>::do_get(const Key& k, size_type max_cache_size)
+{
+ typedef typename object_cache<Key, Object>::data object_data;
+ typedef typename list_type::size_type list_size_type;
+ static object_data s_data;
+
+ //
+ // see if the object is already in the cache:
+ //
+ map_iterator mpos = s_data.index.find(k);
+ if(mpos != s_data.index.end())
+ {
+ //
+ // Eureka!
+ // We have a cached item, bump it up the list and return it:
+ //
+ if(--(s_data.cont.end()) != mpos->second)
+ {
+ // splice out the item we want to move:
+ list_type temp;
+ temp.splice(temp.end(), s_data.cont, mpos->second);
+ // and now place it at the end of the list:
+ s_data.cont.splice(s_data.cont.end(), temp, temp.begin());
+ BOOST_ASSERT(*(s_data.cont.back().second) == k);
+ // update index with new position:
+ mpos->second = --(s_data.cont.end());
+ BOOST_ASSERT(&(mpos->first) == mpos->second->second);
+ BOOST_ASSERT(&(mpos->first) == s_data.cont.back().second);
+ }
+ return s_data.cont.back().first;
+ }
+ //
+ // if we get here then the item is not in the cache,
+ // so create it:
+ //
+ boost::shared_ptr<Object> result(new Object(k));
+ //
+ // Add it to the list, and index it:
+ //
+ s_data.cont.push_back(value_type(result, 0));
+ s_data.index.insert(std::make_pair(k, --(s_data.cont.end())));
+ s_data.cont.back().second = &(s_data.index.find(k)->first);
+ list_size_type s = s_data.cont.size();
+ BOOST_ASSERT(s_data.index[k]->first.get() == result.get());
+ BOOST_ASSERT(&(s_data.index.find(k)->first) == s_data.cont.back().second);
+ BOOST_ASSERT(s_data.index.find(k)->first == k);
+ if(s > max_cache_size)
+ {
+ //
+ // We have too many items in the list, so we need to start
+ // popping them off the back of the list, but only if they're
+ // being held uniquely by us:
+ //
+ list_iterator pos = s_data.cont.begin();
+ list_iterator last = s_data.cont.end();
+ while((pos != last) && (s > max_cache_size))
+ {
+ if(pos->first.unique())
+ {
+ list_iterator condemmed(pos);
+ ++pos;
+ // now remove the items from our containers,
+ // then order has to be as follows:
+ BOOST_ASSERT(s_data.index.find(*(condemmed->second)) != s_data.index.end());
+ s_data.index.erase(*(condemmed->second));
+ s_data.cont.erase(condemmed);
+ --s;
+ }
+ else
+ --pos;
+ }
+ BOOST_ASSERT(s_data.index[k]->first.get() == result.get());
+ BOOST_ASSERT(&(s_data.index.find(k)->first) == s_data.cont.back().second);
+ BOOST_ASSERT(s_data.index.find(k)->first == k);
+ }
+ return result;
+}
+
+}
+
+#endif
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
# include <boost/regex/config.hpp>
#endif
-#ifdef BOOST_REGEX_V3
-# ifndef BOOST_REGEX_TRAITS_HPP_INCLUDED
-# include <boost/regex/v3/regex_traits.hpp>
-# endif
-#else
# ifndef BOOST_REGEX_TRAITS_HPP_INCLUDED
# include <boost/regex/v4/regex_traits.hpp>
# endif
-#endif
#endif // include
+++ /dev/null
-/*
- *
- * Copyright (c) 1998-2002
- * Dr John Maddock
- *
- * Use, modification and distribution are subject to the
- * Boost Software License, Version 1.0. (See accompanying file
- * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- *
- */
-
- /*
- * LOCATION: see http://www.boost.org for most recent version.
- * FILE src.cpp
- * VERSION see <boost/version.hpp>
- * DESCRIPTION: Includes all the regex source files, include this
- * file only if you need to build the regex library
- * as a single file. You must include this file
- * before any other regex header.
- *
- * CAUTION: THIS FILE IS DEPRICATED AND WILL CAUSE
- * UNNECESSARY CODE BLOAT.
- */
-
-#if (!defined(BOOST_REGEX_NO_LIB) || !defined(BOOST_REGEX_NO_EXTERNAL_TEMPLATES)) && defined(BOOST_REGEX_CONFIG_HPP)
-#error too late you have already included a regex header - make sure that you include this header before any other boost header
-#endif
-
-#define BOOST_REGEX_NO_LIB
-#define BOOST_REGEX_STATIC_LINK
-#define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
-
-#include <boost/regex.hpp>
-
-//
-// include library source files:
-//
-#ifdef BOOST_REGEX_USE_WIN32_LOCALE
-#include "libs/regex/src/w32_regex_traits.cpp"
-#elif defined(BOOST_REGEX_USE_C_LOCALE)
-#include "libs/regex/src/c_regex_traits.cpp"
-#else
-#include "libs/regex/src/cpp_regex_traits.cpp"
-#endif
-#include "libs/regex/src/c_regex_traits_common.cpp"
-#include "libs/regex/src/cregex.cpp"
-#include "libs/regex/src/fileiter.cpp"
-#include "libs/regex/src/posix_api.cpp"
-#include "libs/regex/src/wide_posix_api.cpp"
-#include "libs/regex/src/regex.cpp"
-#include "libs/regex/src/regex_debug.cpp"
-#include "libs/regex/src/regex_synch.cpp"
-
-
-
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
// cause more problems than they are worth:
// #define BOOST_REGEX_NO_FWD
-// define this if your compiler can't cope with the new
-// version 4 regex code.
-// #define BOOST_REGEX_V3
-
// define this if your compiler supports MS Windows structured
// exception handling.
// #define BOOST_REGEX_HAS_MS_STACK_GUARD
// down quite a bit).
// #define BOOST_REGEX_MATCH_EXTRA
+// define this if you want to enable support for Unicode via ICU.
+// #define BOOST_HAS_ICU
/*
*
- * Copyright (c) 1998-2002
- * Dr John Maddock
+ * Copyright (c) 1998-2004
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
* LOCATION: see http://www.boost.org for most recent version.
* FILE basic_regex.cpp
* VERSION see <boost/version.hpp>
- * DESCRIPTION: Declares template class basic_regex (note that member function
- * bodies are in regex_compile.hpp).
+ * DESCRIPTION: Declares template class basic_regex.
*/
#ifndef BOOST_REGEX_V4_BASIC_REGEX_HPP
#endif
namespace boost{
-//
-// class reg_expression
-// represents the compiled
-// regular expression:
-//
-
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable : 4251 4231 4660)
#endif
+namespace re_detail{
+
+//
+// forward declaration, we will need this one later:
+//
+template <class charT, class traits>
+class basic_regex_parser;
+
+//
+// class regex_data:
+// represents the data we wish to expose to the matching algorithms.
+//
+template <class charT, class traits>
+struct regex_data
+{
+ typedef regex_constants::syntax_option_type flag_type;
+ typedef std::size_t size_type;
+
+ regex_data(const ::boost::shared_ptr<
+ ::boost::regex_traits_wrapper<traits> >& t)
+ : m_ptraits(t), m_expression(0), m_expression_len(0) {}
+ regex_data()
+ : m_ptraits(new ::boost::regex_traits_wrapper<traits>()), m_expression(0), m_expression_len(0) {}
+
+ ::boost::shared_ptr<
+ ::boost::regex_traits_wrapper<traits>
+ > m_ptraits; // traits class instance
+ flag_type m_flags; // flags with which we were compiled
+ int m_status; // error code (0 implies OK).
+ const charT* m_expression; // the original expression
+ std::ptrdiff_t m_expression_len; // the length of the original expression
+ size_type m_mark_count; // the number of marked sub-expressions
+ re_detail::re_syntax_base* m_first_state; // the first state of the machine
+ unsigned m_restart_type; // search optimisation type
+ unsigned char m_startmap[1 << CHAR_BIT]; // which characters can start a match
+ unsigned int m_can_be_null; // whether we can match a null string
+ re_detail::raw_storage m_data; // the buffer in which our states are constructed
+};
+//
+// class basic_regex_implementation
+// pimpl implementation class for basic_regex.
+//
+template <class charT, class traits>
+class basic_regex_implementation
+ : public regex_data<charT, traits>
+{
+public:
+ typedef regex_constants::syntax_option_type flag_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef typename traits::locale_type locale_type;
+ typedef const charT* const_iterator;
+
+ basic_regex_implementation(){}
+ basic_regex_implementation(const ::boost::shared_ptr<
+ ::boost::regex_traits_wrapper<traits> >& t)
+ : regex_data<charT, traits>(t) {}
+ void assign(const charT* arg_first,
+ const charT* arg_last,
+ flag_type f)
+ {
+ regex_data<charT, traits>* pdat = this;
+ basic_regex_parser<charT, traits> parser(pdat);
+ parser.parse(arg_first, arg_last, f);
+ }
+
+ locale_type BOOST_REGEX_CALL imbue(locale_type l)
+ {
+ return this->m_ptraits->imbue(l);
+ }
+ locale_type BOOST_REGEX_CALL getloc()const
+ {
+ return this->m_ptraits->getloc();
+ }
+ std::basic_string<charT> BOOST_REGEX_CALL str()const
+ {
+ std::basic_string<charT> result;
+ if(this->m_status == 0)
+ result = std::basic_string<charT>(this->m_expression, this->m_expression_len);
+ return result;
+ }
+ const_iterator BOOST_REGEX_CALL expression()const
+ {
+ return this->m_expression;
+ }
+ //
+ // begin, end:
+ const_iterator BOOST_REGEX_CALL begin()const
+ {
+ 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);
+ }
+ flag_type BOOST_REGEX_CALL flags()const
+ {
+ return this->m_flags;
+ }
+ size_type BOOST_REGEX_CALL size()const
+ {
+ return this->m_expression_len;
+ }
+ int BOOST_REGEX_CALL status()const
+ {
+ return this->m_status;
+ }
+ size_type BOOST_REGEX_CALL mark_count()const
+ {
+ return this->m_mark_count;
+ }
+ const re_detail::re_syntax_base* get_first_state()const
+ {
+ return this->m_first_state;
+ }
+ unsigned get_restart_type()const
+ {
+ return this->m_restart_type;
+ }
+ const unsigned char* get_map()const
+ {
+ return this->m_startmap;
+ }
+ const ::boost::regex_traits_wrapper<traits>& get_traits()const
+ {
+ return *(this->m_ptraits);
+ }
+ bool can_be_null()const
+ {
+ return this->m_can_be_null;
+ }
+ const regex_data<charT, traits>& get_data()const
+ {
+ basic_regex_implementation<charT, traits> const* p = this;
+ return *static_cast<const regex_data<charT, traits>*>(p);
+ }
+};
+
+} // namespace re_detail
+//
+// class basic_regex:
+// represents the compiled
+// regular expression:
+//
+
#ifdef BOOST_REGEX_NO_FWD
-template <class charT, class traits = regex_traits<charT>, class Allocator = BOOST_DEFAULT_ALLOCATOR(charT) >
+template <class charT, class traits = regex_traits<charT> >
#else
-template <class charT, class traits, class Allocator >
+template <class charT, class traits >
#endif
-class reg_expression : public regbase
+class basic_regex : public regbase
{
public:
// typedefs:
typedef typename traits::size_type traits_size_type;
- typedef typename traits::uchar_type traits_uchar_type;
typedef typename traits::string_type traits_string_type;
typedef charT char_type;
typedef traits traits_type;
typedef const charT& const_reference;
typedef const charT* const_iterator;
typedef const_iterator iterator;
- typedef typename Allocator::difference_type difference_type;
- typedef typename Allocator::size_type size_type;
- typedef Allocator allocator_type;
- typedef Allocator alloc_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::size_t size_type;
typedef regex_constants::syntax_option_type flag_type;
// locale_type
// placeholder for actual locale type used by the
typedef typename traits::locale_type locale_type;
public:
- explicit reg_expression(const Allocator& a = Allocator());
- explicit reg_expression(const charT* p, flag_type f = regex_constants::normal, const Allocator& a = Allocator());
- reg_expression(const charT* p1, const charT* p2, flag_type f = regex_constants::normal, const Allocator& a = Allocator());
- reg_expression(const charT* p, size_type len, flag_type f, const Allocator& a = Allocator());
- reg_expression(const reg_expression&);
- ~reg_expression();
- reg_expression& BOOST_REGEX_CALL operator=(const reg_expression&);
- reg_expression& BOOST_REGEX_CALL operator=(const charT* ptr)
- {
- set_expression(ptr, regex_constants::normal | regex_constants::use_except);
- return *this;
+ explicit basic_regex(){}
+ explicit basic_regex(const charT* p, flag_type f = regex_constants::normal)
+ {
+ assign(p, f);
+ }
+ basic_regex(const charT* p1, const charT* p2, flag_type f = regex_constants::normal)
+ {
+ assign(p1, p2, f);
+ }
+ basic_regex(const charT* p, size_type len, flag_type f)
+ {
+ assign(p, len, f);
+ }
+ basic_regex(const basic_regex& that)
+ : m_pimpl(that.m_pimpl) {}
+ ~basic_regex(){}
+ basic_regex& BOOST_REGEX_CALL operator=(const basic_regex& that)
+ {
+ return assign(that);
+ }
+ basic_regex& BOOST_REGEX_CALL operator=(const charT* ptr)
+ {
+ return assign(ptr);
}
//
// assign:
- reg_expression& assign(const reg_expression& that)
- { return *this = that; }
- reg_expression& assign(const charT* ptr, flag_type f = regex_constants::normal)
+ basic_regex& assign(const basic_regex& that)
+ {
+ m_pimpl = that.m_pimpl;
+ return *this;
+ }
+ basic_regex& assign(const charT* p, flag_type f = regex_constants::normal)
{
- set_expression(ptr, f | regex_constants::use_except);
- return *this;
+ return assign(p, p + traits::length(p), f);
}
- reg_expression& assign(const charT* ptr, size_type len, flag_type f)
+ basic_regex& assign(const charT* p, size_type len, flag_type f)
{
- std::basic_string<charT> s(ptr, len);
- set_expression(s.c_str(), f | regex_constants::use_except);
- return *this;
+ return assign(p, p + len, f);
}
-
- reg_expression& assign(const charT* arg_first,
- const charT* arg_last,
+private:
+ basic_regex& do_assign(const charT* p1,
+ const charT* p2,
+ flag_type f);
+public:
+ basic_regex& assign(const charT* p1,
+ const charT* p2,
flag_type f = regex_constants::normal)
{
- set_expression(arg_first, arg_last, f | regex_constants::use_except);
- return *this;
+ return do_assign(p1, p2, f);
}
#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
template <class ST, class SA>
unsigned int BOOST_REGEX_CALL set_expression(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal)
- { return set_expression(p.data(), p.data() + p.size(), f); }
+ {
+ return set_expression(p.data(), p.data() + p.size(), f);
+ }
template <class ST, class SA>
- explicit reg_expression(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal, const Allocator& a = Allocator())
- : data(a), pkmp(0), error_code_(REG_EMPTY), _expression(0) { set_expression(p, f | regex_constants::use_except); }
+ explicit basic_regex(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal)
+ {
+ assign(p, f);
+ }
template <class InputIterator>
- reg_expression(InputIterator arg_first, InputIterator arg_last, flag_type f = regex_constants::normal, const Allocator& al = Allocator())
- : data(al), pkmp(0), error_code_(REG_EMPTY), _expression(0)
+ basic_regex(InputIterator arg_first, InputIterator arg_last, flag_type f = regex_constants::normal)
{
- std::basic_string<charT> a(arg_first, arg_last);
- set_expression(a.data(), a.data() + a.size(), f | regex_constants::use_except);
+ typedef typename traits::string_type seq_type;
+ seq_type a(arg_first, arg_last);
+ if(a.size())
+ assign(&*a.begin(), &*a.begin() + a.size(), f);
+ else
+ assign(static_cast<const charT*>(0), static_cast<const charT*>(0), f);
}
template <class ST, class SA>
- reg_expression& BOOST_REGEX_CALL operator=(const std::basic_string<charT, ST, SA>& p)
+ basic_regex& BOOST_REGEX_CALL operator=(const std::basic_string<charT, ST, SA>& p)
{
- set_expression(p.c_str(), p.c_str() + p.size(), regex_constants::normal | regex_constants::use_except);
- return *this;
+ return assign(p.data(), p.data() + p.size(), regex_constants::normal);
}
template <class string_traits, class A>
- reg_expression& BOOST_REGEX_CALL assign(
+ basic_regex& BOOST_REGEX_CALL assign(
const std::basic_string<charT, string_traits, A>& s,
flag_type f = regex_constants::normal)
{
- set_expression(s.c_str(), s.c_str() + s.size(), f | regex_constants::use_except);
- return *this;
+ return assign(s.data(), s.data() + s.size(), f);
}
template <class InputIterator>
- reg_expression& BOOST_REGEX_CALL assign(InputIterator arg_first,
+ basic_regex& BOOST_REGEX_CALL assign(InputIterator arg_first,
InputIterator arg_last,
flag_type f = regex_constants::normal)
{
- std::basic_string<charT> a(arg_first, arg_last);
- set_expression(a.data(), a.data() + a.size(), f | regex_constants::use_except);
- return *this;
+ typedef typename traits::string_type seq_type;
+ seq_type a(arg_first, arg_last);
+ if(a.size())
+ {
+ const charT* p1 = &*a.begin();
+ const charT* p2 = &*a.begin() + a.size();
+ return assign(p1, p2, f);
+ }
+ return assign(static_cast<const charT*>(0), static_cast<const charT*>(0), f);
}
#else
unsigned int BOOST_REGEX_CALL set_expression(const std::basic_string<charT>& p, flag_type f = regex_constants::normal)
- { return set_expression(p.data(), p.data() + p.size(), f | regex_constants::use_except); }
+ {
+ return set_expression(p.data(), p.data() + p.size(), f);
+ }
- reg_expression(const std::basic_string<charT>& p, flag_type f = regex_constants::normal, const Allocator& a = Allocator())
- : data(a), pkmp(0) { set_expression(p, f | regex_constants::use_except); }
+ basic_regex(const std::basic_string<charT>& p, flag_type f = regex_constants::normal)
+ {
+ assign(p, f);
+ }
- reg_expression& BOOST_REGEX_CALL operator=(const std::basic_string<charT>& p)
+ basic_regex& BOOST_REGEX_CALL operator=(const std::basic_string<charT>& p)
{
- set_expression(p.c_str(), p.c_str() + p.size(), regex_constants::normal | regex_constants::use_except);
- return *this;
+ return assign(p.data(), p.data() + p.size(), regex_constants::normal);
}
- reg_expression& BOOST_REGEX_CALL assign(
+ basic_regex& BOOST_REGEX_CALL assign(
const std::basic_string<charT>& s,
flag_type f = regex_constants::normal)
{
- set_expression(s.c_str(), s.c_str() + s.size(), f | regex_constants::use_except);
- return *this;
+ return assign(s.data(), s.data() + s.size(), f);
}
#endif
-
- //
- // allocator access:
- Allocator BOOST_REGEX_CALL get_allocator()const;
//
// locale:
- locale_type BOOST_REGEX_CALL imbue(locale_type l){ return traits_inst.imbue(l); }
- locale_type BOOST_REGEX_CALL getloc()const{ return traits_inst.getloc(); }
+ locale_type BOOST_REGEX_CALL imbue(locale_type l);
+ locale_type BOOST_REGEX_CALL getloc()const
+ {
+ return m_pimpl.get() ? m_pimpl->getloc() : locale_type();
+ }
//
// getflags:
- // retained for backwards compatibility only, the base class has "flags"
- // member which is now the prefered name:
+ // retained for backwards compatibility only, "flags"
+ // is now the prefered name:
flag_type BOOST_REGEX_CALL getflags()const
- { return this->flags(); }
+ {
+ return flags();
+ }
+ flag_type BOOST_REGEX_CALL flags()const
+ {
+ return m_pimpl.get() ? m_pimpl->flags() : 0;
+ }
//
// str:
std::basic_string<charT> BOOST_REGEX_CALL str()const
{
- std::basic_string<charT> result;
- if(this->error_code() == 0)
- result = std::basic_string<charT>(_expression, _expression_len);
- return result;
+ return m_pimpl.get() ? m_pimpl->str() : std::basic_string<charT>();
}
//
// begin, end:
const_iterator BOOST_REGEX_CALL begin()const
- { return (this->error_code() ? 0 : _expression); }
+ {
+ return (m_pimpl.get() ? m_pimpl->begin() : 0);
+ }
const_iterator BOOST_REGEX_CALL end()const
- { return (this->error_code() ? 0 : _expression + _expression_len); }
+ {
+ return (m_pimpl.get() ? m_pimpl->end() : 0);
+ }
//
// swap:
- void BOOST_REGEX_CALL swap(reg_expression&)throw();
+ void BOOST_REGEX_CALL swap(basic_regex& that)throw()
+ {
+ m_pimpl.swap(that.m_pimpl);
+ }
//
// size:
size_type BOOST_REGEX_CALL size()const
- { return (this->error_code() ? 0 : _expression_len); }
+ {
+ return (m_pimpl.get() ? m_pimpl->size() : 0);
+ }
//
// max_size:
size_type BOOST_REGEX_CALL max_size()const
- { return UINT_MAX; }
+ {
+ return UINT_MAX;
+ }
//
// empty:
bool BOOST_REGEX_CALL empty()const
- { return 0 != this->error_code(); }
-
- unsigned BOOST_REGEX_CALL mark_count()const { return (this->error_code() ? 0 : marks); }
- int BOOST_REGEX_CALL compare(const reg_expression&) const;
- bool BOOST_REGEX_CALL operator==(const reg_expression& e)const
- { return compare(e) == 0; }
- bool operator != (const reg_expression& e)
- { return compare(e) != 0; }
- bool BOOST_REGEX_CALL operator<(const reg_expression& e)const
- { return compare(e) < 0; }
- bool BOOST_REGEX_CALL operator>(const reg_expression& e)const
- { return compare(e) > 0; }
- bool BOOST_REGEX_CALL operator<=(const reg_expression& e)const
- { return compare(e) <= 0; }
- bool BOOST_REGEX_CALL operator>=(const reg_expression& e)const
- { return compare(e) >= 0; }
+ {
+ return (m_pimpl.get() ? 0 != m_pimpl->status() : true);
+ }
+
+ size_type BOOST_REGEX_CALL mark_count()const
+ {
+ return (m_pimpl.get() ? m_pimpl->mark_count() : 0);
+ }
+
+ int status()const
+ {
+ return (m_pimpl.get() ? m_pimpl->status() : regex_constants::error_empty);
+ }
+
+ int BOOST_REGEX_CALL compare(const basic_regex& that) const
+ {
+ if(m_pimpl.get() == that.m_pimpl.get())
+ return 0;
+ if(!m_pimpl.get())
+ return -1;
+ if(!that.m_pimpl.get())
+ return 1;
+ if(status() != that.status())
+ return status() - that.status();
+ if(flags() != that.flags())
+ return flags() - that.flags();
+ return str().compare(that.str());
+ }
+ bool BOOST_REGEX_CALL operator==(const basic_regex& e)const
+ {
+ return compare(e) == 0;
+ }
+ bool BOOST_REGEX_CALL operator != (const basic_regex& e)const
+ {
+ return compare(e) != 0;
+ }
+ bool BOOST_REGEX_CALL operator<(const basic_regex& e)const
+ {
+ return compare(e) < 0;
+ }
+ bool BOOST_REGEX_CALL operator>(const basic_regex& e)const
+ {
+ return compare(e) > 0;
+ }
+ bool BOOST_REGEX_CALL operator<=(const basic_regex& e)const
+ {
+ return compare(e) <= 0;
+ }
+ bool BOOST_REGEX_CALL operator>=(const basic_regex& e)const
+ {
+ return compare(e) >= 0;
+ }
//
// The following are deprecated as public interfaces
// but are available for compatibility with earlier versions.
- allocator_type BOOST_REGEX_CALL allocator()const;
- const charT* BOOST_REGEX_CALL expression()const { return (this->error_code() ? 0 : _expression); }
- unsigned int BOOST_REGEX_CALL set_expression(const charT* p, const charT* end, flag_type f = regex_constants::normal);
- unsigned int BOOST_REGEX_CALL set_expression(const charT* p, flag_type f = regex_constants::normal) { return set_expression(p, p + traits_type::length(p), f); }
- //
- // this should be private but template friends don't work:
- const traits_type& get_traits()const { return traits_inst; }
+ const charT* BOOST_REGEX_CALL expression()const
+ {
+ return (m_pimpl.get() && !m_pimpl->status() ? m_pimpl->expression() : 0);
+ }
+ unsigned int BOOST_REGEX_CALL set_expression(const charT* p1, const charT* p2, flag_type f = regex_constants::normal)
+ {
+ assign(p1, p2, f | regex_constants::no_except);
+ return status();
+ }
+ unsigned int BOOST_REGEX_CALL set_expression(const charT* p, flag_type f = regex_constants::normal)
+ {
+ assign(p, f | regex_constants::no_except);
+ return status();
+ }
unsigned int BOOST_REGEX_CALL error_code()const
{
- return error_code_;
+ return status();
+ }
+ //
+ // private access methods:
+ //
+ const re_detail::re_syntax_base* get_first_state()const
+ {
+ BOOST_ASSERT(0 != m_pimpl.get());
+ return m_pimpl->get_first_state();
+ }
+ unsigned get_restart_type()const
+ {
+ BOOST_ASSERT(0 != m_pimpl.get());
+ return m_pimpl->get_restart_type();
+ }
+ const unsigned char* get_map()const
+ {
+ BOOST_ASSERT(0 != m_pimpl.get());
+ return m_pimpl->get_map();
+ }
+ const ::boost::regex_traits_wrapper<traits>& get_traits()const
+ {
+ BOOST_ASSERT(0 != m_pimpl.get());
+ return m_pimpl->get_traits();
+ }
+ bool can_be_null()const
+ {
+ BOOST_ASSERT(0 != m_pimpl.get());
+ return m_pimpl->can_be_null();
+ }
+ const re_detail::regex_data<charT, traits>& get_data()const
+ {
+ BOOST_ASSERT(0 != m_pimpl.get());
+ return m_pimpl->get_data();
}
private:
- traits_type traits_inst; // traits class in use
- re_detail::raw_storage<Allocator> data; // our state machine
- unsigned _restart_type; // search method to use
- unsigned marks; // number of marked sub-expressions
- int repeats; // number of repeats
- unsigned char* startmap; // characters that can match the first state(s) in the machine
- std::size_t _expression_len; // length of the expression
- std::size_t _leading_len; // length of any leading literal
- const charT* _leading_string; // leading literal string
- std::size_t _leading_string_len; // and it's length
- re_detail::kmp_info<charT>* pkmp; // pointer to Knuth Morris Pratt state machine when available
- unsigned error_code_; // our current status
- charT* _expression; // the expression we just compiled if any
-
- void BOOST_REGEX_CALL compile_maps();
- void BOOST_REGEX_CALL compile_map(re_detail::re_syntax_base* node, unsigned char* _map, unsigned int* pnull, unsigned char mask, re_detail::re_syntax_base* terminal = 0)const;
- bool BOOST_REGEX_CALL probe_start(re_detail::re_syntax_base* node, charT c, re_detail::re_syntax_base* terminal)const;
- bool BOOST_REGEX_CALL probe_start_null(re_detail::re_syntax_base* node, re_detail::re_syntax_base* terminal)const;
- void BOOST_REGEX_CALL fixup_apply(re_detail::re_syntax_base* b, unsigned cbraces);
- void BOOST_REGEX_CALL move_offsets(re_detail::re_syntax_base* j, unsigned size);
- re_detail::re_syntax_base* BOOST_REGEX_CALL compile_set(const charT*& first, const charT* last);
- re_detail::re_syntax_base* BOOST_REGEX_CALL compile_set_aux(re_detail::jstack<traits_string_type, Allocator>& singles, re_detail::jstack<traits_string_type, Allocator>& ranges, re_detail::jstack<boost::uint_fast32_t, Allocator>& classes, re_detail::jstack<traits_string_type, Allocator>& equivalents, bool isnot, const re_detail::_narrow_type&);
- re_detail::re_syntax_base* BOOST_REGEX_CALL compile_set_aux(re_detail::jstack<traits_string_type, Allocator>& singles, re_detail::jstack<traits_string_type, Allocator>& ranges, re_detail::jstack<boost::uint_fast32_t, Allocator>& classes, re_detail::jstack<traits_string_type, Allocator>& equivalents, bool isnot, const re_detail::_wide_type&);
- re_detail::re_syntax_base* BOOST_REGEX_CALL compile_set_simple(re_detail::re_syntax_base* dat, unsigned long cls, bool isnot = false);
- unsigned int BOOST_REGEX_CALL parse_inner_set(const charT*& first, const charT* last);
-
- re_detail::re_syntax_base* BOOST_REGEX_CALL add_simple(re_detail::re_syntax_base* dat, re_detail::syntax_element_type type, unsigned int size = sizeof(re_detail::re_syntax_base));
- re_detail::re_syntax_base* BOOST_REGEX_CALL add_literal(re_detail::re_syntax_base* dat, charT c);
- charT BOOST_REGEX_CALL parse_escape(const charT*& first, const charT* last);
- void BOOST_REGEX_CALL parse_range(const charT*& first, const charT* last, unsigned& min, unsigned& max);
- bool BOOST_REGEX_CALL skip_space(const charT*& first, const charT* last);
- unsigned int BOOST_REGEX_CALL probe_restart(re_detail::re_syntax_base* dat);
- unsigned int BOOST_REGEX_CALL fixup_leading_rep(re_detail::re_syntax_base* dat, re_detail::re_syntax_base* end);
- void BOOST_REGEX_CALL fail(unsigned int err);
-
-protected:
- static int BOOST_REGEX_CALL repeat_count(const reg_expression& e)
- { return e.repeats; }
- static unsigned int BOOST_REGEX_CALL restart_type(const reg_expression& e)
- { return e._restart_type; }
- static const re_detail::re_syntax_base* BOOST_REGEX_CALL first(const reg_expression& e)
- { return (const re_detail::re_syntax_base*)e.data.data(); }
- static const unsigned char* BOOST_REGEX_CALL get_map(const reg_expression& e)
- { return e.startmap; }
- static std::size_t BOOST_REGEX_CALL leading_length(const reg_expression& e)
- { return e._leading_len; }
- static const re_detail::kmp_info<charT>* get_kmp(const reg_expression& e)
- { return e.pkmp; }
- static bool BOOST_REGEX_CALL can_start(charT c, const unsigned char* _map, unsigned char mask, const re_detail::_wide_type&);
- static bool BOOST_REGEX_CALL can_start(charT c, const unsigned char* _map, unsigned char mask, const re_detail::_narrow_type&);
+ shared_ptr<re_detail::basic_regex_implementation<charT, traits> > m_pimpl;
};
-template <class charT, class traits, class Allocator >
-void swap(reg_expression<charT, traits, Allocator>& a, reg_expression<charT, traits, Allocator>& b)
+//
+// out of line members;
+// these are the only members that mutate the basic_regex object,
+// and are designed to provide the strong exception guarentee
+// (in the event of a throw, the state of the object remains unchanged).
+//
+template <class charT, class traits>
+basic_regex<charT, traits>& basic_regex<charT, traits>::do_assign(const charT* p1,
+ const charT* p2,
+ flag_type f)
+{
+ shared_ptr<re_detail::basic_regex_implementation<charT, traits> > temp;
+ if(!m_pimpl.get())
+ {
+ temp = shared_ptr<re_detail::basic_regex_implementation<charT, traits> >(new re_detail::basic_regex_implementation<charT, traits>());
+ }
+ else
+ {
+ temp = shared_ptr<re_detail::basic_regex_implementation<charT, traits> >(new re_detail::basic_regex_implementation<charT, traits>(m_pimpl->m_ptraits));
+ }
+ temp->assign(p1, p2, f);
+ temp.swap(m_pimpl);
+ return *this;
+}
+
+template <class charT, class traits>
+typename basic_regex<charT, traits>::locale_type BOOST_REGEX_CALL basic_regex<charT, traits>::imbue(locale_type l)
+{
+ shared_ptr<re_detail::basic_regex_implementation<charT, traits> > temp(new re_detail::basic_regex_implementation<charT, traits>());
+ locale_type result = temp->imbue(l);
+ temp.swap(m_pimpl);
+ return result;
+}
+
+//
+// non-members:
+//
+template <class charT, class traits>
+void swap(basic_regex<charT, traits>& e1, basic_regex<charT, traits>& e2)
{
- a.swap(b);
+ e1.swap(e2);
}
#ifndef BOOST_NO_STD_LOCALE
-template <class charT, class traits, class traits2, class Allocator>
+template <class charT, class traits, class traits2>
std::basic_ostream<charT, traits>&
operator << (std::basic_ostream<charT, traits>& os,
- const reg_expression<charT, traits2, Allocator>& e)
+ const basic_regex<charT, traits2>& e)
{
return (os << e.str());
}
#else
-template <class traits, class Allocator>
-std::ostream& operator << (std::ostream& os, const reg_expression<char, traits, Allocator>& e)
+template <class traits>
+std::ostream& operator << (std::ostream& os, const basic_regex<char, traits>& e)
{
return (os << e.str());
}
#endif
//
-// We want to rename reg_expression basic_regex but maintain
-// backwards compatibility, so class basic_regex is just a thin
-// wrapper around reg_expression:
+// class reg_expression:
+// this is provided for backwards compatibility only,
+// it is deprecated, no not use!
//
#ifdef BOOST_REGEX_NO_FWD
-template <class charT, class traits = regex_traits<charT>, class Allocator = BOOST_DEFAULT_ALLOCATOR(charT) >
+template <class charT, class traits = regex_traits<charT> >
#else
-template <class charT, class traits, class Allocator >
+template <class charT, class traits >
#endif
-class basic_regex : public reg_expression<charT, traits, Allocator>
+class reg_expression : public basic_regex<charT, traits>
{
public:
- typedef typename reg_expression<charT, traits, Allocator>::flag_type flag_type;
- typedef typename reg_expression<charT, traits, Allocator>::size_type size_type;
- explicit basic_regex(const Allocator& a = Allocator())
- : reg_expression<charT, traits, Allocator>(a){}
- explicit basic_regex(const charT* p, flag_type f = regex_constants::normal, const Allocator& a = Allocator())
- : reg_expression<charT, traits, Allocator>(p,f,a){}
- basic_regex(const charT* p1, const charT* p2, flag_type f = regex_constants::normal, const Allocator& a = Allocator())
- : reg_expression<charT, traits, Allocator>(p1,p2,f,a){}
- basic_regex(const charT* p, size_type len, flag_type f, const Allocator& a = Allocator())
- : reg_expression<charT, traits, Allocator>(p,len,f,a){}
- basic_regex(const basic_regex& that)
- : reg_expression<charT, traits, Allocator>(that){}
- ~basic_regex(){}
- basic_regex& BOOST_REGEX_CALL operator=(const basic_regex& that)
+ typedef typename basic_regex<charT, traits>::flag_type flag_type;
+ typedef typename basic_regex<charT, traits>::size_type size_type;
+ explicit reg_expression(){}
+ explicit reg_expression(const charT* p, flag_type f = regex_constants::normal)
+ : basic_regex<charT, traits>(p, f){}
+ reg_expression(const charT* p1, const charT* p2, flag_type f = regex_constants::normal)
+ : basic_regex<charT, traits>(p1, p2, f){}
+ reg_expression(const charT* p, size_type len, flag_type f)
+ : basic_regex<charT, traits>(p, len, f){}
+ reg_expression(const reg_expression& that)
+ : basic_regex<charT, traits>(that) {}
+ ~reg_expression(){}
+ reg_expression& BOOST_REGEX_CALL operator=(const reg_expression& that)
{
- this->assign(that);
- return *this;
- }
- basic_regex& BOOST_REGEX_CALL operator=(const charT* ptr)
- {
- this->assign(ptr);
- return *this;
+ return this->assign(that);
}
-#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !(defined(__IBMCPP__) && (__IBMCPP__ <= 502))
+
+#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
template <class ST, class SA>
- explicit basic_regex(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal, const Allocator& a = Allocator())
- : reg_expression<charT, traits, Allocator>(p,f,a){}
+ explicit reg_expression(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal)
+ : basic_regex<charT, traits>(p, f)
+ {
+ }
- template <class I>
- basic_regex(I arg_first, I arg_last, flag_type f = regex_constants::normal, const Allocator& al = Allocator())
- : reg_expression<charT, traits, Allocator>(arg_first, arg_last, f, al){}
+ template <class InputIterator>
+ reg_expression(InputIterator arg_first, InputIterator arg_last, flag_type f = regex_constants::normal)
+ : basic_regex<charT, traits>(arg_first, arg_last, f)
+ {
+ }
template <class ST, class SA>
- basic_regex& BOOST_REGEX_CALL operator=(const std::basic_string<charT, ST, SA>& p)
+ reg_expression& BOOST_REGEX_CALL operator=(const std::basic_string<charT, ST, SA>& p)
{
this->assign(p);
return *this;
}
#else
- basic_regex(const std::basic_string<charT>& p, flag_type f = regex_constants::normal, const Allocator& a = Allocator())
- : reg_expression<charT, traits, Allocator>(p,f,a){}
+ explicit reg_expression(const std::basic_string<charT>& p, flag_type f = regex_constants::normal)
+ : basic_regex<charT, traits>(p, f)
+ {
+ }
- basic_regex& BOOST_REGEX_CALL operator=(const std::basic_string<charT>& p)
+ reg_expression& BOOST_REGEX_CALL operator=(const std::basic_string<charT>& p)
{
this->assign(p);
return *this;
}
#endif
+
};
#ifdef BOOST_MSVC
--- /dev/null
+/*
+ *
+ * Copyright (c) 2004
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE basic_regex_creator.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares template class basic_regex_creator which fills in
+ * the data members of a regex_data object.
+ */
+
+#ifndef BOOST_REGEX_V4_BASIC_REGEX_CREATOR_HPP
+#define BOOST_REGEX_V4_BASIC_REGEX_CREATOR_HPP
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost{
+
+namespace re_detail{
+
+template <class charT>
+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)
+ {}
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+ digraph(const digraph<charT>& d) : std::pair<charT, charT>(d.first, d.second){}
+#endif
+ template <class Seq>
+ digraph(const Seq& s) : std::pair<charT, charT>()
+ {
+ BOOST_ASSERT(s.size() <= 2);
+ BOOST_ASSERT(s.size());
+ this->first = s[0];
+ this->second = (s.size() > 1) ? s[1] : 0;
+ }
+};
+
+template <class charT, class traits>
+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;
+
+ basic_char_set()
+ {
+ m_negate = false;
+ m_has_digraphs = false;
+ m_classes = 0;
+ m_negated_classes = 0;
+ m_empty = true;
+ }
+
+ void add_single(const digraph_type& s)
+ {
+ m_singles.insert(m_singles.end(), s);
+ if(s.second)
+ m_has_digraphs = true;
+ m_empty = false;
+ }
+ void add_range(const digraph_type& first, const digraph_type& end)
+ {
+ m_ranges.insert(m_ranges.end(), first);
+ m_ranges.insert(m_ranges.end(), end);
+ if(first.second)
+ {
+ m_has_digraphs = true;
+ add_single(first);
+ }
+ if(end.second)
+ {
+ m_has_digraphs = true;
+ add_single(end);
+ }
+ m_empty = false;
+ }
+ void add_class(mask_type m)
+ {
+ m_classes |= m;
+ m_empty = false;
+ }
+ void add_negated_class(mask_type m)
+ {
+ m_negated_classes |= m;
+ m_empty = false;
+ }
+ void add_equivalent(const digraph_type& s)
+ {
+ m_equivalents.insert(m_equivalents.end(), s);
+ if(s.second)
+ {
+ m_has_digraphs = true;
+ add_single(s);
+ }
+ m_empty = false;
+ }
+ void negate()
+ {
+ m_negate = true;
+ //m_empty = false;
+ }
+
+ //
+ // accessor functions:
+ //
+ bool has_digraphs()const
+ {
+ return m_has_digraphs;
+ }
+ bool is_negated()const
+ {
+ return m_negate;
+ }
+ typedef typename std::vector<digraph_type>::const_iterator list_iterator;
+ list_iterator singles_begin()const
+ {
+ return m_singles.begin();
+ }
+ list_iterator singles_end()const
+ {
+ return m_singles.end();
+ }
+ list_iterator ranges_begin()const
+ {
+ return m_ranges.begin();
+ }
+ list_iterator ranges_end()const
+ {
+ return m_ranges.end();
+ }
+ list_iterator equivalents_begin()const
+ {
+ return m_equivalents.begin();
+ }
+ list_iterator equivalents_end()const
+ {
+ return m_equivalents.end();
+ }
+ mask_type classes()const
+ {
+ return m_classes;
+ }
+ mask_type negated_classes()const
+ {
+ return m_negated_classes;
+ }
+ bool empty()const
+ {
+ return m_empty;
+ }
+private:
+ std::vector<digraph_type> m_singles; // a list of single characters to match
+ 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
+ bool m_empty; // whether we've added anything yet
+ std::vector<digraph_type> m_equivalents; // a list of equivalence classes
+};
+
+template <class charT, class traits>
+class basic_regex_creator
+{
+public:
+ basic_regex_creator(regex_data<charT, traits>* data);
+ std::ptrdiff_t getoffset(void* addr)
+ {
+ return getoffset(addr, m_pdata->m_data.data());
+ }
+ std::ptrdiff_t getoffset(const void* addr, const void* base)
+ {
+ return static_cast<const char*>(addr) - static_cast<const char*>(base);
+ }
+ re_syntax_base* getaddress(std::ptrdiff_t off)
+ {
+ return getaddress(off, m_pdata->m_data.data());
+ }
+ re_syntax_base* getaddress(std::ptrdiff_t off, void* base)
+ {
+ return static_cast<re_syntax_base*>(static_cast<void*>(static_cast<char*>(base) + off));
+ }
+ void init(unsigned flags)
+ {
+ m_pdata->m_flags = flags;
+ m_icase = flags & regex_constants::icase;
+ }
+ regbase::flag_type flags()
+ {
+ return m_pdata->m_flags;
+ }
+ void flags(regbase::flag_type f)
+ {
+ m_pdata->m_flags = f;
+ if(m_icase != static_cast<bool>(f & regbase::icase))
+ {
+ m_icase = static_cast<bool>(f & regbase::icase);
+ }
+ }
+ re_syntax_base* append_state(syntax_element_type t, std::size_t s = sizeof(re_syntax_base));
+ re_syntax_base* insert_state(std::ptrdiff_t pos, syntax_element_type t, std::size_t s = sizeof(re_syntax_base));
+ re_literal* append_literal(charT c);
+ re_syntax_base* append_set(const basic_char_set<charT, traits>& char_set);
+ re_syntax_base* append_set(const basic_char_set<charT, traits>& char_set, mpl::false_*);
+ re_syntax_base* append_set(const basic_char_set<charT, traits>& char_set, mpl::true_*);
+ void finalize(const charT* p1, const charT* p2);
+protected:
+ regex_data<charT, traits>* m_pdata; // pointer to the basic_regex_data struct we are filling in
+ const ::boost::regex_traits_wrapper<traits>&
+ m_traits; // convenience reference to traits class
+ re_syntax_base* m_last_state; // the last state we added
+ bool m_icase; // true for case insensitive matches
+ unsigned m_repeater_id; // the id of the next repeater
+ bool m_has_backrefs; // true if there are actually any backrefs
+ unsigned m_backrefs; // bitmask of permitted backrefs
+ boost::uintmax_t m_bad_repeats; // bitmask of repeats we can't deduce a startmap for;
+ typename traits::char_class_type m_word_mask; // mask used to determine if a character is a word character
+ typename traits::char_class_type m_mask_space; // mask used to determine if a character is a word character
+ typename traits::char_class_type m_lower_mask; // mask used to determine if a character is a lowercase character
+ typename traits::char_class_type m_upper_mask; // mask used to determine if a character is an uppercase character
+ typename traits::char_class_type m_alpha_mask; // mask used to determine if a character is an alphabetic character
+private:
+ basic_regex_creator& operator=(const basic_regex_creator&);
+ basic_regex_creator(const basic_regex_creator&);
+
+ void fixup_pointers(re_syntax_base* state);
+ void create_startmaps(re_syntax_base* state);
+ int calculate_backstep(re_syntax_base* state);
+ void create_startmap(re_syntax_base* state, unsigned char* l_map, unsigned int* pnull, unsigned char mask);
+ unsigned get_restart_type(re_syntax_base* state);
+ void set_all_masks(unsigned char* bits, unsigned char);
+ bool is_bad_repeat(re_syntax_base* pt);
+ void set_bad_repeat(re_syntax_base* pt);
+ syntax_element_type get_repeat_type(re_syntax_base* state);
+ void probe_leading_repeat(re_syntax_base* state);
+};
+
+template <class charT, class traits>
+basic_regex_creator<charT, traits>::basic_regex_creator(regex_data<charT, traits>* data)
+ : m_pdata(data), m_traits(*(data->m_ptraits)), m_last_state(0), m_repeater_id(0), m_has_backrefs(false), m_backrefs(0)
+{
+ m_pdata->m_data.clear();
+ m_pdata->m_status = ::boost::regex_constants::error_ok;
+ static const charT w = 'w';
+ static const charT s = 's';
+ static const charT l[5] = { 'l', 'o', 'w', 'e', 'r', };
+ static const charT u[5] = { 'u', 'p', 'p', 'e', 'r', };
+ static const charT a[5] = { 'a', 'l', 'p', 'h', 'a', };
+ m_word_mask = m_traits.lookup_classname(&w, &w +1);
+ m_mask_space = m_traits.lookup_classname(&s, &s +1);
+ m_lower_mask = m_traits.lookup_classname(l, l + 5);
+ m_upper_mask = m_traits.lookup_classname(u, u + 5);
+ m_alpha_mask = m_traits.lookup_classname(a, a + 5);
+ BOOST_ASSERT(m_word_mask != 0);
+ BOOST_ASSERT(m_mask_space != 0);
+ BOOST_ASSERT(m_lower_mask != 0);
+ BOOST_ASSERT(m_upper_mask != 0);
+ BOOST_ASSERT(m_alpha_mask != 0);
+}
+
+template <class charT, class traits>
+re_syntax_base* basic_regex_creator<charT, traits>::append_state(syntax_element_type t, std::size_t s)
+{
+ // if the state is a backref then make a note of it:
+ if(t == syntax_element_backref)
+ this->m_has_backrefs = true;
+ // append a new state, start by aligning our last one:
+ m_pdata->m_data.align();
+ // set the offset to the next state in our last one:
+ if(m_last_state)
+ m_last_state->next.i = m_pdata->m_data.size() - getoffset(m_last_state);
+ // now actually extent our data:
+ m_last_state = static_cast<re_syntax_base*>(m_pdata->m_data.extend(s));
+ // fill in boilerplate options in the new state:
+ m_last_state->next.i = 0;
+ m_last_state->type = t;
+ return m_last_state;
+}
+
+template <class charT, class traits>
+re_syntax_base* basic_regex_creator<charT, traits>::insert_state(std::ptrdiff_t pos, syntax_element_type t, std::size_t s)
+{
+ // append a new state, start by aligning our last one:
+ m_pdata->m_data.align();
+ // set the offset to the next state in our last one:
+ if(m_last_state)
+ m_last_state->next.i = m_pdata->m_data.size() - getoffset(m_last_state);
+ // remember the last state position:
+ std::ptrdiff_t off = getoffset(m_last_state) + s;
+ // now actually insert our data:
+ re_syntax_base* new_state = static_cast<re_syntax_base*>(m_pdata->m_data.insert(pos, s));
+ // fill in boilerplate options in the new state:
+ new_state->next.i = s;
+ new_state->type = t;
+ m_last_state = getaddress(off);
+ return new_state;
+}
+
+template <class charT, class traits>
+re_literal* basic_regex_creator<charT, traits>::append_literal(charT c)
+{
+ re_literal* result;
+ // start by seeing if we have an existing re_literal we can extend:
+ if((0 == m_last_state) || (m_last_state->type != syntax_element_literal))
+ {
+ // no existing re_literal, create a new one:
+ result = static_cast<re_literal*>(append_state(syntax_element_literal, sizeof(re_literal) + sizeof(charT)));
+ result->length = 1;
+ *static_cast<charT*>(static_cast<void*>(result+1)) = m_traits.translate(c, m_icase);
+ }
+ else
+ {
+ // we have an existing re_literal, extend it:
+ std::ptrdiff_t off = getoffset(m_last_state);
+ m_pdata->m_data.extend(sizeof(charT));
+ m_last_state = result = static_cast<re_literal*>(getaddress(off));
+ charT* characters = static_cast<charT*>(static_cast<void*>(result+1));
+ characters[result->length] = m_traits.translate(c, m_icase);
+ ++(result->length);
+ }
+ return result;
+}
+
+template <class charT, class traits>
+inline re_syntax_base* basic_regex_creator<charT, traits>::append_set(
+ const basic_char_set<charT, traits>& char_set)
+{
+ typedef mpl::bool_< (sizeof(charT) == 1) > truth_type;
+ return char_set.has_digraphs()
+ ? append_set(char_set, static_cast<mpl::false_*>(0))
+ : append_set(char_set, static_cast<truth_type*>(0));
+}
+
+template <class charT, class traits>
+re_syntax_base* basic_regex_creator<charT, traits>::append_set(
+ const basic_char_set<charT, traits>& char_set, mpl::false_*)
+{
+ 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;
+
+ 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>)));
+ //
+ // fill in the basics:
+ //
+ result->csingles = static_cast<unsigned int>(::boost::re_detail::distance(char_set.singles_begin(), char_set.singles_end()));
+ result->cranges = static_cast<unsigned int>(::boost::re_detail::distance(char_set.ranges_begin(), char_set.ranges_end())) / 2;
+ result->cequivalents = static_cast<unsigned int>(::boost::re_detail::distance(char_set.equivalents_begin(), char_set.equivalents_end()));
+ result->cclasses = char_set.classes();
+ result->cnclasses = char_set.negated_classes();
+ if(flags() & regbase::icase)
+ {
+ // adjust classes as needed:
+ if(((result->cclasses & m_lower_mask) == m_lower_mask) || ((result->cclasses & m_upper_mask) == m_upper_mask))
+ result->cclasses |= m_alpha_mask;
+ if(((result->cnclasses & m_lower_mask) == m_lower_mask) || ((result->cnclasses & m_upper_mask) == m_upper_mask))
+ result->cnclasses |= m_alpha_mask;
+ }
+
+ result->isnot = char_set.is_negated();
+ result->singleton = !char_set.has_digraphs();
+ //
+ // remember where the state is for later:
+ //
+ std::ptrdiff_t offset = getoffset(result);
+ //
+ // now extend with all the singles:
+ //
+ item_iterator first, last;
+ first = char_set.singles_begin();
+ last = char_set.singles_end();
+ while(first != last)
+ {
+ charT* p = static_cast<charT*>(this->m_pdata->m_data.extend(sizeof(charT) * (first->second ? 3 : 2)));
+ p[0] = m_traits.translate(first->first, m_icase);
+ if(first->second)
+ {
+ p[1] = m_traits.translate(first->second, m_icase);
+ p[2] = 0;
+ }
+ else
+ p[1] = 0;
+ ++first;
+ }
+ //
+ // now extend with all the ranges:
+ //
+ first = char_set.ranges_begin();
+ last = char_set.ranges_end();
+ while(first != last)
+ {
+ // first grab the endpoints of the range:
+ digraph<charT> c1 = *first;
+ c1.first = this->m_traits.translate(c1.first, this->m_icase);
+ c1.second = this->m_traits.translate(c1.second, this->m_icase);
+ ++first;
+ digraph<charT> c2 = *first;
+ c2.first = this->m_traits.translate(c2.first, this->m_icase);
+ c2.second = this->m_traits.translate(c2.second, this->m_icase);
+ ++first;
+ string_type s1, s2;
+ // different actions now depending upon whether collation is turned on:
+ if(flags() & regex_constants::collate)
+ {
+ // we need to transform our range into sort keys:
+#if BOOST_WORKAROUND(__GNUC__, < 3)
+ string_type in(3, charT(0));
+ in[0] = c1.first;
+ in[1] = c1.second;
+ s1 = this->m_traits.transform(in.c_str(), (in[1] ? in.c_str()+2 : in.c_str()+1));
+ in[0] = c2.first;
+ in[1] = c2.second;
+ s2 = this->m_traits.transform(in.c_str(), (in[1] ? in.c_str()+2 : in.c_str()+1));
+#else
+ charT a1[3] = { c1.first, c1.second, charT(0), };
+ charT a2[3] = { c2.first, c2.second, charT(0), };
+ s1 = this->m_traits.transform(a1, (a1[1] ? a1+2 : a1+1));
+ s2 = this->m_traits.transform(a2, (a2[1] ? a2+2 : a2+1));
+#endif
+ if(s1.size() == 0)
+ s1 = string_type(1, charT(0));
+ if(s2.size() == 0)
+ s2 = string_type(1, charT(0));
+ }
+ else
+ {
+ if(c1.second)
+ {
+ s1.insert(s1.end(), c1.first);
+ s1.insert(s1.end(), c1.second);
+ }
+ else
+ s1 = string_type(1, c1.first);
+ if(c2.second)
+ {
+ s2.insert(s2.end(), c2.first);
+ s2.insert(s2.end(), c2.second);
+ }
+ else
+ s2.insert(s2.end(), c2.first);
+ }
+ if(s1 > s2)
+ {
+ // Oops error:
+ return 0;
+ }
+ charT* p = static_cast<charT*>(this->m_pdata->m_data.extend(sizeof(charT) * (s1.size() + s2.size() + 2) ) );
+ re_detail::copy(s1.begin(), s1.end(), p);
+ p[s1.size()] = charT(0);
+ p += s1.size() + 1;
+ re_detail::copy(s2.begin(), s2.end(), p);
+ p[s2.size()] = charT(0);
+ }
+ //
+ // now process the equivalence classes:
+ //
+ first = char_set.equivalents_begin();
+ last = char_set.equivalents_end();
+ while(first != last)
+ {
+ string_type s;
+ if(first->second)
+ {
+#if BOOST_WORKAROUND(__GNUC__, < 3)
+ string_type in(3, charT(0));
+ in[0] = first->first;
+ in[1] = first->second;
+ s = m_traits.transform_primary(in.c_str(), in.c_str()+2);
+#else
+ charT cs[3] = { first->first, first->second, charT(0), };
+ s = m_traits.transform_primary(cs, cs+2);
+#endif
+ }
+ else
+ s = m_traits.transform_primary(&first->first, &first->first+1);
+ if(s.empty())
+ return 0; // invalid or unsupported equivalence class
+ charT* p = static_cast<charT*>(this->m_pdata->m_data.extend(sizeof(charT) * (s.size()+1) ) );
+ re_detail::copy(s.begin(), s.end(), p);
+ p[s.size()] = charT(0);
+ ++first;
+ }
+ //
+ // finally reset the address of our last state:
+ //
+ m_last_state = result = static_cast<re_set_long<mask_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)
+{
+ return static_cast<unsigned char>(t1) < static_cast<unsigned char>(t2);
+}
+template<>
+inline bool char_less<signed char>(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(
+ const basic_char_set<charT, traits>& char_set, mpl::true_*)
+{
+ typedef typename traits::string_type string_type;
+ typedef typename basic_char_set<charT, traits>::list_iterator item_iterator;
+
+ re_set* result = static_cast<re_set*>(append_state(syntax_element_set, sizeof(re_set)));
+ bool negate = char_set.is_negated();
+ std::memset(result->_map, 0, sizeof(result->_map));
+ //
+ // handle singles first:
+ //
+ item_iterator first, last;
+ first = char_set.singles_begin();
+ last = char_set.singles_end();
+ while(first != last)
+ {
+ for(unsigned int i = 0; i < (1 << CHAR_BIT); ++i)
+ {
+ if(this->m_traits.translate(static_cast<charT>(i), this->m_icase)
+ == this->m_traits.translate(first->first, this->m_icase))
+ result->_map[i] = true;
+ }
+ ++first;
+ }
+ //
+ // OK now handle ranges:
+ //
+ first = char_set.ranges_begin();
+ last = char_set.ranges_end();
+ while(first != last)
+ {
+ // first grab the endpoints of the range:
+ charT c1 = this->m_traits.translate(first->first, this->m_icase);
+ ++first;
+ charT c2 = this->m_traits.translate(first->first, this->m_icase);
+ ++first;
+ // different actions now depending upon whether collation is turned on:
+ if(flags() & regex_constants::collate)
+ {
+ // we need to transform our range into sort keys:
+ charT c3[2] = { c1, charT(0), };
+ string_type s1 = this->m_traits.transform(c3, c3+1);
+ c3[0] = c2;
+ string_type s2 = this->m_traits.transform(c3, c3+1);
+ if(s1 > s2)
+ {
+ // Oops error:
+ return 0;
+ }
+ for(unsigned i = 0; i < (1u << CHAR_BIT); ++i)
+ {
+ charT c3[2] = { static_cast<charT>(i), charT(0), };
+ string_type s3 = this->m_traits.transform(c3, c3 +1);
+ if((s1 <= s3) && (s3 <= s2))
+ result->_map[i] = true;
+ }
+ }
+ else
+ {
+ if(char_less<charT>(c2, c1))
+ {
+ // Oops error:
+ return 0;
+ }
+ // everything in range matches:
+ std::memset(result->_map + static_cast<unsigned char>(c1), true, 1 + static_cast<unsigned char>(c2) - static_cast<unsigned char>(c1));
+ }
+ }
+ //
+ // and now the classes:
+ //
+ typedef typename traits::char_class_type mask_type;
+ mask_type m = char_set.classes();
+ if(flags() & regbase::icase)
+ {
+ // adjust m as needed:
+ if(((m & m_lower_mask) == m_lower_mask) || ((m & m_upper_mask) == m_upper_mask))
+ m |= m_alpha_mask;
+ }
+ if(m != 0)
+ {
+ for(unsigned i = 0; i < (1u << CHAR_BIT); ++i)
+ {
+ if(this->m_traits.isctype(static_cast<charT>(i), m))
+ result->_map[i] = true;
+ }
+ }
+ //
+ // and now the negated classes:
+ //
+ m = char_set.negated_classes();
+ if(flags() & regbase::icase)
+ {
+ // adjust m as needed:
+ if(((m & m_lower_mask) == m_lower_mask) || ((m & m_upper_mask) == m_upper_mask))
+ m |= m_alpha_mask;
+ }
+ if(m != 0)
+ {
+ for(unsigned i = 0; i < (1u << CHAR_BIT); ++i)
+ {
+ if(0 == this->m_traits.isctype(static_cast<charT>(i), m))
+ result->_map[i] = true;
+ }
+ }
+ //
+ // now process the equivalence classes:
+ //
+ first = char_set.equivalents_begin();
+ last = char_set.equivalents_end();
+ while(first != last)
+ {
+ string_type s;
+ 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)
+ {
+ charT c[2] = { (static_cast<charT>(i)), charT(0), };
+ string_type s2 = this->m_traits.transform_primary(c, c+1);
+ if(s == s2)
+ result->_map[i] = true;
+ }
+ ++first;
+ }
+ if(negate)
+ {
+ for(unsigned i = 0; i < (1u << CHAR_BIT); ++i)
+ {
+ result->_map[i] = !(result->_map[i]);
+ }
+ }
+ return result;
+}
+
+template <class charT, class traits>
+void basic_regex_creator<charT, traits>::finalize(const charT* p1, const charT* p2)
+{
+ // we've added all the states we need, now finish things off.
+ // start by adding a terminating state:
+ append_state(syntax_element_match);
+ // extend storage to store original expression:
+ std::ptrdiff_t len = p2 - p1;
+ m_pdata->m_expression_len = len;
+ charT* ps = static_cast<charT*>(m_pdata->m_data.extend(sizeof(charT) * (1 + (p2 - p1))));
+ m_pdata->m_expression = ps;
+ re_detail::copy(p1, p2, ps);
+ ps[p2 - p1] = 0;
+ // fill in our other data...
+ // successful parsing implies a zero status:
+ m_pdata->m_status = 0;
+ // get the first state of the machine:
+ m_pdata->m_first_state = static_cast<re_syntax_base*>(m_pdata->m_data.data());
+ // fixup pointers in the machine:
+ fixup_pointers(m_pdata->m_first_state);
+ // create nested startmaps:
+ create_startmaps(m_pdata->m_first_state);
+ // create main startmap:
+ std::memset(m_pdata->m_startmap, 0, sizeof(m_pdata->m_startmap));
+ m_pdata->m_can_be_null = 0;
+
+ m_bad_repeats = 0;
+ create_startmap(m_pdata->m_first_state, m_pdata->m_startmap, &(m_pdata->m_can_be_null), mask_all);
+ // get the restart type:
+ m_pdata->m_restart_type = get_restart_type(m_pdata->m_first_state);
+ // optimise a leading repeat if there is one:
+ probe_leading_repeat(m_pdata->m_first_state);
+}
+
+template <class charT, class traits>
+void basic_regex_creator<charT, traits>::fixup_pointers(re_syntax_base* state)
+{
+ while(state)
+ {
+ switch(state->type)
+ {
+ case syntax_element_rep:
+ case syntax_element_dot_rep:
+ case syntax_element_char_rep:
+ case syntax_element_short_set_rep:
+ case syntax_element_long_set_rep:
+ // set the id of this repeat:
+ static_cast<re_repeat*>(state)->id = m_repeater_id++;
+ // fall through:
+ case syntax_element_alt:
+ std::memset(static_cast<re_alt*>(state)->_map, 0, sizeof(static_cast<re_alt*>(state)->_map));
+ static_cast<re_alt*>(state)->can_be_null = 0;
+ // fall through:
+ case syntax_element_jump:
+ static_cast<re_jump*>(state)->alt.p = getaddress(static_cast<re_jump*>(state)->alt.i, state);
+ // fall through again:
+ default:
+ if(state->next.i)
+ state->next.p = getaddress(state->next.i, state);
+ else
+ state->next.p = 0;
+ }
+ state = state->next.p;
+ }
+}
+
+template <class charT, class traits>
+void basic_regex_creator<charT, traits>::create_startmaps(re_syntax_base* state)
+{
+ // non-recursive implementation:
+ // create the last map in the machine first, so that earlier maps
+ // can make use of the result...
+ //
+ // This was originally a recursive implementation, but that caused stack
+ // overflows with complex expressions on small stacks (think COM+).
+
+ // start by saving the case setting:
+ bool l_icase = m_icase;
+ std::vector<std::pair<bool, re_syntax_base*> > v;
+
+ while(state)
+ {
+ switch(state->type)
+ {
+ case syntax_element_toggle_case:
+ // we need to track case changes here:
+ m_icase = static_cast<re_case*>(state)->icase;
+ state = state->next.p;
+ continue;
+ case syntax_element_alt:
+ case syntax_element_rep:
+ case syntax_element_dot_rep:
+ case syntax_element_char_rep:
+ case syntax_element_short_set_rep:
+ case syntax_element_long_set_rep:
+ // just push the state onto our stack for now:
+ v.push_back(std::pair<bool, re_syntax_base*>(m_icase, state));
+ state = state->next.p;
+ break;
+ case syntax_element_backstep:
+ // 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:
+ if(0 == this->m_pdata->m_status) // update the error code if not already set
+ this->m_pdata->m_status = boost::regex_constants::error_bad_pattern;
+ //
+ // clear the expression, we should be empty:
+ //
+ this->m_pdata->m_expression = 0;
+ this->m_pdata->m_expression_len = 0;
+ //
+ // and throw if required:
+ //
+ if(0 == (this->flags() & regex_constants::no_except))
+ {
+ std::string message = this->m_pdata->m_ptraits->error_string(boost::regex_constants::error_bad_pattern);
+ boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0);
+ e.raise();
+ }
+ }
+ // fall through:
+ default:
+ state = state->next.p;
+ }
+ }
+ // now work through our list, building all the maps as we go:
+ while(v.size())
+ {
+ const std::pair<bool, re_syntax_base*>& p = v.back();
+ m_icase = p.first;
+ state = p.second;
+ v.pop_back();
+
+ // Build maps:
+ create_startmap(state->next.p, static_cast<re_alt*>(state)->_map, &static_cast<re_alt*>(state)->can_be_null, mask_take);
+ m_bad_repeats = 0;
+ create_startmap(static_cast<re_alt*>(state)->alt.p, static_cast<re_alt*>(state)->_map, &static_cast<re_alt*>(state)->can_be_null, mask_skip);
+ // adjust the type of the state to allow for faster matching:
+ state->type = this->get_repeat_type(state);
+ }
+ // restore case sensitivity:
+ m_icase = l_icase;
+}
+
+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;
+ int result = 0;
+ while(state)
+ {
+ switch(state->type)
+ {
+ case syntax_element_startmark:
+ if((static_cast<re_brace*>(state)->index == -1)
+ || (static_cast<re_brace*>(state)->index == -2))
+ {
+ state = static_cast<re_jump*>(state->next.p)->alt.p->next.p;
+ continue;
+ }
+ else if(static_cast<re_brace*>(state)->index == -3)
+ {
+ state = state->next.p->next.p;
+ continue;
+ }
+ break;
+ case syntax_element_endmark:
+ 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;
+ case syntax_element_wild:
+ case syntax_element_set:
+ result += 1;
+ break;
+ case syntax_element_dot_rep:
+ case syntax_element_char_rep:
+ case syntax_element_short_set_rep:
+ case syntax_element_backref:
+ case syntax_element_rep:
+ case syntax_element_combining:
+ case syntax_element_long_set_rep:
+ case syntax_element_backstep:
+ {
+ re_repeat* rep = static_cast<re_repeat *>(state);
+ // adjust the type of the state to allow for faster matching:
+ state->type = this->get_repeat_type(state);
+ if((state->type == syntax_element_dot_rep)
+ || (state->type == syntax_element_char_rep)
+ || (state->type == syntax_element_short_set_rep))
+ {
+ if(rep->max != rep->min)
+ return -1;
+ result += static_cast<int>(rep->min);
+ state = rep->alt.p;
+ continue;
+ }
+ 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)
+ return -1;
+ if(rep->max != rep->min)
+ return -1;
+ result += static_cast<int>(rep->min);
+ state = rep->alt.p;
+ continue;
+ }
+ }
+ return -1;
+ case syntax_element_long_set:
+ if(static_cast<re_set_long<mask_type>*>(state)->singleton == 0)
+ return -1;
+ result += 1;
+ break;
+ case syntax_element_jump:
+ state = static_cast<re_jump*>(state)->alt.p;
+ continue;
+ default:
+ break;
+ }
+ state = state->next.p;
+ }
+ return -1;
+}
+
+template <class charT, class traits>
+void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state, unsigned char* l_map, unsigned int* pnull, unsigned char mask)
+{
+ int not_last_jump = 1;
+
+ // track case sensitivity:
+ bool l_icase = m_icase;
+
+ while(state)
+ {
+ switch(state->type)
+ {
+ case syntax_element_toggle_case:
+ l_icase = static_cast<re_case*>(state)->icase;
+ state = state->next.p;
+ break;
+ case syntax_element_literal:
+ {
+ // don't set anything in *pnull, set each element in l_map
+ // that could match the first character in the literal:
+ if(l_map)
+ {
+ l_map[0] |= mask_init;
+ charT first_char = *static_cast<charT*>(static_cast<void*>(static_cast<re_literal*>(state) + 1));
+ for(unsigned int i = 0; i < (1u << CHAR_BIT); ++i)
+ {
+ if(m_traits.translate(static_cast<charT>(i), l_icase) == first_char)
+ l_map[i] |= mask;
+ }
+ }
+ return;
+ }
+ case syntax_element_end_line:
+ {
+ // next character must be a line separator (if there is one):
+ if(l_map)
+ {
+ l_map[0] |= mask_init;
+ l_map['\n'] |= mask;
+ l_map['\r'] |= mask;
+ l_map['\f'] |= mask;
+ l_map[0x85] |= mask;
+ }
+ // now figure out if we can match a NULL string at this point:
+ if(pnull)
+ create_startmap(state->next.p, 0, pnull, mask);
+ return;
+ }
+ case syntax_element_backref:
+ // can be null, and any character can match:
+ if(pnull)
+ *pnull |= mask;
+ // fall through:
+ case syntax_element_wild:
+ {
+ // can't be null, any character can match:
+ set_all_masks(l_map, mask);
+ return;
+ }
+ case syntax_element_match:
+ {
+ // must be null, any character can match:
+ set_all_masks(l_map, mask);
+ if(pnull)
+ *pnull |= mask;
+ return;
+ }
+ case syntax_element_word_start:
+ {
+ // recurse, then AND with all the word characters:
+ create_startmap(state->next.p, l_map, pnull, mask);
+ if(l_map)
+ {
+ l_map[0] |= mask_init;
+ for(unsigned int i = 0; i < (1u << CHAR_BIT); ++i)
+ {
+ if(!m_traits.isctype(static_cast<charT>(i), m_word_mask))
+ l_map[i] &= static_cast<unsigned char>(~mask);
+ }
+ }
+ return;
+ }
+ case syntax_element_word_end:
+ {
+ // recurse, then AND with all the word characters:
+ create_startmap(state->next.p, l_map, pnull, mask);
+ if(l_map)
+ {
+ l_map[0] |= mask_init;
+ for(unsigned int i = 0; i < (1u << CHAR_BIT); ++i)
+ {
+ if(m_traits.isctype(static_cast<charT>(i), m_word_mask))
+ l_map[i] &= static_cast<unsigned char>(~mask);
+ }
+ }
+ return;
+ }
+ case syntax_element_buffer_end:
+ {
+ // we *must be null* :
+ if(pnull)
+ *pnull |= mask;
+ return;
+ }
+ 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)
+ {
+ 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, m_icase))
+ l_map[i] |= mask;
+ }
+ }
+ else
+ set_all_masks(l_map, mask);
+ }
+ return;
+ case syntax_element_set:
+ if(l_map)
+ {
+ l_map[0] |= mask_init;
+ for(unsigned int i = 0; i < (1u << CHAR_BIT); ++i)
+ {
+ if(static_cast<re_set*>(state)->_map[
+ static_cast<unsigned char>(m_traits.translate(static_cast<charT>(i), l_icase))])
+ l_map[i] |= mask;
+ }
+ }
+ return;
+ case syntax_element_jump:
+ // take the jump:
+ state = static_cast<re_alt*>(state)->alt.p;
+ not_last_jump = -1;
+ break;
+ case syntax_element_alt:
+ case syntax_element_rep:
+ case syntax_element_dot_rep:
+ case syntax_element_char_rep:
+ case syntax_element_short_set_rep:
+ case syntax_element_long_set_rep:
+ {
+ re_alt* rep = static_cast<re_alt*>(state);
+ if(rep->_map[0] & mask_init)
+ {
+ if(l_map)
+ {
+ // copy previous results:
+ l_map[0] |= mask_init;
+ for(unsigned int i = 0; i <= UCHAR_MAX; ++i)
+ {
+ if(rep->_map[i] & mask_any)
+ l_map[i] |= mask;
+ }
+ }
+ if(pnull)
+ {
+ if(rep->can_be_null & mask_any)
+ *pnull |= mask;
+ }
+ }
+ else
+ {
+ // we haven't created a startmap for this alternative yet
+ // so take the union of the two options:
+ if(is_bad_repeat(state))
+ {
+ set_all_masks(l_map, mask);
+ return;
+ }
+ set_bad_repeat(state);
+ create_startmap(state->next.p, l_map, pnull, mask);
+ if((state->type == syntax_element_alt)
+ || (static_cast<re_repeat*>(state)->min == 0)
+ || (not_last_jump == 0))
+ create_startmap(rep->alt.p, l_map, pnull, mask);
+ }
+ }
+ return;
+ case syntax_element_soft_buffer_end:
+ // match newline or null:
+ if(l_map)
+ {
+ l_map[0] |= mask_init;
+ l_map['\n'] |= mask;
+ l_map['\r'] |= mask;
+ }
+ if(pnull)
+ *pnull |= mask;
+ return;
+ case syntax_element_endmark:
+ // need to handle independent subs as a special case:
+ if(static_cast<re_brace*>(state)->index < 0)
+ {
+ // can be null, any character can match:
+ set_all_masks(l_map, mask);
+ if(pnull)
+ *pnull |= mask;
+ return;
+ }
+ else
+ {
+ state = state->next.p;
+ break;
+ }
+
+ case syntax_element_startmark:
+ // need to handle independent subs as a special case:
+ if(static_cast<re_brace*>(state)->index == -3)
+ {
+ state = state->next.p->next.p;
+ break;
+ }
+ // otherwise fall through:
+ default:
+ state = state->next.p;
+ }
+ ++not_last_jump;
+ }
+}
+
+template <class charT, class traits>
+unsigned basic_regex_creator<charT, traits>::get_restart_type(re_syntax_base* state)
+{
+ //
+ // find out how the machine starts, so we can optimise the search:
+ //
+ while(state)
+ {
+ switch(state->type)
+ {
+ case syntax_element_startmark:
+ case syntax_element_endmark:
+ state = state->next.p;
+ continue;
+ case syntax_element_start_line:
+ return regbase::restart_line;
+ case syntax_element_word_start:
+ return regbase::restart_word;
+ case syntax_element_buffer_start:
+ return regbase::restart_buf;
+ case syntax_element_restart_continue:
+ return regbase::restart_continue;
+ default:
+ state = 0;
+ continue;
+ }
+ }
+ return regbase::restart_any;
+}
+
+template <class charT, class traits>
+void basic_regex_creator<charT, traits>::set_all_masks(unsigned char* bits, unsigned char mask)
+{
+ //
+ // set mask in all of bits elements,
+ // if bits[0] has mask_init not set then we can
+ // optimise this to a call to memset:
+ //
+ if(bits)
+ {
+ if(bits[0] == 0)
+ (std::memset)(bits, mask, 1u << CHAR_BIT);
+ else
+ {
+ for(unsigned i = 0; i < (1u << CHAR_BIT); ++i)
+ bits[i] |= mask;
+ }
+ bits[0] |= mask_init;
+ }
+}
+
+template <class charT, class traits>
+bool basic_regex_creator<charT, traits>::is_bad_repeat(re_syntax_base* pt)
+{
+ switch(pt->type)
+ {
+ case syntax_element_rep:
+ case syntax_element_dot_rep:
+ case syntax_element_char_rep:
+ case syntax_element_short_set_rep:
+ case syntax_element_long_set_rep:
+ {
+ 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 & static_cast<boost::uintmax_t>(1uL << id);
+ }
+ default:
+ return false;
+ }
+}
+
+template <class charT, class traits>
+void basic_regex_creator<charT, traits>::set_bad_repeat(re_syntax_base* pt)
+{
+ switch(pt->type)
+ {
+ case syntax_element_rep:
+ case syntax_element_dot_rep:
+ case syntax_element_char_rep:
+ case syntax_element_short_set_rep:
+ case syntax_element_long_set_rep:
+ {
+ unsigned id = static_cast<re_repeat*>(pt)->id;
+ if(id <= sizeof(m_bad_repeats) * CHAR_BIT)
+ m_bad_repeats |= static_cast<boost::uintmax_t>(1uL << id);
+ }
+ default:
+ break;
+ }
+}
+
+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;
+ if(state->type == syntax_element_rep)
+ {
+ // check to see if we are repeating a single state:
+ if(state->next.p->next.p->next.p == static_cast<re_alt*>(state)->alt.p)
+ {
+ switch(state->next.p->type)
+ {
+ case re_detail::syntax_element_wild:
+ return re_detail::syntax_element_dot_rep;
+ case re_detail::syntax_element_literal:
+ return re_detail::syntax_element_char_rep;
+ 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)
+ return re_detail::syntax_element_long_set_rep;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ return state->type;
+}
+
+template <class charT, class traits>
+void basic_regex_creator<charT, traits>::probe_leading_repeat(re_syntax_base* state)
+{
+ // enumerate our states, and see if we have a leading repeat
+ // for which failed search restarts can be optimised;
+ do
+ {
+ switch(state->type)
+ {
+ case syntax_element_startmark:
+ if(static_cast<re_brace*>(state)->index >= 0)
+ {
+ state = state->next.p;
+ continue;
+ }
+ return;
+ case syntax_element_endmark:
+ case syntax_element_start_line:
+ case syntax_element_end_line:
+ case syntax_element_word_boundary:
+ case syntax_element_within_word:
+ case syntax_element_word_start:
+ case syntax_element_word_end:
+ case syntax_element_buffer_start:
+ case syntax_element_buffer_end:
+ case syntax_element_restart_continue:
+ state = state->next.p;
+ break;
+ case syntax_element_dot_rep:
+ case syntax_element_char_rep:
+ case syntax_element_short_set_rep:
+ case syntax_element_long_set_rep:
+ if(this->m_has_backrefs == 0)
+ static_cast<re_repeat*>(state)->leading = true;
+ // fall through:
+ default:
+ return;
+ }
+ }while(state);
+}
+
+
+} // namespace re_detail
+
+} // namespace boost
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif
--- /dev/null
+/*
+ *
+ * Copyright (c) 2004
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE basic_regex_parser.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares template class basic_regex_parser.
+ */
+
+#ifndef BOOST_REGEX_V4_BASIC_REGEX_PARSER_HPP
+#define BOOST_REGEX_V4_BASIC_REGEX_PARSER_HPP
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost{
+namespace re_detail{
+
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4244)
+#endif
+
+template <class charT, class traits>
+class basic_regex_parser : public basic_regex_creator<charT, traits>
+{
+public:
+ basic_regex_parser(regex_data<charT, traits>* data);
+ void parse(const charT* p1, const charT* p2, unsigned flags);
+ void fail(regex_constants::error_type error_code, std::ptrdiff_t position);
+
+ bool parse_all();
+ bool parse_basic();
+ bool parse_extended();
+ bool parse_literal();
+ bool parse_open_paren();
+ bool parse_basic_escape();
+ bool parse_extended_escape();
+ bool parse_match_any();
+ bool parse_repeat(std::size_t low = 0, std::size_t high = (std::numeric_limits<std::size_t>::max)());
+ bool parse_repeat_range(bool isbasic);
+ bool parse_alt();
+ bool parse_set();
+ bool parse_backref();
+ void parse_set_literal(basic_char_set<charT, traits>& char_set);
+ bool parse_inner_set(basic_char_set<charT, traits>& char_set);
+ bool parse_QE();
+ bool parse_perl_extension();
+ bool add_emacs_code(bool negate);
+ bool unwind_alts(std::ptrdiff_t last_paren_start);
+ digraph<charT> get_next_set_literal(basic_char_set<charT, traits>& char_set);
+ charT unescape_character();
+ regex_constants::syntax_option_type parse_options();
+
+private:
+ typedef bool (basic_regex_parser::*parser_proc_type)();
+ typedef typename traits::string_type string_type;
+ typedef typename traits::char_class_type char_class_type;
+ parser_proc_type m_parser_proc; // the main parser to use
+ const charT* m_base; // the start of the string being parsed
+ const charT* m_end; // the end of the string being parsed
+ const charT* m_position; // our current parser position
+ unsigned m_mark_count; // how many sub-expressions we have
+ std::ptrdiff_t m_paren_start; // where the last seen ')' began (where repeats are inserted).
+ std::ptrdiff_t m_alt_insert_point; // where to insert the next alternative
+ bool m_has_case_change; // true if somewhere in the current block the case has changed
+#if defined(BOOST_MSVC) && defined(_M_IX86)
+ // This is an ugly warning suppression workaround (for warnings *inside* std::vector
+ // that can not otherwise be suppressed)...
+ BOOST_STATIC_ASSERT(sizeof(long) >= sizeof(void*));
+ std::vector<long> m_alt_jumps; // list of alternative in the current scope.
+#else
+ std::vector<std::ptrdiff_t> m_alt_jumps; // list of alternative in the current scope.
+#endif
+
+ basic_regex_parser& operator=(const basic_regex_parser&);
+ basic_regex_parser(const basic_regex_parser&);
+};
+
+template <class charT, class traits>
+basic_regex_parser<charT, traits>::basic_regex_parser(regex_data<charT, traits>* data)
+ : basic_regex_creator<charT, traits>(data), m_mark_count(0), m_paren_start(0), m_alt_insert_point(0), m_has_case_change(false)
+{
+}
+
+template <class charT, class traits>
+void basic_regex_parser<charT, traits>::parse(const charT* p1, const charT* p2, unsigned flags)
+{
+ // pass flags on to base class:
+ this->init(flags);
+ // set up pointers:
+ m_position = m_base = p1;
+ m_end = p2;
+ // empty strings are errors:
+ if(p1 == p2)
+ {
+ fail(regex_constants::error_empty, 0);
+ return;
+ }
+ // select which parser to use:
+ switch(flags & regbase::main_option_type)
+ {
+ case regbase::perl_syntax_group:
+ m_parser_proc = &basic_regex_parser<charT, traits>::parse_extended;
+ break;
+ case regbase::basic_syntax_group:
+ m_parser_proc = &basic_regex_parser<charT, traits>::parse_basic;
+ break;
+ case regbase::literal:
+ m_parser_proc = &basic_regex_parser<charT, traits>::parse_literal;
+ break;
+ }
+
+ // parse all our characters:
+ bool result = parse_all();
+ //
+ // Unwind our alternatives:
+ //
+ unwind_alts(-1);
+ // reset flags as a global scope (?imsx) may have altered them:
+ this->flags(flags);
+ // if we haven't gobbled up all the characters then we must
+ // have had an unexpected ')' :
+ if(!result)
+ {
+ fail(regex_constants::error_paren, ::boost::re_detail::distance(m_base, m_position));
+ return;
+ }
+ // if an error has been set then give up now:
+ if(this->m_pdata->m_status)
+ return;
+ // fill in our sub-expression count:
+ this->m_pdata->m_mark_count = 1 + m_mark_count;
+ this->finalize(p1, p2);
+}
+
+template <class charT, class traits>
+void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_code, std::ptrdiff_t position)
+{
+ if(0 == this->m_pdata->m_status) // update the error code if not already set
+ this->m_pdata->m_status = error_code;
+ m_position = m_end; // don't bother parsing anything else
+ // get the error message:
+ std::string message = this->m_pdata->m_ptraits->error_string(error_code);
+ // and raise the exception, this will do nothing if exceptions are disabled:
+#ifndef BOOST_NO_EXCEPTIONS
+ if(0 == (this->flags() & regex_constants::no_except))
+ {
+ boost::regex_error e(message, error_code, position);
+ e.raise();
+ }
+#else
+ (void)position; // suppress warnings.
+#endif
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_all()
+{
+ bool result = true;
+ while(result && (m_position != m_end))
+ {
+ result = (this->*m_parser_proc)();
+ }
+ return result;
+}
+
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4702)
+#endif
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_basic()
+{
+ switch(this->m_traits.syntax_type(*m_position))
+ {
+ case regex_constants::syntax_escape:
+ return parse_basic_escape();
+ case regex_constants::syntax_dot:
+ return parse_match_any();
+ case regex_constants::syntax_caret:
+ ++m_position;
+ this->append_state(syntax_element_start_line);
+ break;
+ case regex_constants::syntax_dollar:
+ ++m_position;
+ this->append_state(syntax_element_end_line);
+ break;
+ case regex_constants::syntax_star:
+ if(!(this->m_last_state) || (this->m_last_state->type == syntax_element_start_line))
+ return parse_literal();
+ else
+ {
+ ++m_position;
+ return parse_repeat();
+ }
+ case regex_constants::syntax_plus:
+ if(!(this->m_last_state) || (this->m_last_state->type == syntax_element_start_line) || !(this->flags() & regbase::emacs_ex))
+ return parse_literal();
+ else
+ {
+ ++m_position;
+ return parse_repeat(1);
+ }
+ case regex_constants::syntax_question:
+ if(!(this->m_last_state) || (this->m_last_state->type == syntax_element_start_line) || !(this->flags() & regbase::emacs_ex))
+ return parse_literal();
+ else
+ {
+ ++m_position;
+ return parse_repeat(0, 1);
+ }
+ case regex_constants::syntax_open_set:
+ return parse_set();
+ default:
+ return parse_literal();
+ }
+ return true;
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_extended()
+{
+ bool result = true;
+ switch(this->m_traits.syntax_type(*m_position))
+ {
+ case regex_constants::syntax_open_mark:
+ return parse_open_paren();
+ case regex_constants::syntax_close_mark:
+ return false;
+ case regex_constants::syntax_escape:
+ return parse_extended_escape();
+ case regex_constants::syntax_dot:
+ return parse_match_any();
+ case regex_constants::syntax_caret:
+ ++m_position;
+ this->append_state(
+ (this->flags() & regex_constants::no_mod_m ? syntax_element_buffer_start : syntax_element_start_line));
+ break;
+ case regex_constants::syntax_dollar:
+ ++m_position;
+ this->append_state(
+ (this->flags() & regex_constants::no_mod_m ? syntax_element_buffer_end : syntax_element_end_line));
+ break;
+ case regex_constants::syntax_star:
+ if(m_position == this->m_base)
+ {
+ fail(regex_constants::error_badrepeat, 0);
+ return false;
+ }
+ ++m_position;
+ return parse_repeat();
+ case regex_constants::syntax_question:
+ if(m_position == this->m_base)
+ {
+ fail(regex_constants::error_badrepeat, 0);
+ return false;
+ }
+ ++m_position;
+ return parse_repeat(0,1);
+ case regex_constants::syntax_plus:
+ if(m_position == this->m_base)
+ {
+ fail(regex_constants::error_badrepeat, 0);
+ return false;
+ }
+ ++m_position;
+ return parse_repeat(1);
+ case regex_constants::syntax_open_brace:
+ ++m_position;
+ return parse_repeat_range(false);
+ case regex_constants::syntax_close_brace:
+ fail(regex_constants::error_brace, this->m_position - this->m_end);
+ return false;
+ case regex_constants::syntax_or:
+ return parse_alt();
+ case regex_constants::syntax_open_set:
+ return parse_set();
+ case regex_constants::syntax_hash:
+ //
+ // If we have a mod_x flag set, then skip until
+ // we get to a newline character:
+ //
+ if((this->flags()
+ & (regbase::no_perl_ex|regbase::mod_x))
+ == regbase::mod_x)
+ {
+ while((m_position != m_end) && !is_separator(*m_position++)){}
+ return true;
+ }
+ // Otherwise fall through:
+ default:
+ result = parse_literal();
+ break;
+ }
+ return result;
+}
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_literal()
+{
+ // append this as a literal provided it's not a space character
+ // or the perl option regbase::mod_x is not set:
+ if(
+ ((this->flags()
+ & (regbase::main_option_type|regbase::mod_x|regbase::no_perl_ex))
+ != regbase::mod_x)
+ || !this->m_traits.isctype(*m_position, this->m_mask_space))
+ this->append_literal(*m_position);
+ ++m_position;
+ return true;
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_open_paren()
+{
+ //
+ // skip the '(' and error check:
+ //
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_paren, m_position - m_base);
+ return false;
+ }
+ //
+ // begin by checking for a perl-style (?...) extension:
+ //
+ if(
+ ((this->flags() & (regbase::main_option_type | regbase::no_perl_ex)) == 0)
+ || ((this->flags() & (regbase::main_option_type | regbase::emacs_ex)) == (regbase::basic_syntax_group|regbase::emacs_ex))
+ )
+ {
+ if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_question)
+ return parse_perl_extension();
+ }
+ //
+ // update our mark count, and append the required state:
+ //
+ unsigned markid = 0;
+ if(0 == (this->flags() & regbase::nosubs))
+ markid = ++m_mark_count;
+ re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_startmark, sizeof(re_brace)));
+ pb->index = markid;
+ std::ptrdiff_t last_paren_start = this->getoffset(pb);
+ // back up insertion point for alternations, and set new point:
+ std::ptrdiff_t last_alt_point = m_alt_insert_point;
+ this->m_pdata->m_data.align();
+ m_alt_insert_point = this->m_pdata->m_data.size();
+ //
+ // back up the current flags in case we have a nested (?imsx) group:
+ //
+ regex_constants::syntax_option_type opts = this->flags();
+ bool old_case_change = m_has_case_change;
+ m_has_case_change = false; // no changes to this scope as yet...
+ //
+ // now recursively add more states, this will terminate when we get to a
+ // matching ')' :
+ //
+ parse_all();
+ //
+ // Unwind pushed alternatives:
+ //
+ if(0 == unwind_alts(last_paren_start))
+ return false;
+ //
+ // restore flags:
+ //
+ if(m_has_case_change)
+ {
+ // the case has changed in one or more of the alternatives
+ // within the scoped (...) block: we have to add a state
+ // to reset the case sensitivity:
+ static_cast<re_case*>(
+ this->append_state(syntax_element_toggle_case, sizeof(re_case))
+ )->icase = opts & regbase::icase;
+ }
+ this->flags(opts);
+ m_has_case_change = old_case_change;
+ //
+ // we either have a ')' or we have run out of characters prematurely:
+ //
+ if(m_position == m_end)
+ {
+ this->fail(regex_constants::error_paren, ::boost::re_detail::distance(m_base, m_end));
+ return false;
+ }
+ BOOST_ASSERT(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_mark);
+ ++m_position;
+ //
+ // append closing parenthesis state:
+ //
+ pb = static_cast<re_brace*>(this->append_state(syntax_element_endmark, sizeof(re_brace)));
+ pb->index = markid;
+ this->m_paren_start = last_paren_start;
+ //
+ // restore the alternate insertion point:
+ //
+ this->m_alt_insert_point = last_alt_point;
+ //
+ // allow backrefs to this mark:
+ //
+ if((markid > 0) && (markid < sizeof(unsigned) * CHAR_BIT))
+ this->m_backrefs |= 1u << (markid - 1);
+
+ return true;
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_basic_escape()
+{
+ ++m_position;
+ bool result = true;
+ switch(this->m_traits.escape_syntax_type(*m_position))
+ {
+ case regex_constants::syntax_open_mark:
+ return parse_open_paren();
+ case regex_constants::syntax_close_mark:
+ return false;
+ case regex_constants::syntax_plus:
+ if(this->flags() & regex_constants::bk_plus_qm)
+ {
+ ++m_position;
+ return parse_repeat(1);
+ }
+ else
+ return parse_literal();
+ case regex_constants::syntax_question:
+ if(this->flags() & regex_constants::bk_plus_qm)
+ {
+ ++m_position;
+ return parse_repeat(0, 1);
+ }
+ else
+ return parse_literal();
+ case regex_constants::syntax_open_brace:
+ if(this->flags() & regbase::no_intervals)
+ return parse_literal();
+ ++m_position;
+ return parse_repeat_range(true);
+ case regex_constants::syntax_close_brace:
+ if(this->flags() & regbase::no_intervals)
+ return parse_literal();
+ fail(regex_constants::error_brace, this->m_position - this->m_base);
+ return false;
+ case regex_constants::syntax_or:
+ if(this->flags() & regbase::bk_vbar)
+ return parse_alt();
+ else
+ result = parse_literal();
+ break;
+ case regex_constants::syntax_digit:
+ return parse_backref();
+ case regex_constants::escape_type_start_buffer:
+ if(this->flags() & regbase::emacs_ex)
+ {
+ ++m_position;
+ this->append_state(syntax_element_buffer_start);
+ }
+ else
+ result = parse_literal();
+ break;
+ case regex_constants::escape_type_end_buffer:
+ if(this->flags() & regbase::emacs_ex)
+ {
+ ++m_position;
+ this->append_state(syntax_element_buffer_end);
+ }
+ else
+ result = parse_literal();
+ break;
+ case regex_constants::escape_type_word_assert:
+ if(this->flags() & regbase::emacs_ex)
+ {
+ ++m_position;
+ this->append_state(syntax_element_word_boundary);
+ }
+ else
+ result = parse_literal();
+ break;
+ case regex_constants::escape_type_not_word_assert:
+ if(this->flags() & regbase::emacs_ex)
+ {
+ ++m_position;
+ this->append_state(syntax_element_within_word);
+ }
+ else
+ result = parse_literal();
+ break;
+ case regex_constants::escape_type_left_word:
+ if(this->flags() & regbase::emacs_ex)
+ {
+ ++m_position;
+ this->append_state(syntax_element_word_start);
+ }
+ else
+ result = parse_literal();
+ break;
+ case regex_constants::escape_type_right_word:
+ if(this->flags() & regbase::emacs_ex)
+ {
+ ++m_position;
+ this->append_state(syntax_element_word_end);
+ }
+ else
+ result = parse_literal();
+ break;
+ default:
+ if(this->flags() & regbase::emacs_ex)
+ {
+ bool negate = true;
+ switch(*m_position)
+ {
+ case 'w':
+ negate = false;
+ // fall through:
+ case 'W':
+ {
+ basic_char_set<charT, traits> char_set;
+ if(negate)
+ char_set.negate();
+ char_set.add_class(this->m_word_mask);
+ if(0 == this->append_set(char_set))
+ {
+ fail(regex_constants::error_ctype, m_position - m_base);
+ return false;
+ }
+ ++m_position;
+ return true;
+ }
+ case 's':
+ negate = false;
+ // fall through:
+ case 'S':
+ return add_emacs_code(negate);
+ case 'c':
+ case 'C':
+ // not supported yet:
+ fail(regex_constants::error_escape, m_position - m_base);
+ return false;
+ default:
+ break;
+ }
+ }
+ result = parse_literal();
+ break;
+ }
+ return result;
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_extended_escape()
+{
+ ++m_position;
+ bool negate = false; // in case this is a character class escape: \w \d etc
+ switch(this->m_traits.escape_syntax_type(*m_position))
+ {
+ case regex_constants::escape_type_not_class:
+ negate = true;
+ // fall through:
+ case regex_constants::escape_type_class:
+ {
+ typedef typename traits::char_class_type mask_type;
+ mask_type m = this->m_traits.lookup_classname(m_position, m_position+1);
+ if(m != 0)
+ {
+ basic_char_set<charT, traits> char_set;
+ if(negate)
+ char_set.negate();
+ char_set.add_class(m);
+ if(0 == this->append_set(char_set))
+ {
+ fail(regex_constants::error_ctype, m_position - m_base);
+ return false;
+ }
+ ++m_position;
+ return true;
+ }
+ //
+ // not a class, just a regular unknown escape:
+ //
+ this->append_literal(unescape_character());
+ break;
+ }
+ case regex_constants::syntax_digit:
+ return parse_backref();
+ case regex_constants::escape_type_left_word:
+ ++m_position;
+ this->append_state(syntax_element_word_start);
+ break;
+ case regex_constants::escape_type_right_word:
+ ++m_position;
+ this->append_state(syntax_element_word_end);
+ break;
+ case regex_constants::escape_type_start_buffer:
+ ++m_position;
+ this->append_state(syntax_element_buffer_start);
+ break;
+ case regex_constants::escape_type_end_buffer:
+ ++m_position;
+ this->append_state(syntax_element_buffer_end);
+ break;
+ case regex_constants::escape_type_word_assert:
+ ++m_position;
+ this->append_state(syntax_element_word_boundary);
+ break;
+ case regex_constants::escape_type_not_word_assert:
+ ++m_position;
+ this->append_state(syntax_element_within_word);
+ break;
+ case regex_constants::escape_type_Z:
+ ++m_position;
+ this->append_state(syntax_element_soft_buffer_end);
+ break;
+ case regex_constants::escape_type_Q:
+ return parse_QE();
+ case regex_constants::escape_type_C:
+ return parse_match_any();
+ case regex_constants::escape_type_X:
+ ++m_position;
+ this->append_state(syntax_element_combining);
+ break;
+ case regex_constants::escape_type_G:
+ ++m_position;
+ this->append_state(syntax_element_restart_continue);
+ break;
+ case regex_constants::escape_type_not_property:
+ negate = true;
+ // fall through:
+ case regex_constants::escape_type_property:
+ {
+ ++m_position;
+ char_class_type m;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return false;
+ }
+ // maybe have \p{ddd}
+ if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_open_brace)
+ {
+ const charT* base = m_position;
+ // skip forward until we find enclosing brace:
+ while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace))
+ ++m_position;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return false;
+ }
+ m = this->m_traits.lookup_classname(++base, m_position++);
+ }
+ else
+ {
+ m = this->m_traits.lookup_classname(m_position, m_position+1);
+ ++m_position;
+ }
+ if(m != 0)
+ {
+ basic_char_set<charT, traits> char_set;
+ if(negate)
+ char_set.negate();
+ char_set.add_class(m);
+ if(0 == this->append_set(char_set))
+ {
+ fail(regex_constants::error_ctype, m_position - m_base);
+ return false;
+ }
+ return true;
+ }
+ fail(regex_constants::error_ctype, m_position - m_base);
+ }
+ default:
+ this->append_literal(unescape_character());
+ break;
+ }
+ return true;
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_match_any()
+{
+ //
+ // we have a '.' that can match any character:
+ //
+ ++m_position;
+ static_cast<re_dot*>(
+ this->append_state(syntax_element_wild, sizeof(re_dot))
+ )->mask = static_cast<unsigned char>(this->flags() & regbase::no_mod_s
+ ? re_detail::force_not_newline
+ : this->flags() & regbase::mod_s ?
+ re_detail::force_newline : re_detail::dont_care);
+ return true;
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_t high)
+{
+ bool greedy = true;
+ std::size_t insert_point;
+ //
+ // when we get to here we may have a non-greedy ? mark still to come:
+ //
+ if((m_position != m_end)
+ && (
+ (0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex)))
+ || ((regbase::basic_syntax_group|regbase::emacs_ex) == (this->flags() & (regbase::main_option_type | regbase::emacs_ex)))
+ )
+ )
+ {
+ // OK we have a perl regex, check for a '?':
+ if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_question)
+ {
+ greedy = false;
+ ++m_position;
+ }
+ }
+ if(0 == this->m_last_state)
+ {
+ fail(regex_constants::error_badrepeat, ::boost::re_detail::distance(m_base, m_position));
+ return false;
+ }
+ if(this->m_last_state->type == syntax_element_endmark)
+ {
+ // insert a repeat before the '(' matching the last ')':
+ insert_point = this->m_paren_start;
+ }
+ else if((this->m_last_state->type == syntax_element_literal) && (static_cast<re_literal*>(this->m_last_state)->length > 1))
+ {
+ // the last state was a literal with more than one character, split it in two:
+ re_literal* lit = static_cast<re_literal*>(this->m_last_state);
+ charT c = (static_cast<charT*>(static_cast<void*>(lit+1)))[lit->length - 1];
+ --(lit->length);
+ // now append new state:
+ lit = static_cast<re_literal*>(this->append_state(syntax_element_literal, sizeof(re_literal) + sizeof(charT)));
+ lit->length = 1;
+ (static_cast<charT*>(static_cast<void*>(lit+1)))[0] = c;
+ insert_point = this->getoffset(this->m_last_state);
+ }
+ else
+ {
+ // repeat the last state whatever it was, need to add some error checking here:
+ switch(this->m_last_state->type)
+ {
+ case syntax_element_start_line:
+ case syntax_element_end_line:
+ case syntax_element_word_boundary:
+ case syntax_element_within_word:
+ case syntax_element_word_start:
+ case syntax_element_word_end:
+ case syntax_element_buffer_start:
+ case syntax_element_buffer_end:
+ case syntax_element_alt:
+ case syntax_element_soft_buffer_end:
+ case syntax_element_restart_continue:
+ case syntax_element_jump:
+ case syntax_element_startmark:
+ // can't legally repeat any of the above:
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ default:
+ // do nothing...
+ break;
+ }
+ insert_point = this->getoffset(this->m_last_state);
+ }
+ //
+ // OK we now know what to repeat, so insert the repeat around it:
+ //
+ re_repeat* rep = static_cast<re_repeat*>(this->insert_state(insert_point, syntax_element_rep, re_repeater_size));
+ rep->min = low;
+ rep->max = high;
+ rep->greedy = greedy;
+ rep->leading = false;
+ // store our repeater position for later:
+ std::ptrdiff_t rep_off = this->getoffset(rep);
+ // and append a back jump to the repeat:
+ re_jump* jmp = static_cast<re_jump*>(this->append_state(syntax_element_jump, sizeof(re_jump)));
+ jmp->alt.i = rep_off - this->getoffset(jmp);
+ this->m_pdata->m_data.align();
+ // now fill in the alt jump for the repeat:
+ rep = static_cast<re_repeat*>(this->getaddress(rep_off));
+ rep->alt.i = this->m_pdata->m_data.size() - rep_off;
+ return true;
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
+{
+ //
+ // parse a repeat-range:
+ //
+ std::size_t min, max;
+ int v;
+ // skip whitespace:
+ while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space))
+ ++m_position;
+ // fail if at end:
+ if(this->m_position == this->m_end)
+ {
+ fail(regex_constants::error_brace, this->m_position - this->m_base);
+ return false;
+ }
+ // get min:
+ v = this->m_traits.toi(m_position, m_end, 10);
+ // skip whitespace:
+ while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space))
+ ++m_position;
+ if(v < 0)
+ {
+ fail(regex_constants::error_badbrace, this->m_position - this->m_base);
+ return false;
+ }
+ else if(this->m_position == this->m_end)
+ {
+ fail(regex_constants::error_brace, this->m_position - this->m_base);
+ return false;
+ }
+ min = v;
+ // see if we have a comma:
+ if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_comma)
+ {
+ // move on and error check:
+ ++m_position;
+ // skip whitespace:
+ while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space))
+ ++m_position;
+ if(this->m_position == this->m_end)
+ {
+ fail(regex_constants::error_brace, this->m_position - this->m_base);
+ return false;
+ }
+ // get the value if any:
+ v = this->m_traits.toi(m_position, m_end, 10);
+ max = (v >= 0) ? v : (std::numeric_limits<std::size_t>::max)();
+ }
+ else
+ {
+ // no comma, max = min:
+ max = min;
+ }
+ // skip whitespace:
+ while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space))
+ ++m_position;
+ // OK now check trailing }:
+ if(this->m_position == this->m_end)
+ {
+ fail(regex_constants::error_brace, this->m_position - this->m_base);
+ return false;
+ }
+ if(isbasic)
+ {
+ if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_escape)
+ {
+ ++m_position;
+ if(this->m_position == this->m_end)
+ {
+ fail(regex_constants::error_brace, this->m_position - this->m_base);
+ return false;
+ }
+ }
+ else
+ {
+ fail(regex_constants::error_badbrace, this->m_position - this->m_base);
+ return false;
+ }
+ }
+ if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_brace)
+ ++m_position;
+ else
+ {
+ fail(regex_constants::error_badbrace, this->m_position - this->m_base);
+ return false;
+ }
+ //
+ // finally go and add the repeat, unless error:
+ //
+ if(min > max)
+ {
+ fail(regex_constants::error_range, this->m_position - this->m_base);
+ return false;
+ }
+ return parse_repeat(min, max);
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_alt()
+{
+ //
+ // error check: if there have been no previous states,
+ // or if the last state was a '(' then error:
+ //
+ if((this->m_last_state == 0) || (this->m_last_state->type == syntax_element_startmark))
+ {
+ fail(regex_constants::error_empty, this->m_position - this->m_base);
+ return false;
+ }
+ ++m_position;
+ //
+ // we need to append a trailing jump:
+ //
+ re_syntax_base* pj = this->append_state(re_detail::syntax_element_jump, sizeof(re_jump));
+ std::ptrdiff_t jump_offset = this->getoffset(pj);
+ //
+ // now insert the alternative:
+ //
+ re_alt* palt = static_cast<re_alt*>(this->insert_state(this->m_alt_insert_point, syntax_element_alt, re_alt_size));
+ jump_offset += re_alt_size;
+ this->m_pdata->m_data.align();
+ palt->alt.i = this->m_pdata->m_data.size() - this->getoffset(palt);
+ //
+ // update m_alt_insert_point so that the next alternate gets
+ // inserted at the start of the second of the two we've just created:
+ //
+ this->m_alt_insert_point = this->m_pdata->m_data.size();
+ //
+ // the start of this alternative must have a case changes state
+ // if the current block has messed around with case changes:
+ //
+ if(m_has_case_change)
+ {
+ static_cast<re_case*>(
+ this->append_state(syntax_element_toggle_case, sizeof(re_case))
+ )->icase = this->m_icase;
+ }
+ //
+ // push the alternative onto our stack, a recursive
+ // implementation here is easier to understand (and faster
+ // as it happens), but causes all kinds of stack overflow problems
+ // on programs with small stacks (COM+).
+ //
+ m_alt_jumps.push_back(jump_offset);
+ return true;
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_set()
+{
+ ++m_position;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_brack, m_position - m_base);
+ return false;
+ }
+ basic_char_set<charT, traits> char_set;
+
+ const charT* base = m_position; // where the '[' was
+ const charT* item_base = m_position; // where the '[' or '^' was
+
+ while(m_position != m_end)
+ {
+ switch(this->m_traits.syntax_type(*m_position))
+ {
+ case regex_constants::syntax_caret:
+ if(m_position == base)
+ {
+ char_set.negate();
+ ++m_position;
+ item_base = m_position;
+ }
+ else
+ parse_set_literal(char_set);
+ break;
+ case regex_constants::syntax_close_set:
+ if(m_position == item_base)
+ {
+ parse_set_literal(char_set);
+ break;
+ }
+ else
+ {
+ ++m_position;
+ if(0 == this->append_set(char_set))
+ {
+ fail(regex_constants::error_range, m_position - m_base);
+ return false;
+ }
+ }
+ return true;
+ case regex_constants::syntax_open_set:
+ if(parse_inner_set(char_set))
+ break;
+ return true;
+ case regex_constants::syntax_escape:
+ {
+ //
+ // look ahead and see if this is a character class shortcut
+ // \d \w \s etc...
+ //
+ ++m_position;
+ if(this->m_traits.escape_syntax_type(*m_position)
+ == regex_constants::escape_type_class)
+ {
+ char_class_type m = this->m_traits.lookup_classname(m_position, m_position+1);
+ if(m != 0)
+ {
+ char_set.add_class(m);
+ ++m_position;
+ break;
+ }
+ }
+ else if(this->m_traits.escape_syntax_type(*m_position)
+ == regex_constants::escape_type_not_class)
+ {
+ // negated character class:
+ char_class_type m = this->m_traits.lookup_classname(m_position, m_position+1);
+ if(m != 0)
+ {
+ char_set.add_negated_class(m);
+ ++m_position;
+ break;
+ }
+ }
+ // not a character class, just a regular escape:
+ --m_position;
+ parse_set_literal(char_set);
+ break;
+ }
+ default:
+ parse_set_literal(char_set);
+ break;
+ }
+ }
+ return m_position != m_end;
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, traits>& char_set)
+{
+ //
+ // we have either a character class [:name:]
+ // a collating element [.name.]
+ // or an equivalence class [=name=]
+ //
+ if(m_end == ++m_position)
+ {
+ fail(regex_constants::error_brack, m_position - m_base);
+ return false;
+ }
+ switch(this->m_traits.syntax_type(*m_position))
+ {
+ case regex_constants::syntax_dot:
+ //
+ // a collating element is treated as a literal:
+ //
+ --m_position;
+ parse_set_literal(char_set);
+ return true;
+ case regex_constants::syntax_colon:
+ {
+ // check that character classes are actually enabled:
+ if((this->flags() & (regbase::main_option_type | regbase::no_char_classes))
+ == (regbase::basic_syntax_group | regbase::no_char_classes))
+ {
+ --m_position;
+ parse_set_literal(char_set);
+ return true;
+ }
+ // skip the ':'
+ if(m_end == ++m_position)
+ {
+ fail(regex_constants::error_brack, m_position - m_base);
+ return false;
+ }
+ const charT* name_first = m_position;
+ // skip at least one character, then find the matching ':]'
+ if(m_end == ++m_position)
+ {
+ fail(regex_constants::error_brack, m_position - m_base);
+ return false;
+ }
+ while((m_position != m_end)
+ && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_colon))
+ ++m_position;
+ const charT* name_last = m_position;
+ if(m_end == m_position)
+ {
+ fail(regex_constants::error_brack, m_position - m_base);
+ return false;
+ }
+ if((m_end == ++m_position)
+ || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set))
+ {
+ fail(regex_constants::error_brack, m_position - m_base);
+ return false;
+ }
+ //
+ // check for negated class:
+ //
+ bool negated = false;
+ if(this->m_traits.syntax_type(*name_first) == regex_constants::syntax_caret)
+ {
+ ++name_first;
+ negated = true;
+ }
+ typedef typename traits::char_class_type mask_type;
+ mask_type m = this->m_traits.lookup_classname(name_first, name_last);
+ if(m == 0)
+ {
+ if(char_set.empty() && (name_last - name_first == 1))
+ {
+ // maybe a special case:
+ ++m_position;
+ if( (m_position != m_end)
+ && (this->m_traits.syntax_type(*m_position)
+ == regex_constants::syntax_close_set))
+ {
+ if(this->m_traits.escape_syntax_type(*name_first)
+ == regex_constants::escape_type_left_word)
+ {
+ ++m_position;
+ this->append_state(syntax_element_word_start);
+ return false;
+ }
+ if(this->m_traits.escape_syntax_type(*name_first)
+ == regex_constants::escape_type_right_word)
+ {
+ ++m_position;
+ this->append_state(syntax_element_word_end);
+ return false;
+ }
+ }
+ }
+ fail(regex_constants::error_ctype, name_first - m_base);
+ return false;
+ }
+ if(negated == false)
+ char_set.add_class(m);
+ else
+ char_set.add_negated_class(m);
+ ++m_position;
+ break;
+ }
+ case regex_constants::syntax_equal:
+ {
+ // skip the '='
+ if(m_end == ++m_position)
+ {
+ fail(regex_constants::error_brack, m_position - m_base);
+ return false;
+ }
+ const charT* name_first = m_position;
+ // skip at least one character, then find the matching '=]'
+ if(m_end == ++m_position)
+ {
+ fail(regex_constants::error_brack, m_position - m_base);
+ return false;
+ }
+ while((m_position != m_end)
+ && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_equal))
+ ++m_position;
+ const charT* name_last = m_position;
+ if(m_end == m_position)
+ {
+ fail(regex_constants::error_brack, m_position - m_base);
+ return false;
+ }
+ if((m_end == ++m_position)
+ || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set))
+ {
+ fail(regex_constants::error_brack, m_position - m_base);
+ return false;
+ }
+ string_type m = this->m_traits.lookup_collatename(name_first, name_last);
+ if((0 == m.size()) || (m.size() > 2))
+ {
+ fail(regex_constants::error_collate, name_first - m_base);
+ return false;
+ }
+ digraph<charT> d;
+ d.first = m[0];
+ if(m.size() > 1)
+ d.second = m[1];
+ else
+ d.second = 0;
+ char_set.add_equivalent(d);
+ ++m_position;
+ break;
+ }
+ default:
+ --m_position;
+ parse_set_literal(char_set);
+ break;
+ }
+ return true;
+}
+
+template <class charT, class traits>
+void basic_regex_parser<charT, traits>::parse_set_literal(basic_char_set<charT, traits>& char_set)
+{
+ digraph<charT> start_range(get_next_set_literal(char_set));
+ if(m_end == m_position)
+ {
+ fail(regex_constants::error_brack, m_position - m_base);
+ return;
+ }
+ if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_dash)
+ {
+ // we have a range:
+ if(m_end == ++m_position)
+ {
+ fail(regex_constants::error_brack, m_position - m_base);
+ return;
+ }
+ if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set)
+ {
+ digraph<charT> end_range = get_next_set_literal(char_set);
+ char_set.add_range(start_range, end_range);
+ if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_dash)
+ {
+ if(m_end == ++m_position)
+ {
+ fail(regex_constants::error_brack, m_position - m_base);
+ return;
+ }
+ if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_set)
+ {
+ // trailing - :
+ --m_position;
+ return;
+ }
+ fail(regex_constants::error_range, m_position - m_base);
+ return;
+ }
+ return;
+ }
+ --m_position;
+ }
+ char_set.add_single(start_range);
+}
+
+template <class charT, class traits>
+digraph<charT> basic_regex_parser<charT, traits>::get_next_set_literal(basic_char_set<charT, traits>& char_set)
+{
+ typedef typename traits::string_type string_type;
+ digraph<charT> result;
+ switch(this->m_traits.syntax_type(*m_position))
+ {
+ case regex_constants::syntax_dash:
+ if(!char_set.empty())
+ {
+ // see if we are at the end of the set:
+ if((++m_position == m_end) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set))
+ {
+ fail(regex_constants::error_range, m_position - m_base);
+ return result;
+ }
+ --m_position;
+ }
+ result.first = *m_position++;
+ return result;
+ case regex_constants::syntax_escape:
+ // check to see if escapes are supported first:
+ if(this->flags() & regex_constants::no_escape_in_lists)
+ {
+ result = *m_position++;
+ break;
+ }
+ ++m_position;
+ result = unescape_character();
+ break;
+ case regex_constants::syntax_open_set:
+ {
+ if(m_end == ++m_position)
+ {
+ fail(regex_constants::error_collate, m_position - m_base);
+ return result;
+ }
+ if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_dot)
+ {
+ --m_position;
+ result.first = *m_position;
+ ++m_position;
+ return result;
+ }
+ if(m_end == ++m_position)
+ {
+ fail(regex_constants::error_collate, m_position - m_base);
+ return result;
+ }
+ const charT* name_first = m_position;
+ // skip at least one character, then find the matching ':]'
+ if(m_end == ++m_position)
+ {
+ fail(regex_constants::error_collate, name_first - m_base);
+ return result;
+ }
+ while((m_position != m_end)
+ && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_dot))
+ ++m_position;
+ const charT* name_last = m_position;
+ if(m_end == m_position)
+ {
+ fail(regex_constants::error_collate, name_first - m_base);
+ return result;
+ }
+ if((m_end == ++m_position)
+ || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set))
+ {
+ fail(regex_constants::error_collate, name_first - m_base);
+ return result;
+ }
+ ++m_position;
+ string_type s = this->m_traits.lookup_collatename(name_first, name_last);
+ if(s.empty() || (s.size() > 2))
+ {
+ fail(regex_constants::error_collate, name_first - m_base);
+ return result;
+ }
+ result.first = s[0];
+ if(s.size() > 1)
+ result.second = s[1];
+ else
+ result.second = 0;
+ return result;
+ }
+ default:
+ result = *m_position++;
+ }
+ return result;
+}
+
+//
+// does a value fit in the specified charT type?
+//
+template <class charT>
+bool valid_value(charT, int v, const mpl::true_&)
+{
+ return (v >> (sizeof(charT) * CHAR_BIT)) == 0;
+}
+template <class charT>
+bool valid_value(charT, int, const mpl::false_&)
+{
+ return true; // v will alsways fit in a charT
+}
+template <class charT>
+bool valid_value(charT c, int v)
+{
+ return valid_value(c, v, mpl::bool_<(sizeof(charT) < sizeof(int))>());
+}
+
+template <class charT, class traits>
+charT basic_regex_parser<charT, traits>::unescape_character()
+{
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
+ charT result(0);
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return false;
+ }
+ switch(this->m_traits.escape_syntax_type(*m_position))
+ {
+ case regex_constants::escape_type_control_a:
+ result = charT('\a');
+ break;
+ case regex_constants::escape_type_e:
+ result = charT(27);
+ break;
+ case regex_constants::escape_type_control_f:
+ result = charT('\f');
+ break;
+ case regex_constants::escape_type_control_n:
+ result = charT('\n');
+ break;
+ case regex_constants::escape_type_control_r:
+ result = charT('\r');
+ break;
+ case regex_constants::escape_type_control_t:
+ result = charT('\t');
+ break;
+ case regex_constants::escape_type_control_v:
+ result = charT('\v');
+ break;
+ case regex_constants::escape_type_word_assert:
+ result = charT('\b');
+ break;
+ case regex_constants::escape_type_ascii_control:
+ ++m_position;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return result;
+ }
+ /*
+ if((*m_position < charT('@'))
+ || (*m_position > charT(125)) )
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return result;
+ }
+ */
+ result = static_cast<charT>(*m_position % 32);
+ break;
+ case regex_constants::escape_type_hex:
+ ++m_position;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return result;
+ }
+ // maybe have \x{ddd}
+ if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_open_brace)
+ {
+ ++m_position;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return result;
+ }
+ int i = this->m_traits.toi(m_position, m_end, 16);
+ if((m_position == m_end)
+ || (i < 0)
+ || ((std::numeric_limits<charT>::is_specialized) && (charT(i) > (std::numeric_limits<charT>::max)()))
+ || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace))
+ {
+ fail(regex_constants::error_badbrace, m_position - m_base);
+ return result;
+ }
+ ++m_position;
+ result = charT(i);
+ }
+ else
+ {
+ std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(2), m_end - m_position);
+ int i = this->m_traits.toi(m_position, m_position + len, 16);
+ if((i < 0)
+ || !valid_value(charT(0), i))
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return result;
+ }
+ result = charT(i);
+ }
+ return result;
+ case regex_constants::syntax_digit:
+ {
+ // an octal escape sequence, the first character must be a zero
+ // followed by up to 3 octal digits:
+ std::ptrdiff_t len = (std::min)(::boost::re_detail::distance(m_position, m_end), static_cast<std::ptrdiff_t>(4));
+ const charT* bp = m_position;
+ int val = this->m_traits.toi(bp, bp + 1, 8);
+ if(val != 0)
+ {
+ // Oops not an octal escape after all:
+ fail(regex_constants::error_escape, m_position - m_base);
+ return result;
+ }
+ val = this->m_traits.toi(m_position, m_position + len, 8);
+ if(val < 0)
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return result;
+ }
+ return static_cast<charT>(val);
+ }
+ case regex_constants::escape_type_named_char:
+ {
+ ++m_position;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return false;
+ }
+ // maybe have \N{name}
+ if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_open_brace)
+ {
+ const charT* base = m_position;
+ // skip forward until we find enclosing brace:
+ while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace))
+ ++m_position;
+ if(m_position == m_end)
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return false;
+ }
+ string_type s = this->m_traits.lookup_collatename(++base, m_position++);
+ if(s.empty())
+ {
+ fail(regex_constants::error_collate, m_position - m_base);
+ return false;
+ }
+ if(s.size() == 1)
+ {
+ return s[0];
+ }
+ }
+ // fall through is a failure:
+ fail(regex_constants::error_escape, m_position - m_base);
+ return false;
+ }
+ default:
+ result = *m_position;
+ break;
+ }
+ ++m_position;
+ return result;
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_backref()
+{
+ BOOST_ASSERT(m_position != m_end);
+ const charT* pc = m_position;
+ int i = this->m_traits.toi(pc, pc + 1, 10);
+ if((i == 0) || (((this->flags() & regbase::main_option_type) == regbase::perl_syntax_group) && (this->flags() & regbase::no_bk_refs)))
+ {
+ // not a backref at all but an octal escape sequence:
+ charT c = unescape_character();
+ this->append_literal(c);
+ }
+ else if((i > 0) && (this->m_backrefs & (1u << (i-1))))
+ {
+ m_position = pc;
+ re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_backref, sizeof(re_brace)));
+ pb->index = i;
+ }
+ else
+ {
+ fail(regex_constants::error_backref, m_position - m_end);
+ return false;
+ }
+ return true;
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_QE()
+{
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
+ //
+ // parse a \Q...\E sequence:
+ //
+ ++m_position; // skip the Q
+ const charT* start = m_position;
+ const charT* end;
+ do
+ {
+ while((m_position != m_end)
+ && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape))
+ ++m_position;
+ if(m_position == m_end)
+ {
+ // a \Q...\E sequence may terminate with the end of the expression:
+ end = m_position;
+ break;
+ }
+ if(++m_position == m_end) // skip the escape
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return false;
+ }
+ // check to see if it's a \E:
+ if(this->m_traits.escape_syntax_type(*m_position) == regex_constants::escape_type_E)
+ {
+ ++m_position;
+ end = m_position - 2;
+ break;
+ }
+ // otherwise go round again:
+ }while(true);
+ //
+ // now add all the character between the two escapes as literals:
+ //
+ while(start != end)
+ {
+ this->append_literal(*start);
+ ++start;
+ }
+ return true;
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::parse_perl_extension()
+{
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ //
+ // treat comments as a special case, as these
+ // are the only ones that don't start with a leading
+ // startmark state:
+ //
+ if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_hash)
+ {
+ while((m_position != m_end)
+ && (this->m_traits.syntax_type(*m_position++) != regex_constants::syntax_close_mark))
+ {}
+ return true;
+ }
+ //
+ // backup some state, and prepare the way:
+ //
+ int markid = 0;
+ std::ptrdiff_t jump_offset = 0;
+ re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_startmark, sizeof(re_brace)));
+ std::ptrdiff_t last_paren_start = this->getoffset(pb);
+ // back up insertion point for alternations, and set new point:
+ std::ptrdiff_t last_alt_point = m_alt_insert_point;
+ this->m_pdata->m_data.align();
+ m_alt_insert_point = this->m_pdata->m_data.size();
+ std::ptrdiff_t expected_alt_point = m_alt_insert_point;
+ bool restore_flags = true;
+ regex_constants::syntax_option_type old_flags = this->flags();
+ bool old_case_change = m_has_case_change;
+ m_has_case_change = false;
+ //
+ // select the actual extension used:
+ //
+ switch(this->m_traits.syntax_type(*m_position))
+ {
+ case regex_constants::syntax_colon:
+ //
+ // a non-capturing mark:
+ //
+ pb->index = markid = 0;
+ ++m_position;
+ break;
+ case regex_constants::syntax_equal:
+ pb->index = markid = -1;
+ ++m_position;
+ jump_offset = this->getoffset(this->append_state(syntax_element_jump, sizeof(re_jump)));
+ this->m_pdata->m_data.align();
+ m_alt_insert_point = this->m_pdata->m_data.size();
+ break;
+ case regex_constants::syntax_not:
+ pb->index = markid = -2;
+ ++m_position;
+ jump_offset = this->getoffset(this->append_state(syntax_element_jump, sizeof(re_jump)));
+ this->m_pdata->m_data.align();
+ m_alt_insert_point = this->m_pdata->m_data.size();
+ break;
+ case regex_constants::escape_type_left_word:
+ {
+ // a lookbehind assertion:
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ regex_constants::syntax_type t = this->m_traits.syntax_type(*m_position);
+ if(t == regex_constants::syntax_not)
+ pb->index = markid = -2;
+ else if(t == regex_constants::syntax_equal)
+ pb->index = markid = -1;
+ else
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ ++m_position;
+ jump_offset = this->getoffset(this->append_state(syntax_element_jump, sizeof(re_jump)));
+ this->append_state(syntax_element_backstep, sizeof(re_brace));
+ this->m_pdata->m_data.align();
+ m_alt_insert_point = this->m_pdata->m_data.size();
+ break;
+ }
+ case regex_constants::escape_type_right_word:
+ //
+ // an independent sub-expression:
+ //
+ pb->index = markid = -3;
+ ++m_position;
+ jump_offset = this->getoffset(this->append_state(syntax_element_jump, sizeof(re_jump)));
+ this->m_pdata->m_data.align();
+ m_alt_insert_point = this->m_pdata->m_data.size();
+ break;
+ case regex_constants::syntax_open_mark:
+ {
+ // a conditional expression:
+ pb->index = markid = -4;
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ int v = this->m_traits.toi(m_position, m_end, 10);
+ if(v > 0)
+ {
+ re_brace* br = static_cast<re_brace*>(this->append_state(syntax_element_assert_backref, sizeof(re_brace)));
+ br->index = v;
+ if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ }
+ else
+ {
+ // verify that we have a lookahead or lookbehind assert:
+ if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_question)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ if(this->m_traits.syntax_type(*m_position) == regex_constants::escape_type_left_word)
+ {
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ if((this->m_traits.syntax_type(*m_position) != regex_constants::syntax_equal)
+ && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_not))
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ m_position -= 3;
+ }
+ else
+ {
+ if((this->m_traits.syntax_type(*m_position) != regex_constants::syntax_equal)
+ && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_not))
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+ m_position -= 2;
+ }
+ }
+ break;
+ }
+ case regex_constants::syntax_close_mark:
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ default:
+ //
+ // lets assume that we have a (?imsx) group and try and parse it:
+ //
+ regex_constants::syntax_option_type opts = parse_options();
+ if(m_position == m_end)
+ return false;
+ // make a note of whether we have a case change:
+ m_has_case_change = ((opts & regbase::icase) != (this->flags() & regbase::icase));
+ pb->index = markid = 0;
+ if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_mark)
+ {
+ // update flags and carry on as normal:
+ this->flags(opts);
+ restore_flags = false;
+ old_case_change |= m_has_case_change; // defer end of scope by one ')'
+ }
+ else if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_colon)
+ {
+ // update flags and carry on until the matching ')' is found:
+ this->flags(opts);
+ ++m_position;
+ }
+ else
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
+
+ // finally append a case change state if we need it:
+ if(m_has_case_change)
+ {
+ static_cast<re_case*>(
+ this->append_state(syntax_element_toggle_case, sizeof(re_case))
+ )->icase = opts & regbase::icase;
+ }
+
+ }
+ //
+ // now recursively add more states, this will terminate when we get to a
+ // matching ')' :
+ //
+ parse_all();
+ //
+ // Unwind alternatives:
+ //
+ if(0 == unwind_alts(last_paren_start))
+ return false;
+ //
+ // we either have a ')' or we have run out of characters prematurely:
+ //
+ if(m_position == m_end)
+ {
+ this->fail(regex_constants::error_paren, ::boost::re_detail::distance(m_base, m_end));
+ return false;
+ }
+ BOOST_ASSERT(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_mark);
+ ++m_position;
+ //
+ // restore the flags:
+ //
+ if(restore_flags)
+ {
+ // append a case change state if we need it:
+ if(m_has_case_change)
+ {
+ static_cast<re_case*>(
+ this->append_state(syntax_element_toggle_case, sizeof(re_case))
+ )->icase = old_flags & regbase::icase;
+ }
+ this->flags(old_flags);
+ }
+ //
+ // set up the jump pointer if we have one:
+ //
+ if(jump_offset)
+ {
+ 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)
+ {
+ // Oops... we didn't have anything inside the assertion:
+ fail(regex_constants::error_empty, m_position - m_base);
+ return false;
+ }
+ }
+ //
+ // verify that if this is conditional expression, that we do have
+ // an alternative, if not add one:
+ //
+ if(markid == -4)
+ {
+ re_syntax_base* b = this->getaddress(expected_alt_point);
+ if(b->type != syntax_element_alt)
+ {
+ re_alt* alt = static_cast<re_alt*>(this->insert_state(expected_alt_point, syntax_element_alt, sizeof(re_alt)));
+ alt->alt.i = this->m_pdata->m_data.size() - this->getoffset(alt);
+ }
+ else if(this->getaddress(static_cast<re_alt*>(b)->alt.i, b)->type == syntax_element_alt)
+ {
+ fail(regex_constants::error_bad_pattern, m_position - m_base);
+ return false;
+ }
+ }
+ //
+ // append closing parenthesis state:
+ //
+ pb = static_cast<re_brace*>(this->append_state(syntax_element_endmark, sizeof(re_brace)));
+ pb->index = markid;
+ this->m_paren_start = last_paren_start;
+ //
+ // restore the alternate insertion point:
+ //
+ this->m_alt_insert_point = last_alt_point;
+ //
+ // and the case change data:
+ //
+ m_has_case_change = old_case_change;
+ return true;
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::add_emacs_code(bool negate)
+{
+ //
+ // parses an emacs style \sx or \Sx construct.
+ //
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_escape, m_position - m_base);
+ return false;
+ }
+ basic_char_set<charT, traits> char_set;
+ if(negate)
+ char_set.negate();
+
+ static const charT s_punct[5] = { 'p', 'u', 'n', 'c', 't', };
+
+ switch(*m_position)
+ {
+ case 's':
+ case ' ':
+ char_set.add_class(this->m_mask_space);
+ break;
+ case 'w':
+ char_set.add_class(this->m_word_mask);
+ break;
+ case '_':
+ char_set.add_single(digraph<charT>(charT('$')));
+ char_set.add_single(digraph<charT>(charT('&')));
+ char_set.add_single(digraph<charT>(charT('*')));
+ char_set.add_single(digraph<charT>(charT('+')));
+ char_set.add_single(digraph<charT>(charT('-')));
+ char_set.add_single(digraph<charT>(charT('_')));
+ char_set.add_single(digraph<charT>(charT('<')));
+ char_set.add_single(digraph<charT>(charT('>')));
+ break;
+ case '.':
+ char_set.add_class(this->m_traits.lookup_classname(s_punct, s_punct+5));
+ break;
+ case '(':
+ char_set.add_single(digraph<charT>(charT('(')));
+ char_set.add_single(digraph<charT>(charT('[')));
+ char_set.add_single(digraph<charT>(charT('{')));
+ break;
+ case ')':
+ char_set.add_single(digraph<charT>(charT(')')));
+ char_set.add_single(digraph<charT>(charT(']')));
+ char_set.add_single(digraph<charT>(charT('}')));
+ break;
+ case '"':
+ char_set.add_single(digraph<charT>(charT('"')));
+ char_set.add_single(digraph<charT>(charT('\'')));
+ char_set.add_single(digraph<charT>(charT('`')));
+ break;
+ case '\'':
+ char_set.add_single(digraph<charT>(charT('\'')));
+ char_set.add_single(digraph<charT>(charT(',')));
+ char_set.add_single(digraph<charT>(charT('#')));
+ break;
+ case '<':
+ char_set.add_single(digraph<charT>(charT(';')));
+ break;
+ case '>':
+ char_set.add_single(digraph<charT>(charT('\n')));
+ char_set.add_single(digraph<charT>(charT('\f')));
+ break;
+ default:
+ fail(regex_constants::error_ctype, m_position - m_base);
+ return false;
+ }
+ if(0 == this->append_set(char_set))
+ {
+ fail(regex_constants::error_ctype, m_position - m_base);
+ return false;
+ }
+ ++m_position;
+ return true;
+}
+
+template <class charT, class traits>
+regex_constants::syntax_option_type basic_regex_parser<charT, traits>::parse_options()
+{
+ // we have a (?imsx-imsx) group, convert it into a set of flags:
+ regex_constants::syntax_option_type f = this->flags();
+ bool breakout = false;
+ do
+ {
+ switch(*m_position)
+ {
+ case 's':
+ f |= regex_constants::mod_s;
+ f &= ~regex_constants::no_mod_s;
+ break;
+ case 'm':
+ f &= ~regex_constants::no_mod_m;
+ break;
+ case 'i':
+ f |= regex_constants::icase;
+ break;
+ case 'x':
+ f |= regex_constants::mod_x;
+ break;
+ default:
+ breakout = true;
+ continue;
+ }
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_paren, m_position - m_base);
+ return false;
+ }
+ }
+ while(!breakout);
+
+ if(*m_position == static_cast<charT>('-'))
+ {
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_paren, m_position - m_base);
+ return false;
+ }
+ do
+ {
+ switch(*m_position)
+ {
+ case 's':
+ f &= ~regex_constants::mod_s;
+ f |= regex_constants::no_mod_s;
+ break;
+ case 'm':
+ f |= regex_constants::no_mod_m;
+ break;
+ case 'i':
+ f &= ~regex_constants::icase;
+ break;
+ case 'x':
+ f &= ~regex_constants::mod_x;
+ break;
+ default:
+ breakout = true;
+ continue;
+ }
+ if(++m_position == m_end)
+ {
+ fail(regex_constants::error_paren, m_position - m_base);
+ return false;
+ }
+ }
+ while(!breakout);
+ }
+ return f;
+}
+
+template <class charT, class traits>
+bool basic_regex_parser<charT, traits>::unwind_alts(std::ptrdiff_t last_paren_start)
+{
+ //
+ // If we didn't actually add any states after the last
+ // alternative then that's an error:
+ //
+ if((this->m_alt_insert_point == static_cast<std::ptrdiff_t>(this->m_pdata->m_data.size()))
+ && m_alt_jumps.size() && (m_alt_jumps.back() > last_paren_start))
+ {
+ fail(regex_constants::error_empty, this->m_position - this->m_base);
+ return false;
+ }
+ //
+ // Fix up our alternatives:
+ //
+ while(m_alt_jumps.size() && (m_alt_jumps.back() > last_paren_start))
+ {
+ //
+ // fix up the jump to point to the end of the states
+ // that we've just added:
+ //
+ std::ptrdiff_t jump_offset = m_alt_jumps.back();
+ m_alt_jumps.pop_back();
+ this->m_pdata->m_data.align();
+ re_jump* jmp = static_cast<re_jump*>(this->getaddress(jump_offset));
+ BOOST_ASSERT(jmp->type == syntax_element_jump);
+ jmp->alt.i = this->m_pdata->m_data.size() - jump_offset;
+ }
+ return true;
+}
+
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
+} // namespace re_detail
+} // namespace boost
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif
--- /dev/null
+/*
+ *
+ * Copyright (c) 2004
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE c_regex_traits.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares regular expression traits class that wraps the global C locale.
+ */
+
+#ifndef BOOST_C_REGEX_TRAITS_HPP_INCLUDED
+#define BOOST_C_REGEX_TRAITS_HPP_INCLUDED
+
+#ifndef BOOST_REGEX_CONFIG_HPP
+#include <boost/regex/config.hpp>
+#endif
+#ifndef BOOST_REGEX_WORKAROUND_HPP
+#include <boost/regex/v4/regex_workaround.hpp>
+#endif
+
+#include <cctype>
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std{
+ using ::strlen; using ::tolower;
+}
+#endif
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost{
+
+template <class charT>
+struct c_regex_traits;
+
+template<>
+struct BOOST_REGEX_DECL c_regex_traits<char>
+{
+ c_regex_traits(){}
+ typedef char char_type;
+ typedef std::size_t size_type;
+ typedef std::string string_type;
+ struct locale_type{};
+ typedef boost::uint32_t char_class_type;
+
+ static size_type length(const char_type* p)
+ {
+ return (std::strlen)(p);
+ }
+
+ char translate(char c) const
+ {
+ return c;
+ }
+ char translate_nocase(char c) const
+ {
+ return static_cast<char>((std::tolower)(static_cast<unsigned char>(c)));
+ }
+
+ static string_type BOOST_REGEX_CALL transform(const char* p1, const char* p2);
+ static string_type BOOST_REGEX_CALL transform_primary(const char* p1, const char* p2);
+
+ static char_class_type BOOST_REGEX_CALL lookup_classname(const char* p1, const char* p2);
+ static string_type BOOST_REGEX_CALL lookup_collatename(const char* p1, const char* p2);
+
+ static bool BOOST_REGEX_CALL isctype(char, char_class_type);
+ static int BOOST_REGEX_CALL value(char, int);
+
+ locale_type imbue(locale_type l)
+ { return l; }
+ locale_type getloc()const
+ { return locale_type(); }
+
+private:
+ // this type is not copyable:
+ c_regex_traits(const c_regex_traits&);
+ c_regex_traits& operator=(const c_regex_traits&);
+};
+
+#ifndef BOOST_NO_WREGEX
+template<>
+struct BOOST_REGEX_DECL c_regex_traits<wchar_t>
+{
+ c_regex_traits(){}
+ typedef wchar_t char_type;
+ typedef std::size_t size_type;
+ typedef std::wstring string_type;
+ struct locale_type{};
+ typedef boost::uint32_t char_class_type;
+
+ static size_type length(const char_type* p)
+ {
+ return (std::wcslen)(p);
+ }
+
+ wchar_t translate(wchar_t c) const
+ {
+ return c;
+ }
+ wchar_t translate_nocase(wchar_t c) const
+ {
+ return (std::towlower)(c);
+ }
+
+ static string_type BOOST_REGEX_CALL transform(const wchar_t* p1, const wchar_t* p2);
+ static string_type BOOST_REGEX_CALL transform_primary(const wchar_t* p1, const wchar_t* p2);
+
+ static char_class_type BOOST_REGEX_CALL lookup_classname(const wchar_t* p1, const wchar_t* p2);
+ static string_type BOOST_REGEX_CALL lookup_collatename(const wchar_t* p1, const wchar_t* p2);
+
+ static bool BOOST_REGEX_CALL isctype(wchar_t, char_class_type);
+ static int BOOST_REGEX_CALL value(wchar_t, int);
+
+ locale_type imbue(locale_type l)
+ { return l; }
+ locale_type getloc()const
+ { return locale_type(); }
+
+private:
+ // this type is not copyable:
+ c_regex_traits(const c_regex_traits&);
+ c_regex_traits& operator=(const c_regex_traits&);
+};
+
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+//
+// Provide an unsigned short version as well, so the user can link to this
+// no matter whether they build with /Zc:wchar_t or not (MSVC specific).
+//
+template<>
+struct BOOST_REGEX_DECL c_regex_traits<unsigned short>
+{
+ c_regex_traits(){}
+ typedef unsigned short char_type;
+ typedef std::size_t size_type;
+ typedef std::basic_string<unsigned short> string_type;
+ struct locale_type{};
+ typedef boost::uint32_t char_class_type;
+
+ static size_type length(const char_type* p)
+ {
+ return (std::wcslen)((const wchar_t*)p);
+ }
+
+ unsigned short translate(unsigned short c) const
+ {
+ return c;
+ }
+ unsigned short translate_nocase(unsigned short c) const
+ {
+ return (std::towlower)((wchar_t)c);
+ }
+
+ static string_type BOOST_REGEX_CALL transform(const unsigned short* p1, const unsigned short* p2);
+ static string_type BOOST_REGEX_CALL transform_primary(const unsigned short* p1, const unsigned short* p2);
+
+ static char_class_type BOOST_REGEX_CALL lookup_classname(const unsigned short* p1, const unsigned short* p2);
+ static string_type BOOST_REGEX_CALL lookup_collatename(const unsigned short* p1, const unsigned short* p2);
+
+ static bool BOOST_REGEX_CALL isctype(unsigned short, char_class_type);
+ static int BOOST_REGEX_CALL value(unsigned short, int);
+
+ locale_type imbue(locale_type l)
+ { return l; }
+ locale_type getloc()const
+ { return locale_type(); }
+
+private:
+ // this type is not copyable:
+ c_regex_traits(const c_regex_traits&);
+ c_regex_traits& operator=(const c_regex_traits&);
+};
+
+#endif
+
+#endif // BOOST_NO_WREGEX
+
+}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif
+
+
+
/*
*
* Copyright (c) 2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
typedef unsigned int size_type;
typedef regex_traits<char> base_type;
- char BOOST_REGEX_CALL translate(char c, bool)const
- {
- return static_cast<const regex_traits<char>*>(this)->translate(c, true);
- }
};
#ifndef BOOST_NO_WREGEX
typedef unsigned int size_type;
typedef regex_traits<wchar_t> base_type;
- wchar_t BOOST_REGEX_CALL translate(wchar_t c, bool)const
- {
- return static_cast<const regex_traits<wchar_t>*>(this)->translate(c, true);
- }
- boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const wchar_t* first, const wchar_t* last)const
- {
- boost::uint_fast32_t result = static_cast<const regex_traits<wchar_t>*>(this)->lookup_classname(first, last);
- if((result & base_type::char_class_upper) == base_type::char_class_upper)
- result |= base_type::char_class_alpha;
- return result;
- }
};
#endif
} // namespace deprecated
--- /dev/null
+/*
+ *
+ * Copyright (c) 2004
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE cpp_regex_traits.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares regular expression traits class cpp_regex_traits.
+ */
+
+#ifndef BOOST_CPP_REGEX_TRAITS_HPP_INCLUDED
+#define BOOST_CPP_REGEX_TRAITS_HPP_INCLUDED
+
+#include <boost/config.hpp>
+
+#ifndef BOOST_NO_STD_LOCALE
+
+#ifndef BOOST_RE_PAT_EXCEPT_HPP
+#include <boost/regex/pattern_except.hpp>
+#endif
+#ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
+#include <boost/regex/v4/regex_traits_defaults.hpp>
+#endif
+#ifdef BOOST_HAS_THREADS
+#include <boost/regex/pending/static_mutex.hpp>
+#endif
+#ifndef BOOST_REGEX_PRIMARY_TRANSFORM
+#include <boost/regex/v4/primary_transform.hpp>
+#endif
+#ifndef BOOST_REGEX_OBJECT_CACHE_HPP
+#include <boost/regex/pending/object_cache.hpp>
+#endif
+
+#include <istream>
+#include <ios>
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4786)
+#endif
+
+namespace boost{
+
+//
+// forward declaration is needed by some compilers:
+//
+template <class charT>
+class cpp_regex_traits;
+
+namespace re_detail{
+
+//
+// class parser_buf:
+// acts as a stream buffer which wraps around a pair of pointers:
+//
+template <class charT,
+ class traits = ::std::char_traits<charT> >
+class parser_buf : public ::std::basic_streambuf<charT, traits>
+{
+ typedef ::std::basic_streambuf<charT, traits> base_type;
+ typedef typename base_type::int_type int_type;
+ typedef typename base_type::char_type char_type;
+ typedef typename base_type::pos_type pos_type;
+ typedef ::std::streamsize streamsize;
+ typedef typename base_type::off_type off_type;
+public:
+ parser_buf() : base_type() { setbuf(0, 0); }
+ const charT* getnext() { return this->gptr(); }
+protected:
+ std::basic_streambuf<charT, traits>* setbuf(char_type* s, streamsize n);
+ typename parser_buf<charT, traits>::pos_type seekpos(pos_type sp, ::std::ios_base::openmode which);
+ typename parser_buf<charT, traits>::pos_type seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which);
+private:
+ parser_buf& operator=(const parser_buf&);
+ parser_buf(const parser_buf&);
+};
+
+template<class charT, class traits>
+std::basic_streambuf<charT, traits>*
+parser_buf<charT, traits>::setbuf(char_type* s, streamsize n)
+{
+ this->setg(s, s, s + n);
+ return this;
+}
+
+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)
+{
+ 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)
+ {
+ case ::std::ios_base::beg:
+ if((off < 0) || (off > size))
+ return pos_type(off_type(-1));
+ else
+ this->setg(g, g + off, g + size);
+ break;
+ case ::std::ios_base::end:
+ if((off < 0) || (off > size))
+ return pos_type(off_type(-1));
+ else
+ this->setg(g, g + size - off, g + size);
+ break;
+ case ::std::ios_base::cur:
+ {
+ std::ptrdiff_t newpos = pos + off;
+ if((newpos < 0) || (newpos > size))
+ return pos_type(off_type(-1));
+ else
+ this->setg(g, g + newpos, g + size);
+ break;
+ }
+ default: ;
+ }
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4244)
+#endif
+ return static_cast<pos_type>(this->gptr() - this->eback());
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+}
+
+template<class charT, class traits>
+typename parser_buf<charT, traits>::pos_type
+parser_buf<charT, traits>::seekpos(pos_type sp, ::std::ios_base::openmode which)
+{
+ if(which & ::std::ios_base::out)
+ return pos_type(off_type(-1));
+ off_type size = static_cast<off_type>(this->egptr() - this->eback());
+ charT* g = this->eback();
+ if(off_type(sp) <= size)
+ {
+ this->setg(g, g + off_type(sp), g + size);
+ }
+ return pos_type(off_type(-1));
+}
+
+//
+// class cpp_regex_traits_base:
+// acts as a container for locale and the facets we are using.
+//
+template <class charT>
+struct cpp_regex_traits_base
+{
+ cpp_regex_traits_base(const std::locale& l)
+ { imbue(l); }
+ std::locale imbue(const std::locale& l);
+
+ std::locale m_locale;
+ std::ctype<charT> const* m_pctype;
+#ifndef BOOST_NO_STD_MESSAGES
+ std::messages<charT> const* m_pmessages;
+#endif
+ std::collate<charT> const* m_pcollate;
+
+ bool operator<(const cpp_regex_traits_base& b)const
+ {
+ if(m_pctype == b.m_pctype)
+ {
+#ifndef BOOST_NO_STD_MESSAGES
+ if(m_pmessages == b.m_pmessages)
+ {
+ }
+ return m_pmessages < b.m_pmessages;
+#else
+ return m_pcollate < b.m_pcollate;
+#endif
+ }
+ return m_pctype < b.m_pctype;
+ }
+ bool operator==(const cpp_regex_traits_base& b)const
+ {
+ return (m_pctype == b.m_pctype)
+#ifndef BOOST_NO_STD_MESSAGES
+ && (m_pmessages == b.m_pmessages)
+#endif
+ && (m_pcollate == b.m_pcollate);
+ }
+};
+
+template <class charT>
+std::locale cpp_regex_traits_base<charT>::imbue(const std::locale& l)
+{
+ std::locale result(m_locale);
+ m_locale = l;
+ m_pctype = &BOOST_USE_FACET(std::ctype<charT>, l);
+#ifndef BOOST_NO_STD_MESSAGES
+ m_pmessages = &BOOST_USE_FACET(std::messages<charT>, l);
+#endif
+ m_pcollate = &BOOST_USE_FACET(std::collate<charT>, l);
+ return result;
+}
+
+//
+// class cpp_regex_traits_char_layer:
+// implements methods that require specialisation for narrow characters:
+//
+template <class charT>
+class cpp_regex_traits_char_layer : public cpp_regex_traits_base<charT>
+{
+ typedef std::basic_string<charT> string_type;
+ typedef std::map<charT, regex_constants::syntax_type> map_type;
+ typedef typename map_type::const_iterator map_iterator_type;
+public:
+ cpp_regex_traits_char_layer(const std::locale& l)
+ : cpp_regex_traits_base<charT>(l)
+ {
+ init();
+ }
+ cpp_regex_traits_char_layer(const cpp_regex_traits_base<charT>& b)
+ : cpp_regex_traits_base<charT>(b)
+ {
+ init();
+ }
+ void init();
+
+ regex_constants::syntax_type syntax_type(charT c)const
+ {
+ map_iterator_type i = m_char_map.find(c);
+ return ((i == m_char_map.end()) ? 0 : i->second);
+ }
+ regex_constants::escape_syntax_type escape_syntax_type(charT c) const
+ {
+ map_iterator_type i = m_char_map.find(c);
+ if(i == m_char_map.end())
+ {
+ if(this->m_pctype->is(std::ctype_base::lower, c)) return regex_constants::escape_type_class;
+ if(this->m_pctype->is(std::ctype_base::upper, c)) return regex_constants::escape_type_not_class;
+ return 0;
+ }
+ return i->second;
+ }
+
+private:
+ string_type get_default_message(regex_constants::syntax_type);
+ // TODO: use a hash table when available!
+ map_type m_char_map;
+};
+
+template <class charT>
+void cpp_regex_traits_char_layer<charT>::init()
+{
+ // we need to start by initialising our syntax map so we know which
+ // character is used for which purpose:
+#ifndef BOOST_NO_STD_MESSAGES
+#ifndef __IBMCPP__
+ typename std::messages<charT>::catalog cat = static_cast<std::messages<char>::catalog>(-1);
+#else
+ typename std::messages<charT>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
+#endif
+ std::string cat_name(cpp_regex_traits<charT>::get_catalog_name());
+ if(cat_name.size())
+ {
+ cat = this->m_pmessages->open(
+ cat_name,
+ this->m_locale);
+ if((int)cat < 0)
+ {
+ std::string m("Unable to open message catalog: ");
+ std::runtime_error err(m + cat_name);
+ boost::re_detail::raise_runtime_error(err);
+ }
+ }
+ //
+ // if we have a valid catalog then load our messages:
+ //
+ if((int)cat >= 0)
+ {
+ try{
+ for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
+ {
+ string_type mss = this->m_pmessages->get(cat, 0, i, get_default_message(i));
+ for(typename string_type::size_type j = 0; j < mss.size(); ++j)
+ {
+ m_char_map[mss[j]] = i;
+ }
+ }
+ this->m_pmessages->close(cat);
+ }
+ catch(...)
+ {
+ this->m_pmessages->close(cat);
+ throw;
+ }
+ }
+ else
+ {
+#endif
+ for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
+ {
+ const char* ptr = get_default_syntax(i);
+ while(ptr && *ptr)
+ {
+ m_char_map[this->m_pctype->widen(*ptr)] = i;
+ ++ptr;
+ }
+ }
+#ifndef BOOST_NO_STD_MESSAGES
+ }
+#endif
+}
+
+template <class charT>
+typename cpp_regex_traits_char_layer<charT>::string_type
+ cpp_regex_traits_char_layer<charT>::get_default_message(regex_constants::syntax_type i)
+{
+ const char* ptr = get_default_syntax(i);
+ string_type result;
+ while(ptr && *ptr)
+ {
+ result.append(1, this->m_pctype->widen(*ptr));
+ ++ptr;
+ }
+ return result;
+}
+
+//
+// specialised version for narrow characters:
+//
+template <>
+class BOOST_REGEX_DECL cpp_regex_traits_char_layer<char> : public cpp_regex_traits_base<char>
+{
+ typedef std::string string_type;
+public:
+ cpp_regex_traits_char_layer(const std::locale& l)
+ : cpp_regex_traits_base<char>(l)
+ {
+ init();
+ }
+ cpp_regex_traits_char_layer(const cpp_regex_traits_base<char>& l)
+ : cpp_regex_traits_base<char>(l)
+ {
+ init();
+ }
+
+ regex_constants::syntax_type syntax_type(char c)const
+ {
+ return m_char_map[static_cast<unsigned char>(c)];
+ }
+ regex_constants::escape_syntax_type escape_syntax_type(char c) const
+ {
+ return m_char_map[static_cast<unsigned char>(c)];
+ }
+
+private:
+ regex_constants::syntax_type m_char_map[1u << CHAR_BIT];
+ void init();
+};
+
+#ifdef BOOST_REGEX_BUGGY_CTYPE_FACET
+enum
+{
+ char_class_space=1<<0,
+ char_class_print=1<<1,
+ char_class_cntrl=1<<2,
+ char_class_upper=1<<3,
+ char_class_lower=1<<4,
+ char_class_alpha=1<<5,
+ char_class_digit=1<<6,
+ char_class_punct=1<<7,
+ char_class_xdigit=1<<8,
+ char_class_alnum=char_class_alpha|char_class_digit,
+ char_class_graph=char_class_alnum|char_class_punct,
+ char_class_blank=1<<9,
+ char_class_word=1<<10,
+ char_class_unicode=1<<11
+};
+
+#endif
+
+//
+// class cpp_regex_traits_implementation:
+// provides pimpl implementation for cpp_regex_traits.
+//
+template <class charT>
+class cpp_regex_traits_implementation : public cpp_regex_traits_char_layer<charT>
+{
+public:
+ typedef typename cpp_regex_traits<charT>::char_class_type char_class_type;
+ typedef typename std::ctype<charT>::mask native_mask_type;
+#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
+ BOOST_STATIC_CONSTANT(char_class_type, mask_blank = 1u << 24);
+ BOOST_STATIC_CONSTANT(char_class_type, mask_word = 1u << 25);
+ BOOST_STATIC_CONSTANT(char_class_type, mask_unicode = 1u << 26);
+#endif
+
+ typedef std::basic_string<charT> string_type;
+ typedef charT char_type;
+ //cpp_regex_traits_implementation();
+ cpp_regex_traits_implementation(const std::locale& l)
+ : cpp_regex_traits_char_layer<charT>(l), m_is(&m_sbuf)
+ {
+ init();
+ }
+ cpp_regex_traits_implementation(const cpp_regex_traits_base<charT>& l)
+ : cpp_regex_traits_char_layer<charT>(l), m_is(&m_sbuf)
+ {
+ init();
+ }
+ std::string error_string(regex_constants::error_type n) const
+ {
+ if(!m_error_strings.empty())
+ {
+ std::map<int, std::string>::const_iterator p = m_error_strings.find(n);
+ return (p == m_error_strings.end()) ? std::string(get_default_error_string(n)) : p->second;
+ }
+ return get_default_error_string(n);
+ }
+ char_class_type lookup_classname(const charT* p1, const charT* p2) const
+ {
+ char_class_type result = lookup_classname_imp(p1, p2);
+ if(result == 0)
+ {
+ string_type temp(p1, p2);
+ this->m_pctype->tolower(&*temp.begin(), &*temp.begin() + temp.size());
+ result = lookup_classname_imp(&*temp.begin(), &*temp.begin() + temp.size());
+ }
+ return result;
+ }
+ string_type lookup_collatename(const charT* p1, const charT* p2) const;
+ string_type transform_primary(const charT* p1, const charT* p2) const;
+ string_type transform(const charT* p1, const charT* p2) const;
+ re_detail::parser_buf<charT> m_sbuf; // buffer for parsing numbers.
+ std::basic_istream<charT> m_is; // stream for parsing numbers.
+private:
+ std::map<int, std::string> m_error_strings; // error messages indexed by numberic ID
+ std::map<string_type, char_class_type> m_custom_class_names; // character class names
+ std::map<string_type, string_type> m_custom_collate_names; // collating element names
+ unsigned m_collate_type; // the form of the collation string
+ charT m_collate_delim; // the collation group delimiter
+ //
+ // helpers:
+ //
+ char_class_type lookup_classname_imp(const charT* p1, const charT* p2) const;
+ void init();
+#ifdef BOOST_REGEX_BUGGY_CTYPE_FACET
+public:
+ bool isctype(charT c, char_class_type m)const;
+#endif
+};
+
+#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
+#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;
+
+#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
+{
+ //
+ // PRECONDITIONS:
+ //
+ // A bug in gcc 3.2 (and maybe other versions as well) treats
+ // p1 as a null terminated string, for efficiency reasons
+ // we work around this elsewhere, but just assert here that
+ // we adhere to gcc's (buggy) preconditions...
+ //
+ BOOST_ASSERT(*p2 == 0);
+
+ string_type result;
+ //
+ // swallowing all exceptions here is a bad idea
+ // however at least one std lib will always throw
+ // std::bad_alloc for certain arguments...
+ //
+ try{
+ //
+ // What we do here depends upon the format of the sort key returned by
+ // sort key returned by this->transform:
+ //
+ switch(m_collate_type)
+ {
+ case sort_C:
+ case sort_unknown:
+ // the best we can do is translate to lower case, then get a regular sort key:
+ {
+ result.assign(p1, p2);
+ this->m_pctype->tolower(&*result.begin(), &*result.begin() + result.size());
+ result = this->m_pcollate->transform(&*result.begin(), &*result.begin() + result.size());
+ break;
+ }
+ case sort_fixed:
+ {
+ // get a regular sort key, and then truncate it:
+ result.assign(this->m_pcollate->transform(p1, p2));
+ result.erase(this->m_collate_delim);
+ break;
+ }
+ case sort_delim:
+ // get a regular sort key, and then truncate everything after the delim:
+ result.assign(this->m_pcollate->transform(p1, p2));
+ std::size_t i;
+ for(i = 0; i < result.size(); ++i)
+ {
+ if(result[i] == m_collate_delim)
+ break;
+ }
+ result.erase(i);
+ break;
+ }
+ }catch(...){}
+ while(result.size() && (charT(0) == *result.rbegin()))
+ result.erase(result.size() - 1);
+ if(result.empty())
+ {
+ // character is ignorable at the primary level:
+ result = string_type(1, charT(0));
+ }
+ return result;
+}
+
+template <class charT>
+typename cpp_regex_traits_implementation<charT>::string_type
+ cpp_regex_traits_implementation<charT>::transform(const charT* p1, const charT* p2) const
+{
+ //
+ // PRECONDITIONS:
+ //
+ // A bug in gcc 3.2 (and maybe other versions as well) treats
+ // p1 as a null terminated string, for efficiency reasons
+ // we work around this elsewhere, but just assert here that
+ // we adhere to gcc's (buggy) preconditions...
+ //
+ BOOST_ASSERT(*p2 == 0);
+ //
+ // swallowing all exceptions here is a bad idea
+ // however at least one std lib will always throw
+ // std::bad_alloc for certain arguments...
+ //
+ string_type result;
+ try{
+ result = this->m_pcollate->transform(p1, p2);
+ //
+ // Borland's STLPort version returns a NULL-terminated
+ // string that has garbage at the end - each call to
+ // std::collate<wchar_t>::transform returns a different string!
+ // So as a workaround, we'll truncate the string at the first NULL
+ // which _seems_ to work....
+#if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
+ result.erase(result.find(charT(0)));
+#else
+ //
+ // some implementations (Dinkumware) append unnecessary trailing \0's:
+ while(result.size() && (charT(0) == *result.rbegin()))
+ result.erase(result.size() - 1);
+#endif
+ BOOST_ASSERT(std::find(result.begin(), result.end(), charT(0)) == result.end());
+ }
+ catch(...)
+ {
+ }
+ return result;
+}
+
+
+template <class charT>
+typename cpp_regex_traits_implementation<charT>::string_type
+ cpp_regex_traits_implementation<charT>::lookup_collatename(const charT* p1, const charT* p2) const
+{
+ typedef typename std::map<string_type, string_type>::const_iterator iter_type;
+ if(m_custom_collate_names.size())
+ {
+ iter_type pos = m_custom_collate_names.find(string_type(p1, p2));
+ if(pos != m_custom_collate_names.end())
+ return pos->second;
+ }
+#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
+ && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\
+ && !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
+ std::string name(p1, p2);
+#else
+ std::string name;
+ const charT* p0 = p1;
+ while(p0 != p2)
+ name.append(1, char(*p0++));
+#endif
+ name = lookup_default_collate_name(name);
+#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
+ && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\
+ && !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)
+ if(name.size())
+ return string_type(name.begin(), name.end());
+#else
+ if(name.size())
+ {
+ string_type result;
+ typedef std::string::const_iterator iter;
+ iter b = name.begin();
+ iter e = name.end();
+ while(b != e)
+ result.append(1, charT(*b++));
+ return result;
+ }
+#endif
+ if(p2 - p1 == 1)
+ return string_type(1, *p1);
+ return string_type();
+}
+
+template <class charT>
+void cpp_regex_traits_implementation<charT>::init()
+{
+#ifndef BOOST_NO_STD_MESSAGES
+#ifndef __IBMCPP__
+ typename std::messages<charT>::catalog cat = static_cast<std::messages<char>::catalog>(-1);
+#else
+ typename std::messages<charT>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
+#endif
+ std::string cat_name(cpp_regex_traits<charT>::get_catalog_name());
+ if(cat_name.size())
+ {
+ cat = this->m_pmessages->open(
+ cat_name,
+ this->m_locale);
+ if((int)cat < 0)
+ {
+ std::string m("Unable to open message catalog: ");
+ std::runtime_error err(m + cat_name);
+ boost::re_detail::raise_runtime_error(err);
+ }
+ }
+ //
+ // if we have a valid catalog then load our messages:
+ //
+ if((int)cat >= 0)
+ {
+ //
+ // Error messages:
+ //
+ for(boost::regex_constants::error_type i = static_cast<boost::regex_constants::error_type>(0);
+ i <= boost::regex_constants::error_unknown;
+ i = static_cast<boost::regex_constants::error_type>(i + 1))
+ {
+ const char* p = get_default_error_string(i);
+ string_type default_message;
+ while(*p)
+ {
+ default_message.append(1, this->m_pctype->widen(*p));
+ ++p;
+ }
+ string_type s = this->m_pmessages->get(cat, 0, i+200, default_message);
+ std::string result;
+ for(std::string::size_type j = 0; j < s.size(); ++j)
+ {
+ result.append(1, this->m_pctype->narrow(s[j], 0));
+ }
+ m_error_strings[i] = result;
+ }
+ //
+ // Custom class names:
+ //
+#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
+ static const char_class_type masks[14] =
+ {
+ std::ctype<charT>::alnum,
+ std::ctype<charT>::alpha,
+ std::ctype<charT>::cntrl,
+ std::ctype<charT>::digit,
+ std::ctype<charT>::graph,
+ std::ctype<charT>::lower,
+ std::ctype<charT>::print,
+ std::ctype<charT>::punct,
+ std::ctype<charT>::space,
+ std::ctype<charT>::upper,
+ std::ctype<charT>::xdigit,
+ cpp_regex_traits_implementation<charT>::mask_blank,
+ cpp_regex_traits_implementation<charT>::mask_word,
+ cpp_regex_traits_implementation<charT>::mask_unicode,
+ };
+#else
+ static const char_class_type masks[14] =
+ {
+ ::boost::re_detail::char_class_alnum,
+ ::boost::re_detail::char_class_alpha,
+ ::boost::re_detail::char_class_cntrl,
+ ::boost::re_detail::char_class_digit,
+ ::boost::re_detail::char_class_graph,
+ ::boost::re_detail::char_class_lower,
+ ::boost::re_detail::char_class_print,
+ ::boost::re_detail::char_class_punct,
+ ::boost::re_detail::char_class_space,
+ ::boost::re_detail::char_class_upper,
+ ::boost::re_detail::char_class_xdigit,
+ ::boost::re_detail::char_class_blank,
+ ::boost::re_detail::char_class_word,
+ ::boost::re_detail::char_class_unicode,
+ };
+#endif
+ static const string_type null_string;
+ for(unsigned int j = 0; j <= 13; ++j)
+ {
+ string_type s(this->m_pmessages->get(cat, 0, j+300, null_string));
+ if(s.size())
+ this->m_custom_class_names[s] = masks[j];
+ }
+ }
+#endif
+ //
+ // get the collation format used by m_pcollate:
+ //
+ m_collate_type = re_detail::find_sort_syntax(this, &m_collate_delim);
+}
+
+template <class charT>
+typename cpp_regex_traits_implementation<charT>::char_class_type
+ cpp_regex_traits_implementation<charT>::lookup_classname_imp(const charT* p1, const charT* p2) const
+{
+#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
+ static const char_class_type masks[20] =
+ {
+ 0,
+ std::ctype<char>::alnum,
+ std::ctype<char>::alpha,
+ cpp_regex_traits_implementation<charT>::mask_blank,
+ std::ctype<char>::cntrl,
+ std::ctype<char>::digit,
+ std::ctype<char>::digit,
+ std::ctype<char>::graph,
+ std::ctype<char>::lower,
+ std::ctype<char>::lower,
+ std::ctype<char>::print,
+ std::ctype<char>::punct,
+ std::ctype<char>::space,
+ std::ctype<char>::space,
+ std::ctype<char>::upper,
+ cpp_regex_traits_implementation<charT>::mask_unicode,
+ std::ctype<char>::upper,
+ std::ctype<char>::alnum | cpp_regex_traits_implementation<charT>::mask_word,
+ std::ctype<char>::alnum | cpp_regex_traits_implementation<charT>::mask_word,
+ std::ctype<char>::xdigit,
+ };
+#else
+ static const char_class_type masks[20] =
+ {
+ 0,
+ ::boost::re_detail::char_class_alnum,
+ ::boost::re_detail::char_class_alpha,
+ ::boost::re_detail::char_class_blank,
+ ::boost::re_detail::char_class_cntrl,
+ ::boost::re_detail::char_class_digit,
+ ::boost::re_detail::char_class_digit,
+ ::boost::re_detail::char_class_graph,
+ ::boost::re_detail::char_class_lower,
+ ::boost::re_detail::char_class_lower,
+ ::boost::re_detail::char_class_print,
+ ::boost::re_detail::char_class_punct,
+ ::boost::re_detail::char_class_space,
+ ::boost::re_detail::char_class_space,
+ ::boost::re_detail::char_class_upper,
+ ::boost::re_detail::char_class_unicode,
+ ::boost::re_detail::char_class_upper,
+ ::boost::re_detail::char_class_alnum | ::boost::re_detail::char_class_word,
+ ::boost::re_detail::char_class_alnum | ::boost::re_detail::char_class_word,
+ ::boost::re_detail::char_class_xdigit,
+ };
+#endif
+ if(m_custom_class_names.size())
+ {
+ typedef typename std::map<std::basic_string<charT>, char_class_type>::const_iterator map_iter;
+ map_iter pos = m_custom_class_names.find(string_type(p1, p2));
+ if(pos != m_custom_class_names.end())
+ return pos->second;
+ }
+ std::size_t id = 1 + re_detail::get_default_class_id(p1, p2);
+ BOOST_ASSERT(id < sizeof(masks) / sizeof(masks[0]));
+ return masks[id];
+}
+
+#ifdef BOOST_REGEX_BUGGY_CTYPE_FACET
+template <class charT>
+bool cpp_regex_traits_implementation<charT>::isctype(const charT c, char_class_type mask) const
+{
+ return
+ ((mask & ::boost::re_detail::char_class_space) && (m_pctype->is(std::ctype<charT>::space, c)))
+ || ((mask & ::boost::re_detail::char_class_print) && (m_pctype->is(std::ctype<charT>::print, c)))
+ || ((mask & ::boost::re_detail::char_class_cntrl) && (m_pctype->is(std::ctype<charT>::cntrl, c)))
+ || ((mask & ::boost::re_detail::char_class_upper) && (m_pctype->is(std::ctype<charT>::upper, c)))
+ || ((mask & ::boost::re_detail::char_class_lower) && (m_pctype->is(std::ctype<charT>::lower, c)))
+ || ((mask & ::boost::re_detail::char_class_alpha) && (m_pctype->is(std::ctype<charT>::alpha, c)))
+ || ((mask & ::boost::re_detail::char_class_digit) && (m_pctype->is(std::ctype<charT>::digit, c)))
+ || ((mask & ::boost::re_detail::char_class_punct) && (m_pctype->is(std::ctype<charT>::punct, c)))
+ || ((mask & ::boost::re_detail::char_class_xdigit) && (m_pctype->is(std::ctype<charT>::xdigit, c)))
+ || ((mask & ::boost::re_detail::char_class_blank) && (m_pctype->is(std::ctype<charT>::space, c)) && !::boost::re_detail::is_separator(c))
+ || ((mask & ::boost::re_detail::char_class_word) && (c == '_'))
+ || ((mask & ::boost::re_detail::char_class_unicode) && ::boost::re_detail::is_extended(c));
+}
+#endif
+
+
+template <class charT>
+inline boost::shared_ptr<cpp_regex_traits_implementation<charT> > create_cpp_regex_traits(const std::locale& l BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(charT))
+{
+ cpp_regex_traits_base<charT> key(l);
+ return ::boost::object_cache<cpp_regex_traits_base<charT>, cpp_regex_traits_implementation<charT> >::get(key, 5);
+}
+
+} // re_detail
+
+template <class charT>
+class cpp_regex_traits
+{
+private:
+ typedef std::ctype<charT> ctype_type;
+public:
+ typedef charT char_type;
+ typedef std::size_t size_type;
+ typedef std::basic_string<char_type> string_type;
+ typedef std::locale locale_type;
+ typedef boost::uint_least32_t char_class_type;
+
+ struct boost_extensions_tag{};
+
+ cpp_regex_traits()
+ : m_pimpl(re_detail::create_cpp_regex_traits<charT>(std::locale()))
+ { }
+ static size_type length(const char_type* p)
+ {
+ return std::char_traits<charT>::length(p);
+ }
+ regex_constants::syntax_type syntax_type(charT c)const
+ {
+ return m_pimpl->syntax_type(c);
+ }
+ regex_constants::escape_syntax_type escape_syntax_type(charT c) const
+ {
+ return m_pimpl->escape_syntax_type(c);
+ }
+ charT translate(charT c) const
+ {
+ return c;
+ }
+ charT translate_nocase(charT c) const
+ {
+ return m_pimpl->m_pctype->tolower(c);
+ }
+ charT translate(charT c, bool icase) const
+ {
+ return icase ? m_pimpl->m_pctype->tolower(c) : c;
+ }
+ charT tolower(charT c) const
+ {
+ return m_pimpl->m_pctype->tolower(c);
+ }
+ charT toupper(charT c) const
+ {
+ return m_pimpl->m_pctype->toupper(c);
+ }
+ string_type transform(const charT* p1, const charT* p2) const
+ {
+ return m_pimpl->transform(p1, p2);
+ }
+ string_type transform_primary(const charT* p1, const charT* p2) const
+ {
+ return m_pimpl->transform_primary(p1, p2);
+ }
+ char_class_type lookup_classname(const charT* p1, const charT* p2) const
+ {
+ return m_pimpl->lookup_classname(p1, p2);
+ }
+ string_type lookup_collatename(const charT* p1, const charT* p2) const
+ {
+ return m_pimpl->lookup_collatename(p1, p2);
+ }
+ bool isctype(charT c, char_class_type f) const
+ {
+#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
+ typedef typename std::ctype<charT>::mask ctype_mask;
+
+ static const ctype_mask mask_base =
+ static_cast<ctype_mask>(
+ std::ctype<charT>::alnum
+ | std::ctype<charT>::alpha
+ | std::ctype<charT>::cntrl
+ | std::ctype<charT>::digit
+ | std::ctype<charT>::graph
+ | std::ctype<charT>::lower
+ | std::ctype<charT>::print
+ | std::ctype<charT>::punct
+ | std::ctype<charT>::space
+ | std::ctype<charT>::upper
+ | std::ctype<charT>::xdigit);
+
+ if((f & mask_base)
+ && (m_pimpl->m_pctype->is(
+ static_cast<ctype_mask>(f & mask_base), c)))
+ return true;
+ else if((f & re_detail::cpp_regex_traits_implementation<charT>::mask_unicode) && re_detail::is_extended(c))
+ return true;
+ else if((f & re_detail::cpp_regex_traits_implementation<charT>::mask_word) && (c == '_'))
+ return true;
+ else if((f & re_detail::cpp_regex_traits_implementation<charT>::mask_blank)
+ && m_pimpl->m_pctype->is(std::ctype<charT>::space, c)
+ && !re_detail::is_separator(c))
+ return true;
+ return false;
+#else
+ return m_pimpl->isctype(c, f);
+#endif
+ }
+ int toi(const charT*& p1, const charT* p2, int radix)const;
+ int value(charT c, int radix)const
+ {
+ const charT* pc = &c;
+ return toi(pc, pc + 1, radix);
+ }
+ locale_type imbue(locale_type l)
+ {
+ std::locale result(getloc());
+ m_pimpl = re_detail::create_cpp_regex_traits<charT>(l);
+ return result;
+ }
+ locale_type getloc()const
+ {
+ return m_pimpl->m_locale;
+ }
+ std::string error_string(regex_constants::error_type n) const
+ {
+ return m_pimpl->error_string(n);
+ }
+
+ //
+ // extension:
+ // set the name of the message catalog in use (defaults to "boost_regex").
+ //
+ static std::string catalog_name(const std::string& name);
+ static std::string get_catalog_name();
+
+private:
+ boost::shared_ptr<re_detail::cpp_regex_traits_implementation<charT> > m_pimpl;
+ //
+ // catalog name handler:
+ //
+ static std::string& get_catalog_name_inst();
+
+#ifdef BOOST_HAS_THREADS
+ static static_mutex& get_mutex_inst();
+#endif
+};
+
+
+template <class charT>
+int cpp_regex_traits<charT>::toi(const charT*& first, const charT* last, int radix)const
+{
+ // we do NOT want to parse any thousands separators inside the stream:
+ last = std::find(first, last, BOOST_USE_FACET(std::numpunct<charT>, m_pimpl->m_is.getloc()).thousands_sep());
+ m_pimpl->m_sbuf.pubsetbuf(const_cast<charT*>(static_cast<const charT*>(first)), static_cast<std::streamsize>(last-first));
+ m_pimpl->m_is.clear();
+ if(std::abs(radix) == 16) m_pimpl->m_is >> std::hex;
+ else if(std::abs(radix) == 8) m_pimpl->m_is >> std::oct;
+ else m_pimpl->m_is >> std::dec;
+ int val;
+ if(m_pimpl->m_is >> val)
+ {
+ first = first + ((last - first) - m_pimpl->m_sbuf.in_avail());
+ return val;
+ }
+ else
+ return -1;
+}
+
+template <class charT>
+std::string cpp_regex_traits<charT>::catalog_name(const std::string& name)
+{
+#ifdef BOOST_HAS_THREADS
+ static_mutex::scoped_lock lk(get_mutex_inst());
+#endif
+ std::string result(get_catalog_name_inst());
+ get_catalog_name_inst() = name;
+ return result;
+}
+
+template <class charT>
+std::string& cpp_regex_traits<charT>::get_catalog_name_inst()
+{
+ static std::string s_name;
+ return s_name;
+}
+
+template <class charT>
+std::string cpp_regex_traits<charT>::get_catalog_name()
+{
+#ifdef BOOST_HAS_THREADS
+ static_mutex::scoped_lock lk(get_mutex_inst());
+#endif
+ std::string result(get_catalog_name_inst());
+ return result;
+}
+
+#ifdef BOOST_HAS_THREADS
+template <class charT>
+static_mutex& cpp_regex_traits<charT>::get_mutex_inst()
+{
+ static static_mutex s_mutex = BOOST_STATIC_MUTEX_INIT;
+ return s_mutex;
+}
+#endif
+
+
+} // boost
+
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif
+
+#endif
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#include <boost/regex/config.hpp>
#endif
#include <boost/regex/v4/match_flags.hpp>
+#include <boost/regex/v4/error_type.hpp>
+
+#ifdef __cplusplus
+#include <cstddef>
+#else
+#include <stddef.h>
+#endif
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
typedef struct
{
unsigned int re_magic;
- unsigned int re_nsub; /* number of parenthesized subexpressions */
- const char* re_endp; /* end pointer for REG_PEND */
+#ifdef __cplusplus
+ std::size_t re_nsub; /* number of parenthesized subexpressions */
+#else
+ size_t re_nsub;
+#endif
+ const char* re_endp; /* end pointer for REG_PEND */
void* guts; /* none of your business :-) */
match_flag_type eflags; /* none of your business :-) */
} regex_tA;
typedef struct
{
unsigned int re_magic;
- unsigned int re_nsub; /* number of parenthesized subexpressions */
+#ifdef __cplusplus
+ std::size_t re_nsub; /* number of parenthesized subexpressions */
+#else
+ size_t re_nsub;
+#endif
const wchar_t* re_endp; /* end pointer for REG_PEND */
void* guts; /* none of your business :-) */
match_flag_type eflags; /* none of your business :-) */
REG_STARTEND = 00004
} reg_exec_flags;
+//
+// POSIX error codes:
+//
+typedef unsigned reg_error_t;
+typedef reg_error_t reg_errcode_t; // backwards compatibility
+
+static const reg_error_t REG_NOERROR = 0; /* Success. */
+static const reg_error_t REG_NOMATCH = 1; /* Didn't find a match (for regexec). */
+
+ /* POSIX regcomp return error codes. (In the order listed in the
+ standard.) */
+static const reg_error_t REG_BADPAT = 2; /* Invalid pattern. */
+static const reg_error_t REG_ECOLLATE = 3; /* Undefined collating element. */
+static const reg_error_t REG_ECTYPE = 4; /* Invalid character class name. */
+static const reg_error_t REG_EESCAPE = 5; /* Trailing backslash. */
+static const reg_error_t REG_ESUBREG = 6; /* Invalid back reference. */
+static const reg_error_t REG_EBRACK = 7; /* Unmatched left bracket. */
+static const reg_error_t REG_EPAREN = 8; /* Parenthesis imbalance. */
+static const reg_error_t REG_EBRACE = 9; /* Unmatched \{. */
+static const reg_error_t REG_BADBR = 10; /* Invalid contents of \{\}. */
+static const reg_error_t REG_ERANGE = 11; /* Invalid range end. */
+static const reg_error_t REG_ESPACE = 12; /* Ran out of memory. */
+static const reg_error_t REG_BADRPT = 13; /* No preceding re for repetition op. */
+static const reg_error_t REG_EEND = 14; /* unexpected end of expression */
+static const reg_error_t REG_ESIZE = 15; /* expression too big */
+static const reg_error_t REG_ERPAREN = 8; /* = REG_EPAREN : unmatched right parenthesis */
+static const reg_error_t REG_EMPTY = 17; /* empty expression */
+static const reg_error_t REG_E_MEMORY = 15; /* = REG_ESIZE : out of memory */
+static const reg_error_t REG_ECOMPLEXITY = 18; /* complexity too high */
+static const reg_error_t REG_ESTACK = 19; /* out of stack space */
+static const reg_error_t REG_E_UNKNOWN = 20; /* unknown error */
+static const reg_error_t REG_ENOSYS = 20; /* = REG_E_UNKNOWN : Reserved. */
+
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA*, const char*, int);
BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int, const regex_tA*, char*, regsize_t);
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA*, const char*, regsize_t, regmatch_t*, int);
#define regex_t regex_tA
#endif
-/* regerror() flags */
-typedef enum
-{
- REG_NOERROR = 0, /* Success. */
- REG_NOMATCH = 1, /* Didn't find a match (for regexec). */
-
- /* POSIX regcomp return error codes. (In the order listed in the
- standard.) */
- REG_BADPAT = 2, /* Invalid pattern. */
- REG_ECOLLATE = 3, /* Undefined collating element. */
- REG_ECTYPE = 4, /* Invalid character class name. */
- REG_EESCAPE = 5, /* Trailing backslash. */
- REG_ESUBREG = 6, /* Invalid back reference. */
- REG_EBRACK = 7, /* Unmatched left bracket. */
- REG_EPAREN = 8, /* Parenthesis imbalance. */
- REG_EBRACE = 9, /* Unmatched \{. */
- REG_BADBR = 10, /* Invalid contents of \{\}. */
- REG_ERANGE = 11, /* Invalid range end. */
- REG_ESPACE = 12, /* Ran out of memory. */
- REG_BADRPT = 13, /* No preceding re for repetition op. */
- REG_EEND = 14, /* unexpected end of expression */
- REG_ESIZE = 15, /* expression too big */
- REG_ERPAREN = 16, /* unmatched right parenthesis */
- REG_EMPTY = 17, /* empty expression */
- REG_E_MEMORY = REG_ESIZE, /* out of memory */
- REG_E_UNKNOWN = 18 /* unknown error */
-} reg_errcode_t;
-
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
} // namespace
#endif
-#if defined(__cplusplus)
//
// C++ high level wrapper goes here:
//
+#if defined(__cplusplus)
#include <string>
#include <vector>
namespace boost{
std::size_t Position(int i = 0)const;
std::size_t Length(int i = 0)const;
bool Matched(int i = 0)const;
- unsigned int Marks()const;
+ std::size_t Marks()const;
std::string What(int i = 0)const;
std::string operator[](int i)const { return What(i); }
-#ifdef __MINGW32__
- static const std::size_t npos = ~0u;
-#else
static const std::size_t npos;
-#endif
+
friend struct re_detail::pred1;
friend struct re_detail::pred2;
friend struct re_detail::pred3;
#endif
-#endif /* include guard */
+#endif // include guard
--- /dev/null
+/*
+ *
+ * Copyright (c) 2003-2005
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE error_type.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares regular expression error type enumerator.
+ */
+
+#ifndef BOOST_REGEX_ERROR_TYPE_HPP
+#define BOOST_REGEX_ERROR_TYPE_HPP
+
+#ifdef __cplusplus
+namespace boost{
+#endif
+
+#ifdef __cplusplus
+namespace regex_constants{
+
+enum error_type{
+
+ error_ok = 0, // not used
+ error_no_match = 1, // not used
+ error_bad_pattern = 2,
+ error_collate = 3,
+ error_ctype = 4,
+ error_escape = 5,
+ error_backref = 6,
+ error_brack = 7,
+ error_paren = 8,
+ error_brace = 9,
+ error_badbrace = 10,
+ error_range = 11,
+ error_space = 12,
+ error_badrepeat = 13,
+ error_end = 14, // not used
+ error_size = 15,
+ error_right_paren = 16, // not used
+ error_empty = 17,
+ error_complexity = 18,
+ error_stack = 19,
+ error_unknown = 20
+};
+
+}
+}
+#endif // __cplusplus
+
+#endif
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#ifndef BOOST_REGEX_CONFIG_HPP
#include <boost/regex/config.hpp>
#endif
+#include <boost/assert.hpp>
#ifndef BOOST_REGEX_NO_FILEITER
#elif defined(BOOST_REGEX_FI_POSIX_DIR)
+#include <cstddef>
#include <cstdio>
#include <cctype>
#include <iterator>
mapfile_iterator& operator = (const mapfile_iterator& i);
char operator* ()const
{
- assert(node >= file->_first);
- assert(node < file->_last);
+ BOOST_ASSERT(node >= file->_first);
+ BOOST_ASSERT(node < file->_last);
return file ? *(*node + sizeof(int) + offset) : char(0);
}
char operator[] (long off)const
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
# error "BOOST_REGEX_CHAR_T not defined"
#endif
+#ifndef BOOST_REGEX_TRAITS_T
+# define BOOST_REGEX_TRAITS_T , boost::regex_traits<BOOST_REGEX_CHAR_T >
+#endif
+
//
// what follows is compiler specific:
//
# pragma option push -Jgx
# endif
-template class BOOST_REGEX_DECL reg_expression< BOOST_REGEX_CHAR_T >;
+template class BOOST_REGEX_DECL basic_regex< BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >;
+template class BOOST_REGEX_DECL match_results< const BOOST_REGEX_CHAR_T* >;
+#ifndef BOOST_NO_STD_ALLOCATOR
+template class BOOST_REGEX_DECL ::boost::re_detail::perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >;
+#endif
# ifndef BOOST_REGEX_INSTANTIATE
# pragma option pop
# include BOOST_ABI_SUFFIX
#endif
-#elif (defined(BOOST_MSVC) && defined(_MSC_EXTENSIONS)) || defined(__GNUC__)
+#elif defined(BOOST_MSVC) || defined(__ICL)
# ifndef BOOST_REGEX_INSTANTIATE
-# define template extern template
+# ifdef __GNUC__
+# define template __extension__ extern template
+# else
+# define template extern template
+# endif
# endif
# ifdef BOOST_MSVC
# pragma warning(disable : 4251 4231 4660)
# endif
-template class BOOST_REGEX_DECL reg_expression< BOOST_REGEX_CHAR_T >;
+template class BOOST_REGEX_DECL basic_regex< BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >;
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+template class BOOST_REGEX_DECL match_results< const BOOST_REGEX_CHAR_T* >;
+#endif
+#ifndef BOOST_NO_STD_ALLOCATOR
+template class BOOST_REGEX_DECL ::boost::re_detail::perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >;
+#endif
+#if !(defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB <= 1))\
+ && !(defined(BOOST_INTEL_CXX_VERSION) && (BOOST_INTEL_CXX_VERSION <= 800))\
+ && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))\
+ && !defined(BOOST_REGEX_ICU_INSTANCES)
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+template class BOOST_REGEX_DECL match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >;
+#endif
+#ifndef BOOST_NO_STD_ALLOCATOR
+template class BOOST_REGEX_DECL ::boost::re_detail::perl_matcher< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >;
+#endif
+#endif
+
# ifdef BOOST_MSVC
# pragma warning(pop)
# undef template
# endif
+#elif (defined(__GNUC__) && (__GNUC__ >= 3))
+
+# ifndef BOOST_REGEX_INSTANTIATE
+# define template __extension__ extern template
+# endif
+
+#if !defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_REGEX_ICU_INSTANCES)
+namespace re_detail{
+template BOOST_REGEX_DECL
+std::locale cpp_regex_traits_base<BOOST_REGEX_CHAR_T>::imbue(const std::locale& l);
+
+template BOOST_REGEX_DECL
+cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::string_type
+ cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::transform_primary(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const;
+template BOOST_REGEX_DECL
+cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::string_type
+ cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::transform(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const;
+template BOOST_REGEX_DECL
+cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::string_type
+ cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::lookup_collatename(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const;
+template BOOST_REGEX_DECL
+void cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::init();
+template BOOST_REGEX_DECL
+cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::char_class_type
+ cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::lookup_classname_imp(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const;
+#ifdef BOOST_REGEX_BUGGY_CTYPE_FACET
+template BOOST_REGEX_DECL
+bool cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::isctype(const BOOST_REGEX_CHAR_T c, char_class_type mask) const;
+#endif
+} // namespace
+template BOOST_REGEX_DECL
+int cpp_regex_traits<BOOST_REGEX_CHAR_T>::toi(const BOOST_REGEX_CHAR_T*& first, const BOOST_REGEX_CHAR_T* last, int radix)const;
+template BOOST_REGEX_DECL
+std::string cpp_regex_traits<BOOST_REGEX_CHAR_T>::catalog_name(const std::string& name);
+template BOOST_REGEX_DECL
+std::string& cpp_regex_traits<BOOST_REGEX_CHAR_T>::get_catalog_name_inst();
+template BOOST_REGEX_DECL
+std::string cpp_regex_traits<BOOST_REGEX_CHAR_T>::get_catalog_name();
+#ifdef BOOST_HAS_THREADS
+template BOOST_REGEX_DECL
+static_mutex& cpp_regex_traits<BOOST_REGEX_CHAR_T>::get_mutex_inst();
+#endif
+#endif
+
+template BOOST_REGEX_DECL basic_regex<BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >&
+ basic_regex<BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >::do_assign(
+ const BOOST_REGEX_CHAR_T* p1,
+ const BOOST_REGEX_CHAR_T* p2,
+ flag_type f);
+template BOOST_REGEX_DECL basic_regex<BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >::locale_type BOOST_REGEX_CALL
+ basic_regex<BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >::imbue(locale_type l);
+
+template BOOST_REGEX_DECL void BOOST_REGEX_CALL
+ match_results<const BOOST_REGEX_CHAR_T*>::maybe_assign(
+ const match_results<const BOOST_REGEX_CHAR_T*>& m);
+
+namespace re_detail{
+template BOOST_REGEX_DECL void perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >::construct_init(
+ const basic_regex<BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >& e, match_flag_type f);
+template BOOST_REGEX_DECL bool perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >::match();
+template BOOST_REGEX_DECL bool perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >::find();
+} // namespace
+
+#if (defined(__GLIBCPP__) || defined(__GLIBCXX__)) \
+ && !defined(BOOST_REGEX_ICU_INSTANCES)\
+ && !defined(__SGI_STL_PORT)\
+ && !defined(_STLPORT_VERSION)
+// std:basic_string<>::const_iterator instances as well:
+template BOOST_REGEX_DECL void BOOST_REGEX_CALL
+ match_results<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator>::maybe_assign(
+ const match_results<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator>& m);
+
+namespace re_detail{
+template BOOST_REGEX_DECL void perl_matcher<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >::construct_init(
+ const basic_regex<BOOST_REGEX_CHAR_T>& e, match_flag_type f);
+template BOOST_REGEX_DECL bool perl_matcher<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >::match();
+template BOOST_REGEX_DECL bool perl_matcher<std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >::find();
+} // namespace
+#endif
+
+# ifdef template
+# undef template
+# endif
+
+
#endif
} // namespace boost
+
/*
*
* Copyright (c) 2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
struct regex_iterator_traits<wchar_t*> : pointer_iterator_traits<wchar_t>{};
template<>
struct regex_iterator_traits<const wchar_t*> : const_pointer_iterator_traits<wchar_t>{};
+//
+// the follwoing are needed for ICU support:
+//
+template<>
+struct regex_iterator_traits<unsigned char*> : pointer_iterator_traits<char>{};
+template<>
+struct regex_iterator_traits<const unsigned char*> : const_pointer_iterator_traits<char>{};
+template<>
+struct regex_iterator_traits<int*> : pointer_iterator_traits<int>{};
+template<>
+struct regex_iterator_traits<const int*> : const_pointer_iterator_traits<int>{};
+
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+template<>
+struct regex_iterator_traits<unsigned short*> : pointer_iterator_traits<unsigned short>{};
+template<>
+struct regex_iterator_traits<const unsigned short*> : const_pointer_iterator_traits<unsigned short>{};
+#endif
#if defined(__SGI_STL_PORT) && defined(__STL_DEBUG)
template<>
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
# include <boost/cstdint.hpp>
#endif
+#include <boost/detail/workaround.hpp>
#ifdef __cplusplus
-#include <boost/detail/workaround.hpp>
namespace boost{
namespace regex_constants{
-#else
-#define BOOST_WORKAROUND(x, y) 1
#endif
typedef enum _match_flags
{
match_default = 0,
- match_not_bol = 1, /* first is not start of line*/
- match_not_eol = match_not_bol << 1, /* last is not end of line*/
- match_not_bob = match_not_eol << 1, /* first is not start of buffer*/
- match_not_eob = match_not_bob << 1, /* last is not end of buffer*/
- match_not_bow = match_not_eob << 1, /* first is not start of word*/
- match_not_eow = match_not_bow << 1, /* last is not end of word*/
- match_not_dot_newline = match_not_eow << 1, /* \n is not matched by '.'*/
- match_not_dot_null = match_not_dot_newline << 1, /* '\0' is not matched by '.'*/
- match_prev_avail = match_not_dot_null << 1, /* *--first is a valid expression*/
- match_init = match_prev_avail << 1, /* internal use*/
- match_any = match_init << 1, /* don't care what we match*/
- match_not_null = match_any << 1, /* string can't be null*/
- match_continuous = match_not_null << 1, /* each grep match must continue from*/
- /* uninterupted from the previous one*/
- match_partial = match_continuous << 1, /* find partial matches*/
-
- match_stop = match_partial << 1, /* stop after first match (grep) V3 only*/
- match_not_initial_null = match_stop, /* don't match initial null, V4 only*/
- match_all = match_stop << 1, /* must find the whole of input even if match_any is set*/
- match_perl = match_all << 1, /* Use perl matching rules*/
- match_posix = match_perl << 1, /* Use POSIX matching rules*/
- match_nosubs = match_posix << 1, /* don't trap marked subs*/
- match_extra = match_nosubs << 1, /* include full capture information for repeated captures*/
- match_single_line = match_extra << 1, /* treat text as single line and ignor any \n's when matching ^ and $.*/
- match_unused1 = match_single_line << 1, /* unused*/
- match_unused2 = match_unused1 << 1, /* unused*/
- match_unused3 = match_unused2 << 1, /* unused*/
+ match_not_bol = 1, // first is not start of line
+ match_not_eol = match_not_bol << 1, // last is not end of line
+ match_not_bob = match_not_eol << 1, // first is not start of buffer
+ match_not_eob = match_not_bob << 1, // last is not end of buffer
+ match_not_bow = match_not_eob << 1, // first is not start of word
+ match_not_eow = match_not_bow << 1, // last is not end of word
+ match_not_dot_newline = match_not_eow << 1, // \n is not matched by '.'
+ match_not_dot_null = match_not_dot_newline << 1, // '\0' is not matched by '.'
+ match_prev_avail = match_not_dot_null << 1, // *--first is a valid expression
+ match_init = match_prev_avail << 1, // internal use
+ match_any = match_init << 1, // don't care what we match
+ match_not_null = match_any << 1, // string can't be null
+ match_continuous = match_not_null << 1, // each grep match must continue from
+ // uninterupted from the previous one
+ match_partial = match_continuous << 1, // find partial matches
+
+ match_stop = match_partial << 1, // stop after first match (grep) V3 only
+ match_not_initial_null = match_stop, // don't match initial null, V4 only
+ match_all = match_stop << 1, // must find the whole of input even if match_any is set
+ match_perl = match_all << 1, // Use perl matching rules
+ match_posix = match_perl << 1, // Use POSIX matching rules
+ match_nosubs = match_posix << 1, // don't trap marked subs
+ match_extra = match_nosubs << 1, // include full capture information for repeated captures
+ match_single_line = match_extra << 1, // treat text as single line and ignor any \n's when matching ^ and $.
+ match_unused1 = match_single_line << 1, // unused
+ match_unused2 = match_unused1 << 1, // unused
+ match_unused3 = match_unused2 << 1, // unused
match_max = match_unused3,
- format_perl = 0, /* perl style replacement*/
- format_default = 0, /* ditto.*/
- format_sed = match_max << 1, /* sed style replacement.*/
- format_all = format_sed << 1, /* enable all extentions to sytax.*/
- format_no_copy = format_all << 1, /* don't copy non-matching segments.*/
- format_first_only = format_no_copy << 1, /* Only replace first occurance.*/
- format_is_if = format_first_only << 1 /* internal use only.*/
+ format_perl = 0, // perl style replacement
+ format_default = 0, // ditto.
+ format_sed = match_max << 1, // sed style replacement.
+ format_all = format_sed << 1, // enable all extentions to sytax.
+ format_no_copy = format_all << 1, // don't copy non-matching segments.
+ format_first_only = format_no_copy << 1, // Only replace first occurance.
+ format_is_if = format_first_only << 1, // internal use only.
+ format_literal = format_is_if << 1 // treat string as a literal
} match_flags;
-#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) || defined(__SUNPRO_CC)
+#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
typedef unsigned long match_flag_type;
#else
typedef match_flags match_flag_type;
inline match_flags operator~(match_flags m1)
{ return static_cast<match_flags>(~static_cast<boost::int32_t>(m1)); }
inline match_flags& operator&=(match_flags& m1, match_flags m2)
-{ m1 = static_cast<match_flags>(m1&m2); return m1; }
+{ m1 = m1&m2; return m1; }
inline match_flags& operator|=(match_flags& m1, match_flags m2)
-{ m1 = static_cast<match_flags>(m1|m2); return m1; }
+{ m1 = m1|m2; return m1; }
inline match_flags& operator^=(match_flags& m1, match_flags m2)
-{ m1 = static_cast<match_flags>(m1^m2); return m1; }
+{ m1 = m1^m2; return m1; }
#endif
#endif
//using regex_constants::format_is_if;
} // namespace boost
-#endif /* __cplusplus */
-#endif /* include guard */
+#endif // __cplusplus
+#endif // include guard
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#endif
namespace boost{
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable : 4251 4231 4660)
+#endif
-template <class BidiIterator
- , class Allocator = BOOST_DEFAULT_ALLOCATOR(sub_match<BidiIterator> )
- >
+template <class BidiIterator, class Allocator>
class match_results
{
private:
typedef typename vector_type::const_iterator const_iterator;
typedef const_iterator iterator;
typedef typename re_detail::regex_iterator_traits<
- BidiIterator>::difference_type difference_type;
+ BidiIterator>::difference_type difference_type;
typedef typename Allocator::size_type size_type;
typedef Allocator allocator_type;
typedef typename re_detail::regex_iterator_traits<
- BidiIterator>::value_type char_type;
+ BidiIterator>::value_type char_type;
typedef std::basic_string<char_type> string_type;
// construct/copy/destroy:
// size:
size_type size() const
- { return (m_subs.size() >= 2) ? m_subs.size() - 2 : 0; }
+ { return empty() ? 0 : m_subs.size() - 2; }
size_type max_size() const
{ return m_subs.max_size(); }
bool empty() const
const sub_match<BidiIterator>& s = m_subs[sub];
if(s.matched)
{
- return boost::re_detail::distance((BidiIterator)(m_base), (BidiIterator)(s.first));
+ return ::boost::re_detail::distance((BidiIterator)(m_base), (BidiIterator)(s.first));
}
}
return ~static_cast<difference_type>(0);
const sub_match<BidiIterator>& s = m_subs[sub];
if(s.matched)
{
- result = s;
+ result = s.str();
}
}
return result;
}
const_iterator begin() const
{
- return (m_subs.size() >= 2) ? (m_subs.begin() + 2) : m_subs.end();
+ return (m_subs.size() > 2) ? (m_subs.begin() + 2) : m_subs.end();
}
const_iterator end() const
{
const string_type& fmt,
match_flag_type flags = format_default) const
{
- return regex_format(out, *this, fmt, flags);
+ re_detail::trivial_format_traits<char_type> traits;
+ return re_detail::regex_format_imp(out, *this, fmt.data(), fmt.data() + fmt.size(), flags, traits);
}
string_type format(const string_type& fmt,
match_flag_type flags = format_default) const
{
- return regex_format(*this, fmt, flags);
+ string_type result;
+ re_detail::string_out_iterator<string_type> i(result);
+ re_detail::trivial_format_traits<char_type> traits;
+ re_detail::regex_format_imp(i, *this, fmt.data(), fmt.data() + fmt.size(), flags, traits);
+ return result;
+ }
+ // format with locale:
+ template <class OutputIterator, class RegexT>
+ OutputIterator format(OutputIterator out,
+ const string_type& fmt,
+ match_flag_type flags,
+ const RegexT& re) const
+ {
+ return ::boost::re_detail::regex_format_imp(out, *this, fmt.data(), fmt.data() + fmt.size(), flags, re.get_traits());
+ }
+ template <class RegexT>
+ string_type format(const string_type& fmt,
+ match_flag_type flags,
+ const RegexT& re) const
+ {
+ string_type result;
+ re_detail::string_out_iterator<string_type> i(result);
+ ::boost::re_detail::regex_format_imp(i, *this, fmt.data(), fmt.data() + fmt.size(), flags, re.get_traits());
+ return result;
}
allocator_type get_allocator() const
// private access functions:
void BOOST_REGEX_CALL set_second(BidiIterator i)
{
- assert(m_subs.size() > 2);
+ BOOST_ASSERT(m_subs.size() > 2);
m_subs[2].second = i;
m_subs[2].matched = true;
m_subs[0].first = i;
void BOOST_REGEX_CALL set_second(BidiIterator i, size_type pos, bool m = true)
{
pos += 2;
- assert(m_subs.size() > pos);
+ BOOST_ASSERT(m_subs.size() > pos);
m_subs[pos].second = i;
m_subs[pos].matched = m;
if(pos == 2)
{
m_base = pos;
}
+ BidiIterator base()const
+ {
+ return m_base;
+ }
void BOOST_REGEX_CALL set_first(BidiIterator i)
{
// set up prefix:
}
void BOOST_REGEX_CALL set_first(BidiIterator i, size_type pos)
{
- assert(pos+2 < m_subs.size());
+ BOOST_ASSERT(pos+2 < m_subs.size());
if(pos)
m_subs[pos+2].first = i;
else
const_iterator p1, p2;
p1 = begin();
p2 = m.begin();
- BidiIterator base = (*this)[-1].first;
- std::size_t len1 = 0;
- std::size_t len2 = 0;
- std::size_t base1 = 0;
- std::size_t base2 = 0;
+ //
+ // Distances are measured from the start of *this* match, unless this isn't
+ // a valid match in which case we use the start of the whole sequence. Note that
+ // no subsequent match-candidate can ever be to the left of the first match found.
+ // This ensures that when we are using bidirectional iterators, that distances
+ // measured are as short as possible, and therefore as efficient as possible
+ // to compute. Finally note that we don't use the "matched" data member to test
+ // whether a sub-expression is a valid match, because partial matches set this
+ // to false for sub-expression 0.
+ //
+ BidiIterator end = this->suffix().second;
+ BidiIterator base = (p1->first == end) ? this->prefix().first : (*this)[0].first;
+ difference_type len1 = 0;
+ difference_type len2 = 0;
+ difference_type base1 = 0;
+ difference_type base2 = 0;
std::size_t i;
- for(i = 0; i < size(); ++i)
+ for(i = 0; i < size(); ++i, ++p1, ++p2)
{
//
- // leftmost takes priority over longest:
- base1 = boost::re_detail::distance(base, p1->first);
- base2 = boost::re_detail::distance(base, p2->first);
+ // Leftmost takes priority over longest; handle special cases
+ // where distances need not be computed first (an optimisation
+ // for bidirectional iterators: ensure that we don't accidently
+ // compute the length of the whole sequence, as this can be really
+ // expensive).
+ //
+ if(p1->first == end)
+ {
+ if(p2->first != end)
+ {
+ // p2 must be better than p1, and no need to calculate
+ // actual distances:
+ base1 = 1;
+ base2 = 0;
+ break;
+ }
+ else
+ {
+ // *p1 and *p2 are either unmatched or match end-of sequence,
+ // either way no need to calculate distances:
+ if((p1->matched == false) && (p2->matched == true))
+ break;
+ if((p1->matched == true) && (p2->matched == false))
+ return;
+ continue;
+ }
+ }
+ else if(p2->first == end)
+ {
+ // p1 better than p2, and no need to calculate distances:
+ return;
+ }
+ base1 = ::boost::re_detail::distance(base, p1->first);
+ base2 = ::boost::re_detail::distance(base, p2->first);
+ BOOST_ASSERT(base1 >= 0);
+ BOOST_ASSERT(base2 >= 0);
if(base1 < base2) return;
if(base2 < base1) break;
- len1 = boost::re_detail::distance((BidiIterator)p1->first, (BidiIterator)p1->second);
- len2 = boost::re_detail::distance((BidiIterator)p2->first, (BidiIterator)p2->second);
+ len1 = ::boost::re_detail::distance((BidiIterator)p1->first, (BidiIterator)p1->second);
+ len2 = ::boost::re_detail::distance((BidiIterator)p2->first, (BidiIterator)p2->second);
+ BOOST_ASSERT(len1 >= 0);
+ BOOST_ASSERT(len2 >= 0);
if((len1 != len2) || ((p1->matched == false) && (p2->matched == true)))
break;
if((p1->matched == true) && (p2->matched == false))
return;
- ++p1;
- ++p2;
}
if(i == size())
return;
}
#endif
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
} // namespace boost
#ifdef BOOST_HAS_ABI_HEADERS
/*
* Copyright (c) 2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#define BOOST_REGEX_V4_MEM_BLOCK_CACHE_HPP
#include <new>
-#include <boost/regex/v4/regex_synch.hpp>
+#ifdef BOOST_HAS_THREADS
+#include <boost/regex/pending/static_mutex.hpp>
+#endif
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
// this member has to be statically initialsed:
mem_block_node* next;
unsigned cached_blocks;
+#ifdef BOOST_HAS_THREADS
+ boost::static_mutex mut;
+#endif
~mem_block_cache()
{
void* get()
{
#ifdef BOOST_HAS_THREADS
- re_detail::cs_guard g(*re_detail::p_re_lock);
+ boost::static_mutex::scoped_lock g(mut);
#endif
if(next)
{
void put(void* p)
{
#ifdef BOOST_HAS_THREADS
- re_detail::cs_guard g(*re_detail::p_re_lock);
+ boost::static_mutex::scoped_lock g(mut);
#endif
if(cached_blocks >= BOOST_REGEX_MAX_CACHE_BLOCKS)
{
/*
*
* Copyright (c) 2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
//
// error checking API:
//
-BOOST_REGEX_DECL void BOOST_REGEX_CALL verify_options(boost::regex::flag_type ef, match_flag_type mf);
+BOOST_REGEX_DECL void BOOST_REGEX_CALL verify_options(boost::regex_constants::syntax_option_type ef, match_flag_type mf);
+//
+// function can_start:
+//
+template <class charT>
+bool can_start(charT c, const unsigned char* map, unsigned char mask)
+{
+ return ((c < static_cast<charT>(0)) ? true : ((c >= static_cast<charT>(1 << CHAR_BIT)) ? true : map[c] & mask));
+}
+inline bool can_start(char c, const unsigned char* map, unsigned char mask)
+{
+ return map[(unsigned char)c] & mask;
+}
+inline bool can_start(signed char c, const unsigned char* map, unsigned char mask)
+{
+ return map[(unsigned char)c] & mask;
+}
+inline bool can_start(unsigned char c, const unsigned char* map, unsigned char mask)
+{
+ return map[c] & mask;
+}
+inline bool can_start(unsigned short c, const unsigned char* map, unsigned char mask)
+{
+ return ((c >= (1 << CHAR_BIT)) ? true : map[c] & mask);
+}
+#if !defined(__HP_aCC)
+#if defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
+inline bool can_start(wchar_t c, const unsigned char* map, unsigned char mask)
+{
+ return ((c >= (1 << CHAR_BIT)) ? true : map[c] & mask);
+}
+#endif
+#endif
//
// which succeeds when it should not.
//
#ifndef _RWSTD_VER
-# define STR_COMP(s,p) s.compare(p)
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310)
+template <class C, class T, class A>
+inline int string_compare(const std::basic_string<C,T,A>& s, const C* p)
+{
+ if(0 == *p)
+ {
+ if(s.empty() || ((s.size() == 1) && (s[0] == 0)))
+ return 0;
+ }
+ return s.compare(p);
+}
+#endif
#else
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310)
template <class C, class T, class A>
inline int string_compare(const std::basic_string<C,T,A>& s, const C* p)
-{ return s.compare(p); }
+{
+ if(0 == *p)
+ {
+ if(s.empty() || ((s.size() == 1) && (s[0] == 0)))
+ return 0;
+ }
+ return s.compare(p);
+}
+#endif
inline int string_compare(const std::string& s, const char* p)
{ return std::strcmp(s.c_str(), p); }
# ifndef BOOST_NO_WREGEX
inline int string_compare(const std::wstring& s, const wchar_t* p)
{ return std::wcscmp(s.c_str(), p); }
#endif
-# define STR_COMP(s,p) string_compare(s,p)
#endif
+template <class Seq, class C>
+inline int string_compare(const Seq& s, const C* p)
+{
+ std::size_t i = 0;
+ while((i < s.size()) && (p[i] == s[i]))
+ {
+ ++i;
+ }
+ return (i == s.size()) ? -p[i] : s[i] - p[i];
+}
+# define STR_COMP(s,p) string_compare(s,p)
template<class charT>
inline const charT* re_skip_past_null(const charT* p)
{
- while (*p != 0) ++p;
+ while (*p != static_cast<charT>(0)) ++p;
return ++p;
}
-template <class iterator, class charT, class traits_type, class Allocator>
+template <class iterator, class charT, class traits_type, class char_classT>
iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
iterator last,
- const re_set_long* set_,
- const reg_expression<charT, traits_type, Allocator>& e)
+ const re_set_long<char_classT>* set_,
+ const regex_data<charT, traits_type>& e, bool icase)
{
const charT* p = reinterpret_cast<const charT*>(set_+1);
iterator ptr;
unsigned int i;
- bool icase = e.flags() & regex_constants::icase;
+ //bool icase = e.m_flags & regex_constants::icase;
if(next == last) return next;
typedef typename traits_type::string_type traits_string_type;
- const traits_type& traits_inst = e.get_traits();
+ const ::boost::regex_traits_wrapper<traits_type>& traits_inst = *(e.m_ptraits);
// dwa 9/13/00 suppress incorrect MSVC warning - it claims this is never
// referenced
for(i = 0; i < set_->csingles; ++i)
{
ptr = next;
- if(*p == 0)
+ if(*p == static_cast<charT>(0))
{
// treat null string as special case:
if(traits_inst.translate(*ptr, icase) != *p)
{
- while(*p == 0)++p;
+ while(*p == static_cast<charT>(0))++p;
continue;
}
return set_->isnot ? next : (ptr == next) ? ++next : ptr;
++ptr;
}
- if(*p == 0) // if null we've matched
+ if(*p == static_cast<charT>(0)) // if null we've matched
return set_->isnot ? next : (ptr == next) ? ++next : ptr;
p = re_skip_past_null(p); // skip null
if(set_->cranges || set_->cequivalents)
{
- traits_string_type s2(1, col);
traits_string_type s1;
//
// try and match a range, NB only a single character can match
if(set_->cranges)
{
- if((e.flags() & regex_constants::collate) == 0)
- s1 = s2;
+ if((e.m_flags & regex_constants::collate) == 0)
+ s1.assign(1, col);
else
- traits_inst.transform(s1, s2);
+ {
+ charT a[2] = { col, charT(0), };
+ s1 = traits_inst.transform(a, a + 1);
+ }
for(i = 0; i < set_->cranges; ++i)
{
- if(STR_COMP(s1, p) <= 0)
+ if(STR_COMP(s1, p) >= 0)
{
- while(*p)++p;
+ do{ ++p; }while(*p);
++p;
- if(STR_COMP(s1, p) >= 0)
+ if(STR_COMP(s1, p) <= 0)
return set_->isnot ? next : ++next;
}
else
{
// skip first string
- while(*p)++p;
+ do{ ++p; }while(*p);
++p;
}
// skip second string
- while(*p)++p;
+ do{ ++p; }while(*p);
++p;
}
}
// try and match an equivalence class, NB only a single character can match
if(set_->cequivalents)
{
- traits_inst.transform_primary(s1, s2);
+ charT a[2] = { col, charT(0), };
+ s1 = traits_inst.transform_primary(a, a +1);
for(i = 0; i < set_->cequivalents; ++i)
{
if(STR_COMP(s1, p) == 0)
return set_->isnot ? next : ++next;
// skip string
- while(*p)++p;
+ do{ ++p; }while(*p);
++p;
}
}
}
- if(traits_inst.is_class(col, set_->cclasses) == true)
+ if(traits_inst.isctype(col, set_->cclasses) == true)
+ return set_->isnot ? next : ++next;
+ if((set_->cnclasses != 0) && (traits_inst.isctype(col, set_->cnclasses) == false))
return set_->isnot ? next : ++next;
return set_->isnot ? ++next : next;
}
-template <class charT, class traits, class Allocator>
-struct access_t : public reg_expression<charT, traits, Allocator>
-{
- typedef typename is_byte<charT>::width_type width_type;
- typedef reg_expression<charT, traits, Allocator> base_type;
- typedef charT char_type;
- typedef traits traits_type;
- typedef Allocator alloc_type;
-
- static int repeat_count(const base_type& b)
- { return base_type::repeat_count(b); }
- static unsigned int restart_type(const base_type& b)
- { return base_type::restart_type(b); }
- static const re_syntax_base* first(const base_type& b)
- { return base_type::first(b); }
- static const unsigned char* get_map(const base_type& b)
- { return base_type::get_map(b); }
- static std::size_t leading_length(const base_type& b)
- { return base_type::leading_length(b); }
- static const kmp_info<charT>* get_kmp(const base_type& b)
- { return base_type::get_kmp(b); }
- static bool can_start(char_type c, const unsigned char* _map, unsigned char mask)
- {
- return reg_expression<char_type, traits_type, alloc_type>::can_start(c, _map, mask, width_type());
- }
-};
-
-
template <class BidiIterator>
class repeater_count
{
repeater_count** stack;
repeater_count* next;
int id;
- unsigned count; // the number of iterations so far
- BidiIterator start_pos; // where the last repeat started
+ std::size_t count; // the number of iterations so far
+ BidiIterator start_pos; // where the last repeat started
public:
repeater_count(repeater_count** s)
{
{
*stack = next;
}
- unsigned get_count() { return count; }
+ std::size_t get_count() { return count; }
int get_id() { return id; }
- int operator++() { return ++count; }
- bool check_null_repeat(const BidiIterator& pos, unsigned max)
+ std::size_t operator++() { return ++count; }
+ bool check_null_repeat(const BidiIterator& pos, std::size_t max)
{
// this is called when we are about to start a new repeat,
// if the last one was NULL move our count to max,
saved_state_count = 14
};
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable : 4251 4231 4660)
+#endif
+
+template <class BidiIterator, class Allocator, class traits>
class perl_matcher
{
public:
typedef typename traits::char_type char_type;
- typedef perl_matcher<BidiIterator, Allocator, traits, Allocator2> self_type;
+ typedef perl_matcher<BidiIterator, Allocator, traits> self_type;
typedef bool (self_type::*matcher_proc_type)(void);
- typedef access_t<char_type, traits, Allocator2> access;
typedef typename traits::size_type traits_size_type;
- typedef typename traits::uchar_type traits_uchar_type;
typedef typename is_byte<char_type>::width_type width_type;
typedef typename regex_iterator_traits<BidiIterator>::difference_type difference_type;
perl_matcher(BidiIterator first, BidiIterator end,
match_results<BidiIterator, Allocator>& what,
- const reg_expression<char_type, traits, Allocator2>& e,
- match_flag_type f);
+ const basic_regex<char_type, traits>& e,
+ match_flag_type f,
+ BidiIterator base);
bool match();
- bool match_imp();
bool find();
- bool find_imp();
-#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
- typedef bool (perl_matcher::*protected_proc_type)();
- bool protected_call(protected_proc_type);
-#endif
void setf(match_flag_type f)
{ m_match_flags |= f; }
{ m_match_flags &= ~f; }
private:
+ void construct_init(const basic_regex<char_type, traits>& e, match_flag_type f);
+ bool find_imp();
+ bool match_imp();
+#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
+ typedef bool (perl_matcher::*protected_proc_type)();
+ bool protected_call(protected_proc_type);
+#endif
void estimate_max_state_count(std::random_access_iterator_tag*);
void estimate_max_state_count(void*);
bool match_prefix();
bool match_char_repeat();
bool match_dot_repeat_fast();
bool match_dot_repeat_slow();
- bool backtrack_till_match(unsigned count);
+ bool match_backstep();
+ bool match_assert_backref();
+ bool match_toggle_case();
+#ifdef BOOST_REGEX_RECURSIVE
+ bool backtrack_till_match(std::size_t count);
+#endif
// find procs stored in s_find_vtable:
bool find_restart_any();
BidiIterator restart;
// where the current search started from, acts as base for $` during grep:
BidiIterator search_base;
+ // how far we can go back when matching lookbehind:
+ BidiIterator backstop;
// the expression being examined:
- const reg_expression<char_type, traits, Allocator2>& re;
+ const basic_regex<char_type, traits>& re;
// the expression's traits class:
- const traits& traits_inst;
+ const ::boost::regex_traits_wrapper<traits>& traits_inst;
// the next state in the machine being matched:
const re_syntax_base* pstate;
// matching flags in use:
bool m_has_partial_match;
// set to true whenever we get a match:
bool m_has_found_match;
+ // set to true whenever we're inside an independent sub-expression:
+ bool m_independent;
// the current repeat being examined:
repeater_count<BidiIterator>* next_count;
// the first repeat being examined (top of linked list):
repeater_count<BidiIterator> rep_obj;
+ // the mask to pass when matching word boundaries:
+ typename traits::char_class_type m_word_mask;
+ // the bitmask to use when determining whether a match_any matches a newline or not:
+ unsigned char match_any_mask;
#ifdef BOOST_REGEX_NON_RECURSIVE
//
void push_assertion(const re_syntax_base* ps, bool positive);
void push_alt(const re_syntax_base* ps);
void push_repeater_count(int i, repeater_count<BidiIterator>** s);
- void push_single_repeat(unsigned c, const re_repeat* r, BidiIterator last_position, int id);
+ void push_single_repeat(std::size_t c, const re_repeat* r, BidiIterator last_position, int id);
void push_non_greedy_repeat(const re_syntax_base* ps);
unsigned used_block_count;
#endif
- // these operations aren't allowed, so are declared private:
- perl_matcher& operator=(const perl_matcher&);
- perl_matcher(const perl_matcher&);
+ // these operations aren't allowed, so are declared private,
+ // bodies are provided to keep explicit-instantiation requests happy:
+ perl_matcher& operator=(const perl_matcher&)
+ {
+ return *this;
+ }
+ perl_matcher(const perl_matcher& that)
+ : m_result(that.m_result), re(that.re), traits_inst(that.traits_inst), rep_obj(0) {}
};
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
} // namespace re_detail
#ifdef BOOST_HAS_ABI_HEADERS
/*
*
* Copyright (c) 2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
namespace boost{
namespace re_detail{
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-perl_matcher<BidiIterator, Allocator, traits, Allocator2>::perl_matcher(BidiIterator first, BidiIterator end,
+template <class BidiIterator, class Allocator, class traits>
+perl_matcher<BidiIterator, Allocator, traits>::perl_matcher(BidiIterator first, BidiIterator end,
match_results<BidiIterator, Allocator>& what,
- const reg_expression<char_type, traits, Allocator2>& e,
- match_flag_type f)
+ const basic_regex<char_type, traits>& e,
+ match_flag_type f,
+ BidiIterator b)
: m_result(what), base(first), last(end),
- position(first), re(e), traits_inst(e.get_traits()),
- next_count(&rep_obj), rep_obj(&next_count)
+ position(first), backstop(b), re(e), traits_inst(e.get_traits()),
+ m_independent(false), next_count(&rep_obj), rep_obj(&next_count)
+{
+ construct_init(e, f);
+}
+
+template <class BidiIterator, class Allocator, class traits>
+void perl_matcher<BidiIterator, Allocator, traits>::construct_init(const basic_regex<char_type, traits>& e, match_flag_type f)
{
typedef typename regex_iterator_traits<BidiIterator>::iterator_category category;
estimate_max_state_count(static_cast<category*>(0));
if(!(m_match_flags & (match_perl|match_posix)))
{
- if((re.flags() & regex_constants::perlex) || (re.flags() & regex_constants::literal))
+ if((re.flags() & (regbase::main_option_type|regbase::no_perl_ex)) == 0)
+ m_match_flags |= match_perl;
+ else if((re.flags() & (regbase::main_option_type|regbase::emacs_ex)) == (regbase::basic_syntax_group|regbase::emacs_ex))
m_match_flags |= match_perl;
else
m_match_flags |= match_posix;
m_stack_base = 0;
m_backup_state = 0;
#endif
+ // find the value to use for matching word boundaries:
+ const char_type w = static_cast<char_type>('w');
+ m_word_mask = traits_inst.lookup_classname(&w, &w+1);
+ // find bitmask to use for matching '.':
+ match_any_mask = static_cast<unsigned char>((f & match_not_dot_newline) ? re_detail::test_not_newline : re_detail::test_newline);
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::estimate_max_state_count(std::random_access_iterator_tag*)
+template <class BidiIterator, class Allocator, class traits>
+void perl_matcher<BidiIterator, Allocator, traits>::estimate_max_state_count(std::random_access_iterator_tag*)
{
+ static const difference_type k = 100000;
difference_type dist = boost::re_detail::distance(base, last);
traits_size_type states = static_cast<traits_size_type>(re.size());
states *= states;
- difference_type lim = (std::numeric_limits<difference_type>::max)() - 100000 - states;
- if(dist > (difference_type)(lim / states))
- max_state_count = lim;
+ difference_type lim = ((std::numeric_limits<difference_type>::max)() - k) / states;
+ if(dist >= lim)
+ max_state_count = (std::numeric_limits<difference_type>::max)();
else
- max_state_count = 100000 + states * dist;
+ max_state_count = k + states * dist;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::estimate_max_state_count(void*)
+
+template <class BidiIterator, class Allocator, class traits>
+void perl_matcher<BidiIterator, Allocator, traits>::estimate_max_state_count(void*)
{
// we don't know how long the sequence is:
max_state_count = BOOST_REGEX_MAX_STATE_COUNT;
}
#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::protected_call(
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::protected_call(
protected_proc_type proc)
{
+ /*
__try{
return (this->*proc)();
}__except(EXCEPTION_STACK_OVERFLOW == GetExceptionCode())
reset_stack_guard_page();
}
// we only get here after a stack overflow:
- raise_error<traits>(traits_inst, REG_E_MEMORY);
+ raise_error<traits>(traits_inst, regex_constants::error_size);
// and we never really get here at all:
return false;
+ */
+ ::boost::re_detail::concrete_protected_call
+ <perl_matcher<BidiIterator, Allocator, traits> >
+ obj(this, proc);
+ return obj.execute();
+
}
#endif
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match()
{
#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
- return protected_call(&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_imp);
+ return protected_call(&perl_matcher<BidiIterator, Allocator, traits>::match_imp);
#else
return match_imp();
#endif
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_imp()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_imp()
{
// initialise our stack if we are non-recursive:
#ifdef BOOST_REGEX_NON_RECURSIVE
search_base = base;
state_count = 0;
m_match_flags |= regex_constants::match_all;
- m_presult->set_size((m_match_flags & match_nosubs) ? 1 : re.mark_count(), base, last);
+ m_presult->set_size((m_match_flags & match_nosubs) ? 1 : re.mark_count(), search_base, last);
m_presult->set_base(base);
if(m_match_flags & match_posix)
m_result = *m_presult;
#endif
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::find()
{
#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
- return protected_call(&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_imp);
+ return protected_call(&perl_matcher<BidiIterator, Allocator, traits>::find_imp);
#else
return find_imp();
#endif
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_imp()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::find_imp()
{
static matcher_proc_type const s_find_vtable[7] =
{
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_any,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_word,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_line,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_buf,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_prefix,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_lit,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_lit,
+ &perl_matcher<BidiIterator, Allocator, traits>::find_restart_any,
+ &perl_matcher<BidiIterator, Allocator, traits>::find_restart_word,
+ &perl_matcher<BidiIterator, Allocator, traits>::find_restart_line,
+ &perl_matcher<BidiIterator, Allocator, traits>::find_restart_buf,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_prefix,
+ &perl_matcher<BidiIterator, Allocator, traits>::find_restart_lit,
+ &perl_matcher<BidiIterator, Allocator, traits>::find_restart_lit,
};
// initialise our stack if we are non-recursive:
if((m_match_flags & regex_constants::match_init) == 0)
{
// reset our state machine:
- position = base;
- search_base = base;
- pstate = access::first(re);
+ search_base = position = base;
+ pstate = re.get_first_state();
m_presult->set_size((m_match_flags & match_nosubs) ? 1 : re.mark_count(), base, last);
m_presult->set_base(base);
m_match_flags |= regex_constants::match_init;
}
// reset $` start:
m_presult->set_size((m_match_flags & match_nosubs) ? 1 : re.mark_count(), search_base, last);
- if(base != search_base)
- m_match_flags |= match_prev_avail;
+ //if((base != search_base) && (base == backstop))
+ // m_match_flags |= match_prev_avail;
}
if(m_match_flags & match_posix)
{
// find out what kind of expression we have:
unsigned type = (m_match_flags & match_continuous) ?
static_cast<unsigned int>(regbase::restart_continue)
- : static_cast<unsigned int>(access::restart_type(re));
+ : static_cast<unsigned int>(re.get_restart_type());
// call the appropriate search routine:
matcher_proc_type proc = s_find_vtable[type];
#endif
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_prefix()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_prefix()
{
m_has_partial_match = false;
m_has_found_match = false;
- pstate = access::first(re);
+ pstate = re.get_first_state();
m_presult->set_first(position);
restart = position;
match_all_states();
return m_has_found_match;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_endmark()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_endmark()
{
int index = static_cast<const re_brace*>(pstate)->index;
if(index > 0)
if((m_match_flags & match_nosubs) == 0)
m_presult->set_second(position, index);
}
- else if(index < 0)
+ else if((index < 0) && (index != -4))
{
// matched forward lookahead:
pstate = 0;
return true;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_literal()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_literal()
{
unsigned int len = static_cast<const re_literal*>(pstate)->length;
const char_type* what = reinterpret_cast<const char_type*>(static_cast<const re_literal*>(pstate) + 1);
return true;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_start_line()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_start_line()
{
- if(position == base)
+ if(position == backstop)
{
if((m_match_flags & match_prev_avail) == 0)
{
--t;
if(position != last)
{
- if(traits_inst.is_separator(*t) && !((*t == '\r') && (*position == '\n')) )
+ if(is_separator(*t) && !((*t == static_cast<char_type>('\r')) && (*position == static_cast<char_type>('\n'))) )
{
pstate = pstate->next.p;
return true;
}
}
- else if(traits_inst.is_separator(*t))
+ else if(is_separator(*t))
{
pstate = pstate->next.p;
return true;
return false;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_end_line()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_end_line()
{
if(position != last)
{
if(m_match_flags & match_single_line)
return false;
// we're not yet at the end so *first is always valid:
- if(traits_inst.is_separator(*position))
+ if(is_separator(*position))
{
- if((position != base) || (m_match_flags & match_prev_avail))
+ if((position != backstop) || (m_match_flags & match_prev_avail))
{
// check that we're not in the middle of \r\n sequence
BidiIterator t(position);
--t;
- if((*t == '\r') && (*position == '\n'))
+ if((*t == static_cast<char_type>('\r')) && (*position == static_cast<char_type>('\n')))
{
return false;
}
return false;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_wild()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_wild()
{
if(position == last)
return false;
- if(traits_inst.is_separator(*position) && (m_match_flags & match_not_dot_newline))
+ if(is_separator(*position) && ((match_any_mask & static_cast<const re_dot*>(pstate)->mask) == 0))
return false;
if((*position == char_type(0)) && (m_match_flags & match_not_dot_null))
return false;
return true;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_match()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_match()
{
if((m_match_flags & match_not_null) && (position == (*m_presult)[0].first))
return false;
m_presult->set_second(position);
pstate = 0;
m_has_found_match = true;
- if((m_match_flags & (match_posix|match_any)) == match_posix)
+ if((m_match_flags & match_posix) == match_posix)
{
m_result.maybe_assign(*m_presult);
- return false;
+ if((m_match_flags & match_any) == 0)
+ return false;
}
#ifdef BOOST_REGEX_MATCH_EXTRA
if(match_extra & m_match_flags)
return true;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_boundary()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_word_boundary()
{
bool b; // indcates whether next character is a word character
if(position != last)
{
// prev and this character must be opposites:
#if defined(BOOST_REGEX_USE_C_LOCALE) && defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ < 95)
- b = traits::is_class(*position, traits::char_class_word);
+ b = traits::isctype(*position, m_word_mask);
#else
- b = traits_inst.is_class(*position, traits::char_class_word);
+ b = traits_inst.isctype(*position, m_word_mask);
#endif
}
else
{
b = (m_match_flags & match_not_eow) ? true : false;
}
- if((position == base) && ((m_match_flags & match_prev_avail) == 0))
+ if((position == backstop) && ((m_match_flags & match_prev_avail) == 0))
{
if(m_match_flags & match_not_bow)
b ^= true;
else
{
--position;
- b ^= traits_inst.is_class(*position, traits::char_class_word);
+ b ^= traits_inst.isctype(*position, m_word_mask);
++position;
}
if(b)
return false; // no match if we get to here...
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_within_word()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_within_word()
{
if(position == last)
return false;
- // both prev and this character must be traits::char_class_word:
- if(traits_inst.is_class(*position, traits::char_class_word))
+ // both prev and this character must be m_word_mask:
+ if(traits_inst.isctype(*position, m_word_mask))
{
bool b;
- if((position == base) && ((m_match_flags & match_prev_avail) == 0))
+ if((position == backstop) && ((m_match_flags & match_prev_avail) == 0))
return false;
else
{
--position;
- b = traits_inst.is_class(*position, traits::char_class_word);
+ b = traits_inst.isctype(*position, m_word_mask);
++position;
}
if(b)
return false;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_start()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_word_start()
{
if(position == last)
return false; // can't be starting a word if we're already at the end of input
- if(!traits_inst.is_class(*position, traits::char_class_word))
+ if(!traits_inst.isctype(*position, m_word_mask))
return false; // next character isn't a word character
- if((position == base) && ((m_match_flags & match_prev_avail) == 0))
+ if((position == backstop) && ((m_match_flags & match_prev_avail) == 0))
{
if(m_match_flags & match_not_bow)
return false; // no previous input
// otherwise inside buffer:
BidiIterator t(position);
--t;
- if(traits_inst.is_class(*t, traits::char_class_word))
+ if(traits_inst.isctype(*t, m_word_mask))
return false; // previous character not non-word
}
// OK we have a match:
return true;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_end()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_word_end()
{
- if((position == base) && ((m_match_flags & match_prev_avail) == 0))
+ if((position == backstop) && ((m_match_flags & match_prev_avail) == 0))
return false; // start of buffer can't be end of word
BidiIterator t(position);
--t;
- if(traits_inst.is_class(*t, traits::char_class_word) == false)
+ if(traits_inst.isctype(*t, m_word_mask) == false)
return false; // previous character wasn't a word character
if(position == last)
else
{
// otherwise inside buffer:
- if(traits_inst.is_class(*position, traits::char_class_word))
+ if(traits_inst.isctype(*position, m_word_mask))
return false; // next character is a word character
}
pstate = pstate->next.p;
return true; // if we fall through to here then we've succeeded
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_start()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_buffer_start()
{
- if((position != base) || (m_match_flags & match_not_bob))
+ if((position != backstop) || (m_match_flags & match_not_bob))
return false;
// OK match:
pstate = pstate->next.p;
return true;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_end()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_buffer_end()
{
if((position != last) || (m_match_flags & match_not_eob))
return false;
return true;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_backref()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_backref()
{
// compare with what we previously matched:
BidiIterator i = (*m_presult)[static_cast<const re_brace*>(pstate)->index].first;
return true;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_long_set()
{
+ typedef typename traits::char_class_type char_class_type;
// let the traits class do the work:
if(position == last)
return false;
- BidiIterator t = re_is_set_member(position, last, static_cast<const re_set_long*>(pstate), re);
+ BidiIterator t = re_is_set_member(position, last, static_cast<const re_set_long<char_class_type>*>(pstate), re.get_data(), icase);
if(t != position)
{
pstate = pstate->next.p;
return false;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_set()
{
if(position == last)
return false;
- if(static_cast<const re_set*>(pstate)->_map[(traits_uchar_type)traits_inst.translate(*position, icase)])
+ if(static_cast<const re_set*>(pstate)->_map[static_cast<unsigned char>(traits_inst.translate(*position, icase))])
{
pstate = pstate->next.p;
++position;
return false;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_jump()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_jump()
{
pstate = static_cast<const re_jump*>(pstate)->alt.p;
return true;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_combining()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_combining()
{
if(position == last)
return false;
- if(traits_inst.is_combining(traits_inst.translate(*position, icase)))
+ if(is_combining(traits_inst.translate(*position, icase)))
return false;
++position;
- while((position != last) && traits_inst.is_combining(traits_inst.translate(*position, icase)))
+ while((position != last) && is_combining(traits_inst.translate(*position, icase)))
++position;
pstate = pstate->next.p;
return true;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_soft_buffer_end()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_soft_buffer_end()
{
if(m_match_flags & match_not_eob)
return false;
BidiIterator p(position);
- while((p != last) && traits_inst.is_separator(traits_inst.translate(*p, icase)))++p;
+ while((p != last) && is_separator(traits_inst.translate(*p, icase)))++p;
if(p != last)
return false;
pstate = pstate->next.p;
return true;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_restart_continue()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_restart_continue()
{
if(position == search_base)
{
return false;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_any()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_backstep()
{
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable:4127)
#endif
- const unsigned char* _map = access::get_map(re);
+ if( ::boost::is_random_access_iterator<BidiIterator>::value)
+ {
+ std::ptrdiff_t maxlen = ::boost::re_detail::distance(backstop, position);
+ if(maxlen < static_cast<const re_brace*>(pstate)->index)
+ return false;
+ std::advance(position, -static_cast<const re_brace*>(pstate)->index);
+ }
+ else
+ {
+ int c = static_cast<const re_brace*>(pstate)->index;
+ while(c--)
+ {
+ if(position == backstop)
+ return false;
+ --position;
+ }
+ }
+ pstate = pstate->next.p;
+ return true;
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+}
+
+template <class BidiIterator, class Allocator, class traits>
+inline bool perl_matcher<BidiIterator, Allocator, traits>::match_assert_backref()
+{
+ // return true if marked sub-expression N has been matched:
+ bool result = (*m_presult)[static_cast<const re_brace*>(pstate)->index].matched;
+ pstate = pstate->next.p;
+ return result;
+}
+
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_toggle_case()
+{
+ // change our case sensitivity:
+ this->icase = static_cast<const re_case*>(pstate)->icase;
+ pstate = pstate->next.p;
+ return true;
+}
+
+
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::find_restart_any()
+{
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4127)
+#endif
+ const unsigned char* _map = re.get_map();
while(true)
{
// skip everything we can't match:
- while((position != last) && !access::can_start(*position, _map, (unsigned char)mask_any) )
+ while((position != last) && !can_start(*position, _map, (unsigned char)mask_any) )
++position;
if(position == last)
{
// run out of characters, try a null match if possible:
- if(access::first(re)->can_be_null)
+ if(re.can_be_null())
return match_prefix();
break;
}
#endif
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_word()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::find_restart_word()
{
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable:4127)
#endif
// do search optimised for word starts:
- const unsigned char* _map = access::get_map(re);
+ const unsigned char* _map = re.get_map();
if((m_match_flags & match_prev_avail) || (position != base))
--position;
else if(match_prefix())
return true;
do
{
- while((position != last) && traits_inst.is_class(*position, traits::char_class_word))
+ while((position != last) && traits_inst.isctype(*position, m_word_mask))
++position;
- while((position != last) && !traits_inst.is_class(*position, traits::char_class_word))
+ while((position != last) && !traits_inst.isctype(*position, m_word_mask))
++position;
if(position == last)
break;
- if(access::can_start(*position, _map, (unsigned char)mask_any) )
+ if(can_start(*position, _map, (unsigned char)mask_any) )
{
if(match_prefix())
return true;
#endif
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_line()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::find_restart_line()
{
// do search optimised for line starts:
- const unsigned char* _map = access::get_map(re);
+ const unsigned char* _map = re.get_map();
if(match_prefix())
return true;
while(position != last)
{
- while((position != last) && (*position != '\n'))
+ while((position != last) && !is_separator(*position))
++position;
if(position == last)
return false;
++position;
if(position == last)
{
- if((access::first(re)->can_be_null) && match_prefix())
+ if(re.can_be_null() && match_prefix())
return true;
return false;
}
- if( access::can_start(*position, _map, (unsigned char)mask_any) )
+ if( can_start(*position, _map, (unsigned char)mask_any) )
{
if(match_prefix())
return true;
return false;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_buf()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::find_restart_buf()
{
if((position == base) && ((m_match_flags & match_not_bob) == 0))
return match_prefix();
return false;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::find_restart_lit()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::find_restart_lit()
{
+#if 0
if(position == last)
return false; // can't possibly match if we're at the end already
unsigned type = (m_match_flags & match_continuous) ?
static_cast<unsigned int>(regbase::restart_continue)
- : static_cast<unsigned int>(access::restart_type(re));
+ : static_cast<unsigned int>(re.get_restart_type());
const kmp_info<char_type>* info = access::get_kmp(re);
int len = info->len;
std::advance(position, -j);
return match_prefix();
}
+#endif
return false;
}
/*
*
* Copyright (c) 2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
{
union{
unsigned int id;
- // these ensure that this struct gets the same alignment as derived structs:
- void* padding1;
- std::size_t padding2;
- std::ptrdiff_t padding3;
+ // 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) {}
};
*end = reinterpret_cast<saved_state*>(reinterpret_cast<char*>(*base)+BOOST_REGEX_BLOCKSIZE);
--(*end);
(void) new (*end)saved_state(0);
- assert(*end > *base);
+ BOOST_ASSERT(*end > *base);
}
~save_state_init()
{
template <class BidiIterator>
struct saved_single_repeat : public saved_state
{
- unsigned count;
+ std::size_t count;
const re_repeat* rep;
BidiIterator last_position;
- saved_single_repeat(unsigned c, const re_repeat* r, BidiIterator lp, int arg_id)
+ saved_single_repeat(std::size_t c, const re_repeat* r, BidiIterator lp, int arg_id)
: saved_state(arg_id), count(c), rep(r), last_position(lp){}
};
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_all_states()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_all_states()
{
- static matcher_proc_type const s_match_vtable[26] =
- {
- (&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_startmark),
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_endmark,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_literal,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_start_line,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_end_line,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_wild,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_match,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_boundary,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_within_word,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_start,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_end,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_start,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_end,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_backref,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_jump,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_alt,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_combining,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_soft_buffer_end,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_restart_continue,
- (::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_slow),
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_char_repeat,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set_repeat,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set_repeat,
+ static matcher_proc_type const s_match_vtable[29] =
+ {
+ (&perl_matcher<BidiIterator, Allocator, traits>::match_startmark),
+ &perl_matcher<BidiIterator, Allocator, traits>::match_endmark,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_literal,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_start_line,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_end_line,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_wild,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_match,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_word_boundary,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_within_word,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_word_start,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_word_end,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_buffer_start,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_buffer_end,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_backref,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_long_set,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_set,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_jump,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_alt,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_rep,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_combining,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_soft_buffer_end,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_restart_continue,
+ (::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_slow),
+ &perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_backstep,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_assert_backref,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_toggle_case,
};
push_recursion_stopper();
if(!(this->*proc)())
{
if(state_count > max_state_count)
- raise_error(traits_inst, REG_ESPACE);
- if((m_match_flags & match_partial) && (position == last))
+ raise_error(traits_inst, regex_constants::error_space);
+ if((m_match_flags & match_partial) && (position == last) && (position != search_base))
m_has_partial_match = true;
- if(false == unwind(false))
+ bool successful_unwind = unwind(false);
+ if((m_match_flags & match_partial) && (position == last) && (position != search_base))
+ m_has_partial_match = true;
+ if(false == successful_unwind)
return m_recursive_result;
}
}
return m_recursive_result;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::extend_stack()
+template <class BidiIterator, class Allocator, class traits>
+void perl_matcher<BidiIterator, Allocator, traits>::extend_stack()
{
if(used_block_count)
{
m_backup_state = block;
}
else
- raise_error(traits_inst, REG_E_MEMORY);
+ raise_error(traits_inst, regex_constants::error_size);
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-inline void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::push_matched_paren(int index, const sub_match<BidiIterator>& sub)
+template <class BidiIterator, class Allocator, class traits>
+inline void perl_matcher<BidiIterator, Allocator, traits>::push_matched_paren(int index, const sub_match<BidiIterator>& sub)
{
- assert(index);
+ BOOST_ASSERT(index);
saved_matched_paren<BidiIterator>* pmp = static_cast<saved_matched_paren<BidiIterator>*>(m_backup_state);
--pmp;
if(pmp < m_stack_base)
m_backup_state = pmp;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-inline void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::push_recursion_stopper()
+template <class BidiIterator, class Allocator, class traits>
+inline void perl_matcher<BidiIterator, Allocator, traits>::push_recursion_stopper()
{
saved_state* pmp = m_backup_state;
--pmp;
m_backup_state = pmp;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-inline void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::push_assertion(const re_syntax_base* ps, bool positive)
+template <class BidiIterator, class Allocator, class traits>
+inline void perl_matcher<BidiIterator, Allocator, traits>::push_assertion(const re_syntax_base* ps, bool positive)
{
saved_assertion<BidiIterator>* pmp = static_cast<saved_assertion<BidiIterator>*>(m_backup_state);
--pmp;
m_backup_state = pmp;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-inline void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::push_alt(const re_syntax_base* ps)
+template <class BidiIterator, class Allocator, class traits>
+inline void perl_matcher<BidiIterator, Allocator, traits>::push_alt(const re_syntax_base* ps)
{
saved_position<BidiIterator>* pmp = static_cast<saved_position<BidiIterator>*>(m_backup_state);
--pmp;
m_backup_state = pmp;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-inline void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::push_non_greedy_repeat(const re_syntax_base* ps)
+template <class BidiIterator, class Allocator, class traits>
+inline void perl_matcher<BidiIterator, Allocator, traits>::push_non_greedy_repeat(const re_syntax_base* ps)
{
saved_position<BidiIterator>* pmp = static_cast<saved_position<BidiIterator>*>(m_backup_state);
--pmp;
m_backup_state = pmp;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-inline void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::push_repeater_count(int i, repeater_count<BidiIterator>** s)
+template <class BidiIterator, class Allocator, class traits>
+inline void perl_matcher<BidiIterator, Allocator, traits>::push_repeater_count(int i, repeater_count<BidiIterator>** s)
{
saved_repeater<BidiIterator>* pmp = static_cast<saved_repeater<BidiIterator>*>(m_backup_state);
--pmp;
m_backup_state = pmp;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-inline void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::push_single_repeat(unsigned c, const re_repeat* r, BidiIterator last_position, int id)
+template <class BidiIterator, class Allocator, class traits>
+inline void perl_matcher<BidiIterator, Allocator, traits>::push_single_repeat(std::size_t c, const re_repeat* r, BidiIterator last_position, int id)
{
saved_single_repeat<BidiIterator>* pmp = static_cast<saved_single_repeat<BidiIterator>*>(m_backup_state);
--pmp;
m_backup_state = pmp;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_startmark()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
{
int index = static_cast<const re_brace*>(pstate)->index;
switch(index)
case -3:
{
// independent sub-expression, currently this is always recursive:
+ bool old_independent = m_independent;
+ m_independent = true;
const re_syntax_base* next_pstate = static_cast<const re_jump*>(pstate->next.p)->alt.p->next.p;
pstate = pstate->next.p->next.p;
bool r = match_all_states();
pstate = next_pstate;
+ m_independent = old_independent;
#ifdef BOOST_REGEX_MATCH_EXTRA
if(r && (m_match_flags & match_extra))
{
#endif
return r;
}
+ case -4:
+ {
+ // conditional expression:
+ const re_alt* alt = static_cast<const re_alt*>(pstate->next.p);
+ BOOST_ASSERT(alt->type == syntax_element_alt);
+ pstate = alt->next.p;
+ if(pstate->type == syntax_element_assert_backref)
+ {
+ if(!match_assert_backref())
+ pstate = alt->alt.p;
+ break;
+ }
+ else
+ {
+ // zero width assertion, have to match this recursively:
+ BOOST_ASSERT(pstate->type == syntax_element_startmark);
+ bool negated = static_cast<const re_brace*>(pstate)->index == -2;
+ BidiIterator saved_position = position;
+ const re_syntax_base* next_pstate = static_cast<const re_jump*>(pstate->next.p)->alt.p->next.p;
+ pstate = pstate->next.p->next.p;
+ bool r = match_all_states();
+ position = saved_position;
+ if(negated)
+ r = !r;
+ if(r)
+ pstate = next_pstate;
+ else
+ pstate = alt->alt.p;
+ break;
+ }
+ }
default:
{
- assert(index > 0);
+ BOOST_ASSERT(index > 0);
if((m_match_flags & match_nosubs) == 0)
{
push_matched_paren(index, (*m_presult)[index]);
return true;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_alt()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_alt()
{
bool take_first, take_second;
- const re_jump* jmp = static_cast<const re_jump*>(pstate);
+ const re_alt* jmp = static_cast<const re_alt*>(pstate);
// find out which of these two alternatives we need to take:
if(position == last)
}
else
{
- take_first = access::can_start(*position, jmp->_map, (unsigned char)mask_take);
- take_second = access::can_start(*position, jmp->_map, (unsigned char)mask_skip);
+ take_first = can_start(*position, jmp->_map, (unsigned char)mask_take);
+ take_second = can_start(*position, jmp->_map, (unsigned char)mask_skip);
}
if(take_first)
return false; // neither option is possible
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_rep()
{
#ifdef BOOST_MSVC
#pragma warning(push)
}
else
{
- take_first = access::can_start(*position, rep->_map, (unsigned char)mask_take);
- take_second = access::can_start(*position, rep->_map, (unsigned char)mask_skip);
+ take_first = can_start(*position, rep->_map, (unsigned char)mask_take);
+ take_second = can_start(*position, rep->_map, (unsigned char)mask_skip);
}
if(take_first || (next_count->get_id() != rep->id))
return false;
}
- if(rep->greedy)
+ bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent);
+ if(greedy)
{
// try and take the repeat if we can:
if((next_count->get_count() < rep->max) && take_first)
// try and skip the repeat if we can:
if(take_second)
{
- // store position in case we fail:
- push_non_greedy_repeat(rep->next.p);
+ if((next_count->get_count() < rep->max) && take_first)
+ {
+ // store position in case we fail:
+ push_non_greedy_repeat(rep->next.p);
+ }
pstate = rep->alt.p;
return true;
}
#endif
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_slow()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_slow()
{
unsigned count = 0;
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
return false;
++count;
}
- if(rep->greedy)
+ bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent);
+ if(greedy)
{
// repeat for as long as we can:
while(count < rep->max)
if(count < rep->max)
push_single_repeat(count, rep, position, saved_state_rep_slow_dot);
pstate = rep->alt.p;
- return (position == last) ? (rep->can_be_null & mask_skip) : access::can_start(*position, rep->_map, mask_skip);
+ return (position == last) ? (rep->can_be_null & mask_skip) : can_start(*position, rep->_map, mask_skip);
}
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_fast()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_fast()
{
- if(m_match_flags & (match_not_dot_newline | match_not_dot_null))
+ if(m_match_flags & match_not_dot_null)
+ return match_dot_repeat_slow();
+ if((static_cast<const re_dot*>(pstate->next.p)->mask & match_any_mask) == 0)
return match_dot_repeat_slow();
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
- unsigned count = (std::min)(static_cast<unsigned>(re_detail::distance(position, last)), static_cast<unsigned>(rep->greedy ? rep->max : rep->min));
+ bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent);
+ unsigned count = static_cast<unsigned>((std::min)(static_cast<unsigned>(::boost::re_detail::distance(position, last)), static_cast<unsigned>(greedy ? rep->max : rep->min)));
if(rep->min > count)
+ {
+ position = last;
return false; // not enough text left to match
+ }
std::advance(position, count);
- if(rep->greedy)
+ if(greedy)
{
if((rep->leading) && (count < rep->max))
restart = position;
if(count < rep->max)
push_single_repeat(count, rep, position, saved_state_rep_fast_dot);
pstate = rep->alt.p;
- return (position == last) ? (rep->can_be_null & mask_skip) : access::can_start(*position, rep->_map, mask_skip);
+ return (position == last) ? (rep->can_be_null & mask_skip) : can_start(*position, rep->_map, mask_skip);
}
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_char_repeat()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat()
{
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma option push -w-8008 -w-8066 -w-8004
#endif
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
- assert(1 == static_cast<const re_literal*>(rep->next.p)->length);
+ BOOST_ASSERT(1 == static_cast<const re_literal*>(rep->next.p)->length);
const char_type what = *reinterpret_cast<const char_type*>(static_cast<const re_literal*>(rep->next.p) + 1);
- unsigned count = 0;
+ std::size_t count = 0;
//
// start by working out how much we can skip:
//
- unsigned desired = rep->greedy ? rep->max : rep->min;
+ bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent);
+ std::size_t desired = greedy ? rep->max : rep->min;
if(::boost::is_random_access_iterator<BidiIterator>::value)
{
BidiIterator end = position;
- std::advance(end, (std::min)((unsigned)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))
{
++position;
}
- count = (unsigned)re_detail::distance(origin, position);
+ count = (unsigned)::boost::re_detail::distance(origin, position);
}
else
{
if(count < rep->min)
return false;
- if(rep->greedy)
+ if(greedy)
{
if((rep->leading) && (count < rep->max))
restart = position;
if(count < rep->max)
push_single_repeat(count, rep, position, saved_state_rep_char);
pstate = rep->alt.p;
- return (position == last) ? (rep->can_be_null & mask_skip) : access::can_start(*position, rep->_map, mask_skip);
+ return (position == last) ? (rep->can_be_null & mask_skip) : can_start(*position, rep->_map, mask_skip);
}
#ifdef __BORLANDC__
#pragma option pop
#endif
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set_repeat()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat()
{
#ifdef BOOST_MSVC
#pragma warning(push)
#endif
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
const unsigned char* map = static_cast<const re_set*>(rep->next.p)->_map;
- unsigned count = 0;
+ std::size_t count = 0;
//
// start by working out how much we can skip:
//
- unsigned desired = rep->greedy ? rep->max : rep->min;
+ bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent);
+ std::size_t desired = greedy ? rep->max : rep->min;
if(::boost::is_random_access_iterator<BidiIterator>::value)
{
BidiIterator end = position;
- std::advance(end, (std::min)((unsigned)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[(traits_uchar_type)traits_inst.translate(*position, icase)])
+ while((position != end) && map[static_cast<unsigned char>(traits_inst.translate(*position, icase))])
{
++position;
}
- count = (unsigned)re_detail::distance(origin, position);
+ count = (unsigned)::boost::re_detail::distance(origin, position);
}
else
{
- while((count < desired) && (position != last) && map[(traits_uchar_type)traits_inst.translate(*position, icase)])
+ while((count < desired) && (position != last) && map[static_cast<unsigned char>(traits_inst.translate(*position, icase))])
{
++position;
++count;
if(count < rep->min)
return false;
- if(rep->greedy)
+ if(greedy)
{
if((rep->leading) && (count < rep->max))
restart = position;
if(count < rep->max)
push_single_repeat(count, rep, position, saved_state_rep_short_set);
pstate = rep->alt.p;
- return (position == last) ? (rep->can_be_null & mask_skip) : access::can_start(*position, rep->_map, mask_skip);
+ return (position == last) ? (rep->can_be_null & mask_skip) : can_start(*position, rep->_map, mask_skip);
}
#ifdef __BORLANDC__
#pragma option pop
#endif
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set_repeat()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat()
{
#ifdef BOOST_MSVC
#pragma warning(push)
#ifdef __BORLANDC__
#pragma option push -w-8008 -w-8066 -w-8004
#endif
+ typedef typename traits::char_class_type mask_type;
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
- const re_set_long* set = static_cast<const re_set_long*>(pstate->next.p);
- unsigned count = 0;
+ const re_set_long<mask_type>* set = static_cast<const re_set_long<mask_type>*>(pstate->next.p);
+ std::size_t count = 0;
//
// start by working out how much we can skip:
//
- unsigned desired = rep->greedy ? rep->max : rep->min;
+ bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent);
+ std::size_t desired = greedy ? rep->max : rep->min;
if(::boost::is_random_access_iterator<BidiIterator>::value)
{
BidiIterator end = position;
- std::advance(end, (std::min)((unsigned)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)))
+ while((position != end) && (position != re_is_set_member(position, last, set, re.get_data(), icase)))
{
++position;
}
- count = (unsigned)re_detail::distance(origin, position);
+ count = (unsigned)::boost::re_detail::distance(origin, position);
}
else
{
- while((count < desired) && (position != last) && (position != re_is_set_member(position, last, set, re)))
+ while((count < desired) && (position != last) && (position != re_is_set_member(position, last, set, re.get_data(), icase)))
{
++position;
++count;
if(count < rep->min)
return false;
- if(rep->greedy)
+ if(greedy)
{
if((rep->leading) && (count < rep->max))
restart = position;
if(count < rep->max)
push_single_repeat(count, rep, position, saved_state_rep_long_set);
pstate = rep->alt.p;
- return (position == last) ? (rep->can_be_null & mask_skip) : access::can_start(*position, rep->_map, mask_skip);
+ return (position == last) ? (rep->can_be_null & mask_skip) : can_start(*position, rep->_map, mask_skip);
}
#ifdef __BORLANDC__
#pragma option pop
****************************************************************************/
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind(bool have_match)
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind(bool have_match)
{
static unwind_proc_type const s_unwind_table[14] =
{
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_end,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_paren,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_recursion_stopper,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_assertion,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_alt,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_repeater_counter,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_extra_block,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_greedy_single_repeat,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_slow_dot_repeat,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_fast_dot_repeat,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_char_repeat,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_short_set_repeat,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_long_set_repeat,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_non_greedy_repeat,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_end,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_paren,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_recursion_stopper,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_assertion,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_alt,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_repeater_counter,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_extra_block,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_greedy_single_repeat,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_slow_dot_repeat,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_fast_dot_repeat,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_char_repeat,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_short_set_repeat,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_long_set_repeat,
+ &perl_matcher<BidiIterator, Allocator, traits>::unwind_non_greedy_repeat,
};
m_recursive_result = have_match;
return pstate ? true : false;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_end(bool)
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_end(bool)
{
pstate = 0; // nothing left to search
return false; // end of stack nothing more to search
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_paren(bool have_match)
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_paren(bool have_match)
{
saved_matched_paren<BidiIterator>* pmp = static_cast<saved_matched_paren<BidiIterator>*>(m_backup_state);
// restore previous values if no match was found:
return true; // keep looking
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_recursion_stopper(bool)
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_recursion_stopper(bool)
{
boost::re_detail::inplace_destroy(m_backup_state++);
pstate = 0; // nothing left to search
return false; // end of stack nothing more to search
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_assertion(bool r)
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_assertion(bool r)
{
saved_assertion<BidiIterator>* pmp = static_cast<saved_assertion<BidiIterator>*>(m_backup_state);
pstate = pmp->pstate;
return !result; // return false if the assertion was matched to stop search.
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_alt(bool r)
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_alt(bool r)
{
saved_position<BidiIterator>* pmp = static_cast<saved_position<BidiIterator>*>(m_backup_state);
if(!r)
return r;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_repeater_counter(bool)
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_repeater_counter(bool)
{
saved_repeater<BidiIterator>* pmp = static_cast<saved_repeater<BidiIterator>*>(m_backup_state);
boost::re_detail::inplace_destroy(pmp++);
return true; // keep looking
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_extra_block(bool)
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_extra_block(bool)
{
saved_extra_block* pmp = static_cast<saved_extra_block*>(m_backup_state);
void* condemmed = m_stack_base;
return true; // keep looking
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-inline void perl_matcher<BidiIterator, Allocator, traits, Allocator2>::destroy_single_repeat()
+template <class BidiIterator, class Allocator, class traits>
+inline void perl_matcher<BidiIterator, Allocator, traits>::destroy_single_repeat()
{
saved_single_repeat<BidiIterator>* p = static_cast<saved_single_repeat<BidiIterator>*>(m_backup_state);
boost::re_detail::inplace_destroy(p++);
m_backup_state = p;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_greedy_single_repeat(bool r)
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_greedy_single_repeat(bool r)
{
saved_single_repeat<BidiIterator>* pmp = static_cast<saved_single_repeat<BidiIterator>*>(m_backup_state);
}
const re_repeat* rep = pmp->rep;
- unsigned count = pmp->count;
- assert(rep->next.p != 0);
- assert(rep->alt.p != 0);
+ std::size_t count = pmp->count;
+ BOOST_ASSERT(rep->next.p != 0);
+ BOOST_ASSERT(rep->alt.p != 0);
count -= rep->min;
if((m_match_flags & match_partial) && (position == last))
m_has_partial_match = true;
- assert(count);
+ BOOST_ASSERT(count);
position = pmp->last_position;
// backtrack till we can skip out:
--position;
--count;
++state_count;
- }while(count && !access::can_start(*position, rep->_map, mask_skip));
+ }while(count && !can_start(*position, rep->_map, mask_skip));
// if we've hit base, destroy this state:
if(count == 0)
{
destroy_single_repeat();
- if(!access::can_start(*position, rep->_map, mask_skip))
+ if(!can_start(*position, rep->_map, mask_skip))
return true;
}
else
return false;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_slow_dot_repeat(bool r)
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_slow_dot_repeat(bool r)
{
saved_single_repeat<BidiIterator>* pmp = static_cast<saved_single_repeat<BidiIterator>*>(m_backup_state);
}
const re_repeat* rep = pmp->rep;
- unsigned count = pmp->count;
- assert(rep->type == syntax_element_dot_rep);
- assert(rep->next.p != 0);
- assert(rep->alt.p != 0);
- assert(rep->next.p->type == syntax_element_wild);
+ std::size_t count = pmp->count;
+ BOOST_ASSERT(rep->type == syntax_element_dot_rep);
+ BOOST_ASSERT(rep->next.p != 0);
+ BOOST_ASSERT(rep->alt.p != 0);
+ BOOST_ASSERT(rep->next.p->type == syntax_element_wild);
- assert(count < rep->max);
+ BOOST_ASSERT(count < rep->max);
pstate = rep->next.p;
position = pmp->last_position;
++count;
++state_count;
pstate = rep->next.p;
- }while((count < rep->max) && (position != last) && !access::can_start(*position, rep->_map, mask_skip));
+ }while((count < rep->max) && (position != last) && !can_start(*position, rep->_map, mask_skip));
}
if(position == last)
{
{
// can't repeat any more, remove the pushed state:
destroy_single_repeat();
- if(!access::can_start(*position, rep->_map, mask_skip))
+ if(!can_start(*position, rep->_map, mask_skip))
return true;
}
else
return false;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_fast_dot_repeat(bool r)
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_fast_dot_repeat(bool r)
{
saved_single_repeat<BidiIterator>* pmp = static_cast<saved_single_repeat<BidiIterator>*>(m_backup_state);
}
const re_repeat* rep = pmp->rep;
- unsigned count = pmp->count;
+ std::size_t count = pmp->count;
- assert(count < rep->max);
+ BOOST_ASSERT(count < rep->max);
position = pmp->last_position;
if(position != last)
{
++position;
++count;
++state_count;
- }while((count < rep->max) && (position != last) && !access::can_start(*position, rep->_map, mask_skip));
+ }while((count < rep->max) && (position != last) && !can_start(*position, rep->_map, mask_skip));
}
if(position == last)
{
// can't repeat any more, remove the pushed state:
destroy_single_repeat();
- if(!access::can_start(*position, rep->_map, mask_skip))
+ if(!can_start(*position, rep->_map, mask_skip))
return true;
}
else
return false;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_char_repeat(bool r)
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_char_repeat(bool r)
{
saved_single_repeat<BidiIterator>* pmp = static_cast<saved_single_repeat<BidiIterator>*>(m_backup_state);
}
const re_repeat* rep = pmp->rep;
- unsigned count = pmp->count;
+ std::size_t count = pmp->count;
pstate = rep->next.p;
const char_type what = *reinterpret_cast<const char_type*>(static_cast<const re_literal*>(pstate) + 1);
position = pmp->last_position;
- assert(rep->type == syntax_element_char_rep);
- assert(rep->next.p != 0);
- assert(rep->alt.p != 0);
- assert(rep->next.p->type == syntax_element_literal);
- assert(count < rep->max);
+ BOOST_ASSERT(rep->type == syntax_element_char_rep);
+ BOOST_ASSERT(rep->next.p != 0);
+ BOOST_ASSERT(rep->alt.p != 0);
+ BOOST_ASSERT(rep->next.p->type == syntax_element_literal);
+ BOOST_ASSERT(count < rep->max);
if(position != last)
{
++ position;
++state_count;
pstate = rep->next.p;
- }while((count < rep->max) && (position != last) && !access::can_start(*position, rep->_map, mask_skip));
+ }while((count < rep->max) && (position != last) && !can_start(*position, rep->_map, mask_skip));
}
if(position == last)
{
{
// can't repeat any more, remove the pushed state:
destroy_single_repeat();
- if(!access::can_start(*position, rep->_map, mask_skip))
+ if(!can_start(*position, rep->_map, mask_skip))
return true;
}
else
return false;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_short_set_repeat(bool r)
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_short_set_repeat(bool r)
{
saved_single_repeat<BidiIterator>* pmp = static_cast<saved_single_repeat<BidiIterator>*>(m_backup_state);
}
const re_repeat* rep = pmp->rep;
- unsigned count = pmp->count;
+ std::size_t count = pmp->count;
pstate = rep->next.p;
const unsigned char* map = static_cast<const re_set*>(rep->next.p)->_map;
position = pmp->last_position;
- assert(rep->type == syntax_element_short_set_rep);
- assert(rep->next.p != 0);
- assert(rep->alt.p != 0);
- assert(rep->next.p->type == syntax_element_set);
- assert(count < rep->max);
+ BOOST_ASSERT(rep->type == syntax_element_short_set_rep);
+ BOOST_ASSERT(rep->next.p != 0);
+ BOOST_ASSERT(rep->alt.p != 0);
+ BOOST_ASSERT(rep->next.p->type == syntax_element_set);
+ BOOST_ASSERT(count < rep->max);
if(position != last)
{
// wind forward until we can skip out of the repeat:
do
{
- if(!map[(traits_uchar_type)traits_inst.translate(*position, icase)])
+ if(!map[static_cast<unsigned char>(traits_inst.translate(*position, icase))])
{
// failed repeat match, discard this state and look for another:
destroy_single_repeat();
++ position;
++state_count;
pstate = rep->next.p;
- }while((count < rep->max) && (position != last) && !access::can_start(*position, rep->_map, mask_skip));
+ }while((count < rep->max) && (position != last) && !can_start(*position, rep->_map, mask_skip));
}
if(position == last)
{
{
// can't repeat any more, remove the pushed state:
destroy_single_repeat();
- if(!access::can_start(*position, rep->_map, mask_skip))
+ if(!can_start(*position, rep->_map, mask_skip))
return true;
}
else
return false;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_long_set_repeat(bool r)
+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;
saved_single_repeat<BidiIterator>* pmp = static_cast<saved_single_repeat<BidiIterator>*>(m_backup_state);
// if we have a match, just discard this state:
}
const re_repeat* rep = pmp->rep;
- unsigned count = pmp->count;
+ std::size_t count = pmp->count;
pstate = rep->next.p;
- const re_set_long* set = static_cast<const re_set_long*>(pstate);
+ const re_set_long<mask_type>* set = static_cast<const re_set_long<mask_type>*>(pstate);
position = pmp->last_position;
- assert(rep->type == syntax_element_long_set_rep);
- assert(rep->next.p != 0);
- assert(rep->alt.p != 0);
- assert(rep->next.p->type == syntax_element_long_set);
- assert(position != last);
- assert(count < rep->max);
+ BOOST_ASSERT(rep->type == syntax_element_long_set_rep);
+ BOOST_ASSERT(rep->next.p != 0);
+ BOOST_ASSERT(rep->alt.p != 0);
+ BOOST_ASSERT(rep->next.p->type == syntax_element_long_set);
+ BOOST_ASSERT(count < rep->max);
if(position != last)
{
// wind forward until we can skip out of the repeat:
do
{
- if(position == re_is_set_member(position, last, set, re))
+ if(position == re_is_set_member(position, last, set, re.get_data(), icase))
{
// failed repeat match, discard this state and look for another:
destroy_single_repeat();
++count;
++state_count;
pstate = rep->next.p;
- }while((count < rep->max) && (position != last) && !access::can_start(*position, rep->_map, mask_skip));
+ }while((count < rep->max) && (position != last) && !can_start(*position, rep->_map, mask_skip));
}
if(position == last)
{
{
// can't repeat any more, remove the pushed state:
destroy_single_repeat();
- if(!access::can_start(*position, rep->_map, mask_skip))
+ if(!can_start(*position, rep->_map, mask_skip))
return true;
}
else
return false;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::unwind_non_greedy_repeat(bool r)
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::unwind_non_greedy_repeat(bool r)
{
saved_position<BidiIterator>* pmp = static_cast<saved_position<BidiIterator>*>(m_backup_state);
if(!r)
/*
*
* Copyright (c) 2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
const sub_match<BidiIterator>& get() { return sub; }
};
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_all_states()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_all_states()
{
- static matcher_proc_type const s_match_vtable[26] =
+ static matcher_proc_type const s_match_vtable[29] =
{
- (&perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_startmark),
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_endmark,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_literal,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_start_line,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_end_line,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_wild,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_match,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_boundary,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_within_word,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_start,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_word_end,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_start,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_buffer_end,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_backref,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_jump,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_alt,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_combining,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_soft_buffer_end,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_restart_continue,
- (::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_slow),
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_char_repeat,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set_repeat,
- &perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set_repeat,
+ (&perl_matcher<BidiIterator, Allocator, traits>::match_startmark),
+ &perl_matcher<BidiIterator, Allocator, traits>::match_endmark,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_literal,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_start_line,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_end_line,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_wild,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_match,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_word_boundary,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_within_word,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_word_start,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_word_end,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_buffer_start,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_buffer_end,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_backref,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_long_set,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_set,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_jump,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_alt,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_rep,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_combining,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_soft_buffer_end,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_restart_continue,
+ (::boost::is_random_access_iterator<BidiIterator>::value ? &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_fast : &perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_slow),
+ &perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_backstep,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_assert_backref,
+ &perl_matcher<BidiIterator, Allocator, traits>::match_toggle_case,
};
if(state_count > max_state_count)
- raise_error(traits_inst, REG_ESPACE);
+ raise_error(traits_inst, regex_constants::error_space);
while(pstate)
{
matcher_proc_type proc = s_match_vtable[pstate->type];
++state_count;
if(!(this->*proc)())
{
- if((m_match_flags & match_partial) && (position == last))
+ if((m_match_flags & match_partial) && (position == last) && (position != search_base))
m_has_partial_match = true;
return 0;
}
return true;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_startmark()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
{
int index = static_cast<const re_brace*>(pstate)->index;
bool r = true;
case -3:
{
// independent sub-expression:
+ bool old_independent = m_independent;
+ m_independent = true;
const re_syntax_base* next_pstate = static_cast<const re_jump*>(pstate->next.p)->alt.p->next.p;
pstate = pstate->next.p->next.p;
r = match_all_states();
pstate = next_pstate;
+ m_independent = old_independent;
#ifdef BOOST_REGEX_MATCH_EXTRA
if(r && (m_match_flags & match_extra))
{
#endif
break;
}
+ case -4:
+ {
+ // conditional expression:
+ const re_alt* alt = static_cast<const re_alt*>(pstate->next.p);
+ BOOST_ASSERT(alt->type == syntax_element_alt);
+ pstate = alt->next.p;
+ if(pstate->type == syntax_element_assert_backref)
+ {
+ if(!match_assert_backref())
+ pstate = alt->alt.p;
+ break;
+ }
+ else
+ {
+ // zero width assertion, have to match this recursively:
+ BOOST_ASSERT(pstate->type == syntax_element_startmark);
+ bool negated = static_cast<const re_brace*>(pstate)->index == -2;
+ BidiIterator saved_position = position;
+ const re_syntax_base* next_pstate = static_cast<const re_jump*>(pstate->next.p)->alt.p->next.p;
+ pstate = pstate->next.p->next.p;
+ bool r = match_all_states();
+ position = saved_position;
+ if(negated)
+ r = !r;
+ if(r)
+ pstate = next_pstate;
+ else
+ pstate = alt->alt.p;
+ break;
+ }
+ }
default:
{
- assert(index > 0);
+ BOOST_ASSERT(index > 0);
if((m_match_flags & match_nosubs) == 0)
{
backup_subex<BidiIterator> sub(*m_presult, index);
return r;
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_alt()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_alt()
{
bool take_first, take_second;
- const re_jump* jmp = static_cast<const re_jump*>(pstate);
+ const re_alt* jmp = static_cast<const re_alt*>(pstate);
// find out which of these two alternatives we need to take:
if(position == last)
}
else
{
- take_first = access::can_start(*position, jmp->_map, (unsigned char)mask_take);
- take_second = access::can_start(*position, jmp->_map, (unsigned char)mask_skip);
+ take_first = can_start(*position, jmp->_map, (unsigned char)mask_take);
+ take_second = can_start(*position, jmp->_map, (unsigned char)mask_skip);
}
if(take_first)
return false; // neither option is possible
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_rep()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_rep()
{
#ifdef BOOST_MSVC
#pragma warning(push)
}
else
{
- take_first = access::can_start(*position, rep->_map, (unsigned char)mask_take);
- take_second = access::can_start(*position, rep->_map, (unsigned char)mask_skip);
+ take_first = can_start(*position, rep->_map, (unsigned char)mask_take);
+ take_second = can_start(*position, rep->_map, (unsigned char)mask_skip);
}
if(next_count->get_count() < rep->min)
}
return false;
}
-
- if(rep->greedy)
+ bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent);
+ if(greedy)
{
// try and take the repeat if we can:
if((next_count->get_count() < rep->max) && take_first)
#endif
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_slow()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_slow()
{
#ifdef BOOST_MSVC
#pragma warning(push)
return false;
++count;
}
- if(rep->greedy)
+ bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent);
+ if(greedy)
{
// normal repeat:
while(count < rep->max)
#endif
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_dot_repeat_fast()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_fast()
{
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable:4127)
#endif
- if(m_match_flags & (match_not_dot_newline | match_not_dot_null))
+ if(m_match_flags & match_not_dot_null)
+ return match_dot_repeat_slow();
+ if((static_cast<const re_dot*>(pstate->next.p)->mask & match_any_mask) == 0)
return match_dot_repeat_slow();
//
// start by working out how much we can skip:
//
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
- unsigned count = (std::min)(static_cast<unsigned>(re_detail::distance(position, last)), (rep->greedy ? rep->max : rep->min));
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4267)
+#endif
+ bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent);
+ std::size_t count = (std::min)(static_cast<std::size_t>(::boost::re_detail::distance(position, last)), static_cast<std::size_t>(greedy ? rep->max : rep->min));
if(rep->min > count)
+ {
+ position = last;
return false; // not enough text left to match
+ }
std::advance(position, count);
- if((rep->leading) && (count < rep->max) && (rep->greedy))
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+ if((rep->leading) && (count < rep->max) && greedy)
restart = position;
- if(rep->greedy)
+ if(greedy)
return backtrack_till_match(count - rep->min);
// non-greedy, keep trying till we get a match:
BidiIterator save_pos;
do
{
- while((position != last) && (count < rep->max) && !access::can_start(*position, rep->_map, mask_skip))
+ while((position != last) && (count < rep->max) && !can_start(*position, rep->_map, mask_skip))
{
++position;
++count;
}
- if((rep->leading) && (count == UINT_MAX))
+ if((rep->leading) && (rep->max == UINT_MAX))
restart = position;
pstate = rep->alt.p;
save_pos = position;
#endif
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_char_repeat()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat()
{
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma option push -w-8008 -w-8066 -w-8004
#endif
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
- assert(1 == static_cast<const re_literal*>(rep->next.p)->length);
+ BOOST_ASSERT(1 == static_cast<const re_literal*>(rep->next.p)->length);
const char_type what = *reinterpret_cast<const char_type*>(static_cast<const re_literal*>(rep->next.p) + 1);
unsigned count = 0;
//
// start by working out how much we can skip:
//
- unsigned desired = rep->greedy ? rep->max : rep->min;
+ bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent);
+ std::size_t desired = greedy ? rep->max : rep->min;
if(::boost::is_random_access_iterator<BidiIterator>::value)
{
BidiIterator end = position;
- std::advance(end, (std::min)((unsigned)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))
{
++position;
}
- count = (unsigned)re_detail::distance(origin, position);
+ count = (unsigned)::boost::re_detail::distance(origin, position);
}
else
{
++count;
}
}
- if((rep->leading) && (count < rep->max) && (rep->greedy))
+ if((rep->leading) && (count < rep->max) && greedy)
restart = position;
if(count < rep->min)
return false;
- if(rep->greedy)
+ if(greedy)
return backtrack_till_match(count - rep->min);
// non-greedy, keep trying till we get a match:
BidiIterator save_pos;
do
{
- while((position != last) && (count < rep->max) && !access::can_start(*position, rep->_map, mask_skip))
+ while((position != last) && (count < rep->max) && !can_start(*position, rep->_map, mask_skip))
{
if((traits_inst.translate(*position, icase) == what))
{
#endif
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_set_repeat()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat()
{
#ifdef BOOST_MSVC
#pragma warning(push)
//
// start by working out how much we can skip:
//
- unsigned desired = rep->greedy ? rep->max : rep->min;
+ bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent);
+ std::size_t desired = greedy ? rep->max : rep->min;
if(::boost::is_random_access_iterator<BidiIterator>::value)
{
BidiIterator end = position;
- std::advance(end, (std::min)((unsigned)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[(traits_uchar_type)traits_inst.translate(*position, icase)])
+ while((position != end) && map[static_cast<unsigned char>(traits_inst.translate(*position, icase))])
{
++position;
}
- count = (unsigned)re_detail::distance(origin, position);
+ count = (unsigned)::boost::re_detail::distance(origin, position);
}
else
{
- while((count < desired) && (position != last) && map[(traits_uchar_type)traits_inst.translate(*position, icase)])
+ while((count < desired) && (position != last) && map[static_cast<unsigned char>(traits_inst.translate(*position, icase))])
{
++position;
++count;
}
}
- if((rep->leading) && (count < rep->max) && (rep->greedy))
+ if((rep->leading) && (count < rep->max) && greedy)
restart = position;
if(count < rep->min)
return false;
- if(rep->greedy)
+ if(greedy)
return backtrack_till_match(count - rep->min);
// non-greedy, keep trying till we get a match:
BidiIterator save_pos;
do
{
- while((position != last) && (count < rep->max) && !access::can_start(*position, rep->_map, mask_skip))
+ while((position != last) && (count < rep->max) && !can_start(*position, rep->_map, mask_skip))
{
- if(map[(traits_uchar_type)traits_inst.translate(*position, icase)])
+ if(map[static_cast<unsigned char>(traits_inst.translate(*position, icase))])
{
++position;
++count;
if(position == last)
return false;
position = save_pos;
- if(map[(traits_uchar_type)traits_inst.translate(*position, icase)])
+ if(map[static_cast<unsigned char>(traits_inst.translate(*position, icase))])
{
++position;
++count;
#endif
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::match_long_set_repeat()
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat()
{
#ifdef BOOST_MSVC
#pragma warning(push)
#ifdef __BORLANDC__
#pragma option push -w-8008 -w-8066 -w-8004
#endif
+ typedef typename traits::char_class_type char_class_type;
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
- const re_set_long* set = static_cast<const re_set_long*>(pstate->next.p);
+ const re_set_long<char_class_type>* set = static_cast<const re_set_long<char_class_type>*>(pstate->next.p);
unsigned count = 0;
//
// start by working out how much we can skip:
//
- unsigned desired = rep->greedy ? rep->max : rep->min;
+ bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent);
+ std::size_t desired = greedy ? rep->max : rep->min;
if(::boost::is_random_access_iterator<BidiIterator>::value)
{
BidiIterator end = position;
- std::advance(end, (std::min)((unsigned)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)))
+ while((position != end) && (position != re_is_set_member(position, last, set, re.get_data(), icase)))
{
++position;
}
- count = (unsigned)re_detail::distance(origin, position);
+ count = (unsigned)::boost::re_detail::distance(origin, position);
}
else
{
- while((count < desired) && (position != last) && (position != re_is_set_member(position, last, set, re)))
+ while((count < desired) && (position != last) && (position != re_is_set_member(position, last, set, re.get_data(), icase)))
{
++position;
++count;
}
}
- if((rep->leading) && (count < rep->max) && (rep->greedy))
+ if((rep->leading) && (count < rep->max) && greedy)
restart = position;
if(count < rep->min)
return false;
- if(rep->greedy)
+ if(greedy)
return backtrack_till_match(count - rep->min);
// non-greedy, keep trying till we get a match:
BidiIterator save_pos;
do
{
- while((position != last) && (count < rep->max) && !access::can_start(*position, rep->_map, mask_skip))
+ while((position != last) && (count < rep->max) && !can_start(*position, rep->_map, mask_skip))
{
- if(position != re_is_set_member(position, last, set, re))
+ if(position != re_is_set_member(position, last, set, re.get_data(), icase))
{
++position;
++count;
if(position == last)
return false;
position = save_pos;
- if(position != re_is_set_member(position, last, set, re))
+ if(position != re_is_set_member(position, last, set, re.get_data(), icase))
{
++position;
++count;
#endif
}
-template <class BidiIterator, class Allocator, class traits, class Allocator2>
-bool perl_matcher<BidiIterator, Allocator, traits, Allocator2>::backtrack_till_match(unsigned count)
+template <class BidiIterator, class Allocator, class traits>
+bool perl_matcher<BidiIterator, Allocator, traits>::backtrack_till_match(std::size_t count)
{
#ifdef BOOST_MSVC
#pragma warning(push)
}
do
{
- while(count && !access::can_start(*position, rep->_map, mask_skip))
+ while(count && !can_start(*position, rep->_map, mask_skip))
{
--position;
--count;
--- /dev/null
+/*
+ *
+ * Copyright (c) 1998-2002
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE: primary_transform.hpp
+ * VERSION: see <boost/version.hpp>
+ * DESCRIPTION: Heuristically determines the sort string format in use
+ * by the current locale.
+ */
+
+#ifndef BOOST_REGEX_PRIMARY_TRANSFORM
+#define BOOST_REGEX_PRIMARY_TRANSFORM
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost{
+ namespace re_detail{
+
+
+enum{
+ sort_C,
+ sort_fixed,
+ sort_delim,
+ sort_unknown
+};
+
+template <class S, class charT>
+unsigned count_chars(const S& s, charT c)
+{
+ //
+ // Count how many occurances of character c occur
+ // in string s: if c is a delimeter between collation
+ // fields, then this should be the same value for all
+ // sort keys:
+ //
+ unsigned int count = 0;
+ for(unsigned pos = 0; pos < s.size(); ++pos)
+ {
+ if(s[pos] == c) ++count;
+ }
+ return count;
+}
+
+
+template <class traits, class charT>
+unsigned find_sort_syntax(const traits* pt, charT* delim)
+{
+ //
+ // compare 'a' with 'A' to see how similar they are,
+ // should really use a-accute but we can't portably do that,
+ //
+ typedef typename traits::string_type string_type;
+ typedef typename traits::char_type char_type;
+
+ // Suppress incorrect warning for MSVC
+ (void)pt;
+
+ char_type a[2] = {'a', '\0', };
+ string_type sa(pt->transform(a, a+1));
+ if(sa == a)
+ {
+ *delim = 0;
+ return sort_C;
+ }
+ char_type A[2] = { 'A', '\0', };
+ string_type sA(pt->transform(A, A+1));
+ char_type c[2] = { ';', '\0', };
+ string_type sc(pt->transform(c, c+1));
+
+ int pos = 0;
+ while((pos <= static_cast<int>(sa.size())) && (pos <= static_cast<int>(sA.size())) && (sa[pos] == sA[pos])) ++pos;
+ --pos;
+ if(pos < 0)
+ {
+ *delim = 0;
+ return sort_unknown;
+ }
+ //
+ // at this point sa[pos] is either the end of a fixed width field
+ // or the character that acts as a delimiter:
+ //
+ charT maybe_delim = sa[pos];
+ if((pos != 0) && (count_chars(sa, maybe_delim) == count_chars(sA, maybe_delim)) && (count_chars(sa, maybe_delim) == count_chars(sc, maybe_delim)))
+ {
+ *delim = maybe_delim;
+ return sort_delim;
+ }
+ //
+ // OK doen't look like a delimiter, try for fixed width field:
+ //
+ if((sa.size() == sA.size()) && (sa.size() == sc.size()))
+ {
+ // note assumes that the fixed width field is less than
+ // (numeric_limits<charT>::max)(), should be true for all types
+ // I can't imagine 127 character fields...
+ *delim = static_cast<charT>(++pos);
+ return sort_fixed;
+ }
+ //
+ // don't know what it is:
+ //
+ *delim = 0;
+ return sort_unknown;
+}
+
+
+ } // namespace re_detail
+} // namespace boost
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif
+
+
+
+
+
+
+
--- /dev/null
+/*
+ *
+ * Copyright (c) 2004
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE basic_regex_creator.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares template class basic_regex_creator which fills in
+ * the data members of a regex_data object.
+ */
+
+#ifndef BOOST_REGEX_V4_PROTECTED_CALL_HPP
+#define BOOST_REGEX_V4_PROTECTED_CALL_HPP
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost{
+namespace re_detail{
+
+class BOOST_REGEX_DECL abstract_protected_call
+{
+public:
+ bool BOOST_REGEX_CALL execute()const;
+ // this stops gcc-4 from complaining:
+ virtual ~abstract_protected_call(){}
+private:
+ virtual bool call()const = 0;
+};
+
+template <class T>
+class concrete_protected_call
+ : public abstract_protected_call
+{
+public:
+ typedef bool (T::*proc_type)();
+ concrete_protected_call(T* o, proc_type p)
+ : obj(o), proc(p) {}
+private:
+ virtual bool call()const;
+ T* obj;
+ proc_type proc;
+};
+
+template <class T>
+bool concrete_protected_call<T>::call()const
+{
+ return (obj->*proc)();
+}
+
+}
+} // namespace boost
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
public:
enum flag_type_
{
- escape_in_lists = 1, // '\' special inside [...]
- char_classes = escape_in_lists << 1, // [[:CLASS:]] allowed
- intervals = char_classes << 1, // {x,y} allowed
- limited_ops = intervals << 1, // all of + ? and | are normal characters
- newline_alt = limited_ops << 1, // \n is the same as |
- bk_plus_qm = newline_alt << 1, // uses \+ and \?
- bk_braces = bk_plus_qm << 1, // uses \{ and \}
- bk_parens = bk_braces << 1, // uses \( and \)
- bk_refs = bk_parens << 1, // \d allowed
- bk_vbar = bk_refs << 1, // uses \|
-
- use_except = bk_vbar << 1, // exception on error
- failbit = use_except << 1, // error flag
- literal = failbit << 1, // all characters are literals
- icase = literal << 1, // characters are matched regardless of case
- nocollate = 0, // don't use locale specific collation (deprecated)
- collate = icase << 1, // use locale specific collation
- perlex = collate << 1, // perl extensions
- nosubs = perlex << 1, // don't mark sub-expressions
- optimize = 0, // not really supported
-
- basic = char_classes | intervals | limited_ops | bk_braces | bk_parens | bk_refs | collate,
- extended = char_classes | intervals | bk_refs | collate,
- normal = perlex | escape_in_lists | char_classes | intervals | bk_refs | nocollate,
- emacs = bk_braces | bk_parens | bk_refs | bk_vbar,
- awk = extended | escape_in_lists,
+ //
+ // Divide the flags up into logical groups:
+ // bits 0-7 indicate main synatx type.
+ // bits 8-15 indicate syntax subtype.
+ // bits 16-31 indicate options that are common to all
+ // regex syntaxes.
+ // In all cases the default is 0.
+ //
+ // Main synatx group:
+ //
+ perl_syntax_group = 0, // default
+ basic_syntax_group = 1, // POSIX basic
+ literal = 2, // all characters are literals
+ main_option_type = literal | basic_syntax_group | perl_syntax_group, // everything!
+ //
+ // options specific to perl group:
+ //
+ no_bk_refs = 1 << 8, // \d not allowed
+ no_perl_ex = 1 << 9, // disable perl extensions
+ no_mod_m = 1 << 10, // disable Perl m modifier
+ mod_x = 1 << 11, // Perl x modifier
+ mod_s = 1 << 12, // force s modifier on (overrides match_not_dot_newline)
+ no_mod_s = 1 << 13, // force s modifier off (overrides match_not_dot_newline)
+
+ //
+ // options specific to basic group:
+ //
+ no_char_classes = 1 << 8, // [[:CLASS:]] not allowed
+ no_intervals = 1 << 9, // {x,y} not allowed
+ bk_plus_qm = 1 << 10, // uses \+ and \?
+ bk_vbar = 1 << 11, // use \| for alternatives
+ emacs_ex = 1 << 12, // enables emacs extensions
+
+ //
+ // options common to all groups:
+ //
+ no_escape_in_lists = 1 << 16, // '\' not special inside [...]
+ newline_alt = 1 << 17, // \n is the same as |
+ no_except = 1 << 18, // no exception on error
+ failbit = 1 << 19, // error flag
+ icase = 1 << 20, // characters are matched regardless of case
+ nocollate = 0, // don't use locale specific collation (deprecated)
+ collate = 1 << 21, // use locale specific collation
+ nosubs = 1 << 22, // don't mark sub-expressions
+ optimize = 0, // not really supported
+
+
+
+ basic = basic_syntax_group | collate | no_escape_in_lists,
+ extended = no_bk_refs | collate | no_perl_ex | no_escape_in_lists,
+ normal = 0,
+ emacs = basic_syntax_group | collate | emacs_ex | bk_vbar,
+ awk = no_bk_refs | collate | no_perl_ex,
grep = basic | newline_alt,
egrep = extended | newline_alt,
sed = basic,
restart_fixed_lit = 6,
restart_count = 7
};
-
- flag_type BOOST_REGEX_CALL flags()const
- {
- return _flags;
- }
-
- regbase();
- regbase(const regbase& b);
- void swap(regbase& that)
- { std::swap(_flags, that._flags); }
-protected:
- flag_type _flags;
};
//
enum flag_type_
{
- escape_in_lists = ::boost::regbase::escape_in_lists,
- char_classes = ::boost::regbase::char_classes,
- intervals = ::boost::regbase::intervals,
- limited_ops = ::boost::regbase::limited_ops,
- newline_alt = ::boost::regbase::newline_alt,
- bk_plus_qm = ::boost::regbase::bk_plus_qm,
- bk_braces = ::boost::regbase::bk_braces,
- bk_parens = ::boost::regbase::bk_parens,
- bk_refs = ::boost::regbase::bk_refs,
- bk_vbar = ::boost::regbase::bk_vbar,
- use_except = ::boost::regbase::use_except,
+ no_except = ::boost::regbase::no_except,
failbit = ::boost::regbase::failbit,
literal = ::boost::regbase::literal,
icase = ::boost::regbase::icase,
nocollate = ::boost::regbase::nocollate,
collate = ::boost::regbase::collate,
- perlex = ::boost::regbase::perlex,
nosubs = ::boost::regbase::nosubs,
optimize = ::boost::regbase::optimize,
+ bk_plus_qm = ::boost::regbase::bk_plus_qm,
+ bk_vbar = ::boost::regbase::bk_vbar,
+ no_intervals = ::boost::regbase::no_intervals,
+ no_char_classes = ::boost::regbase::no_char_classes,
+ no_escape_in_lists = ::boost::regbase::no_escape_in_lists,
+ no_mod_m = ::boost::regbase::no_mod_m,
+ mod_x = ::boost::regbase::mod_x,
+ mod_s = ::boost::regbase::mod_s,
+ no_mod_s = ::boost::regbase::no_mod_s,
basic = ::boost::regbase::basic,
extended = ::boost::regbase::extended,
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
* LOCATION: see http://www.boost.org for most recent version.
* FILE regex.cpp
* VERSION see <boost/version.hpp>
- * DESCRIPTION: Declares boost::reg_expression<> and associated
+ * DESCRIPTION: Declares boost::basic_regex<> and associated
* functions and classes. This header is the main
* entry point for the template regex code.
*/
#ifndef BOOST_RE_REGEX_HPP_INCLUDED
#define BOOST_RE_REGEX_HPP_INCLUDED
-#ifndef BOOST_RE_CREGEX_HPP
-#include <boost/cregex.hpp>
-#endif
-
#ifdef __cplusplus
// what follows is all C++ don't include in C builds!!
-#ifdef BOOST_REGEX_DEBUG
-# include <iosfwd>
-#endif
-
-#include <new>
-#include <cstring>
#ifndef BOOST_REGEX_CONFIG_HPP
#include <boost/regex/config.hpp>
#endif
+#ifndef BOOST_REGEX_WORKAROUND_HPP
+#include <boost/regex/v4/regex_workaround.hpp>
+#endif
+
#ifndef BOOST_REGEX_FWD_HPP
#include <boost/regex_fwd.hpp>
#endif
-#ifndef BOOST_REGEX_STACK_HPP
-#include <boost/regex/v4/regex_stack.hpp>
+#ifndef BOOST_REGEX_TRAITS_HPP
+#include <boost/regex/regex_traits.hpp>
#endif
#ifndef BOOST_REGEX_RAW_BUFFER_HPP
-#include <boost/regex/v4/regex_raw_buffer.hpp>
+#include <boost/regex/v4/error_type.hpp>
#endif
-#ifndef BOOST_REGEX_KMP_HPP
-#include <boost/regex/v4/regex_kmp.hpp>
+#ifndef BOOST_REGEX_V4_MATCH_FLAGS
+#include <boost/regex/v4/match_flags.hpp>
+#endif
+#ifndef BOOST_REGEX_RAW_BUFFER_HPP
+#include <boost/regex/v4/regex_raw_buffer.hpp>
#endif
#ifndef BOOST_RE_PAT_EXCEPT_HPP
#include <boost/regex/pattern_except.hpp>
#endif
-#ifndef BOOST_REGEX_TRAITS_HPP
-#include <boost/regex/regex_traits.hpp>
-#endif
-#include <boost/scoped_array.hpp>
#ifndef BOOST_REGEX_V4_CHAR_REGEX_TRAITS_HPP
#include <boost/regex/v4/char_regex_traits.hpp>
#ifndef BOOST_REGEX_V4_ITERATOR_TRAITS_HPP
#include <boost/regex/v4/iterator_traits.hpp>
#endif
-#ifndef BOOST_REGEX_V4_ITERATOR_TRAITS_HPP
-#include <boost/regex/v4/iterator_traits.hpp>
-#endif
#ifndef BOOST_REGEX_V4_BASIC_REGEX_HPP
#include <boost/regex/v4/basic_regex.hpp>
#endif
+#ifndef BOOST_REGEX_V4_BASIC_REGEX_CREATOR_HPP
+#include <boost/regex/v4/basic_regex_creator.hpp>
+#endif
+#ifndef BOOST_REGEX_V4_BASIC_REGEX_PARSER_HPP
+#include <boost/regex/v4/basic_regex_parser.hpp>
+#endif
#ifndef BOOST_REGEX_V4_SUB_MATCH_HPP
#include <boost/regex/v4/sub_match.hpp>
#endif
#ifndef BOOST_REGEX_V4_MATCH_RESULTS_HPP
#include <boost/regex/v4/match_results.hpp>
#endif
-#ifndef BOOST_REGEX_COMPILE_HPP
-#include <boost/regex/v4/regex_compile.hpp>
+#ifndef BOOST_REGEX_V4_PROTECTED_CALL_HPP
+#include <boost/regex/v4/protected_call.hpp>
+#endif
+#ifndef BOOST_REGEX_MATCHER_HPP
+#include <boost/regex/v4/perl_matcher.hpp>
#endif
-
//
// template instances:
//
#endif
#ifndef BOOST_NO_WREGEX
-#define BOOST_REGEX_CHAR_T boost::regex_wchar_type
+#define BOOST_REGEX_CHAR_T wchar_t
#ifdef BOOST_REGEX_WIDE_INSTANTIATE
# define BOOST_REGEX_INSTANTIATE
#endif
#endif
#endif
+#if !defined(BOOST_NO_WREGEX) && defined(BOOST_REGEX_HAS_OTHER_WCHAR_T)
+#define BOOST_REGEX_CHAR_T unsigned short
+#ifdef BOOST_REGEX_US_INSTANTIATE
+# define BOOST_REGEX_INSTANTIATE
+#endif
+#include <boost/regex/v4/instances.hpp>
+#undef BOOST_REGEX_CHAR_T
+#ifdef BOOST_REGEX_INSTANTIATE
+# undef BOOST_REGEX_INSTANTIATE
+#endif
+#endif
+
namespace boost{
#ifdef BOOST_REGEX_NO_FWD
-typedef reg_expression<char, regex_traits<char>, BOOST_DEFAULT_ALLOCATOR(char)> regex;
+typedef basic_regex<char, regex_traits<char> > regex;
#ifndef BOOST_NO_WREGEX
-typedef reg_expression<wchar_t, regex_traits<wchar_t>, BOOST_DEFAULT_ALLOCATOR(wchar_t)> wregex;
+typedef basic_regex<wchar_t, regex_traits<wchar_t> > wregex;
#endif
#endif
#ifndef BOOST_REGEX_V4_REGEX_SEARCH_HPP
#include <boost/regex/v4/regex_search.hpp>
#endif
+#ifndef BOOST_REGEX_ITERATOR_HPP
+#include <boost/regex/v4/regex_iterator.hpp>
+#endif
+#ifndef BOOST_REGEX_TOKEN_ITERATOR_HPP
+#include <boost/regex/v4/regex_token_iterator.hpp>
+#endif
#ifndef BOOST_REGEX_V4_REGEX_GREP_HPP
#include <boost/regex/v4/regex_grep.hpp>
#endif
#ifndef BOOST_REGEX_SPLIT_HPP
#include <boost/regex/v4/regex_split.hpp>
#endif
-#ifndef BOOST_REGEX_ITERATOR_HPP
-#include <boost/regex/v4/regex_iterator.hpp>
-#endif
-#ifndef BOOST_REGEX_TOKEN_ITERATOR_HPP
-#include <boost/regex/v4/regex_token_iterator.hpp>
-#endif
#endif // __cplusplus
+++ /dev/null
-/*
- *
- * Copyright (c) 1998-2002
- * Dr John Maddock
- *
- * Use, modification and distribution are subject to the
- * Boost Software License, Version 1.0. (See accompanying file
- * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- *
- */
-
- /*
- * LOCATION: see http://www.boost.org for most recent version.
- * FILE regex_compile.hpp
- * VERSION see <boost/version.hpp>
- * DESCRIPTION: Declares reg_expression<> member functions. This is
- * an internal header file, do not include directly.
- */
-
-#ifndef BOOST_REGEX_COMPILE_HPP
-#define BOOST_REGEX_COMPILE_HPP
-
-namespace boost{
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_PREFIX
-#endif
-#ifdef __BORLANDC__
-#pragma option push -w-8004
-#endif
-
-namespace re_detail{
-
-
-template <class traits>
-struct kmp_translator
-{
- typedef typename traits::char_type char_type;
- bool icase;
- const traits* pt;
- kmp_translator(bool c, traits* p) : icase(c), pt(p) {}
- char_type operator()(char_type c)
- {
- return pt->translate(c, icase);
- }
-};
-
-
-template <class charT, class traits_type, class Allocator>
-bool BOOST_REGEX_CALL re_maybe_set_member(charT c,
- const re_set_long* set_,
- const reg_expression<charT, traits_type, Allocator>& e)
-{
- const charT* p = reinterpret_cast<const charT*>(set_+1);
- bool icase = e.flags() & regex_constants::icase;
- charT col = e.get_traits().translate(c, icase);
- for(unsigned int i = 0; i < set_->csingles; ++i)
- {
- if(col == *p)
- return set_->isnot ? false : true;
-
- while(*p)++p;
- ++p; // skip null
- }
- return set_->isnot ? true : false;
-}
-
-} // namespace re_detail
-
-template <class traits>
-struct is_big_char
-{
- typedef typename traits::uchar_type traits_uchar_type;
- typedef typename traits::size_type traits_size_type;
-#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
- static bool test(char)
- { return false; }
- static bool test(unsigned char)
- { return false; }
- static bool test(signed char)
- { return false; }
-#endif
- template <class charT> static bool test(charT c)
- { return (traits_size_type)(traits_uchar_type)c >= 256; }
-};
-
-template <class charT, class traits, class Allocator>
-inline bool BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::can_start(charT c, const unsigned char* _map, unsigned char mask, const re_detail::_wide_type&)
-{
- if(is_big_char<traits>::test(c))
- return true;
- return BOOST_REGEX_MAKE_BOOL(_map[(traits_uchar_type)c] & mask);
-}
-
-template <class charT, class traits, class Allocator>
-inline bool BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::can_start(charT c, const unsigned char* _map, unsigned char mask, const re_detail::_narrow_type&)
-{
- return BOOST_REGEX_MAKE_BOOL(_map[(traits_uchar_type)c] & mask);
-}
-
-template <class charT, class traits, class Allocator>
-reg_expression<charT, traits, Allocator>::reg_expression(const Allocator& a)
- : regbase(), data(a), pkmp(0), error_code_(REG_EMPTY), _expression(0)
-{
-}
-
-template <class charT, class traits, class Allocator>
-reg_expression<charT, traits, Allocator>::reg_expression(const charT* p, flag_type f, const Allocator& a)
- : data(a), pkmp(0), error_code_(REG_EMPTY), _expression(0)
-{
- set_expression(p, f | regex_constants::use_except);
-}
-
-template <class charT, class traits, class Allocator>
-reg_expression<charT, traits, Allocator>::reg_expression(const charT* p1, const charT* p2, flag_type f, const Allocator& a)
- : data(a), pkmp(0), error_code_(REG_EMPTY), _expression(0)
-{
- set_expression(p1, p2, f | regex_constants::use_except);
-}
-
-template <class charT, class traits, class Allocator>
-reg_expression<charT, traits, Allocator>::reg_expression(const charT* p, size_type len, flag_type f, const Allocator& a)
- : data(a), pkmp(0), error_code_(REG_EMPTY), _expression(0)
-{
- set_expression(p, p + len, f | regex_constants::use_except);
-}
-
-template <class charT, class traits, class Allocator>
-reg_expression<charT, traits, Allocator>::reg_expression(const reg_expression<charT, traits, Allocator>& e)
- : regbase(e), data(e.allocator()), pkmp(0), error_code_(REG_EMPTY), _expression(0)
-{
- //
- // we do a deep copy only if e is a valid expression, otherwise fail.
- //
- if(e.error_code() == 0)
- {
- const charT* pe = e.expression();
- set_expression(pe, pe + e._expression_len, e.flags() | regex_constants::use_except);
- }
- else
- {
- _flags = e.flags() & ~(regex_constants::use_except);
- fail(e.error_code());
- }
-}
-
-template <class charT, class traits, class Allocator>
-reg_expression<charT, traits, Allocator>::~reg_expression()
-{
- if(pkmp)
- re_detail::kmp_free(pkmp, data.allocator());
-}
-
-template <class charT, class traits, class Allocator>
-reg_expression<charT, traits, Allocator>& BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::operator=(const reg_expression<charT, traits, Allocator>& e)
-{
- //
- // we do a deep copy only if e is a valid expression, otherwise fail.
- //
- if(this == &e) return *this;
- _flags = use_except;
- fail(e.error_code());
- if(error_code() == 0)
- set_expression(e._expression, e._expression + e._expression_len, e.flags() | regex_constants::use_except);
- return *this;
-}
-
-template <class charT, class traits, class Allocator>
-int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::compare(const reg_expression<charT, traits, Allocator>& e)const
-{
- if(_flags != e.flags())
- return _flags - e.flags();
- return str().compare(e.str());
-}
-
-template <class charT, class traits, class Allocator>
-void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::swap(reg_expression& that)throw()
-{
- traits_inst.swap(that.traits_inst);
- data.swap(that.data);
- static_cast<regbase&>(*this).swap(that);
-
- std::swap(_restart_type, that._restart_type);
- std::swap(marks, that.marks);
- std::swap(repeats, that.repeats);
- std::swap(startmap, that.startmap);
- std::swap(_expression_len, that._expression_len);
- std::swap(_leading_len, that._leading_len);
- std::swap(_leading_string, that._leading_string);
- std::swap(_leading_string_len, that._leading_string_len);
- std::swap(pkmp, that.pkmp);
- std::swap(error_code_, that.error_code_);
- std::swap(_expression, that._expression);
-}
-
-template <class charT, class traits, class Allocator>
-Allocator BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::allocator()const
-{
- return data.allocator();
-}
-
-template <class charT, class traits, class Allocator>
-Allocator BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::get_allocator()const
-{
- return data.allocator();
-}
-
-template <class charT, class traits, class Allocator>
-unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::parse_inner_set(const charT*& arg_first, const charT* arg_last)
-{
- //
- // we have an inner [...] construct
- //
- jm_assert(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*arg_first) == traits_type::syntax_open_set);
- const charT* base = arg_first;
- while( (arg_first != arg_last)
- && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*arg_first) != traits_type::syntax_close_set) )
- ++arg_first;
- if(arg_first == arg_last)
- return 0;
- ++arg_first;
- if((arg_first-base) < 5)
- return 0;
- if(*(base+1) != *(arg_first-2))
- return 0;
- unsigned int result = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+1));
- if((result == traits_type::syntax_colon) && ((arg_first-base) == 5))
- {
- unsigned type = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+2));
- if((type == traits_type::syntax_left_word) || (type == traits_type::syntax_right_word))
- return type;
- }
- return ((result == traits_type::syntax_colon) || (result == traits_type::syntax_dot) || (result == traits_type::syntax_equal)) ? result : 0;
-}
-
-
-template <class charT, class traits, class Allocator>
-bool BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::skip_space(const charT*& arg_first, const charT* arg_last)
-{
- //
- // returns true if we get to arg_last:
- //
- while((arg_first != arg_last) && (traits_inst.is_class(*arg_first, traits_type::char_class_space) == true))
- {
- ++arg_first;
- }
- return arg_first == arg_last;
-}
-
-template <class charT, class traits, class Allocator>
-void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::parse_range(const charT*& ptr, const charT* arg_end, unsigned& min, unsigned& max)
-{
- //
- // we have {x} or {x,} or {x,y} NB no spaces inside braces
- // anything else is illegal
- // On input ptr points to "{"
- //
- ++ptr;
- if(skip_space(ptr, arg_end))
- {
- fail(REG_EBRACE);
- return;
- }
- if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) != traits_type::syntax_digit)
- {
- fail(REG_BADBR);
- return;
- }
- min = traits_inst.toi(ptr, arg_end, 10);
- if(skip_space(ptr, arg_end))
- {
- fail(REG_EBRACE);
- return;
- }
- if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_comma)
- {
- //we have a second interval:
- ++ptr;
- if(skip_space(ptr, arg_end))
- {
- fail(REG_EBRACE);
- return;
- }
- if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_digit)
- max = traits_inst.toi(ptr, arg_end, 10);
- else
- max = (unsigned)-1;
- }
- else
- max = min;
-
- // validate input:
- if(skip_space(ptr, arg_end))
- {
- fail(REG_EBRACE);
- return;
- }
- if(max < min)
- {
- fail(REG_ERANGE);
- return;
- }
- if(_flags & bk_braces)
- {
- if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) != traits_type::syntax_slash)
- {
- fail(REG_BADBR);
- return;
- }
- else
- {
- // back\ is OK now check the }
- ++ptr;
- if((ptr == arg_end) || (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) != traits_type::syntax_close_brace))
- {
- fail(REG_BADBR);
- return;
- }
- }
- }
- else if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) != traits_type::syntax_close_brace)
- {
- fail(REG_BADBR);
- return;
- }
-}
-
-template <class charT, class traits, class Allocator>
-charT BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::parse_escape(const charT*& arg_first, const charT* arg_last)
-{
- charT c(*arg_first);
- traits_size_type c_unsigned = (traits_size_type)(traits_uchar_type)*arg_first;
- // this is only used for the switch(), but cannot be folded in
- // due to a bug in Comeau 4.2.44beta3
- traits_size_type syntax = traits_inst.syntax_type(c_unsigned);
- switch(syntax)
- {
- case traits_type::syntax_a:
- c = '\a';
- ++arg_first;
- break;
- case traits_type::syntax_f:
- c = '\f';
- ++arg_first;
- break;
- case traits_type::syntax_n:
- c = '\n';
- ++arg_first;
- break;
- case traits_type::syntax_r:
- c = '\r';
- ++arg_first;
- break;
- case traits_type::syntax_t:
- c = '\t';
- ++arg_first;
- break;
- case traits_type::syntax_v:
- c = '\v';
- ++arg_first;
- break;
- case traits_type::syntax_x:
- ++arg_first;
- if(arg_first == arg_last)
- {
- fail(REG_EESCAPE);
- break;
- }
- // maybe have \x{ddd}
- if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*arg_first)) == traits_type::syntax_open_brace)
- {
- ++arg_first;
- if(arg_first == arg_last)
- {
- fail(REG_EESCAPE);
- break;
- }
- if(traits_inst.is_class(*arg_first, traits_type::char_class_xdigit) == false)
- {
- fail(REG_BADBR);
- break;
- }
- c = (charT)traits_inst.toi(arg_first, arg_last, -16);
- if((arg_first == arg_last) || (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*arg_first)) != traits_type::syntax_close_brace))
- {
- fail(REG_BADBR);
- }
- ++arg_first;
- break;
- }
- else
- {
- if(traits_inst.is_class(*arg_first, traits_type::char_class_xdigit) == false)
- {
- fail(REG_BADBR);
- break;
- }
- c = (charT)traits_inst.toi(arg_first, arg_last, -16);
- }
- break;
- case traits_type::syntax_c:
- ++arg_first;
- if(arg_first == arg_last)
- {
- fail(REG_EESCAPE);
- break;
- }
- if(((traits_uchar_type)(*arg_first) < (traits_uchar_type)'@')
- || ((traits_uchar_type)(*arg_first) > (traits_uchar_type)127) )
- {
- fail(REG_EESCAPE);
- return (charT)0;
- }
- c = (charT)((traits_uchar_type)(*arg_first) - (traits_uchar_type)'@');
- ++arg_first;
- break;
- case traits_type::syntax_e:
- c = (charT)27;
- ++arg_first;
- break;
- case traits_type::syntax_digit:
- c = (charT)traits_inst.toi(arg_first, arg_last, -8);
- break;
- default:
- //c = *arg_first;
- ++arg_first;
- }
- return c;
-}
-
-template <class charT, class traits, class Allocator>
-void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::compile_maps()
-{
- re_detail::re_syntax_base* record = static_cast<re_detail::re_syntax_base*>(data.data());
- // always compile the first _map:
- std::memset(startmap, 0, 256);
- record->can_be_null = 0;
- compile_map(record, startmap, 0, re_detail::mask_all);
-
- while(record->type != re_detail::syntax_element_match)
- {
- if((record->type == re_detail::syntax_element_alt) || (record->type == re_detail::syntax_element_rep))
- {
- std::memset(&(static_cast<re_detail::re_jump*>(record)->_map), 0, 256);
- record->can_be_null = 0;
- compile_map(record->next.p, static_cast<re_detail::re_jump*>(record)->_map, &(record->can_be_null), re_detail::mask_take, static_cast<re_detail::re_jump*>(record)->alt.p);
- compile_map(static_cast<re_detail::re_jump*>(record)->alt.p, static_cast<re_detail::re_jump*>(record)->_map, &(record->can_be_null), re_detail::mask_skip);
- if(record->type == re_detail::syntax_element_rep)
- {
- re_detail::re_repeat* rep = static_cast<re_detail::re_repeat*>(record);
- // set whether this is a singleton repeat or not:
- if(rep->next.p->next.p->next.p == rep->alt.p)
- {
- switch(rep->next.p->type)
- {
- case re_detail::syntax_element_wild:
- rep->type = re_detail::syntax_element_dot_rep;
- break;
- case re_detail::syntax_element_literal:
- rep->type = re_detail::syntax_element_char_rep;
- break;
- case re_detail::syntax_element_set:
- rep->type = re_detail::syntax_element_short_set_rep;
- break;
- case re_detail::syntax_element_long_set:
- if(static_cast<re_detail::re_set_long*>(rep->next.p)->singleton)
- rep->type = re_detail::syntax_element_long_set_rep;
- break;
- default:
- break;
- }
- }
- }
- }
- else
- {
- record->can_be_null = 0;
- compile_map(record, 0, &(record->can_be_null), re_detail::mask_all);
- }
- record = record->next.p;
- }
- record->can_be_null = re_detail::mask_all;
-}
-
-template <class charT, class traits, class Allocator>
-bool BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::probe_start(
- re_detail::re_syntax_base* node, charT cc, re_detail::re_syntax_base* terminal) const
-{
- unsigned int c;
-
- switch(node->type)
- {
- case re_detail::syntax_element_startmark:
- if(static_cast<const re_detail::re_brace*>(node)->index == -1)
- {
- return probe_start(node->next.p->next.p, cc, terminal)
- && probe_start(static_cast<const re_detail::re_jump*>(node->next.p)->alt.p, cc, terminal);
- }
- else if(static_cast<const re_detail::re_brace*>(node)->index == -3)
- {
- return probe_start(node->next.p->next.p, cc, terminal);
- }
- // doesn't tell us anything about the next character, so:
- return probe_start(node->next.p, cc, terminal);
- case re_detail::syntax_element_endmark:
- if(static_cast<const re_detail::re_brace*>(node)->index == -3)
- {
- return true;
- }
- // fall through:
- case re_detail::syntax_element_start_line:
- case re_detail::syntax_element_word_boundary:
- case re_detail::syntax_element_buffer_start:
- case re_detail::syntax_element_restart_continue:
- // doesn't tell us anything about the next character, so:
- return probe_start(node->next.p, cc, terminal);
- case re_detail::syntax_element_literal:
- // only the first character of the literal can match:
- // note these have already been translated:
- if(*reinterpret_cast<charT*>(static_cast<re_detail::re_literal*>(node)+1) == traits_inst.translate(cc, (_flags & regex_constants::icase)))
- return true;
- return false;
- case re_detail::syntax_element_end_line:
- // next character (if there is one!) must be a newline:
- if(traits_inst.is_separator(traits_inst.translate(cc, (_flags & regex_constants::icase))))
- return true;
- return false;
- case re_detail::syntax_element_wild:
- return true;
- case re_detail::syntax_element_match:
- return true;
- case re_detail::syntax_element_within_word:
- case re_detail::syntax_element_word_start:
- return traits_inst.is_class(traits_inst.translate(cc, (_flags & regex_constants::icase)), traits_type::char_class_word);
- case re_detail::syntax_element_word_end:
- // what follows must not be a word character,
- return traits_inst.is_class(traits_inst.translate(cc, (_flags & regex_constants::icase)), traits_type::char_class_word) ? false : true;
- case re_detail::syntax_element_buffer_end:
- // we can be null, nothing must follow,
- // NB we assume that this is followed by
- // re_detail::syntax_element_match, if its not then we can
- // never match anything anyway!!
- return false;
- case re_detail::syntax_element_soft_buffer_end:
- // we can be null, only newlines must follow,
- // NB we assume that this is followed by
- // re_detail::syntax_element_match, if its not then we can
- // never match anything anyway!!
- return traits_inst.is_separator(traits_inst.translate(cc, (_flags & regex_constants::icase)));
- case re_detail::syntax_element_backref:
- // there's no easy way to determine this
- // which is not to say it can't be done!
- // for now:
- return true;
- case re_detail::syntax_element_long_set:
- // we can not be null,
- // we need to add already translated values in the set
- // to values in the _map
- return re_detail::re_maybe_set_member(cc, static_cast<const re_detail::re_set_long*>(node), *this) || (re_detail::re_is_set_member(static_cast<const charT*>(&cc), static_cast<const charT*>(&cc+1), static_cast<re_detail::re_set_long*>(node), *this) != &cc);
- case re_detail::syntax_element_set:
- // set all the elements that are set in corresponding set:
- c = (traits_size_type)(traits_uchar_type)traits_inst.translate(cc, (_flags & regex_constants::icase));
- return static_cast<re_detail::re_set*>(node)->_map[c] != 0;
- case re_detail::syntax_element_jump:
- if(static_cast<re_detail::re_jump*>(node)->alt.p < node)
- {
- // backwards jump,
- // caused only by end of repeat section, we'll treat this
- // the same as a match, because the sub-expression has matched.
- if(node->next.p == terminal)
- return true; // null repeat - we can always take this
- else
- {
- //
- // take the jump, add in fix for the fact that if the
- // repeat that we're jumping to has non-zero minimum count
- // then we need to add in the possiblity that we could still
- // skip that repeat.
- re_detail::re_syntax_base* next = static_cast<re_detail::re_jump*>(node)->alt.p;
- bool b = probe_start(next, cc, terminal);
- if((next->type == re_detail::syntax_element_rep) && (static_cast<re_detail::re_repeat*>(next)->min != 0))
- {
- b = b || probe_start(static_cast<re_detail::re_jump*>(next)->alt.p, cc, terminal);
- }
- return b;
- }
- }
- else
- // take the jump and compile:
- return probe_start(static_cast<re_detail::re_jump*>(node)->alt.p, cc, terminal);
- case re_detail::syntax_element_alt:
- // we need to take the OR of the two alternatives:
- return probe_start(static_cast<re_detail::re_jump*>(node)->alt.p, cc, terminal) || probe_start(node->next.p, cc, terminal);
- case re_detail::syntax_element_rep:
- case re_detail::syntax_element_char_rep:
- case re_detail::syntax_element_dot_rep:
- case re_detail::syntax_element_long_set_rep:
- case re_detail::syntax_element_short_set_rep:
- // we need to take the OR of the two alternatives
- if(static_cast<re_detail::re_repeat*>(node)->min == 0)
- return probe_start(node->next.p, cc, static_cast<re_detail::re_jump*>(node)->alt.p) || probe_start(static_cast<re_detail::re_jump*>(node)->alt.p, cc, terminal);
- else
- return probe_start(node->next.p, cc, static_cast<re_detail::re_jump*>(node)->alt.p);
- case re_detail::syntax_element_combining:
- return !traits_inst.is_combining(traits_inst.translate(cc, (_flags & regex_constants::icase)));
- }
- return false;
-}
-
-template <class charT, class traits, class Allocator>
-bool BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::probe_start_null(re_detail::re_syntax_base* node, re_detail::re_syntax_base* terminal)const
-{
- switch(node->type)
- {
- case re_detail::syntax_element_endmark:
- if(static_cast<const re_detail::re_brace*>(node)->index == -3)
- {
- return true;
- }
- // fall through:
- case re_detail::syntax_element_startmark:
- case re_detail::syntax_element_start_line:
- case re_detail::syntax_element_word_boundary:
- case re_detail::syntax_element_buffer_start:
- case re_detail::syntax_element_restart_continue:
- case re_detail::syntax_element_end_line:
- case re_detail::syntax_element_word_end:
- // doesn't tell us anything about the next character, so:
- return probe_start_null(node->next.p, terminal);
- case re_detail::syntax_element_match:
- case re_detail::syntax_element_buffer_end:
- case re_detail::syntax_element_soft_buffer_end:
- case re_detail::syntax_element_backref:
- return true;
- case re_detail::syntax_element_jump:
- if(static_cast<re_detail::re_jump*>(node)->alt.p < node)
- {
- // backwards jump,
- // caused only by end of repeat section, we'll treat this
- // the same as a match, because the sub-expression has matched.
- // this is only caused by NULL repeats as in "(a*)*" or "(\<)*"
- // these are really nonsensence and make the matching code much
- // harder, it would be nice to get rid of them altogether.
- if(node->next.p == terminal)
- return true;
- else
- return probe_start_null(static_cast<re_detail::re_jump*>(node)->alt.p, terminal);
- }
- else
- // take the jump and compile:
- return probe_start_null(static_cast<re_detail::re_jump*>(node)->alt.p, terminal);
- case re_detail::syntax_element_alt:
- // we need to take the OR of the two alternatives:
- return probe_start_null(static_cast<re_detail::re_jump*>(node)->alt.p, terminal) || probe_start_null(node->next.p, terminal);
- case re_detail::syntax_element_rep:
- // only need to consider skipping the repeat:
- return probe_start_null(static_cast<re_detail::re_jump*>(node)->alt.p, terminal);
- default:
- break;
- }
- return false;
-}
-
-template <class charT, class traits, class Allocator>
-void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::compile_map(
- re_detail::re_syntax_base* node, unsigned char* _map,
- unsigned int* pnull, unsigned char mask, re_detail::re_syntax_base* terminal)const
-{
- if(_map)
- {
- for(unsigned int i = 0; i < 256; ++i)
- {
- if(probe_start(node, (charT)i, terminal))
- _map[i] |= mask;
- }
- }
- if(pnull && probe_start_null(node, terminal))
- *pnull |= mask;
-}
-
-template <class charT, class traits, class Allocator>
-void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::move_offsets(re_detail::re_syntax_base* j, unsigned arg_size)
-{
-# ifdef BOOST_MSVC
-# pragma warning(push)
-# pragma warning(disable: 4127)
-#endif
- // move all offsets starting with j->link forward by arg_size
- // called after an insert:
- j = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(data.data()) + j->next.i);
- while(true)
- {
- switch(j->type)
- {
- case re_detail::syntax_element_rep:
- static_cast<re_detail::re_jump*>(j)->alt.i += arg_size;
- j->next.i += arg_size;
- break;
- case re_detail::syntax_element_jump:
- case re_detail::syntax_element_alt:
- static_cast<re_detail::re_jump*>(j)->alt.i += arg_size;
- j->next.i += arg_size;
- break;
- default:
- j->next.i += arg_size;
- break;
- }
- if(j->next.i == arg_size)
- break;
- j = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(data.data()) + j->next.i);
- }
-# ifdef BOOST_MSVC
-# pragma warning(pop)
-#endif
-}
-
-template <class charT, class traits, class Allocator>
-re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::compile_set_simple(re_detail::re_syntax_base* dat, unsigned long cls, bool isnot)
-{
- typedef typename re_detail::is_byte<charT>::width_type width_type;
- re_detail::jstack<traits_string_type, Allocator> singles(64, data.allocator());
- re_detail::jstack<traits_string_type, Allocator> ranges(64, data.allocator());
- re_detail::jstack<boost::uint_fast32_t, Allocator> classes(64, data.allocator());
- re_detail::jstack<traits_string_type, Allocator> equivalents(64, data.allocator());
- if(_flags & regbase::icase)
- {
- if((cls == traits_type::char_class_upper) || (cls == traits_type::char_class_lower))
- {
- cls = traits_type::char_class_alpha;
- }
- }
- classes.push(cls);
- if(dat)
- {
- data.align();
- dat->next.i = data.size();
- }
- return compile_set_aux(singles, ranges, classes, equivalents, isnot, width_type());
-}
-
-template <class charT, class traits, class Allocator>
-re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::compile_set(const charT*& arg_first, const charT* arg_last)
-{
- re_detail::jstack<traits_string_type, Allocator> singles(64, data.allocator());
- re_detail::jstack<traits_string_type, Allocator> ranges(64, data.allocator());
- re_detail::jstack<boost::uint_fast32_t, Allocator> classes(64, data.allocator());
- re_detail::jstack<traits_string_type, Allocator> equivalents(64, data.allocator());
- bool has_digraphs = false;
- jm_assert(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*arg_first) == traits_type::syntax_open_set);
- ++arg_first;
- bool started = false;
- bool done = false;
- bool isnot = false;
-
- enum last_type
- {
- last_single,
- last_none,
- last_dash
- };
-
- unsigned l = last_none;
- traits_string_type s;
-
- while((arg_first != arg_last) && !done)
- {
- traits_size_type c = (traits_size_type)(traits_uchar_type)*arg_first;
- // this is only used for the switch(), but cannot be folded in
- // due to a bug in Comeau 4.2.44beta3
- traits_size_type syntax = traits_inst.syntax_type(c);
- switch(syntax)
- {
- case traits_type::syntax_caret:
- if(!started && !isnot)
- {
- isnot = true;
- }
- else
- {
- s = (charT)c;
- goto char_set_literal;
- }
- break;
- case traits_type::syntax_open_set:
- {
- if((_flags & char_classes) == 0)
- {
- s = (charT)c;
- goto char_set_literal;
- }
- // check to see if we really have a class:
- const charT* base = arg_first;
- // this is only used for the switch(), but cannot be folded in
- // due to a bug in Comeau 4.2.44beta3
- unsigned int inner_set = parse_inner_set(arg_first, arg_last);
- switch(inner_set)
- {
- case traits_type::syntax_colon:
- {
- if(l == last_dash)
- {
- fail(REG_ERANGE);
- return 0;
- }
- boost::uint_fast32_t id = traits_inst.lookup_classname(base+2, arg_first-2);
- if(_flags & regex_constants::icase)
- {
- if((id == traits_type::char_class_upper) || (id == traits_type::char_class_lower))
- {
- id = traits_type::char_class_alpha;
- }
- }
- if(id == 0)
- {
- fail(REG_ECTYPE);
- return 0;
- }
- classes.push(id);
- started = true;
- l = last_none;
- }
- break;
- case traits_type::syntax_dot:
- //
- // we have a collating element [.collating-name.]
- //
- if(traits_inst.lookup_collatename(s, base+2, arg_first-2))
- {
- --arg_first;
- if(s.size() > 1)
- has_digraphs = true;
- if(s.size())goto char_set_literal;
- }
- fail(REG_ECOLLATE);
- return 0;
- case traits_type::syntax_equal:
- //
- // we have an equivalence class [=collating-name=]
- //
- if(traits_inst.lookup_collatename(s, base+2, arg_first-2))
- {
- std::size_t len = s.size();
- if(len)
- {
- unsigned i = 0;
- while(i < len)
- {
- s[i] = traits_inst.translate(s[i], (_flags & regex_constants::icase));
- ++i;
- }
- traits_string_type s2;
- traits_inst.transform_primary(s2, s);
- equivalents.push(s2);
- started = true;
- l = last_none;
- break;
- }
- }
- fail(REG_ECOLLATE);
- return 0;
- case traits_type::syntax_left_word:
- if((started == false) && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*arg_first) == traits_type::syntax_close_set))
- {
- ++arg_first;
- return add_simple(0, re_detail::syntax_element_word_start);
- }
- fail(REG_EBRACK);
- return 0;
- case traits_type::syntax_right_word:
- if((started == false) && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*arg_first) == traits_type::syntax_close_set))
- {
- ++arg_first;
- return add_simple(0, re_detail::syntax_element_word_end);
- }
- fail(REG_EBRACK);
- return 0;
- default:
- if(started == false)
- {
- unsigned int t = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*(base+1));
- if((t != traits_type::syntax_colon) && (t != traits_type::syntax_dot) && (t != traits_type::syntax_equal))
- {
- arg_first = base;
- s = (charT)c;
- goto char_set_literal;
- }
- }
- fail(REG_EBRACK);
- return 0;
- }
- if(arg_first == arg_last)
- {
- fail(REG_EBRACK);
- return 0;
- }
- continue;
- }
- case traits_type::syntax_close_set:
- if(started == false)
- {
- s = (charT)c;
- goto char_set_literal;
- }
- done = true;
- break;
- case traits_type::syntax_dash:
- if(!started)
- {
- s = (charT)c;
- goto char_set_literal;
- }
- ++arg_first;
- if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*arg_first) == traits_type::syntax_close_set)
- {
- --arg_first;
- s = (charT)c;
- goto char_set_literal;
- }
- if((singles.empty() == true) || (l != last_single))
- {
- fail(REG_ERANGE);
- return 0;
- }
- ranges.push(singles.peek());
- if(singles.peek().size() <= 1) // leave digraphs and ligatures in place
- singles.pop();
- l = last_dash;
- continue;
- case traits_type::syntax_slash:
- if(_flags & regex_constants::escape_in_lists)
- {
- ++arg_first;
- if(arg_first == arg_last)
- continue;
- /*traits_size_type*/ c = (traits_size_type)(traits_uchar_type)*arg_first;
- // this is only used for the switch(), but cannot be folded in
- // due to a bug in Comeau 4.2.44beta3
- traits_size_type syntax4 = traits_inst.syntax_type(c);
- switch(syntax4)
- {
- case traits_type::syntax_w:
- if(l == last_dash)
- {
- fail(REG_ERANGE);
- return 0;
- }
- classes.push(traits_type::char_class_word);
- started = true;
- l = last_none;
- ++arg_first;
- continue;
- case traits_type::syntax_d:
- if(l == last_dash)
- {
- fail(REG_ERANGE);
- return 0;
- }
- classes.push(traits_type::char_class_digit);
- started = true;
- l = last_none;
- ++arg_first;
- continue;
- case traits_type::syntax_s:
- if(l == last_dash)
- {
- fail(REG_ERANGE);
- return 0;
- }
- classes.push(traits_type::char_class_space);
- started = true;
- l = last_none;
- ++arg_first;
- continue;
- case traits_type::syntax_l:
- if(l == last_dash)
- {
- fail(REG_ERANGE);
- return 0;
- }
- classes.push(traits_type::char_class_lower);
- started = true;
- l = last_none;
- ++arg_first;
- continue;
- case traits_type::syntax_u:
- if(l == last_dash)
- {
- fail(REG_ERANGE);
- return 0;
- }
- classes.push(traits_type::char_class_upper);
- started = true;
- l = last_none;
- ++arg_first;
- continue;
- case traits_type::syntax_W:
- case traits_type::syntax_D:
- case traits_type::syntax_S:
- case traits_type::syntax_U:
- case traits_type::syntax_L:
- fail(REG_EESCAPE);
- return 0;
- default:
- c = parse_escape(arg_first, arg_last);
- --arg_first;
- s = (charT)c;
- goto char_set_literal;
- }
- }
- else
- {
- s = (charT)c;
- goto char_set_literal;
- }
- default:
- s = (charT)c;
- char_set_literal:
- unsigned i = 0;
- // get string length to stop us going past the end of string (DWA)
- std::size_t len = s.size();
- while(i < len)
- {
- s[i] = traits_inst.translate(s[i], (_flags & regex_constants::icase));
- ++i;
- }
- started = true;
- if(l == last_dash)
- {
- ranges.push(s);
- l = last_none;
- if(s.size() > 1) // add ligatures to singles list as well
- singles.push(s);
- }
- else
- {
- singles.push(s);
- l = last_single;
- }
- }
- ++arg_first;
- }
- if(!done)
- return 0;
-
- typedef typename re_detail::is_byte<charT>::width_type width_type;
-
- re_detail::re_syntax_base* result;
- if(has_digraphs)
- result = compile_set_aux(singles, ranges, classes, equivalents, isnot, re_detail::_wide_type());
- else
- result = compile_set_aux(singles, ranges, classes, equivalents, isnot, width_type());
- #ifdef __BORLANDC__
- // delayed throw:
- if((result == 0) && (_flags & regex_constants::use_except))
- fail(error_code());
- #endif
- return result;
-}
-
-template <class charT, class traits, class Allocator>
-re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::compile_set_aux(re_detail::jstack<traits_string_type, Allocator>& singles, re_detail::jstack<traits_string_type, Allocator>& ranges, re_detail::jstack<boost::uint_fast32_t, Allocator>& classes, re_detail::jstack<traits_string_type, Allocator>& equivalents, bool isnot, const re_detail::_wide_type&)
-{
- size_type base = data.size();
- data.extend(sizeof(re_detail::re_set_long));
- unsigned int csingles = 0;
- unsigned int cranges = 0;
- boost::uint_fast32_t cclasses = 0;
- unsigned int cequivalents = 0;
- bool nocollate_state = !(flags() & regex_constants::collate);
- bool singleton = true;
-
- while(singles.empty() == false)
- {
- ++csingles;
- const traits_string_type& s = singles.peek();
- std::size_t len = (s.size() + 1) * sizeof(charT);
- if(len > sizeof(charT) * 2)
- singleton = false;
- std::memcpy(reinterpret_cast<charT*>(data.extend(len)), s.c_str(), len);
- singles.pop();
- }
- while(ranges.empty() == false)
- {
- traits_string_type c1, c2;
- if(nocollate_state)
- c1 = ranges.peek();
- else
- traits_inst.transform(c1, ranges.peek());
- ranges.pop();
- if(nocollate_state)
- c2 = ranges.peek();
- else
- traits_inst.transform(c2, ranges.peek());
- ranges.pop();
- if(c1 < c2)
- {
- // for some reason bc5 crashes when throwing exceptions
- // from here - probably an EH-compiler bug, but hard to
- // be sure...
- // delay throw to later:
- #ifdef __BORLANDC__
- boost::uint_fast32_t f = _flags;
- _flags &= ~regex_constants::use_except;
- #endif
- fail(REG_ERANGE);
- #ifdef __BORLANDC__
- _flags = f;
- #endif
- return 0;
- }
- ++cranges;
- std::size_t len = (re_detail::re_strlen(c1.c_str()) + 1) * sizeof(charT);
- std::memcpy(data.extend(len), c1.c_str(), len);
- len = (re_detail::re_strlen(c2.c_str()) + 1) * sizeof(charT);
- std::memcpy(data.extend(len), c2.c_str(), len);
- }
- while(classes.empty() == false)
- {
- cclasses |= classes.peek();
- classes.pop();
- }
- while(equivalents.empty() == false)
- {
- ++cequivalents;
- const traits_string_type& s = equivalents.peek();
- std::size_t len = (re_detail::re_strlen(s.c_str()) + 1) * sizeof(charT);
- std::memcpy(reinterpret_cast<charT*>(data.extend(len)), s.c_str(), len);
- equivalents.pop();
- }
-
- re_detail::re_set_long* dat = reinterpret_cast<re_detail::re_set_long*>(reinterpret_cast<unsigned char*>(data.data()) + base);
- dat->type = re_detail::syntax_element_long_set;
- dat->csingles = csingles;
- dat->cranges = cranges;
- dat->cclasses = cclasses;
- dat->cequivalents = cequivalents;
- dat->isnot = isnot;
- dat->next.i = 0;
- dat->singleton = isnot ? true : singleton;
- return dat;
-}
-
-template <class charT, class traits, class Allocator>
-re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::compile_set_aux(re_detail::jstack<traits_string_type, Allocator>& singles, re_detail::jstack<traits_string_type, Allocator>& ranges, re_detail::jstack<boost::uint_fast32_t, Allocator>& classes, re_detail::jstack<traits_string_type, Allocator>& equivalents, bool isnot, const re_detail::_narrow_type&)
-{
- re_detail::re_set* dat = reinterpret_cast<re_detail::re_set*>(data.extend(sizeof(re_detail::re_set)));
- std::memset(dat, 0, sizeof(re_detail::re_set));
-
- while(singles.empty() == false)
- {
- dat->_map[(traits_size_type)(traits_uchar_type)*(singles.peek().c_str())] = re_detail::mask_all;
- singles.pop();
- }
- while(ranges.empty() == false)
- {
- traits_string_type c1, c2, c3, c4;
-
- if((flags() & regex_constants::collate) == 0)
- c1 = ranges.peek();
- else
- traits_inst.transform(c1, ranges.peek());
- ranges.pop();
- if((flags() & regex_constants::collate) == 0)
- c2 = ranges.peek();
- else
- traits_inst.transform(c2, ranges.peek());
- ranges.pop();
-
- if(c1 < c2)
- {
- // for some reason bc5 crashes when throwing exceptions
- // from here - probably an EH-compiler bug, but hard to
- // be sure...
- // delay throw to later:
- #ifdef __BORLANDC__
- boost::uint_fast32_t f = _flags;
- _flags &= ~regex_constants::use_except;
- #endif
- fail(REG_ERANGE);
- #ifdef __BORLANDC__
- _flags = f;
- #endif
- return 0;
- }
- for(unsigned int i = 0; i < 256; ++i)
- {
- c4 = (charT)i;
- if((flags() & regex_constants::collate) == 0)
- c3 = c4;
- else
- traits_inst.transform(c3, c4);
- if((c3 <= c1) && (c3 >= c2))
- dat->_map[i] = re_detail::mask_all;
- }
- }
- while(equivalents.empty() == false)
- {
- traits_string_type c1, c2;
- for(unsigned int i = 0; i < 256; ++i)
- {
- c2 = (charT)i;
- traits_inst.transform_primary(c1, c2);
- if(c1 == equivalents.peek())
- dat->_map[i] = re_detail::mask_all;
- }
- equivalents.pop();
- }
-
- boost::uint_fast32_t l_flags = 0;
- while(classes.empty() == false)
- {
- l_flags |= classes.peek();
- classes.pop();
- }
- if(l_flags)
- {
- for(unsigned int i = 0; i < 256; ++i)
- {
- if(traits_inst.is_class(charT(i), l_flags))
- dat->_map[(traits_uchar_type)traits_inst.translate((charT)i, (_flags & regex_constants::icase))] = re_detail::mask_all;
- }
- }
-
- if(isnot)
- {
- for(unsigned int i = 0; i < 256; ++i)
- {
- dat->_map[i] = !dat->_map[i];
- }
- }
-
- dat->type = re_detail::syntax_element_set;
- dat->next.i = 0;
- return dat;
-}
-
-#ifndef __CODEGUARD__
-// this must not be inline when Borland's codeguard support is turned
-// on, otherwise we _will_ get surious codeguard errors...
-inline
-#endif
- re_detail::re_syntax_base* add_offset(void* base, std::ptrdiff_t off)
-{
- return reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(base) + off);
-}
-
-template <class charT, class traits, class Allocator>
-void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::fixup_apply(re_detail::re_syntax_base* b, unsigned cbraces)
-{
- typedef typename boost::detail::rebind_allocator<bool, Allocator>::type b_alloc;
-
- register unsigned char* base = reinterpret_cast<unsigned char*>(b);
- register re_detail::re_syntax_base* ptr = b;
- bool* pb = 0;
- b_alloc a(data.allocator());
-#ifndef BOOST_NO_EXCEPTIONS
- try
- {
-#endif
- pb = a.allocate(cbraces);
- BOOST_REGEX_NOEH_ASSERT(pb)
- for(unsigned i = 0; i < cbraces; ++i)
- pb[i] = false;
-
- repeats = 0;
-
- while(ptr->next.i)
- {
- switch(ptr->type)
- {
- case re_detail::syntax_element_rep:
- jm_assert(data.size() > static_cast<re_detail::re_jump*>(ptr)->alt.i);
- static_cast<re_detail::re_jump*>(ptr)->alt.p = add_offset(base, static_cast<re_detail::re_jump*>(ptr)->alt.i);
-#ifdef BOOST_REGEX_DEBUG
- if((re_detail::padding_mask & reinterpret_cast<int>(static_cast<re_detail::re_jump*>(ptr)->alt.p)) && (static_cast<re_detail::re_jump*>(ptr)->alt.p != b))
- {
- jm_trace("padding mis-aligment in repeat jump to object type: " << static_cast<re_detail::re_jump*>(ptr)->alt.p->type)
- //jm_assert(0 == (padding_mask & (int)((re_detail::re_jump*)ptr)->alt.p));
- }
-#endif
- static_cast<re_detail::re_repeat*>(ptr)->id = repeats;
- ++repeats;
- goto rebase;
- case re_detail::syntax_element_jump:
- case re_detail::syntax_element_alt:
- jm_assert(data.size() > static_cast<re_detail::re_jump*>(ptr)->alt.i);
- static_cast<re_detail::re_jump*>(ptr)->alt.p = add_offset(base, static_cast<re_detail::re_jump*>(ptr)->alt.i);
-#ifdef BOOST_REGEX_DEBUG
- if((re_detail::padding_mask & reinterpret_cast<int>(static_cast<re_detail::re_jump*>(ptr)->alt.p) && (static_cast<re_detail::re_jump*>(ptr)->alt.p != b)))
- {
- jm_trace("padding mis-aligment in alternation jump to object type: " << static_cast<re_detail::re_jump*>(ptr)->alt.p->type)
- //jm_assert(0 == (padding_mask & (int)((re_detail::re_jump*)ptr)->alt.p));
- }
-#endif
- goto rebase;
- case re_detail::syntax_element_backref:
- if((static_cast<re_detail::re_brace*>(ptr)->index >= (int)cbraces) || (pb[static_cast<re_detail::re_brace*>(ptr)->index] == false) )
- {
- fail(REG_ESUBREG);
- a.deallocate(pb, cbraces);
- return;
- }
- goto rebase;
- case re_detail::syntax_element_endmark:
- if(static_cast<re_detail::re_brace*>(ptr)->index > 0)
- pb[static_cast<re_detail::re_brace*>(ptr)->index] = true;
- goto rebase;
- default:
- rebase:
- jm_assert(data.size() > ptr->next.i);
- ptr->next.p = add_offset(base, ptr->next.i);
-#ifdef BOOST_REGEX_DEBUG
- if((re_detail::padding_mask & (int)(ptr->next.p)) && (static_cast<re_detail::re_jump*>(ptr)->alt.p != b))
- {
- jm_trace("padding mis-alignment in next record of type " << ptr->next.p->type)
- jm_assert(0 == (re_detail::padding_mask & (int)(ptr->next.p)));
- }
-#endif
- ptr = ptr->next.p;
- }
- }
- a.deallocate(pb, cbraces);
- pb = 0;
-#ifndef BOOST_NO_EXCEPTIONS
- }
- catch(...)
- {
- if(pb)
- a.deallocate(pb, cbraces);
- throw;
- }
-#endif
-}
-
-
-template <class charT, class traits, class Allocator>
-unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::set_expression(const charT* arg_first, const charT* arg_last, flag_type f)
-{
-# ifdef BOOST_MSVC
-# pragma warning(push)
-# pragma warning(disable: 4127)
-#endif
-#ifdef __OpenBSD__
- // strxfrm not working on OpenBSD??
- f &= ~regex_constants::collate;
-#endif
-
- if(arg_first == expression())
- {
- traits_string_type s(arg_first, arg_last);
- return set_expression(s.c_str(), s.c_str() + s.size(), f);
- }
- typedef typename traits_type::sentry sentry_t;
- sentry_t sent(traits_inst);
- if(sent){
-
- const charT* base = arg_first;
- data.clear();
- _flags = f;
- fail(REG_NOERROR); // clear any error
- _leading_len = 0; // set this to non-zero if there are any backrefs, we'll refer to it later...
-
- if(arg_first >= arg_last)
- {
- fail(REG_EMPTY);
- return error_code();
- }
-
- const charT* ptr = arg_first;
- marks = 0;
- re_detail::jstack<std::size_t, Allocator> mark(64, data.allocator());
- re_detail::jstack<int, Allocator> markid(64, data.allocator());
- std::size_t last_mark_popped = 0;
- register traits_size_type c;
- register re_detail::re_syntax_base* dat;
-
- unsigned rep_min = 0;
- unsigned rep_max = 0;
-
- //
- // set up header:
- //
- ++marks;
- dat = 0;
-
- if(_flags & regex_constants::literal)
- {
- while(ptr != arg_last)
- {
- dat = add_literal(dat, traits_inst.translate(*ptr, (_flags & regex_constants::icase)));
- ++ptr;
- }
- }
-
- while (ptr < arg_last)
- {
- c = (traits_size_type)(traits_uchar_type)*ptr;
- // this is only used for the switch(), but cannot be folded in
- // due to a bug in Comeau 4.2.44beta3
- traits_size_type syntax = traits_inst.syntax_type(c);
- switch(syntax)
- {
- case traits_type::syntax_open_bracket:
- if(_flags & bk_parens)
- {
- dat = add_literal(dat, (charT)c);
- ++ptr;
- continue;
- }
- open_bracked_jump:
- // extend:
- dat = add_simple(dat, re_detail::syntax_element_startmark, sizeof(re_detail::re_brace));
- if(_flags & nosubs)
- {
- markid.push(0);
- static_cast<re_detail::re_brace*>(dat)->index = 0;
- }
- else
- {
- markid.push(marks);
- static_cast<re_detail::re_brace*>(dat)->index = marks++;
- }
- mark.push(data.index(dat));
- ++ptr;
- //
- // check for perl like (?...) extention syntax
- c = (traits_size_type)(traits_uchar_type)*ptr;
- if(((_flags & (bk_parens|perlex)) == perlex) && (traits_type::syntax_question == traits_inst.syntax_type(c)))
- {
- ++ptr;
- c = (traits_size_type)(traits_uchar_type)*ptr;
- // this is only used for the switch(), but cannot be folded in
- // due to a bug in Comeau 4.2.44beta3
- traits_size_type syntax2 = traits_inst.syntax_type(c);
- switch(syntax2)
- {
- case traits_type::syntax_colon:
- static_cast<re_detail::re_brace*>(dat)->index = 0;
- if((_flags & nosubs) == 0)
- --marks;
- markid.pop();
- markid.push(0);
- ++ptr;
- continue;
- case traits_type::syntax_equal:
- static_cast<re_detail::re_brace*>(dat)->index = -1;
- markid.pop();
- markid.push(-1);
- common_forward_assert:
- if((_flags & nosubs) == 0)
- --marks;
- ++ptr;
- // extend:
- dat = add_simple(dat, re_detail::syntax_element_jump, re_detail::re_jump_size);
- data.align();
- //
- // we don't know what value to put here yet,
- // use an arbitrarily large value for now
- // and check it later:
- static_cast<re_detail::re_jump*>(dat)->alt.i = INT_MAX/2;
- mark.push(data.size() - re_detail::re_jump_size);
- continue;
- case traits_type::syntax_right_word:
- static_cast<re_detail::re_brace*>(dat)->index = -3;
- markid.pop();
- markid.push(-3);
- goto common_forward_assert;
- case traits_type::syntax_not:
- static_cast<re_detail::re_brace*>(dat)->index = -2;
- markid.pop();
- markid.push(-2);
- goto common_forward_assert;
- case traits_type::syntax_hash:
- // comment just skip it:
- static_cast<re_detail::re_brace*>(dat)->index = 0;
- if((_flags & nosubs) == 0)
- --marks;
- markid.pop();
- mark.pop();
- do{
- ++ptr;
- c = (traits_size_type)(traits_uchar_type)*ptr;
- }while(traits_type::syntax_close_bracket != traits_inst.syntax_type(c));
- ++ptr;
- continue;
- default:
- //
- // error, return to standard parsing and let that handle the error:
- --ptr;
- continue;
- }
- }
- break;
- case traits_type::syntax_close_bracket:
- if(_flags & bk_parens)
- {
- dat = add_literal(dat, (charT)c);
- ++ptr;
- continue;
- }
-
- close_bracked_jump:
- if(dat)
- {
- data.align();
- dat->next.i = data.size();
- }
-
- if(mark.empty())
- {
- fail(REG_EPAREN);
- return error_code();
- }
- // see if we have an empty alternative:
- if(mark.peek() == data.index(dat) )
- {
- re_detail::re_syntax_base* para = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(data.data()) + mark.peek());
- if(para->type == re_detail::syntax_element_jump)
- {
- fail(REG_EMPTY);
- return error_code();
- }
- }
-
- // pop any pushed alternatives and set the target arg_last destination:
- dat = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<unsigned char*>(data.data()) + mark.peek());
- while(dat->type == re_detail::syntax_element_jump)
- {
- static_cast<re_detail::re_jump*>(dat)->alt.i = data.size();
- mark.pop();
- if(mark.empty())
- {
- fail(REG_EPAREN);
- return error_code();
- }
- dat = reinterpret_cast<re_detail::re_jump*>(reinterpret_cast<unsigned char*>(data.data()) + mark.peek());
- }
-
- dat = add_simple(0, re_detail::syntax_element_endmark, sizeof(re_detail::re_brace));
- static_cast<re_detail::re_brace*>(dat)->index = markid.peek();
- markid.pop();
- last_mark_popped = mark.peek();
- mark.pop();
- ++ptr;
- break;
- case traits_type::syntax_char:
- dat = add_literal(dat, (charT)c);
- ++ptr;
- break;
- case traits_type::syntax_slash:
- {
- if(++ptr == arg_last)
- {
- fail(REG_EESCAPE);
- return error_code();
- }
- c = (traits_size_type)(traits_uchar_type)*ptr;
- // this is only used for the switch(), but cannot be folded in
- // due to a bug in Comeau 4.2.44beta3
- traits_size_type syntax3 = traits_inst.syntax_type(c);
- switch(syntax3)
- {
- case traits_type::syntax_open_bracket:
- if(_flags & bk_parens)
- goto open_bracked_jump;
- break;
- case traits_type::syntax_close_bracket:
- if(_flags & bk_parens)
- goto close_bracked_jump;
- break;
- case traits_type::syntax_plus:
- if((_flags & bk_plus_qm) && ((_flags & limited_ops) == 0))
- {
- rep_min = 1;
- rep_max = (unsigned)-1;
- goto repeat_jump;
- }
- break;
- case traits_type::syntax_question:
- if((_flags & bk_plus_qm) && ((_flags & limited_ops) == 0))
- {
- rep_min = 0;
- rep_max = 1;
- goto repeat_jump;
- }
- break;
- case traits_type::syntax_or:
- if(((_flags & bk_vbar) == 0) || (_flags & limited_ops))
- break;
- goto alt_string_jump;
- case traits_type::syntax_open_brace:
- if( ((_flags & bk_braces) == 0) || ((_flags & intervals) == 0))
- break;
-
- // we have {x} or {x,} or {x,y}:
- parse_range(ptr, arg_last, rep_min, rep_max);
- goto repeat_jump;
-
- case traits_type::syntax_digit:
- if(_flags & bk_refs)
- {
- // update previous:
- int i = traits_inst.toi((charT)c);
- if(i == 0)
- {
- // we can have \025 which means take char whose
- // code is 25 (octal), so parse string:
- c = traits_inst.toi(ptr, arg_last, -8);
- --ptr;
- break;
- }
- dat = add_simple(dat, re_detail::syntax_element_backref, sizeof(re_detail::re_brace));
- static_cast<re_detail::re_brace*>(dat)->index = i;
- ++ptr;
- _leading_len = 1;
- continue;
- }
- break;
- case traits_type::syntax_b: // re_detail::syntax_element_word_boundary
- dat = add_simple(dat, re_detail::syntax_element_word_boundary);
- ++ptr;
- continue;
- case traits_type::syntax_B:
- dat = add_simple(dat, re_detail::syntax_element_within_word);
- ++ptr;
- continue;
- case traits_type::syntax_left_word:
- dat = add_simple(dat, re_detail::syntax_element_word_start);
- ++ptr;
- continue;
- case traits_type::syntax_right_word:
- dat = add_simple(dat, re_detail::syntax_element_word_end);
- ++ptr;
- continue;
- case traits_type::syntax_w: //re_detail::syntax_element_word_char
- dat = compile_set_simple(dat, traits_type::char_class_word);
- ++ptr;
- continue;
- case traits_type::syntax_W:
- dat = compile_set_simple(dat, traits_type::char_class_word, true);
- ++ptr;
- continue;
- case traits_type::syntax_d: //re_detail::syntax_element_word_char
- dat = compile_set_simple(dat, traits_type::char_class_digit);
- ++ptr;
- continue;
- case traits_type::syntax_D:
- dat = compile_set_simple(dat, traits_type::char_class_digit, true);
- ++ptr;
- continue;
- case traits_type::syntax_s: //re_detail::syntax_element_word_char
- dat = compile_set_simple(dat, traits_type::char_class_space);
- ++ptr;
- continue;
- case traits_type::syntax_S:
- dat = compile_set_simple(dat, traits_type::char_class_space, true);
- ++ptr;
- continue;
- case traits_type::syntax_l: //re_detail::syntax_element_word_char
- dat = compile_set_simple(dat, traits_type::char_class_lower);
- ++ptr;
- continue;
- case traits_type::syntax_L:
- dat = compile_set_simple(dat, traits_type::char_class_lower, true);
- ++ptr;
- continue;
- case traits_type::syntax_u: //re_detail::syntax_element_word_char
- dat = compile_set_simple(dat, traits_type::char_class_upper);
- ++ptr;
- continue;
- case traits_type::syntax_U:
- dat = compile_set_simple(dat, traits_type::char_class_upper, true);
- ++ptr;
- continue;
- case traits_type::syntax_Q:
- ++ptr;
- while(true)
- {
- if(ptr == arg_last)
- {
- fail(REG_EESCAPE);
- return error_code();
- }
- if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_slash)
- {
- ++ptr;
- if((ptr != arg_last) && (traits_inst.syntax_type((traits_size_type)(traits_uchar_type)*ptr) == traits_type::syntax_E))
- break;
- else
- {
- dat = add_literal(dat, *(ptr-1));
- continue;
- }
- }
- dat = add_literal(dat, *ptr);
- ++ptr;
- }
- ++ptr;
- continue;
- case traits_type::syntax_C:
- dat = add_simple(dat, re_detail::syntax_element_wild);
- ++ptr;
- continue;
- case traits_type::syntax_X:
- dat = add_simple(dat, re_detail::syntax_element_combining);
- ++ptr;
- continue;
- case traits_type::syntax_Z:
- dat = add_simple(dat, re_detail::syntax_element_soft_buffer_end);
- ++ptr;
- continue;
- case traits_type::syntax_G:
- dat = add_simple(dat, re_detail::syntax_element_restart_continue);
- ++ptr;
- continue;
- case traits_type::syntax_start_buffer:
- dat = add_simple(dat, re_detail::syntax_element_buffer_start);
- ++ptr;
- continue;
- case traits_type::syntax_end_buffer:
- dat = add_simple(dat, re_detail::syntax_element_buffer_end);
- ++ptr;
- continue;
- default:
- c = (traits_size_type)(traits_uchar_type)parse_escape(ptr, arg_last);
- dat = add_literal(dat, (charT)c);
- continue;
- }
- dat = add_literal(dat, (charT)c);
- ++ptr;
- break;
- }
- case traits_type::syntax_dollar:
- dat = add_simple(dat, re_detail::syntax_element_end_line, sizeof(re_detail::re_syntax_base));
- ++ptr;
- continue;
- case traits_type::syntax_caret:
- dat = add_simple(dat, re_detail::syntax_element_start_line, sizeof(re_detail::re_syntax_base));
- ++ptr;
- continue;
- case traits_type::syntax_dot:
- dat = add_simple(dat, re_detail::syntax_element_wild, sizeof(re_detail::re_syntax_base));
- ++ptr;
- continue;
- case traits_type::syntax_star:
- rep_min = 0;
- rep_max = (unsigned)-1;
-
- repeat_jump:
- {
- std::ptrdiff_t offset;
- if(dat == 0)
- {
- fail(REG_BADRPT);
- return error_code();
- }
- switch(dat->type)
- {
- case re_detail::syntax_element_endmark:
- offset = last_mark_popped;
- break;
- case re_detail::syntax_element_literal:
- if(static_cast<re_detail::re_literal*>(dat)->length > 1)
- {
- // update previous:
- charT lit = *reinterpret_cast<charT*>(reinterpret_cast<char*>(dat) + sizeof(re_detail::re_literal) + ((static_cast<re_detail::re_literal*>(dat)->length-1)*sizeof(charT)));
- --static_cast<re_detail::re_literal*>(dat)->length;
- dat = add_simple(dat, re_detail::syntax_element_literal, sizeof(re_detail::re_literal) + sizeof(charT));
- static_cast<re_detail::re_literal*>(dat)->length = 1;
- *reinterpret_cast<charT*>(static_cast<re_detail::re_literal*>(dat)+1) = lit;
- }
- offset = reinterpret_cast<char*>(dat) - reinterpret_cast<char*>(data.data());
- break;
- case re_detail::syntax_element_backref:
- case re_detail::syntax_element_long_set:
- case re_detail::syntax_element_set:
- case re_detail::syntax_element_wild:
- case re_detail::syntax_element_combining:
- // we're repeating a single item:
- offset = reinterpret_cast<char*>(dat) - reinterpret_cast<char*>(data.data());
- break;
- default:
- fail(REG_BADRPT);
- return error_code();
- }
- data.align();
- dat->next.i = data.size();
- //unsigned pos = (char*)dat - (char*)data.data();
-
- // add the trailing jump:
- dat = add_simple(dat, re_detail::syntax_element_jump, re_detail::re_jump_size);
- static_cast<re_detail::re_jump*>(dat)->alt.i = 0;
-
- // now insert the leading repeater:
- dat = static_cast<re_detail::re_syntax_base*>(data.insert(offset, re_detail::re_repeater_size));
- dat->next.i = (reinterpret_cast<char*>(dat) - reinterpret_cast<char*>(data.data())) + re_detail::re_repeater_size;
- dat->type = re_detail::syntax_element_rep;
- static_cast<re_detail::re_repeat*>(dat)->alt.i = data.size();
- static_cast<re_detail::re_repeat*>(dat)->min = rep_min;
- static_cast<re_detail::re_repeat*>(dat)->max = rep_max;
- static_cast<re_detail::re_repeat*>(dat)->leading = false;
- static_cast<re_detail::re_repeat*>(dat)->greedy = true;
- move_offsets(dat, re_detail::re_repeater_size);
- ++ptr;
- //
- // now check to see if we have a non-greedy repeat:
- if((ptr != arg_last) && (_flags & (perlex | limited_ops | bk_plus_qm | bk_braces)) == perlex)
- {
- c = (traits_size_type)(traits_uchar_type)*ptr;
- if(traits_type::syntax_question == traits_inst.syntax_type(c))
- {
- // OK repeat is non-greedy:
- static_cast<re_detail::re_repeat*>(dat)->greedy = false;
- ++ptr;
- }
- }
- dat = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(data.data()) + data.size() - re_detail::re_jump_size);
- static_cast<re_detail::re_repeat*>(dat)->alt.i = offset;
- continue;
- }
- case traits_type::syntax_plus:
- if(_flags & (bk_plus_qm | limited_ops))
- {
- dat = add_literal(dat, (charT)c);
- ++ptr;
- continue;
- }
- rep_min = 1;
- rep_max = (unsigned)-1;
- goto repeat_jump;
- case traits_type::syntax_question:
- if(_flags & (bk_plus_qm | limited_ops))
- {
- dat = add_literal(dat, (charT)c);
- ++ptr;
- continue;
- }
- rep_min = 0;
- rep_max = 1;
- goto repeat_jump;
- case traits_type::syntax_open_set:
- // update previous:
- if(dat)
- {
- data.align();
- dat->next.i = data.size();
- }
- // extend:
- dat = compile_set(ptr, arg_last);
- if(dat == 0)
- {
- if((_flags & regex_constants::failbit) == 0)
- fail(REG_EBRACK);
- return error_code();
- }
- break;
- case traits_type::syntax_or:
- {
- if(_flags & (bk_vbar | limited_ops))
- {
- dat = add_literal(dat, (charT)c);
- ++ptr;
- continue;
- }
-
- alt_string_jump:
-
- // update previous:
- if(dat == 0)
- {
- // start of pattern can't have empty "|"
- fail(REG_EMPTY);
- return error_code();
- }
- // see if we have an empty alternative:
- if(mark.empty() == false)
- if(mark.peek() == data.index(dat))
- {
- fail(REG_EMPTY);
- return error_code();
- }
- // extend:
- dat = add_simple(dat, re_detail::syntax_element_jump, re_detail::re_jump_size);
- data.align();
- //
- // we don't know what value to put here yet,
- // use an arbitrarily large value for now
- // and check it later (TODO!)
- static_cast<re_detail::re_jump*>(dat)->alt.i = INT_MAX/2;
-
- // now work out where to insert:
- std::size_t offset = 0;
- if(mark.empty() == false)
- {
- // we have a '(' or '|' to go back to:
- offset = mark.peek();
- re_detail::re_syntax_base* base2 = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<unsigned char*>(data.data()) + offset);
- offset = base2->next.i;
- }
- re_detail::re_jump* j = static_cast<re_detail::re_jump*>(data.insert(offset, re_detail::re_jump_size));
- j->type = re_detail::syntax_element_alt;
- j->next.i = offset + re_detail::re_jump_size;
- j->alt.i = data.size();
- move_offsets(j, re_detail::re_jump_size);
- dat = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<unsigned char*>(data.data()) + data.size() - re_detail::re_jump_size);
- mark.push(data.size() - re_detail::re_jump_size);
- ++ptr;
- break;
- }
- case traits_type::syntax_open_brace:
- if((_flags & bk_braces) || ((_flags & intervals) == 0))
- {
- dat = add_literal(dat, (charT)c);
- ++ptr;
- continue;
- }
- // we have {x} or {x,} or {x,y}:
- parse_range(ptr, arg_last, rep_min, rep_max);
- goto repeat_jump;
- case traits_type::syntax_newline:
- if(_flags & newline_alt)
- goto alt_string_jump;
- dat = add_literal(dat, (charT)c);
- ++ptr;
- continue;
- case traits_type::syntax_close_brace:
- if(_flags & bk_braces)
- {
- dat = add_literal(dat, (charT)c);
- ++ptr;
- continue;
- }
- fail(REG_BADPAT);
- return error_code();
- default:
- dat = add_literal(dat, (charT)c);
- ++ptr;
- break;
- } // switch
- } // while
-
- //
- // update previous:
- if(dat)
- {
- data.align();
- dat->next.i = data.size();
- }
-
- // see if we have an empty alternative:
- if(mark.empty() == false)
- if(mark.peek() == data.index(dat) )
- {
- re_detail::re_syntax_base* para = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<char*>(data.data()) + mark.peek());
- if(para->type == re_detail::syntax_element_jump)
- {
- fail(REG_EMPTY);
- return error_code();
- }
- }
- //
- // set up tail:
- //
- if(mark.empty() == false)
- {
- // pop any pushed alternatives and set the target arg_last destination:
- dat = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<unsigned char*>(data.data()) + mark.peek());
- while(dat->type == re_detail::syntax_element_jump)
- {
- static_cast<re_detail::re_jump*>(dat)->alt.i = data.size();
- mark.pop();
- if(mark.empty() == true)
- break;
- dat = reinterpret_cast<re_detail::re_jump*>(reinterpret_cast<unsigned char*>(data.data()) + mark.peek());
- }
- }
-
- dat = static_cast<re_detail::re_brace*>(data.extend(sizeof(re_detail::re_syntax_base)));
- dat->type = re_detail::syntax_element_match;
- dat->next.i = 0;
-
- if(mark.empty() == false)
- {
- fail(REG_EPAREN);
- return error_code();
- }
-
- //
- // allocate space for start _map:
- startmap = reinterpret_cast<unsigned char*>(data.extend(256 + ((arg_last - base + 1) * sizeof(charT))));
- //
- // and copy the expression we just compiled:
- _expression = reinterpret_cast<charT*>(reinterpret_cast<char*>(startmap) + 256);
- _expression_len = arg_last - base;
- std::memcpy(_expression, base, _expression_len * sizeof(charT));
- *(_expression + _expression_len) = charT(0);
-
- //
- // now we need to apply fixups to the array
- // so that we can use pointers and not indexes
- fixup_apply(static_cast<re_detail::re_syntax_base*>(data.data()), marks);
-
- // check for error during fixup:
- if(_flags & regex_constants::failbit)
- return error_code();
-
- //
- // finally compile the maps so that we can make intelligent choices
- // whenever we encounter an alternative:
- compile_maps();
- if(pkmp)
- {
- re_detail::kmp_free(pkmp, data.allocator());
- pkmp = 0;
- }
- re_detail::re_syntax_base* sbase = static_cast<re_detail::re_syntax_base*>(data.data());
- _restart_type = probe_restart(sbase);
- _leading_len = fixup_leading_rep(sbase, 0);
- if((sbase->type == re_detail::syntax_element_literal) && (sbase->next.p->type == re_detail::syntax_element_match))
- {
- _restart_type = restart_fixed_lit;
- if(0 == pkmp)
- {
- charT* p1 = reinterpret_cast<charT*>(reinterpret_cast<char*>(sbase) + sizeof(re_detail::re_literal));
- charT* p2 = p1 + static_cast<re_detail::re_literal*>(sbase)->length;
- pkmp = re_detail::kmp_compile(p1, p2, charT(), re_detail::kmp_translator<traits>(_flags®ex_constants::icase, &traits_inst), data.allocator());
- }
- }
- return error_code();
-
- } // sentry
- return REG_EMPTY;
-
-# ifdef BOOST_MSVC
-# pragma warning(pop)
-#endif
-
-}
-
-template <class charT, class traits, class Allocator>
-re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::add_simple(re_detail::re_syntax_base* dat, re_detail::syntax_element_type type, unsigned int arg_size)
-{
- if(dat)
- {
- data.align();
- dat->next.i = data.size();
- }
- if(arg_size < sizeof(re_detail::re_syntax_base))
- arg_size = sizeof(re_detail::re_syntax_base);
- dat = static_cast<re_detail::re_syntax_base*>(data.extend(arg_size));
- dat->type = type;
- dat->next.i = 0;
- return dat;
-}
-
-template <class charT, class traits, class Allocator>
-re_detail::re_syntax_base* BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::add_literal(re_detail::re_syntax_base* dat, charT c)
-{
- if(dat && (dat->type == re_detail::syntax_element_literal))
- {
- // add another charT to the list:
- std::ptrdiff_t pos = reinterpret_cast<unsigned char*>(dat) - reinterpret_cast<unsigned char*>(data.data());
- *reinterpret_cast<charT*>(data.extend(sizeof(charT))) = traits_inst.translate(c, (_flags & regex_constants::icase));
- dat = reinterpret_cast<re_detail::re_syntax_base*>(reinterpret_cast<unsigned char*>(data.data()) + pos);
- ++(static_cast<re_detail::re_literal*>(dat)->length);
- }
- else
- {
- // extend:
- dat = add_simple(dat, re_detail::syntax_element_literal, sizeof(re_detail::re_literal) + sizeof(charT));
- static_cast<re_detail::re_literal*>(dat)->length = 1;
- *reinterpret_cast<charT*>(reinterpret_cast<re_detail::re_literal*>(dat)+1) = traits_inst.translate(c, (_flags & regex_constants::icase));
- }
- return dat;
-}
-
-template <class charT, class traits, class Allocator>
-unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::probe_restart(re_detail::re_syntax_base* dat)
-{
- switch(dat->type)
- {
- case re_detail::syntax_element_startmark:
- case re_detail::syntax_element_endmark:
- if(static_cast<const re_detail::re_brace*>(dat)->index == -2)
- return regbase::restart_any;
- return probe_restart(dat->next.p);
- case re_detail::syntax_element_start_line:
- return regbase::restart_line;
- case re_detail::syntax_element_word_start:
- return regbase::restart_word;
- case re_detail::syntax_element_buffer_start:
- return regbase::restart_buf;
- case re_detail::syntax_element_restart_continue:
- return regbase::restart_continue;
- default:
- return regbase::restart_any;
- }
-}
-
-template <class charT, class traits, class Allocator>
-unsigned int BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::fixup_leading_rep(re_detail::re_syntax_base* dat, re_detail::re_syntax_base* arg_end)
-{
- unsigned int len = 0;
- if((_restart_type >= restart_word) || (_restart_type <= restart_continue))
- return 0;
- bool leading_lit = arg_end ? false : true;
- while(dat != arg_end)
- {
- switch(dat->type)
- {
- case re_detail::syntax_element_literal:
- len += static_cast<re_detail::re_literal*>(dat)->length;
- if((leading_lit) && (static_cast<re_detail::re_literal*>(dat)->length > 2))
- {
- // we can do a literal search for the leading literal string
- // using Knuth-Morris-Pratt (or whatever), and only then check for
- // matches. We need a decent length string though to make it
- // worth while.
- _leading_string = reinterpret_cast<charT*>(reinterpret_cast<char*>(dat) + sizeof(re_detail::re_literal));
- _leading_string_len = static_cast<re_detail::re_literal*>(dat)->length;
- _restart_type = restart_lit;
- leading_lit = false;
- const charT* p1 = _leading_string;
- const charT* p2 = _leading_string + _leading_string_len;
- pkmp = re_detail::kmp_compile(p1, p2, charT(), re_detail::kmp_translator<traits>(_flags®ex_constants::icase, &traits_inst), data.allocator());
- }
- leading_lit = false;
- break;
- case re_detail::syntax_element_wild:
- ++len;
- leading_lit = false;
- break;
- case re_detail::syntax_element_match:
- return len;
- case re_detail::syntax_element_backref:
- //case re_detail::syntax_element_jump:
- case re_detail::syntax_element_alt:
- case re_detail::syntax_element_combining:
- return 0;
- case re_detail::syntax_element_long_set:
- {
- // we need to verify that there are no multi-character
- // collating elements inside the repeat:
- if(!static_cast<re_detail::re_set_long*>(dat)->singleton)
- return 0;
- ++len;
- leading_lit = false;
- break;
- }
- case re_detail::syntax_element_set:
- ++len;
- leading_lit = false;
- break;
- case re_detail::syntax_element_rep:
- case re_detail::syntax_element_dot_rep:
- case re_detail::syntax_element_char_rep:
- case re_detail::syntax_element_short_set_rep:
- case re_detail::syntax_element_long_set_rep:
- if((len == 0) && (_leading_len == 0) && (1 == fixup_leading_rep(dat->next.p, static_cast<re_detail::re_repeat*>(dat)->alt.p) ))
- {
- static_cast<re_detail::re_repeat*>(dat)->leading = leading_lit;
- return len;
- }
- return len;
- case re_detail::syntax_element_startmark:
- if(static_cast<const re_detail::re_brace*>(dat)->index == -2)
- return 0;
- // fall through:
- default:
- break;
- }
- dat = dat->next.p;
- }
- return len;
-}
-
-template <class charT, class traits, class Allocator>
-void BOOST_REGEX_CALL reg_expression<charT, traits, Allocator>::fail(unsigned int err)
-{
- error_code_ = err;
- if(err)
- {
- _flags |= regex_constants::failbit;
-#ifndef BOOST_NO_EXCEPTIONS
- if(_flags & regex_constants::use_except)
- {
- re_detail::raise_error(traits_inst, err);
- }
-#endif
- }
- else
- _flags &= ~regex_constants::failbit;
-}
-
-#ifdef __BORLANDC__
-#pragma option pop
-#endif
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_SUFFIX
-#endif
-
-} // namespace boost
-
-
-#endif // BOOST_REGEX_COMPILE_HPP
-
-
-
-
-
-
-
-
-
-
-
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
- * Use, modification and distribution are subject to the
- * Boost Software License, Version 1.0. (See accompanying file
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*
*/
//
// Forward declaration:
//
-template <class RandomAccessIterator, class Allocator>
+ template <class BidiIterator, class Allocator = BOOST_DEDUCED_TYPENAME std::vector<sub_match<BidiIterator> >::allocator_type >
class match_results;
namespace re_detail{
-// make_upper and make_lower should ideally be implemented in regex_traits
-#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
-
//
-// VC6 needs to link to user32.lib, as do all compilers that
-// claim to be VC6/7 compatible:
+// struct trivial_format_traits:
+// defines minimum localisation support for formatting
+// in the case that the actual regex traits is unavailable.
//
-#if defined(_MSC_VER) && !defined(__BORLANDC__)
-#pragma comment(lib, "user32.lib")
-#endif
-
-inline wchar_t make_upper(wchar_t c)
+template <class charT>
+struct trivial_format_traits
{
- return LOWORD(::CharUpperW(reinterpret_cast<wchar_t*>(static_cast<unsigned short>(c))));
-}
-
-inline char make_upper(char c)
-{
- return static_cast<char>(LOWORD(::CharUpperA(reinterpret_cast<char*>(static_cast<unsigned short>(c)))));
-}
-
-inline wchar_t make_lower(wchar_t c)
-{
- return LOWORD(::CharLowerW(reinterpret_cast<wchar_t*>(static_cast<unsigned short>(c))));
-}
-
-inline char make_lower(char c)
-{
- return static_cast<char>(LOWORD(::CharLowerA(reinterpret_cast<char*>(static_cast<unsigned short>(c)))));
-}
+ typedef charT char_type;
-#else
-
-// TODO: make this traits class sensitive:
-#ifndef BOOST_NO_WREGEX
-inline wchar_t make_upper(wchar_t c)
-{
- return (std::towupper)(c);
-}
+ static std::ptrdiff_t length(const charT* p)
+ {
+ return global_length(p);
+ }
+ static charT tolower(charT c)
+ {
+ return ::boost::re_detail::global_lower(c);
+ }
+ static charT toupper(charT c)
+ {
+ return ::boost::re_detail::global_upper(c);
+ }
+ static int value(const charT c, int radix)
+ {
+ int result = global_value(c);
+ return result >= radix ? -1 : result;
+ }
+ int toi(const charT*& p1, const charT* p2, int radix)const
+ {
+ return global_toi(p1, p2, radix, *this);
+ }
+};
-inline wchar_t make_lower(wchar_t c)
-{
- return (std::towlower)(c);
-}
-#endif
-inline char make_upper(char c)
+template <class OutputIterator, class Results, class traits>
+class basic_regex_formatter
{
- return static_cast<char>((std::toupper)(c));
-}
+public:
+ typedef typename traits::char_type char_type;
+ basic_regex_formatter(OutputIterator o, const Results& r, const traits& t)
+ : m_traits(t), m_results(r), m_out(o), m_state(output_copy), m_have_conditional(false) {}
+ OutputIterator format(const char_type* p1, const char_type* p2, match_flag_type f);
+ OutputIterator format(const char_type* p1, match_flag_type f)
+ {
+ return format(p1, p1 + m_traits.length(p1), f);
+ }
+private:
+ typedef typename Results::value_type sub_match_type;
+ enum output_state
+ {
+ output_copy,
+ output_next_lower,
+ output_next_upper,
+ output_lower,
+ output_upper,
+ output_none
+ };
+
+ void put(char_type c);
+ void put(const sub_match_type& sub);
+ void format_all();
+ void format_perl();
+ void format_escape();
+ void format_conditional();
+ void format_until_scope_end();
+
+ const traits& m_traits; // the traits class for localised formatting operations
+ const Results& m_results; // the match_results being used.
+ OutputIterator m_out; // where to send output.
+ const char_type* m_position; // format string, current position
+ const char_type* m_end; // format string end
+ match_flag_type m_flags; // format flags to use
+ output_state m_state; // what to do with the next character
+ bool m_have_conditional; // we are parsing a conditional
+private:
+ basic_regex_formatter(const basic_regex_formatter&);
+ basic_regex_formatter& operator=(const basic_regex_formatter&);
+};
-inline char make_lower(char c)
+template <class OutputIterator, class Results, class traits>
+OutputIterator basic_regex_formatter<OutputIterator, Results, traits>::format(const char_type* p1, const char_type* p2, match_flag_type f)
{
- return static_cast<char>((std::tolower)(c));
+ m_position = p1;
+ m_end = p2;
+ m_flags = f;
+ format_all();
+ return m_out;
}
-#endif //defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
-
-typedef enum {
- case_nochange,
- case_oneupper,
- case_onelower,
- case_allupper,
- case_alllower
-} case_flags_type;
-
-// traits_type is unused, but provided to make it possible to use it for case conversion
-template <class O, class charT, class traits_type>
-void BOOST_REGEX_CALL output_char(O& out, charT c, traits_type& /*t*/, case_flags_type& f)
+template <class OutputIterator, class Results, class traits>
+void basic_regex_formatter<OutputIterator, Results, traits>::format_all()
{
- switch (f) {
- case case_oneupper:
- f = case_nochange;
- // drop through
- case case_allupper:
- *out = make_upper(c);
+ // over and over:
+ while(m_position != m_end)
+ {
+ switch(*m_position)
+ {
+ case '&':
+ if(m_flags & ::boost::regex_constants::format_sed)
+ {
+ ++m_position;
+ put(m_results[0]);
+ break;
+ }
+ put(*m_position++);
+ break;
+ case '\\':
+ format_escape();
+ break;
+ case '(':
+ if(m_flags & boost::regex_constants::format_all)
+ {
+ ++m_position;
+ bool have_conditional = m_have_conditional;
+ m_have_conditional = false;
+ format_until_scope_end();
+ m_have_conditional = have_conditional;
+ if(m_position == m_end)
+ return;
+ BOOST_ASSERT(*m_position == static_cast<char_type>(')'));
+ ++m_position; // skip the closing ')'
+ break;
+ }
+ put(*m_position);
+ ++m_position;
+ break;
+ case ')':
+ if(m_flags & boost::regex_constants::format_all)
+ {
+ return;
+ }
+ put(*m_position);
+ ++m_position;
break;
- case case_onelower:
- f = case_nochange;
- // drop through
- case case_alllower:
- *out = make_lower(c);
+ case ':':
+ if((m_flags & boost::regex_constants::format_all) && m_have_conditional)
+ {
+ return;
+ }
+ put(*m_position);
+ ++m_position;
+ break;
+ case '?':
+ if(m_flags & boost::regex_constants::format_all)
+ {
+ ++m_position;
+ format_conditional();
+ break;
+ }
+ put(*m_position);
+ ++m_position;
break;
+ case '$':
+ if((m_flags & format_sed) == 0)
+ {
+ format_perl();
+ break;
+ }
+ // fall through, not a special character:
default:
- *out = c;
+ put(*m_position);
+ ++m_position;
break;
+ }
}
}
-template <class O, class I, class traits_type>
-O BOOST_REGEX_CALL re_copy_out(O out, I first, I last, traits_type& t, case_flags_type& f)
+template <class OutputIterator, class Results, class traits>
+void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
{
- while(first != last)
+ //
+ // On entry *m_position points to a '$' character
+ // output the information that goes with it:
+ //
+ BOOST_ASSERT(*m_position == '$');
+ //
+ // see if this is a trailing '$':
+ //
+ if(++m_position == m_end)
{
- if (f != case_nochange)
- output_char(out, *first, t, f);
- else
- *out = *first;
-
- ++out;
- ++first;
+ --m_position;
+ put(*m_position);
+ ++m_position;
+ return;
}
- return out;
-}
-
-
-template <class charT, class traits_type>
-void BOOST_REGEX_CALL re_skip_format(const charT*& fmt, const traits_type& traits_inst)
-{
- // dwa 9/13/00 - suppress incorrect unused parameter warning for MSVC
- (void)traits_inst;
-
- typedef typename traits_type::size_type traits_size_type;
- typedef typename traits_type::uchar_type traits_uchar_type;
- typedef typename traits_type::string_type traits_string_type;
-
- unsigned int parens = 0;
- unsigned int c;
- while(*fmt)
+ //
+ // OK find out what kind it is:
+ //
+ switch(*m_position)
{
- c = traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt));
- if((c == traits_type::syntax_colon) && (parens == 0))
- {
- ++fmt;
- return;
- }
- else if(c == traits_type::syntax_close_bracket)
+ case '&':
+ ++m_position;
+ put(this->m_results[0]);
+ break;
+ case '`':
+ ++m_position;
+ put(this->m_results.prefix());
+ break;
+ case '\'':
+ ++m_position;
+ put(this->m_results.suffix());
+ break;
+ case '$':
+ put(*m_position++);
+ break;
+ default:
+ // see if we have a number:
{
- if(parens == 0)
+ std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(2), ::boost::re_detail::distance(m_position, m_end));
+ int v = m_traits.toi(m_position, m_position + len, 10);
+ if(v < 0)
{
- ++fmt;
- return;
+ // leave the $ as is, and carry on:
+ --m_position;
+ put(*m_position);
+ ++m_position;
+ break;
}
- --parens;
- }
- else if(c == traits_type::syntax_open_bracket)
- ++parens;
- else if(c == traits_type::syntax_slash)
- {
- ++fmt;
- if(*fmt == 0)
- return;
+ // otherwise output sub v:
+ put(this->m_results[v]);
}
- ++fmt;
}
}
-#ifdef BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN
-
-//
-// ugly hack for buggy output iterators
-
-template <class T>
-inline void oi_assign(T* p, T v)
-{
- ::boost::re_detail::pointer_destroy(p);
- pointer_construct(p, v);
-}
-
-#else
-
-template <class T>
-inline void oi_assign(T* p, T v)
-{
- //
- // if you get a compile time error in here then you either
- // need to rewrite your output iterator to make it assignable
- // (as is required by the standard), or define
- // BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN to use the ugly hack above
- *p = v;
-}
-
-#endif
-
-
-#if defined(BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE)
-//
-// Ugly ugly hack,
-// template don't merge if they contain switch statements so declare these
-// templates in unnamed namespace (ie with internal linkage), each translation
-// unit then gets its own local copy, it works seemlessly but bloats the app.
-namespace{
-#endif
-
-//
-// algorithm reg_format:
-// takes the result of a match and a format string
-// and merges them to produce a new string which
-// is sent to an OutputIterator,
-// _reg_format_aux does the actual work:
-//
-template <class OutputIterator, class Iterator, class Allocator, class charT, class traits_type>
-OutputIterator BOOST_REGEX_CALL _reg_format_aux(OutputIterator out,
- const match_results<Iterator, Allocator>& m,
- const charT*& fmt,
- match_flag_type flags, const traits_type& traits_inst,
- case_flags_type& case_flags)
+template <class OutputIterator, class Results, class traits>
+void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
{
-#ifdef __BORLANDC__
-#pragma option push -w-8037
-#endif
- const charT* fmt_end = fmt;
- while(*fmt_end) ++ fmt_end;
-
- typedef typename traits_type::size_type traits_size_type;
- typedef typename traits_type::uchar_type traits_uchar_type;
- typedef typename traits_type::string_type traits_string_type;
-
- while(*fmt)
+ // skip the escape and check for trailing escape:
+ if(++m_position == m_end)
{
- switch(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)))
+ put(static_cast<char_type>('\\'));
+ return;
+ }
+ // now switch on the escape type:
+ switch(*m_position)
+ {
+ case 'a':
+ put(static_cast<char_type>('\a'));
+ ++m_position;
+ break;
+ case 'f':
+ put(static_cast<char_type>('\f'));
+ ++m_position;
+ break;
+ case 'n':
+ put(static_cast<char_type>('\n'));
+ ++m_position;
+ break;
+ case 'r':
+ put(static_cast<char_type>('\r'));
+ ++m_position;
+ break;
+ case 't':
+ put(static_cast<char_type>('\t'));
+ ++m_position;
+ break;
+ case 'v':
+ put(static_cast<char_type>('\v'));
+ ++m_position;
+ break;
+ case 'x':
+ if(++m_position == m_end)
{
- case traits_type::syntax_dollar:
- if(flags & format_sed)
- {
- // no perl style replacement,
- // $ is an ordinary character:
- goto default_opt;
- }
- ++fmt;
- if(*fmt == 0) // oops trailing $
- {
- --fmt;
- *out = *fmt;
- ++out;
- return out;
- }
- switch(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)))
- {
- case traits_type::syntax_start_buffer:
- oi_assign(&out, re_copy_out(out, Iterator(m[-1].first), Iterator(m[-1].second),
- traits_inst, case_flags));
- ++fmt;
- continue;
- case traits_type::syntax_end_buffer:
- oi_assign(&out, re_copy_out(out, Iterator(m[-2].first), Iterator(m[-2].second),
- traits_inst, case_flags));
- ++fmt;
- continue;
- case traits_type::syntax_digit:
- {
-expand_sub:
- unsigned int index = traits_inst.toi(fmt, fmt_end, 10);
- if(index < m.size())
- oi_assign(&out, re_copy_out(out, Iterator(m[index].first), Iterator(m[index].second),
- traits_inst, case_flags));
- continue;
- }
- }
- // anything else:
- if(*fmt == '&')
+ put(static_cast<char_type>('x'));
+ return;
+ }
+ // maybe have \x{ddd}
+ if(*m_position == static_cast<char_type>('{'))
+ {
+ ++m_position;
+ int val = m_traits.toi(m_position, m_end, 16);
+ if(val < 0)
{
- oi_assign(&out, re_copy_out(out, Iterator(m[0].first), Iterator(m[0].second),
- traits_inst, case_flags));
- ++fmt;
+ // invalid value treat everything as literals:
+ put(static_cast<char_type>('x'));
+ put(static_cast<char_type>('{'));
+ return;
}
- else
+ if(*m_position != static_cast<char_type>('}'))
{
- // probably an error, treat as a literal '$'
- --fmt;
- *out = *fmt;
- ++out;
- ++fmt;
+ while(*m_position != static_cast<char_type>('\\'))
+ --m_position;
+ ++m_position;
+ put(*m_position++);
+ return;
}
- continue;
- case traits_type::syntax_slash:
+ ++m_position;
+ put(static_cast<char_type>(val));
+ return;
+ }
+ else
{
- // escape sequence:
- ++fmt;
- charT c(*fmt);
- if(*fmt == 0)
+ std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(2), ::boost::re_detail::distance(m_position, m_end));
+ int val = m_traits.toi(m_position, m_position + len, 16);
+ if(val < 0)
{
- --fmt;
- *out = *fmt;
- ++out;
- ++fmt;
- return out;
+ --m_position;
+ put(*m_position++);
+ return;
}
- switch(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)))
+ put(static_cast<char_type>(val));
+ }
+ break;
+ case 'c':
+ if(++m_position == m_end)
+ {
+ --m_position;
+ put(*m_position++);
+ return;
+ }
+ put(static_cast<char_type>(*m_position++ % 32));
+ break;
+ case 'e':
+ put(static_cast<char_type>(27));
+ ++m_position;
+ break;
+ default:
+ // see if we have a perl specific escape:
+ if((m_flags & boost::regex_constants::format_sed) == 0)
+ {
+ bool breakout = false;
+ switch(*m_position)
{
- case traits_type::syntax_a:
- c = '\a';
- ++fmt;
- break;
- case traits_type::syntax_f:
- c = '\f';
- ++fmt;
- break;
- case traits_type::syntax_n:
- c = '\n';
- ++fmt;
- break;
- case traits_type::syntax_r:
- c = '\r';
- ++fmt;
+ case 'l':
+ ++m_position;
+ m_state = output_next_lower;
+ breakout = true;
break;
- case traits_type::syntax_t:
- c = '\t';
- ++fmt;
+ case 'L':
+ ++m_position;
+ m_state = output_lower;
+ breakout = true;
break;
- case traits_type::syntax_v:
- c = '\v';
- ++fmt;
+ case 'u':
+ ++m_position;
+ m_state = output_next_upper;
+ breakout = true;
break;
- case traits_type::syntax_x:
- ++fmt;
- if(fmt == fmt_end)
- {
- *out = *--fmt;
- ++out;
- return out;
- }
- // maybe have \x{ddd}
- if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)) == traits_type::syntax_open_brace)
- {
- ++fmt;
- if(fmt == fmt_end)
- {
- fmt -= 2;
- *out = *fmt;
- ++out;
- ++fmt;
- continue;
- }
- if(traits_inst.is_class(*fmt, traits_type::char_class_xdigit) == false)
- {
- fmt -= 2;
- *out = *fmt;
- ++out;
- ++fmt;
- continue;
- }
- c = (charT)traits_inst.toi(fmt, fmt_end, -16);
- if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)) != traits_type::syntax_close_brace)
- {
- while(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*fmt)) != traits_type::syntax_slash)
- --fmt;
- ++fmt;
- *out = *fmt;
- ++out;
- ++fmt;
- continue;
- }
- ++fmt;
- break;
- }
- else
- {
- if(traits_inst.is_class(*fmt, traits_type::char_class_xdigit) == false)
- {
- --fmt;
- *out = *fmt;
- ++out;
- ++fmt;
- continue;
- }
- c = (charT)traits_inst.toi(fmt, fmt_end, -16);
- }
+ case 'U':
+ ++m_position;
+ m_state = output_upper;
+ breakout = true;
break;
- case traits_type::syntax_c:
- ++fmt;
- if(fmt == fmt_end)
- {
- --fmt;
- *out = *fmt;
- ++out;
- return out;
- }
- if(((typename traits_type::uchar_type)(*fmt) < (typename traits_type::uchar_type)'@')
- || ((typename traits_type::uchar_type)(*fmt) > (typename traits_type::uchar_type)127) )
- {
- --fmt;
- *out = *fmt;
- ++out;
- ++fmt;
- break;
- }
- c = (charT)((typename traits_type::uchar_type)(*fmt) - (typename traits_type::uchar_type)'@');
- ++fmt;
+ case 'E':
+ ++m_position;
+ m_state = output_copy;
+ breakout = true;
break;
- case traits_type::syntax_e:
- c = (charT)27;
- ++fmt;
- break;
- case traits_type::syntax_digit:
- if(flags & format_sed)
- goto expand_sub;
- else
- c = (charT)traits_inst.toi(fmt, fmt_end, -8);
- break;
-
- case traits_type::syntax_u:
- ++fmt;
- if(flags & format_sed) break;
- case_flags = case_oneupper;
- continue;
- case traits_type::syntax_l:
- ++fmt;
- if(flags & format_sed) break;
- case_flags = case_onelower;
- continue;
- case traits_type::syntax_U:
- ++fmt;
- if(flags & format_sed) break;
- case_flags = case_allupper;
- continue;
- case traits_type::syntax_L:
- ++fmt;
- if(flags & format_sed) break;
- case_flags = case_alllower;
- continue;
- case traits_type::syntax_E:
- ++fmt;
- if(flags & format_sed) break;
- case_flags = case_nochange;
- continue;
- default:
- //c = *fmt;
- ++fmt;
}
- *out = c;
- ++out;
- continue;
+ if(breakout)
+ break;
}
- case traits_type::syntax_open_bracket:
- if(0 == (flags & format_all))
- {
- *out = *fmt;
- ++out;
- ++fmt;
- continue;
- }
- else
- {
- ++fmt; // recurse
- oi_assign(&out, _reg_format_aux(out, m, fmt, flags, traits_inst, case_flags));
- continue;
- }
- case traits_type::syntax_close_bracket:
- if(0 == (flags & format_all))
- {
- *out = *fmt;
- ++out;
- ++fmt;
- continue;
- }
- else
- {
- ++fmt; // return from recursion
- return out;
- }
- case traits_type::syntax_colon:
- if(flags & regex_constants::format_is_if)
- {
- ++fmt;
- return out;
- }
- *out = *fmt;
- ++out;
- ++fmt;
- continue;
- case traits_type::syntax_question:
+ // see if we have a \n sed style backreference:
+ int v = m_traits.toi(m_position, m_position+1, 10);
+ if((v > 0) || ((v == 0) && (m_flags & ::boost::regex_constants::format_sed)))
{
- if(0 == (flags & format_all))
- {
- *out = *fmt;
- ++out;
- ++fmt;
- continue;
- }
- else
- {
- ++fmt;
- if(*fmt == 0)
- {
- --fmt;
- *out = *fmt;
- ++out;
- ++fmt;
- return out;
- }
- unsigned int id = traits_inst.toi(fmt, fmt_end, 10);
- if(m[id].matched)
- {
- oi_assign(&out, _reg_format_aux(out, m, fmt, flags | regex_constants::format_is_if, traits_inst, case_flags));
- if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*(fmt-1))) == traits_type::syntax_colon)
- re_skip_format(fmt, traits_inst);
- }
- else
- {
- re_skip_format(fmt, traits_inst);
- if(traits_inst.syntax_type((traits_size_type)(traits_uchar_type)(*(fmt-1))) == traits_type::syntax_colon)
- oi_assign(&out, _reg_format_aux(out, m, fmt, flags | regex_constants::format_is_if, traits_inst, case_flags));
- }
- return out;
- }
+ put(m_results[v]);
+ break;
}
- default:
-default_opt:
- if((flags & format_sed) && (*fmt == '&'))
- {
- oi_assign(&out, re_copy_out(out, Iterator(m[0].first), Iterator(m[0].second),
- traits_inst, case_flags));
- ++fmt;
- continue;
- }
+ else if(v == 0)
+ {
+ // octal ecape sequence:
+ --m_position;
+ std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(4), ::boost::re_detail::distance(m_position, m_end));
+ v = m_traits.toi(m_position, m_position + len, 8);
+ BOOST_ASSERT(v >= 0);
+ put(static_cast<char_type>(v));
+ break;
+ }
+ // Otherwise output the character "as is":
+ put(*m_position++);
+ break;
+ }
+}
- output_char(out, *fmt, traits_inst, case_flags);
- ++out;
- ++fmt;
+template <class OutputIterator, class Results, class traits>
+void basic_regex_formatter<OutputIterator, Results, traits>::format_conditional()
+{
+ if(m_position == m_end)
+ {
+ // oops trailing '?':
+ put(static_cast<char_type>('?'));
+ return;
+ }
+ std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(2), ::boost::re_detail::distance(m_position, m_end));
+ int v = m_traits.toi(m_position, m_position + len, 10);
+ if(v < 0)
+ {
+ // oops not a number:
+ put(static_cast<char_type>('?'));
+ return;
+ }
+
+ // output varies depending upon whether sub-expression v matched or not:
+ if(m_results[v].matched)
+ {
+ m_have_conditional = true;
+ format_all();
+ m_have_conditional = false;
+ if((m_position != m_end) && (*m_position == static_cast<char_type>(':')))
+ {
+ // skip the ':':
+ ++m_position;
+ // save output state, then turn it off:
+ output_state saved_state = m_state;
+ m_state = output_none;
+ // format the rest of this scope:
+ format_until_scope_end();
+ // restore output state:
+ m_state = saved_state;
}
}
+ else
+ {
+ // save output state, then turn it off:
+ output_state saved_state = m_state;
+ m_state = output_none;
+ // format until ':' or ')':
+ m_have_conditional = true;
+ format_all();
+ m_have_conditional = false;
+ // restore state:
+ m_state = saved_state;
+ if((m_position != m_end) && (*m_position == static_cast<char_type>(':')))
+ {
+ // skip the ':':
+ ++m_position;
+ // format the rest of this scope:
+ format_until_scope_end();
+ }
+ }
+}
- return out;
-#ifdef __BORLANDC__
-#pragma option pop
-#endif
+template <class OutputIterator, class Results, class traits>
+void basic_regex_formatter<OutputIterator, Results, traits>::format_until_scope_end()
+{
+ do
+ {
+ format_all();
+ if((m_position == m_end) || (*m_position == static_cast<char_type>(')')))
+ return;
+ put(*m_position++);
+ }while(m_position != m_end);
}
-#if defined(BOOST_REGEX_NO_TEMPLATE_SWITCH_MERGE)
-} // namespace
-#endif
+template <class OutputIterator, class Results, class traits>
+void basic_regex_formatter<OutputIterator, Results, traits>::put(char_type c)
+{
+ // write a single character to output
+ // according to which case translation mode we are in:
+ switch(this->m_state)
+ {
+ case output_none:
+ return;
+ case output_next_lower:
+ c = m_traits.tolower(c);
+ this->m_state = output_copy;
+ break;
+ case output_next_upper:
+ c = m_traits.toupper(c);
+ this->m_state = output_copy;
+ break;
+ case output_lower:
+ c = m_traits.tolower(c);
+ break;
+ case output_upper:
+ c = m_traits.toupper(c);
+ break;
+ default:
+ break;
+ }
+ *m_out = c;
+ ++m_out;
+}
+
+template <class OutputIterator, class Results, class traits>
+void basic_regex_formatter<OutputIterator, Results, traits>::put(const sub_match_type& sub)
+{
+ typedef typename sub_match_type::iterator iterator_type;
+ iterator_type i = sub.first;
+ while(i != sub.second)
+ {
+ put(*i);
+ ++i;
+ }
+}
template <class S>
class string_out_iterator
+#ifndef BOOST_NO_STD_ITERATOR
+ : public std::iterator<std::output_iterator_tag, typename S::value_type>
+#endif
{
S* out;
public:
- typedef typename S::difference_type difference_type;
- typedef typename S::value_type value_type;
- typedef typename S::pointer pointer;
- typedef typename S::reference reference;
- typedef std::output_iterator_tag iterator_category;
-
string_out_iterator(S& s) : out(&s) {}
string_out_iterator& operator++() { return *this; }
string_out_iterator& operator++(int) { return *this; }
string_out_iterator& operator*() { return *this; }
- string_out_iterator& operator=(typename S::value_type v)
- {
- out->append(1, v);
- return *this;
+ string_out_iterator& operator=(typename S::value_type v)
+ {
+ out->append(1, v);
+ return *this;
}
+
+#ifdef BOOST_NO_STD_ITERATOR
+ typedef std::ptrdiff_t difference_type;
+ typedef typename S::value_type value_type;
+ typedef value_type* pointer;
+ typedef value_type& reference;
+ typedef std::output_iterator_tag iterator_category;
+#endif
};
-template <class OutputIterator, class Iterator, class charT, class Allocator, class traits_type>
-class merge_out_predicate
+template <class OutputIterator, class Iterator, class Alloc, class charT, class traits>
+OutputIterator regex_format_imp(OutputIterator out,
+ const match_results<Iterator, Alloc>& m,
+ const charT* p1, const charT* p2,
+ match_flag_type flags,
+ const traits& t
+ )
{
- OutputIterator* out;
- Iterator* last;
- const charT* fmt;
- match_flag_type flags;
- const traits_type* pt;
- // rebind allocator to correct type:
- typedef typename detail::rebind_allocator<sub_match<Iterator>, Allocator>::type alloc_type;
-
-public:
- merge_out_predicate(OutputIterator& o, Iterator& pi, const charT* f, match_flag_type format_flags, const traits_type& p)
- : out(&o), last(&pi), fmt(f), flags(format_flags), pt(&p){}
-
- ~merge_out_predicate() {}
- bool BOOST_REGEX_CALL operator()(const boost::match_results<Iterator, alloc_type>& m)
+ if(flags & regex_constants::format_literal)
{
- const charT* f = fmt;
- case_flags_type cf = case_nochange;
- if(0 == (flags & format_no_copy))
- {
- oi_assign(out, re_copy_out(
- *out,
- Iterator(m[-1].first),
- Iterator(m[-1].second),
- *pt,
- cf));
- }
- oi_assign(out, _reg_format_aux(*out, m, f, flags, *pt, cf));
- *last = m[-2].first;
- return flags & format_first_only ? false : true;
+ return re_detail::copy(p1, p2, out);
}
-};
+
+ re_detail::basic_regex_formatter<
+ OutputIterator,
+ match_results<Iterator, Alloc>,
+ traits > f(out, m, t);
+ return f.format(p1, p2, flags);
+}
+
} // namespace re_detail
-template <class OutputIterator, class Iterator, class Allocator, class charT>
+template <class OutputIterator, class Iterator, class charT>
OutputIterator regex_format(OutputIterator out,
- const match_results<Iterator, Allocator>& m,
+ const match_results<Iterator>& m,
const charT* fmt,
match_flag_type flags = format_all
)
{
- regex_traits<charT> t;
-
- re_detail::case_flags_type cf = re_detail::case_nochange;
- return re_detail::_reg_format_aux(out, m, fmt, flags, t, cf);
+ re_detail::trivial_format_traits<charT> traits;
+ return re_detail::regex_format_imp(out, m, fmt, fmt + traits.length(fmt), flags, traits);
}
-template <class OutputIterator, class Iterator, class Allocator, class charT>
+template <class OutputIterator, class Iterator, class charT>
OutputIterator regex_format(OutputIterator out,
- const match_results<Iterator, Allocator>& m,
+ const match_results<Iterator>& m,
const std::basic_string<charT>& fmt,
match_flag_type flags = format_all
)
{
- regex_traits<charT> t;
- const charT* start = fmt.c_str();
-
- re_detail::case_flags_type cf = re_detail::case_nochange;
- return re_detail::_reg_format_aux(out, m, start, flags, t, cf);
-}
+ re_detail::trivial_format_traits<charT> traits;
+ return re_detail::regex_format_imp(out, m, fmt.data(), fmt.data() + fmt.size(), flags, traits);
+}
-template <class Iterator, class Allocator, class charT>
-std::basic_string<charT> regex_format(const match_results<Iterator, Allocator>& m,
- const charT* fmt,
+template <class Iterator, class charT>
+std::basic_string<charT> regex_format(const match_results<Iterator>& m,
+ const charT* fmt,
match_flag_type flags = format_all)
{
std::basic_string<charT> result;
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
- regex_format(i, m, fmt, flags);
+ re_detail::trivial_format_traits<charT> traits;
+ re_detail::regex_format_imp(i, m, fmt, fmt + traits.length(fmt), flags, traits);
return result;
}
-template <class Iterator, class Allocator, class charT>
-std::basic_string<charT> regex_format(const match_results<Iterator, Allocator>& m,
- const std::basic_string<charT>& fmt,
+template <class Iterator, class charT>
+std::basic_string<charT> regex_format(const match_results<Iterator>& m,
+ const std::basic_string<charT>& fmt,
match_flag_type flags = format_all)
{
std::basic_string<charT> result;
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
- regex_format(i, m, fmt.c_str(), flags);
+ re_detail::trivial_format_traits<charT> traits;
+ re_detail::regex_format_imp(i, m, fmt.data(), fmt.data() + fmt.size(), flags, traits);
return result;
}
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
* LOCATION: see http://www.boost.org for most recent version.
* FILE regex_fwd.cpp
* VERSION see <boost/version.hpp>
- * DESCRIPTION: Forward declares boost::reg_expression<> and
+ * DESCRIPTION: Forward declares boost::basic_regex<> and
* associated typedefs.
*/
#define BOOST_REGEX_FWD_HPP_INCLUDED
#ifndef BOOST_REGEX_CONFIG_HPP
-#include <boost/config.hpp>
+#include <boost/regex/config.hpp>
#endif
-#include <boost/regex/config/allocator.hpp>
//
// define BOOST_REGEX_NO_FWD if this
# endif
#else
-//
-// If there isn't good enough wide character support then there will
-// be no wide character regular expressions:
-//
-#if (defined(BOOST_NO_CWCHAR) || defined(BOOST_NO_CWCTYPE) || defined(BOOST_NO_STD_WSTRING)) && !defined(BOOST_NO_WREGEX)
-# define BOOST_NO_WREGEX
-#endif
-
namespace boost{
template <class charT>
-class regex_traits;
+class cpp_regex_traits;
+template <class charT>
+struct c_regex_traits;
+template <class charT>
+class w32_regex_traits;
+
+#ifdef BOOST_REGEX_USE_WIN32_LOCALE
+template <class charT, class implementationT = w32_regex_traits<charT> >
+struct regex_traits;
+#elif defined(BOOST_REGEX_USE_CPP_LOCALE)
+template <class charT, class implementationT = cpp_regex_traits<charT> >
+struct regex_traits;
+#else
+template <class charT, class implementationT = c_regex_traits<charT> >
+struct regex_traits;
+#endif
-template <class charT, class traits = regex_traits<charT>, class Allocator = BOOST_DEFAULT_ALLOCATOR(charT) >
-class reg_expression;
-template <class charT, class traits = regex_traits<charT>, class Allocator = BOOST_DEFAULT_ALLOCATOR(charT) >
+template <class charT, class traits = regex_traits<charT> >
class basic_regex;
-typedef basic_regex<char, regex_traits<char>, BOOST_DEFAULT_ALLOCATOR(char) > regex;
+typedef basic_regex<char, regex_traits<char> > regex;
#ifndef BOOST_NO_WREGEX
-typedef basic_regex<wchar_t, regex_traits<wchar_t>, BOOST_DEFAULT_ALLOCATOR(wchar_t) > wregex;
+typedef basic_regex<wchar_t, regex_traits<wchar_t> > wregex;
#endif
} // namespace boost
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
// regex_grep:
// find all non-overlapping matches within the sequence first last:
//
-template <class Predicate, class BidiIterator, class charT, class traits, class Allocator>
+template <class Predicate, class BidiIterator, class charT, class traits>
inline unsigned int regex_grep(Predicate foo,
BidiIterator first,
BidiIterator last,
- const reg_expression<charT, traits, Allocator>& e,
+ const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
if(e.flags() & regex_constants::failbit)
return false;
- typedef detail::rebind_allocator<sub_match<BidiIterator>, Allocator> binder;
- typedef typename binder::type match_allocator_type;
- //typedef Allocator match_allocator_type;
- match_results<BidiIterator, match_allocator_type> m;
- re_detail::perl_matcher<BidiIterator, match_allocator_type, traits, Allocator> matcher(first, last, m, e, flags);
+ typedef typename match_results<BidiIterator>::allocator_type match_allocator_type;
+
+ match_results<BidiIterator> m;
+ re_detail::perl_matcher<BidiIterator, match_allocator_type, traits> matcher(first, last, m, e, flags, first);
unsigned int count = 0;
while(matcher.find())
{
// this isn't really a partial specialisation, but template function
// overloading - if the compiler doesn't support partial specialisation
// then it really won't support this either:
-template <class Predicate, class charT, class Allocator, class traits>
+template <class Predicate, class charT, class traits>
inline unsigned int regex_grep(Predicate foo, const charT* str,
- const reg_expression<charT, traits, Allocator>& e,
+ const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
return regex_grep(foo, str, str + traits::length(str), e, flags);
}
-template <class Predicate, class ST, class SA, class Allocator, class charT, class traits>
+template <class Predicate, class ST, class SA, class charT, class traits>
inline unsigned int regex_grep(Predicate foo, const std::basic_string<charT, ST, SA>& s,
- const reg_expression<charT, traits, Allocator>& e,
+ const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
return regex_grep(foo, s.begin(), s.end(), e, flags);
/*
*
* Copyright (c) 2003
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
template <class BidirectionalIterator,
class charT,
- class traits,
- class Allocator>
+ class traits>
class regex_iterator_implementation
{
- typedef basic_regex<charT, traits, Allocator> regex_type;
+ typedef basic_regex<charT, traits> regex_type;
match_results<BidirectionalIterator> what; // current match
BidirectionalIterator base; // start of sequence
BidirectionalIterator end; // end of sequence
- const regex_type* pre; // the expression
+ const regex_type re; // the expression
match_flag_type flags; // flags for matching
public:
regex_iterator_implementation(const regex_type* p, BidirectionalIterator last, match_flag_type f)
- : base(), end(last), pre(p), flags(f){}
+ : base(), end(last), re(*p), flags(f){}
bool init(BidirectionalIterator first)
{
base = first;
- return regex_search(first, end, what, *pre, flags);
+ return regex_search(first, end, what, re, flags);
}
bool compare(const regex_iterator_implementation& that)
{
if(this == &that) return true;
- return (pre == that.pre) && (end == that.end) && (flags == that.flags) && (what[0].first == that.what[0].first) && (what[0].second == that.what[0].second);
+ return (&re.get_data() == &that.re.get_data()) && (end == that.end) && (flags == that.flags) && (what[0].first == that.what[0].first) && (what[0].second == that.what[0].second);
}
const match_results<BidirectionalIterator>& get()
{ return what; }
bool next()
{
- if(what.prefix().first != what[0].second)
- flags |= match_prev_avail;
+ //if(what.prefix().first != what[0].second)
+ // flags |= match_prev_avail;
BidirectionalIterator next_start = what[0].second;
match_flag_type f(flags);
if(!what.length())
f |= regex_constants::match_not_initial_null;
- bool result = regex_search(next_start, end, what, *pre, f);
+ //if(base != next_start)
+ // f |= regex_constants::match_not_bob;
+ bool result = regex_search(next_start, end, what, re, f, base);
if(result)
what.set_base(base);
return result;
}
+private:
+ regex_iterator_implementation& operator=(const regex_iterator_implementation&);
};
template <class BidirectionalIterator,
class charT = BOOST_DEDUCED_TYPENAME re_detail::regex_iterator_traits<BidirectionalIterator>::value_type,
- class traits = regex_traits<charT>,
- class Allocator = BOOST_DEFAULT_ALLOCATOR(charT) >
+ class traits = regex_traits<charT> >
class regex_iterator
#ifndef BOOST_NO_STD_ITERATOR
: public std::iterator<
#endif
{
private:
- typedef regex_iterator_implementation<BidirectionalIterator, charT, traits, Allocator> impl;
+ typedef regex_iterator_implementation<BidirectionalIterator, charT, traits> impl;
typedef shared_ptr<impl> pimpl;
public:
- typedef basic_regex<charT, traits, Allocator> regex_type;
+ typedef basic_regex<charT, traits> regex_type;
typedef match_results<BidirectionalIterator> value_type;
typedef typename re_detail::regex_iterator_traits<BidirectionalIterator>::difference_type
difference_type;
typedef regex_iterator<std::wstring::const_iterator> wsregex_iterator;
#endif
+// make_regex_iterator:
+template <class charT, class traits>
+inline regex_iterator<const charT*, charT, traits> make_regex_iterator(const charT* p, const basic_regex<charT, traits>& e, regex_constants::match_flag_type m = regex_constants::match_default)
+{
+ return regex_iterator<const charT*, charT, traits>(p, p+traits::length(p), e, m);
+}
+template <class charT, class traits, class ST, class SA>
+inline regex_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits> make_regex_iterator(const std::basic_string<charT, ST, SA>& p, const basic_regex<charT, traits>& e, regex_constants::match_flag_type m = regex_constants::match_default)
+{
+ return regex_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits>(p.begin(), p.end(), e, m);
+}
+
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
typedef typename boost::detail::rebind_allocator<char, Allocator>::type atype;
int i, j, m;
i = 0;
- m = static_cast<int>(boost::re_detail::distance(first, last));
+ m = static_cast<int>(::boost::re_detail::distance(first, last));
++m;
unsigned int size = sizeof(kmp_info<charT>) + sizeof(int)*m + sizeof(charT)*m;
--m;
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#ifndef BOOST_REGEX_MATCH_HPP
#define BOOST_REGEX_MATCH_HPP
-#ifndef BOOST_REGEX_MAX_STATE_COUNT
-# define BOOST_REGEX_MAX_STATE_COUNT 100000000
-#endif
-
-#include <boost/limits.hpp>
-#include <boost/regex/v4/perl_matcher.hpp>
-
-
namespace boost{
#ifdef BOOST_HAS_ABI_HEADERS
// returns true if the specified regular expression matches
// the whole of the input. Fills in what matched in m.
//
-template <class BidiIterator, class Allocator, class charT, class traits, class Allocator2>
+template <class BidiIterator, class Allocator, class charT, class traits>
bool regex_match(BidiIterator first, BidiIterator last,
match_results<BidiIterator, Allocator>& m,
- const reg_expression<charT, traits, Allocator2>& e,
+ const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
- re_detail::perl_matcher<BidiIterator, Allocator, traits, Allocator2> matcher(first, last, m, e, flags);
+ re_detail::perl_matcher<BidiIterator, Allocator, traits> matcher(first, last, m, e, flags, first);
return matcher.match();
}
-template <class iterator, class charT, class traits, class Allocator2>
+template <class iterator, class charT, class traits>
bool regex_match(iterator first, iterator last,
- const reg_expression<charT, traits, Allocator2>& e,
+ const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
match_results<iterator> m;
- return regex_match(first, last, m, e, flags);
+ return regex_match(first, last, m, e, flags | regex_constants::match_any);
}
//
// query_match convenience interfaces:
// this isn't really a partial specialisation, but template function
// overloading - if the compiler doesn't support partial specialisation
// then it really won't support this either:
-template <class charT, class Allocator, class traits, class Allocator2>
+template <class charT, class Allocator, class traits>
inline bool regex_match(const charT* str,
match_results<const charT*, Allocator>& m,
- const reg_expression<charT, traits, Allocator2>& e,
+ const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
return regex_match(str, str + traits::length(str), m, e, flags);
}
-template <class ST, class SA, class Allocator, class charT, class traits, class Allocator2>
+template <class ST, class SA, class Allocator, class charT, class traits>
inline bool regex_match(const std::basic_string<charT, ST, SA>& s,
match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
- const reg_expression<charT, traits, Allocator2>& e,
+ const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
return regex_match(s.begin(), s.end(), m, e, flags);
}
-template <class charT, class traits, class Allocator2>
+template <class charT, class traits>
inline bool regex_match(const charT* str,
- const reg_expression<charT, traits, Allocator2>& e,
+ const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
match_results<const charT*> m;
- return regex_match(str, str + traits::length(str), m, e, flags);
+ return regex_match(str, str + traits::length(str), m, e, flags | regex_constants::match_any);
}
-template <class ST, class SA, class charT, class traits, class Allocator2>
+template <class ST, class SA, class charT, class traits>
inline bool regex_match(const std::basic_string<charT, ST, SA>& s,
- const reg_expression<charT, traits, Allocator2>& e,
+ const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
typedef typename std::basic_string<charT, ST, SA>::const_iterator iterator;
match_results<iterator> m;
- return regex_match(s.begin(), s.end(), m, e, flags);
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
}
#else // partial ordering
inline bool regex_match(const char* str,
match_flag_type flags = match_default)
{
match_results<const char*> m;
+ return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
+}
+#ifndef BOOST_NO_STD_LOCALE
+inline bool regex_match(const char* str,
+ cmatch& m,
+ const basic_regex<char, cpp_regex_traits<char> >& e,
+ match_flag_type flags = match_default)
+{
return regex_match(str, str + regex::traits_type::length(str), m, e, flags);
}
+inline bool regex_match(const char* str,
+ const basic_regex<char, cpp_regex_traits<char> >& e,
+ match_flag_type flags = match_default)
+{
+ match_results<const char*> m;
+ return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
+}
+#endif
+inline bool regex_match(const char* str,
+ cmatch& m,
+ const basic_regex<char, c_regex_traits<char> >& e,
+ match_flag_type flags = match_default)
+{
+ return regex_match(str, str + regex::traits_type::length(str), m, e, flags);
+}
+inline bool regex_match(const char* str,
+ const basic_regex<char, c_regex_traits<char> >& e,
+ match_flag_type flags = match_default)
+{
+ match_results<const char*> m;
+ return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
+}
+#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
+inline bool regex_match(const char* str,
+ cmatch& m,
+ const basic_regex<char, w32_regex_traits<char> >& e,
+ match_flag_type flags = match_default)
+{
+ return regex_match(str, str + regex::traits_type::length(str), m, e, flags);
+}
+inline bool regex_match(const char* str,
+ const basic_regex<char, w32_regex_traits<char> >& e,
+ match_flag_type flags = match_default)
+{
+ match_results<const char*> m;
+ return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
+}
+#endif
#ifndef BOOST_NO_WREGEX
inline bool regex_match(const wchar_t* str,
wcmatch& m,
match_flag_type flags = match_default)
{
match_results<const wchar_t*> m;
+ return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
+}
+#ifndef BOOST_NO_STD_LOCALE
+inline bool regex_match(const wchar_t* str,
+ wcmatch& m,
+ const basic_regex<wchar_t, cpp_regex_traits<wchar_t> >& e,
+ match_flag_type flags = match_default)
+{
return regex_match(str, str + wregex::traits_type::length(str), m, e, flags);
}
+inline bool regex_match(const wchar_t* str,
+ const basic_regex<wchar_t, cpp_regex_traits<wchar_t> >& e,
+ match_flag_type flags = match_default)
+{
+ match_results<const wchar_t*> m;
+ return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
+}
+#endif
+inline bool regex_match(const wchar_t* str,
+ wcmatch& m,
+ const basic_regex<wchar_t, c_regex_traits<wchar_t> >& e,
+ match_flag_type flags = match_default)
+{
+ return regex_match(str, str + wregex::traits_type::length(str), m, e, flags);
+}
+inline bool regex_match(const wchar_t* str,
+ const basic_regex<wchar_t, c_regex_traits<wchar_t> >& e,
+ match_flag_type flags = match_default)
+{
+ match_results<const wchar_t*> m;
+ return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
+}
+#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
+inline bool regex_match(const wchar_t* str,
+ wcmatch& m,
+ const basic_regex<wchar_t, w32_regex_traits<wchar_t> >& e,
+ match_flag_type flags = match_default)
+{
+ return regex_match(str, str + wregex::traits_type::length(str), m, e, flags);
+}
+inline bool regex_match(const wchar_t* str,
+ const basic_regex<wchar_t, w32_regex_traits<wchar_t> >& e,
+ match_flag_type flags = match_default)
+{
+ match_results<const wchar_t*> m;
+ return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
+}
+#endif
#endif
inline bool regex_match(const std::string& s,
smatch& m,
match_flag_type flags = match_default)
{
match_results<std::string::const_iterator> m;
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
+}
+#ifndef BOOST_NO_STD_LOCALE
+inline bool regex_match(const std::string& s,
+ smatch& m,
+ const basic_regex<char, cpp_regex_traits<char> >& e,
+ match_flag_type flags = match_default)
+{
return regex_match(s.begin(), s.end(), m, e, flags);
}
+inline bool regex_match(const std::string& s,
+ const basic_regex<char, cpp_regex_traits<char> >& e,
+ match_flag_type flags = match_default)
+{
+ match_results<std::string::const_iterator> m;
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
+}
+#endif
+inline bool regex_match(const std::string& s,
+ smatch& m,
+ const basic_regex<char, c_regex_traits<char> >& e,
+ match_flag_type flags = match_default)
+{
+ return regex_match(s.begin(), s.end(), m, e, flags);
+}
+inline bool regex_match(const std::string& s,
+ const basic_regex<char, c_regex_traits<char> >& e,
+ match_flag_type flags = match_default)
+{
+ match_results<std::string::const_iterator> m;
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
+}
+#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
+inline bool regex_match(const std::string& s,
+ smatch& m,
+ const basic_regex<char, w32_regex_traits<char> >& e,
+ match_flag_type flags = match_default)
+{
+ return regex_match(s.begin(), s.end(), m, e, flags);
+}
+inline bool regex_match(const std::string& s,
+ const basic_regex<char, w32_regex_traits<char> >& e,
+ match_flag_type flags = match_default)
+{
+ match_results<std::string::const_iterator> m;
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
+}
+#endif
#if !defined(BOOST_NO_WREGEX)
inline bool regex_match(const std::basic_string<wchar_t>& s,
- wsmatch& m,
+ match_results<std::basic_string<wchar_t>::const_iterator>& m,
const wregex& e,
match_flag_type flags = match_default)
{
match_flag_type flags = match_default)
{
match_results<std::basic_string<wchar_t>::const_iterator> m;
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
+}
+#ifndef BOOST_NO_STD_LOCALE
+inline bool regex_match(const std::basic_string<wchar_t>& s,
+ match_results<std::basic_string<wchar_t>::const_iterator>& m,
+ const basic_regex<wchar_t, cpp_regex_traits<wchar_t> >& e,
+ match_flag_type flags = match_default)
+{
+ return regex_match(s.begin(), s.end(), m, e, flags);
+}
+inline bool regex_match(const std::basic_string<wchar_t>& s,
+ const basic_regex<wchar_t, cpp_regex_traits<wchar_t> >& e,
+ match_flag_type flags = match_default)
+{
+ match_results<std::basic_string<wchar_t>::const_iterator> m;
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
+}
+#endif
+inline bool regex_match(const std::basic_string<wchar_t>& s,
+ match_results<std::basic_string<wchar_t>::const_iterator>& m,
+ const basic_regex<wchar_t, c_regex_traits<wchar_t> >& e,
+ match_flag_type flags = match_default)
+{
+ return regex_match(s.begin(), s.end(), m, e, flags);
+}
+inline bool regex_match(const std::basic_string<wchar_t>& s,
+ const basic_regex<wchar_t, c_regex_traits<wchar_t> >& e,
+ match_flag_type flags = match_default)
+{
+ match_results<std::basic_string<wchar_t>::const_iterator> m;
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
+}
+#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
+inline bool regex_match(const std::basic_string<wchar_t>& s,
+ match_results<std::basic_string<wchar_t>::const_iterator>& m,
+ const basic_regex<wchar_t, w32_regex_traits<wchar_t> >& e,
+ match_flag_type flags = match_default)
+{
return regex_match(s.begin(), s.end(), m, e, flags);
}
+inline bool regex_match(const std::basic_string<wchar_t>& s,
+ const basic_regex<wchar_t, w32_regex_traits<wchar_t> >& e,
+ match_flag_type flags = match_default)
+{
+ match_results<std::basic_string<wchar_t>::const_iterator> m;
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
+}
+#endif
#endif
#endif
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
# include BOOST_ABI_PREFIX
#endif
-template <class OutputIterator, class Iterator, class traits, class Allocator, class charT>
+template <class OutputIterator, class Iterator, class traits, class charT>
inline OutputIterator regex_merge(OutputIterator out,
Iterator first,
Iterator last,
- const reg_expression<charT, traits, Allocator>& e,
+ const basic_regex<charT, traits>& e,
const charT* fmt,
match_flag_type flags = match_default)
{
return regex_replace(out, first, last, e, fmt, flags);
}
-template <class OutputIterator, class Iterator, class traits, class Allocator, class charT>
+template <class OutputIterator, class Iterator, class traits, class charT>
inline OutputIterator regex_merge(OutputIterator out,
Iterator first,
Iterator last,
- const reg_expression<charT, traits, Allocator>& e,
+ const basic_regex<charT, traits>& e,
const std::basic_string<charT>& fmt,
match_flag_type flags = match_default)
{
return regex_merge(out, first, last, e, fmt.c_str(), flags);
}
-template <class traits, class Allocator, class charT>
+template <class traits, class charT>
inline std::basic_string<charT> regex_merge(const std::basic_string<charT>& s,
- const reg_expression<charT, traits, Allocator>& e,
+ const basic_regex<charT, traits>& e,
const charT* fmt,
match_flag_type flags = match_default)
{
return regex_replace(s, e, fmt, flags);
}
-template <class traits, class Allocator, class charT>
+template <class traits, class charT>
inline std::basic_string<charT> regex_merge(const std::basic_string<charT>& s,
- const reg_expression<charT, traits, Allocator>& e,
+ const basic_regex<charT, traits>& e,
const std::basic_string<charT>& fmt,
match_flag_type flags = match_default)
{
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#include <boost/regex/config.hpp>
#endif
+#include <algorithm>
+#include <cstddef>
+
namespace boost{
namespace re_detail{
//
// class raw_storage
// basically this is a simplified vector<unsigned char>
-// this is used by reg_expression for expression storage
+// this is used by basic_regex for expression storage
//
-template <class Allocator>
-class raw_storage
+class BOOST_REGEX_DECL raw_storage
{
public:
- typedef Allocator allocator_type;
- typedef typename boost::detail::rebind_allocator<unsigned char, allocator_type>::type alloc_inst_type;
- typedef typename alloc_inst_type::size_type size_type;
- typedef typename alloc_inst_type::pointer pointer;
+ typedef std::size_t size_type;
+ typedef unsigned char* pointer;
private:
- //
- // empty member optimisation:
- struct alloc_data : public alloc_inst_type
- {
- typename alloc_inst_type::pointer last;
- alloc_data(const Allocator& a) : alloc_inst_type(a){}
- } alloc_inst;
- pointer start, end;
+ pointer last, start, end;
public:
- raw_storage(const Allocator& a = Allocator());
- raw_storage(size_type n, const Allocator& a = Allocator());
+ raw_storage();
+ raw_storage(size_type n);
~raw_storage()
{
- alloc_inst.deallocate(start, (alloc_inst.last - start));
+ ::operator delete(start);
}
void BOOST_REGEX_CALL resize(size_type n);
void* BOOST_REGEX_CALL extend(size_type n)
{
- if(size_type(alloc_inst.last - end) < n)
+ if(size_type(last - end) < n)
resize(n + (end - start));
- register void* result = end;
+ register pointer result = end;
end += n;
return result;
}
size_type BOOST_REGEX_CALL capacity()
{
- return alloc_inst.last - start;
+ return last - start;
}
void* BOOST_REGEX_CALL data()const
size_type BOOST_REGEX_CALL index(void* ptr)
{
- return reinterpret_cast<unsigned char*>(ptr) - reinterpret_cast<unsigned char*>(data());
+ return static_cast<pointer>(ptr) - static_cast<pointer>(data());
}
void BOOST_REGEX_CALL clear()
void BOOST_REGEX_CALL align()
{
// move end up to a boundary:
- end = reinterpret_cast<unsigned char*>(start) + (((reinterpret_cast<unsigned char*>(end) - reinterpret_cast<unsigned char*>(start)) + padding_mask) & ~padding_mask);
+ end = start + (((end - start) + padding_mask) & ~padding_mask);
}
-
- Allocator BOOST_REGEX_CALL allocator()const;
void swap(raw_storage& that)
{
std::swap(start, that.start);
std::swap(end, that.end);
- std::swap(alloc_inst.last, that.alloc_inst.last);
- std::swap(static_cast<alloc_inst_type&>(alloc_inst), static_cast<alloc_inst_type&>(that.alloc_inst));
+ std::swap(last, that.last);
}
};
-template <class Allocator>
-raw_storage<Allocator>::raw_storage(const Allocator& a)
- : alloc_inst(a)
-{
- start = end = alloc_inst.allocate(1024);
- BOOST_REGEX_NOEH_ASSERT(start)
- alloc_inst.last = start + 1024;
-}
-
-template <class Allocator>
-raw_storage<Allocator>::raw_storage(size_type n, const Allocator& a)
- : alloc_inst(a)
+inline raw_storage::raw_storage()
{
- start = end = alloc_inst.allocate(n);
- BOOST_REGEX_NOEH_ASSERT(start)
- alloc_inst.last = start + n;
+ last = start = end = 0;
}
-template <class Allocator>
-Allocator BOOST_REGEX_CALL raw_storage<Allocator>::allocator()const
+inline raw_storage::raw_storage(size_type n)
{
- return alloc_inst;
+ start = end = static_cast<pointer>(::operator new(n));
+ BOOST_REGEX_NOEH_ASSERT(start)
+ last = start + n;
}
-template <class Allocator>
-void BOOST_REGEX_CALL raw_storage<Allocator>::resize(size_type n)
-{
- register size_type newsize = (alloc_inst.last - start) * 2;
- register size_type datasize = end - start;
- if(newsize < n)
- newsize = n;
- // extend newsize to WORD/DWORD boundary:
- newsize = (newsize + padding_mask) & ~(padding_mask);
-
- // allocate and copy data:
- register unsigned char* ptr = alloc_inst.allocate(newsize);
- BOOST_REGEX_NOEH_ASSERT(ptr)
- std::memcpy(ptr, start, datasize);
-
- // get rid of old buffer:
- alloc_inst.deallocate(start, (alloc_inst.last - start));
-
- // and set up pointers:
- start = ptr;
- end = ptr + datasize;
- alloc_inst.last = ptr + newsize;
-}
-
-template <class Allocator>
-void* BOOST_REGEX_CALL raw_storage<Allocator>::insert(size_type pos, size_type n)
-{
- jm_assert(pos <= size_type(end - start));
- if(size_type(alloc_inst.last - end) < n)
- resize(n + (end - start));
- register void* result = start + pos;
- std::memmove(start + pos + n, start + pos, (end - start) - pos);
- end += n;
- return result;
-}
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
# include BOOST_ABI_PREFIX
#endif
-template <class OutputIterator, class Iterator, class traits, class Allocator, class charT>
+template <class OutputIterator, class BidirectionalIterator, class traits, class charT>
OutputIterator regex_replace(OutputIterator out,
- Iterator first,
- Iterator last,
- const reg_expression<charT, traits, Allocator>& e,
+ BidirectionalIterator first,
+ BidirectionalIterator last,
+ const basic_regex<charT, traits>& e,
const charT* fmt,
match_flag_type flags = match_default)
{
- Iterator l = first;
- re_detail::merge_out_predicate<OutputIterator, Iterator, charT, Allocator, traits> oi(out, l, fmt, flags, e.get_traits());
- regex_grep(oi, first, last, e, flags);
- return (flags & format_no_copy) ? out : std::copy(l, last, out);
+ regex_iterator<BidirectionalIterator, charT, traits> i(first, last, e, flags);
+ regex_iterator<BidirectionalIterator, charT, traits> j;
+ if(i == j)
+ {
+ if(!(flags & regex_constants::format_no_copy))
+ out = re_detail::copy(first, last, out);
+ }
+ else
+ {
+ BidirectionalIterator last_m = first;
+ while(i != j)
+ {
+ if(!(flags & regex_constants::format_no_copy))
+ out = re_detail::copy(i->prefix().first, i->prefix().second, out);
+ out = i->format(out, fmt, flags, e);
+ last_m = (*i)[0].second;
+ if(flags & regex_constants::format_first_only)
+ break;
+ ++i;
+ }
+ if(!(flags & regex_constants::format_no_copy))
+ out = re_detail::copy(last_m, last, out);
+ }
+ return out;
}
-template <class OutputIterator, class Iterator, class traits, class Allocator, class charT>
+template <class OutputIterator, class Iterator, class traits, class charT>
inline OutputIterator regex_replace(OutputIterator out,
Iterator first,
Iterator last,
- const reg_expression<charT, traits, Allocator>& e,
+ const basic_regex<charT, traits>& e,
const std::basic_string<charT>& fmt,
match_flag_type flags = match_default)
{
return regex_replace(out, first, last, e, fmt.c_str(), flags);
}
-template <class traits, class Allocator, class charT>
+template <class traits, class charT>
std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
- const reg_expression<charT, traits, Allocator>& e,
+ const basic_regex<charT, traits>& e,
const charT* fmt,
match_flag_type flags = match_default)
{
return result;
}
-template <class traits, class Allocator, class charT>
+template <class traits, class charT>
std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
- const reg_expression<charT, traits, Allocator>& e,
+ const basic_regex<charT, traits>& e,
const std::basic_string<charT>& fmt,
match_flag_type flags = match_default)
{
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
# include BOOST_ABI_PREFIX
#endif
-template <class BidiIterator, class Allocator, class charT, class traits, class Allocator2>
+template <class BidiIterator, class Allocator, class charT, class traits>
bool regex_search(BidiIterator first, BidiIterator last,
match_results<BidiIterator, Allocator>& m,
- const reg_expression<charT, traits, Allocator2>& e,
+ const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
+{
+ return regex_search(first, last, m, e, flags, first);
+}
+
+template <class BidiIterator, class Allocator, class charT, class traits>
+bool regex_search(BidiIterator first, BidiIterator last,
+ match_results<BidiIterator, Allocator>& m,
+ const basic_regex<charT, traits>& e,
+ match_flag_type flags,
+ BidiIterator base)
{
if(e.flags() & regex_constants::failbit)
return false;
- re_detail::perl_matcher<BidiIterator, Allocator, traits, Allocator2> matcher(first, last, m, e, flags);
+ re_detail::perl_matcher<BidiIterator, Allocator, traits> matcher(first, last, m, e, flags, base);
return matcher.find();
}
// this isn't really a partial specialisation, but template function
// overloading - if the compiler doesn't support partial specialisation
// then it really won't support this either:
-template <class charT, class Allocator, class traits, class Allocator2>
+template <class charT, class Allocator, class traits>
inline bool regex_search(const charT* str,
match_results<const charT*, Allocator>& m,
- const reg_expression<charT, traits, Allocator2>& e,
+ const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
return regex_search(str, str + traits::length(str), m, e, flags);
}
-template <class ST, class SA, class Allocator, class charT, class traits, class Allocator2>
+template <class ST, class SA, class Allocator, class charT, class traits>
inline bool regex_search(const std::basic_string<charT, ST, SA>& s,
match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
- const reg_expression<charT, traits, Allocator2>& e,
+ const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
return regex_search(s.begin(), s.end(), m, e, flags);
}
-#else // partial specialisation
+#else // partial overloads:
inline bool regex_search(const char* str,
cmatch& m,
const regex& e,
{
return regex_search(str, str + regex::traits_type::length(str), m, e, flags);
}
+inline bool regex_search(const char* first, const char* last,
+ const regex& e,
+ match_flag_type flags = match_default)
+{
+ cmatch m;
+ return regex_search(first, last, m, e, flags | regex_constants::match_any);
+}
+
#ifndef BOOST_NO_WREGEX
inline bool regex_search(const wchar_t* str,
wcmatch& m,
{
return regex_search(str, str + wregex::traits_type::length(str), m, e, flags);
}
+inline bool regex_search(const wchar_t* first, const wchar_t* last,
+ const wregex& e,
+ match_flag_type flags = match_default)
+{
+ wcmatch m;
+ return regex_search(first, last, m, e, flags | regex_constants::match_any);
+}
#endif
inline bool regex_search(const std::string& s,
smatch& m,
#endif
-template <class BidiIterator, class charT, class traits, class Allocator2>
+template <class BidiIterator, class charT, class traits>
bool regex_search(BidiIterator first, BidiIterator last,
- const reg_expression<charT, traits, Allocator2>& e,
+ const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
if(e.flags() & regex_constants::failbit)
match_results<BidiIterator> m;
typedef typename match_results<BidiIterator>::allocator_type match_alloc_type;
- re_detail::perl_matcher<BidiIterator, match_alloc_type, traits, Allocator2> matcher(first, last, m, e, flags);
+ re_detail::perl_matcher<BidiIterator, match_alloc_type, traits> matcher(first, last, m, e, flags | regex_constants::match_any, first);
return matcher.find();
}
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
-template <class charT, class traits, class Allocator2>
+template <class charT, class traits>
inline bool regex_search(const charT* str,
- const reg_expression<charT, traits, Allocator2>& e,
+ const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
return regex_search(str, str + traits::length(str), e, flags);
}
-template <class ST, class SA, class charT, class traits, class Allocator2>
+template <class ST, class SA, class charT, class traits>
inline bool regex_search(const std::basic_string<charT, ST, SA>& s,
- const reg_expression<charT, traits, Allocator2>& e,
+ const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
return regex_search(s.begin(), s.end(), e, flags);
}
#else // non-template function overloads
-inline bool regex_search(const char* first, const char* last,
- const regex& e,
- match_flag_type flags = match_default)
-{
- cmatch m;
- return regex_search(first, last, m, e, flags);
-}
-
-#ifndef BOOST_NO_WREGEX
-inline bool regex_search(const wchar_t* first, const wchar_t* last,
- const wregex& e,
- match_flag_type flags = match_default)
-{
- wcmatch m;
- return regex_search(first, last, m, e, flags);
-}
-#endif
inline bool regex_search(const char* str,
const regex& e,
match_flag_type flags = match_default)
{
cmatch m;
- return regex_search(str, str + regex::traits_type::length(str), m, e, flags);
+ return regex_search(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
}
#ifndef BOOST_NO_WREGEX
inline bool regex_search(const wchar_t* str,
match_flag_type flags = match_default)
{
wcmatch m;
- return regex_search(str, str + wregex::traits_type::length(str), m, e, flags);
+ return regex_search(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
}
#endif
inline bool regex_search(const std::string& s,
match_flag_type flags = match_default)
{
smatch m;
- return regex_search(s.begin(), s.end(), m, e, flags);
+ return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
}
#if !defined(BOOST_NO_WREGEX)
inline bool regex_search(const std::basic_string<wchar_t>& s,
match_flag_type flags = match_default)
{
wsmatch m;
- return regex_search(s.begin(), s.end(), m, e, flags);
+ return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
}
-#endif
-#endif
+#endif // BOOST_NO_WREGEX
+
+#endif // partial overload
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
namespace re_detail{
template <class charT>
-const reg_expression<charT>& get_default_expression(charT)
+const basic_regex<charT>& get_default_expression(charT)
{
static const charT expression_text[4] = { '\\', 's', '+', '\00', };
- static const reg_expression<charT> e(expression_text);
+ static const basic_regex<charT> e(expression_text);
return e;
}
-template <class OutputIterator, class charT, class Traits1, class Alloc1, class Alloc2>
+template <class OutputIterator, class charT, class Traits1, class Alloc1>
class split_pred
{
typedef std::basic_string<charT, Traits1, Alloc1> string_type;
split_pred(iterator_type* a, OutputIterator* b, std::size_t* c)
: p_last(a), p_out(b), p_max(c), initial_max(*c) {}
- bool operator()(const match_results<iterator_type, Alloc2>& what);
+ bool operator()(const match_results<iterator_type>& what);
};
-template <class OutputIterator, class charT, class Traits1, class Alloc1, class Alloc2>
-bool split_pred<OutputIterator, charT, Traits1, Alloc1, Alloc2>::operator()
- (const match_results<iterator_type, Alloc2>& what)
+template <class OutputIterator, class charT, class Traits1, class Alloc1>
+bool split_pred<OutputIterator, charT, Traits1, Alloc1>::operator()
+ (const match_results<iterator_type>& what)
{
*p_last = what[0].second;
if(what.size() > 1)
// output sub-expressions only:
for(unsigned i = 1; i < what.size(); ++i)
{
- *(*p_out) = static_cast<string_type>(what[i]);
+ *(*p_out) = what.str(i);
++(*p_out);
if(0 == --*p_max) return false;
}
const sub_match<iterator_type>& sub = what[-1];
if((sub.first != sub.second) || (*p_max != initial_max))
{
- *(*p_out) = static_cast<string_type>(sub);
+ *(*p_out) = sub.str();
++(*p_out);
return --*p_max;
}
} // namespace re_detail
-template <class OutputIterator, class charT, class Traits1, class Alloc1, class Traits2, class Alloc2>
+template <class OutputIterator, class charT, class Traits1, class Alloc1, class Traits2>
std::size_t regex_split(OutputIterator out,
std::basic_string<charT, Traits1, Alloc1>& s,
- const reg_expression<charT, Traits2, Alloc2>& e,
+ const basic_regex<charT, Traits2>& e,
match_flag_type flags,
std::size_t max_split)
{
- typedef typename std::basic_string<charT, Traits1, Alloc1>::const_iterator ci_t;
- typedef typename detail::rebind_allocator<sub_match<ci_t>, Alloc2>::type match_allocator;
+ typedef typename std::basic_string<charT, Traits1, Alloc1>::const_iterator ci_t;
+ typedef typename match_results<ci_t>::allocator_type match_allocator;
ci_t last = s.begin();
std::size_t init_size = max_split;
- re_detail::split_pred<OutputIterator, charT, Traits1, Alloc1, match_allocator> pred(&last, &out, &max_split);
+ re_detail::split_pred<OutputIterator, charT, Traits1, Alloc1> pred(&last, &out, &max_split);
ci_t i, j;
i = s.begin();
j = s.end();
return init_size - max_split;
}
-template <class OutputIterator, class charT, class Traits1, class Alloc1, class Traits2, class Alloc2>
+template <class OutputIterator, class charT, class Traits1, class Alloc1, class Traits2>
inline std::size_t regex_split(OutputIterator out,
std::basic_string<charT, Traits1, Alloc1>& s,
- const reg_expression<charT, Traits2, Alloc2>& e,
+ const basic_regex<charT, Traits2>& e,
match_flag_type flags = match_default)
{
return regex_split(out, s, e, flags, UINT_MAX);
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
{
// make sure that we have a valid item
// on TOS:
- jm_assert(m_stack->next);
+ BOOST_ASSERT(m_stack->next);
register node* p = m_stack;
m_stack = p->next;
p->next = unused;
+++ /dev/null
-/*
- *
- * Copyright (c) 1998-2002
- * Dr John Maddock
- *
- * Use, modification and distribution are subject to the
- * Boost Software License, Version 1.0. (See accompanying file
- * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- *
- */
-
- /*
- * LOCATION: see http://www.boost.org for most recent version.
- * FILE regex_synch.hpp
- * VERSION see <boost/version.hpp>
- * DESCRIPTION: Thread synchronisation for regex code.
- * Note this is an internal header file included
- * by regex.hpp, do not include on its own.
- */
-
-#ifndef BOOST_REGEX_SYNCH_HPP
-#define BOOST_REGEX_SYNCH_HPP
-
-#ifndef BOOST_REGEX_CONFIG_HPP
-#include <boost/regex/config.hpp>
-#endif
-
-#if defined(BOOST_HAS_THREADS)
-# if defined(BOOST_HAS_WINTHREADS)
-# include <windows.h>
-# elif defined(BOOST_HAS_BETHREADS)
-# include <OS.h>
-# include <cassert>
-# elif defined(BOOST_HAS_PTHREADS)
-# include <pthread.h>
-# else
-# error "Unknown threading API"
-# endif
-#endif
-
-
-namespace boost{
- namespace re_detail{
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_PREFIX
-#endif
-
-void BOOST_REGEX_CALL re_init_threads();
-void BOOST_REGEX_CALL re_free_threads();
-
-#ifdef BOOST_HAS_THREADS
-
-# ifdef BOOST_HAS_BETHREADS
-
-typedef sem_id CRITICAL_SECTION;
-
-inline void BOOST_REGEX_CALL InitializeCriticalSection(CRITICAL_SECTION* ps)
-{
- *ps = create_sem(1, "regex++");
- assert(*ps > 0);
-}
-
-inline void BOOST_REGEX_CALL DeleteCriticalSection(CRITICAL_SECTION* ps)
-{
- int t = delete_sem(*ps);
- assert(t == B_NO_ERROR);
-}
-
-inline void BOOST_REGEX_CALL EnterCriticalSection(CRITICAL_SECTION* ps)
-{
- status_t t = acquire_sem(*ps);
- assert(t == B_NO_ERROR);
-}
-
-inline void BOOST_REGEX_CALL LeaveCriticalSection(CRITICAL_SECTION* ps)
-{
- status_t t = release_sem(*ps);
- assert(t == B_NO_ERROR);
-}
-
-# elif defined(BOOST_HAS_PTHREADS)
-
-typedef pthread_mutex_t CRITICAL_SECTION;
-
-inline void BOOST_REGEX_CALL InitializeCriticalSection(CRITICAL_SECTION* ps)
-{
- pthread_mutex_init(ps, 0);
-}
-
-inline void BOOST_REGEX_CALL DeleteCriticalSection(CRITICAL_SECTION* ps)
-{
- pthread_mutex_destroy(ps);
-}
-
-inline void BOOST_REGEX_CALL EnterCriticalSection(CRITICAL_SECTION* ps)
-{
- pthread_mutex_lock(ps);
-}
-
-inline void BOOST_REGEX_CALL LeaveCriticalSection(CRITICAL_SECTION* ps)
-{
- pthread_mutex_unlock(ps);
-}
-
-# elif !defined(BOOST_HAS_WINTHREADS)
-# error "Unknown threading API"
-# endif
-
-template <class Lock>
-class lock_guard
-{
- typedef Lock lock_type;
-public:
- lock_guard(lock_type& m, bool aq = true)
- : mut(m), owned(false){ acquire(aq); }
-
- ~lock_guard()
- { acquire(false); }
-
- void BOOST_REGEX_CALL acquire(bool aq = true)
- {
- if(aq && !owned)
- {
- mut.acquire(true);
- owned = true;
- }
- else if(!aq && owned)
- {
- mut.acquire(false);
- owned = false;
- }
- }
-private:
- lock_type& mut;
- bool owned;
- // VC6 warning suppression:
- lock_guard& operator=(const lock_guard&);
-};
-
-
-class critical_section
-{
-public:
- critical_section()
- { InitializeCriticalSection(&hmutex);}
-
- critical_section(const critical_section&)
- { InitializeCriticalSection(&hmutex);}
-
- const critical_section& BOOST_REGEX_CALL operator=(const critical_section&)
- {return *this;}
-
- ~critical_section()
- {DeleteCriticalSection(&hmutex);}
-
-private:
-
- void BOOST_REGEX_CALL acquire(bool aq)
- { if(aq) EnterCriticalSection(&hmutex);
- else LeaveCriticalSection(&hmutex);
- }
-
- CRITICAL_SECTION hmutex;
-
-public:
- typedef lock_guard<critical_section> ro_guard;
- typedef lock_guard<critical_section> rw_guard;
-
- friend class lock_guard<critical_section>;
-};
-
-inline bool BOOST_REGEX_CALL operator==(const critical_section&, const critical_section&)
-{
- return false;
-}
-
-inline bool BOOST_REGEX_CALL operator<(const critical_section&, const critical_section&)
-{
- return true;
-}
-
-typedef lock_guard<critical_section> cs_guard;
-
-BOOST_REGEX_DECL extern critical_section* p_re_lock;
-BOOST_REGEX_DECL extern unsigned int re_lock_count;
-
-#define BOOST_REGEX_GUARD(inst) boost::re_detail::critical_section::rw_guard g(inst);
-
-#else // BOOST_HAS_THREADS
-
-#define BOOST_REGEX_GUARD(inst)
-
-#endif // BOOST_HAS_THREADS
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_SUFFIX
-#endif
-
-} // namespace re_detail
-} // namespace boost
-
-#endif // sentry
-
-
-
-
-
-
-
/*
*
* Copyright (c) 2003
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#include <boost/detail/workaround.hpp>
#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(__HP_aCC, BOOST_TESTED_AT(55500))
+ || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
//
// Borland C++ Builder 6, and Visual C++ 6,
// can't cope with the array template constructor
template <class BidirectionalIterator,
class charT,
- class traits,
- class Allocator>
+ class traits>
class regex_token_iterator_implementation
{
- typedef basic_regex<charT, traits, Allocator> regex_type;
+ typedef basic_regex<charT, traits> regex_type;
typedef sub_match<BidirectionalIterator> value_type;
match_results<BidirectionalIterator> what; // current match
+ BidirectionalIterator base; // start of search area
BidirectionalIterator end; // end of search area
- const regex_type* pre; // the expression
+ const regex_type re; // the expression
match_flag_type flags; // match flags
value_type result; // the current string result
int N; // the current sub-expression being enumerated
public:
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, int sub, match_flag_type f)
- : end(last), pre(p), flags(f){ subs.push_back(sub); }
+ : end(last), re(*p), flags(f){ subs.push_back(sub); }
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const std::vector<int>& v, match_flag_type f)
- : end(last), pre(p), flags(f), subs(v){}
+ : end(last), re(*p), flags(f), subs(v){}
+#if !BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
#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(__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), pre(p), flags(f)
+ : end(last), re(*p), flags(f)
{
// assert that T really is an array:
BOOST_STATIC_ASSERT(::boost::is_array<T>::value);
#else
template <std::size_t CN>
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const int (&submatches)[CN], match_flag_type f)
- : end(last), pre(p), flags(f)
+ : end(last), re(*p), flags(f)
{
for(std::size_t i = 0; i < CN; ++i)
{
}
}
#endif
-
+#endif
bool init(BidirectionalIterator first)
{
N = 0;
- if(regex_search(first, end, what, *pre, flags) == true)
+ base = first;
+ if(regex_search(first, end, what, re, flags, base) == true)
{
N = 0;
result = ((subs[N] == -1) ? what.prefix() : what[(int)subs[N]]);
bool compare(const regex_token_iterator_implementation& that)
{
if(this == &that) return true;
- return (pre == that.pre)
+ return (&re.get_data() == &that.re.get_data())
&& (end == that.end)
&& (flags == that.flags)
&& (N == that.N)
result =((subs[N] == -1) ? what.prefix() : what[subs[N]]);
return true;
}
- if(what.prefix().first != what[0].second)
- flags |= match_prev_avail;
+ //if(what.prefix().first != what[0].second)
+ // flags |= /*match_prev_avail |*/ regex_constants::match_not_bob;
BidirectionalIterator last_end(what[0].second);
- if(regex_search(last_end, end, what, *pre, ((what[0].first == what[0].second) ? flags | regex_constants::match_not_initial_null : flags)))
+ if(regex_search(last_end, end, what, re, ((what[0].first == what[0].second) ? flags | regex_constants::match_not_initial_null : flags), base))
{
N =0;
result =((subs[N] == -1) ? what.prefix() : what[subs[N]]);
}
return false;
}
+private:
+ regex_token_iterator_implementation& operator=(const regex_token_iterator_implementation&);
};
template <class BidirectionalIterator,
class charT = BOOST_DEDUCED_TYPENAME re_detail::regex_iterator_traits<BidirectionalIterator>::value_type,
- class traits = regex_traits<charT>,
- class Allocator = BOOST_DEFAULT_ALLOCATOR(charT) >
+ class traits = regex_traits<charT> >
class regex_token_iterator
#ifndef BOOST_NO_STD_ITERATOR
: public std::iterator<
#endif
{
private:
- typedef regex_token_iterator_implementation<BidirectionalIterator, charT, traits, Allocator> impl;
+ typedef regex_token_iterator_implementation<BidirectionalIterator, charT, traits> impl;
typedef shared_ptr<impl> pimpl;
public:
- typedef basic_regex<charT, traits, Allocator> regex_type;
+ typedef basic_regex<charT, traits> regex_type;
typedef sub_match<BidirectionalIterator> value_type;
typedef typename re_detail::regex_iterator_traits<BidirectionalIterator>::difference_type
difference_type;
if(!pdata->init(a))
pdata.reset();
}
+#if !BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
if(!pdata->init(a))
pdata.reset();
}
+#endif
#endif
regex_token_iterator(const regex_token_iterator& that)
: pdata(that.pdata) {}
typedef regex_token_iterator<std::wstring::const_iterator> wsregex_token_iterator;
#endif
+template <class charT, class traits>
+inline regex_token_iterator<const charT*, charT, traits> make_regex_token_iterator(const charT* p, const basic_regex<charT, traits>& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
+{
+ return regex_token_iterator<const charT*, charT, traits>(p, p+traits::length(p), e, submatch, m);
+}
+template <class charT, class traits, class ST, class SA>
+inline regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits> make_regex_token_iterator(const std::basic_string<charT, ST, SA>& p, const basic_regex<charT, traits>& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
+{
+ return regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits>(p.begin(), p.end(), e, submatch, m);
+}
+#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
+template <class charT, class traits, std::size_t N>
+inline regex_token_iterator<const charT*, charT, traits> make_regex_token_iterator(const charT* p, const basic_regex<charT, traits>& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
+{
+ return regex_token_iterator<const charT*, charT, traits>(p, p+traits::length(p), e, submatch, m);
+}
+template <class charT, class traits, class ST, class SA, std::size_t N>
+inline regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits> make_regex_token_iterator(const std::basic_string<charT, ST, SA>& p, const basic_regex<charT, traits>& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
+{
+ return regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits>(p.begin(), p.end(), e, submatch, m);
+}
+#endif
+template <class charT, class traits>
+inline regex_token_iterator<const charT*, charT, traits> make_regex_token_iterator(const charT* p, const basic_regex<charT, traits>& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
+{
+ return regex_token_iterator<const charT*, charT, traits>(p, p+traits::length(p), e, submatch, m);
+}
+template <class charT, class traits, class ST, class SA>
+inline regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits> make_regex_token_iterator(const std::basic_string<charT, ST, SA>& p, const basic_regex<charT, traits>& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
+{
+ return regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits>(p.begin(), p.end(), e, submatch, m);
+}
+
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
# pragma warning(pop)
#endif
/*
*
- * Copyright (c) 1998-2002
- * Dr John Maddock
+ * Copyright (c) 2003
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#ifndef BOOST_REGEX_TRAITS_HPP_INCLUDED
#define BOOST_REGEX_TRAITS_HPP_INCLUDED
-#ifndef BOOST_RE_CREGEX_HPP
-#include <boost/cregex.hpp>
+#ifndef BOOST_REGEX_CONFIG_HPP
+#include <boost/regex/config.hpp>
#endif
-#ifndef BOOST_REGEX_CSTRING_HPP
-#include <boost/regex/v4/regex_cstring.hpp>
+#ifndef BOOST_REGEX_WORKAROUND_HPP
+#include <boost/regex/v4/regex_workaround.hpp>
#endif
-
-namespace boost{
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_PREFIX
+#ifndef BOOST_REGEX_SYNTAX_TYPE_HPP
+#include <boost/regex/v4/syntax_type.hpp>
#endif
-
-template <class charT>
-class c_regex_traits;
-
-namespace re_detail{
-
-struct mss
-{
- unsigned int id;
- const char* what;
-};
-
-BOOST_REGEX_DECL bool BOOST_REGEX_CALL re_lookup_def_collate_name(std::string& buf, const char* name);
-BOOST_REGEX_DECL std::size_t BOOST_REGEX_CALL re_get_default_message(char* buf, std::size_t len, std::size_t id);
-extern BOOST_REGEX_DECL const char *re_default_error_messages[];
-
-#ifndef BOOST_NO_WREGEX
-extern BOOST_REGEX_DECL regex_wchar_type wide_lower_case_map[];
-extern BOOST_REGEX_DECL unsigned short wide_unicode_classes[];
-BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining(regex_wchar_type c);
+#ifndef BOOST_REGEX_ERROR_TYPE_HPP
+#include <boost/regex/v4/error_type.hpp>
#endif
-
-
-struct BOOST_REGEX_DECL regex_traits_base
-{
- enum char_syntax_type
- {
- syntax_char = 0,
- syntax_open_bracket = 1, // (
- syntax_close_bracket = 2, // )
- syntax_dollar = 3, // $
- syntax_caret = 4, // ^
- syntax_dot = 5, // .
- syntax_star = 6, // *
- syntax_plus = 7, // +
- syntax_question = 8, // ?
- syntax_open_set = 9, // [
- syntax_close_set = 10, // ]
- syntax_or = 11, // |
- syntax_slash = 12, //
- syntax_hash = 13, // #
- syntax_dash = 14, // -
- syntax_open_brace = 15, // {
- syntax_close_brace = 16, // }
- syntax_digit = 17, // 0-9
- syntax_b = 18, // for \b
- syntax_B = 19, // for \B
- syntax_left_word = 20, // for \<
- syntax_right_word = 21, // for \>
- syntax_w = 22, // for \w
- syntax_W = 23, // for \W
- syntax_start_buffer = 24, // for \`
- syntax_end_buffer = 25, // for \'
- syntax_newline = 26, // for newline alt
- syntax_comma = 27, // for {x,y}
-
- syntax_a = 28, // for \a
- syntax_f = 29, // for \f
- syntax_n = 30, // for \n
- syntax_r = 31, // for \r
- syntax_t = 32, // for \t
- syntax_v = 33, // for \v
- syntax_x = 34, // for \xdd
- syntax_c = 35, // for \cx
- syntax_colon = 36, // for [:...:]
- syntax_equal = 37, // for [=...=]
-
- // perl ops:
- syntax_e = 38, // for \e
- syntax_l = 39, // for \l
- syntax_L = 40, // for \L
- syntax_u = 41, // for \u
- syntax_U = 42, // for \U
- syntax_s = 43, // for \s
- syntax_S = 44, // for \S
- syntax_d = 45, // for \d
- syntax_D = 46, // for \D
- syntax_E = 47, // for \Q\E
- syntax_Q = 48, // for \Q\E
- syntax_X = 49, // for \X
- syntax_C = 50, // for \C
- syntax_Z = 51, // for \Z
- syntax_G = 52, // for \G
-
- // new extentions:
- syntax_not = 53, // for (?!...)
-
- syntax_max = 54
- };
-#ifdef __BORLANDC__
-private:
- char dummy_member;
+#ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
+#include <boost/regex/v4/regex_traits_defaults.hpp>
#endif
-};
-
-struct BOOST_REGEX_DECL c_traits_base : public regex_traits_base
-{
-public:
- enum{
- char_class_none = 0,
- char_class_alpha = 0x0001,
- char_class_cntrl = 0x0002,
- char_class_digit = 0x0004,
- char_class_lower = 0x0008,
- char_class_punct = 0x0010,
- char_class_space = 0x0020,
- char_class_upper = 0x0040,
- char_class_xdigit = 0x0080,
- char_class_blank = 0x0100,
- char_class_underscore = 0x4000,
- char_class_unicode = 0x8000,
-
- char_class_alnum = char_class_alpha | char_class_digit,
- char_class_graph = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore,
- char_class_print = char_class_alpha | char_class_digit | char_class_punct | char_class_underscore | char_class_blank,
- char_class_word = char_class_alpha | char_class_digit | char_class_underscore
- };
- static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
-protected:
-#if defined(__MWERKS__) && __MWERKS__ <= 0x6000
- friend class c_regex_traits<char>;
- friend class c_regex_traits<regex_wchar_type>;
-#endif
-
- static char regex_message_catalogue[BOOST_REGEX_MAX_PATH];
- enum syntax_map_size
- {
- map_size = UCHAR_MAX + 1
- };
-
- static unsigned char syntax_map[map_size];
- static unsigned short class_map[map_size];
- static char lower_case_map[map_size];
-
- static boost::uint_fast32_t BOOST_REGEX_CALL do_lookup_class(const char* p);
- static bool BOOST_REGEX_CALL do_lookup_collate(std::string& buf, const char* p);
- static void BOOST_REGEX_CALL do_update_ctype();
- static void BOOST_REGEX_CALL do_update_collate();
-public:
- static std::string BOOST_REGEX_CALL error_string(unsigned id);
- static char* BOOST_REGEX_CALL get_catalogue() { return regex_message_catalogue; }
-};
-
-} // namespace re_detail
-
-
-template<>
-class BOOST_REGEX_DECL c_regex_traits<char> : public re_detail::c_traits_base
-{
- typedef re_detail::c_traits_base base_type;
-public:
- typedef char char_type;
- typedef unsigned char uchar_type;
- typedef unsigned int size_type;
- typedef std::string string_type;
- typedef int locale_type;
-
- static std::size_t BOOST_REGEX_CALL length(const char_type* p)
- {
- return std::strlen(p);
- }
- static unsigned int BOOST_REGEX_CALL syntax_type(size_type c)
- {
- return syntax_map[c];
- }
- static char BOOST_REGEX_CALL translate(char c, bool icase)
- {
- return icase ? lower_case_map[(size_type)(uchar_type)c] : c;
- }
- static void BOOST_REGEX_CALL transform(std::string& out, const std::string& in);
-
- static void BOOST_REGEX_CALL transform_primary(std::string& out, const std::string& in);
-
- static bool BOOST_REGEX_CALL is_separator(char c)
- {
- return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r'));
- }
-
- static bool BOOST_REGEX_CALL is_combining(char)
- {
- return false;
- }
-
- static bool BOOST_REGEX_CALL is_class(char c, boost::uint_fast32_t f)
- {
- return BOOST_REGEX_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f);
- }
-
- static int BOOST_REGEX_CALL toi(char c);
- static int BOOST_REGEX_CALL toi(const char*& first, const char* last, int radix);
-
- static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const char* first, const char* last)
- {
- std::string s(first, last);
- return do_lookup_class(s.c_str());
- }
-
- static bool BOOST_REGEX_CALL lookup_collatename(std::string& buf, const char* first, const char* last)
- {
- std::string s(first, last);
- return do_lookup_collate(buf, s.c_str());
- }
-
- static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
- locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
- void swap(c_regex_traits&){}
-
- c_regex_traits()
- {
- init();
- }
- ~c_regex_traits()
- {
- m_free();
- }
- struct sentry
- {
- sentry(const c_regex_traits<char>&)
- { c_regex_traits<char>::update(); }
- operator void*() { return this; }
- };
- static void BOOST_REGEX_CALL update();
-private:
- static void BOOST_REGEX_CALL init();
- static void BOOST_REGEX_CALL m_free();
- static c_regex_traits<char> i;
-
- static unsigned sort_type;
- static char sort_delim;
-};
-
-#ifndef BOOST_NO_WREGEX
-template<>
-class BOOST_REGEX_DECL c_regex_traits<regex_wchar_type> : public re_detail::c_traits_base
-{
- typedef re_detail::c_traits_base base_type;
-public:
- typedef regex_wchar_type char_type;
- typedef unsigned short uchar_type;
- typedef unsigned int size_type;
- typedef std::basic_string<regex_wchar_type> string_type;
- typedef int locale_type;
-#ifndef BOOST_REGEX_HAS_SHORT_WCHAR_T
- static std::size_t BOOST_REGEX_CALL length(const char_type* p)
- {
- return std::wcslen(p);
- }
-#else
- static std::size_t BOOST_REGEX_CALL length(const char_type* p)
- {
- return std::wcslen(reinterpret_cast<const wchar_t*>(p));
- }
+#ifndef BOOST_NO_STD_LOCALE
+# ifndef BOOST_CPP_REGEX_TRAITS_HPP_INCLUDED
+# include <boost/regex/v4/cpp_regex_traits.hpp>
+# endif
+#endif
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
+# ifndef BOOST_C_REGEX_TRAITS_HPP_INCLUDED
+# include <boost/regex/v4/c_regex_traits.hpp>
+# endif
+#endif
+#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
+# ifndef BOOST_W32_REGEX_TRAITS_HPP_INCLUDED
+# include <boost/regex/v4/w32_regex_traits.hpp>
+# endif
+#endif
+#ifndef BOOST_REGEX_FWD_HPP_INCLUDED
+#include <boost/regex_fwd.hpp>
#endif
- static unsigned int BOOST_REGEX_CALL syntax_type(size_type c);
- static regex_wchar_type BOOST_REGEX_CALL translate(regex_wchar_type c, bool icase)
- {
- return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : std::towlower(c)) : c;
- }
-
- static void BOOST_REGEX_CALL transform(std::basic_string<regex_wchar_type>& out, const std::basic_string<regex_wchar_type>& in);
-
- static void BOOST_REGEX_CALL transform_primary(std::basic_string<regex_wchar_type>& out, const std::basic_string<regex_wchar_type>& in);
-
- static bool BOOST_REGEX_CALL is_separator(regex_wchar_type c)
- {
- return BOOST_REGEX_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (regex_wchar_type)0x2028) || (c == (regex_wchar_type)0x2029));
- }
-
- static bool BOOST_REGEX_CALL is_combining(regex_wchar_type c)
- { return re_detail::is_combining(c); }
-
- static bool BOOST_REGEX_CALL is_class(regex_wchar_type c, boost::uint_fast32_t f)
- {
- return BOOST_REGEX_MAKE_BOOL(((uchar_type)c < 256) ? (re_detail::wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f));
- }
-
- static int BOOST_REGEX_CALL toi(regex_wchar_type c);
- static int BOOST_REGEX_CALL toi(const regex_wchar_type*& first, const regex_wchar_type* last, int radix);
- static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const regex_wchar_type* first, const regex_wchar_type* last);
+#include "boost/mpl/has_xxx.hpp"
+#include <boost/static_assert.hpp>
- static bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<regex_wchar_type>& s, const regex_wchar_type* first, const regex_wchar_type* last);
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
- static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
- locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
- void swap(c_regex_traits&){}
- c_regex_traits<regex_wchar_type>()
- { init(); }
- ~c_regex_traits<regex_wchar_type>()
- { m_free(); }
- struct sentry
- {
- sentry(const c_regex_traits<regex_wchar_type>&)
- { c_regex_traits<regex_wchar_type>::update(); }
- operator void*() { return this; }
- };
- static void BOOST_REGEX_CALL update();
- static std::size_t BOOST_REGEX_CALL strnarrow(char *s1, std::size_t len, const regex_wchar_type *s2);
- static std::size_t BOOST_REGEX_CALL strwiden(regex_wchar_type *s1, std::size_t len, const char *s2);
-private:
- static bool BOOST_REGEX_CALL do_iswclass(regex_wchar_type c, boost::uint_fast32_t f);
- static void BOOST_REGEX_CALL m_free();
- static void BOOST_REGEX_CALL init();
- static bool BOOST_REGEX_CALL do_lookup_collate(std::basic_string<regex_wchar_type>& out, const regex_wchar_type* first, const regex_wchar_type* last);
- static c_regex_traits<regex_wchar_type> init_;
+namespace boost{
- static unsigned sort_type;
- static regex_wchar_type sort_delim;
+template <class charT, class implementationT >
+struct regex_traits : public implementationT
+{
+ regex_traits() : implementationT() {}
};
-#ifdef BOOST_REGEX_HAS_SHORT_WCHAR_T
//
-// What follows here is Visual Studio specific - it is a thin wrapper
-// that redirects calls to c_regex_traits<unsigned short> to
-// c_regex_traits<__wchar_t>. This allows the library to be built
-// so that it supports programs built both with and without /Zc:wchar_t.
+// class regex_traits_wrapper.
+// this is what our implementation will actually store;
+// it provides default implementations of the "optional"
+// interfaces that we support, in addition to the
+// required "standard" ones:
//
-template<>
-class c_regex_traits<unsigned short> : public re_detail::c_traits_base
-{
- typedef re_detail::c_traits_base base_type;
-public:
- typedef unsigned short char_type;
- typedef unsigned short uchar_type;
- typedef unsigned int size_type;
- typedef std::basic_string<unsigned short> string_type;
- typedef int locale_type;
- static std::size_t BOOST_REGEX_CALL length(const char_type* p)
- {
- return c_regex_traits<regex_wchar_type>::length(
- reinterpret_cast<const regex_wchar_type*>(p));
- }
- static unsigned int BOOST_REGEX_CALL syntax_type(size_type c)
- {
- return c_regex_traits<regex_wchar_type>::syntax_type(c);
- }
- static unsigned short BOOST_REGEX_CALL translate(unsigned short c, bool icase)
- {
- return c_regex_traits<regex_wchar_type>::translate(c, icase);
- }
-
- static void BOOST_REGEX_CALL transform(std::basic_string<unsigned short>& out, const std::basic_string<unsigned short>& in)
- {
- c_regex_traits<regex_wchar_type>::transform(
- reinterpret_cast<std::basic_string<regex_wchar_type>&>(out),
- reinterpret_cast<const std::basic_string<regex_wchar_type>&>(in));
- }
-
- static void BOOST_REGEX_CALL transform_primary(std::basic_string<unsigned short>& out, const std::basic_string<unsigned short>& in)
- {
- c_regex_traits<regex_wchar_type>::transform_primary(
- reinterpret_cast<std::basic_string<regex_wchar_type>&>(out),
- reinterpret_cast<const std::basic_string<regex_wchar_type>&>(in)); }
-
- static bool BOOST_REGEX_CALL is_separator(unsigned short c)
- {
- return c_regex_traits<regex_wchar_type>::is_separator(c);
- }
-
- static bool BOOST_REGEX_CALL is_combining(unsigned short c)
- {
- return c_regex_traits<regex_wchar_type>::is_combining(c);
- }
-
- static bool BOOST_REGEX_CALL is_class(unsigned short c, boost::uint_fast32_t f)
- {
- return c_regex_traits<regex_wchar_type>::is_class(c, f);
- }
-
- static int BOOST_REGEX_CALL toi(unsigned short c)
- {
- return c_regex_traits<regex_wchar_type>::toi(c);
- }
- static int BOOST_REGEX_CALL toi(const unsigned short*& first, const unsigned short* last, int radix)
- {
- return c_regex_traits<regex_wchar_type>::toi(
- reinterpret_cast<const regex_wchar_type*&>(first),
- reinterpret_cast<const regex_wchar_type*>(last),
- radix);
- }
-
- static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const unsigned short* first, const unsigned short* last)
- {
- return c_regex_traits<regex_wchar_type>::lookup_classname(
- reinterpret_cast<const regex_wchar_type*>(first),
- reinterpret_cast<const regex_wchar_type*>(last));
- }
-
- static bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<unsigned short>& s, const unsigned short* first, const unsigned short* last)
- {
- return c_regex_traits<regex_wchar_type>::lookup_collatename(
- reinterpret_cast<std::basic_string<regex_wchar_type>&>(s),
- reinterpret_cast<const regex_wchar_type*>(first),
- reinterpret_cast<const regex_wchar_type*>(last));
- }
-
- static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
- locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
-
- struct sentry
- {
- sentry(const c_regex_traits<unsigned short>&)
- { c_regex_traits<unsigned short>::update(); }
- ~sentry(){}
- operator void*() { return this; }
- };
- static void BOOST_REGEX_CALL update()
- {
- c_regex_traits<regex_wchar_type>::update();
- }
- void swap(c_regex_traits&){}
- c_regex_traits(){};
- ~c_regex_traits(){};
- static std::size_t BOOST_REGEX_CALL strnarrow(char *s1, std::size_t len, const unsigned short *s2)
- {
- return c_regex_traits<regex_wchar_type>::strnarrow(
- s1,
- len,
- reinterpret_cast<const regex_wchar_type *>(s2));
- }
- static std::size_t BOOST_REGEX_CALL strwiden(unsigned short *s1, std::size_t len, const char *s2)
- {
- return c_regex_traits<regex_wchar_type>::strwiden(
- reinterpret_cast<regex_wchar_type *>(s1), len, s2);
- }
-
-private:
- c_regex_traits<regex_wchar_type> m_init;
-
-};
-
-#endif // BOOST_REGEX_HAS_SHORT_WCHAR_T
-
-#endif // wide characters
-
-#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
-
namespace re_detail{
-
-struct BOOST_REGEX_DECL w32_traits_base : public regex_traits_base
+#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>
+struct has_boost_extensions_tag
{
- enum{
- char_class_none = 0,
- char_class_alnum = C1_ALPHA | C1_DIGIT,
- char_class_alpha = C1_ALPHA,
- char_class_cntrl = C1_CNTRL,
- char_class_digit = C1_DIGIT,
- char_class_graph = C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_ALPHA,
- char_class_lower = C1_LOWER,
- char_class_print = C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_BLANK | C1_ALPHA,
- char_class_punct = C1_PUNCT,
- char_class_space = C1_SPACE,
- char_class_upper = C1_UPPER,
- char_class_xdigit = C1_XDIGIT,
- char_class_blank = C1_BLANK,
- char_class_underscore = 0x4000,
- char_class_word = C1_ALPHA | C1_DIGIT | char_class_underscore,
- char_class_unicode = 0x8000,
- char_class_win = 0x01FF
- };
-
-
-public:
- static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
-protected:
- static char regex_message_catalogue[BOOST_REGEX_MAX_PATH];
- enum syntax_map_size
- {
- map_size = UCHAR_MAX + 1
- };
-
- static unsigned char syntax_map[map_size];
- static unsigned short class_map[map_size];
- static char lower_case_map[map_size];
-
- static boost::uint_fast32_t BOOST_REGEX_CALL do_lookup_class(const char* p);
- static bool BOOST_REGEX_CALL do_lookup_collate(std::string& buf, const char* p);
- static void BOOST_REGEX_CALL do_free();
- static void BOOST_REGEX_CALL do_init();
-public:
- static std::string BOOST_REGEX_CALL error_string(unsigned id);
- static char* BOOST_REGEX_CALL get_catalogue() { return regex_message_catalogue; }
+ BOOST_STATIC_CONSTANT(bool, value = false);
};
+#endif
-
-} // namespace re_detail
-
-template<class charT>
-class w32_regex_traits;
-
-template<>
-class BOOST_REGEX_DECL w32_regex_traits<char> : public re_detail::w32_traits_base
+template <class BaseT>
+struct default_wrapper : public BaseT
{
- typedef re_detail::w32_traits_base base_type;
-public:
- typedef char char_type;
- typedef unsigned char uchar_type;
- typedef unsigned int size_type;
- typedef std::string string_type;
- typedef int locale_type;
-
- static std::size_t BOOST_REGEX_CALL length(const char_type* p)
+ typedef typename BaseT::char_type char_type;
+ std::string error_string(::boost::regex_constants::error_type e)const
{
- return std::strlen(p);
+ return ::boost::re_detail::get_default_error_string(e);
}
- static unsigned int BOOST_REGEX_CALL syntax_type(size_type c)
+ ::boost::regex_constants::syntax_type syntax_type(char_type c)const
{
- return syntax_map[c];
+ return ((c & 0x7f) == c) ? get_default_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::syntax_char;
}
- static char BOOST_REGEX_CALL translate(char c, bool icase)
+ ::boost::regex_constants::escape_syntax_type escape_syntax_type(char_type c)const
{
- return icase ? lower_case_map[(size_type)(uchar_type)c] : c;
+ return ((c & 0x7f) == c) ? get_default_escape_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::escape_type_identity;
}
- static void BOOST_REGEX_CALL transform(std::string& out, const std::string& in);
-
- static void BOOST_REGEX_CALL transform_primary(std::string& out, const std::string& in);
-
- static bool BOOST_REGEX_CALL is_separator(char c)
+ int toi(const char_type*& p1, const char_type* p2, int radix)const
{
- return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r'));
+ return ::boost::re_detail::global_toi(p1, p2, radix, *this);
}
-
- static bool BOOST_REGEX_CALL is_combining(char)
+ char_type translate(char_type c, bool icase)const
{
- return false;
+ return (icase ? this->translate_nocase(c) : this->translate(c));
}
-
- static bool BOOST_REGEX_CALL is_class(char c, boost::uint_fast32_t f)
+ char_type translate(char_type c)const
{
- return BOOST_REGEX_MAKE_BOOL(class_map[(size_type)(uchar_type)c] & f);
+ return BaseT::translate(c);
}
-
- static int BOOST_REGEX_CALL toi(char c);
- static int BOOST_REGEX_CALL toi(const char*& first, const char* last, int radix);
-
- static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const char* first, const char* last)
+ char_type tolower(char_type c)const
{
- std::string s(first, last);
- return do_lookup_class(s.c_str());
+ return ::boost::re_detail::global_lower(c);
}
-
- static bool BOOST_REGEX_CALL lookup_collatename(std::string& buf, const char* first, const char* last)
+ char_type toupper(char_type c)const
{
- std::string s(first, last);
- return do_lookup_collate(buf, s.c_str());
+ return ::boost::re_detail::global_upper(c);
}
-
- static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
- locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
-
- struct sentry
- {
- sentry(const w32_regex_traits<char>&)
- { w32_regex_traits<char>::update(); }
- ~sentry(){}
- operator void*() { return this; }
- };
- static void BOOST_REGEX_CALL update();
- void swap(w32_regex_traits&){}
- w32_regex_traits();
- ~w32_regex_traits();
-private:
- static w32_regex_traits<char> i;
};
-#ifndef BOOST_NO_WREGEX
-template<>
-class BOOST_REGEX_DECL w32_regex_traits<regex_wchar_type> : public re_detail::w32_traits_base
+template <class BaseT, bool has_extensions>
+struct compute_wrapper_base
{
- typedef re_detail::w32_traits_base base_type;
-public:
- typedef regex_wchar_type char_type;
- typedef unsigned short uchar_type;
- typedef unsigned int size_type;
- typedef std::basic_string<regex_wchar_type> string_type;
- typedef int locale_type;
-#ifndef BOOST_REGEX_HAS_SHORT_WCHAR_T
- static std::size_t BOOST_REGEX_CALL length(const char_type* p)
- {
- return std::wcslen(p);
- }
-#else
- static std::size_t BOOST_REGEX_CALL length(const char_type* p)
- {
- return std::wcslen(reinterpret_cast<const wchar_t*>(p));
- }
-#endif
- static unsigned int BOOST_REGEX_CALL syntax_type(size_type c);
- static regex_wchar_type BOOST_REGEX_CALL translate(regex_wchar_type c, bool icase)
- {
- return icase ? ((c < 256) ? re_detail::wide_lower_case_map[(uchar_type)c] : wtolower(c)) : c;
- }
-
- static void BOOST_REGEX_CALL transform(std::basic_string<regex_wchar_type>& out, const std::basic_string<regex_wchar_type>& in);
-
- static void BOOST_REGEX_CALL transform_primary(std::basic_string<regex_wchar_type>& out, const std::basic_string<regex_wchar_type>& in);
-
- static bool BOOST_REGEX_CALL is_separator(regex_wchar_type c)
- {
- return BOOST_REGEX_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (regex_wchar_type)0x2028) || (c == (regex_wchar_type)0x2029));
- }
-
- static bool BOOST_REGEX_CALL is_combining(regex_wchar_type c)
- { return re_detail::is_combining(c); }
-
- static bool BOOST_REGEX_CALL is_class(regex_wchar_type c, boost::uint_fast32_t f)
- {
- return BOOST_REGEX_MAKE_BOOL(((uchar_type)c < 256) ? (wide_unicode_classes[(size_type)(uchar_type)c] & f) : do_iswclass(c, f));
- }
-
- static int BOOST_REGEX_CALL toi(regex_wchar_type c);
- static int BOOST_REGEX_CALL toi(const regex_wchar_type*& first, const regex_wchar_type* last, int radix);
-
- static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const regex_wchar_type* first, const regex_wchar_type* last);
-
- static bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<regex_wchar_type>& s, const regex_wchar_type* first, const regex_wchar_type* last);
-
- static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
- locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
-
- struct sentry
- {
- sentry(const w32_regex_traits<regex_wchar_type>&)
- { w32_regex_traits<regex_wchar_type>::update(); }
- ~sentry(){}
- operator void*() { return this; }
- };
- static void BOOST_REGEX_CALL update();
- void swap(w32_regex_traits&){}
- w32_regex_traits();
- ~w32_regex_traits();
- static std::size_t BOOST_REGEX_CALL strnarrow(char *s1, std::size_t len, const regex_wchar_type *s2);
- static std::size_t BOOST_REGEX_CALL strwiden(regex_wchar_type *s1, std::size_t len, const char *s2);
-
-private:
- static bool BOOST_REGEX_CALL do_iswclass(regex_wchar_type c, boost::uint_fast32_t f);
- static bool BOOST_REGEX_CALL do_lookup_collate(std::basic_string<regex_wchar_type>& out, const regex_wchar_type* first, const regex_wchar_type* last);
- static w32_regex_traits<regex_wchar_type> init_;
- static regex_wchar_type BOOST_REGEX_CALL wtolower(regex_wchar_type c);
- static unsigned short wide_unicode_classes[];
+ typedef BaseT type;
};
-
-#ifdef BOOST_REGEX_HAS_SHORT_WCHAR_T
-//
-// What follows here is Visual Studio specific - it is a thin wrapper
-// that redirects calls to w32_regex_traits<unsigned short> to
-// w32_regex_traits<__wchar_t>. This allows the library to be built
-// so that it supports programs built both with and without /Zc:wchar_t.
-//
-template<>
-class w32_regex_traits<unsigned short> : public re_detail::w32_traits_base
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))
+template <class BaseT>
+struct compute_wrapper_base<BaseT, false>
{
- typedef re_detail::w32_traits_base base_type;
-public:
- typedef unsigned short char_type;
- typedef unsigned short uchar_type;
- typedef unsigned int size_type;
- typedef std::basic_string<unsigned short> string_type;
- typedef int locale_type;
- static std::size_t BOOST_REGEX_CALL length(const char_type* p)
- {
- return w32_regex_traits<regex_wchar_type>::length(
- reinterpret_cast<const regex_wchar_type*>(p));
- }
- static unsigned int BOOST_REGEX_CALL syntax_type(size_type c)
- {
- return w32_regex_traits<regex_wchar_type>::syntax_type(c);
- }
- static unsigned short BOOST_REGEX_CALL translate(unsigned short c, bool icase)
- {
- return w32_regex_traits<regex_wchar_type>::translate(c, icase);
- }
-
- static void BOOST_REGEX_CALL transform(std::basic_string<unsigned short>& out, const std::basic_string<unsigned short>& in)
- {
- w32_regex_traits<regex_wchar_type>::transform(
- reinterpret_cast<std::basic_string<regex_wchar_type>&>(out),
- reinterpret_cast<const std::basic_string<regex_wchar_type>&>(in));
- }
-
- static void BOOST_REGEX_CALL transform_primary(std::basic_string<unsigned short>& out, const std::basic_string<unsigned short>& in)
- {
- w32_regex_traits<regex_wchar_type>::transform_primary(
- reinterpret_cast<std::basic_string<regex_wchar_type>&>(out),
- reinterpret_cast<const std::basic_string<regex_wchar_type>&>(in)); }
-
- static bool BOOST_REGEX_CALL is_separator(unsigned short c)
- {
- return w32_regex_traits<regex_wchar_type>::is_separator(c);
- }
-
- static bool BOOST_REGEX_CALL is_combining(unsigned short c)
- {
- return w32_regex_traits<regex_wchar_type>::is_combining(c);
- }
-
- static bool BOOST_REGEX_CALL is_class(unsigned short c, boost::uint_fast32_t f)
- {
- return w32_regex_traits<regex_wchar_type>::is_class(c, f);
- }
-
- static int BOOST_REGEX_CALL toi(unsigned short c)
- {
- return w32_regex_traits<regex_wchar_type>::toi(c);
- }
- static int BOOST_REGEX_CALL toi(const unsigned short*& first, const unsigned short* last, int radix)
- {
- return w32_regex_traits<regex_wchar_type>::toi(
- reinterpret_cast<const regex_wchar_type*&>(first),
- reinterpret_cast<const regex_wchar_type*>(last),
- radix);
- }
-
- static boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const unsigned short* first, const unsigned short* last)
- {
- return w32_regex_traits<regex_wchar_type>::lookup_classname(
- reinterpret_cast<const regex_wchar_type*>(first),
- reinterpret_cast<const regex_wchar_type*>(last));
- }
-
- static bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<unsigned short>& s, const unsigned short* first, const unsigned short* last)
- {
- return w32_regex_traits<regex_wchar_type>::lookup_collatename(
- reinterpret_cast<std::basic_string<regex_wchar_type>&>(s),
- reinterpret_cast<const regex_wchar_type*>(first),
- reinterpret_cast<const regex_wchar_type*>(last));
- }
-
- static locale_type BOOST_REGEX_CALL imbue(locale_type l){ return l; }
- locale_type BOOST_REGEX_CALL getloc()const{ return locale_type(); }
-
- struct sentry
- {
- sentry(const w32_regex_traits<unsigned short>&)
- { w32_regex_traits<unsigned short>::update(); }
- ~sentry(){}
- operator void*() { return this; }
- };
- static void BOOST_REGEX_CALL update()
- {
- w32_regex_traits<regex_wchar_type>::update();
- }
- void swap(w32_regex_traits&){}
- w32_regex_traits(){};
- ~w32_regex_traits(){};
- static std::size_t BOOST_REGEX_CALL strnarrow(char *s1, std::size_t len, const unsigned short *s2)
- {
- return w32_regex_traits<regex_wchar_type>::strnarrow(
- s1,
- len,
- reinterpret_cast<const regex_wchar_type *>(s2));
- }
- static std::size_t BOOST_REGEX_CALL strwiden(unsigned short *s1, std::size_t len, const char *s2)
- {
- return w32_regex_traits<regex_wchar_type>::strwiden(
- reinterpret_cast<regex_wchar_type *>(s1), len, s2);
- }
-
-private:
- w32_regex_traits<regex_wchar_type> m_init;
-
+ typedef default_wrapper<BaseT> type;
};
-
-#endif // BOOST_REGEX_HAS_SHORT_WCHAR_T
-
-#endif // Wide strings
-#endif // Win32
-
-#if !defined(BOOST_NO_STD_LOCALE)
-
-namespace re_detail
-{
-
-template <class charT>
-struct message_data;
-
-template <>
-struct message_data<char>;
-
+#else
template <>
-struct message_data<regex_wchar_type>;
-
-struct BOOST_REGEX_DECL cpp_regex_traits_base : public regex_traits_base
+struct compute_wrapper_base<c_regex_traits<char>, false>
{
- enum char_class_type
- {
- char_class_none = 0,
- char_class_alnum = std::ctype_base::alnum,
- char_class_alpha = std::ctype_base::alpha,
- char_class_cntrl = std::ctype_base::cntrl,
- char_class_digit = std::ctype_base::digit,
- char_class_graph = std::ctype_base::graph,
- char_class_lower = std::ctype_base::lower,
- char_class_print = std::ctype_base::print,
- char_class_punct = std::ctype_base::punct,
- char_class_space = std::ctype_base::space,
- char_class_upper = std::ctype_base::upper,
- char_class_xdigit = std::ctype_base::xdigit,
- char_class_blank = 1<<12,
- char_class_underscore = 1<<13,
- char_class_word = std::ctype_base::alnum | char_class_underscore,
- char_class_unicode = 1<<14,
- char_class_all_base = char_class_alnum | char_class_alpha | char_class_cntrl
- | char_class_digit | char_class_graph | char_class_lower
- | char_class_print | char_class_punct | char_class_space
- | char_class_upper | char_class_xdigit
- };
-
- static std::string BOOST_REGEX_CALL set_message_catalogue(const std::string& s);
-protected:
- static char regex_message_cat[BOOST_REGEX_MAX_PATH];
+ typedef default_wrapper<c_regex_traits<char> > type;
};
-
-} // namespace re_detail
-
-template <class charT>
-class cpp_regex_traits;
-
-template<>
-class BOOST_REGEX_DECL cpp_regex_traits<char> : public re_detail::cpp_regex_traits_base
+#ifndef BOOST_NO_WREGEX
+template <>
+struct compute_wrapper_base<c_regex_traits<wchar_t>, false>
{
- typedef re_detail::cpp_regex_traits_base base_type;
-private:
- re_detail::message_data<char>* pmd;
- const unsigned char* psyntax;
- char* lower_map;
- const std::ctype<char>* pctype;
- const std::collate<char>* pcollate;
- std::locale locale_inst;
- unsigned sort_type;
- char sort_delim;
-
- cpp_regex_traits(const cpp_regex_traits&);
- cpp_regex_traits& operator=(const cpp_regex_traits&);
-
-public:
- typedef char char_type;
- typedef unsigned char uchar_type;
- typedef unsigned int size_type;
- typedef std::string string_type;
- typedef std::locale locale_type;
-
- cpp_regex_traits();
- ~cpp_regex_traits();
-
- static std::size_t BOOST_REGEX_CALL length(const char_type* p)
- {
- return std::strlen(p);
- }
- unsigned int BOOST_REGEX_CALL syntax_type(size_type c)const
- {
- return psyntax[c];
- }
- char BOOST_REGEX_CALL translate(char c, bool icase)const
- {
- return icase ? lower_map[(size_type)(uchar_type)c] : c;
- }
- void BOOST_REGEX_CALL transform(std::string& out, const std::string& in)const
- {
- out = pcollate->transform(in.c_str(), in.c_str() + in.size()).c_str();
- }
-
- void BOOST_REGEX_CALL transform_primary(std::string& out, const std::string& in)const;
-
- static bool BOOST_REGEX_CALL is_separator(char c)
- {
- return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r'));
- }
-
- static bool BOOST_REGEX_CALL is_combining(char)
- {
- return false;
- }
-
- bool BOOST_REGEX_CALL is_class(char c, boost::uint_fast32_t f)const
- {
- if(pctype->is((std::ctype<char>::mask)(f & char_class_all_base), c))
- return true;
- if((f & char_class_underscore) && (c == '_'))
- return true;
- if((f & char_class_blank) && ((c == ' ') || (c == '\t')))
- return true;
- return false;
- }
-
- int BOOST_REGEX_CALL toi(char c)const;
- int BOOST_REGEX_CALL toi(const char*& first, const char* last, int radix)const;
-
- boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const char* first, const char* last)const;
- bool BOOST_REGEX_CALL lookup_collatename(std::string& s, const char* first, const char* last)const;
-
- std::string BOOST_REGEX_CALL error_string(unsigned id)const;
- locale_type BOOST_REGEX_CALL imbue(locale_type l);
- locale_type BOOST_REGEX_CALL getloc()const{ return locale_inst; }
- void swap(cpp_regex_traits&);
-
- struct sentry
- {
- sentry(const cpp_regex_traits<char>&){}
- operator void*() { return this; }
- };
+ typedef default_wrapper<c_regex_traits<wchar_t> > type;
};
-
-#if !defined(BOOST_NO_WREGEX) && !defined(BOOST_NO_STD_WSTREAMBUF)
-template<>
-class BOOST_REGEX_DECL cpp_regex_traits<regex_wchar_type> : public re_detail::cpp_regex_traits_base
-{
- typedef re_detail::cpp_regex_traits_base base_type;
-public:
- typedef regex_wchar_type char_type;
- typedef unsigned short uchar_type;
- typedef unsigned int size_type;
- typedef std::basic_string<regex_wchar_type> string_type;
- typedef std::locale locale_type;
-
-private:
- re_detail::message_data<regex_wchar_type>* pmd;
- const unsigned char* psyntax;
- regex_wchar_type* lower_map;
- const std::ctype<regex_wchar_type>* pctype;
- const std::collate<regex_wchar_type>* pcollate;
- const std::codecvt<regex_wchar_type, char, std::mbstate_t>* pcdv;
- std::locale locale_inst;
- unsigned int BOOST_REGEX_CALL do_syntax_type(size_type c)const;
- unsigned sort_type;
- regex_wchar_type sort_delim;
-
- cpp_regex_traits(const cpp_regex_traits&);
- cpp_regex_traits& operator=(const cpp_regex_traits&);
-
-public:
-#ifndef BOOST_REGEX_HAS_SHORT_WCHAR_T
- static std::size_t BOOST_REGEX_CALL length(const char_type* p)
- {
- return std::wcslen(p);
- }
-#else
- static std::size_t BOOST_REGEX_CALL length(const char_type* p)
- {
- return std::wcslen(reinterpret_cast<const wchar_t*>(p));
- }
#endif
- unsigned int BOOST_REGEX_CALL syntax_type(size_type c)const
- {
- return (c < UCHAR_MAX) ? psyntax[c] : do_syntax_type(c);
- }
- regex_wchar_type BOOST_REGEX_CALL translate(regex_wchar_type c, bool icase)const
- {
- return icase ? (((uchar_type)c) <= UCHAR_MAX) ? lower_map[c] : pctype->tolower(c) : c;
- }
- void BOOST_REGEX_CALL transform(std::basic_string<regex_wchar_type>& out, const std::basic_string<regex_wchar_type>& in)const
- {
- out = pcollate->transform(in.c_str(), in.c_str() + in.size());
- }
-
- void BOOST_REGEX_CALL transform_primary(std::basic_string<regex_wchar_type>& out, const std::basic_string<regex_wchar_type>& in)const;
-
- static bool BOOST_REGEX_CALL is_separator(regex_wchar_type c)
- {
- return BOOST_REGEX_MAKE_BOOL((c == L'\n') || (c == L'\r') || (c == (regex_wchar_type)0x2028) || (c == (regex_wchar_type)0x2029));
- }
-
- static bool BOOST_REGEX_CALL is_combining(regex_wchar_type c)
- { return re_detail::is_combining(c); }
-
- bool BOOST_REGEX_CALL is_class(regex_wchar_type c, boost::uint_fast32_t f)const
- {
- if(pctype->is((std::ctype<regex_wchar_type>::mask)(f & char_class_all_base), c))
- return true;
- if((f & char_class_underscore) && (c == '_'))
- return true;
- if((f & char_class_blank) && ((c == ' ') || (c == '\t')))
- return true;
- if((f & char_class_unicode) && ((uchar_type)c > (uchar_type)255))
- return true;
- return false;
- }
-
- int BOOST_REGEX_CALL toi(regex_wchar_type c)const;
- int BOOST_REGEX_CALL toi(const regex_wchar_type*& first, const regex_wchar_type* last, int radix)const;
-
- boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const regex_wchar_type* first, const regex_wchar_type* last)const;
- bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<regex_wchar_type>& s, const regex_wchar_type* first, const regex_wchar_type* last)const;
-
- std::string BOOST_REGEX_CALL error_string(unsigned id)const;
- void swap(cpp_regex_traits&);
- cpp_regex_traits();
- ~cpp_regex_traits();
- locale_type BOOST_REGEX_CALL imbue(locale_type l);
- locale_type BOOST_REGEX_CALL getloc()const{ return locale_inst; }
- std::size_t BOOST_REGEX_CALL strwiden(regex_wchar_type *s1, std::size_t len, const char *s2)const;
+#endif
- struct sentry
- {
- sentry(const cpp_regex_traits<regex_wchar_type>&){}
- operator void*() { return this; }
- };
-};
+} // namespace re_detail
-#ifdef BOOST_REGEX_HAS_SHORT_WCHAR_T
-//
-// What follows here is Visual Studio specific - it is a thin wrapper
-// that redirects calls to cpp_regex_traits<unsigned short> to
-// cpp_regex_traits<__wchar_t>. This allows the library to be built
-// so that it supports programs built both with and without /Zc:wchar_t.
-//
-template<>
-class cpp_regex_traits<unsigned short> : public re_detail::cpp_regex_traits_base
+template <class BaseT>
+struct regex_traits_wrapper
+ : public ::boost::re_detail::compute_wrapper_base<
+ BaseT,
+ ::boost::re_detail::has_boost_extensions_tag<BaseT>::value
+ >::type
{
- typedef re_detail::cpp_regex_traits_base base_type;
-public:
- typedef unsigned short char_type;
- typedef unsigned short uchar_type;
- typedef unsigned int size_type;
- typedef std::basic_string<unsigned short> string_type;
- typedef std::locale locale_type;
- static std::size_t BOOST_REGEX_CALL length(const char_type* p)
- {
- return cpp_regex_traits<regex_wchar_type>::length(
- reinterpret_cast<const regex_wchar_type*>(p));
- }
- unsigned int BOOST_REGEX_CALL syntax_type(size_type c)const
- {
- return m_imp.syntax_type(c);
- }
- unsigned short BOOST_REGEX_CALL translate(unsigned short c, bool icase)const
- {
- return m_imp.translate(c, icase);
- }
-
- void BOOST_REGEX_CALL transform(std::basic_string<unsigned short>& out, const std::basic_string<unsigned short>& in)const
- {
- m_imp.transform(
- reinterpret_cast<std::basic_string<regex_wchar_type>&>(out),
- reinterpret_cast<const std::basic_string<regex_wchar_type>&>(in));
- }
-
- void BOOST_REGEX_CALL transform_primary(std::basic_string<unsigned short>& out, const std::basic_string<unsigned short>& in)const
- {
- m_imp.transform_primary(
- reinterpret_cast<std::basic_string<regex_wchar_type>&>(out),
- reinterpret_cast<const std::basic_string<regex_wchar_type>&>(in)); }
-
- static bool BOOST_REGEX_CALL is_separator(unsigned short c)
- {
- return cpp_regex_traits<regex_wchar_type>::is_separator(c);
- }
-
- static bool BOOST_REGEX_CALL is_combining(unsigned short c)
- {
- return cpp_regex_traits<regex_wchar_type>::is_combining(c);
- }
-
- bool BOOST_REGEX_CALL is_class(unsigned short c, boost::uint_fast32_t f)const
- {
- return m_imp.is_class(c, f);
- }
-
- int BOOST_REGEX_CALL toi(unsigned short c)const
- {
- return m_imp.toi(c);
- }
- int BOOST_REGEX_CALL toi(const unsigned short*& first, const unsigned short* last, int radix)const
- {
- return m_imp.toi(
- reinterpret_cast<const regex_wchar_type*&>(first),
- reinterpret_cast<const regex_wchar_type*>(last),
- radix);
- }
-
- boost::uint_fast32_t BOOST_REGEX_CALL lookup_classname(const unsigned short* first, const unsigned short* last)const
- {
- return m_imp.lookup_classname(
- reinterpret_cast<const regex_wchar_type*>(first),
- reinterpret_cast<const regex_wchar_type*>(last));
- }
-
- bool BOOST_REGEX_CALL lookup_collatename(std::basic_string<unsigned short>& s, const unsigned short* first, const unsigned short* last)const
- {
- return m_imp.lookup_collatename(
- reinterpret_cast<std::basic_string<regex_wchar_type>&>(s),
- reinterpret_cast<const regex_wchar_type*>(first),
- reinterpret_cast<const regex_wchar_type*>(last));
- }
-
- locale_type BOOST_REGEX_CALL imbue(locale_type l)
- {
- return m_imp.imbue(l);
- }
- locale_type BOOST_REGEX_CALL getloc()const
- {
- return m_imp.getloc();
- }
-
- struct sentry
- {
- sentry(const cpp_regex_traits<unsigned short>&){}
- operator void*() { return this; }
- };
- void swap(cpp_regex_traits& that)
- {
- m_imp.swap(that.m_imp);
- }
- cpp_regex_traits(){};
- ~cpp_regex_traits(){};
- std::size_t BOOST_REGEX_CALL strwiden(unsigned short *s1, std::size_t len, const char *s2)const
- {
- return m_imp.strwiden(
- reinterpret_cast<regex_wchar_type *>(s1), len, s2);
- }
- std::string BOOST_REGEX_CALL error_string(unsigned id)const
- {
- return m_imp.error_string(id);
- }
-
+ regex_traits_wrapper(){}
private:
- cpp_regex_traits<regex_wchar_type> m_imp;
-
+ regex_traits_wrapper(const regex_traits_wrapper&);
+ regex_traits_wrapper& operator=(const regex_traits_wrapper&);
};
-#endif // BOOST_REGEX_HAS_SHORT_WCHAR_T
-#endif // BOOST_NO_WREGEX
-
-#endif // BOOST_NO_STD_LOCALE
-
-#ifdef BOOST_REGEX_USE_WIN32_LOCALE
-
-template <class charT>
-class regex_traits : public w32_regex_traits<charT>
-{
-};
-
-#elif defined(BOOST_REGEX_USE_C_LOCALE)
-
-template <class charT>
-class regex_traits : public c_regex_traits<charT>
-{
-};
-
-#elif defined(BOOST_REGEX_USE_CPP_LOCALE)
-
-template <class charT>
-class regex_traits : public cpp_regex_traits<charT>
-{
-};
-
-#else
-#error No default localisation model defined
-#endif
+} // namespace boost
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
-} // namespace boost
-
#endif // include
-
-
-
-
-
-
-
--- /dev/null
+/*
+ *
+ * Copyright (c) 2004
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_traits_defaults.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares API's for access to regex_traits default properties.
+ */
+
+#ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
+#define BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+#ifndef BOOST_REGEX_SYNTAX_TYPE_HPP
+#include <boost/regex/v4/syntax_type.hpp>
+#endif
+#ifndef BOOST_REGEX_ERROR_TYPE_HPP
+#include <boost/regex/v4/error_type.hpp>
+#endif
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std{
+ using ::strlen;
+}
+#endif
+
+namespace boost{ namespace re_detail{
+
+
+//
+// helpers to suppress warnings:
+//
+template <class charT>
+inline bool is_extended(charT c)
+{ return c > 256; }
+inline bool is_extended(char)
+{ return false; }
+
+
+BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_syntax(regex_constants::syntax_type n);
+BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_error_string(regex_constants::error_type n);
+BOOST_REGEX_DECL regex_constants::syntax_type BOOST_REGEX_CALL get_default_syntax_type(char c);
+BOOST_REGEX_DECL regex_constants::escape_syntax_type BOOST_REGEX_CALL get_default_escape_syntax_type(char c);
+
+// is charT c a combining character?
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining_implementation(uint_least16_t s);
+
+template <class charT>
+inline bool is_combining(charT c)
+{
+ return (c <= static_cast<charT>(0)) ? false : ((c >= static_cast<charT>((std::numeric_limits<uint_least16_t>::max)())) ? false : is_combining_implementation(static_cast<unsigned short>(c)));
+}
+template <>
+inline bool is_combining<char>(char)
+{
+ return false;
+}
+template <>
+inline bool is_combining<signed char>(signed char)
+{
+ return false;
+}
+template <>
+inline bool is_combining<unsigned char>(unsigned char)
+{
+ return false;
+}
+#ifndef __HP_aCC
+#ifdef _MSC_VER
+template<>
+inline bool is_combining<wchar_t>(wchar_t c)
+{
+ return is_combining_implementation(static_cast<unsigned short>(c));
+}
+#elif !defined(__DECCXX) && !defined(__osf__) && !defined(__OSF__) && 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)
+{
+ return is_combining_implementation(static_cast<unsigned short>(c));
+}
+#else
+template<>
+inline bool is_combining<wchar_t>(wchar_t c)
+{
+ return (c >= (std::numeric_limits<uint_least16_t>::max)()) ? false : is_combining_implementation(static_cast<unsigned short>(c));
+}
+#endif
+#endif
+#endif
+
+//
+// is a charT c a line separator?
+//
+template <class charT>
+inline bool is_separator(charT c)
+{
+ return BOOST_REGEX_MAKE_BOOL(
+ (c == static_cast<charT>('\n'))
+ || (c == static_cast<charT>('\r'))
+ || (c == static_cast<charT>('\f'))
+ || (static_cast<boost::uint16_t>(c) == 0x2028u)
+ || (static_cast<boost::uint16_t>(c) == 0x2029u)
+ || (static_cast<boost::uint16_t>(c) == 0x85u));
+}
+template <>
+inline bool is_separator<char>(char c)
+{
+ return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r') || (c == '\f'));
+}
+
+//
+// get a default collating element:
+//
+BOOST_REGEX_DECL std::string BOOST_REGEX_CALL lookup_default_collate_name(const std::string& name);
+
+//
+// get the id of a character clasification, the individual
+// traits classes then transform that id into a bitmask:
+//
+template <class charT>
+struct character_pointer_range
+{
+ const charT* p1;
+ const charT* p2;
+
+ bool operator < (const character_pointer_range& r)const
+ {
+ return std::lexicographical_compare(p1, p2, r.p1, r.p2);
+ }
+ bool operator == (const character_pointer_range& r)const
+ {
+ return ((p2 - p1) == (r.p2 - r.p1)) && std::equal(p1, p2, r.p1);
+ }
+};
+template <class charT>
+int get_default_class_id(const charT* p1, const charT* p2)
+{
+ static const charT data[72] = {
+ 'a', 'l', 'n', 'u', 'm',
+ 'a', 'l', 'p', 'h', 'a',
+ 'b', 'l', 'a', 'n', 'k',
+ 'c', 'n', 't', 'r', 'l',
+ 'd', 'i', 'g', 'i', 't',
+ 'g', 'r', 'a', 'p', 'h',
+ 'l', 'o', 'w', 'e', 'r',
+ 'p', 'r', 'i', 'n', 't',
+ 'p', 'u', 'n', 'c', 't',
+ 's', 'p', 'a', 'c', 'e',
+ 'u', 'n', 'i', 'c', 'o', 'd', 'e',
+ 'u', 'p', 'p', 'e', 'r',
+ 'w', 'o', 'r', 'd',
+ 'x', 'd', 'i', 'g', 'i', 't',
+ };
+
+ static const character_pointer_range<charT> ranges[19] =
+ {
+ {data+0, data+5,}, // alnum
+ {data+5, data+10,}, // alpha
+ {data+10, data+15,}, // blank
+ {data+15, data+20,}, // cntrl
+ {data+20, data+21,}, // d
+ {data+20, data+25,}, // digit
+ {data+25, data+30,}, // graph
+ {data+30, data+31,}, // l
+ {data+30, data+35,}, // lower
+ {data+35, data+40,}, // print
+ {data+40, data+45,}, // punct
+ {data+45, data+46,}, // s
+ {data+45, data+50,}, // space
+ {data+57, data+58,}, // u
+ {data+50, data+57,}, // unicode
+ {data+57, data+62,}, // upper
+ {data+62, data+63,}, // w
+ {data+62, data+66,}, // word
+ {data+66, data+72,}, // xdigit
+ };
+ static const character_pointer_range<charT>* ranges_begin = ranges;
+ static const character_pointer_range<charT>* ranges_end = ranges + (sizeof(ranges)/sizeof(ranges[0]));
+
+ character_pointer_range<charT> t = { p1, p2, };
+ const character_pointer_range<charT>* p = std::lower_bound(ranges_begin, ranges_end, t);
+ if((p != ranges_end) && (t == *p))
+ return static_cast<int>(p - ranges);
+ return -1;
+}
+
+//
+// helper functions:
+//
+template <class charT>
+std::ptrdiff_t global_length(const charT* p)
+{
+ std::ptrdiff_t n = 0;
+ while(*p)
+ {
+ ++p;
+ ++n;
+ }
+ return n;
+}
+template<>
+inline std::ptrdiff_t global_length<char>(const char* p)
+{
+ return (std::strlen)(p);
+}
+#ifndef BOOST_NO_WREGEX
+template<>
+inline std::ptrdiff_t global_length<wchar_t>(const wchar_t* p)
+{
+ return (std::wcslen)(p);
+}
+#endif
+template <class charT>
+inline charT BOOST_REGEX_CALL global_lower(charT c)
+{
+ return c;
+}
+template <class charT>
+inline charT BOOST_REGEX_CALL global_upper(charT c)
+{
+ return c;
+}
+
+BOOST_REGEX_DECL char BOOST_REGEX_CALL do_global_lower(char c);
+BOOST_REGEX_DECL char BOOST_REGEX_CALL do_global_upper(char c);
+#ifndef BOOST_NO_WREGEX
+BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL do_global_lower(wchar_t c);
+BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL do_global_upper(wchar_t c);
+#endif
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL do_global_lower(unsigned short c);
+BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL do_global_upper(unsigned short c);
+#endif
+//
+// This sucks: declare template specialisations of global_lower/global_upper
+// that just forward to the non-template implementation functions. We do
+// this because there is one compiler (Compaq Tru64 C++) that doesn't seem
+// to differentiate between templates and non-template overloads....
+// what's more, the primary template, plus all overloads have to be
+// defined in the same translation unit (if one is inline they all must be)
+// otherwise the "local template instantiation" compiler option can pick
+// the wrong instantiation when linking:
+//
+template<> inline char BOOST_REGEX_CALL global_lower<char>(char c){ return do_global_lower(c); }
+template<> inline char BOOST_REGEX_CALL global_upper<char>(char c){ return do_global_upper(c); }
+#ifndef BOOST_NO_WREGEX
+template<> inline wchar_t BOOST_REGEX_CALL global_lower<wchar_t>(wchar_t c){ return do_global_lower(c); }
+template<> inline wchar_t BOOST_REGEX_CALL global_upper<wchar_t>(wchar_t c){ return do_global_upper(c); }
+#endif
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+template<> inline unsigned short BOOST_REGEX_CALL global_lower<unsigned short>(unsigned short c){ return do_global_lower(c); }
+template<> inline unsigned short BOOST_REGEX_CALL global_upper<unsigned short>(unsigned short c){ return do_global_upper(c); }
+#endif
+
+template <class charT>
+int global_value(charT c)
+{
+ static const charT zero = '0';
+ static const charT nine = '9';
+ static const charT a = 'a';
+ static const charT f = 'f';
+ static const charT A = 'A';
+ static const charT F = 'F';
+
+ if(c > f) return -1;
+ if(c >= a) return 10 + (c - a);
+ if(c > F) return -1;
+ if(c >= A) return 10 + (c - A);
+ if(c > nine) return -1;
+ if(c >= zero) return c - zero;
+ return -1;
+}
+template <class charT, class traits>
+int global_toi(const charT*& p1, const charT* p2, int radix, const traits& t)
+{
+ (void)t; // warning suppression
+ int next_value = t.value(*p1, radix);
+ if((p1 == p2) || (next_value < 0) || (next_value >= radix))
+ return -1;
+ int result = 0;
+ while(p1 != p2)
+ {
+ next_value = t.value(*p1, radix);
+ if((next_value < 0) || (next_value >= radix))
+ break;
+ result *= radix;
+ result += next_value;
+ ++p1;
+ }
+ return result;
+}
+
+} // re_detail
+} // boost
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif
--- /dev/null
+/*
+ *
+ * Copyright (c) 1998-2005
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_workarounds.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares Misc workarounds.
+ */
+
+#ifndef BOOST_REGEX_WORKAROUND_HPP
+#define BOOST_REGEX_WORKAROUND_HPP
+
+
+#include <new>
+#include <cstring>
+#include <cstdlib>
+#include <cstddef>
+#include <cassert>
+#include <cstdio>
+#include <string>
+#include <stdexcept>
+#include <iterator>
+#include <algorithm>
+#include <iosfwd>
+#include <vector>
+#include <map>
+#include <boost/limits.hpp>
+#include <boost/assert.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/scoped_array.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/mpl/bool_fwd.hpp>
+#ifndef BOOST_NO_STD_LOCALE
+# include <locale>
+#endif
+
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::sprintf; using ::strcpy; using ::strcat; using ::strlen;
+}
+#endif
+
+namespace boost{ namespace re_detail{
+#ifdef BOOST_NO_STD_DISTANCE
+template <class T>
+std::ptrdiff_t distance(const T& x, const T& y)
+{ return y - x; }
+#else
+using std::distance;
+#endif
+}}
+
+
+#ifdef BOOST_REGEX_NO_BOOL
+# define BOOST_REGEX_MAKE_BOOL(x) static_cast<bool>((x) ? true : false)
+#else
+# ifdef BOOST_MSVC
+ // warning suppression with VC6:
+# pragma warning(disable: 4800)
+# pragma warning(disable: 4786)
+# endif
+# define BOOST_REGEX_MAKE_BOOL(x) static_cast<bool>(x)
+#endif
+
+/*****************************************************************************
+ *
+ * Fix broken broken namespace support:
+ *
+ ****************************************************************************/
+
+#if defined(BOOST_NO_STDC_NAMESPACE) && defined(__cplusplus)
+
+namespace std{
+ using ::ptrdiff_t;
+ using ::size_t;
+ using ::abs;
+ using ::memset;
+ using ::memcpy;
+}
+
+#endif
+
+/*****************************************************************************
+ *
+ * helper functions pointer_construct/pointer_destroy:
+ *
+ ****************************************************************************/
+
+#ifdef __cplusplus
+namespace boost{ namespace re_detail{
+
+#ifdef BOOST_MSVC
+#pragma warning (push)
+#pragma warning (disable : 4100)
+#endif
+
+template <class T>
+inline void pointer_destroy(T* p)
+{ p->~T(); (void)p; }
+
+#ifdef BOOST_MSVC
+#pragma warning (pop)
+#endif
+
+template <class T>
+inline void pointer_construct(T* p, const T& t)
+{ new (p) T(t); }
+
+}} // namespaces
+#endif
+
+/*****************************************************************************
+ *
+ * helper function copy:
+ *
+ ****************************************************************************/
+
+#ifdef __cplusplus
+namespace boost{ namespace re_detail{
+#if BOOST_WORKAROUND(BOOST_MSVC,>=1400)
+ //
+ // MSVC 8 will either emit warnings or else refuse to compile
+ // code that makes perfectly legitimate use of std::copy, when
+ // the OutputIterator type is a user-defined class (apparently all user
+ // defined iterators are "unsafe"). This code works around that:
+ //
+ template<class InputIterator, class OutputIterator>
+ inline OutputIterator copy(
+ InputIterator first,
+ InputIterator last,
+ OutputIterator dest
+ )
+ {
+ return stdext::unchecked_copy(first, last, dest);
+ }
+
+ // use safe versions of strcpy etc:
+ using ::strcpy_s;
+ using ::strcat_s;
+#else
+ using std::copy;
+
+ inline std::size_t strcpy_s(
+ char *strDestination,
+ std::size_t sizeInBytes,
+ const char *strSource
+ )
+ {
+ if(std::strlen(strSource)+1 > sizeInBytes)
+ return 1;
+ std::strcpy(strDestination, strSource);
+ return 0;
+ }
+ inline std::size_t strcat_s(
+ char *strDestination,
+ std::size_t sizeInBytes,
+ const char *strSource
+ )
+ {
+ if(std::strlen(strSource) + std::strlen(strDestination) + 1 > sizeInBytes)
+ return 1;
+ std::strcat(strDestination, strSource);
+ return 0;
+ }
+
+#endif
+
+ inline void overflow_error_if_not_zero(std::size_t i)
+ {
+ if(i)
+ {
+ std::overflow_error e("String buffer too small");
+ boost::throw_exception(e);
+ }
+ }
+
+}} // namespaces
+#endif
+
+#endif // include guard
+
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
{
mask_take = 1,
mask_skip = 2,
+ mask_init = 4,
mask_any = mask_skip | mask_take,
mask_all = mask_any
};
syntax_element_dot_rep = syntax_element_restart_continue + 1,
syntax_element_char_rep = syntax_element_dot_rep + 1,
syntax_element_short_set_rep = syntax_element_char_rep + 1,
- syntax_element_long_set_rep = syntax_element_short_set_rep + 1
+ syntax_element_long_set_rep = syntax_element_short_set_rep + 1,
+ // a backstep for lookbehind repeats:
+ syntax_element_backstep = syntax_element_long_set_rep + 1,
+ // an assertion that a mark was matched:
+ syntax_element_assert_backref = syntax_element_backstep + 1,
+ syntax_element_toggle_case = syntax_element_assert_backref + 1
};
#ifdef BOOST_REGEX_DEBUG
union offset_type
{
re_syntax_base* p;
- std::size_t i;
+ std::ptrdiff_t i;
};
/*** struct re_syntax_base ********************************************
{
syntax_element_type type; // what kind of state this is
offset_type next; // next state in the machine
- unsigned int can_be_null; // true if we match a NULL string
};
/*** struct re_brace **************************************************
-Base class for all states in the machine.
+A marked parenthesis.
***********************************************************************/
struct re_brace : public re_syntax_base
{
int index;
};
+/*** struct re_dot **************************************************
+Match anything.
+***********************************************************************/
+enum
+{
+ dont_care = 1,
+ force_not_newline = 0,
+ force_newline = 2,
+
+ test_not_newline = 2,
+ test_newline = 3
+};
+struct re_dot : public re_syntax_base
+{
+ unsigned char mask;
+};
+
/*** struct re_literal ************************************************
A string of literals, following this structure will be an
array of characters: charT[length]
unsigned int length;
};
+/*** struct re_case ************************************************
+Indicates whether we are moving to a case insensive block or not
+***********************************************************************/
+struct re_case : public re_syntax_base
+{
+ bool icase;
+};
+
/*** struct re_set_long ***********************************************
A wide character set of characters, following this structure will be
an array of type charT:
Then 2 * cranges NULL terminated strings
Then cequivalents NULL terminated strings
***********************************************************************/
+template <class mask_type>
struct re_set_long : public re_syntax_base
{
unsigned int csingles, cranges, cequivalents;
- boost::uint_fast32_t cclasses;
+ mask_type cclasses;
+ mask_type cnclasses;
bool isnot;
bool singleton;
};
***********************************************************************/
struct re_set : public re_syntax_base
{
- unsigned char _map[256];
+ unsigned char _map[1 << CHAR_BIT];
};
/*** struct re_jump ***************************************************
***********************************************************************/
struct re_jump : public re_syntax_base
{
- offset_type alt; // location to jump to
- unsigned char _map[256]; // which characters can take the jump
+ offset_type alt; // location to jump to
+};
+
+/*** struct re_alt ***************************************************
+Jump to a new location in the machine (possibly next).
+***********************************************************************/
+struct re_alt : public re_jump
+{
+ unsigned char _map[1 << CHAR_BIT]; // which characters can take the jump
+ unsigned int can_be_null; // true if we match a NULL string
};
/*** struct re_repeat *************************************************
Repeat a section of the machine
***********************************************************************/
-struct re_repeat : public re_jump
+struct re_repeat : public re_alt
{
- unsigned min, max; // min and max allowable repeats
- int id; // Unique identifier for this repeat
- bool leading; // True if this repeat is at the start of the machine (lets us optimize some searches)
- bool greedy; // True if this is a greedy repeat
+ std::size_t min, max; // min and max allowable repeats
+ int id; // Unique identifier for this repeat
+ bool leading; // True if this repeat is at the start of the machine (lets us optimize some searches)
+ bool greedy; // True if this is a greedy repeat
};
/*** enum re_jump_size_type *******************************************
enum re_jump_size_type
{
re_jump_size = (sizeof(re_jump) + padding_mask) & ~(padding_mask),
- re_repeater_size = (sizeof(re_repeat) + padding_mask) & ~(padding_mask)
+ re_repeater_size = (sizeof(re_repeat) + padding_mask) & ~(padding_mask),
+ re_alt_size = (sizeof(re_alt) + padding_mask) & ~(padding_mask)
};
/*** proc re_is_set_member *********************************************
Forward declaration: we'll need this one later...
***********************************************************************/
-template <class iterator, class charT, class traits_type, class Allocator>
+
+template<class charT, class traits>
+struct regex_data;
+
+template <class iterator, class charT, class traits_type, class char_classT>
iterator BOOST_REGEX_CALL re_is_set_member(iterator next,
iterator last,
- const re_set_long* set_,
- const reg_expression<charT, traits_type, Allocator>& e);
+ const re_set_long<char_classT>* set_,
+ const regex_data<charT, traits_type>& e, bool icase);
} // namespace re_detail
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
sub_match() : std::pair<BidiIterator, BidiIterator>(), matched(false) {}
sub_match(BidiIterator i) : std::pair<BidiIterator, BidiIterator>(i, i), matched(false) {}
-
+#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
+ && !BOOST_WORKAROUND(BOOST_MSVC, < 1310)\
+ && !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)\
+ && !BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
+ template <class T, class A>
+ operator std::basic_string<value_type, T, A> ()const
+ {
+ return std::basic_string<value_type, T, A>(this->first, this->second);
+ }
+#else
operator std::basic_string<value_type> ()const
{
return str();
}
+#endif
difference_type BOOST_REGEX_CALL length()const
{
- difference_type n = boost::re_detail::distance((BidiIterator)this->first, (BidiIterator)this->second);
+ difference_type n = ::boost::re_detail::distance((BidiIterator)this->first, (BidiIterator)this->second);
return n;
}
std::basic_string<value_type> str()const
{
std::basic_string<value_type> result;
- std::size_t len = boost::re_detail::distance((BidiIterator)this->first, (BidiIterator)this->second);
+ std::size_t len = ::boost::re_detail::distance((BidiIterator)this->first, (BidiIterator)this->second);
result.reserve(len);
BidiIterator i = this->first;
while(i != this->second)
return static_cast<int>(matched) - static_cast<int>(s.matched);
return str().compare(s.str());
}
+ int compare(const std::basic_string<value_type>& s)const
+ {
+ return str().compare(s);
+ }
+ int compare(const value_type* p)const
+ {
+ return str().compare(p);
+ }
bool operator==(const sub_match& that)const
{ return compare(that) == 0; }
#endif
};
+typedef sub_match<const char*> csub_match;
+typedef sub_match<std::string::const_iterator> ssub_match;
+#ifndef BOOST_NO_WREGEX
+typedef sub_match<const wchar_t*> wcsub_match;
+typedef sub_match<std::wstring::const_iterator> wssub_match;
+#endif
+
// comparison to std::basic_string<> part 1:
template <class RandomAccessIterator, class traits, class Allocator>
inline bool operator == (const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s,
--- /dev/null
+/*
+ *
+ * Copyright (c) 2003
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE syntax_type.hpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares regular expression synatx type enumerator.
+ */
+
+#ifndef BOOST_REGEX_SYNTAX_TYPE_HPP
+#define BOOST_REGEX_SYNTAX_TYPE_HPP
+
+namespace boost{
+namespace regex_constants{
+
+typedef unsigned char syntax_type;
+
+//
+// values chosen are binary compatible with previous version:
+//
+static const syntax_type syntax_char = 0;
+static const syntax_type syntax_open_mark = 1;
+static const syntax_type syntax_close_mark = 2;
+static const syntax_type syntax_dollar = 3;
+static const syntax_type syntax_caret = 4;
+static const syntax_type syntax_dot = 5;
+static const syntax_type syntax_star = 6;
+static const syntax_type syntax_plus = 7;
+static const syntax_type syntax_question = 8;
+static const syntax_type syntax_open_set = 9;
+static const syntax_type syntax_close_set = 10;
+static const syntax_type syntax_or = 11;
+static const syntax_type syntax_escape = 12;
+static const syntax_type syntax_dash = 14;
+static const syntax_type syntax_open_brace = 15;
+static const syntax_type syntax_close_brace = 16;
+static const syntax_type syntax_digit = 17;
+static const syntax_type syntax_comma = 27;
+static const syntax_type syntax_equal = 37;
+static const syntax_type syntax_colon = 36;
+static const syntax_type syntax_not = 53;
+
+// extensions:
+
+static const syntax_type syntax_hash = 13;
+static const syntax_type syntax_newline = 26;
+
+// escapes:
+
+typedef syntax_type escape_syntax_type;
+
+static const escape_syntax_type escape_type_word_assert = 18;
+static const escape_syntax_type escape_type_not_word_assert = 19;
+static const escape_syntax_type escape_type_control_f = 29;
+static const escape_syntax_type escape_type_control_n = 30;
+static const escape_syntax_type escape_type_control_r = 31;
+static const escape_syntax_type escape_type_control_t = 32;
+static const escape_syntax_type escape_type_control_v = 33;
+static const escape_syntax_type escape_type_ascii_control = 35;
+static const escape_syntax_type escape_type_hex = 34;
+static const escape_syntax_type escape_type_unicode = 0; // not used
+static const escape_syntax_type escape_type_identity = 0; // not used
+static const escape_syntax_type escape_type_backref = syntax_digit;
+static const escape_syntax_type escape_type_decimal = syntax_digit; // not used
+static const escape_syntax_type escape_type_class = 22;
+static const escape_syntax_type escape_type_not_class = 23;
+
+// extensions:
+
+static const escape_syntax_type escape_type_left_word = 20;
+static const escape_syntax_type escape_type_right_word = 21;
+static const escape_syntax_type escape_type_start_buffer = 24; // for \`
+static const escape_syntax_type escape_type_end_buffer = 25; // for \'
+static const escape_syntax_type escape_type_control_a = 28; // for \a
+static const escape_syntax_type escape_type_e = 38; // for \e
+static const escape_syntax_type escape_type_E = 47; // for \Q\E
+static const escape_syntax_type escape_type_Q = 48; // for \Q\E
+static const escape_syntax_type escape_type_X = 49; // for \X
+static const escape_syntax_type escape_type_C = 50; // for \C
+static const escape_syntax_type escape_type_Z = 51; // for \Z
+static const escape_syntax_type escape_type_G = 52; // for \G
+
+static const escape_syntax_type escape_type_property = 54; // for \p
+static const escape_syntax_type escape_type_not_property = 55; // for \P
+static const escape_syntax_type escape_type_named_char = 56; // for \N
+
+static const escape_syntax_type syntax_max = 57;
+
+}
+}
+
+
+#endif
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
* LOCATION: see http://www.boost.org/libs/regex for documentation.
* FILE regex_fwd.cpp
* VERSION see <boost/version.hpp>
- * DESCRIPTION: Forward declares boost::reg_expression<> and
+ * DESCRIPTION: Forward declares boost::basic_regex<> and
* associated typedefs.
*/
#include <boost/regex/config.hpp>
#endif
-#ifdef BOOST_REGEX_V3
-#include <boost/regex/v3/regex_fwd.hpp>
-#else
#include <boost/regex/v4/regex_fwd.hpp>
-#endif
#endif
}
template<class Y>
- explicit shared_ptr(Y * p): px(p), pn(p, checked_deleter<Y>()) // Y must be complete
+ explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete
{
detail::sp_enable_shared_from_this( pn, p, p );
}
return px != 0;
}
-#elif defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
+#elif \
+ ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \
+ ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) )
+
typedef T * (this_type::*unspecified_bool_type)() const;
operator unspecified_bool_type() const // never throws
// get_deleter (experimental)
-#if (defined(__GNUC__) && (__GNUC__ < 3)) || (defined(__EDG_VERSION__) && (__EDG_VERSION__ <= 238))
+#if ( defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) ) || \
+ ( defined(__EDG_VERSION__) && BOOST_WORKAROUND(__EDG_VERSION__, <= 238) ) || \
+ ( defined(__HP_aCC) && BOOST_WORKAROUND(__HP_aCC, <= 33500) )
// g++ 2.9x doesn't allow static_cast<X const *>(void *)
-// apparently EDG 2.38 also doesn't accept it
+// apparently EDG 2.38 and HP aCC A.03.35 also don't accept it
template<class D, class T> D * get_deleter(shared_ptr<T> const & p)
{
void* signal;
void* signal_data;
void (*signal_disconnect)(void*, void*);
+ bool blocked_;
std::list<bound_object> bound_objects;
};
connection(const connection&);
~connection();
+ // Block he connection: if the connection is still active, there
+ // will be no notification
+ void block(bool should_block = true) { con->blocked_ = should_block; }
+ void unblock() { con->blocked_ = false; }
+ bool blocked() const { return !connected() || con->blocked_; }
+
// Disconnect the signal and slot, if they are connected
void disconnect() const;
public: // TBD: CHANGE THIS
// Set whether this connection object is controlling or not
- void set_controlling(bool control = true)
+ void set_controlling(bool control = true)
{ controlling_connection = control; }
shared_ptr<BOOST_SIGNALS_NAMESPACE::detail::basic_connection>
- get_connection() const
+ get_connection() const
{ return con; }
private:
}
};
+ // Determines if the underlying connection is callable, ie if
+ // it is connected and not blocked
+ struct is_callable {
+ typedef connection_slot_pair argument_type;
+ typedef bool result_type;
+
+ inline bool operator()(const argument_type& c) const
+ {
+ return c.first.connected() && !c.first.blocked() ;
+ }
+ };
+
// Autodisconnects the bound object when it is destroyed unless the
// release method is invoked.
class auto_disconnect_bound_object {
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Copyright (c) 2003-2004
* Douglas Gregor
#include <boost/signals/detail/config.hpp>
#include <boost/signals/detail/signals_common.hpp>
#include <boost/signals/connection.hpp>
-#include <boost/smart_ptr.hpp>
-#include <boost/any.hpp>
#include <boost/utility.hpp>
+#include <boost/shared_ptr.hpp>
#include <boost/function/function2.hpp>
#include <boost/iterator/iterator_facade.hpp>
+#include <map>
#include <memory>
#include <utility>
namespace detail {
-typedef function2<bool, any, any> compare_type;
+class stored_group
+{
+ public:
+ enum storage_kind { sk_empty, sk_front, sk_back, sk_group };
+
+ stored_group(storage_kind kind = sk_empty) : kind(kind), group() { }
+
+ template<typename T>
+ stored_group(const T& group) : kind(sk_group), group(new T(group)) { }
+
+ bool is_front() const { return kind == sk_front; }
+ bool is_back() const { return kind == sk_back; }
+ bool empty() const { return kind == sk_empty; }
+
+ void* get() const { return group.get(); }
+
+ private:
+ storage_kind kind;
+ shared_ptr<void> group;
+};
-// Used to delimit the front and back of the list for O(1) insertion.
-struct front_type {};
-struct back_type {};
+typedef function2<bool, stored_group, stored_group> compare_type;
// This function object bridges from a pair of any objects that hold
// values of type Key to the underlying function object that compares
// values of type Key.
template<typename Compare, typename Key>
-class any_bridge_compare {
+class group_bridge_compare {
public:
typedef bool result_type;
- typedef const any& first_argument_type;
- typedef const any& second_argument_type;
+ typedef const stored_group& first_argument_type;
+ typedef const stored_group& second_argument_type;
- any_bridge_compare(const Compare& c) : comp(c) {}
+ group_bridge_compare(const Compare& c) : comp(c) {}
- bool operator()(const any& k1, const any& k2) const
+ bool operator()(const stored_group& k1, const stored_group& k2) const
{
- if (k1.type() == typeid(front_type))
- return !(k2.type() == typeid(front_type));
- if (k1.type() == typeid(back_type))
- return false;
- if (k2.type() == typeid(front_type))
- return false;
- if (k2.type() == typeid(back_type))
- return true;
+ if (k1.is_front()) return !k2.is_front();
+ if (k1.is_back()) return false;
+ if (k2.is_front()) return false;
+ if (k2.is_back()) return true;
// Neither is empty, so compare their values to order them
- // The strange */& is so that we will get a reference to the
- // value stored in the any object instead of a copy
- return comp(*any_cast<Key>(&k1), *any_cast<Key>(&k2));
+ return comp(*static_cast<Key*>(k1.get()), *static_cast<Key*>(k2.get()));
}
private:
connection_slot_pair,
forward_traversal_tag>
{
- class impl;
+ typedef std::list<connection_slot_pair> group_list;
+ typedef group_list::iterator slot_pair_iterator;
+ typedef std::map<stored_group, group_list, compare_type> slot_container_type;
+ typedef slot_container_type::iterator group_iterator;
+ typedef slot_container_type::const_iterator const_group_iterator;
typedef iterator_facade<named_slot_map_iterator,
connection_slot_pair,
forward_traversal_tag> inherited;
public:
named_slot_map_iterator();
- named_slot_map_iterator(const named_slot_map_iterator& other);
- ~named_slot_map_iterator();
- named_slot_map_iterator& operator=(const named_slot_map_iterator& other);
+ named_slot_map_iterator(const named_slot_map_iterator&);
+ named_slot_map_iterator& operator=(const named_slot_map_iterator&);
connection_slot_pair& dereference() const;
void increment();
bool equal(const named_slot_map_iterator& other) const;
-#if BOOST_WORKAROUND(BOOST_MSVC, <= 0x1701)
+#if BOOST_WORKAROUND(_MSC_VER, <= 1400)
void decrement();
void advance(difference_type);
#endif
private:
- named_slot_map_iterator(std::auto_ptr<impl>);
+ named_slot_map_iterator(group_iterator group, group_iterator last) :
+ group(group), last_group(last), slot_assigned(false)
+ { init_next_group(); }
+ named_slot_map_iterator(group_iterator group, group_iterator last,
+ slot_pair_iterator slot) :
+ group(group), last_group(last), slot_(slot), slot_assigned(true)
+ { }
+
+ void init_next_group()
+ {
+ while (group != last_group && group->second.empty()) ++group;
+ if (group != last_group) {
+ slot_ = group->second.begin();
+ slot_assigned = true;
+ }
+ }
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
- shared_ptr<impl> impl_;
-#else
- scoped_ptr<impl> impl_;
-#endif
+ group_iterator group;
+ group_iterator last_group;
+ slot_pair_iterator slot_;
+ bool slot_assigned;
friend class named_slot_map;
};
typedef named_slot_map_iterator iterator;
named_slot_map(const compare_type& compare);
- ~named_slot_map();
void clear();
iterator begin();
iterator end();
- iterator insert(const any& name, const connection& con, const any& slot,
- connect_position at);
- void disconnect(const any& name);
+ iterator insert(const stored_group& name, const connection& con,
+ const any& slot, connect_position at);
+ void disconnect(const stored_group& name);
void erase(iterator pos);
void remove_disconnected_slots();
private:
- class impl;
+ typedef std::list<connection_slot_pair> group_list;
+ typedef std::map<stored_group, group_list, compare_type> slot_container_type;
+ typedef slot_container_type::iterator group_iterator;
+ typedef slot_container_type::const_iterator const_group_iterator;
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
- shared_ptr<impl> impl_;
-#else
- scoped_ptr<impl> impl_;
-#endif
+ bool empty(const_group_iterator group) const
+ {
+ return (group->second.empty() && group != groups.begin() && group != back);
+ }
+ slot_container_type groups;
+ group_iterator back;
};
} } }
#include <boost/signals/trackable.hpp>
#include <boost/signals/slot.hpp>
#include <boost/smart_ptr.hpp>
-#include <boost/any.hpp>
#include <boost/utility.hpp>
#include <boost/function/function2.hpp>
#include <utility>
public:
friend class call_notification;
- typedef function2<bool, any, any> compare_type;
+ typedef function2<bool, stored_group, stored_group> compare_type;
// Make sure that an exception does not cause the "clearing" flag to
// remain set
std::size_t num_slots() const;
// Disconnect all slots in the given group
- void disconnect(const any&);
+ void disconnect(const stored_group&);
// We're being notified that a slot has disconnected
static void slot_disconnected(void* obj, void* data);
connection connect_slot(const any& slot,
- const any& name,
+ const stored_group& name,
shared_ptr<slot_base::data_t> data,
connect_position at);
protected:
connection connect_slot(const any& slot,
- const any& name,
+ const stored_group& name,
shared_ptr<slot_base::data_t> data,
connect_position at)
{
#ifndef BOOST_SIGNALS_SLOT_CALL_ITERATOR
#define BOOST_SIGNALS_SLOT_CALL_ITERATOR
-#include <functional>
+#include <memory>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/signals/detail/config.hpp>
#include <boost/signals/connection.hpp>
+#include <boost/optional.hpp>
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
namespace boost {
namespace BOOST_SIGNALS_NAMESPACE {
namespace detail {
- // A cached return value from a slot
- template<typename T>
- struct cached_return_value {
- cached_return_value(const T& t) : value(t) {}
-
- T value;
- };
// Generates a slot call iterator. Essentially, this is an iterator that:
// - skips over disconnected slots in the underlying list
friend class iterator_core_access;
public:
- slot_call_iterator() {}
-
- slot_call_iterator(Iterator iter_in, Iterator end_in, Function f)
- : iter(iter_in), end(end_in), f(f), cache()
+ slot_call_iterator(Iterator iter_in, Iterator end_in, Function f,
+ optional<result_type> &c)
+ : iter(iter_in), end(end_in), f(f), cache(&c)
{
- iter = std::find_if(iter, end, std::not1(is_disconnected()));
+ iter = std::find_if(iter, end, is_callable());
}
typename inherited::reference
dereference() const
{
- if (!cache.get()) {
- cache.reset(new cached_return_value<result_type>(f(*iter)));
+ if (!cache->is_initialized()) {
+ cache->reset(f(*iter));
}
- return cache->value;
+ return cache->get();
}
void increment()
{
- iter = std::find_if(++iter, end, std::not1(is_disconnected()));
- cache.reset();
+ iter = std::find_if(++iter, end, is_callable());
+ cache->reset();
}
bool equal(const slot_call_iterator& other) const
{
- iter = std::find_if(iter, end, std::not1(is_disconnected()));
+ iter = std::find_if(iter, end, is_callable());
other.iter = std::find_if(other.iter, other.end,
- std::not1(is_disconnected()));
+ is_callable());
return iter == other.iter;
}
mutable Iterator iter;
Iterator end;
Function f;
- mutable shared_ptr< cached_return_value<result_type> > cache;
+ optional<result_type>* cache;
};
} // end namespace detail
} // end namespace BOOST_SIGNALS_NAMESPACE
template<typename Pair>
R operator()(const Pair& slot) const
{
- F* target = const_cast<F*>(any_cast<F>(&slot.second));
+ F* target = const_cast<F*>(unsafe_any_cast<F>(&slot.second));
return (*target)(BOOST_SIGNALS_BOUND_ARGS);
}
};
template<typename Pair>
unusable operator()(const Pair& slot) const
{
- F* target = const_cast<F*>(any_cast<F>(&slot.second));
+ F* target = const_cast<F*>(unsafe_any_cast<F>(&slot.second));
(*target)(BOOST_SIGNALS_BOUND_ARGS);
return unusable();
}
private:
// The real slot name comparison object type
- typedef BOOST_SIGNALS_NAMESPACE::detail::any_bridge_compare<GroupCompare, Group>
+ typedef BOOST_SIGNALS_NAMESPACE::detail::group_bridge_compare<GroupCompare, Group>
real_group_compare_type;
// The function object passed to the slot call iterator that will call
BOOST_SIGNALS_NAMESPACE::detail::call_notification notification(this->impl);
for (iterator i = impl->slots_.begin(); i != impl->slots_.end(); ++i) {
- slot_function_type& s = *any_cast<slot_function_type>(&i->second);
+ slot_function_type& s = *unsafe_any_cast<slot_function_type>(&i->second);
if (s == f) i->first.disconnect();
}
}
result_type operator()(BOOST_SIGNALS_PARMS) const;
Combiner& combiner()
- { return *any_cast<Combiner>(&impl->combiner_); }
+ { return *unsafe_any_cast<Combiner>(&impl->combiner_); }
const Combiner& combiner() const
- { return *any_cast<const Combiner>(&impl->combiner_); }
+ { return *unsafe_any_cast<const Combiner>(&impl->combiner_); }
};
template<
>::connect(const slot_type& in_slot,
BOOST_SIGNALS_NAMESPACE::connect_position at)
{
+ using boost::BOOST_SIGNALS_NAMESPACE::detail::stored_group;
+
// If the slot has been disconnected, just return a disconnected
// connection
if (!in_slot.is_active()) {
return BOOST_SIGNALS_NAMESPACE::connection();
}
- return impl->connect_slot(in_slot.get_slot_function(), any(),
+ return impl->connect_slot(in_slot.get_slot_function(), stored_group(),
in_slot.get_data(), at);
}
return BOOST_SIGNALS_NAMESPACE::connection();
}
- return impl->connect_slot(in_slot.get_slot_function(), group,
+ return impl->connect_slot(in_slot.get_slot_function(), group,
in_slot.get_data(), at);
}
#endif // BOOST_SIGNALS_NUM_ARGS > 0
call_bound_slot f(&args);
+ typedef typename call_bound_slot::result_type result_type;
+ optional<result_type> cache;
// Let the combiner call the slots via a pair of input iterators
return combiner()(slot_call_iterator(notification.impl->slots_.begin(),
- impl->slots_.end(), f),
+ impl->slots_.end(), f, cache),
slot_call_iterator(notification.impl->slots_.end(),
- impl->slots_.end(), f));
+ impl->slots_.end(), f, cache));
}
template<
call_bound_slot f(&args);
+ typedef typename call_bound_slot::result_type result_type;
+ optional<result_type> cache;
+
// Let the combiner call the slots via a pair of input iterators
return combiner()(slot_call_iterator(notification.impl->slots_.begin(),
- impl->slots_.end(), f),
+ impl->slots_.end(), f, cache),
slot_call_iterator(notification.impl->slots_.end(),
- impl->slots_.end(), f));
+ impl->slots_.end(), f, cache));
}
} // namespace boost
{
// Take the address of this object, because the object itself may be
// trackable
- add_if_trackable(addressof(t));
+ add_if_trackable(boost::addressof(t));
}
// add_if_trackable() adds trackable objects to the list of bound objects
#if defined(NDEBUG)
#define BOOST_SPIRIT_ASSERT(x)
#elif defined (BOOST_SPIRIT_ASSERT_EXCEPTION)
- #define BOOST_SPIRIT_ASSERT_AUX(f, l, x) \
+ #define BOOST_SPIRIT_ASSERT_AUX(f, l, x) BOOST_SPIRIT_ASSERT_AUX2(f, l, x)
+ #define BOOST_SPIRIT_ASSERT_AUX2(f, l, x) \
do{ if (!(x)) boost::throw_exception( \
BOOST_SPIRIT_ASSERT_EXCEPTION(f "(" #l "): " #x)); } while(0)
#define BOOST_SPIRIT_ASSERT(x) BOOST_SPIRIT_ASSERT_AUX(__FILE__, __LINE__, x)
typename parser_result<self_t, ScannerT>::type
parse(ScannerT const& scan) const
{
- if (positive_ == cond())
+ if (positive_ == bool(cond())) // allow cond to return int
return scan.empty_match();
else
return scan.no_match();
CondT cond;
};
-#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) // VC 7.1
+#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) || \
+ BOOST_WORKAROUND(BOOST_MSVC, == 1400)
+// VC 7.1 and VC8
template <typename CondT>
inline condition_parser<CondT, false>
operator~(condition_parser<CondT, true> const& p)
inline condition_parser<CondT, true>
operator~(condition_parser<CondT, false> const& p)
{ return p.negate(); }
-#else // BOOST_WORKAROUND(BOOST_MSVC, == 1310)
+#else // BOOST_WORKAROUND(BOOST_MSVC, == 1310) || == 1400
template <typename CondT, bool positive>
inline condition_parser<CondT, !positive>
operator~(condition_parser<CondT, positive> const& p)
{ return p.negate(); }
-#endif // BOOST_WORKAROUND(BOOST_MSVC, == 1310)
+#endif // BOOST_WORKAROUND(BOOST_MSVC, == 1310) || == 1400
///////////////////////////////////////////////////////////////////////////////
//
iterator_t save = scan.first;
if (result_t hl = this->left().parse(scan))
{
- ScannerT bscan(scan.first, scan.first);
+ ScannerT bscan(scan.first, scan.first, scan);
scan.first = save;
result_t hr = this->right().parse(bscan);
if (hl.length() == hr.length())
#include <boost/optional.hpp>
#include <boost/mpl/bool.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/type_traits/is_same.hpp>
namespace boost { namespace spirit { namespace impl
{
const_reference;
// case where src *IS* convertible to T (dest)
+ template <typename T2>
static void
- convert(boost::optional<T>& dest, const_reference src)
- { dest.reset(src); }
+ convert(boost::optional<T>& dest, T2 const& src, mpl::true_)
+ {
+ dest.reset(src);
+ }
// case where src *IS NOT* convertible to T (dest)
+ template <typename T2>
+ static void
+ convert(boost::optional<T>& dest, T2 const& /*src*/, mpl::false_)
+ {
+ dest.reset();
+ }
+
static void
- convert(boost::optional<T>& dest, .../*src*/)
- { dest.reset(); }
+ convert(boost::optional<T>& dest, nil_t/*src*/)
+ {
+ dest.reset();
+ }
+
+ template <typename T2>
+ static void
+ convert(boost::optional<T>& dest, T2 const& src)
+ {
+ convert(dest, src, is_convertible<T2, T>());
+ }
template <typename OtherMatchT>
static void
public:
typedef entry_grammar<DerivedT, N, ContextT> self_t;
- typedef DerivedT const& embed_t;
+ typedef self_t embed_t;
typedef typename ContextT::context_linker_t context_t;
typedef typename context_t::attr_t attr_t;
{
typedef typename parser_result<self_t, ScannerT>::type result_t;
typedef parser_scanner_linker<ScannerT> scanner_t;
- BOOST_SPIRIT_CONTEXT_PARSE(scan, *this, scanner_t, context_t,
- result_t)
+ BOOST_SPIRIT_CONTEXT_PARSE(scan, target_grammar, scanner_t,
+ context_t, result_t)
}
private:
#ifdef BOOST_SPIRIT_THREADSAFE
#include <boost/thread/mutex.hpp>
+#include <boost/thread/once.hpp>
#endif
///////////////////////////////////////////////////////////////////////////////
void release_object_id(object_id);
private:
+#ifdef BOOST_SPIRIT_THREADSAFE
+ static boost::mutex &mutex_instance();
+ static void mutex_init();
+#endif
boost::shared_ptr<object_with_id_base_supply<IdT> > id_supply;
};
{
{
#ifdef BOOST_SPIRIT_THREADSAFE
- static boost::mutex mutex;
+ static boost::once_flag been_here = BOOST_ONCE_INIT;
+ boost::call_once(mutex_init, been_here);
+ boost::mutex &mutex = mutex_instance();
boost::mutex::scoped_lock lock(mutex);
#endif
static boost::shared_ptr<object_with_id_base_supply<IdT> >
id_supply->release(id);
}
+ //////////////////////////////////
+#ifdef BOOST_SPIRIT_THREADSAFE
+ template <typename TagT, typename IdT>
+ inline boost::mutex &
+ object_with_id_base<TagT, IdT>::mutex_instance()
+ {
+ static boost::mutex mutex;
+ return mutex;
+ }
+#endif
+
+ //////////////////////////////////
+#ifdef BOOST_SPIRIT_THREADSAFE
+ template <typename TagT, typename IdT>
+ inline void
+ object_with_id_base<TagT, IdT>::mutex_init()
+ {
+ mutex_instance();
+ }
+#endif
+
} // namespace impl
///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_SPIRIT_PARSER_ID_HPP)
#define BOOST_SPIRIT_PARSER_ID_HPP
+#if defined(BOOST_SPIRIT_DEBUG)
+# include <ostream>
+#endif
+
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit {
isalnum_(char c)
{
using namespace std;
- return isalnum(to_int_type(c));
+ return isalnum(to_int_type(c)) ? true : false;
}
inline bool
isalpha_(char c)
{
using namespace std;
- return isalpha(to_int_type(c));
+ return isalpha(to_int_type(c)) ? true : false;
}
inline bool
iscntrl_(char c)
{
using namespace std;
- return iscntrl(to_int_type(c));
+ return iscntrl(to_int_type(c)) ? true : false;
}
inline bool
isdigit_(char c)
{
using namespace std;
- return isdigit(to_int_type(c));
+ return isdigit(to_int_type(c)) ? true : false;
}
inline bool
isgraph_(char c)
{
using namespace std;
- return isgraph(to_int_type(c));
+ return isgraph(to_int_type(c)) ? true : false;
}
inline bool
islower_(char c)
{
using namespace std;
- return islower(to_int_type(c));
+ return islower(to_int_type(c)) ? true : false;
}
inline bool
isprint_(char c)
{
using namespace std;
- return isprint(to_int_type(c));
+ return isprint(to_int_type(c)) ? true : false;
}
inline bool
ispunct_(char c)
{
using namespace std;
- return ispunct(to_int_type(c));
+ return ispunct(to_int_type(c)) ? true : false;
}
inline bool
isspace_(char c)
{
using namespace std;
- return isspace(to_int_type(c));
+ return isspace(to_int_type(c)) ? true : false;
}
inline bool
isupper_(char c)
{
using namespace std;
- return isupper(to_int_type(c)); }
+ return isupper(to_int_type(c)) ? true : false;
+ }
inline bool
isxdigit_(char c)
{
using namespace std;
- return isxdigit(to_int_type(c));
+ return isxdigit(to_int_type(c)) ? true : false;
}
inline bool
isalnum_(wchar_t c)
{
using namespace std;
- return iswalnum(to_int_type(c));
+ return iswalnum(to_int_type(c)) ? true : false;
}
inline bool
isalpha_(wchar_t c)
{
using namespace std;
- return iswalpha(to_int_type(c));
+ return iswalpha(to_int_type(c)) ? true : false;
}
inline bool
iscntrl_(wchar_t c)
{
using namespace std;
- return iswcntrl(to_int_type(c));
+ return iswcntrl(to_int_type(c)) ? true : false;
}
inline bool
isdigit_(wchar_t c)
{
using namespace std;
- return iswdigit(to_int_type(c));
+ return iswdigit(to_int_type(c)) ? true : false;
}
inline bool
isgraph_(wchar_t c)
{
using namespace std;
- return iswgraph(to_int_type(c));
+ return iswgraph(to_int_type(c)) ? true : false;
}
inline bool
islower_(wchar_t c)
{
using namespace std;
- return iswlower(to_int_type(c));
+ return iswlower(to_int_type(c)) ? true : false;
}
inline bool
isprint_(wchar_t c)
{
using namespace std;
- return iswprint(to_int_type(c));
+ return iswprint(to_int_type(c)) ? true : false;
}
inline bool
ispunct_(wchar_t c)
{
using namespace std;
- return iswpunct(to_int_type(c));
+ return iswpunct(to_int_type(c)) ? true : false;
}
inline bool
isspace_(wchar_t c)
{
using namespace std;
- return iswspace(to_int_type(c));
+ return iswspace(to_int_type(c)) ? true : false;
}
inline bool
isupper_(wchar_t c)
{
using namespace std;
- return iswupper(to_int_type(c));
+ return iswupper(to_int_type(c)) ? true : false;
}
inline bool
isxdigit_(wchar_t c)
{
using namespace std;
- return iswxdigit(to_int_type(c));
+ return iswxdigit(to_int_type(c)) ? true : false;
}
inline bool
return chlit<CharT>(ch);
}
+ // This should take care of ch_p("a") "bugs"
+ template <typename CharT, std::size_t N>
+ inline chlit<CharT>
+ ch_p(CharT const (& str)[N])
+ {
+ // ch_p's argument should be a single character or a null-terminated
+ // string with a single character
+ BOOST_STATIC_ASSERT(N < 3);
+ return chlit<CharT>(str[0]);
+ }
+
///////////////////////////////////////////////////////////////////////////
//
// range class
return strlit<CharT const*>(str);
}
+ template <typename CharT>
+ inline strlit<CharT *>
+ str_p(CharT * str)
+ {
+ return strlit<CharT *>(str);
+ }
+
template <typename IteratorT>
inline strlit<IteratorT>
str_p(IteratorT first, IteratorT last)
return strlit<IteratorT>(first, last);
}
+ // This should take care of str_p('a') "bugs"
+ template <typename CharT>
+ inline chlit<CharT>
+ str_p(CharT ch)
+ {
+ return chlit<CharT>(ch);
+ }
+
///////////////////////////////////////////////////////////////////////////
//
// nothing_parser class
++len;
}
- if (!scan.at_end() && *scan == '\n') // LF
+ // Don't call skipper here
+ if (scan.first != scan.last && *scan == '\n') // LF
{
++scan.first;
++len;
length += then_result.length();
return scan.create_match(std::size_t(length), nil_t(), save, scan.first);
}
+ return scan.no_match();
}
return scan.empty_match();
}
public:
- parser_error_base(parser_error_base const&) {}
+ parser_error_base(parser_error_base const& rhs)
+ : std::exception(rhs) {}
parser_error_base& operator=(parser_error_base const&)
{
return *this;
: where(where_), descriptor(descriptor_) {}
parser_error(parser_error const& rhs)
- : where(rhs.where), descriptor(rhs.descriptor) {}
+ : parser_error_base(rhs)
+ , where(rhs.where), descriptor(rhs.descriptor) {}
parser_error&
operator=(parser_error const& rhs)
template <
typename CharT = char,
typename BaseIterator =
-#ifndef BOOST_SPIRIT_FILEITERATOR_WINDOWS
+#ifdef BOOST_SPIRIT_FILEITERATOR_STD
fileiter_impl::std_file_iterator<CharT>
#else
fileiter_impl::mmap_file_iterator<CharT>
}} /* namespace boost::spirit */
///////////////////////////////////////////////////////////////////////////////
-#include "impl/file_iterator.ipp" /* implementation */
+#include <boost/spirit/iterator/impl/file_iterator.ipp> /* implementation */
#endif /* BOOST_SPIRIT_FILE_ITERATOR_HPP */
// will be called from the destructor of the last iterator.
void destroy()
{
- BOOST_SPIRIT_ASSERT(queuedElements);
+ BOOST_SPIRIT_ASSERT(NULL != queuedElements);
delete queuedElements;
queuedElements = 0;
}
// will be called from the destructor of the last iterator.
void destroy()
{
- BOOST_SPIRIT_ASSERT(queuedElements);
+ BOOST_SPIRIT_ASSERT(NULL != queuedElements);
delete queuedElements;
queuedElements = 0;
}
bool was_initialized;
};
+ // Needed by compilers not implementing the resolution to DR45. For
+ // reference, see
+ // http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#45.
+
+ friend struct Data;
+
public:
typedef result_type value_type;
typedef
public:
reference get_input() const
{
- BOOST_SPIRIT_ASSERT(0 != data);
+ BOOST_SPIRIT_ASSERT(NULL != data);
ensure_initialized();
return data->curtok;
}
void advance_input()
{
- BOOST_SPIRIT_ASSERT(0 != data);
+ BOOST_SPIRIT_ASSERT(NULL != data);
data->was_initialized = false; // should get the next token
++data->input;
}
// This must be included here for full compatibility with old MSVC
-#include "impl/position_iterator.ipp"
+#include "boost/spirit/iterator/impl/position_iterator.ipp"
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit {
struct make_binary1;
}
-namespace impl {
-
- ///////////////////////////////////////////////////////////////////////////
- //
- // if_t selects type A or B depending on the condition C If C is of
- // type char[2], B is selected, otherwise A
- //
- // TODO: This should be part of a common meta-library
- //
- ///////////////////////////////////////////////////////////////////////////
- template <typename C, typename A, typename B>
- struct if_t { typedef A type; };
-
- template <typename A, typename B>
- struct if_t<char[2], A, B> { typedef B type; };
-}
-
///////////////////////////////////////////////////////////////////////////////
//
// unpack_tuple class
//
// arg0 ---------|
// arg1 ---------|
-// arg3 ---------|---> tupled_args ---> base.eval
+// arg2 ---------|---> tupled_args ---> base.eval
// ... |
// argN ---------|
//
///////////////////////////////////////////////////////////////////////////////
#include <boost/spirit/phoenix/functions.hpp>
#include <boost/type_traits/is_const.hpp>
+#include <boost/mpl/if.hpp>
///////////////////////////////////////////////////////////////////////////////
namespace phoenix {
template <typename CT>
struct result {
-
- typedef char is_const[boost::is_const<CT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, T const&, T&>::type type;
+ typedef typename boost::mpl::if_<boost::is_const<CT>, T const&, T&
+ >::type type;
};
typedef T ClassT::*mem_var_ptr_t;
typedef RT result_type;
typedef RT(ClassT::*mf)();
typedef RT(ClassT::*cmf)() const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT>
struct result { typedef result_type type; };
typedef RT result_type;
typedef RT(ClassT::*mf)(A);
typedef RT(ClassT::*cmf)(A) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT, typename A_>
struct result { typedef result_type type; };
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B);
typedef RT(ClassT::*cmf)(A, B) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT, typename A_, typename B_>
struct result { typedef result_type type; };
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C);
typedef RT(ClassT::*cmf)(A, B, C) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT, typename A_, typename B_, typename C_>
struct result { typedef result_type type; };
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D);
typedef RT(ClassT::*cmf)(A, B, C, D) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT,
typename A_, typename B_, typename C_, typename D_
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E);
typedef RT(ClassT::*cmf)(A, B, C, D, E) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT,
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT,
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT,
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT,
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT,
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT,
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT,
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT,
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT,
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT,
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT,
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)();
typedef RT(ClassT::*cmf)() const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename CT>
struct result { typedef result_type type; };
typedef RT result_type;
typedef RT(ClassT::*mf)(A);
typedef RT(ClassT::*cmf)(A) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename A_>
struct result { typedef result_type type; };
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B);
typedef RT(ClassT::*cmf)(A, B) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename A_, typename B_>
struct result { typedef result_type type; };
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C);
typedef RT(ClassT::*cmf)(A, B, C) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename A_, typename B_, typename C_>
struct result { typedef result_type type; };
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D);
typedef RT(ClassT::*cmf)(A, B, C, D) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename A_, typename B_, typename C_, typename D_>
struct result { typedef result_type type; };
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E);
typedef RT(ClassT::*cmf)(A, B, C, D, E) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <typename A_, typename B_, typename C_, typename D_,
typename E_
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <
typename A_, typename B_, typename C_, typename D_,
typedef RT result_type;
typedef RT(ClassT::*mf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O);
typedef RT(ClassT::*cmf)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) const;
- typedef char is_const[boost::is_const<ClassT>::value ? 1 : 2];
- typedef typename impl::if_t<is_const, cmf, mf>::type mem_func_ptr_t;
+ typedef typename boost::mpl::if_<boost::is_const<ClassT>, cmf, mf>::type
+ mem_func_ptr_t;
template <
typename A_, typename B_, typename C_, typename D_,
#ifdef PHOENIX_THREADSAFE
#include <boost/thread/tss.hpp>
+#include <boost/thread/once.hpp>
#endif
///////////////////////////////////////////////////////////////////////////////
typedef impl::closure_frame_holder<closure_frame_t> holder_t;
+#ifdef PHOENIX_THREADSAFE
+ static boost::thread_specific_ptr<holder_t*> &
+ tsp_frame_instance()
+ {
+ static boost::thread_specific_ptr<holder_t*> the_instance;
+ return the_instance;
+ }
+
+ static void
+ tsp_frame_instance_init()
+ {
+ tsp_frame_instance();
+ }
+#endif
+
static holder_t &
closure_frame_holder_ref(holder_t* holder_ = 0)
{
#ifdef PHOENIX_THREADSAFE
- static boost::thread_specific_ptr<holder_t*> tsp_frame;
+ static boost::once_flag been_here = BOOST_ONCE_INIT;
+ boost::call_once(tsp_frame_instance_init, been_here);
+ boost::thread_specific_ptr<holder_t*> &tsp_frame = tsp_frame_instance();
if (!tsp_frame.get())
tsp_frame.reset(new holder_t *(0));
holder_t *& holder = *tsp_frame;
new_()
{
typedef impl::make_composite<new_l_0<T> > make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(
- make_composite_t::composite_type(new_l_0<T>()));
+ return type_t(composite_type_t(new_l_0<T>()));
}
//////////////////////////////////
new_(A const& a)
{
typedef impl::make_composite<new_1<T>, A> make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(make_composite_t::composite_type(new_1<T>(),
+ return type_t(composite_type_t(new_1<T>(),
as_actor<A>::convert(a)
));
}
new_(A const& a, B const& b)
{
typedef impl::make_composite<new_2<T>, A, B> make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(make_composite_t::composite_type(new_2<T>(),
+ return type_t(composite_type_t(new_2<T>(),
as_actor<A>::convert(a),
as_actor<B>::convert(b)
));
new_(A const& a, B const& b, C const& c)
{
typedef impl::make_composite<new_3<T>, A, B, C> make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(make_composite_t::composite_type(new_3<T>(),
+ return type_t(composite_type_t(new_3<T>(),
as_actor<A>::convert(a),
as_actor<B>::convert(b),
as_actor<C>::convert(c)
typedef
impl::make_composite<new_4<T>, A, B, C, D>
make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(make_composite_t::composite_type(new_4<T>(),
+ return type_t(composite_type_t(new_4<T>(),
as_actor<A>::convert(a),
as_actor<B>::convert(b),
as_actor<C>::convert(c),
typedef
impl::make_composite<new_5<T>, A, B, C, D, E>
make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(make_composite_t::composite_type(new_5<T>(),
+ return type_t(composite_type_t(new_5<T>(),
as_actor<A>::convert(a),
as_actor<B>::convert(b),
as_actor<C>::convert(c),
typedef
impl::make_composite<new_6<T>, A, B, C, D, E, F>
make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(make_composite_t::composite_type(new_6<T>(),
+ return type_t(composite_type_t(new_6<T>(),
as_actor<A>::convert(a),
as_actor<B>::convert(b),
as_actor<C>::convert(c),
typedef
impl::make_composite<new_7<T>, A, B, C, D, E, F, G>
make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(make_composite_t::composite_type(new_7<T>(),
+ return type_t(composite_type_t(new_7<T>(),
as_actor<A>::convert(a),
as_actor<B>::convert(b),
as_actor<C>::convert(c),
typedef
impl::make_composite<new_8<T>, A, B, C, D, E, F, G, H>
make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(make_composite_t::composite_type(new_8<T>(),
+ return type_t(composite_type_t(new_8<T>(),
as_actor<A>::convert(a),
as_actor<B>::convert(b),
as_actor<C>::convert(c),
typedef
impl::make_composite<new_9<T>, A, B, C, D, E, F, G, H, I>
make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(make_composite_t::composite_type(new_9<T>(),
+ return type_t(composite_type_t(new_9<T>(),
as_actor<A>::convert(a),
as_actor<B>::convert(b),
as_actor<C>::convert(c),
new_10<T>, A, B, C, D, E, F, G, H, I, J
>
make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(make_composite_t::composite_type(new_10<T>(),
+ return type_t(composite_type_t(new_10<T>(),
as_actor<A>::convert(a),
as_actor<B>::convert(b),
as_actor<C>::convert(c),
new_11<T>, A, B, C, D, E, F, G, H, I, J, K
>
make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(make_composite_t::composite_type(new_11<T>(),
+ return type_t(composite_type_t(new_11<T>(),
as_actor<A>::convert(a),
as_actor<B>::convert(b),
as_actor<C>::convert(c),
new_12<T>, A, B, C, D, E, F, G, H, I, J, K, L
>
make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(make_composite_t::composite_type(new_12<T>(),
+ return type_t(composite_type_t(new_12<T>(),
as_actor<A>::convert(a),
as_actor<B>::convert(b),
as_actor<C>::convert(c),
new_13<T>, A, B, C, D, E, F, G, H, I, J, K, L, M
>
make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(make_composite_t::composite_type(new_13<T>(),
+ return type_t(composite_type_t(new_13<T>(),
as_actor<A>::convert(a),
as_actor<B>::convert(b),
as_actor<C>::convert(c),
new_14<T>, A, B, C, D, E, F, G, H, I, J, K, L, M, N
>
make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(make_composite_t::composite_type(new_14<T>(),
+ return type_t(composite_type_t(new_14<T>(),
as_actor<A>::convert(a),
as_actor<B>::convert(b),
as_actor<C>::convert(c),
new_15<T>, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O
>
make_composite_t;
+ typedef typename make_composite_t::type type_t;
+ typedef typename make_composite_t::composite_type composite_type_t;
- return make_composite_t::type(make_composite_t::composite_type(new_15<T>(),
+ return type_t(composite_type_t(new_15<T>(),
as_actor<A>::convert(a),
as_actor<B>::convert(b),
as_actor<C>::convert(c),
#include <boost/spirit/phoenix/actor.hpp>
#include <boost/spirit/phoenix/composite.hpp>
#include <boost/config.hpp>
+#include <boost/mpl/if.hpp>
///////////////////////////////////////////////////////////////////////////////
namespace phoenix {
///////////////////////////////////////////////////////////////////////////////
template <typename T0, typename T1>
struct higher_rank {
-
- enum {
-
- rank1 = rank<T0>::value,
- rank2 = rank<T1>::value,
-
-#if defined __BORLANDC__ && __BORLANDC__ >= 0x561
- siz = (rank<T0>::value < rank<T1>::value) ? 1 : 2
-#else
- siz = (rank1 < rank2) ? 1 : 2
-#endif
- };
-
- typedef char compare_rank[siz];
- typedef typename impl::if_t<compare_rank, T1, T0>::type type;
+ typedef typename boost::mpl::if_c<
+ rank<T0>::value < rank<T1>::value,
+ T1, T0>::type type;
};
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#include <memory> // for std::auto_ptr
+#include <boost/spirit/core/assert.hpp>
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit {
node_t** np = &root;
CharT ch = *first;
+ BOOST_SPIRIT_ASSERT(first == last || ch != 0
+ && "Won't add string containing null character");
+
for (;;)
{
if (*np == 0 || ch == 0)
}
}
++first;
- ch = (first == last) ? 0 : *first;
+ ch = (first == last) ? CharT(0) : *first;
+ BOOST_SPIRIT_ASSERT(first == last || ch != 0
+ && "Won't add string containing null character");
np = &(**np).middle.link;
}
else
while (np)
{
- if (ch < np->value)
+
+ if (ch < np->value) // => go left!
{
if (np->value == 0)
{
latest_len = result.length;
}
}
+
np = np->left;
}
- else
+ else if (ch == np->value) // => go middle!
{
- if (ch == np->value)
+ // Matching the null character is not allowed.
+ if (np->value == 0)
{
- if (scan.at_end())
+ result.data = np->middle.data;
+ if (result.data)
{
- result.data = np->middle.data;
- if (result.data)
- {
- latest = scan.first;
- latest_len = result.length;
- }
- break;
+ latest = scan.first;
+ latest_len = result.length;
}
-
- ++scan;
- ch = scan.at_end() ? 0 : *scan;
- np = np->middle.link;
- ++result.length;
+ break;
}
- else
+
+ ++scan;
+ ch = scan.at_end() ? CharT(0) : *scan;
+ np = np->middle.link;
+ ++result.length;
+ }
+ else // (ch > np->value) => go right!
+ {
+ if (np->value == 0)
{
- if (np->value == 0)
+ result.data = np->middle.data;
+ if (result.data)
{
- result.data = np->middle.data;
- if (result.data)
- {
- latest = scan.first;
- latest_len = result.length;
- }
+ latest = scan.first;
+ latest_len = result.length;
}
- np = np->right;
- }
+ }
+
+ np = np->right;
}
}
#include <cctype>
#include <boost/limits.hpp>
+#include <boost/spirit/debug.hpp>
+
#include <boost/spirit/utility/impl/escape_char.ipp>
///////////////////////////////////////////////////////////////////////////////
bool operator()(const CharT x, range<CharT> const& y) const
{ return x < y.first; }
+
+ // This additional operator is required for the checked STL shipped
+ // with VC8 testing the ordering of the iterators passed to the
+ // std::lower_bound algo this range_char_compare<> predicate is passed
+ // to.
+ bool operator()(range<CharT> const& x, range<CharT> const& y) const
+ { return x.first < y.first; }
};
//////////////////////////////////
#ifndef BOOST_SPIRIT_ESCAPE_CHAR_IPP
#define BOOST_SPIRIT_ESCAPE_CHAR_IPP
+#include <boost/spirit/core/parser.hpp>
+#include <boost/spirit/core/primitives/numerics.hpp>
+#include <boost/spirit/core/composite/difference.hpp>
+#include <boost/spirit/core/composite/sequence.hpp>
+
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit {
#include <boost/version.hpp>
#if BOOST_VERSION < 103200
-#error "Spirit V1.8.1 needs at least Boost V1.32.0 to compile successfully."
+#error "Spirit v1.8.x needs at least Boost V1.32.0 to compile successfully."
#endif
///////////////////////////////////////////////////////////////////////////////
// This is the version of the current Spirit distribution
//
///////////////////////////////////////////////////////////////////////////////
-#define SPIRIT_VERSION 0x1801
-#define SPIRIT_PIZZA_VERSION SPIRIT_FOUR_SEASONS // :-)
+#define SPIRIT_VERSION 0x1803
+#define SPIRIT_PIZZA_VERSION SPIRIT_DOUBLE_CHEESE // :-)
#endif // defined(SPIRIT_VERSION_HPP)
// style casts: too many compilers currently have problems with static_cast
// when used inside integral constant expressions.
//
-#if !defined(BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS) && \
- !BOOST_WORKAROUND(__MWERKS__, < 0x3003)
+#if !defined(BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS)
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
// __LINE__ macro broken when -ZI is used see Q199057
sizeof(::boost::STATIC_ASSERTION_FAILURE< \
BOOST_JOIN(boost_static_assert_test_, __LINE__) >)>\
BOOST_JOIN(boost_static_assert_typedef_, __LINE__)
+#elif BOOST_WORKAROUND(__MWERKS__, <= 0x3003)
+// special version for CodeWarrior <= 8.x
+#define BOOST_STATIC_ASSERT( B ) \
+ BOOST_STATIC_CONSTANT(int, \
+ BOOST_JOIN(boost_static_assert_test_, __LINE__) = \
+ sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) )
#else
// generic version
#define BOOST_STATIC_ASSERT( B ) \
--- /dev/null
+// (C) Copyright Gennadiy Rozental 2004-2005.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile: enable_warnings.hpp,v $
+//
+// Version : $Revision: 1.4 $
+//
+// Description : enable previosly suppressed warnings
+// ***************************************************************************
+
+#ifdef BOOST_MSVC
+# pragma warning(default: 4511) // copy constructor could not be generated
+# pragma warning(default: 4512) // assignment operator could not be generated
+# pragma warning(default: 4100) // unreferenced formal parameter
+# pragma warning(default: 4996) // <symbol> was declared deprecated
+# pragma warning(default: 4355) // 'this' : used in base member initializer list
+# pragma warning(default: 4706) // assignment within conditional expression
+# pragma warning(pop)
+#endif
+
+// ***************************************************************************
+// Revision History :
+//
+// $Log: enable_warnings.hpp,v $
+// Revision 1.4 2005/02/20 08:27:06 rogeeff
+// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
+//
+// Revision 1.3 2005/02/01 06:40:07 rogeeff
+// copyright update
+// old log entries removed
+// minor stilistic changes
+// depricated tools removed
+//
+// Revision 1.2 2005/01/31 06:00:37 rogeeff
+// deprecated std symbols warning suppressed
+//
+// ***************************************************************************
+++ /dev/null
-// (C) Copyright Gennadiy Rozental 2002-2003.
-// (C) Copyright Daryle Walker 2000-2001.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/libs/test for the library home page.
-//
-// File : $RCSfile: nullstream.hpp,v $
-//
-// Version : $Revision: 1.9 $
-//
-// Description : simulate /dev/null stream
-// ***************************************************************************
-
-#ifndef BOOST_NULLSTREAM_HPP_071894GER
-#define BOOST_NULLSTREAM_HPP_071894GER
-
-#include <ostream> // for std::basic_ostream
-#include <streambuf> // for std::basic_streambuf
-#include <string> // for std::char_traits
-
-#include <boost/utility/base_from_member.hpp>
-
-namespace boost {
-
-// ************************************************************************** //
-// ************** basic_nullbuf ************** //
-// ************************************************************************** //
-// Class for a buffer that reads nothing and writes to nothing.
-// Idea from an Usenet post by Tom <the_wid@my-deja.com> at
-// 27 Oct 2000 14:06:21 GMT on comp.lang.c++.
-
-template<typename CharType, class CharTraits = ::std::char_traits<CharType> >
-class basic_nullbuf : public ::std::basic_streambuf<CharType, CharTraits> {
- typedef ::std::basic_streambuf<CharType, CharTraits> base_type;
-public:
- // Types
- typedef typename base_type::char_type char_type;
- typedef typename base_type::traits_type traits_type;
- typedef typename base_type::int_type int_type;
- typedef typename base_type::pos_type pos_type;
- typedef typename base_type::off_type off_type;
-
- // Use automatic default constructor and destructor
-
-protected:
- // The default implementations of the miscellaneous virtual
- // member functions are sufficient.
-
- // The default implementations of the input & putback virtual
- // member functions, being nowhere but EOF, are sufficient.
-
- // The output virtual member functions need to be changed to
- // accept anything without any problems, instead of being at EOF.
- virtual ::std::streamsize xsputn( char_type const* /*s*/, ::std::streamsize n ) { return n; } // "s" is unused
- virtual int_type overflow( int_type c = traits_type::eof() ) { return traits_type::not_eof( c ); }
-};
-
-typedef basic_nullbuf<char> nullbuf;
-typedef basic_nullbuf<wchar_t> wnullbuf;
-
-// ************************************************************************** //
-// ************** basic_onullstream ************** //
-// ************************************************************************** //
-// Output streams based on basic_nullbuf.
-
-template< typename CharType, class CharTraits = ::std::char_traits<CharType> >
-class basic_onullstream : private boost::base_from_member<basic_nullbuf<CharType, CharTraits> >
- , public ::std::basic_ostream<CharType, CharTraits> {
- typedef boost::base_from_member<basic_nullbuf<CharType, CharTraits> > pbase_type;
- typedef ::std::basic_ostream<CharType, CharTraits> base_type;
-public:
- // Constructor
- basic_onullstream() : pbase_type(), base_type( &this->pbase_type::member ) {}
-};
-
-typedef basic_onullstream<char> onullstream;
-typedef basic_onullstream<wchar_t> wonullstream;
-
-} // namespace boost
-
-// ***************************************************************************
-// Revision History :
-//
-// $Log: nullstream.hpp,v $
-// Revision 1.9 2004/07/19 12:21:08 rogeeff
-// guard rename
-//
-// Revision 1.8 2004/05/21 06:19:35 rogeeff
-// licence update
-//
-// Revision 1.7 2003/12/01 00:41:56 rogeeff
-// prerelease cleaning
-//
-// ***************************************************************************
-
-#endif // BOOST_NULLSTREAM_HPP_071894GER
--- /dev/null
+// (C) Copyright Gennadiy Rozental 2004-2005.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile: suppress_warnings.hpp,v $
+//
+// Version : $Revision: 1.4 $
+//
+// Description : suppress some warnings
+// ***************************************************************************
+
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable: 4511) // copy constructor could not be generated
+# pragma warning(disable: 4512) // assignment operator could not be generated
+# pragma warning(disable: 4100) // unreferenced formal parameter
+# pragma warning(disable: 4996) // <symbol> was declared deprecated
+# pragma warning(disable: 4355) // 'this' : used in base member initializer list
+# pragma warning(disable: 4706) // assignment within conditional expression
+#endif
+
+// ***************************************************************************
+// Revision History :
+//
+// $Log: suppress_warnings.hpp,v $
+// Revision 1.4 2005/02/20 08:27:06 rogeeff
+// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
+//
+// Revision 1.3 2005/02/01 06:40:07 rogeeff
+// copyright update
+// old log entries removed
+// minor stilistic changes
+// depricated tools removed
+//
+// Revision 1.2 2005/01/31 06:00:37 rogeeff
+// deprecated std symbols warning suppressed
+//
+// ***************************************************************************
--- /dev/null
+// (C) Copyright Gennadiy Rozental 2002-2005.
+// (C) Copyright Daryle Walker 2000-2001.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/test for the library home page.
+//
+// File : $RCSfile: nullstream.hpp,v $
+//
+// Version : $Revision: 1.4 $
+//
+// Description : simulate /dev/null stream
+// ***************************************************************************
+
+#ifndef BOOST_NULLSTREAM_HPP_071894GER
+#define BOOST_NULLSTREAM_HPP_071894GER
+
+#include <ostream> // for std::basic_ostream
+#include <streambuf> // for std::basic_streambuf
+#include <string> // for std::char_traits
+
+#include <boost/utility/base_from_member.hpp>
+
+#include <boost/test/detail/suppress_warnings.hpp>
+
+//____________________________________________________________________________//
+
+namespace boost {
+
+// ************************************************************************** //
+// ************** basic_nullbuf ************** //
+// ************************************************************************** //
+// Class for a buffer that reads nothing and writes to nothing.
+// Idea from an Usenet post by Tom <the_wid@my-deja.com> at
+// 27 Oct 2000 14:06:21 GMT on comp.lang.c++.
+
+template<typename CharType, class CharTraits = ::std::char_traits<CharType> >
+class basic_nullbuf : public ::std::basic_streambuf<CharType, CharTraits> {
+ typedef ::std::basic_streambuf<CharType, CharTraits> base_type;
+public:
+ // Types
+ typedef typename base_type::char_type char_type;
+ typedef typename base_type::traits_type traits_type;
+ typedef typename base_type::int_type int_type;
+ typedef typename base_type::pos_type pos_type;
+ typedef typename base_type::off_type off_type;
+
+ // Use automatic default constructor and destructor
+
+protected:
+ // The default implementations of the miscellaneous virtual
+ // member functions are sufficient.
+
+ // The default implementations of the input & putback virtual
+ // member functions, being nowhere but EOF, are sufficient.
+
+ // The output virtual member functions need to be changed to
+ // accept anything without any problems, instead of being at EOF.
+ virtual ::std::streamsize xsputn( char_type const* /*s*/, ::std::streamsize n ) { return n; } // "s" is unused
+ virtual int_type overflow( int_type c = traits_type::eof() ) { return traits_type::not_eof( c ); }
+};
+
+typedef basic_nullbuf<char> nullbuf;
+typedef basic_nullbuf<wchar_t> wnullbuf;
+
+// ************************************************************************** //
+// ************** basic_onullstream ************** //
+// ************************************************************************** //
+// Output streams based on basic_nullbuf.
+
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable: 4355) // 'this' : used in base member initializer list
+#endif
+
+template< typename CharType, class CharTraits = ::std::char_traits<CharType> >
+class basic_onullstream : private boost::base_from_member<basic_nullbuf<CharType, CharTraits> >
+ , public ::std::basic_ostream<CharType, CharTraits> {
+ typedef boost::base_from_member<basic_nullbuf<CharType, CharTraits> > pbase_type;
+ typedef ::std::basic_ostream<CharType, CharTraits> base_type;
+public:
+ // Constructor
+ basic_onullstream() : pbase_type(), base_type( &this->pbase_type::member ) {}
+};
+
+#ifdef BOOST_MSVC
+# pragma warning(default: 4355)
+#endif
+
+typedef basic_onullstream<char> onullstream;
+typedef basic_onullstream<wchar_t> wonullstream;
+
+} // namespace boost
+
+//____________________________________________________________________________//
+
+#include <boost/test/detail/enable_warnings.hpp>
+
+// ***************************************************************************
+// Revision History :
+//
+// $Log: nullstream.hpp,v $
+// Revision 1.4 2005/02/20 08:27:08 rogeeff
+// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
+//
+// Revision 1.3 2005/02/01 06:40:07 rogeeff
+// copyright update
+// old log entries removed
+// minor stilistic changes
+// depricated tools removed
+//
+// Revision 1.2 2005/01/30 01:42:49 rogeeff
+// warnings suppressed
+//
+// Revision 1.1 2005/01/22 18:21:40 rogeeff
+// moved sharable staff into utils
+//
+// ***************************************************************************
+
+#endif // BOOST_NULLSTREAM_HPP_071894GER
#include "boost/type_traits/has_trivial_constructor.hpp"
#include "boost/type_traits/has_trivial_copy.hpp"
#include "boost/type_traits/has_trivial_destructor.hpp"
+#include "boost/type_traits/has_virtual_destructor.hpp"
+#include "boost/type_traits/is_signed.hpp"
+#include "boost/type_traits/is_unsigned.hpp"
#include "boost/type_traits/is_abstract.hpp"
#include "boost/type_traits/is_arithmetic.hpp"
#include "boost/type_traits/is_array.hpp"
#include "boost/type_traits/is_base_and_derived.hpp"
+#include "boost/type_traits/is_base_of.hpp"
#include "boost/type_traits/is_class.hpp"
#include "boost/type_traits/is_compound.hpp"
#include "boost/type_traits/is_const.hpp"
#include "boost/type_traits/is_empty.hpp"
#include "boost/type_traits/is_enum.hpp"
#include "boost/type_traits/is_float.hpp"
+#include "boost/type_traits/is_floating_point.hpp"
#include "boost/type_traits/is_function.hpp"
#include "boost/type_traits/is_fundamental.hpp"
#include "boost/type_traits/is_integral.hpp"
#include "boost/type_traits/is_member_function_pointer.hpp"
+#include "boost/type_traits/is_member_object_pointer.hpp"
#include "boost/type_traits/is_member_pointer.hpp"
#include "boost/type_traits/is_object.hpp"
#include "boost/type_traits/is_pod.hpp"
#include "boost/type_traits/is_union.hpp"
#include "boost/type_traits/is_void.hpp"
#include "boost/type_traits/is_volatile.hpp"
+#include "boost/type_traits/rank.hpp"
+#include "boost/type_traits/extent.hpp"
#include "boost/type_traits/remove_bounds.hpp"
+#include "boost/type_traits/remove_extent.hpp"
+#include "boost/type_traits/remove_all_extents.hpp"
#include "boost/type_traits/remove_const.hpp"
#include "boost/type_traits/remove_cv.hpp"
#include "boost/type_traits/remove_pointer.hpp"
#include "boost/type_traits/remove_volatile.hpp"
#include "boost/type_traits/type_with_alignment.hpp"
#include "boost/type_traits/function_traits.hpp"
+#include "boost/type_traits/aligned_storage.hpp"
#include "boost/type_traits/ice.hpp"
--- /dev/null
+
+// (C) John Maddock 2005.
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+//
+// See http://www.boost.org/libs/type_traits for most recent version including documentation.
+
+#ifndef BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED
+# define BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED
+# include <boost/aligned_storage.hpp>
+#endif // BOOST_TT_ALIGNED_STORAGE_HPP_INCLUDED
# define BOOST_TT_DECL /**/
#endif
-# if (defined(__MWERKS__) && __MWERKS__ >= 0x3000) || (defined(BOOST_MSVC) && (BOOST_MSVC > 1301)) || defined(__EDG_VERSION__) || (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__DMC__) || defined(BOOST_NO_COMPILER_CONFIG)
+# if (defined(__MWERKS__) && __MWERKS__ >= 0x3000) || (defined(BOOST_MSVC) && (BOOST_MSVC > 1301)) || defined(__EDG_VERSION__) || (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__DMC__) || ( defined(__IBMCPP__) && (__IBMCPP__ >= 600 ) ) || defined(BOOST_NO_COMPILER_CONFIG)
# define BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
#endif
+//
+// Define BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+// when we can't test for function types with elipsis:
+//
+#if defined(__GNUC__) && (__GNUC__ < 3)
+# define BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+#endif
+
+//
+// define BOOST_TT_TEST_MS_FUNC_SIGS
+// when we want to test __stdcall etc function types with is_function etc
+// (Note, does not work with Borland, even though it does support __stdcall etc):
+//
+#if defined(_MSC_EXTENSIONS) && !defined(__BORLANDC__)
+# define BOOST_TT_TEST_MS_FUNC_SIGS
+#endif
+
+//
+// define BOOST_TT_NO_CV_FUNC_TEST
+// if tests for cv-qualified member functions don't
+// work in is_member_function_pointer
+//
+#if (defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600)
+# define BOOST_TT_NO_CV_FUNC_TEST
+#endif
+
#endif // BOOST_TT_CONFIG_HPP_INCLUDED
// http://www.boost.org/LICENSE_1_0.txt)
// $Source: /cvsroot/boost/boost/boost/type_traits/detail/bool_trait_def.hpp,v $
-// $Date: 2004/09/02 15:41:27 $
-// $Revision: 1.16 $
+// $Date: 2005/03/16 12:22:22 $
+// $Revision: 1.18 $
#include <boost/type_traits/detail/template_arity_spec.hpp>
+#include <boost/type_traits/integral_constant.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
#include <boost/config.hpp>
-#if defined(__SUNPRO_CC)
+#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x570)
# define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
- typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::bool_< C > type; \
+ typedef ::boost::integral_constant<bool,C> type; \
enum { value = type::value }; \
/**/
# define BOOST_TT_AUX_BOOL_C_BASE(C)
#elif defined(BOOST_MSVC) && BOOST_MSVC <= 1200
# define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
- typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::bool_< C > base_; \
+ typedef ::boost::integral_constant<bool,C> base_; \
using base_::value; \
/**/
#endif
#ifndef BOOST_TT_AUX_BOOL_C_BASE
-# define BOOST_TT_AUX_BOOL_C_BASE(C) : BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::bool_< C >
+# define BOOST_TT_AUX_BOOL_C_BASE(C) : ::boost::integral_constant<bool,C>
#endif
BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,value) \
/**/
#endif
-
-#if 0 // there are true_type and false_type already in boost::
- // This also induces dependencies which may be undesirable
- // Let's wait until sometime not just before a release and clean
- // the whole ct_if mess up.
-# ifndef BOOST_TT_INTEGRAL_CONSTANT
-# define BOOST_TT_INTEGRAL_CONSTANT
-# include <boost/mpl/integral_c.hpp>
-
-//
-// this is not a TR1 conforming integral_constant,
-// but it is a first start:
-//
-
-namespace boost{
-
-template <class T, T val>
-struct integral_constant
-: public BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::integral_c<T,val> {};
-
-
-template<> struct integral_constant< bool, true > \
- BOOST_TT_AUX_BOOL_C_BASE(true) \
-{ \
- BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(true) \
- BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,integral_constant,(bool)) \
-};
-template<> struct integral_constant< bool, false > \
- BOOST_TT_AUX_BOOL_C_BASE(false) \
-{ \
- BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(false) \
- BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,integral_constant,(bool)) \
-};
-
-namespace pending {
-typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::true_ true_type;
-typedef BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::false_ false_type;
-}
-
-}
-
-# endif
-#endif
#define BOOST_TT_DETAIL_CV_TRAITS_IMPL_HPP_INCLUDED
#include "boost/config.hpp"
+#include "boost/detail/workaround.hpp"
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+// implementation helper:
+
+
+#if !(BOOST_WORKAROUND(__GNUC__,== 3) && (__GNUC_MINOR__ <= 2))
namespace boost {
namespace detail {
-
-// implementation helper:
+#else
+#include "boost/type_traits/detail/yes_no_type.hpp"
+namespace boost {
+namespace type_traits {
+namespace gcc8503 {
+#endif
template <typename T> struct cv_traits_imp {};
typedef T unqualified_type;
};
+#if BOOST_WORKAROUND(__GNUC__,== 3) && BOOST_WORKAROUND(__GNUC_MINOR__, <= 2)
+// We have to exclude function pointers
+// (see http://gcc.gnu.org/bugzilla/show_bug.cgi?8503)
+yes_type mini_funcptr_tester(...);
+no_type mini_funcptr_tester(const volatile void*);
+
+} // namespace gcc8503
+} // namespace type_traits
+
+namespace detail {
+
+// Use the implementation above for non function pointers
+template <typename T, unsigned Select
+ = (unsigned)sizeof(::boost::type_traits::gcc8503::mini_funcptr_tester((T)0)) >
+struct cv_traits_imp : ::boost::type_traits::gcc8503::cv_traits_imp<T> { };
+
+// Functions are never cv-qualified
+template <typename T> struct cv_traits_imp<T*,1>
+{
+ BOOST_STATIC_CONSTANT(bool, is_const = false);
+ BOOST_STATIC_CONSTANT(bool, is_volatile = false);
+ typedef T unqualified_type;
+};
+
+#endif
+
} // namespace detail
} // namespace boost
#if !defined(BOOST_TT_PREPROCESSING_MODE)
// preprocessor-generated part, don't edit by hand!
-template <class R>
-struct is_function_ptr_helper<R (*)()> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0>
-struct is_function_ptr_helper<R (*)(T0)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1>
-struct is_function_ptr_helper<R (*)(T0,T1)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2>
-struct is_function_ptr_helper<R (*)(T0,T1,T2)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21,class T22>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21,class T22,class T23>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
-template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21,class T22,class T23,class T24>
-struct is_function_ptr_helper<R (*)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24)> { BOOST_STATIC_CONSTANT(bool,value = true); };
-
+template <class R >
+struct is_function_ptr_helper<R (*)()> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R >
+struct is_function_ptr_helper<R (*)( ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0>
+struct is_function_ptr_helper<R (*)( T0)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0>
+struct is_function_ptr_helper<R (*)( T0 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1>
+struct is_function_ptr_helper<R (*)( T0 , T1)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1>
+struct is_function_ptr_helper<R (*)( T0 , T1 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24>
+struct is_function_ptr_helper<R (*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
#else
#undef BOOST_STATIC_CONSTANT
///// iteration
#else
-#define i BOOST_PP_FRAME_ITERATION(1)
-
-template <class R BOOST_PP_COMMA_IF(i) BOOST_PP_ENUM_PARAMS(i,class T)>
-struct is_function_ptr_helper<R (*)(BOOST_PP_ENUM_PARAMS(i,T))> { BOOST_STATIC_CONSTANT(bool, value = true); };
-
-#undef i
+#define BOOST_PP_COUNTER BOOST_PP_FRAME_ITERATION(1)
+
+template <class R BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T)>
+struct is_function_ptr_helper<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T))> { BOOST_STATIC_CONSTANT(bool, value = true); };
+@#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T)>
+struct is_function_ptr_helper<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...)> { BOOST_STATIC_CONSTANT(bool, value = true); };
+@#endif
+#undef BOOST_PP_COUNTER
#endif // BOOST_PP_IS_ITERATING
};
#if !defined(BOOST_TT_PREPROCESSING_MODE)
-// preprocessor-generated part, don't edit by hand!
+// pre-processed code, don't edit, try GNU cpp with
+// cpp -I../../../ -DBOOST_TT_PREPROCESSING_MODE -x c++ -P filename
-template <class R, class T >
+template <class R, class T >
struct is_mem_fun_pointer_impl<R (T::*)() > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T >
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T >
+struct is_mem_fun_pointer_impl<R (T::*)( ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T >
struct is_mem_fun_pointer_impl<R (T::*)() const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T >
+
+template <class R, class T >
struct is_mem_fun_pointer_impl<R (T::*)() volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T >
+
+template <class R, class T >
struct is_mem_fun_pointer_impl<R (T::*)() const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T >
+struct is_mem_fun_pointer_impl<R (T::*)( ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T >
+struct is_mem_fun_pointer_impl<R (T::*)( ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T >
+struct is_mem_fun_pointer_impl<R (T::*)( ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0>
struct is_mem_fun_pointer_impl<R (T::*)( T0) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0>
struct is_mem_fun_pointer_impl<R (T::*)( T0) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0>
+
+template <class R, class T , class T0>
struct is_mem_fun_pointer_impl<R (T::*)( T0) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0>
+
+template <class R, class T , class T0>
struct is_mem_fun_pointer_impl<R (T::*)( T0) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1>
+
+template <class R, class T , class T0 , class T1>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1>
+
+template <class R, class T , class T0 , class T1>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2>
+
+template <class R, class T , class T0 , class T1 , class T2>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2>
+
+template <class R, class T , class T0 , class T1 , class T2>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#endif
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+#endif
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24) > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24>
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
+
+#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24>
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24>
struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T , class T0 , class T1 , class T2 , class T3 , class T4 , class T5 , class T6 , class T7 , class T8 , class T9 , class T10 , class T11 , class T12 , class T13 , class T14 , class T15 , class T16 , class T17 , class T18 , class T19 , class T20 , class T21 , class T22 , class T23 , class T24>
+struct is_mem_fun_pointer_impl<R (T::*)( T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+#endif
#endif
#else
///// iteration
#else
-#define i BOOST_PP_FRAME_ITERATION(1)
+#define BOOST_PP_COUNTER BOOST_PP_FRAME_ITERATION(1)
-template <class R, class T BOOST_PP_COMMA_IF(i) BOOST_PP_ENUM_PARAMS(i,class T)>
-struct is_mem_fun_pointer_impl<R (T::*)(BOOST_PP_ENUM_PARAMS(i,T)) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T)>
+struct is_mem_fun_pointer_impl<R (T::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T)) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+@#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T)>
+struct is_mem_fun_pointer_impl<R (T::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...) > { BOOST_STATIC_CONSTANT(bool, value = true); };
+@#endif
-// Metrowerks and Visual Age think this creates ambiguities
-/// #if !((defined(__MWERKS__) && __MWERKS__ < 0x3000) || (defined(__IBMCPP__) && __IBMCPP__ <= 600))
-template <class R, class T BOOST_PP_COMMA_IF(i) BOOST_PP_ENUM_PARAMS(i,class T)>
-struct is_mem_fun_pointer_impl<R (T::*)(BOOST_PP_ENUM_PARAMS(i,T)) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
+@#if !defined(BOOST_TT_NO_CV_FUNC_TEST)
+template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T)>
+struct is_mem_fun_pointer_impl<R (T::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T)) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T BOOST_PP_COMMA_IF(i) BOOST_PP_ENUM_PARAMS(i,class T)>
-struct is_mem_fun_pointer_impl<R (T::*)(BOOST_PP_ENUM_PARAMS(i,T)) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T)>
+struct is_mem_fun_pointer_impl<R (T::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T)) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-template <class R, class T BOOST_PP_COMMA_IF(i) BOOST_PP_ENUM_PARAMS(i,class T)>
-struct is_mem_fun_pointer_impl<R (T::*)(BOOST_PP_ENUM_PARAMS(i,T)) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
-/// #endif
+template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T)>
+struct is_mem_fun_pointer_impl<R (T::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T)) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+@#ifndef BOOST_TT_NO_ELLIPSIS_IN_FUNC_TESTING
+template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T)>
+struct is_mem_fun_pointer_impl<R (T::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...) const > { BOOST_STATIC_CONSTANT(bool, value = true); };
-#undef i
+template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T)>
+struct is_mem_fun_pointer_impl<R (T::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...) volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+
+template <class R, class T BOOST_PP_COMMA_IF(BOOST_PP_COUNTER) BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,class T)>
+struct is_mem_fun_pointer_impl<R (T::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_COUNTER,T) ...) const volatile > { BOOST_STATIC_CONSTANT(bool, value = true); };
+@#endif
+@#endif
+
+#undef BOOST_PP_COUNTER
#endif // BOOST_PP_IS_ITERATING
+
// http://www.boost.org/LICENSE_1_0.txt)
// $Source: /cvsroot/boost/boost/boost/type_traits/detail/size_t_trait_def.hpp,v $
-// $Date: 2004/09/02 15:41:27 $
-// $Revision: 1.7 $
+// $Date: 2005/01/30 15:47:45 $
+// $Revision: 1.8 $
#include <boost/type_traits/detail/template_arity_spec.hpp>
-#include <boost/mpl/size_t.hpp>
+#include <boost/type_traits/integral_constant.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/mpl/size_t.hpp>
#include <cstddef>
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1200
+# define BOOST_TT_AUX_SIZE_T_BASE(C) ::boost::integral_constant<std::size_t,C>
# define BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) /**/
#else
+# define BOOST_TT_AUX_SIZE_T_BASE(C) ::boost::mpl::size_t<C>
# define BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) \
- typedef mpl::size_t< C > base_; \
+ typedef ::boost::mpl::size_t<C> base_; \
using base_::value; \
/**/
#endif
#define BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(trait,T,C) \
template< typename T > struct trait \
- : mpl::size_t< C > \
+ : BOOST_TT_AUX_SIZE_T_BASE(C) \
{ \
BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) \
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \
#define BOOST_TT_AUX_SIZE_T_TRAIT_SPEC1(trait,spec,C) \
template<> struct trait<spec> \
- : mpl::size_t< C > \
+ : BOOST_TT_AUX_SIZE_T_BASE(C) \
{ \
BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) \
BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(spec)) \
#define BOOST_TT_AUX_SIZE_T_TRAIT_PARTIAL_SPEC1_1(param,trait,spec,C) \
template< param > struct trait<spec> \
- : mpl::size_t< C > \
+ : BOOST_TT_AUX_SIZE_T_BASE(C) \
{ \
}; \
/**/
--- /dev/null
+
+// (C) Copyright John Maddock 2005.
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+//
+// See http://www.boost.org/libs/type_traits for most recent version including documentation.
+
+
+#ifndef BOOST_TT_EXTENT_HPP_INCLUDED
+#define BOOST_TT_EXTENT_HPP_INCLUDED
+
+// should be the last #include
+#include "boost/type_traits/detail/size_t_trait_def.hpp"
+
+namespace boost {
+
+namespace detail{
+
+template <class T, std::size_t N>
+struct extent_imp
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = 0);
+};
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
+template <class T, std::size_t R, std::size_t N>
+struct extent_imp<T[R], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
+};
+
+template <class T, std::size_t R, std::size_t N>
+struct extent_imp<T const[R], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
+};
+
+template <class T, std::size_t R, std::size_t N>
+struct extent_imp<T volatile[R], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
+};
+
+template <class T, std::size_t R, std::size_t N>
+struct extent_imp<T const volatile[R], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
+};
+
+template <class T, std::size_t R>
+struct extent_imp<T[R],0>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = R);
+};
+
+template <class T, std::size_t R>
+struct extent_imp<T const[R], 0>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = R);
+};
+
+template <class T, std::size_t R>
+struct extent_imp<T volatile[R], 0>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = R);
+};
+
+template <class T, std::size_t R>
+struct extent_imp<T const volatile[R], 0>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = R);
+};
+
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840)) && !defined(__MWERKS__)
+template <class T, std::size_t N>
+struct extent_imp<T[], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
+};
+template <class T, std::size_t N>
+struct extent_imp<T const[], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
+};
+template <class T, std::size_t N>
+struct extent_imp<T volatile[], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
+};
+template <class T, std::size_t N>
+struct extent_imp<T const volatile[], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::extent_imp<T, N-1>::value));
+};
+template <class T>
+struct extent_imp<T[], 0>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = 0);
+};
+template <class T>
+struct extent_imp<T const[], 0>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = 0);
+};
+template <class T>
+struct extent_imp<T volatile[], 0>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = 0);
+};
+template <class T>
+struct extent_imp<T const volatile[], 0>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = 0);
+};
+#endif
+#endif
+}
+
+template <class T, std::size_t N = 0>
+struct extent
+ : public ::boost::integral_constant<std::size_t, ::boost::detail::extent_imp<T,N>::value>
+{
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
+ typedef ::boost::integral_constant<std::size_t, ::boost::detail::extent_imp<T,N>::value> base_;
+ using base_::value;
+#endif
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,extent,(T))
+};
+
+} // namespace boost
+
+#include "boost/type_traits/detail/size_t_trait_undef.hpp"
+
+#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
namespace boost {
-BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_assign,T,::boost::has_trivial_assign<T>::value)
+namespace detail{
+
+template <class T>
+struct has_nothrow_assign_imp{
+ BOOST_STATIC_CONSTANT(bool, value =
+ (::boost::type_traits::ice_or<
+ ::boost::has_trivial_assign<T>::value,
+ BOOST_HAS_NOTHROW_ASSIGN(T)
+ >::value));
+};
+
+}
+
+BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_assign,T,::boost::detail::has_nothrow_assign_imp<T>::value)
} // namespace boost
namespace boost {
-BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_constructor,T,::boost::has_trivial_constructor<T>::value)
+namespace detail{
+
+template <class T>
+struct has_nothrow_constructor_imp{
+ BOOST_STATIC_CONSTANT(bool, value =
+ (::boost::type_traits::ice_or<
+ ::boost::has_trivial_constructor<T>::value,
+ BOOST_HAS_NOTHROW_CONSTRUCTOR(T)
+ >::value));
+};
+
+}
+
+BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_constructor,T,::boost::detail::has_nothrow_constructor_imp<T>::value)
} // namespace boost
namespace boost {
-BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_copy,T,::boost::has_trivial_copy<T>::value)
+namespace detail{
+
+template <class T>
+struct has_nothrow_copy_imp{
+ BOOST_STATIC_CONSTANT(bool, value =
+ (::boost::type_traits::ice_or<
+ ::boost::has_trivial_copy<T>::value,
+ BOOST_HAS_NOTHROW_COPY(T)
+ >::value));
+};
+
+}
+
+BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_copy,T,::boost::detail::has_nothrow_copy_imp<T>::value)
} // namespace boost
--- /dev/null
+
+// (C) Copyright John Maddock 2005.
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+//
+// See http://www.boost.org/libs/type_traits for most recent version including documentation.
+
+
+#ifndef BOOST_TT_HAS_VIRTUAL_DESTRUCTOR_HPP_INCLUDED
+#define BOOST_TT_HAS_VIRTUAL_DESTRUCTOR_HPP_INCLUDED
+
+#include <boost/type_traits/intrinsics.hpp>
+// should be the last #include
+#include "boost/type_traits/detail/bool_trait_def.hpp"
+
+namespace boost {
+
+BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_virtual_destructor,T,BOOST_HAS_VIRTUAL_DESTRUCTOR(T))
+
+} // namespace boost
+
+#include "boost/type_traits/detail/bool_trait_undef.hpp"
+
+#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
--- /dev/null
+// (C) Copyright John Maddock 2005.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_TYPE_TRAITS_INTEGRAL_CONSTANT_HPP
+#define BOOST_TYPE_TRAITS_INTEGRAL_CONSTANT_HPP
+
+#include <boost/config.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/integral_c.hpp>
+
+namespace boost{
+
+#if defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) || defined(__BORLANDC__)
+template <class T, int val>
+#else
+template <class T, T val>
+#endif
+struct integral_constant : public mpl::integral_c<T, val>
+{
+ //BOOST_STATIC_CONSTANT(T, value = val);
+ //typedef T value_type;
+ typedef integral_constant<T,val> type;
+
+#if 0
+ //
+ // everything that follows now, is MPL-compatibility code:
+ //
+ typedef ::boost::mpl::integral_c_tag tag;
+
+ // have to #ifdef here: some compilers don't like the 'val + 1' form (MSVC),
+ // while some other don't like 'value + 1' (Borland), and some don't like
+ // either
+#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243)
+private:
+ BOOST_STATIC_CONSTANT(T, next_value = BOOST_MPL_AUX_STATIC_CAST(T, (val + 1)));
+ BOOST_STATIC_CONSTANT(T, prior_value = BOOST_MPL_AUX_STATIC_CAST(T, (val - 1)));
+public:
+ typedef integral_constant<T,next_value> next;
+ typedef integral_constant<T,prior_value> prior;
+#elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \
+ || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \
+ || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800))
+ typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (val + 1)) )> next;
+ typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (val - 1)) )> prior;
+#else
+ typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (value + 1)) )> next;
+ typedef integral_constant<T, ( BOOST_MPL_AUX_STATIC_CAST(T, (value - 1)) )> prior;
+#endif
+
+ // enables uniform function call syntax for families of overloaded
+ // functions that return objects of both arithmetic ('int', 'long',
+ // 'double', etc.) and wrapped integral types (for an example, see
+ // "mpl/example/power.cpp")
+ operator T() const { return static_cast<T>(this->value); }
+#endif
+};
+
+template<> struct integral_constant<bool,true> : public mpl::true_
+{
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
+ typedef mpl::true_ base_;
+ using base_::value;
+#endif
+ typedef integral_constant<bool,true> type;
+};
+template<> struct integral_constant<bool,false> : public mpl::false_
+{
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
+ typedef mpl::false_ base_;
+ using base_::value;
+#endif
+ typedef integral_constant<bool,false> type;
+};
+
+typedef integral_constant<bool,true> true_type;
+typedef integral_constant<bool,false> false_type;
+
+}
+
+#endif
// BOOST_HAS_TRIVIAL_COPY(T) should evaluate to true if T(t) <==> memcpy
// BOOST_HAS_TRIVIAL_ASSIGN(T) should evaluate to true if t = u <==> memcpy
// BOOST_HAS_TRIVIAL_DESTRUCTOR(T) should evaluate to true if ~T() has no effect
+// BOOST_HAS_NOTHROW_CONSTRUCTOR(T) should evaluate to true if "T x;" can not throw
+// BOOST_HAS_NOTHROW_COPY(T) should evaluate to true if T(t) can not throw
+// BOOST_HAS_NOTHROW_ASSIGN(T) should evaluate to true if t = u can not throw
+// BOOST_HAS_VIRTUAL_DESTRUCTOR(T) should evaluate to true T has a virtual destructor
#ifdef BOOST_HAS_SGI_TYPE_TRAITS
// Hook into SGI's __type_traits class, this will pick up user supplied
# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
#endif
+#if defined(BOOST_MSVC) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >=140050215)
+# define BOOST_IS_UNION(T) __is_union(T)
+# define BOOST_IS_POD(T) __is_pod(T)
+# define BOOST_IS_EMPTY(T) __is_empty(T)
+# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
+# define BOOST_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T)
+# define BOOST_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T)
+# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
+# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T)
+# define BOOST_HAS_NOTHROW_COPY(T) __has_nothrow_copy(T)
+# define BOOST_HAS_NOTHROW_ASSIGN(T) __has_nothrow_assign(T)
+# define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
+# define BOOST_HAS_TYPE_TRAITS_INTRINSICS
+#endif
+
+
#ifndef BOOST_IS_UNION
# define BOOST_IS_UNION(T) false
#endif
# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) false
#endif
+#ifndef BOOST_HAS_NOTHROW_CONSTRUCTOR
+# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) false
+#endif
+
+#ifndef BOOST_HAS_NOTHROW_COPY
+# define BOOST_HAS_NOTHROW_COPY(T) false
+#endif
+
+#ifndef BOOST_HAS_NOTHROW_ASSIGN
+# define BOOST_HAS_NOTHROW_ASSIGN(T) false
+#endif
+
+#ifndef BOOST_HAS_VIRTUAL_DESTRUCTOR
+# define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) false
+#endif
+
#endif // BOOST_TT_INTRINSICS_HPP_INCLUDED
// (starting with submission #10).
// - Jan 2004: GCC 3.4 fixed to suport DR337 (Giovanni Bajo).
// - Jan 2004: modified to be part of Boost.TypeTraits (Pavel Vozenilek).
+// - Nov 2004: Christoph Ludwig found that the implementation did not work with
+// template types and gcc-3.4 or VC7.1, fix due to Christoph Ludwig
+// and John Maddock.
+// - Dec 2004: Added new config macro BOOST_NO_IS_ABSTRACT which causes the template
+// to degrade gracefully, rather than trash the compiler (John Maddock).
//
+#include <boost/static_assert.hpp>
#include <boost/type_traits/detail/yes_no_type.hpp>
#include <boost/type_traits/is_class.hpp>
#include "boost/type_traits/detail/ice_and.hpp"
+#ifdef BOOST_NO_IS_ABSTRACT
+#include <boost/type_traits/is_polymorphic.hpp>
+#endif
// should be the last #include
#include "boost/type_traits/detail/bool_trait_def.hpp"
namespace boost {
namespace detail{
+#ifndef BOOST_NO_IS_ABSTRACT
template<class T>
-struct is_abstract_imp
+struct is_abstract_imp2
{
// Deduction fails if T is void, function type,
// reference type (14.8.2/2)or an abstract class type
static type_traits::no_type check_sig(U (*)[1]);
template<class U>
static type_traits::yes_type check_sig(...);
+ //
+ // T must be a complete type, further if T is a template then
+ // it must be instantiated in order for us to get the right answer:
+ //
+ BOOST_STATIC_ASSERT(sizeof(T) != 0);
// GCC2 won't even parse this template if we embed the computation
// of s1 in the computation of value.
#ifdef __GNUC__
- BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(is_abstract_imp<T>::template check_sig<T>(0)));
+ BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(is_abstract_imp2<T>::template check_sig<T>(0)));
#else
BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(check_sig<T>(0)));
#endif
BOOST_STATIC_CONSTANT(bool, value =
- (::boost::type_traits::ice_and<
- ::boost::is_class<T>::value,
- (s1 == sizeof(type_traits::yes_type))
- >::value));
+ (s1 == sizeof(type_traits::yes_type)));
+};
+
+template <bool v>
+struct is_abstract_select
+{
+ template <class T>
+ struct rebind
+ {
+ typedef is_abstract_imp2<T> type;
+ };
+};
+template <>
+struct is_abstract_select<false>
+{
+ template <class T>
+ struct rebind
+ {
+ typedef false_type type;
+ };
};
+template <class T>
+struct is_abstract_imp
+{
+ typedef is_abstract_select< ::boost::is_class<T>::value> selector;
+ typedef typename selector::template rebind<T> binder;
+ typedef typename binder::type type;
+
+ BOOST_STATIC_CONSTANT(bool, value = type::value);
+};
+
+#endif
}
+#ifndef BOOST_NO_IS_ABSTRACT
BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_abstract,T,::boost::detail::is_abstract_imp<T>::value)
+#else
+BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_abstract,T,::boost::detail::is_polymorphic_imp<T>::value)
+#endif
} // namespace boost
template <typename B, typename D>
struct bd_helper
{
+ //
+ // This VC7.1 specific workaround stops the compiler from generating
+ // an internal compiler error when compiling with /vmg (thanks to
+ // Aleksey Gurtovoy for figuring out the workaround).
+ //
+#if !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
template <typename T>
static type_traits::yes_type check_sig(D const volatile *, T);
static type_traits::no_type check_sig(B const volatile *, int);
+#else
+ static type_traits::yes_type check_sig(D const volatile *, long);
+ static type_traits::no_type check_sig(B const volatile * const&, int);
+#endif
};
template<typename B, typename D>
{
struct Host
{
+#if !BOOST_WORKAROUND(BOOST_MSVC, == 1310)
operator B const volatile *() const;
+#else
+ operator B const volatile * const&() const;
+#endif
operator D const volatile *();
};
--- /dev/null
+
+// (C) Copyright Rani Sharoni 2003-2005.
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+//
+// See http://www.boost.org/libs/type_traits for most recent version including documentation.
+
+#ifndef BOOST_TT_IS_BASE_OF_HPP_INCLUDED
+#define BOOST_TT_IS_BASE_OF_HPP_INCLUDED
+
+#include "boost/type_traits/is_base_and_derived.hpp"
+
+// should be the last #include
+#include "boost/type_traits/detail/bool_trait_def.hpp"
+
+namespace boost {
+
+BOOST_TT_AUX_BOOL_TRAIT_DEF2(
+ is_base_of
+ , Base
+ , Derived
+ , (::boost::detail::is_base_and_derived_impl<Base,Derived>::value)
+ )
+
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived,false)
+BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base,Derived&,false)
+BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived&,false)
+#endif
+
+} // namespace boost
+
+#include "boost/type_traits/detail/bool_trait_undef.hpp"
+
+#endif // BOOST_TT_IS_BASE_AND_DERIVED_HPP_INCLUDED
#include "boost/type_traits/is_array.hpp"
#include "boost/type_traits/add_reference.hpp"
#include "boost/type_traits/ice.hpp"
+#include "boost/type_traits/is_arithmetic.hpp"
+#ifndef BOOST_NO_IS_ABSTRACT
+#include "boost/type_traits/is_abstract.hpp"
+#endif
#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1300)
# include "boost/type_traits/is_void.hpp"
};
#elif (defined(__EDG_VERSION__) && (__EDG_VERSION__ >= 245) && !defined(__ICL)) \
- || defined(__IBMCPP__)
+ || defined(__IBMCPP__) || defined(__HP_aCC)
//
// This is *almost* an ideal world implementation as it doesn't rely
// on undefined behaviour by passing UDT's through (...).
};
#endif
+template <bool trivial1, bool trivial2, bool abstract_target>
+struct is_convertible_impl_select
+{
+ template <class From, class To>
+ struct rebind
+ {
+ typedef is_convertible_impl<From, To> type;
+ };
+};
+
+template <>
+struct is_convertible_impl_select<true, true, false>
+{
+ template <class From, class To>
+ struct rebind
+ {
+ typedef true_type type;
+ };
+};
+
+template <>
+struct is_convertible_impl_select<false, false, true>
+{
+ template <class From, class To>
+ struct rebind
+ {
+ typedef false_type type;
+ };
+};
+
+template <>
+struct is_convertible_impl_select<true, false, true>
+{
+ template <class From, class To>
+ struct rebind
+ {
+ typedef false_type type;
+ };
+};
+
+template <typename From, typename To>
+struct is_convertible_impl_dispatch_base
+{
+#ifndef __HP_aCC
+ typedef is_convertible_impl_select<
+ ::boost::is_arithmetic<From>::value,
+ ::boost::is_arithmetic<To>::value,
+#ifndef BOOST_NO_IS_ABSTRACT
+ ::boost::is_abstract<To>::value
+#else
+ false
+#endif
+ > selector;
+#else
+ typedef is_convertible_impl_select<false, false, false> selector;
+#endif
+ typedef typename selector::template rebind<From, To> isc_binder;
+ typedef typename isc_binder::type type;
+};
+
+template <typename From, typename To>
+struct is_convertible_impl_dispatch
+ : public is_convertible_impl_dispatch_base<From, To>::type
+{};
+
//
// Now add the full and partial specialisations
// for void types, these are common to all the
} // namespace detail
-BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,(::boost::detail::is_convertible_impl<From,To>::value))
-
-
-#if defined(__GNUC__)
-
-// Declare specializations of is_convertible for all of the floating
-// types to all of the integral types. This suppresses some nasty
-// warnings
-
-# define TT_AUX_IS_CONVERTIBLE_SPEC(T1,T2) \
- BOOST_TT_AUX_BOOL_TRAIT_SPEC2(is_convertible,T1,T2,true) \
- /**/
-
-# define TT_AUX_IS_CONVERTIBLE_SPEC_2(T1,T2) \
- TT_AUX_IS_CONVERTIBLE_SPEC(T1,signed T2) \
- TT_AUX_IS_CONVERTIBLE_SPEC(T1,unsigned T2) \
- /**/
-
-# define TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_SPEC(F) \
- TT_AUX_IS_CONVERTIBLE_SPEC(F,char) \
- TT_AUX_IS_CONVERTIBLE_SPEC_2(F,char) \
- TT_AUX_IS_CONVERTIBLE_SPEC_2(F,short) \
- TT_AUX_IS_CONVERTIBLE_SPEC_2(F,int) \
- TT_AUX_IS_CONVERTIBLE_SPEC_2(F,long) \
- TT_AUX_IS_CONVERTIBLE_SPEC(F,::boost::long_long_type) \
- TT_AUX_IS_CONVERTIBLE_SPEC(F,::boost::ulong_long_type) \
- /**/
-
-# define TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(F) \
- TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_SPEC(F) \
- TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_SPEC(F const) \
- TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_SPEC(F volatile) \
- TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_SPEC(F const volatile) \
- /**/
-
-TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(float)
-TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(double)
-TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC(long double)
-
-# undef TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_CV_SPEC
-# undef TT_AUX_IS_CONVERTIBLE_FROM_FLOAT_SPEC
-# undef TT_AUX_IS_CONVERTIBLE_SPEC_2
-# undef TT_AUX_IS_CONVERTIBLE_SPEC
-
-#endif // __GNUC__
+BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_convertible,From,To,(::boost::detail::is_convertible_impl_dispatch<From,To>::value))
} // namespace boost
#include "boost/type_traits/is_arithmetic.hpp"
#include "boost/type_traits/is_reference.hpp"
#include "boost/type_traits/is_convertible.hpp"
+#include "boost/type_traits/is_array.hpp"
#ifdef __GNUC__
#include <boost/type_traits/is_function.hpp>
#endif
struct is_enum_helper<false>
{
template <typename T> struct type
- : ::boost::is_convertible<T,::boost::detail::int_convertible>
+ : ::boost::is_convertible<typename boost::add_reference<T>::type,::boost::detail::int_convertible>
{
};
};
template <typename T> struct is_enum_impl
{
- typedef ::boost::add_reference<T> ar_t;
- typedef typename ar_t::type r_type;
+ //typedef ::boost::add_reference<T> ar_t;
+ //typedef typename ar_t::type r_type;
#if defined(__GNUC__)
#ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
+
+ // We MUST check for is_class_or_union on conforming compilers in
+ // order to correctly deduce that noncopyable types are not enums
+ // (dwa 2002/04/15)...
BOOST_STATIC_CONSTANT(bool, selector =
(::boost::type_traits::ice_or<
::boost::is_arithmetic<T>::value
, ::boost::is_reference<T>::value
, ::boost::is_function<T>::value
, is_class_or_union<T>::value
+ , is_array<T>::value
>::value));
#else
+ // ...however, not checking is_class_or_union on non-conforming
+ // compilers prevents a dependency recursion.
BOOST_STATIC_CONSTANT(bool, selector =
(::boost::type_traits::ice_or<
::boost::is_arithmetic<T>::value
, ::boost::is_reference<T>::value
, ::boost::is_function<T>::value
+ , is_array<T>::value
>::value));
#endif // BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
-#else
+#else // !defined(__GNUC__):
+
BOOST_STATIC_CONSTANT(bool, selector =
(::boost::type_traits::ice_or<
::boost::is_arithmetic<T>::value
, ::boost::is_reference<T>::value
, is_class_or_union<T>::value
- // However, not doing this on non-conforming compilers prevents
- // a dependency recursion.
+ , is_array<T>::value
>::value));
+
#endif
#if BOOST_WORKAROUND(__BORLANDC__, < 0x600)
typedef ::boost::detail::is_enum_helper<selector> se_t;
#endif
- typedef typename se_t::template type<r_type> helper;
+ typedef typename se_t::template type<T> helper;
BOOST_STATIC_CONSTANT(bool, value = helper::value);
};
--- /dev/null
+
+// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000-2005.
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+//
+// See http://www.boost.org/libs/type_traits for most recent version including documentation.
+
+#ifndef BOOST_TYPE_TRAITS_IS_FLOATING_HPP_INCLUDED
+#define BOOST_TYPE_TRAITS_IS_FLOATING_HPP_INCLUDED
+
+// should be the last #include
+#include "boost/type_traits/detail/bool_trait_def.hpp"
+
+namespace boost {
+
+//* is a type T a floating-point type described in the standard (3.9.1p8)
+BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_floating_point,T,false)
+BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_floating_point,float,true)
+BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_floating_point,double,true)
+BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(is_floating_point,long double,true)
+
+} // namespace boost
+
+#include "boost/type_traits/detail/bool_trait_undef.hpp"
+
+#endif // BOOST_TYPE_TRAITS_IS_FLOAT_HPP_INCLUDED
#include "boost/type_traits/detail/false_result.hpp"
#include "boost/config.hpp"
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
# include "boost/type_traits/detail/is_function_ptr_helper.hpp"
#else
# include "boost/type_traits/detail/is_function_ptr_tester.hpp"
namespace boost {
namespace detail {
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
template<bool is_ref = true>
struct is_function_chooser
: ::boost::type_traits::false_result
);
};
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+template <typename T>
+struct is_function_impl<T&> : public false_type
+{};
+#endif
+
#endif
} // namespace detail
#include "boost/type_traits/config.hpp"
#include "boost/detail/workaround.hpp"
-#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__BORLANDC__, < 0x600)
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
+ && !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
+ //
+ // Note: we use the "workaround" version for MSVC because it works for
+ // __stdcall etc function types, where as the partial specialisation
+ // version does not do so.
+ //
# include "boost/type_traits/detail/is_mem_fun_pointer_impl.hpp"
#else
# include "boost/type_traits/is_reference.hpp"
# include "boost/type_traits/is_array.hpp"
-# include "boost/type_traits/detail/is_mem_fun_pointer_tester.hpp"
# include "boost/type_traits/detail/yes_no_type.hpp"
# include "boost/type_traits/detail/false_result.hpp"
# include "boost/type_traits/detail/ice_or.hpp"
+# include "boost/type_traits/detail/is_mem_fun_pointer_tester.hpp"
#endif
// should be the last #include
namespace boost {
-#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__BORLANDC__, < 0x600)
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS)
BOOST_TT_AUX_BOOL_TRAIT_DEF1(
is_member_function_pointer
{
template <typename T> struct result_
{
- static T& make_t;
+ static T* make_t;
typedef result_<T> self_type;
BOOST_STATIC_CONSTANT(
{
};
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+template <typename T>
+struct is_member_function_pointer_impl<T&> : public false_type{};
+#endif
+
#else // Borland C++
template <typename T>
struct is_member_function_pointer_impl
{
- static T& m_t;
+ static T* m_t;
BOOST_STATIC_CONSTANT(
bool, value =
(1 == sizeof(type_traits::is_mem_fun_pointer_tester(m_t))) );
--- /dev/null
+
+// (C) Copyright John Maddock 2005.
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+//
+// See http://www.boost.org/libs/type_traits for most recent version including documentation.
+
+
+#ifndef BOOST_TT_IS_MEMBER_OBJECT_POINTER_HPP_INCLUDED
+#define BOOST_TT_IS_MEMBER_OBJECT_POINTER_HPP_INCLUDED
+
+#include "boost/type_traits/config.hpp"
+#include "boost/type_traits/is_member_pointer.hpp"
+#include "boost/type_traits/is_member_function_pointer.hpp"
+#include "boost/type_traits/detail/ice_and.hpp"
+#include "boost/type_traits/detail/ice_not.hpp"
+
+// should be the last #include
+#include "boost/type_traits/detail/bool_trait_def.hpp"
+
+namespace boost {
+
+namespace detail{
+
+template <typename T>
+struct is_member_object_pointer_impl
+{
+ BOOST_STATIC_CONSTANT(
+ bool, value = (::boost::type_traits::ice_and<
+ ::boost::is_member_pointer<T>::value,
+ ::boost::type_traits::ice_not<
+ ::boost::is_member_function_pointer<T>::value
+ >::value
+ >::value ));
+};
+
+} // namespace detail
+
+BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_object_pointer,T,::boost::detail::is_member_object_pointer_impl<T>::value)
+
+} // namespace boost
+
+#include "boost/type_traits/detail/bool_trait_undef.hpp"
+
+#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
namespace detail {
template <typename R, typename T>
-::boost::type_traits::yes_type BOOST_TT_DECL is_member_pointer_tester(R T::*);
+::boost::type_traits::yes_type BOOST_TT_DECL is_member_pointer_tester(R T::*const volatile*);
::boost::type_traits::no_type BOOST_TT_DECL is_member_pointer_tester(...);
template <bool>
{
template <typename T> struct result_
{
- static T& make_t();
+ static T* make_t();
BOOST_STATIC_CONSTANT(
bool, value =
(::boost::type_traits::ice_or<
# include "boost/type_traits/detail/wrap.hpp"
#endif
-#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && defined(BOOST_MSVC)
-# include "boost/type_traits/detail/is_function_type_tester.hpp"
-# include "boost/type_traits/detail/false_result.hpp"
-#endif
-
// should be the last #include
#include "boost/type_traits/detail/bool_trait_def.hpp"
--- /dev/null
+
+// (C) Copyright John Maddock 2005.
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+//
+// See http://www.boost.org/libs/type_traits for most recent version including documentation.
+
+
+#ifndef BOOST_TT_IS_SIGNED_HPP_INCLUDED
+#define BOOST_TT_IS_SIGNED_HPP_INCLUDED
+
+#include "boost/type_traits/is_integral.hpp"
+#include "boost/type_traits/is_enum.hpp"
+#include "boost/type_traits/detail/ice_or.hpp"
+
+// should be the last #include
+#include "boost/type_traits/detail/bool_trait_def.hpp"
+
+namespace boost {
+
+namespace detail{
+
+#if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238)
+
+template <class T>
+struct is_signed_helper
+{
+ BOOST_STATIC_CONSTANT(bool, value = (static_cast<T>(-1) < 0));
+};
+
+template <bool integral_type>
+struct is_signed_select_helper
+{
+ template <class T>
+ struct rebind
+ {
+ typedef is_signed_helper<T> type;
+ };
+};
+
+template <>
+struct is_signed_select_helper<false>
+{
+ template <class T>
+ struct rebind
+ {
+ typedef false_type type;
+ };
+};
+
+template <class T>
+struct is_signed_imp
+{
+ typedef is_signed_select_helper<
+ ::boost::type_traits::ice_or<
+ ::boost::is_integral<T>::value,
+ ::boost::is_enum<T>::value>::value
+ > selector;
+ typedef typename selector::template rebind<T> binder;
+ typedef typename binder::type type;
+#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1200)
+ BOOST_STATIC_CONSTANT(bool, value = is_signed_imp<T>::type::value);
+#else
+ BOOST_STATIC_CONSTANT(bool, value = type::value);
+#endif
+};
+
+#else
+
+template <class T> struct is_signed_imp : public false_type{};
+template <> struct is_signed_imp<signed char> : public true_type{};
+template <> struct is_signed_imp<const signed char> : public true_type{};
+template <> struct is_signed_imp<volatile signed char> : public true_type{};
+template <> struct is_signed_imp<const volatile signed char> : public true_type{};
+template <> struct is_signed_imp<short> : public true_type{};
+template <> struct is_signed_imp<const short> : public true_type{};
+template <> struct is_signed_imp<volatile short> : public true_type{};
+template <> struct is_signed_imp<const volatile short> : public true_type{};
+template <> struct is_signed_imp<int> : public true_type{};
+template <> struct is_signed_imp<const int> : public true_type{};
+template <> struct is_signed_imp<volatile int> : public true_type{};
+template <> struct is_signed_imp<const volatile int> : public true_type{};
+template <> struct is_signed_imp<long> : public true_type{};
+template <> struct is_signed_imp<const long> : public true_type{};
+template <> struct is_signed_imp<volatile long> : public true_type{};
+template <> struct is_signed_imp<const volatile long> : public true_type{};
+#ifdef BOOST_HAS_LONG_LONG
+template <> struct is_signed_imp<long long> : public true_type{};
+template <> struct is_signed_imp<const long long> : public true_type{};
+template <> struct is_signed_imp<volatile long long> : public true_type{};
+template <> struct is_signed_imp<const volatile long long> : public true_type{};
+#endif
+#if defined(CHAR_MIN) && (CHAR_MIN != 0)
+template <> struct is_signed_imp<char> : public true_type{};
+template <> struct is_signed_imp<const char> : public true_type{};
+template <> struct is_signed_imp<volatile char> : public true_type{};
+template <> struct is_signed_imp<const volatile char> : public true_type{};
+#endif
+#if defined(WCHAR_MIN) && (WCHAR_MIN != 0)
+template <> struct is_signed_imp<wchar_t> : public true_type{};
+template <> struct is_signed_imp<const wchar_t> : public true_type{};
+template <> struct is_signed_imp<volatile wchar_t> : public true_type{};
+template <> struct is_signed_imp<const volatile wchar_t> : public true_type{};
+#endif
+
+#endif
+
+}
+
+BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_signed,T,::boost::detail::is_signed_imp<T>::value)
+
+} // namespace boost
+
+#include "boost/type_traits/detail/bool_trait_undef.hpp"
+
+#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
--- /dev/null
+
+// (C) Copyright John Maddock 2005.
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+//
+// See http://www.boost.org/libs/type_traits for most recent version including documentation.
+
+
+#ifndef BOOST_TT_IS_UNSIGNED_HPP_INCLUDED
+#define BOOST_TT_IS_UNSIGNED_HPP_INCLUDED
+
+#include "boost/type_traits/is_integral.hpp"
+#include "boost/type_traits/is_enum.hpp"
+#include "boost/type_traits/detail/ice_or.hpp"
+
+// should be the last #include
+#include "boost/type_traits/detail/bool_trait_def.hpp"
+
+namespace boost {
+
+namespace detail{
+
+#if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238)
+
+template <class T>
+struct is_ununsigned_helper
+{
+ BOOST_STATIC_CONSTANT(bool, value = (static_cast<T>(-1) > 0));
+};
+
+template <bool integral_type>
+struct is_ununsigned_select_helper
+{
+ template <class T>
+ struct rebind
+ {
+ typedef is_ununsigned_helper<T> type;
+ };
+};
+
+template <>
+struct is_ununsigned_select_helper<false>
+{
+ template <class T>
+ struct rebind
+ {
+ typedef false_type type;
+ };
+};
+
+template <class T>
+struct is_unsigned_imp
+{
+ typedef is_ununsigned_select_helper<
+ ::boost::type_traits::ice_or<
+ ::boost::is_integral<T>::value,
+ ::boost::is_enum<T>::value>::value
+ > selector;
+ typedef typename selector::template rebind<T> binder;
+ typedef typename binder::type type;
+ BOOST_STATIC_CONSTANT(bool, value = type::value);
+};
+
+#else
+
+template <class T> struct is_unsigned_imp : public false_type{};
+template <> struct is_unsigned_imp<unsigned char> : public true_type{};
+template <> struct is_unsigned_imp<const unsigned char> : public true_type{};
+template <> struct is_unsigned_imp<volatile unsigned char> : public true_type{};
+template <> struct is_unsigned_imp<const volatile unsigned char> : public true_type{};
+template <> struct is_unsigned_imp<unsigned short> : public true_type{};
+template <> struct is_unsigned_imp<const unsigned short> : public true_type{};
+template <> struct is_unsigned_imp<volatile unsigned short> : public true_type{};
+template <> struct is_unsigned_imp<const volatile unsigned short> : public true_type{};
+template <> struct is_unsigned_imp<unsigned int> : public true_type{};
+template <> struct is_unsigned_imp<const unsigned int> : public true_type{};
+template <> struct is_unsigned_imp<volatile unsigned int> : public true_type{};
+template <> struct is_unsigned_imp<const volatile unsigned int> : public true_type{};
+template <> struct is_unsigned_imp<unsigned long> : public true_type{};
+template <> struct is_unsigned_imp<const unsigned long> : public true_type{};
+template <> struct is_unsigned_imp<volatile unsigned long> : public true_type{};
+template <> struct is_unsigned_imp<const volatile unsigned long> : public true_type{};
+#ifdef BOOST_HAS_LONG_LONG
+template <> struct is_unsigned_imp<unsigned long long> : public true_type{};
+template <> struct is_unsigned_imp<const unsigned long long> : public true_type{};
+template <> struct is_unsigned_imp<volatile unsigned long long> : public true_type{};
+template <> struct is_unsigned_imp<const volatile unsigned long long> : public true_type{};
+#endif
+#if defined(CHAR_MIN) && (CHAR_MIN == 0)
+template <> struct is_unsigned_imp<char> : public true_type{};
+template <> struct is_unsigned_imp<const char> : public true_type{};
+template <> struct is_unsigned_imp<volatile char> : public true_type{};
+template <> struct is_unsigned_imp<const volatile char> : public true_type{};
+#endif
+#if defined(WCHAR_MIN) && (WCHAR_MIN == 0)
+template <> struct is_unsigned_imp<wchar_t> : public true_type{};
+template <> struct is_unsigned_imp<const wchar_t> : public true_type{};
+template <> struct is_unsigned_imp<volatile wchar_t> : public true_type{};
+template <> struct is_unsigned_imp<const volatile wchar_t> : public true_type{};
+#endif
+
+#endif
+
+
+}
+
+BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_unsigned,T,::boost::detail::is_unsigned_imp<T>::value)
+
+} // namespace boost
+
+#include "boost/type_traits/detail/bool_trait_undef.hpp"
+
+#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
--- /dev/null
+
+// (C) Copyright John Maddock 2005.
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+//
+// See http://www.boost.org/libs/type_traits for most recent version including documentation.
+
+
+#ifndef BOOST_TT_RANK_HPP_INCLUDED
+#define BOOST_TT_RANK_HPP_INCLUDED
+
+// should be the last #include
+#include "boost/type_traits/detail/size_t_trait_def.hpp"
+
+namespace boost {
+
+namespace detail{
+
+template <class T, std::size_t N>
+struct rank_imp
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = N);
+};
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
+template <class T, std::size_t R, std::size_t N>
+struct rank_imp<T[R], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
+};
+
+template <class T, std::size_t R, std::size_t N>
+struct rank_imp<T const[R], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
+};
+
+template <class T, std::size_t R, std::size_t N>
+struct rank_imp<T volatile[R], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
+};
+
+template <class T, std::size_t R, std::size_t N>
+struct rank_imp<T const volatile[R], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
+};
+
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840))
+template <class T, std::size_t N>
+struct rank_imp<T[], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
+};
+template <class T, std::size_t N>
+struct rank_imp<T const[], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
+};
+template <class T, std::size_t N>
+struct rank_imp<T volatile[], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
+};
+template <class T, std::size_t N>
+struct rank_imp<T const volatile[], N>
+{
+ BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::rank_imp<T, N+1>::value));
+};
+#endif
+#endif
+}
+
+BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(rank,T,(::boost::detail::rank_imp<T,0>::value))
+
+} // namespace boost
+
+#include "boost/type_traits/detail/size_t_trait_undef.hpp"
+
+#endif // BOOST_TT_IS_MEMBER_FUNCTION_POINTER_HPP_INCLUDED
--- /dev/null
+
+// (C) Copyright John Maddock 2005.
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+//
+// See http://www.boost.org/libs/type_traits for most recent version including documentation.
+
+#ifndef BOOST_TT_REMOVE_ALL_EXTENTS_HPP_INCLUDED
+#define BOOST_TT_REMOVE_ALL_EXTENTS_HPP_INCLUDED
+
+#include "boost/config.hpp"
+#include <cstddef>
+
+// should be the last #include
+#include "boost/type_traits/detail/type_trait_def.hpp"
+
+namespace boost {
+
+BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_all_extents,T,T)
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T[N],typename boost::remove_all_extents<T>::type type)
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T const[N],typename boost::remove_all_extents<T const>::type type)
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T volatile[N],typename boost::remove_all_extents<T volatile>::type type)
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_all_extents,T const volatile[N],typename boost::remove_all_extents<T const volatile>::type type)
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840))
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T[],typename boost::remove_all_extents<T>::type)
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T const[],typename boost::remove_all_extents<T const>::type)
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T volatile[],typename boost::remove_all_extents<T volatile>::type)
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_all_extents,T const volatile[],typename boost::remove_all_extents<T const volatile>::type)
+#endif
+#endif
+
+} // namespace boost
+
+#include "boost/type_traits/detail/type_trait_undef.hpp"
+
+#endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED
--- /dev/null
+
+// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000-2005.
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+//
+// See http://www.boost.org/libs/type_traits for most recent version including documentation.
+
+#ifndef BOOST_TT_REMOVE_EXTENT_HPP_INCLUDED
+#define BOOST_TT_REMOVE_EXTENT_HPP_INCLUDED
+
+#include "boost/config.hpp"
+#include <cstddef>
+
+// should be the last #include
+#include "boost/type_traits/detail/type_trait_def.hpp"
+
+namespace boost {
+
+BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_extent,T,T)
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T[N],T type)
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T const[N],T const type)
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T volatile[N],T volatile type)
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_extent,T const volatile[N],T const volatile type)
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840))
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T[],T)
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T const[],T const)
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T volatile[],T volatile)
+BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_extent,T const volatile[],T const volatile)
+#endif
+#endif
+
+} // namespace boost
+
+#include "boost/type_traits/detail/type_trait_undef.hpp"
+
+#endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED
+++ /dev/null
-// (C) Copyright John Maddock 2000.
-// Use, modification and distribution are subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt).
-//
-// See http://www.boost.org/libs/type_traits for most recent version including documentation.
-
-
-// common test code for type-traits tests
-// WARNING: contains code as well as declarations!
-
-
-#ifndef BOOST_TYPE_TRAITS_TEST_HPP
-#define BOOST_TYPE_TRAITS_TEST_HPP
-
-#include "boost/config.hpp"
-#include "boost/utility.hpp"
-#include "boost/type_traits/alignment_of.hpp"
-#include "boost/type_traits/type_with_alignment.hpp"
-#include "boost/type_traits/ice.hpp"
-
-#include <iostream>
-#include <typeinfo>
-
-//
-// define tests here
-unsigned failures = 0;
-unsigned test_count = 0;
-//
-// This must get defined within the test file.
-// All compilers have bugs, set this to the number of
-// regressions *expected* from a given compiler,
-// if there are no workarounds for the bugs, *and*
-// the regressions have been investigated.
-//
-extern unsigned int expected_failures;
-//
-// proc check_result()
-// Checks that there were no regressions:
-//
-int check_result(int argc, char** argv)
-{
- std::cout << test_count << " tests completed, "
- << failures << " failures found, "
- << expected_failures << " failures expected from this compiler." << std::endl;
- if((argc == 2)
- && (argv[1][0] == '-')
- && (argv[1][1] == 'a')
- && (argv[1][2] == 0))
- {
- std::cout << "Press any key to continue...";
- std::cin.get();
- }
- return (failures == expected_failures)
- ? 0
- : (failures != 0) ? static_cast<int>(failures) : -1;
-}
-
-
-//
-// this one is to verify that a constant is indeed a
-// constant-integral-expression:
-//
-// HP aCC cannot deal with missing names for template value parameters
-template <bool b>
-struct checker
-{
- static void check(bool, bool, const char*, bool){ ++test_count; }
-};
-
-template <>
-struct checker<false>
-{
- static void check(bool o, bool n, const char* name, bool soft)
- {
- ++test_count;
- ++failures;
- // if this is a soft test, then failure is expected,
- // or may depend upon factors outside our control
- // (like compiler options)...
- if(soft)++expected_failures;
- std::cout << "checking value of " << name << "...failed" << std::endl;
- std::cout << "\tfound: " << n << " expected " << o << std::endl;
- }
-};
-
-template <class T>
-struct typify{};
-
-template <class T, class U>
-struct type_checker
-{
- static void check(const char* TT, const char*, const char* expression)
- {
- ++test_count;
- if(typeid(typify<T>) != typeid(typify<U>))
- {
- ++failures;
- std::cout << "checking type of " << expression << "...failed" << std::endl;
- std::cout << " evaluating: type_checker<" << TT << "," << expression << ">" << std::endl;
- std::cout << " expected: type_checker<" << TT << "," << TT << ">" << std::endl;
- std::cout << " but got: " << typeid(type_checker<T,U>).name() << std::endl;
- }
- }
-};
-
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-template <class T>
-struct type_checker<T,T>
-{
- static void check(const char*, const char*, const char*)
- {
- ++test_count;
- }
-};
-#endif
-
-
-#define value_test(v, x) checker<(v == x)>::check(v, x, #x, false);
-#define soft_value_test(v, x) checker<(v == x)>::check(v, x, #x, true);
-
-#define value_fail(v, x) \
- ++test_count; \
- ++failures; \
- ++expected_failures;\
- std::cout << "checking value of " << #x << "...failed" << std::endl; \
- std::cout << " " #x " does not compile on this compiler" << std::endl;
-
-
-#define type_test(v, x) type_checker<v,x>::check(#v, #x, #x);
-#define type_test3(v, x, z) type_checker<v,x,z>::check(#v, #x "," #z, #x "," #z);
-#ifndef SHORT_TRANSFORM_TEST
-#define transform_check(name, from_suffix, to_suffix)\
- type_test(bool to_suffix, name<bool from_suffix>::type);\
- type_test(char to_suffix, name<char from_suffix>::type);\
- type_test(wchar_t to_suffix, name<wchar_t from_suffix>::type);\
- type_test(signed char to_suffix, name<signed char from_suffix>::type);\
- type_test(unsigned char to_suffix, name<unsigned char from_suffix>::type);\
- type_test(short to_suffix, name<short from_suffix>::type);\
- type_test(unsigned short to_suffix, name<unsigned short from_suffix>::type);\
- type_test(int to_suffix, name<int from_suffix>::type);\
- type_test(unsigned int to_suffix, name<unsigned int from_suffix>::type);\
- type_test(long to_suffix, name<long from_suffix>::type);\
- type_test(unsigned long to_suffix, name<unsigned long from_suffix>::type);\
- type_test(float to_suffix, name<float from_suffix>::type);\
- type_test(long double to_suffix, name<long double from_suffix>::type);\
- type_test(double to_suffix, name<double from_suffix>::type);\
- type_test(UDT to_suffix, name<UDT from_suffix>::type);\
- type_test(enum1 to_suffix, name<enum1 from_suffix>::type);
-#else
-#define transform_check(name, from_suffix, to_suffix)\
- type_test(int to_suffix, name<int from_suffix>::type);\
- type_test(UDT to_suffix, name<UDT from_suffix>::type);\
- type_test(enum1 to_suffix, name<enum1 from_suffix>::type);
-#endif
-
-#define boost_dummy_macro_param
-
-template <class T>
-struct test_align
-{
- struct padded
- {
- char c;
- T t;
- };
-
- static void do_it()
- {
- padded p;
- unsigned a = reinterpret_cast<char*>(&(p.t)) - reinterpret_cast<char*>(&p);
- ++test_count;
- // only fail if we do not have a multiple of the actual value:
- if((a > ::boost::alignment_of<T>::value) || (a % ::boost::alignment_of<T>::value))
- {
- ++failures;
- std::cout << "checking value of " << typeid(boost::alignment_of<T>).name() << "...failed" << std::endl;
- std::cout << "\tfound: " << boost::alignment_of<T>::value << " expected " << a << std::endl;
- }
- // suppress warnings about unused variables:
- not_unused(p);
- not_unused(a);
- }
-
- template <class U>
- static void not_unused(U const&) {}
-};
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-template <class T>
-struct test_align<T&>
-{
- static void do_it()
- {
- //
- // we can't do the usual test because we can't take the address
- // of a reference, so check that the result is the same as for a
- // pointer type instead:
- unsigned a = boost::alignment_of<T*>::value;
- ++test_count;
- if(a != boost::alignment_of<T&>::value)
- {
- ++failures;
- std::cout << "checking value of " << typeid(boost::alignment_of<T&>).name() << "...failed" << std::endl;
- std::cout << "\tfound: " << boost::alignment_of<T&>::value << " expected " << a << std::endl;
- }
- }
-};
-#endif
-
-#define align_test(T) test_align<T>::do_it()
-
-template<class T>
-struct test_type_with_align
-{
- typedef typename boost::type_with_alignment<
- (boost::alignment_of<T>::value)>::type
- align_t;
-
- static void do_it()
- {
- int align = boost::alignment_of<T>::value;
- int new_align = boost::alignment_of<align_t>::value;
- ++test_count;
- if (new_align % align != 0) {
- ++failures;
- std::cerr << "checking for an object with same alignment as "
- << typeid(T).name() << "...failed" << std::endl;
- std::cerr << "\tfound: " << typeid(align_t).name() << std::endl;
- }
- }
-};
-
-#define type_with_align_test(T) test_type_with_align<T>::do_it()
-
-//
-// the following code allows us to test that a particular
-// template functions correctly when instanciated inside another template
-// (some bugs only show up in that situation). For each template
-// we declare one NESTED_DECL(classname) that sets up the template class
-// and multiple NESTED_TEST(classname, template-arg) declarations, to carry
-// the actual tests:
-template <bool b>
-struct nested_test
-{
- typedef nested_test type;
- bool run_time_value;
- const char* what;
- nested_test(bool b2, const char* w) : run_time_value(b2), what(w) { check(); }
- void check()
- {
- ++test_count;
- if(b != run_time_value)
- {
- ++failures;
- std::cerr << "Mismatch between runtime and compile time values in " << what << std::endl;
- }
- }
-};
-
-#ifndef __SUNPRO_CC
-#define NESTED_DECL(what)\
-template <class T> \
-struct BOOST_TT_JOIN(nested_tester_,what){\
- nested_test< (::boost::type_traits::ice_ne<0, ::boost::what<T>::value>::value)> tester;\
- BOOST_TT_JOIN(nested_tester_,what)(const char* s) : tester(::boost::what<T>::value, s){}\
-};
-#define NESTED_TEST(what, with)\
-{BOOST_TT_JOIN(nested_tester_,what)<with> check(#what "<" #with ">"); (void)check;}
-#else
-#define NESTED_DECL(what)
-#define NESTED_TEST(what, with)
-#endif
-
-#define BOOST_TT_JOIN( X, Y ) BOOST_DO_TT_JOIN( X, Y )
-#define BOOST_DO_TT_JOIN( X, Y ) X##Y
-
-
-
-//
-// define some types to test with:
-//
-enum enum_UDT{ one, two, three };
-struct UDT
-{
- UDT(){};
- ~UDT(){};
- UDT(const UDT&);
- UDT& operator=(const UDT&);
- int i;
-
- void f1();
- int f2();
- int f3(int);
- int f4(int, float);
-};
-
-typedef void(*f1)();
-typedef int(*f2)(int);
-typedef int(*f3)(int, bool);
-typedef void (UDT::*mf1)();
-typedef int (UDT::*mf2)();
-typedef int (UDT::*mf3)(int);
-typedef int (UDT::*mf4)(int, float);
-typedef int (UDT::*mp);
-typedef int (UDT::*cmf)(int) const;
-
-// cv-qualifiers applied to reference types should have no effect
-// declare these here for later use with is_reference and remove_reference:
-# ifdef BOOST_MSVC
-# pragma warning(push)
-# pragma warning(disable: 4181)
-# elif defined(__ICL)
-# pragma warning(push)
-# pragma warning(disable: 21)
-# endif
-//
-// This is intentional:
-// r_type and cr_type should be the same type
-// but some compilers wrongly apply cv-qualifiers
-// to reference types (this may generate a warning
-// on some compilers):
-//
-typedef int& r_type;
-typedef const r_type cr_type;
-# ifdef BOOST_MSVC
-# pragma warning(pop)
-# elif defined(__ICL)
-# pragma warning(pop)
-# pragma warning(disable: 985) // identifier truncated in debug information
-# endif
-
-struct POD_UDT { int x; };
-struct empty_UDT
-{
- ~empty_UDT(){};
- empty_UDT& operator=(const empty_UDT&){ return *this; }
- bool operator==(const empty_UDT&)const
- { return true; }
-};
-struct empty_POD_UDT
-{
- empty_POD_UDT& operator=(const empty_POD_UDT&){ return *this; }
- bool operator==(const empty_POD_UDT&)const
- { return true; }
-};
-union union_UDT
-{
- int x;
- double y;
- ~union_UDT();
-};
-union POD_union_UDT
-{
- int x;
- double y;
-};
-union empty_union_UDT
-{
- ~empty_union_UDT();
-};
-union empty_POD_union_UDT{};
-
-class Base { };
-
-class Derived : public Base { };
-
-class NonDerived { };
-
-enum enum1
-{
- one_,two_
-};
-
-enum enum2
-{
- three_,four_
-};
-
-struct VB
-{
- virtual ~VB(){};
-};
-
-struct VD : VB
-{
- ~VD(){};
-};
-//
-// struct non_pointer:
-// used to verify that is_pointer does not return
-// true for class types that implement operator void*()
-//
-struct non_pointer
-{
- operator void*(){return this;}
-};
-struct non_int_pointer
-{
- int i;
- operator int*(){return &i;}
-};
-struct int_constructible
-{
- int_constructible(int);
-};
-struct int_convertible
-{
- operator int();
-};
-//
-// struct non_empty:
-// used to verify that is_empty does not emit
-// spurious warnings or errors.
-//
-struct non_empty : private boost::noncopyable
-{
- int i;
-};
-//
-// abstract base classes:
-struct test_abc1
-{
- virtual void foo() = 0;
- virtual void foo2() = 0;
-};
-
-struct test_abc2
-{
- virtual void foo() = 0;
- virtual void foo2() = 0;
-};
-
-struct incomplete_type;
-
-
-#endif // BOOST_TYPE_TRAITS_TEST_HPP
# include <boost/config.hpp>
# include <boost/detail/workaround.hpp>
-# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
-# include <boost/type_traits/add_pointer.hpp>
-# endif
namespace boost {
// VC7 strips const from nested classes unless we add indirection here
# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
-template <typename T> typename add_pointer<T>::type
+
+template<class T> struct _addp
+{
+ typedef T * type;
+};
+
+template <typename T> typename _addp<T>::type
+
# else
template <typename T> T*
# endif
&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
}
+// Borland doesn't like casting an array reference to a char reference
+// but these overloads work around the problem.
+# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
+template<typename T,std::size_t N>
+T (*addressof(T (&t)[N]))[N]
+{
+ return reinterpret_cast<T(*)[N]>(&t);
+}
+
+template<typename T,std::size_t N>
+const T (*addressof(const T (&t)[N]))[N]
+{
+ return reinterpret_cast<const T(*)[N]>(&t);
+}
+# endif
+
}
#endif // BOOST_UTILITY_ADDRESSOF_HPP
// BOOST_VERSION / 100 % 1000 is the minor version
// BOOST_VERSION / 100000 is the major version
-#define BOOST_VERSION 103200
+#define BOOST_VERSION 103301
//
// BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
// number and y is the minor version number. This is used by
// <config/auto_link.hpp> to select which library version to link to.
-#define BOOST_LIB_VERSION "1_32"
+#define BOOST_LIB_VERSION "1_33_1"
#endif
+
+
// the library is being built (possibly exporting rather than importing code)
#define BOOST_FILESYSTEM_SOURCE
+#define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect,
+#define __USE_FILE_OFFSET64 // but that is harmless on Windows and on POSIX
+ // 64-bit systems or on 32-bit systems which don't have files larger
+ // than can be represented by a traditional POSIX/UNIX off_t type.
+ // OTOH, defining them should kick in 64-bit off_t's (and thus
+ // st_size) on 32-bit systems that provide the Large File
+ // Support (LFS) interface, such as Linux, Solaris, and IRIX.
+ // The defines are given before any headers are included to
+ // ensure that they are available to all included headers.
+ // That is required at least on Solaris, and possibly on other
+ // systems as well.
+
#include <boost/filesystem/config.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/exception.hpp>
#include <boost/scoped_array.hpp>
#include <boost/throw_exception.hpp>
#include <boost/detail/workaround.hpp>
-#include <cstring>
-
-#ifdef BOOST_NO_STDC_NAMESPACE
-namespace std { using ::strcmp; using ::remove; using ::rename; }
-#endif
namespace fs = boost::filesystem;
# if defined(BOOST_WINDOWS)
# include "windows.h"
-
- //////////////////////////////////////////////////////////////////////
- //
- // Enable Boost.Filesystem to run on Win95 using the emulation
- // of GetFileAttributesEx available in the Microsoft Platform SDK
- // header file NewAPIs.h.
- //
- // The user needs only to define WANT_GETFILEATTRIBUTESEX_WRAPPER
- // to enable this emulation.
- //
- // Please note, however, that this block of preprocessor code enables
- // the user to compile against the emulation code. To link the
- // executable the user must also compile the function definitions in
- // NewAPIs.h. See NewAPIs.h for further details.
- //
- // This code should work both with Microsoft's native implementation
- // of the winapi headers and also with MinGW/Cygwin's version.
- //
- //////////////////////////////////////////////////////////////////////
-# if defined(WANT_GETFILEATTRIBUTESEX_WRAPPER)
-# if (defined(__MINGW32__) || defined(__CYGWIN__)) && WINVER < 0x040A
- // MinGW/Cygwin's winapi header files and NewAPIs.h do not live
- // well together because NewAPIs.h redefines
- // WIN32_FILE_ATTRIBUTE_DATA and GET_FILEEX_INFO_LEVELS
- // if WINVER < 0x04A.
-# include <w32api.h>
-# if __W32API_MAJOR_VERSION < 3 || \
- __W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION <= 3
-# define BOOST_FILESYSTEM_WINVER WINVER
-# undef WINVER
-# define WINVER 0x040A
-# endif
-# endif
-
-# include <NewAPIs.h>
-
- // Return macro definitions to their original state.
-# ifdef BOOST_FILESYSTEM_WINVER
-# undef WINVER
-# define WINVER BOOST_FILESYSTEM_WINVER
-# undef BOOST_FILESYSTEM_WINVER
-# endif
-# endif
- //////////////////////////////////////////////////////////////////////
-
# if defined(__BORLANDC__) || defined(__MWERKS__)
# if defined(__BORLANDC__)
using std::time_t;
// other macros defined. There was a bug report of this happening.)
# else // BOOST_POSIX
-# define _USE_FILE_OFFSET_BITS 64 // at worst,
-# define __USE_FILE_OFFSET64 // these defines may do nothing,
- // but that won't matter on 64-bit systems or on 32-bit systems which
- // don't have files larger than can be represented by a traditional
- // POSIX/UNIX off_t type. OTOH, defining them should kick
- // in 64-bit off_t's (and thus st_size) on 32-bit systems that support
- // the Large File Support (LFS) interface, such as Linux, Solaris, and IRIX.
-
# include <sys/types.h>
# include "dirent.h"
# include "unistd.h"
#include <sys/stat.h> // even on Windows some functions use stat()
#include <string>
+#include <cstring>
#include <cstdio> // for remove, rename
#include <cerrno>
#include <cassert>
+//#include <iostream> // for debugging only; comment out when not in use
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std { using ::strcmp; using ::remove; using ::rename; }
+#endif
#include <boost/config/abi_prefix.hpp> // must be the last header
# define BOOST_HANDLE DIR *
# define BOOST_INVALID_HANDLE_VALUE 0
-# define BOOST_SYSTEM_DIRECTORY_TYPE struct dirent *
+# define BOOST_SYSTEM_DIRECTORY_TYPE struct dirent
inline const char * find_first_file( const char * dir,
BOOST_HANDLE & handle, BOOST_SYSTEM_DIRECTORY_TYPE & )
::closedir( handle );
}
- inline const char * find_next_file(
- BOOST_HANDLE handle, const fs::path & ph, BOOST_SYSTEM_DIRECTORY_TYPE & )
+ // warning: the only dirent member updated is d_name
+ inline int readdir_r_simulator( DIR * dirp, struct dirent * entry,
+ struct dirent ** result ) // *result set to 0 on end of directory
+ {
+# if defined(_POSIX_THREAD_SAFE_FUNCTIONS) \
+ && defined(_SC_THREAD_SAFE_FUNCTIONS) \
+ && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0) \
+ && ( !defined(__HP_aCC) || ( defined(__HP_aCC) && defined(_REENTRANT) ) )
+ if ( ::sysconf( _SC_THREAD_SAFE_FUNCTIONS ) >= 0 )
+ { return ::readdir_r( dirp, entry, result ); }
+# endif
+
+ struct dirent * p;
+ errno = 0;
+ *result = 0;
+ if ( (p = ::readdir( dirp )) == 0 )
+ return errno;
+ // POSIX specs require entry->d_name be large enough:
+ std::strcpy( entry->d_name, p->d_name );
+ *result = entry;
+ return 0;
+ }
+
+ inline const char * find_next_file( BOOST_HANDLE handle,
+ const fs::path & ph, BOOST_SYSTEM_DIRECTORY_TYPE & entry )
// Returns: if EOF 0, otherwise name
// Throws: if system reports error
{
-
-// TODO: use readdir_r() if available, so code is multi-thread safe.
-// Fly-in-ointment: not all platforms support readdir_r().
-
- struct dirent * dp;
- errno = 0;
- if ( (dp = ::readdir( handle )) == 0 )
+ struct dirent * result;
+ int return_code;
+ if ( (return_code = ::readdir_r_simulator( handle, &entry, &result )) != 0 )
{
- if ( errno != 0 )
- {
- boost::throw_exception(
- fs::filesystem_error(
- "boost::filesystem::directory_iterator::operator++",
- ph, errno ) );
- }
- else { return 0; } // end reached
+ boost::throw_exception(
+ fs::filesystem_error(
+ "boost::filesystem::directory_iterator::operator++",
+ ph, return_code ) );
}
- return dp->d_name;
+ return result ? entry.d_name : 0;
}
#else // BOOST_WINDOWS
inline const char * find_first_file( const char * dir,
BOOST_HANDLE & handle, BOOST_SYSTEM_DIRECTORY_TYPE & data )
// Returns: 0 if error, otherwise name
+ // Note: an empty root directory has no "." or ".." entries, so this causes
+ // a ERROR_FILE_NOT_FOUND error which we do not considered an error. Instead,
+ // the handle is set to BOOST_INVALID_HANDLE_VALUE and a non-zero is returned.
{
-// std::cout << "find_first_file " << dir << std::endl;
- std::string dirpath( std::string(dir) + "/*" );
+ // use a form of search Sebastian Martel reports will work with Win98
+ std::string dirpath( dir );
+ dirpath += (dirpath.empty()
+ || (dirpath[dirpath.size()-1] != '\\'
+ && dirpath[dirpath.size()-1] != '/')) ? "\\*" : "*";
+
return ( (handle = ::FindFirstFileA( dirpath.c_str(), &data ))
- == BOOST_INVALID_HANDLE_VALUE ) ? 0 : data.cFileName;
+ == BOOST_INVALID_HANDLE_VALUE
+ && ::GetLastError() != ERROR_FILE_NOT_FOUND) ? 0 : data.cFileName;
}
inline void find_close( BOOST_HANDLE handle )
{
-// std::cout << "find_close" << std::endl;
assert( handle != BOOST_INVALID_HANDLE_VALUE );
::FindClose( handle );
}
BOOST_SYSTEM_DIRECTORY_TYPE scratch;
const char * name = 0; // initialization quiets compiler warnings
if ( dir_path.empty() )
- m_imp->handle = BOOST_INVALID_HANDLE_VALUE;
+ m_imp->handle = BOOST_INVALID_HANDLE_VALUE;
else
+ {
name = find_first_file( dir_path.native_directory_string().c_str(),
m_imp->handle, scratch ); // sets handle
-
+ if ( m_imp->handle == BOOST_INVALID_HANDLE_VALUE
+ && name ) // eof
+ {
+ m_imp.reset(); // make end iterator
+ return;
+ }
+ }
if ( m_imp->handle != BOOST_INVALID_HANDLE_VALUE )
{
m_imp->entry_path = dir_path;
if(::GetFileAttributesA( ph.string().c_str() ) == 0xFFFFFFFF)
{
UINT err = ::GetLastError();
- if((err == ERROR_FILE_NOT_FOUND) ||
- (err == ERROR_INVALID_PARAMETER) ||
- (err == ERROR_PATH_NOT_FOUND) ||
- (err == ERROR_INVALID_NAME) ||
- (err == ERROR_ACCESS_DENIED))
+ if((err == ERROR_FILE_NOT_FOUND)
+ || (err == ERROR_INVALID_PARAMETER)
+ || (err == ERROR_NOT_READY)
+ || (err == ERROR_PATH_NOT_FOUND)
+ || (err == ERROR_INVALID_NAME)
+ || (err == ERROR_BAD_NETPATH ))
return false; // GetFileAttributes failed because the path does not exist
// for any other error we assume the file does exist and fall through,
// this may not be the best policy though... (JM 20040330)
: path_stat.st_size == 0;
# else
WIN32_FILE_ATTRIBUTE_DATA fad;
- if ( !::GetFileAttributesEx( ph.string().c_str(),
+ if ( !::GetFileAttributesExA( ph.string().c_str(),
::GetFileExInfoStandard, &fad ) )
boost::throw_exception( filesystem_error(
"boost::filesystem::is_empty",
"boost::filesystem::equivalent",
ph2, fs::detail::system_error_code() ) );
// In theory, volume serial numbers are sufficient to distinguish between
- // devices, but in practice VSN's are sometimes duplicated, so device id
- // is also checked. Device id's alone aren't sufficient because network
- // share devices on different machines will have the same id. Furthermore,
- // cheap floppy disks often have 0 VSN's and are mounted on the same
- // lettered drive across networks, so last write time and file size is
- // checked to distinguish that case as far as is possible.
- if ( info1.dwVolumeSerialNumber != info2.dwVolumeSerialNumber
- || info1.nFileIndexHigh != info2.nFileIndexHigh
- || info1.nFileIndexLow != info2.nFileIndexLow
- || info1.nFileSizeHigh != info2.nFileSizeHigh
- || info1.nFileSizeLow != info2.nFileSizeLow ) return false;
- struct stat s1;
- if ( ::stat( ph1.string().c_str(), &s1 ) != 0 )
- boost::throw_exception( filesystem_error(
- "boost::filesystem::equivalent",
- ph1, fs::detail::system_error_code() ) );
- struct stat s2;
- if ( ::stat( ph2.string().c_str(), &s2 ) != 0 )
- boost::throw_exception( filesystem_error(
- "boost::filesystem::equivalent",
- ph2, fs::detail::system_error_code() ) );
- return s1.st_dev == s2.st_dev;
+ // devices, but in practice VSN's are sometimes duplicated, so last write
+ // time and file size are also checked.
+ return info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber
+ && info1.nFileIndexHigh == info2.nFileIndexHigh
+ && info1.nFileIndexLow == info2.nFileIndexLow
+ && info1.nFileSizeHigh == info2.nFileSizeHigh
+ && info1.nFileSizeLow == info2.nFileSizeLow
+ && info1.ftLastWriteTime.dwLowDateTime
+ == info2.ftLastWriteTime.dwLowDateTime
+ && info1.ftLastWriteTime.dwHighDateTime
+ == info2.ftLastWriteTime.dwHighDateTime;
# endif
}
# else
// by now, intmax_t is 64-bits on all Windows compilers
WIN32_FILE_ATTRIBUTE_DATA fad;
- if ( !::GetFileAttributesEx( ph.string().c_str(),
+ if ( !::GetFileAttributesExA( ph.string().c_str(),
::GetFileExInfoStandard, &fad ) )
boost::throw_exception( filesystem_error(
"boost::filesystem::file_size",
# ifdef BOOST_POSIX
|| symbolic_link_exists( ph ) ) // handle dangling symbolic links
{
+# if defined(__QNXNTO__) || (defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)))
+ // Some Metrowerks C library versions fail on directories because of a
+ // known Metrowerks coding error in ::remove. Workaround is to call
+ // rmdir() or unlink() as indicated.
+ // Same bug reported for QNX; same fix.
+ if ( (is_directory( ph )
+ ? ::rmdir( ph.string().c_str() )
+ : ::unlink( ph.string().c_str() )) != 0 )
+# else
// note that the POSIX behavior for symbolic links is what we want;
// the link rather than what it points to is deleted
if ( std::remove( ph.string().c_str() ) != 0 )
+# endif
+
{
int error = fs::detail::system_error_code();
// POSIX says "If the directory is not an empty directory, rmdir()
old_path, new_path, fs::detail::system_error_code() ) );
}
+#ifdef BOOST_POSIX
+ namespace detail
+ {
+ void throw_copy_file_error( const path & from_file_ph,
+ const path & to_file_ph )
+ {
+ boost::throw_exception( fs::filesystem_error(
+ "boost::filesystem::copy_file",
+ from_file_ph, to_file_ph, system_error_code() ) );
+ }
+ }
+#endif
+
BOOST_FILESYSTEM_DECL void copy_file( const path & from_file_ph,
const path & to_file_ph )
{
# ifdef BOOST_POSIX
- // TODO: Ask POSIX experts if this is the best way to copy a file
-
const std::size_t buf_sz = 32768;
boost::scoped_array<char> buf( new char [buf_sz] );
int infile=0, outfile=0; // init quiets compiler warning
O_WRONLY | O_CREAT | O_EXCL,
from_stat.st_mode )) < 0 )
{
- if ( infile != 0 ) ::close( infile );
- boost::throw_exception( filesystem_error(
- "boost::filesystem::copy_file",
- from_file_ph, to_file_ph, fs::detail::system_error_code() ) );
+ if ( infile >= 0 ) ::close( infile );
+ detail::throw_copy_file_error( from_file_ph, to_file_ph );
}
- ssize_t sz;
- while ( (sz = ::read( infile, buf.get(), buf_sz )) > 0
- && (sz = ::write( outfile, buf.get(), sz )) > 0 ) {}
+ ssize_t sz, sz_read=1, sz_write;
+ while ( sz_read > 0
+ && (sz_read = ::read( infile, buf.get(), buf_sz )) > 0 )
+ {
+ // Allow for partial writes - see Advanced Unix Programming (2nd Ed.),
+ // Marc Rochkind, Addison-Wesley, 2004, page 94
+ sz_write = 0;
+ do
+ {
+ if ( (sz = ::write( outfile, buf.get(), sz_read - sz_write )) < 0 )
+ {
+ sz_read = sz; // cause read loop termination
+ break; // and error to be thrown after closes
+ }
+ sz_write += sz;
+ } while ( sz_write < sz_read );
+ }
- ::close( infile );
- ::close( outfile );
+ if ( ::close( infile) < 0 ) sz_read = -1;
+ if ( ::close( outfile) < 0 ) sz_read = -1;
- if ( sz != 0 )
+ if ( sz_read < 0 )
+ detail::throw_copy_file_error( from_file_ph, to_file_ph );
# else
if ( !::CopyFileA( from_file_ph.string().c_str(),
to_file_ph.string().c_str(), /*fail_if_exists=*/true ) )
-# endif
- boost::throw_exception( filesystem_error(
+ boost::throw_exception( fs::filesystem_error(
"boost::filesystem::copy_file",
- from_file_ph, to_file_ph, fs::detail::system_error_code() ) );
+ from_file_ph, to_file_ph, detail::system_error_code() ) );
+# endif
}
BOOST_FILESYSTEM_DECL path current_path()
buf( new char[static_cast<std::size_t>(path_max)] );
if ( ::getcwd( buf.get(), static_cast<std::size_t>(path_max) ) == 0 )
{
- if ( errno != ERANGE )
+ if ( errno != ERANGE
+// there is a bug in some versions of the Metrowerks C lib on the Mac: wrong errno set
+#if defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
+ && errno != 0
+#endif
+ )
boost::throw_exception(
filesystem_error( "boost::filesystem::current_path", path(),
fs::detail::system_error_code() ) );
// path::iterator implementation --------------------------------------------//
- void path::iterator::increment()
+ BOOST_FILESYSTEM_DECL void path::iterator::increment()
{
assert( m_pos < m_path_ptr->m_path.size() ); // detect increment past end
m_pos += m_name.size();
m_name = m_path_ptr->m_path.substr( m_pos, end_pos - m_pos );
}
- void path::iterator::decrement()
+ BOOST_FILESYSTEM_DECL void path::iterator::decrement()
{
assert( m_pos ); // detect decrement of begin
std::string::size_type end_pos( m_pos );
libboost_regex_la_SOURCES = \
cpp_regex_traits.cpp \
- c_regex_traits_common.cpp \
c_regex_traits.cpp \
cregex.cpp \
fileiter.cpp \
instances.cpp \
primary_transform.hpp \
regex.cpp \
- w32_regex_traits.cpp \
- regex_synch.cpp
+ regex_raw_buffer.cpp \
+ regex_traits_defaults.cpp \
+ w32_regex_traits.cpp
# posix_api.cpp \
# wide_posix_api.cpp \
/*
*
- * Copyright (c) 1998-2002
- * Dr John Maddock
+ * Copyright (c) 2004
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*
*/
-
+
/*
* LOCATION: see http://www.boost.org for most recent version.
- * FILE c_regex_traits.cpp
- * VERSION see <boost/version.hpp>
- * DESCRIPTION: Implements the c_regex_traits<charT> traits class
+ * FILE: c_regex_traits.cpp
+ * VERSION: see <boost/version.hpp>
+ * DESCRIPTION: Implements out of line c_regex_traits<char> members
*/
+
#define BOOST_REGEX_SOURCE
#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
-# ifdef BOOST_MSVC
-# pragma warning(disable: 4702)
-# endif
-
-#include <clocale>
-#include <cstdio>
-#include <list>
-#include <cctype>
-#include <cstdio>
-#include <boost/cregex.hpp>
-#include <boost/regex/regex_traits.hpp>
-#ifdef BOOST_REGEX_V3
-#include <boost/regex/v3/regex_synch.hpp>
-#include <boost/regex/v3/regex_cstring.hpp>
-#else
-#include <boost/regex/v4/regex_synch.hpp>
-#include <boost/regex/v4/regex_cstring.hpp>
-#endif
-#include <boost/scoped_array.hpp>
-
-#include "primary_transform.hpp"
+#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560)
+#include <boost/regex/v4/c_regex_traits.hpp>
+#include <boost/regex/v4/primary_transform.hpp>
+#include <boost/regex/v4/regex_traits_defaults.hpp>
-#if defined(BOOST_HAS_NL_TYPES_H)
-#include <nl_types.h>
-#endif
-
-// Fixes a very strange bug in Comeau 4.2.45.2 that would otherwise result in
-// an instantiation loop
-#if defined(__COMO__) && __COMO_VERSION__ <= 4245
-void c_regex_adopted_no_longer_needed_loop_shutter_upper() { }
-#endif
-
-namespace{
-
-//
-// helper function to get the locale name,
-// works around possibly broken setlocale implementations:
-//
-const char* re_get_locale(int id)
-{
- static const char* def = "Unknown";
- const char* pl = std::setlocale(id, 0);
- return pl ? pl : def;
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std{
+ using ::strxfrm; using ::isspace;
+ using ::ispunct; using ::isalpha;
+ using ::isalnum; using ::iscntrl;
+ using ::isprint; using ::isupper;
+ using ::islower; using ::isdigit;
+ using ::isxdigit; using ::strtol;
}
-
-//
-// character classes:
-//
-boost::uint_fast32_t re_char_class_id[] = {
- boost::re_detail::c_traits_base::char_class_alnum,
- boost::re_detail::c_traits_base::char_class_alpha,
- boost::re_detail::c_traits_base::char_class_cntrl,
- boost::re_detail::c_traits_base::char_class_digit,
- boost::re_detail::c_traits_base::char_class_graph,
- boost::re_detail::c_traits_base::char_class_lower,
- boost::re_detail::c_traits_base::char_class_print,
- boost::re_detail::c_traits_base::char_class_punct,
- boost::re_detail::c_traits_base::char_class_space,
- boost::re_detail::c_traits_base::char_class_upper,
- boost::re_detail::c_traits_base::char_class_xdigit,
- boost::re_detail::c_traits_base::char_class_blank,
- boost::re_detail::c_traits_base::char_class_word,
- boost::re_detail::c_traits_base::char_class_unicode,
-};
-
-const char* re_char_class_names[] = {
-"alnum",
-"alpha",
-"cntrl",
-"digit",
-"graph",
-"lower",
-"print",
-"punct",
-"space",
-"upper",
-"xdigit",
-"blank",
-"word",
-"unicode",
-};
-
-std::string* re_cls_name;
-std::string* pclasses;
-unsigned int classes_count = 0;
-const unsigned int re_classes_max = 14;
-
-//
-// collate names:
-
-struct collate_name_t
-{
- std::string name;
- std::string value;
- collate_name_t(const char* p1, const char* p2, const char* p3, const char* p4)
- : name(p1, p2), value(p3, p4) {}
-};
-
-std::string* re_coll_name;
-std::list<collate_name_t>* pcoll_names;
-unsigned int collate_count = 0;
-
-//
-// message handling:
-#ifndef BOOST_RE_MESSAGE_BASE
-#define BOOST_RE_MESSAGE_BASE 0
#endif
-#if defined(BOOST_HAS_NL_TYPES_H)
-nl_catd message_cat = (nl_catd)-1;
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
#endif
-unsigned int message_count = 0;
-std::string* mess_locale;
-
-char* re_custom_error_messages[] = {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
-};
-
-#if !defined(LC_MESSAGES)
-#define LC_MESSAGES LC_CTYPE
-#endif
-
-char re_zero;
-char re_ten;
-
-unsigned int entry_count = 0;
-
-std::string* ctype_name;
-std::string* collate_name;
-enum syntax_map_size
-{
- map_size = UCHAR_MAX + 1
-};
-
-std::size_t BOOST_REGEX_CALL _re_get_message(char* buf, std::size_t len, std::size_t id);
-
-#ifndef BOOST_NO_WREGEX
-
-boost::regex_wchar_type re_zero_w;
-boost::regex_wchar_type re_ten_w;
-
-unsigned int nlsw_count = 0;
-std::string* wlocale_name = 0;
-
-struct syntax_map_t
-{
- boost::regex_wchar_type c;
- unsigned int type;
-};
-
-std::list<syntax_map_t>* syntax;
-
-std::size_t BOOST_REGEX_CALL re_get_message(boost::regex_wchar_type* buf, std::size_t len, std::size_t id)
-{
- std::size_t size = _re_get_message(static_cast<char*>(0), 0, id);
- if(len < size)
- return size;
- boost::scoped_array<char> cb(new char[size]);
- _re_get_message(cb.get(), size, id);
- size = boost::c_regex_traits<boost::regex_wchar_type>::strwiden(buf, len, cb.get());
- return size;
-}
-#endif
-
-inline std::size_t BOOST_REGEX_CALL re_get_message(char* buf, std::size_t len, std::size_t id)
-{
- return _re_get_message(buf, len, id);
-}
-
-void BOOST_REGEX_CALL re_init_classes()
-{
- BOOST_RE_GUARD_STACK
- if(classes_count == 0)
- {
- re_cls_name = new std::string("xxxxxxxx");
-#ifndef BOOST_NO_EXCEPTIONS
- try{
-#endif
- pclasses = new std::string[re_classes_max];
- BOOST_REGEX_NOEH_ASSERT(pclasses)
-#ifndef BOOST_NO_EXCEPTIONS
- }
- catch(...)
- {
- delete re_cls_name;
- throw;
- }
-#endif
- }
- ++classes_count;
-}
-
-void BOOST_REGEX_CALL re_free_classes()
-{
- BOOST_RE_GUARD_STACK
- if(--classes_count == 0)
- {
- delete re_cls_name;
- delete[] pclasses;
- }
-}
-
-void BOOST_REGEX_CALL re_update_classes()
-{
- BOOST_RE_GUARD_STACK
- if(*re_cls_name != re_get_locale(LC_CTYPE))
- {
- *re_cls_name = re_get_locale(LC_CTYPE);
- char buf[256];
- unsigned int i;
- for(i = 0; i < re_classes_max; ++i)
- {
- re_get_message(buf, 256, i+300);
- pclasses[i] = buf;
- }
- }
-}
-
-void BOOST_REGEX_CALL re_init_collate()
-{
- BOOST_RE_GUARD_STACK
- if(collate_count == 0)
- {
- re_coll_name = new std::string("xxxxxxxx");
-#ifndef BOOST_NO_EXCEPTIONS
- try{
-#endif
- pcoll_names = new std::list<collate_name_t>();
- BOOST_REGEX_NOEH_ASSERT(pcoll_names)
-#ifndef BOOST_NO_EXCEPTIONS
- }
- catch(...)
- {
- delete re_coll_name;
- throw;
- }
-#endif
- }
- ++collate_count;
-}
-
-void BOOST_REGEX_CALL re_free_collate()
-{
- BOOST_RE_GUARD_STACK
- if(--collate_count == 0)
- {
- delete re_coll_name;
- delete pcoll_names;
- }
-}
-
-void BOOST_REGEX_CALL re_update_collate()
-{
- BOOST_RE_GUARD_STACK
- if(*re_coll_name != re_get_locale(LC_COLLATE))
- {
- *re_coll_name = re_get_locale(LC_COLLATE);
- char buf[256];
- unsigned int i = 400;
- re_get_message(buf, 256, i);
- while(*buf)
- {
- char* p1, *p2, *p3, *p4;;
- p1 = buf;
- while(*p1 && std::isspace((unsigned char)*p1))++p1;
- p2 = p1;
- while(*p2 && !std::isspace((unsigned char)*p2))++p2;
- p3 = p2;
- while(*p3 && std::isspace((unsigned char)*p3))++p3;
- p4 = p3;
- while(*p4 && !std::isspace((unsigned char)*p4))++p4;
- pcoll_names->push_back(collate_name_t(p1, p2, p3, p4));
- ++i;
- re_get_message(buf, 256, i);
- }
- }
-}
-
-std::size_t BOOST_REGEX_CALL _re_get_message(char* buf, std::size_t len, std::size_t id)
-{
- BOOST_RE_GUARD_STACK
- // get the customised message if any:
- #if defined(BOOST_HAS_NL_TYPES_H)
- if(message_cat != (nl_catd)-1)
- {
- const char* m = catgets(message_cat, 0, id, 0);
- if(m)
- {
- std::size_t size = std::strlen(m) + 1;
- if(size > len)
- return size;
- std::strcpy(buf, m);
- return size;
- }
- }
- #endif
-
- //
- // now get the default message if any:
- return boost::re_detail::re_get_default_message(buf, len, id);
-}
+namespace boost{
-void BOOST_REGEX_CALL re_message_init()
-{
- BOOST_RE_GUARD_STACK
- if(message_count == 0)
+c_regex_traits<char>::string_type BOOST_REGEX_CALL c_regex_traits<char>::transform(const char* p1, const char* p2)
+{
+ std::string result(10, ' ');
+ std::size_t s = result.size();
+ std::size_t r;
+ std::string src(p1, p2);
+ while(s < (r = std::strxfrm(&*result.begin(), src.c_str(), s)))
{
- mess_locale = new std::string("xxxxxxxxxxxxxxxx");
+ result.append(r - s + 3, ' ');
+ s = result.size();
}
- ++message_count;
+ result.erase(r);
+ return result;
}
-void BOOST_REGEX_CALL re_message_update()
+c_regex_traits<char>::string_type BOOST_REGEX_CALL c_regex_traits<char>::transform_primary(const char* p1, const char* p2)
{
- BOOST_RE_GUARD_STACK
+ static char s_delim;
+ static const int s_collate_type = ::boost::re_detail::find_sort_syntax(static_cast<c_regex_traits<char>*>(0), &s_delim);
+ std::string result;
//
- // called whenever the global locale changes:
+ // What we do here depends upon the format of the sort key returned by
+ // sort key returned by this->transform:
//
- std::string l(re_get_locale(LC_MESSAGES));
- if(*mess_locale != l)
- {
- *mess_locale = l;
-#if defined(BOOST_HAS_NL_TYPES_H)
- if(message_cat != (nl_catd)-1)
- {
- catclose(message_cat);
- message_cat = (nl_catd)-1;
- }
- if(*boost::re_detail::c_traits_base::get_catalogue())
- {
- message_cat = catopen(boost::re_detail::c_traits_base::get_catalogue(), 0);
- if(message_cat == (nl_catd)-1)
- {
- std::string m("Unable to open message catalog: ");
- std::runtime_error err(m + boost::re_detail::c_traits_base::get_catalogue());
- boost::throw_exception(err);
- }
- }
-#endif
- for(int i = 0; i < boost::REG_E_UNKNOWN; ++i)
- {
- if(re_custom_error_messages[i])
- {
- boost::re_detail::re_strfree(re_custom_error_messages[i]);
- re_custom_error_messages[i] = 0;
- }
- }
- }
-}
-
-void BOOST_REGEX_CALL re_message_free()
-{
- BOOST_RE_GUARD_STACK
- --message_count;
- if(message_count == 0)
- {
-#if defined(BOOST_HAS_NL_TYPES_H)
- if(message_cat != (nl_catd)-1)
- catclose(message_cat);
-#endif
- delete mess_locale;
- for(int i = 0; i < boost::REG_E_UNKNOWN; ++i)
- {
- if(re_custom_error_messages[i])
- {
- boost::re_detail::re_strfree(re_custom_error_messages[i]);
- re_custom_error_messages[i] = 0;
- }
- }
- }
-}
-
-
-const char* BOOST_REGEX_CALL re_get_error_str(unsigned int id)
-{
- BOOST_RE_GUARD_STACK
-#ifdef BOOST_HAS_THREADS
- boost::re_detail::cs_guard g(*boost::re_detail::p_re_lock);
-#endif
- if(re_custom_error_messages[id] == 0)
- {
- char buf[256];
- _re_get_message(buf, 256, id + 200);
- if(*buf)
- {
- re_custom_error_messages[id] = boost::re_detail::re_strdup(buf);
- return re_custom_error_messages[id];
- }
- return boost::re_detail::re_default_error_messages[id];
- }
- return re_custom_error_messages[id];
-}
-
-} // namespace
-
-namespace boost{
-namespace re_detail{
-
-char c_traits_base::regex_message_catalogue[BOOST_REGEX_MAX_PATH] = {0};
-
-std::string BOOST_REGEX_CALL c_traits_base::error_string(unsigned id)
-{
- return re_get_error_str(id);
-}
-
-void BOOST_REGEX_CALL c_traits_base::do_update_collate()
-{
- BOOST_RE_GUARD_STACK
- re_update_collate();
- std::string s;
- const char* p = "zero";
- if(c_regex_traits<char>::lookup_collatename(s, p, p+4))
- {
- jm_assert(s.size() == 1);
- re_zero = *s.c_str();
- }
- else
- re_zero = '0';
-
- p = "ten";
- if(c_regex_traits<char>::lookup_collatename(s, p, p+3))
- {
- jm_assert(s.size() == 1);
- re_ten = *s.c_str();
- }
- else
- re_ten = 'a';
-}
-
-void BOOST_REGEX_CALL c_traits_base::do_update_ctype()
-{
- BOOST_RE_GUARD_STACK
- // start by updating the syntax map:
- unsigned int i;
- char buf[map_size+2];
- std::memset(syntax_map, syntax_char, map_size);
- for(i = 1; i < syntax_max; ++i)
- {
- char* ptr = buf;
- re_get_message(static_cast<char*>(buf), map_size, i+100);
- for(; *ptr; ++ptr)
- {
- syntax_map[(unsigned char)*ptr] = (unsigned char)i;
- }
- }
-
- // now update the character class map,
- // and lower case map:
- std::memset(class_map, 0, sizeof(class_map));
- for(i = 0; i < map_size; ++i)
- {
- if(std::isalpha(i))
- class_map[i] |= char_class_alpha;
- if(std::iscntrl(i))
- class_map[i] |= char_class_cntrl;
- if(std::isdigit(i))
- class_map[i] |= char_class_digit;
- if(std::islower(i))
- class_map[i] |= char_class_lower;
- if(std::isupper(i))
- class_map[i] |= char_class_upper;
- if(std::ispunct(i))
- class_map[i] |= char_class_punct;
- if(std::isspace(i))
- class_map[i] |= char_class_space;
- if(std::isxdigit(i))
- class_map[i] |= char_class_xdigit;
- }
- class_map[(unsigned char)'_'] |= char_class_underscore;
- class_map[(unsigned char)' '] |= char_class_blank;
- class_map[(unsigned char)'\t'] |= char_class_blank;
- for(i = 0; i < map_size; ++i)
- {
- lower_case_map[i] = (char)std::tolower(i);
- }
- re_update_classes();
-}
-
-boost::uint_fast32_t BOOST_REGEX_CALL c_traits_base::do_lookup_class(const char* p)
-{
- BOOST_RE_GUARD_STACK
- unsigned int i;
- for(i = 0; i < re_classes_max; ++i)
- {
- if(pclasses[i] == p)
- {
- return re_char_class_id[i];
- }
- }
- for(i = 0; i < re_classes_max; ++i)
- {
- if(std::strcmp(re_char_class_names[i], p) == 0)
- {
- return re_char_class_id[i];
- }
- }
- return 0;
-}
-
-bool BOOST_REGEX_CALL c_traits_base::do_lookup_collate(std::string& buf, const char* p)
-{
- BOOST_RE_GUARD_STACK
- std::list<collate_name_t>::iterator first, last;
- first = pcoll_names->begin();
- last = pcoll_names->end();
- while(first != last)
+ switch(s_collate_type)
{
- if((*first).name == p)
+ case ::boost::re_detail::sort_C:
+ case ::boost::re_detail::sort_unknown:
+ // the best we can do is translate to lower case, then get a regular sort key:
{
- buf = (*first).value;
- return true;
+ result.assign(p1, p2);
+ for(std::string::size_type i = 0; i < result.size(); ++i)
+ result[i] = static_cast<char>((std::tolower)(static_cast<unsigned char>(result[i])));
+ result = transform(&*result.begin(), &*result.begin() + result.size());
+ break;
}
- ++first;
- }
-
- bool result = re_detail::re_lookup_def_collate_name(buf, p);
- if((result == 0) && (std::strlen(p) == 1))
- {
- result = true;
- buf = *p;
- }
- return result;
-}
-
-std::string BOOST_REGEX_CALL c_traits_base::set_message_catalogue(const std::string& l)
-{
- if(sizeof(regex_message_catalogue) <= l.size())
- return l;
- std::string old(regex_message_catalogue);
- std::strcpy(regex_message_catalogue, l.c_str());
- return old;
-}
-
-unsigned char c_traits_base::syntax_map[map_size];
-unsigned short c_traits_base::class_map[map_size];
-char c_traits_base::lower_case_map[map_size];
-
-} // namespace re_detail
-
-#ifndef BOOST_NO_WREGEX
-bool BOOST_REGEX_CALL c_regex_traits<regex_wchar_type>::lookup_collatename(std::basic_string<regex_wchar_type>& out, const regex_wchar_type* first, const regex_wchar_type* last)
-{
- BOOST_RE_GUARD_STACK
- std::basic_string<regex_wchar_type> s(first, last);
- std::size_t len = strnarrow(static_cast<char*>(0), 0, s.c_str());
- scoped_array<char> buf(new char[len]);
- strnarrow(buf.get(), len, s.c_str());
- std::string t_out;
- bool result = base_type::do_lookup_collate(t_out, buf.get());
- if(t_out.size() == 0) result = false;
- if(result)
- {
- if(t_out[0])
+ case ::boost::re_detail::sort_fixed:
{
- len = strwiden(static_cast<regex_wchar_type*>(0), 0, t_out.c_str());
- scoped_array<regex_wchar_type> wb(new regex_wchar_type[len]);
- strwiden(wb.get(), len, t_out.c_str());
- out = wb.get();
+ // get a regular sort key, and then truncate it:
+ result = transform(p1, p2);
+ result.erase(s_delim);
+ break;
}
- else
- out.append(1, (regex_wchar_type)0);
- }
- return result;
-}
-#endif
-
-c_regex_traits<char> c_regex_traits<char>::i;
-
-void BOOST_REGEX_CALL c_regex_traits<char>::init()
-{
- BOOST_RE_GUARD_STACK
-#ifdef BOOST_HAS_THREADS
- re_detail::re_init_threads();
- re_detail::cs_guard g(*re_detail::p_re_lock);
-#endif
- // just keep track of entry_count
- if(entry_count == 0)
- {
- ctype_name = new std::string("xxxxxxxxxxxxxxxx");
-#ifndef BOOST_NO_EXCEPTIONS
- try{
-#endif
- collate_name = new std::string("xxxxxxxxxxxxxxxx");
- BOOST_REGEX_NOEH_ASSERT(collate_name)
-#ifndef BOOST_NO_EXCEPTIONS
- }
- catch(...)
- {
- delete ctype_name;
- throw;
- }
-#endif
- }
- re_message_init();
- re_init_classes();
- re_init_collate();
- ++entry_count;
-}
-
-void BOOST_REGEX_CALL c_regex_traits<char>::update()
-{
- BOOST_RE_GUARD_STACK
- #ifdef BOOST_HAS_THREADS
- re_detail::cs_guard g(*re_detail::p_re_lock);
- #endif
- re_message_update();
- if(*collate_name != re_get_locale(LC_COLLATE))
- {
- do_update_collate();
- *collate_name = re_get_locale(LC_COLLATE);
- }
- if(*ctype_name != re_get_locale(LC_CTYPE))
- {
- do_update_ctype();
- *ctype_name = re_get_locale(LC_CTYPE);
- }
- sort_type = re_detail::find_sort_syntax(&i, &sort_delim);
-}
-
-void BOOST_REGEX_CALL c_regex_traits<char>::m_free()
-{
- BOOST_RE_GUARD_STACK
- #ifdef BOOST_HAS_THREADS
- re_detail::cs_guard g(*re_detail::p_re_lock);
- #endif
- re_message_free();
- re_free_classes();
- re_free_collate();
- --entry_count;
- // add reference to static member here to ensure
- // that the linker includes it in the .exe:
- if((entry_count == 0) && (0 != &c_regex_traits<char>::i))
- {
- delete ctype_name;
- delete collate_name;
- }
-#ifdef BOOST_HAS_THREADS
- g.acquire(false);
- re_detail::re_free_threads();
-#endif
-}
-
-void BOOST_REGEX_CALL c_regex_traits<char>::transform(std::string& out, const std::string& in)
-{
- BOOST_RE_GUARD_STACK
- std::size_t n = std::strxfrm(0, in.c_str(), 0);
- if(n == (std::size_t)(-1))
- {
- out = in;
- return;
- }
- scoped_array<char> buf(new char[n+1]);
- n = std::strxfrm(buf.get(), in.c_str(), n+1);
- if(n == (std::size_t)(-1))
- {
- out = in;
- return;
- }
- out = buf.get();
-}
-
-void BOOST_REGEX_CALL c_regex_traits<char>::transform_primary(std::string& out, const std::string& in)
-{
- transform(out, in);
- switch(sort_type)
- {
- case re_detail::sort_C:
- case re_detail::sort_unknown:
- break;
- case re_detail::sort_fixed:
- out.erase((int)sort_delim);
- break;
- case re_detail::sort_delim:
- for(unsigned int j = 0; j < out.size(); ++j)
- {
- if((out[j] == sort_delim) && (j+1 < out.size()))
- {
- out.erase(j+1);
+ case ::boost::re_detail::sort_delim:
+ // get a regular sort key, and then truncate everything after the delim:
+ result = transform(p1, p2);
+ if(result.size() && (result[0] == s_delim))
break;
+ std::size_t i;
+ for(i = 0; i < result.size(); ++i)
+ {
+ if(result[i] == s_delim)
+ break;
}
- }
- }
-}
-
-unsigned c_regex_traits<char>::sort_type;
-char c_regex_traits<char>::sort_delim;
-
-
-int BOOST_REGEX_CALL c_regex_traits<char>::toi(char c)
-{
- if(is_class(c, char_class_digit))
- return c - re_zero;
- if(is_class(c, char_class_xdigit))
- return 10 + translate(c, true) - translate(re_ten, true);
- return -1; // error!!
-}
-
-int BOOST_REGEX_CALL c_regex_traits<char>::toi(const char*& first, const char* last, int radix)
-{
- unsigned int maxval;
- if(radix < 0)
- {
- // if radix is less than zero, then restrict
- // return value to charT. NB assumes sizeof(charT) <= sizeof(int)
- radix *= -1;
- maxval = 1u << (sizeof(*first) * CHAR_BIT - 1);
- maxval /= radix;
- maxval *= 2;
- maxval -= 1;
- }
- else
- {
- maxval = (unsigned int)-1;
- maxval /= radix;
- }
-
- unsigned int result = 0;
- unsigned int type = (radix > 10) ? char_class_xdigit : char_class_digit;
- while((first != last) && is_class(*first, type) && (result <= maxval))
- {
- result *= radix;
- result += toi(*first);
- ++first;
+ result.erase(i);
+ break;
}
+ if(result.empty())
+ result = std::string(1, char(0));
return result;
}
-#ifndef BOOST_NO_WREGEX
-
-unsigned int BOOST_REGEX_CALL c_regex_traits<regex_wchar_type>::syntax_type(size_type c)
-{
- BOOST_RE_GUARD_STACK
- std::list<syntax_map_t>::const_iterator first, last;
- first = syntax->begin();
- last = syntax->end();
- while(first != last)
- {
- if((uchar_type)(*first).c == c)
- return (*first).type;
- ++first;
- }
- return 0;
-}
-
-void BOOST_REGEX_CALL c_regex_traits<regex_wchar_type>::init()
-{
- BOOST_RE_GUARD_STACK
- re_detail::re_init_threads();
-#ifdef BOOST_HAS_THREADS
- re_detail::cs_guard g(*re_detail::p_re_lock);
-#endif
- re_message_init();
- re_init_classes();
- re_init_collate();
- if(nlsw_count == 0)
- {
- wlocale_name = new std::string("xxxxxxxxxxxxxxxx");
-#ifndef BOOST_NO_EXCEPTIONS
- try{
-#endif
- syntax = new std::list<syntax_map_t>();
- BOOST_REGEX_NOEH_ASSERT(syntax)
-#ifndef BOOST_NO_EXCEPTIONS
- }
- catch(...)
- {
- delete wlocale_name;
- throw;
- }
-#endif
- }
- ++nlsw_count;
-}
+enum
+{
+ char_class_space=1<<0,
+ char_class_print=1<<1,
+ char_class_cntrl=1<<2,
+ char_class_upper=1<<3,
+ char_class_lower=1<<4,
+ char_class_alpha=1<<5,
+ char_class_digit=1<<6,
+ char_class_punct=1<<7,
+ char_class_xdigit=1<<8,
+ char_class_alnum=char_class_alpha|char_class_digit,
+ char_class_graph=char_class_alnum|char_class_punct,
+ char_class_blank=1<<9,
+ char_class_word=1<<10,
+ char_class_unicode=1<<11
+};
-bool BOOST_REGEX_CALL c_regex_traits<regex_wchar_type>::do_lookup_collate(std::basic_string<regex_wchar_type>& out, const regex_wchar_type* first, const regex_wchar_type* last)
-{
- BOOST_RE_GUARD_STACK
- std::basic_string<regex_wchar_type> s(first, last);
- std::size_t len = strnarrow(static_cast<char*>(0), 0, s.c_str());
- scoped_array<char> buf(new char[len]);
- strnarrow(buf.get(), len, s.c_str());
- std::string t_out;
- bool result = base_type::do_lookup_collate(t_out, buf.get());
- if(result)
- {
- len = strwiden(static_cast<regex_wchar_type*>(0), 0, t_out.c_str());
- scoped_array<regex_wchar_type> wb(new regex_wchar_type[len]);
- strwiden(wb.get(), len, t_out.c_str());
- out = wb.get();
- }
+c_regex_traits<char>::char_class_type BOOST_REGEX_CALL c_regex_traits<char>::lookup_classname(const char* p1, const char* p2)
+{
+ static const char_class_type masks[] =
+ {
+ 0,
+ char_class_alnum,
+ char_class_alpha,
+ char_class_blank,
+ char_class_cntrl,
+ char_class_digit,
+ char_class_digit,
+ char_class_graph,
+ char_class_lower,
+ char_class_lower,
+ char_class_print,
+ char_class_punct,
+ char_class_space,
+ char_class_space,
+ char_class_upper,
+ char_class_unicode,
+ char_class_upper,
+ char_class_alnum | char_class_word,
+ char_class_alnum | char_class_word,
+ char_class_xdigit,
+ };
+
+ int id = ::boost::re_detail::get_default_class_id(p1, p2);
+ if(id < 0)
+ {
+ std::string s(p1, p2);
+ for(std::string::size_type i = 0; i < s.size(); ++i)
+ s[i] = static_cast<char>((std::tolower)(static_cast<unsigned char>(s[i])));
+ id = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
+ }
+ BOOST_ASSERT(std::size_t(id+1) < sizeof(masks) / sizeof(masks[0]));
+ return masks[id+1];
+}
+
+bool BOOST_REGEX_CALL c_regex_traits<char>::isctype(char c, char_class_type mask)
+{
+ return
+ ((mask & char_class_space) && (std::isspace)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_print) && (std::isprint)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_cntrl) && (std::iscntrl)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_upper) && (std::isupper)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_lower) && (std::islower)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_alpha) && (std::isalpha)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_digit) && (std::isdigit)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_punct) && (std::ispunct)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_xdigit) && (std::isxdigit)(static_cast<unsigned char>(c)))
+ || ((mask & char_class_blank) && (std::isspace)(static_cast<unsigned char>(c)) && !::boost::re_detail::is_separator(c))
+ || ((mask & char_class_word) && (c == '_'));
+}
+
+c_regex_traits<char>::string_type BOOST_REGEX_CALL c_regex_traits<char>::lookup_collatename(const char* p1, const char* p2)
+{
+ std::string s(p1, p2);
+ s = ::boost::re_detail::lookup_default_collate_name(s);
+ if(s.empty() && (p2-p1 == 1))
+ s.append(1, *p1);
+ return s;
+}
+
+int BOOST_REGEX_CALL c_regex_traits<char>::value(char c, int radix)
+{
+ char b[2] = { c, '\0', };
+ char* ep;
+ int result = std::strtol(b, &ep, radix);
+ if(ep == b)
+ return -1;
return result;
}
-
-void BOOST_REGEX_CALL c_regex_traits<regex_wchar_type>::update()
-{
- BOOST_RE_GUARD_STACK
-#ifdef BOOST_HAS_THREADS
- re_detail::cs_guard g(*re_detail::p_re_lock);
-#endif
- re_message_update();
- re_update_classes();
- re_update_collate();
- std::string l(re_get_locale(LC_CTYPE));
- if(*wlocale_name != l)
- {
- *wlocale_name = l;
- std::basic_string<regex_wchar_type> s;
- const regex_wchar_type* p = (const regex_wchar_type*)L"zero";
- if(do_lookup_collate(s, p, p+4))
- {
- jm_assert(s.size() == 1);
- re_zero_w = *s.c_str();
- }
- else
- re_zero_w = L'0';
-
- p = (const regex_wchar_type*)L"ten";
- if(do_lookup_collate(s, p, p+3))
- {
- jm_assert(s.size() == 1);
- re_ten_w = *s.c_str();
- }
- else
- re_ten_w = L'a';
-
- unsigned int i;
- regex_wchar_type buf[256];
- syntax_map_t sm;
- syntax->clear();
- for(i = 1; i < syntax_max; ++i)
- {
- regex_wchar_type* ptr = buf;
- re_get_message(static_cast<regex_wchar_type*>(buf), 256, i+100);
- for(; *ptr; ++ptr)
- {
- sm.c = *ptr;
- sm.type = i;
- syntax->push_back(sm);
- }
- }
- sort_type = re_detail::find_sort_syntax(&init_, &sort_delim);
- }
}
-
-void BOOST_REGEX_CALL c_regex_traits<regex_wchar_type>::m_free()
-{
- BOOST_RE_GUARD_STACK
-#ifdef BOOST_HAS_THREADS
- re_detail::cs_guard g(*re_detail::p_re_lock);
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
#endif
- --nlsw_count;
- re_message_free();
- re_free_classes();
- re_free_collate();
- // add reference to static member here to ensure
- // that the linker includes it in the .exe:
- if((nlsw_count == 0) && (0 != &c_regex_traits<regex_wchar_type>::init_))
- {
- // cleanup:
- delete wlocale_name;
- delete syntax;
- }
-#ifdef BOOST_HAS_THREADS
- g.acquire(false);
- re_detail::re_free_threads();
-#endif
-}
-bool BOOST_REGEX_CALL c_regex_traits<regex_wchar_type>::do_iswclass(regex_wchar_type c, boost::uint_fast32_t f)
-{
- BOOST_RE_GUARD_STACK
- if((c & ~0xFF) == 0)
- return BOOST_REGEX_MAKE_BOOL(re_detail::wide_unicode_classes[(uchar_type)c] & f);
- if((f & char_class_alpha) && std::iswalpha(c))
- return true;
- if((f & char_class_cntrl) && std::iswcntrl(c))
- return true;
- if((f & char_class_digit) && std::iswdigit(c))
- return true;
- if((f & char_class_lower) && std::iswlower(c))
- return true;
- if((f & char_class_punct) && std::iswpunct(c))
- return true;
- if((f & char_class_space) && std::iswspace(c))
- return true;
- if((f & char_class_upper) && std::iswupper(c))
- return true;
- if((f & char_class_xdigit) && std::iswxdigit(c))
- return true;
- if(f & char_class_unicode)
- return true;
- return false;
-}
-
-void BOOST_REGEX_CALL c_regex_traits<regex_wchar_type>::transform(std::basic_string<regex_wchar_type>& out, const std::basic_string<regex_wchar_type>& in)
-{
- BOOST_RE_GUARD_STACK
-#ifndef BOOST_MSVC
- std::size_t n = std::wcsxfrm(0, in.c_str(), 0);
-#else
- // broken wcsxfrm under VC6 doesn't check size of
- // output buffer, we have no choice but to guess!
- std::size_t n = 100 * in.size();
#endif
- if((n == (std::size_t)(-1)) || (n == 0))
- {
- out = in;
- return;
- }
- scoped_array<regex_wchar_type> buf(new regex_wchar_type[n+1]);
- n = std::wcsxfrm((wchar_t*)buf.get(), (const wchar_t*)in.c_str(), n+1);
- if(n == (std::size_t)(-1))
- {
- out = in;
- return;
- }
- out = buf.get();
-}
-
-void BOOST_REGEX_CALL c_regex_traits<regex_wchar_type>::transform_primary(std::basic_string<regex_wchar_type>& out, const std::basic_string<regex_wchar_type>& in)
-{
- transform(out, in);
- switch(sort_type)
- {
- case re_detail::sort_C:
- case re_detail::sort_unknown:
- break;
- case re_detail::sort_fixed:
- if((unsigned)sort_delim < out.size())
- out.erase((int)sort_delim);
- break;
- case re_detail::sort_delim:
- for(unsigned int i = 0; i < out.size(); ++i)
- {
- if((out[i] == sort_delim) && (i+1 < out.size()))
- {
- out.erase(i+1);
- break;
- }
- }
- }
-}
-
-unsigned c_regex_traits<regex_wchar_type>::sort_type;
-regex_wchar_type c_regex_traits<regex_wchar_type>::sort_delim;
-
-
-int BOOST_REGEX_CALL c_regex_traits<regex_wchar_type>::toi(regex_wchar_type c)
-{
- if(is_class(c, char_class_digit))
- return c - re_zero_w;
- if(is_class(c, char_class_xdigit))
- return 10 + translate(c, true) - translate(re_ten_w, true);
- return -1; // error!!
-}
-
-int BOOST_REGEX_CALL c_regex_traits<regex_wchar_type>::toi(const regex_wchar_type*& first, const regex_wchar_type* last, int radix)
-{
- unsigned int maxval;
- if(radix < 0)
- {
- // if radix is less than zero, then restrict
- // return value to charT. NB assumes sizeof(charT) <= sizeof(int)
- radix *= -1;
- maxval = 1u << (sizeof(*first) * CHAR_BIT - 1);
- maxval /= radix;
- maxval *= 2;
- maxval -= 1;
- }
- else
- {
- maxval = (unsigned int)-1;
- maxval /= radix;
- }
-
- unsigned int result = 0;
- unsigned int type = (radix > 10) ? char_class_xdigit : char_class_digit;
- while((first != last) && is_class(*first, type) && (result <= maxval))
- {
- result *= radix;
- result += toi(*first);
- ++first;
- }
- return result;
-}
-
-boost::uint_fast32_t BOOST_REGEX_CALL c_regex_traits<regex_wchar_type>::lookup_classname(const regex_wchar_type* first, const regex_wchar_type* last)
-{
- std::basic_string<regex_wchar_type> s(first, last);
- std::size_t len = strnarrow(static_cast<char*>(0), 0, s.c_str());
- scoped_array<char> buf(new char[len]);
- strnarrow(buf.get(), len, s.c_str());
- boost::uint_fast32_t result = do_lookup_class(buf.get());
- return result;
-}
-
-c_regex_traits<regex_wchar_type> c_regex_traits<regex_wchar_type>::init_;
-
-std::size_t BOOST_REGEX_CALL c_regex_traits<regex_wchar_type>::strnarrow(char *s1, std::size_t len, const regex_wchar_type *s2)
-{
- BOOST_RE_GUARD_STACK
- std::size_t size = std::wcslen((const wchar_t*)s2) + 1;
- if(size > len)
- return size;
- return std::wcstombs(s1, (const wchar_t*)s2, len);
-}
-
-std::size_t BOOST_REGEX_CALL c_regex_traits<regex_wchar_type>::strwiden(regex_wchar_type *s1, std::size_t len, const char *s2)
-{
- BOOST_RE_GUARD_STACK
- std::size_t size = std::strlen(s2) + 1;
- if(size > len)
- return size;
- size = std::mbstowcs((wchar_t*)s1, s2, len);
- s1[size] = 0;
- return size + 1;
-}
-
-#endif // BOOST_NO_WREGEX
-
-} // namespace boost
-
-
-
-
-
+++ /dev/null
-/*
- *
- * Copyright (c) 1998-2002
- * Dr John Maddock
- *
- * Use, modification and distribution are subject to the
- * Boost Software License, Version 1.0. (See accompanying file
- * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- *
- */
-
- /*
- * LOCATION: see http://www.boost.org for most recent version.
- * FILE: c_regex_traits_common.cpp
- * VERSION: see <boost/version.hpp>
- * DESCRIPTION: Implements common code and data for the
- * c_regex_traits<charT> traits classes.
- */
-
-
-#define BOOST_REGEX_SOURCE
-
-#include <clocale>
-#include <cstdio>
-#include <list>
-#include <cctype>
-#include <boost/regex/regex_traits.hpp>
-#ifdef BOOST_REGEX_V3
-#include <boost/regex/v3/regex_synch.hpp>
-#else
-#include <boost/regex/v4/regex_synch.hpp>
-#endif
-
-
-namespace boost{
- namespace re_detail{
-
-//
-// these are the POSIX collating names:
-//
-BOOST_REGEX_DECL const char* def_coll_names[] = {
-"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "alert", "backspace", "tab", "newline",
-"vertical-tab", "form-feed", "carriage-return", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK",
-"SYN", "ETB", "CAN", "EM", "SUB", "ESC", "IS4", "IS3", "IS2", "IS1", "space", "exclamation-mark",
-"quotation-mark", "number-sign", "dollar-sign", "percent-sign", "ampersand", "apostrophe",
-"left-parenthesis", "right-parenthesis", "asterisk", "plus-sign", "comma", "hyphen",
-"period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
-"colon", "semicolon", "less-than-sign", "equals-sign", "greater-than-sign",
-"question-mark", "commercial-at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P",
-"Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "left-square-bracket", "backslash",
-"right-square-bracket", "circumflex", "underscore", "grave-accent", "a", "b", "c", "d", "e", "f",
-"g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "left-curly-bracket",
-"vertical-line", "right-curly-bracket", "tilde", "DEL", "",
-};
-
-// these multi-character collating elements
-// should keep most Western-European locales
-// happy - we should really localise these a
-// little more - but this will have to do for
-// now:
-
-BOOST_REGEX_DECL const char* def_multi_coll[] = {
- "ae",
- "Ae",
- "AE",
- "ch",
- "Ch",
- "CH",
- "ll",
- "Ll",
- "LL",
- "ss",
- "Ss",
- "SS",
- "nj",
- "Nj",
- "NJ",
- "dz",
- "Dz",
- "DZ",
- "lj",
- "Lj",
- "LJ",
- "",
-};
-
-
-
-BOOST_REGEX_DECL bool BOOST_REGEX_CALL re_lookup_def_collate_name(std::string& buf, const char* name)
-{
- BOOST_RE_GUARD_STACK
- unsigned int i = 0;
- while(*def_coll_names[i])
- {
- if(std::strcmp(def_coll_names[i], name) == 0)
- {
- buf = (char)i;
- return true;
- }
- ++i;
- }
- i = 0;
- while(*def_multi_coll[i])
- {
- if(std::strcmp(def_multi_coll[i], name) == 0)
- {
- buf = def_multi_coll[i];
- return true;
- }
- ++i;
- }
- return false;
-}
-
-//
-// messages:
-BOOST_REGEX_DECL const char * re_default_error_messages[] =
-{ "Success", /* REG_NOERROR */
- "No match", /* REG_NOMATCH */
- "Invalid regular expression", /* REG_BADPAT */
- "Invalid collation character", /* REG_ECOLLATE */
- "Invalid character class name", /* REG_ECTYPE */
- "Trailing backslash", /* REG_EESCAPE */
- "Invalid back reference", /* REG_ESUBREG */
- "Unmatched [ or [^", /* REG_EBRACK */
- "Unmatched ( or \\(", /* REG_EPAREN */
- "Unmatched \\{", /* REG_EBRACE */
- "Invalid content of \\{\\}", /* REG_BADBR */
- "Invalid range end", /* REG_ERANGE */
- "Memory exhausted", /* REG_ESPACE */
- "Invalid preceding regular expression", /* REG_BADRPT */
- "Premature end of regular expression", /* REG_EEND */
- "Regular expression too big", /* REG_ESIZE */
- "Unmatched ) or \\)", /* REG_ERPAREN */
- "Empty expression", /* REG_EMPTY */
- "Unknown error", /* REG_E_UNKNOWN */
- "",
- "",
- "",
-};
-
-const mss default_messages[] = {
- { 100+ c_regex_traits<char>::syntax_open_bracket, "(", },
- { 100+ c_regex_traits<char>::syntax_close_bracket, ")", },
- { 100+ c_regex_traits<char>::syntax_dollar, "$", },
- { 100+ c_regex_traits<char>::syntax_caret, "^", },
- { 100+ c_regex_traits<char>::syntax_dot, ".", },
- { 100+ c_regex_traits<char>::syntax_star, "*", },
- { 100+ c_regex_traits<char>::syntax_plus, "+", },
- { 100+ c_regex_traits<char>::syntax_question, "?", },
- { 100+ c_regex_traits<char>::syntax_open_set, "[", },
- { 100+ c_regex_traits<char>::syntax_close_set, "]", },
- { 100+ c_regex_traits<char>::syntax_or, "|", },
- { 100+ c_regex_traits<char>::syntax_slash, "\\", },
- { 100+ c_regex_traits<char>::syntax_hash, "#", },
- { 100+ c_regex_traits<char>::syntax_dash, "-", },
- { 100+ c_regex_traits<char>::syntax_open_brace, "{", },
- { 100+ c_regex_traits<char>::syntax_close_brace, "}", },
- { 100+ c_regex_traits<char>::syntax_digit, "0123456789", },
- { 100+ c_regex_traits<char>::syntax_b, "b", },
- { 100+ c_regex_traits<char>::syntax_B, "B", },
- { 100+ c_regex_traits<char>::syntax_left_word, "<", },
- { 100+ c_regex_traits<char>::syntax_right_word, ">", },
- { 100+ c_regex_traits<char>::syntax_w, "w", },
- { 100+ c_regex_traits<char>::syntax_W, "W", },
- { 100+ c_regex_traits<char>::syntax_start_buffer, "`A", },
- { 100+ c_regex_traits<char>::syntax_end_buffer, "'z", },
- { 100+ c_regex_traits<char>::syntax_newline, "\n", },
- { 100+ c_regex_traits<char>::syntax_comma, ",", },
- { 100+ c_regex_traits<char>::syntax_a, "a", },
- { 100+ c_regex_traits<char>::syntax_f, "f", },
- { 100+ c_regex_traits<char>::syntax_n, "n", },
- { 100+ c_regex_traits<char>::syntax_r, "r", },
- { 100+ c_regex_traits<char>::syntax_t, "t", },
- { 100+ c_regex_traits<char>::syntax_v, "v", },
- { 100+ c_regex_traits<char>::syntax_x, "x", },
- { 100+ c_regex_traits<char>::syntax_c, "c", },
- { 100+ c_regex_traits<char>::syntax_colon, ":", },
- { 100+ c_regex_traits<char>::syntax_equal, "=", },
-
- { 100 + c_regex_traits<char>::syntax_e, "e", },
- { 100 + c_regex_traits<char>::syntax_l, "l", },
- { 100 + c_regex_traits<char>::syntax_L, "L", },
- { 100 + c_regex_traits<char>::syntax_u, "u", },
- { 100 + c_regex_traits<char>::syntax_U, "U", },
- { 100 + c_regex_traits<char>::syntax_s, "s", },
- { 100 + c_regex_traits<char>::syntax_S, "S", },
- { 100 + c_regex_traits<char>::syntax_d, "d", },
- { 100 + c_regex_traits<char>::syntax_D, "D", },
- { 100 + c_regex_traits<char>::syntax_E, "E", },
- { 100 + c_regex_traits<char>::syntax_Q, "Q", },
- { 100 + c_regex_traits<char>::syntax_X, "X", },
- { 100 + c_regex_traits<char>::syntax_C, "C", },
- { 100 + c_regex_traits<char>::syntax_Z, "Z", },
- { 100 + c_regex_traits<char>::syntax_G, "G", },
-
- { 100 + c_regex_traits<char>::syntax_not, "!", },
-
- { 0, "", },
- };
-
-BOOST_REGEX_DECL std::size_t BOOST_REGEX_CALL re_get_default_message(char* buf, std::size_t len, std::size_t id)
-{
- BOOST_RE_GUARD_STACK
- const mss* pm = default_messages;
- while(pm->id)
- {
- if(pm->id == id)
- {
- std::size_t size = re_strlen(pm->what) + 1;
- if(size > len)
- return size;
- re_strcpy(buf, pm->what);
- return size;
- }
- ++pm;
- }
- if(buf && len)
- *buf = 0;
- return 1;
-}
-
-#ifndef BOOST_NO_WREGEX
-const regex_wchar_type combining_ranges[] = { 0x0300, 0x0361,
- 0x0483, 0x0486,
- 0x0903, 0x0903,
- 0x093E, 0x0940,
- 0x0949, 0x094C,
- 0x0982, 0x0983,
- 0x09BE, 0x09C0,
- 0x09C7, 0x09CC,
- 0x09D7, 0x09D7,
- 0x0A3E, 0x0A40,
- 0x0A83, 0x0A83,
- 0x0ABE, 0x0AC0,
- 0x0AC9, 0x0ACC,
- 0x0B02, 0x0B03,
- 0x0B3E, 0x0B3E,
- 0x0B40, 0x0B40,
- 0x0B47, 0x0B4C,
- 0x0B57, 0x0B57,
- 0x0B83, 0x0B83,
- 0x0BBE, 0x0BBF,
- 0x0BC1, 0x0BCC,
- 0x0BD7, 0x0BD7,
- 0x0C01, 0x0C03,
- 0x0C41, 0x0C44,
- 0x0C82, 0x0C83,
- 0x0CBE, 0x0CBE,
- 0x0CC0, 0x0CC4,
- 0x0CC7, 0x0CCB,
- 0x0CD5, 0x0CD6,
- 0x0D02, 0x0D03,
- 0x0D3E, 0x0D40,
- 0x0D46, 0x0D4C,
- 0x0D57, 0x0D57,
- 0x0F7F, 0x0F7F,
- 0x20D0, 0x20E1,
- 0x3099, 0x309A,
- 0xFE20, 0xFE23,
- 0xffff, 0xffff, };
-
-BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining(regex_wchar_type c)
-{
- BOOST_RE_GUARD_STACK
- const regex_wchar_type* p = combining_ranges + 1;
- while(*p < c) p += 2;
- --p;
- if((c >= *p) && (c <= *(p+1)))
- return true;
- return false;
-}
-
-BOOST_REGEX_DECL unsigned short wide_unicode_classes[] = {
- c_traits_base::char_class_cntrl, // '' 0
- c_traits_base::char_class_cntrl, // '' 1
- c_traits_base::char_class_cntrl, // '' 2
- c_traits_base::char_class_cntrl, // '' 3
- c_traits_base::char_class_cntrl, // '' 4
- c_traits_base::char_class_cntrl, // '' 5
- c_traits_base::char_class_cntrl, // '' 6
- c_traits_base::char_class_cntrl, // '' 7
- c_traits_base::char_class_cntrl, // '' 8
- c_traits_base::char_class_cntrl | c_traits_base::char_class_space | c_traits_base::char_class_blank, // '' 9
- c_traits_base::char_class_cntrl | c_traits_base::char_class_space, // '' 10
- c_traits_base::char_class_cntrl | c_traits_base::char_class_space, // '' 11
- c_traits_base::char_class_cntrl | c_traits_base::char_class_space, // '' 12
- c_traits_base::char_class_cntrl | c_traits_base::char_class_space, // '' 13
- c_traits_base::char_class_cntrl, // '.' 14
- c_traits_base::char_class_cntrl, // '.' 15
- c_traits_base::char_class_cntrl, // '.' 16
- c_traits_base::char_class_cntrl, // '.' 17
- c_traits_base::char_class_cntrl, // '.' 18
- c_traits_base::char_class_cntrl, // '.' 19
- c_traits_base::char_class_cntrl, // '.' 20
- c_traits_base::char_class_cntrl, // '.' 21
- c_traits_base::char_class_cntrl, // '.' 22
- c_traits_base::char_class_cntrl, // '.' 23
- c_traits_base::char_class_cntrl, // '.' 24
- c_traits_base::char_class_cntrl, // '' 25
- c_traits_base::char_class_cntrl, // '' 26
- c_traits_base::char_class_cntrl, // '' 27
- c_traits_base::char_class_cntrl, // '.' 28
- c_traits_base::char_class_cntrl, // '.' 29
- c_traits_base::char_class_cntrl, // '.' 30
- c_traits_base::char_class_cntrl, // '.' 31
- c_traits_base::char_class_space | c_traits_base::char_class_blank, // ' ' 32
- c_traits_base::char_class_punct, // '!' 33
- c_traits_base::char_class_punct, // '"' 34
- c_traits_base::char_class_punct, // '#' 35
- c_traits_base::char_class_punct, // '$' 36
- c_traits_base::char_class_punct, // '%' 37
- c_traits_base::char_class_punct, // '&' 38
- c_traits_base::char_class_punct, // ''' 39
- c_traits_base::char_class_punct, // '(' 40
- c_traits_base::char_class_punct, // ')' 41
- c_traits_base::char_class_punct, // '*' 42
- c_traits_base::char_class_punct, // '+' 43
- c_traits_base::char_class_punct, // ',' 44
- c_traits_base::char_class_punct, // '-' 45
- c_traits_base::char_class_punct, // '.' 46
- c_traits_base::char_class_punct, // '/' 47
- c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '0' 48
- c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '1' 49
- c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '2' 50
- c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '3' 51
- c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '4' 52
- c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '5' 53
- c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '6' 54
- c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '7' 55
- c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '8' 56
- c_traits_base::char_class_digit | c_traits_base::char_class_xdigit, // '9' 57
- c_traits_base::char_class_punct, // ':' 58
- c_traits_base::char_class_punct, // ';' 59
- c_traits_base::char_class_punct, // '<' 60
- c_traits_base::char_class_punct, // '=' 61
- c_traits_base::char_class_punct, // '>' 62
- c_traits_base::char_class_punct, // '?' 63
- c_traits_base::char_class_punct, // '@' 64
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper | c_traits_base::char_class_xdigit, // 'A' 65
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper | c_traits_base::char_class_xdigit, // 'B' 66
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper | c_traits_base::char_class_xdigit, // 'C' 67
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper | c_traits_base::char_class_xdigit, // 'D' 68
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper | c_traits_base::char_class_xdigit, // 'E' 69
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper | c_traits_base::char_class_xdigit, // 'F' 70
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'G' 71
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'H' 72
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'I' 73
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'J' 74
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'K' 75
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'L' 76
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'M' 77
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'N' 78
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'O' 79
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'P' 80
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Q' 81
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'R' 82
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'S' 83
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'T' 84
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'U' 85
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'V' 86
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'W' 87
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'X' 88
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Y' 89
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Z' 90
- c_traits_base::char_class_punct, // '[' 91
- c_traits_base::char_class_punct, // '\' 92
- c_traits_base::char_class_punct, // ']' 93
- c_traits_base::char_class_punct, // '^' 94
- c_traits_base::char_class_punct | c_traits_base::char_class_underscore, // '_' 95
- c_traits_base::char_class_punct, // '`' 96
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower | c_traits_base::char_class_xdigit, // 'a' 97
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower | c_traits_base::char_class_xdigit, // 'b' 98
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower | c_traits_base::char_class_xdigit, // 'c' 99
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower | c_traits_base::char_class_xdigit, // 'd' 100
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower | c_traits_base::char_class_xdigit, // 'e' 101
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower | c_traits_base::char_class_xdigit, // 'f' 102
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'g' 103
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'h' 104
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'i' 105
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'j' 106
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'k' 107
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'l' 108
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'm' 109
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'n' 110
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'o' 111
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'p' 112
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'q' 113
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'r' 114
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 's' 115
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 't' 116
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'u' 117
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'v' 118
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'w' 119
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'x' 120
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'y' 121
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'z' 122
- c_traits_base::char_class_punct, // '{' 123
- c_traits_base::char_class_punct, // '|' 124
- c_traits_base::char_class_punct, // '}' 125
- c_traits_base::char_class_punct, // '~' 126
-
- c_traits_base::char_class_cntrl, // '\7f' 127
- c_traits_base::char_class_cntrl, // '\80' 128
- c_traits_base::char_class_cntrl, // '\81' 129
- c_traits_base::char_class_cntrl, // '\82' 130
- c_traits_base::char_class_cntrl, // '\83' 131
- c_traits_base::char_class_cntrl, // '\84' 132
- c_traits_base::char_class_cntrl, // '\85' 133
- c_traits_base::char_class_cntrl, // '\86' 134
- c_traits_base::char_class_cntrl, // '\87' 135
- c_traits_base::char_class_cntrl, // '\88' 136
- c_traits_base::char_class_cntrl, // '\89' 137
- c_traits_base::char_class_cntrl, // '\8a' 138
- c_traits_base::char_class_cntrl, // '\8b' 139
- c_traits_base::char_class_cntrl, // '\8c' 140
- c_traits_base::char_class_cntrl, // '\8d' 141
- c_traits_base::char_class_cntrl, // '\8e' 142
- c_traits_base::char_class_cntrl, // '\8f' 143
- c_traits_base::char_class_cntrl, // '\90' 144
- c_traits_base::char_class_cntrl, // '\91' 145
- c_traits_base::char_class_cntrl, // '\92' 146
- c_traits_base::char_class_cntrl, // '\93' 147
- c_traits_base::char_class_cntrl, // '\94' 148
- c_traits_base::char_class_cntrl, // '\95' 149
- c_traits_base::char_class_cntrl, // '\96' 150
- c_traits_base::char_class_cntrl, // '\97' 151
- c_traits_base::char_class_cntrl, // '\98' 152
- c_traits_base::char_class_cntrl, // '\99' 153
- c_traits_base::char_class_cntrl, // '\9a' 154
- c_traits_base::char_class_cntrl, // '\9b' 155
- c_traits_base::char_class_cntrl, // '\9c' 156
- c_traits_base::char_class_cntrl, // '\9d' 157
- c_traits_base::char_class_cntrl, // '\9e' 158
- c_traits_base::char_class_cntrl, // '\9f' 159
- c_traits_base::char_class_space | c_traits_base::char_class_blank, // ' ' 160
- c_traits_base::char_class_punct, // '¡' 161
- c_traits_base::char_class_punct, // '¢' 162
- c_traits_base::char_class_punct, // '£' 163
- c_traits_base::char_class_punct, // '¤' 164
- c_traits_base::char_class_punct, // '¥' 165
- c_traits_base::char_class_punct, // '¦' 166
- c_traits_base::char_class_punct, // '§' 167
- c_traits_base::char_class_punct, // '¨' 168
- c_traits_base::char_class_punct, // '©' 169
- c_traits_base::char_class_punct, // 'ª' 170
- c_traits_base::char_class_punct, // '«' 171
- c_traits_base::char_class_punct, // '¬' 172
- c_traits_base::char_class_punct, // '' 173
- c_traits_base::char_class_punct, // '®' 174
- c_traits_base::char_class_punct, // '¯' 175
- c_traits_base::char_class_punct, // '°' 176
- c_traits_base::char_class_punct, // '±' 177
- c_traits_base::char_class_punct, // '²' 178
- c_traits_base::char_class_punct, // '³' 179
- c_traits_base::char_class_punct, // '´' 180
- c_traits_base::char_class_punct, // 'µ' 181
- c_traits_base::char_class_punct, // '¶' 182
- c_traits_base::char_class_punct, // '·' 183
- c_traits_base::char_class_punct, // '¸' 184
- c_traits_base::char_class_punct, // '¹' 185
- c_traits_base::char_class_punct, // 'º' 186
- c_traits_base::char_class_punct, // '»' 187
- c_traits_base::char_class_punct, // '¼' 188
- c_traits_base::char_class_punct, // '½' 189
- c_traits_base::char_class_punct, // '¾' 190
- c_traits_base::char_class_punct, // '¿' 191
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'À' 192
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Á' 193
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Â' 194
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ã' 195
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ä' 196
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Å' 197
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Æ' 198
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ç' 199
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'È' 200
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'É' 201
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ê' 202
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ë' 203
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ì' 204
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Í' 205
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Î' 206
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ï' 207
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ð' 208
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ñ' 209
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ò' 210
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ó' 211
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ô' 212
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Õ' 213
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ö' 214
- c_traits_base::char_class_punct, // '×' 215
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ø' 216
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ù' 217
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ú' 218
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Û' 219
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ü' 220
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Ý' 221
- c_traits_base::char_class_alpha | c_traits_base::char_class_upper, // 'Þ' 222
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ß' 223
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'à' 224
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'á' 225
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'â' 226
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ã' 227
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ä' 228
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'å' 229
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'æ' 230
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ç' 231
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'è' 232
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'é' 233
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ê' 234
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ë' 235
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ì' 236
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'í' 237
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'î' 238
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ï' 239
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ð' 240
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ñ' 241
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ò' 242
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ó' 243
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ô' 244
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'õ' 245
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ö' 246
- c_traits_base::char_class_punct, // '÷' 247
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ø' 248
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ù' 249
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ú' 250
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'û' 251
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ü' 252
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ý' 253
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'þ' 254
- c_traits_base::char_class_alpha | c_traits_base::char_class_lower, // 'ÿ' 255
-};
-
-BOOST_REGEX_DECL regex_wchar_type wide_lower_case_map[] = {
- 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
- 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
- 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
- 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
- 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf,
- 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
-};
-#endif // BOOST_NO_WREGEX
-
- } // namespace re_detail
-} // namespace boost
-
-
-
-
/*
*
- * Copyright (c) 1998-2002
- * Dr John Maddock
+ * Copyright (c) 2004
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
/*
* LOCATION: see http://www.boost.org for most recent version.
- * FILE: c_regex_traits.cpp
- * VERSION: see <boost/version.hpp>
- * DESCRIPTION: Implements the cpp_regex_traits<charT> traits class
+ * FILE cpp_regex_traits.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Implements cpp_regex_traits<char> (and associated helper classes).
*/
-
#define BOOST_REGEX_SOURCE
-
-#include <boost/regex/config.hpp>
-
-#if defined(BOOST_REGEX_HAS_SHORT_WCHAR_T) && !defined(_NATIVE_WCHAR_T_DEFINED)
-# pragma message ("disabling support for class cpp_regex_traits<wchar_t> - rebuild with /Zc:wchar_t if you really need this")
-# define BOOST_NO_WREGEX
-#endif
-
-#if !defined(BOOST_NO_STD_LOCALE)
-
-# ifdef BOOST_MSVC
-# pragma warning(disable:4786 4702 4127 4244)
-# endif
-
-#include <clocale>
-#include <locale>
-#include <cstdio>
-#include <list>
-#include <cctype>
-#include <ios>
-#include <iostream>
-#include <map>
+#include <boost/config.hpp>
+#ifndef BOOST_NO_STD_LOCALE
#include <boost/regex/regex_traits.hpp>
-#include <boost/cregex.hpp>
-#include <boost/scoped_array.hpp>
-#include "primary_transform.hpp"
-
-# ifdef BOOST_MSVC
-# pragma warning(disable:4786 4702 4127 4244)
-# endif
-
-namespace{
- const unsigned int re_classes_max = 14;
- const unsigned int char_set_size = CHAR_MAX - CHAR_MIN + 1;
+#include <boost/regex/pattern_except.hpp>
-boost::uint_fast32_t re_char_class_id[] = {
- boost::re_detail::cpp_regex_traits_base::char_class_alnum,
- boost::re_detail::cpp_regex_traits_base::char_class_alpha,
- boost::re_detail::cpp_regex_traits_base::char_class_cntrl,
- boost::re_detail::cpp_regex_traits_base::char_class_digit,
- boost::re_detail::cpp_regex_traits_base::char_class_graph,
- boost::re_detail::cpp_regex_traits_base::char_class_lower,
- boost::re_detail::cpp_regex_traits_base::char_class_print,
- boost::re_detail::cpp_regex_traits_base::char_class_punct,
- boost::re_detail::cpp_regex_traits_base::char_class_space,
- boost::re_detail::cpp_regex_traits_base::char_class_upper,
- boost::re_detail::cpp_regex_traits_base::char_class_xdigit,
- boost::re_detail::cpp_regex_traits_base::char_class_blank,
- boost::re_detail::cpp_regex_traits_base::char_class_word,
- boost::re_detail::cpp_regex_traits_base::char_class_unicode,
-};
-
-const char* re_char_class_names[] = {
-"alnum",
-"alpha",
-"cntrl",
-"digit",
-"graph",
-"lower",
-"print",
-"punct",
-"space",
-"upper",
-"xdigit",
-"blank",
-"word",
-"unicode",
-};
-
-template <class charT,
- class traits = ::std::char_traits<charT> >
-class parser_buf : public ::std::basic_streambuf<charT, traits>
-{
- typedef ::std::basic_streambuf<charT, traits> base_type;
- typedef typename base_type::int_type int_type;
- typedef typename base_type::char_type char_type;
- typedef typename base_type::pos_type pos_type;
- typedef ::std::streamsize streamsize;
- typedef typename base_type::off_type off_type;
-public:
- parser_buf() : base_type() { setbuf(0, 0); }
- const charT* getnext() { return this->gptr(); }
-protected:
- std::basic_streambuf<charT, traits>* setbuf(char_type* s, streamsize n);
- typename parser_buf<charT, traits>::pos_type seekpos(pos_type sp, ::std::ios_base::openmode which);
- typename parser_buf<charT, traits>::pos_type seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which);
-private:
- parser_buf& operator=(const parser_buf&);
- parser_buf(const parser_buf&);
-};
-
-template<class charT, class traits>
-std::basic_streambuf<charT, traits>*
-parser_buf<charT, traits>::setbuf(char_type* s, streamsize n)
-{
- this->setg(s, s, s + n);
- return this;
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std{
+ using ::memset;
}
+#endif
-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)
-{
- 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)
- {
- case ::std::ios_base::beg:
- if((off < 0) || (off > size))
- return pos_type(off_type(-1));
- else
- this->setg(g, g + off, g + size);
- break;
- case ::std::ios_base::end:
- if((off < 0) || (off > size))
- return pos_type(off_type(-1));
- else
- this->setg(g, g + size - off, g + size);
- break;
- case ::std::ios_base::cur:
- {
- std::ptrdiff_t newpos = pos + off;
- if((newpos < 0) || (newpos > size))
- return pos_type(off_type(-1));
- else
- this->setg(g, g + newpos, g + size);
- break;
- }
- default: ;
- }
- return static_cast<pos_type>(this->gptr() - this->eback());
-}
-
-template<class charT, class traits>
-typename parser_buf<charT, traits>::pos_type
-parser_buf<charT, traits>::seekpos(pos_type sp, ::std::ios_base::openmode which)
-{
- if(which & ::std::ios_base::out)
- return pos_type(off_type(-1));
- off_type size = this->egptr() - this->eback();
- charT* g = this->eback();
- if(off_type(sp) <= size)
- {
- this->setg(g, g + off_type(sp), g + size);
- }
- return pos_type(off_type(-1));
-}
-
-
-} // namespace
-
-namespace boost{
- namespace re_detail{
-
-template <>
-struct message_data<char>
-{
- unsigned char syntax_map[CHAR_MAX-CHAR_MIN];
- std::map<std::string, std::string, std::less<std::string> > collating_elements;
- std::map<std::string, std::size_t, std::less<std::string> > classes;
- //std::string _zero;
- //std::string _ten;
- parser_buf<char> sbuf;
- std::istream is;
- std::string error_strings[boost::REG_E_UNKNOWN+1];
-
- message_data(const std::locale& l, std::string regex_message_catalogue);
-private:
- message_data(const message_data&);
- message_data& operator=(const message_data&);
-};
-
+namespace boost{ namespace re_detail{
-message_data<char>::message_data(const std::locale& l, std::string regex_message_catalogue)
- : is(&sbuf)
+void cpp_regex_traits_char_layer<char>::init()
{
- is.imbue(l);
+ // we need to start by initialising our syntax map so we know which
+ // character is used for which purpose:
+ std::memset(m_char_map, 0, sizeof(m_char_map));
#ifndef BOOST_NO_STD_MESSAGES
-
- const std::messages<char>* pm = 0;
#ifndef __IBMCPP__
std::messages<char>::catalog cat = static_cast<std::messages<char>::catalog>(-1);
#else
std::messages<char>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
#endif
- if(regex_message_catalogue.size())
+ std::string cat_name(cpp_regex_traits<char>::get_catalog_name());
+ if(cat_name.size())
{
- pm = &BOOST_USE_FACET(std::messages<char>, l);
- cat = pm->open(regex_message_catalogue, l);
- if(cat < 0)
+ cat = this->m_pmessages->open(
+ cat_name,
+ this->m_locale);
+ if((int)cat < 0)
{
std::string m("Unable to open message catalog: ");
- std::runtime_error err(m + regex_message_catalogue);
- boost::throw_exception(err);
- }
- }
-#endif
- std::memset(syntax_map, cpp_regex_traits<char>::syntax_char, 256);
- unsigned i;
- scoped_array<char> a;
- std::size_t array_size = 0;
- std::size_t new_size;
- for(i = 1; i < cpp_regex_traits<char>::syntax_max; ++i)
- {
- new_size = re_get_default_message(0, 0, i+100);
- if(new_size > array_size)
- {
- a.reset(new char[new_size]);
- array_size = new_size;
- }
- re_get_default_message(a.get(), array_size, i+100);
- std::string s = a.get();
-#ifndef BOOST_NO_STD_MESSAGES
- if((int)cat >= 0)
- s = pm->get(cat, 0, i+100, s);
-#endif
- for(std::size_t j = 0; j < s.size(); ++j)
- {
- syntax_map[(unsigned char)s[j]] = (unsigned char)(i);
+ std::runtime_error err(m + cat_name);
+ boost::re_detail::raise_runtime_error(err);
}
}
-
-#ifndef BOOST_NO_STD_MESSAGES
- // load any custom collate names:
//
- // for some reason Borland C++ Builder 6 won't let us use
- // std::isspace(char, std::locale) unless we call it
- // unqualifed - weird. This seems to be affecting other
- // STLport users as well (gcc3.1+STLport5), so enable the
- // workaround for all STLport users...
+ // if we have a valid catalog then load our messages:
//
-#if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && !defined(BOOST_MSVC)
- using namespace std;
- using stlport::isspace;
-# define BOOST_REGEX_STD
-#else
-# define BOOST_REGEX_STD std::
-#endif
-
- std::string c1, c2;
- i = 400;
if((int)cat >= 0)
{
- c2 = pm->get(cat, 0, i, c1);
- while(c2.size())
- {
- const char* p1, *p2, *p3, *p4;;
- p1 = c2.c_str();
- while(*p1 && BOOST_REGEX_STD isspace((char)*p1, l))++p1;
- p2 = p1;
- while(*p2 && !BOOST_REGEX_STD isspace((char)*p2, l))++p2;
- p3 = p2;
- while(*p3 && BOOST_REGEX_STD isspace((char)*p3, l))++p3;
- p4 = p3;
- while(*p4 && !BOOST_REGEX_STD isspace((char)*p4, l))++p4;
- collating_elements[std::string(p1, p2)] = std::string(p3, p4);
-
- ++i;
- c2 = pm->get(cat, 0, i, c1);
- }
- }
-#endif
- std::string m;
- std::string s;
-#ifndef BOOST_NO_STD_MESSAGES
- if((int)cat >= 0)
- {
- for(i = 0; i < re_classes_max; ++i)
- {
- s = pm->get(cat, 0, i+300, m);
- if(s.size())
- classes[s] = i;
- }
- for(i = 0; i <= boost::REG_E_UNKNOWN ; ++i)
- {
- s = pm->get(cat, 0, i+200, m);
- error_strings[i] = s;
- }
- }
-
- if((int)cat >= 0)
- pm->close(cat);
-#endif
-}
-
-std::string BOOST_REGEX_CALL cpp_regex_traits_base::set_message_catalogue(const std::string& l)
-{
- if(sizeof(regex_message_cat) <= l.size())
- return l;
- std::string old(regex_message_cat);
- std::strcpy(regex_message_cat, l.c_str());
- return old;
-}
-
-char cpp_regex_traits_base::regex_message_cat[BOOST_REGEX_MAX_PATH] = {0};
-
-
-} // namespace re_detail
-
-
-cpp_regex_traits<char>::cpp_regex_traits()
-{
- pmd = new re_detail::message_data<char>(locale_inst, regex_message_cat);
- psyntax = pmd->syntax_map;
#ifndef BOOST_NO_EXCEPTIONS
- try{
+ try{
#endif
- lower_map = new char[char_set_size];
- BOOST_REGEX_NOEH_ASSERT(lower_map)
-#ifndef BOOST_NO_EXCEPTIONS
- }
- catch(...)
- {
- delete pmd;
- throw;
- }
-#endif
- for(unsigned int i = 0; i < char_set_size; ++i)
- lower_map[i] = static_cast<char>(i);
- pctype = &BOOST_USE_FACET(std::ctype<char>, locale_inst);
- pctype->tolower(&lower_map[0], &lower_map[char_set_size]);
- pcollate = &BOOST_USE_FACET(std::collate<char>, locale_inst);
- sort_type = re_detail::find_sort_syntax(this, &(this->sort_delim));
-}
-
-void cpp_regex_traits<char>::swap(cpp_regex_traits<char>& that)
-{
- std::swap(locale_inst, that.locale_inst); // this one goes first
- std::swap(pmd, that.pmd);
- std::swap(psyntax, that.psyntax);
- std::swap(lower_map, that.lower_map);
- std::swap(pctype, that.pctype);
- std::swap(pcollate, that.pcollate);
- std::swap(sort_type, that.sort_type);
- std::swap(sort_delim, that.sort_delim);
-}
-
-cpp_regex_traits<char>::~cpp_regex_traits()
-{
- delete pmd;
- delete[] lower_map;
-}
-
-int BOOST_REGEX_CALL cpp_regex_traits<char>::toi(char c)const
-{
- pmd->sbuf.pubsetbuf(&c, 1);
- pmd->is.clear();
- pmd->is >> std::dec;
- int val;
- if(pmd->is >> val)
- {
- return val;
- }
- else
- return 0;
-}
-
-int BOOST_REGEX_CALL cpp_regex_traits<char>::toi(const char*& first, const char* last, int radix)const
-{
- pmd->sbuf.pubsetbuf(const_cast<char*>(static_cast<const char*>(first)), static_cast<std::streamsize>(last-first));
- pmd->is.clear();
- if(std::abs(radix) == 16) pmd->is >> std::hex;
- else if(std::abs(radix) == 8) pmd->is >> std::oct;
- else pmd->is >> std::dec;
- int val;
- if(pmd->is >> val)
- {
- first = first + ((last - first) - pmd->sbuf.in_avail());
- return val;
- }
- else
- return 0;
-}
-
-boost::uint_fast32_t BOOST_REGEX_CALL cpp_regex_traits<char>::lookup_classname(const char* first, const char* last)const
-{
- BOOST_RE_GUARD_STACK
- unsigned int i;
- std::string s(first, last);
-
- std::map<std::string, std::size_t, std::less<std::string> >::const_iterator pos = pmd->classes.find(s);
- if(pos != pmd->classes.end())
- return re_char_class_id[(*pos).second];
-
- for(i = 0; i < re_classes_max; ++i)
- {
- if(s == re_char_class_names[i])
- return re_char_class_id[i];
- }
- return 0;
-}
-
-bool BOOST_REGEX_CALL cpp_regex_traits<char>::lookup_collatename(std::string& s, const char* first, const char* last)const
-{
- BOOST_RE_GUARD_STACK
- std::string name(first, last);
- std::map<std::string, std::string, std::less<std::string > >::const_iterator pos = pmd->collating_elements.find(name);
- if(pos != pmd->collating_elements.end())
- {
- s = (*pos).second;
- return true;
- }
- return re_detail::re_lookup_def_collate_name(s, name.c_str());
-}
-
-void BOOST_REGEX_CALL cpp_regex_traits<char>::transform_primary(std::string& out, const std::string& in)const
-{
- transform(out, in);
- switch(sort_type)
- {
- case re_detail::sort_C:
- case re_detail::sort_unknown:
- break;
- case re_detail::sort_fixed:
- if((unsigned)sort_delim < out.size())
- out.erase((int)sort_delim);
- break;
- case re_detail::sort_delim:
- for(unsigned int i = 0; i < out.size(); ++i)
- {
- if((out[i] == sort_delim) && (i+1 < out.size()))
- {
- out.erase(i+1);
- break;
- }
- }
- }
-}
-
-
-std::string BOOST_REGEX_CALL cpp_regex_traits<char>::error_string(unsigned id)const
-{
- if((id <= boost::REG_E_UNKNOWN) && (pmd->error_strings[id].size()))
- return pmd->error_strings[id];
- return boost::re_detail::re_default_error_messages[id];
-}
-
-cpp_regex_traits<char>::locale_type BOOST_REGEX_CALL cpp_regex_traits<char>::imbue(locale_type l)
-{
- locale_type old_l(locale_inst);
- locale_inst = l;
- re_detail::message_data<char>* npmd = new re_detail::message_data<char>(locale_inst, regex_message_cat);
- delete pmd;
- pmd = npmd;
- psyntax = pmd->syntax_map;
- for(unsigned int i = 0; i < char_set_size; ++i)
- lower_map[i] = static_cast<char>(i);
- pctype = &BOOST_USE_FACET(std::ctype<char>, locale_inst);
- pctype->tolower(&lower_map[0], &lower_map[char_set_size]);
- pcollate = &BOOST_USE_FACET(std::collate<char>, locale_inst);
- sort_type = re_detail::find_sort_syntax(this, &(this->sort_delim));
- return old_l;
-}
-
-#if !defined(BOOST_NO_WREGEX) && !defined(BOOST_NO_STD_WSTREAMBUF)
-
-namespace re_detail{
-
-std::string BOOST_REGEX_CALL to_narrow(const std::basic_string<wchar_t>& is, const std::codecvt<wchar_t, char, std::mbstate_t>& cvt)
-{
- BOOST_RE_GUARD_STACK
- std::basic_string<wchar_t>::size_type bufsize = is.size() * 2;
- //
- // declare buffer first as VC6 workaround for internal compiler error!
- char* pc = new char[bufsize];
- scoped_array<char> t(pc);
- #if defined(BOOST_MSVC) && !defined(DINKUMWARE_CE)
- std::mbstate_t state = 0;
- #else
- std::mbstate_t state = std::mbstate_t();
- #endif
-
- const wchar_t* next_in;
- char* next_out;
- while(true)
- {
- switch(cvt.out(state, is.c_str(), is.c_str() + is.size(), next_in, t.get(), t.get() + bufsize, next_out))
- {
- case std::codecvt_base::ok:
- return std::string(t.get(), next_out);
- case std::codecvt_base::partial:
- bufsize *= 2;
- t.reset(new char[bufsize]);
- continue;
- case std::codecvt_base::error:
- // not much we can do here but guess:
- case std::codecvt_base::noconv:
- std::string out;
- for(unsigned i = 0; i < is.size(); ++i)
+ for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
{
- out.append(1, (char)is[i]);
+ string_type mss = this->m_pmessages->get(cat, 0, i, get_default_syntax(i));
+ for(string_type::size_type j = 0; j < mss.size(); ++j)
+ {
+ m_char_map[static_cast<unsigned char>(mss[j])] = i;
+ }
}
- return out;
+ this->m_pmessages->close(cat);
+#ifndef BOOST_NO_EXCEPTIONS
}
- }
-}
-
-std::wstring BOOST_REGEX_CALL to_wide(const std::string& is, const std::codecvt<wchar_t, char, std::mbstate_t>& cvt)
-{
- BOOST_RE_GUARD_STACK
- std::string::size_type bufsize = is.size() + 2;
- std::string::size_type maxsize = is.size() * 100;
- //
- // declare buffer first as VC6 workaround for internal compiler error!
- wchar_t* pc = new wchar_t[bufsize];
- scoped_array<wchar_t> t(pc);
- #if defined(BOOST_MSVC) && !defined(DINKUMWARE_CE)
- std::mbstate_t state = 0;
- #else
- std::mbstate_t state = std::mbstate_t();
- #endif
-
-
- wchar_t* next_out;
- const char* next_in;
- while(true)
- {
- switch(cvt.in(state, is.c_str(), is.c_str() + is.size(), next_in, t.get(), t.get() + bufsize, next_out))
+ catch(...)
{
- case std::codecvt_base::ok:
- return std::wstring(t.get(), next_out);
- case std::codecvt_base::partial:
- bufsize *= 2;
- if(bufsize < maxsize)
- {
- t.reset(new wchar_t[bufsize]);
- continue;
- }
- //
- // error fall through:
- case std::codecvt_base::error:
- // not much we can do here but guess:
- case std::codecvt_base::noconv:
- std::wstring out;
- for(unsigned i = 0; i < is.size(); ++i)
- {
- out.append(1, is[i]);
- }
- return out;
+ this->m_pmessages->close(cat);
+ throw;
}
- }
-}
-
-
-
-template <>
-struct message_data<wchar_t>
-{
-#ifndef BOOST_NO_STD_MESSAGES
- typedef std::messages<wchar_t>::string_type string_type;
-#else
- typedef std::wstring string_type;
-#endif
-
- string_type name;
-
- struct syntax_map
- {
- wchar_t c;
- unsigned int type;
- };
-
- std::list<syntax_map> syntax;
- std::map<string_type, std::size_t> classes;
- std::map<string_type, string_type> collating_elements;
- unsigned char syntax_[CHAR_MAX-CHAR_MIN+1];
-
- parser_buf<wchar_t> sbuf;
- std::wistream is;
- std::string error_strings[boost::REG_E_UNKNOWN+1];
-
- message_data(const std::locale& l, const std::string& regex_message_catalogue);
-private:
- message_data(const message_data&);
- message_data& operator=(const message_data&);
-};
-
-message_data<wchar_t>::message_data(const std::locale& l, const std::string& regex_message_catalogue)
- : is(&sbuf)
-{
- is.imbue(l);
- syntax_map m;
- typedef std::codecvt<wchar_t, char, std::mbstate_t> cvt_type;
- const cvt_type& cvt = BOOST_USE_FACET(cvt_type, l);
-#ifndef BOOST_NO_STD_MESSAGES
- const std::messages<wchar_t>& msgs = BOOST_USE_FACET(std::messages<wchar_t>, l);
-#ifndef __IBMCPP__
- std::messages<wchar_t>::catalog cat = static_cast<std::messages<wchar_t>::catalog>(-1);
-#else
- std::messages<wchar_t>::catalog cat = reinterpret_cast<std::messages<wchar_t>::catalog>(-1);
#endif
- if(regex_message_catalogue.size())
- {
- cat = msgs.open(regex_message_catalogue, l);
- if(cat < 0)
- {
- std::string mess("Unable to open message catalog: ");
- std::runtime_error err(mess + regex_message_catalogue);
- boost::throw_exception(err);
- }
}
-#endif
- scoped_array<char> a;
- std::size_t array_size = 0;
- std::size_t new_size;
- std::size_t i;
- std::memset(syntax_, cpp_regex_traits<wchar_t>::syntax_char, sizeof(syntax_));
- for(i = 1; i < cpp_regex_traits<wchar_t>::syntax_max; ++i)
+ else
{
- new_size = re_get_default_message(0, 0, i+100);
- if(new_size > array_size)
- {
- a.reset(new char[new_size]);
- array_size = new_size;
- }
- re_get_default_message(a.get(), array_size, i+100);
- std::string ns = a.get();
- string_type s = to_wide(ns, cvt);
-#ifndef BOOST_NO_STD_MESSAGES
- if((int)cat >= 0)
- s = BOOST_USE_FACET(std::messages<wchar_t>, l).get(cat, 0, (int)i+100, s);
#endif
- for(unsigned int j = 0; j < s.size(); ++j)
+ for(regex_constants::syntax_type j = 1; j < regex_constants::syntax_max; ++j)
{
-#if defined(WCHAR_MIN) && (WCHAR_MIN == 0)
- if(s[j] <= UCHAR_MAX)
-#else
- if((s[j] <= UCHAR_MAX) && (s[j] >= 0))
-#endif
- syntax_[s[j]] = static_cast<unsigned char>(i);
- else
+ const char* ptr = get_default_syntax(j);
+ while(ptr && *ptr)
{
- m.c = s[j];
- m.type = static_cast<unsigned int>(i);
- syntax.push_back(m);
+ m_char_map[static_cast<unsigned char>(*ptr)] = j;
+ ++ptr;
}
}
- }
-
#ifndef BOOST_NO_STD_MESSAGES
- // load any custom collate names:
- string_type c1, c2;
- i = 400;
- if((int)cat >= 0)
- {
- c2 = msgs.get(cat, 0, (int)i, c1);
- while(c2.size())
- {
- const wchar_t* p1, *p2, *p3, *p4;;
- p1 = c2.c_str();
- while(*p1 && BOOST_REGEX_STD isspace((wchar_t)*p1, l))++p1;
- p2 = p1;
- while(*p2 && !BOOST_REGEX_STD isspace((wchar_t)*p2, l))++p2;
- p3 = p2;
- while(*p3 && BOOST_REGEX_STD isspace((wchar_t)*p3, l))++p3;
- p4 = p3;
- while(*p4 && !BOOST_REGEX_STD isspace((wchar_t)*p4, l))++p4;
- collating_elements[std::basic_string<wchar_t>(p1, p2)] = std::basic_string<wchar_t>(p3, p4);
-
- ++i;
- c2 = msgs.get(cat, 0, (int)i, c1);
- }
- }
-
- if((int)cat >= 0)
- {
- c2.erase();
- for(i = 0; i < re_classes_max; ++i)
- {
- c1 = msgs.get(cat, 0, static_cast<int>(i+300), c2);
- if(c1.size())
- classes[c1] = i;
- }
- for(i = 0; i <= boost::REG_E_UNKNOWN ; ++i)
- {
- c1 = msgs.get(cat, 0, static_cast<int>(i+200), c2);
- error_strings[i] = to_narrow(c1, cvt);
- }
- }
-
- if((int)cat >= 0)
- msgs.close(cat);
-#endif
-}
-
-} // namespace re_detail
-
-unsigned int BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::do_syntax_type(size_type c)const
-{
- std::list<re_detail::message_data<wchar_t>::syntax_map>::const_iterator i, j;
- i = pmd->syntax.begin();
- j = pmd->syntax.end();
- while(i != j)
- {
- if(((uchar_type)(*i).c) == c)
- return (*i).type;
- ++i;
}
- return 0;
-}
-
-void BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::transform_primary(std::basic_string<wchar_t>& out, const std::basic_string<wchar_t>& in)const
-{
- transform(out, in);
- switch(sort_type)
+#endif
+ //
+ // finish off by calculating our escape types:
+ //
+ unsigned char i = 'A';
+ do
{
- case re_detail::sort_C:
- case re_detail::sort_unknown:
- break;
- case re_detail::sort_fixed:
- if((unsigned)sort_delim < out.size())
- out.erase((int)sort_delim);
- break;
- case re_detail::sort_delim:
- for(unsigned int i = 0; i < out.size(); ++i)
+ if(m_char_map[i] == 0)
{
- if((out[i] == sort_delim) && (i+1 < out.size()))
- {
- out.erase(i+1);
- break;
- }
+ if(this->m_pctype->is(std::ctype_base::lower, i))
+ m_char_map[i] = regex_constants::escape_type_class;
+ else if(this->m_pctype->is(std::ctype_base::upper, i))
+ m_char_map[i] = regex_constants::escape_type_not_class;
}
- }
-}
-
-int BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::toi(wchar_t c)const
-{
- pmd->sbuf.pubsetbuf(&c, 1);
- pmd->is.clear();
- pmd->is >> std::dec;
- int val;
- if(pmd->is >> val)
- {
- return val;
- }
- else
- return 0;
-}
-
-int BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::toi(const wchar_t*& first, const wchar_t* last, int radix)const
-{
- pmd->sbuf.pubsetbuf(const_cast<wchar_t*>(first), static_cast<std::streamsize>(last-first));
- pmd->is.clear();
- if(std::abs(radix) == 16) pmd->is >> std::hex;
- else if(std::abs(radix) == 8) pmd->is >> std::oct;
- else pmd->is >> std::dec;
- int val;
- if(pmd->is >> val)
- {
- first = first + ((last - first) - pmd->sbuf.in_avail());
- return val;
- }
- else
- return 0;
-}
-
-boost::uint_fast32_t BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::lookup_classname(const wchar_t* first, const wchar_t* last)const
-{
- BOOST_RE_GUARD_STACK
- unsigned int i;
- std::wstring s(first, last);
-
- std::map<std::wstring, std::size_t>::const_iterator pos = pmd->classes.find(s);
- if(pos != pmd->classes.end())
- return re_char_class_id[(*pos).second];
-
- std::string ns = re_detail::to_narrow(s, *pcdv);
-
- for(i = 0; i < re_classes_max; ++i)
- {
- if(ns == re_char_class_names[i])
- return re_char_class_id[i];
- }
- return 0;
-}
-
-bool BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::lookup_collatename(std::basic_string<wchar_t>& s, const wchar_t* first, const wchar_t* last)const
-{
- BOOST_RE_GUARD_STACK
- std::wstring name(first, last);
- std::map<std::wstring, std::wstring>::const_iterator pos = pmd->collating_elements.find(name);
- if(pos != pmd->collating_elements.end())
- {
- s = (*pos).second;
- return true;
- }
- std::string ns = re_detail::to_narrow(name, *pcdv);
- std::string ns2;
- bool result = re_detail::re_lookup_def_collate_name(ns2, ns.c_str());
- s = re_detail::to_wide(ns2, *pcdv);
- return result;
-}
-
-std::string BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::error_string(unsigned id)const
-{
- if((id <= boost::REG_E_UNKNOWN) && (pmd->error_strings[id].size()))
- return pmd->error_strings[id];
- return boost::re_detail::re_default_error_messages[id];
+ }while(0xFF != i++);
}
-cpp_regex_traits<wchar_t>::cpp_regex_traits()
-{
- pmd = new re_detail::message_data<wchar_t>(locale_inst, std::string(regex_message_cat));
- psyntax = pmd->syntax_;
-#ifndef BOOST_NO_EXCEPTIONS
- try{
+} // re_detail
+} // boost
#endif
- lower_map = new wchar_t[char_set_size];
- BOOST_REGEX_NOEH_ASSERT(lower_map)
-#ifndef BOOST_NO_EXCEPTIONS
- }
- catch(...)
- {
- delete pmd;
- throw;
- }
-#endif
- for(unsigned int i = 0; i < char_set_size; ++i)
- lower_map[i] = static_cast<wchar_t>(i);
- pctype = &BOOST_USE_FACET(std::ctype<wchar_t>, locale_inst);
- pctype->tolower(&lower_map[0], &lower_map[char_set_size]);
- pcollate = &BOOST_USE_FACET(std::collate<wchar_t>, locale_inst);
- typedef std::codecvt<wchar_t, char, std::mbstate_t> cvt_t;
- pcdv = &BOOST_USE_FACET(cvt_t, locale_inst);
- sort_type = re_detail::find_sort_syntax(this, &(this->sort_delim));
-}
-
-cpp_regex_traits<wchar_t>::~cpp_regex_traits()
-{
- delete pmd;
- delete[] lower_map;
-}
-
-cpp_regex_traits<wchar_t>::locale_type BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::imbue(locale_type l)
-{
- locale_type old_l(locale_inst);
- locale_inst = l;
- re_detail::message_data<wchar_t>* npmd = new re_detail::message_data<wchar_t>(locale_inst, std::string(regex_message_cat));
- delete pmd;
- pmd = npmd;
- psyntax = pmd->syntax_;
- for(unsigned int i = 0; i < char_set_size; ++i)
- lower_map[i] = static_cast<wchar_t>(i);
- pctype = &BOOST_USE_FACET(std::ctype<wchar_t>, locale_inst);
- pctype->tolower(&lower_map[0], &lower_map[char_set_size]);
- pcollate = &BOOST_USE_FACET(std::collate<wchar_t>, locale_inst);
- typedef std::codecvt<wchar_t, char, std::mbstate_t> cvt_t;
- pcdv = &BOOST_USE_FACET(cvt_t, locale_inst);
- sort_type = re_detail::find_sort_syntax(this, &(this->sort_delim));
- return old_l;
-}
-
-std::size_t BOOST_REGEX_CALL cpp_regex_traits<wchar_t>::strwiden(wchar_t *s1, std::size_t len, const char *s2)const
-{
- std::string s(s2);
- std::wstring ws = re_detail::to_wide(s2, *pcdv);
- if(len > ws.size())
- std::wcscpy(s1, ws.c_str());
- return ws.size()+1;
-}
-
-void cpp_regex_traits<wchar_t>::swap(cpp_regex_traits<wchar_t>& that)
-{
- std::swap(locale_inst, that.locale_inst); // this one must go first
- std::swap(pmd, that.pmd);
- std::swap(psyntax, that.psyntax);
- std::swap(lower_map, that.lower_map);
- std::swap(pctype, that.pctype);
- std::swap(pcollate, that.pcollate);
- std::swap(pcdv, that.pcdv);
- std::swap(sort_type, that.sort_type);
- std::swap(sort_delim, that.sort_delim);
-}
-
-#endif // BOOST_NO_WREGEX
-
-
-} // namespace boost
-
-#endif
-
-
-
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#include <boost/cregex.hpp>
#include <boost/regex.hpp>
-#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
-# include <boost/integer_traits.hpp>
-#endif
#if !defined(BOOST_NO_STD_STRING)
#include <map>
#include <list>
template <class iterator>
std::string to_string(iterator i, iterator j)
{
- BOOST_RE_GUARD_STACK
std::string s;
while(i != j)
{
void RegExData::update()
{
- BOOST_RE_GUARD_STACK
strings.erase(strings.begin(), strings.end());
positions.erase(positions.begin(), positions.end());
if(t == type_pc)
for(unsigned int i = 0; i < m.size(); ++i)
{
if(m[i].matched) strings[i] = std::string(m[i].first, m[i].second);
- positions[i] = m[i].matched ? m[i].first - pbase : RegEx::npos;
+ positions[i] = m[i].matched ? m[i].first - pbase : -1;
}
}
#ifndef BOOST_REGEX_NO_FILEITER
for(unsigned int i = 0; i < fm.size(); ++i)
{
if(fm[i].matched) strings[i] = to_string(fm[i].first, fm[i].second);
- positions[i] = fm[i].matched ? fm[i].first - fbase : RegEx::npos;
+ positions[i] = fm[i].matched ? fm[i].first - fbase : -1;
}
}
#endif
void RegExData::clean()
{
- BOOST_RE_GUARD_STACK
#ifndef BOOST_REGEX_NO_FILEITER
fbase = mapfile::iterator();
fm = match_results<mapfile::iterator>();
RegEx::RegEx()
{
- BOOST_RE_GUARD_STACK
pdata = new re_detail::RegExData();
}
RegEx::RegEx(const RegEx& o)
{
- BOOST_RE_GUARD_STACK
pdata = new re_detail::RegExData(*(o.pdata));
}
RegEx::~RegEx()
{
- BOOST_RE_GUARD_STACK
delete pdata;
}
RegEx::RegEx(const char* c, bool icase)
{
- BOOST_RE_GUARD_STACK
pdata = new re_detail::RegExData();
SetExpression(c, icase);
}
RegEx::RegEx(const std::string& s, bool icase)
{
- BOOST_RE_GUARD_STACK
pdata = new re_detail::RegExData();
SetExpression(s.c_str(), icase);
}
RegEx& RegEx::operator=(const RegEx& o)
{
- BOOST_RE_GUARD_STACK
*pdata = *(o.pdata);
return *this;
}
RegEx& RegEx::operator=(const char* p)
{
- BOOST_RE_GUARD_STACK
SetExpression(p, false);
return *this;
}
unsigned int RegEx::SetExpression(const char* p, bool icase)
{
- BOOST_RE_GUARD_STACK
- boost::uint_fast32_t f = icase ? regex::normal | regex::use_except | regex::icase : regex::normal | regex::use_except;
+ boost::uint_fast32_t f = icase ? regex::normal | regex::icase : regex::normal;
return pdata->e.set_expression(p, f);
}
std::string RegEx::Expression()const
{
- BOOST_RE_GUARD_STACK
return pdata->e.expression();
}
//
bool RegEx::Match(const char* p, match_flag_type flags)
{
- BOOST_RE_GUARD_STACK
pdata->t = re_detail::RegExData::type_pc;
pdata->pbase = p;
const char* end = p;
bool RegEx::Search(const char* p, match_flag_type flags)
{
- BOOST_RE_GUARD_STACK
pdata->t = re_detail::RegExData::type_pc;
pdata->pbase = p;
const char* end = p;
}
unsigned int RegEx::Grep(GrepCallback cb, const char* p, match_flag_type flags)
{
- BOOST_RE_GUARD_STACK
pdata->t = re_detail::RegExData::type_pc;
pdata->pbase = p;
const char* end = p;
unsigned int RegEx::Grep(std::vector<std::string>& v, const char* p, match_flag_type flags)
{
- BOOST_RE_GUARD_STACK
pdata->t = re_detail::RegExData::type_pc;
pdata->pbase = p;
const char* end = p;
}
unsigned int RegEx::Grep(std::vector<std::size_t>& v, const char* p, match_flag_type flags)
{
- BOOST_RE_GUARD_STACK
pdata->t = re_detail::RegExData::type_pc;
pdata->pbase = p;
const char* end = p;
namespace{
void BuildFileList(std::list<std::string>* pl, const char* files, bool recurse)
{
- BOOST_RE_GUARD_STACK
file_iterator start(files);
file_iterator end;
if(recurse)
{
// go through sub directories:
char buf[MAX_PATH];
- std::strcpy(buf, start.root());
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(buf, MAX_PATH, start.root()));
if(*buf == 0)
{
- std::strcpy(buf, ".");
- std::strcat(buf, directory_iterator::separator());
- std::strcat(buf, "*");
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(buf, MAX_PATH, "."));
+ re_detail::overflow_error_if_not_zero(re_detail::strcat_s(buf, MAX_PATH, directory_iterator::separator()));
+ re_detail::overflow_error_if_not_zero(re_detail::strcat_s(buf, MAX_PATH, "*"));
}
else
{
- std::strcat(buf, directory_iterator::separator());
- std::strcat(buf, "*");
+ re_detail::overflow_error_if_not_zero(re_detail::strcat_s(buf, MAX_PATH, directory_iterator::separator()));
+ re_detail::overflow_error_if_not_zero(re_detail::strcat_s(buf, MAX_PATH, "*"));
}
directory_iterator dstart(buf);
directory_iterator dend;
while(dstart != dend)
{
- std::sprintf(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr);
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+ (::sprintf_s)(buf, sizeof(buf), "%s%s%s", dstart.path(), directory_iterator::separator(), ptr);
+#else
+ (std::sprintf)(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr);
+#endif
BuildFileList(pl, buf, recurse);
++dstart;
}
unsigned int RegEx::GrepFiles(GrepFileCallback cb, const char* files, bool recurse, match_flag_type flags)
{
- BOOST_RE_GUARD_STACK
unsigned int result = 0;
std::list<std::string> file_list;
BuildFileList(&file_list, files, recurse);
unsigned int RegEx::FindFiles(FindFilesCallback cb, const char* files, bool recurse, match_flag_type flags)
{
- BOOST_RE_GUARD_STACK
unsigned int result = 0;
std::list<std::string> file_list;
BuildFileList(&file_list, files, recurse);
//
std::size_t RegEx::Position(int i)const
{
- BOOST_RE_GUARD_STACK
switch(pdata->t)
{
case re_detail::RegExData::type_pc:
return RegEx::npos;
}
-unsigned int RegEx::Marks()const
+std::size_t RegEx::Marks()const
{
- BOOST_RE_GUARD_STACK
return pdata->e.mark_count();
}
std::size_t RegEx::Length(int i)const
{
- BOOST_RE_GUARD_STACK
switch(pdata->t)
{
case re_detail::RegExData::type_pc:
bool RegEx::Matched(int i)const
{
- BOOST_RE_GUARD_STACK
switch(pdata->t)
{
case re_detail::RegExData::type_pc:
std::string RegEx::What(int i)const
{
- BOOST_RE_GUARD_STACK
std::string result;
switch(pdata->t)
{
return result;
}
-#ifndef __MINGW32__
-#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
-const std::size_t RegEx::npos = ::boost::integer_traits<std::size_t>::const_max;
-#elif defined(BOOST_HAS_LONG_LONG)
-const std::size_t RegEx::npos = ~0ULL;
+#ifdef BOOST_HAS_LONG_LONG
+const std::size_t RegEx::npos = static_cast<std::size_t>(~0ULL);
#else
-const std::size_t RegEx::npos = ~0UL;
-#endif
+const std::size_t RegEx::npos = static_cast<std::size_t>(~0UL);
#endif
} // namespace boost
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#include <climits>
#include <stdexcept>
-#ifdef BOOST_REGEX_V3
-#include <boost/regex/v3/fileiter.hpp>
-#else
+#include <string>
+#include <boost/throw_exception.hpp>
#include <boost/regex/v4/fileiter.hpp>
+#include <boost/regex/v4/regex_workaround.hpp>
+#include <boost/regex/pattern_except.hpp>
+
+#include <cstdio>
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::sprintf;
+ using ::fseek;
+ using ::fread;
+ using ::ftell;
+ using ::fopen;
+ using ::fclose;
+ using ::FILE;
+ using ::strcpy;
+ using ::strcpy;
+ using ::strcat;
+ using ::strcmp;
+ using ::strlen;
+}
#endif
+
#ifndef BOOST_REGEX_NO_FILEITER
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
// directories are separated with '\\'
// and names are insensitive of case
-const char* _fi_sep = "\\";
+BOOST_REGEX_DECL const char* _fi_sep = "\\";
const char* _fi_sep_alt = "/";
#define BOOST_REGEX_FI_TRANSLATE(c) std::tolower(c)
// directories are separated with '/'
// and names are sensitive of case
-const char* _fi_sep = "/";
+BOOST_REGEX_DECL const char* _fi_sep = "/";
const char* _fi_sep_alt = _fi_sep;
#define BOOST_REGEX_FI_TRANSLATE(c) c
void mapfile::open(const char* file)
{
- BOOST_RE_GUARD_STACK
#if defined(__CYGWIN__)||defined(__CYGWIN32__)
char win32file[ MAX_PATH ];
cygwin_conv_to_win32_path( file, win32file );
hmap = 0;
hfile = 0;
std::runtime_error err("Unable to create file mapping.");
- boost::throw_exception(err);
+ boost::re_detail::raise_runtime_error(err);
}
_first = static_cast<const char*>(MapViewOfFile(hmap, FILE_MAP_READ, 0, 0, 0));
if(_first == 0)
void mapfile::close()
{
- BOOST_RE_GUARD_STACK
if(hfile != INVALID_HANDLE_VALUE)
{
UnmapViewOfFile((void*)_first);
mapfile_iterator& mapfile_iterator::operator = (const mapfile_iterator& i)
{
- BOOST_RE_GUARD_STACK
if(file && node)
file->unlock(node);
file = i.file;
mapfile_iterator& mapfile_iterator::operator++ ()
{
- BOOST_RE_GUARD_STACK
if((++offset == mapfile::buf_size) && file)
{
++node;
mapfile_iterator mapfile_iterator::operator++ (int)
{
- BOOST_RE_GUARD_STACK
mapfile_iterator temp(*this);
if((++offset == mapfile::buf_size) && file)
{
mapfile_iterator& mapfile_iterator::operator-- ()
{
- BOOST_RE_GUARD_STACK
if((offset == 0) && file)
{
--node;
mapfile_iterator mapfile_iterator::operator-- (int)
{
- BOOST_RE_GUARD_STACK
mapfile_iterator temp(*this);
if((offset == 0) && file)
{
mapfile_iterator operator + (const mapfile_iterator& i, long off)
{
- BOOST_RE_GUARD_STACK
mapfile_iterator temp(i);
temp += off;
return temp;
mapfile_iterator operator - (const mapfile_iterator& i, long off)
{
- BOOST_RE_GUARD_STACK
mapfile_iterator temp(i);
temp -= off;
return temp;
mapfile::iterator mapfile::begin()const
{
- BOOST_RE_GUARD_STACK
return mapfile_iterator(this, 0);
}
mapfile::iterator mapfile::end()const
{
- BOOST_RE_GUARD_STACK
return mapfile_iterator(this, _size);
}
void mapfile::lock(pointer* node)const
{
- BOOST_RE_GUARD_STACK
- assert(node >= _first);
- assert(node <= _last);
+ BOOST_ASSERT(node >= _first);
+ BOOST_ASSERT(node <= _last);
if(node < _last)
{
if(*node == 0)
void mapfile::unlock(pointer* node)const
{
- BOOST_RE_GUARD_STACK
- assert(node >= _first);
- assert(node <= _last);
+ BOOST_ASSERT(node >= _first);
+ BOOST_ASSERT(node <= _last);
if(node < _last)
{
if(--(*reinterpret_cast<int*>(*node)) == 0)
long int get_file_length(std::FILE* hfile)
{
- BOOST_RE_GUARD_STACK
long int result;
std::fseek(hfile, 0, SEEK_END);
result = std::ftell(hfile);
void mapfile::open(const char* file)
{
- BOOST_RE_GUARD_STACK
hfile = std::fopen(file, "rb");
#ifndef BOOST_NO_EXCEPTIONS
try{
void mapfile::close()
{
- BOOST_RE_GUARD_STACK
if(hfile != 0)
{
pointer* p = _first;
file_iterator::file_iterator()
{
- BOOST_RE_GUARD_STACK
_root = _path = 0;
ref = 0;
#ifndef BOOST_NO_EXCEPTIONS
file_iterator::file_iterator(const char* wild)
{
- BOOST_RE_GUARD_STACK
_root = _path = 0;
ref = 0;
#ifndef BOOST_NO_EXCEPTIONS
BOOST_REGEX_NOEH_ASSERT(_root)
_path = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_path)
- std::strcpy(_root, wild);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_root, MAX_PATH, wild));
ptr = _root;
while(*ptr)++ptr;
while((ptr > _root) && (*ptr != *_fi_sep) && (*ptr != *_fi_sep_alt))--ptr;
- #if 0
- *ptr = 0;
- std::strcpy(_path, _root);
- if(*_path == 0)
- std::strcpy(_path, ".");
- std::strcat(_path, _fi_sep);
- ptr = _path + std::strlen(_path);
- #else
if((ptr == _root) && ( (*ptr== *_fi_sep) || (*ptr==*_fi_sep_alt) ) )
{
_root[1]='\0';
- std::strcpy(_path, _root);
- ptr = _path + std::strlen(_path);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, _root));
}
else
{
*ptr = 0;
- std::strcpy(_path, _root);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, _root));
if(*_path == 0)
- std::strcpy(_path, ".");
- std::strcat(_path, _fi_sep);
- ptr = _path + std::strlen(_path);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, "."));
+ re_detail::overflow_error_if_not_zero(re_detail::strcat_s(_path, MAX_PATH, _fi_sep));
}
- #endif
+ ptr = _path + std::strlen(_path);
ref = new file_iterator_ref();
BOOST_REGEX_NOEH_ASSERT(ref)
}
else
{
- std::strcpy(ptr, ref->_data.cFileName);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(ptr, (MAX_PATH - (ptr - _path)), ref->_data.cFileName));
if(ref->_data.dwFileAttributes & _fi_dir)
next();
}
file_iterator::file_iterator(const file_iterator& other)
{
- BOOST_RE_GUARD_STACK
_root = _path = 0;
ref = 0;
#ifndef BOOST_NO_EXCEPTIONS
BOOST_REGEX_NOEH_ASSERT(_root)
_path = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_path)
- std::strcpy(_root, other._root);
- std::strcpy(_path, other._path);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_root, MAX_PATH, other._root));
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, other._path));
ptr = _path + (other.ptr - other._path);
ref = other.ref;
#ifndef BOOST_NO_EXCEPTIONS
file_iterator& file_iterator::operator=(const file_iterator& other)
{
- BOOST_RE_GUARD_STACK
- std::strcpy(_root, other._root);
- std::strcpy(_path, other._path);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_root, MAX_PATH, other._root));
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, other._path));
ptr = _path + (other.ptr - other._path);
if(--(ref->count) == 0)
{
file_iterator::~file_iterator()
{
- BOOST_RE_GUARD_STACK
delete[] _root;
delete[] _path;
if(--(ref->count) == 0)
file_iterator file_iterator::operator++(int)
{
- BOOST_RE_GUARD_STACK
file_iterator temp(*this);
next();
return temp;
void file_iterator::next()
{
- BOOST_RE_GUARD_STACK
if(ref->hf != _fi_invalid_handle)
{
bool cont = true;
ptr = _path;
}
else
- std::strcpy(ptr, ref->_data.cFileName);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(ptr, MAX_PATH - (ptr - _path), ref->_data.cFileName));
}
}
directory_iterator::directory_iterator()
{
- BOOST_RE_GUARD_STACK
_root = _path = 0;
ref = 0;
#ifndef BOOST_NO_EXCEPTIONS
directory_iterator::directory_iterator(const char* wild)
{
- BOOST_RE_GUARD_STACK
_root = _path = 0;
ref = 0;
#ifndef BOOST_NO_EXCEPTIONS
BOOST_REGEX_NOEH_ASSERT(_root)
_path = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_path)
- std::strcpy(_root, wild);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_root, MAX_PATH, wild));
ptr = _root;
while(*ptr)++ptr;
while((ptr > _root) && (*ptr != *_fi_sep) && (*ptr != *_fi_sep_alt))--ptr;
- #if 0
- *ptr = 0;
- std::strcpy(_path, _root);
- if(*_path == 0)
- std::strcpy(_path, ".");
- std::strcat(_path, _fi_sep);
- ptr = _path + std::strlen(_path);
- #else
+
if((ptr == _root) && ( (*ptr== *_fi_sep) || (*ptr==*_fi_sep_alt) ) )
{
_root[1]='\0';
- std::strcpy(_path, _root);
- ptr = _path + std::strlen(_path);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, _root));
}
else
{
*ptr = 0;
- std::strcpy(_path, _root);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, _root));
if(*_path == 0)
- std::strcpy(_path, ".");
- std::strcat(_path, _fi_sep);
- ptr = _path + std::strlen(_path);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, "."));
+ re_detail::overflow_error_if_not_zero(re_detail::strcat_s(_path, MAX_PATH, _fi_sep));
}
- #endif
+ ptr = _path + std::strlen(_path);
+
ref = new file_iterator_ref();
BOOST_REGEX_NOEH_ASSERT(ref)
ref->count = 1;
}
else
{
- std::strcpy(ptr, ref->_data.cFileName);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(ptr, MAX_PATH - (ptr - _path), ref->_data.cFileName));
if(((ref->_data.dwFileAttributes & _fi_dir) == 0) || (std::strcmp(ref->_data.cFileName, ".") == 0) || (std::strcmp(ref->_data.cFileName, "..") == 0))
next();
}
directory_iterator::~directory_iterator()
{
- BOOST_RE_GUARD_STACK
delete[] _root;
delete[] _path;
if(--(ref->count) == 0)
directory_iterator::directory_iterator(const directory_iterator& other)
{
- BOOST_RE_GUARD_STACK
_root = _path = 0;
ref = 0;
#ifndef BOOST_NO_EXCEPTIONS
BOOST_REGEX_NOEH_ASSERT(_root)
_path = new char[MAX_PATH];
BOOST_REGEX_NOEH_ASSERT(_path)
- std::strcpy(_root, other._root);
- std::strcpy(_path, other._path);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_root, MAX_PATH, other._root));
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, other._path));
ptr = _path + (other.ptr - other._path);
ref = other.ref;
#ifndef BOOST_NO_EXCEPTIONS
directory_iterator& directory_iterator::operator=(const directory_iterator& other)
{
- BOOST_RE_GUARD_STACK
- std::strcpy(_root, other._root);
- std::strcpy(_path, other._path);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_root, MAX_PATH, other._root));
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(_path, MAX_PATH, other._path));
ptr = _path + (other.ptr - other._path);
if(--(ref->count) == 0)
{
directory_iterator directory_iterator::operator++(int)
{
- BOOST_RE_GUARD_STACK
directory_iterator temp(*this);
next();
return temp;
void directory_iterator::next()
{
- BOOST_RE_GUARD_STACK
if(ref->hf != _fi_invalid_handle)
{
bool cont = true;
ptr = _path;
}
else
- std::strcpy(ptr, ref->_data.cFileName);
+ re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(ptr, MAX_PATH - (ptr - _path), ref->_data.cFileName));
}
}
_fi_priv_data::_fi_priv_data(const char* p)
{
- BOOST_RE_GUARD_STACK
std::strcpy(root, p);
mask = root;
while(*mask) ++mask;
bool iswild(const char* mask, const char* name)
{
- BOOST_RE_GUARD_STACK
while(*mask && *name)
{
switch(*mask)
unsigned _fi_attributes(const char* root, const char* name)
{
- BOOST_RE_GUARD_STACK
char buf[MAX_PATH];
if( ( (root[0] == *_fi_sep) || (root[0] == *_fi_sep_alt) ) && (root[1] == '\0') )
- std::sprintf(buf, "%s%s", root, name);
+ (std::sprintf)(buf, "%s%s", root, name);
else
- std::sprintf(buf, "%s%s%s", root, _fi_sep, name);
+ (std::sprintf)(buf, "%s%s%s", root, _fi_sep, name);
DIR* d = opendir(buf);
if(d)
{
_fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindFileData)
{
- BOOST_RE_GUARD_STACK
_fi_find_handle dat = new _fi_priv_data(lpFileName);
DIR* h = opendir(dat->root);
bool _fi_FindNextFile(_fi_find_handle dat, _fi_find_data* lpFindFileData)
{
- BOOST_RE_GUARD_STACK
dirent* d;
do
{
bool _fi_FindClose(_fi_find_handle dat)
{
- BOOST_RE_GUARD_STACK
closedir(dat->d);
delete dat;
return true;
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#include <boost/regex.hpp>
#endif
-
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#define BOOST_REGEX_SOURCE
#include <cstdio>
+#include <boost/cregex.hpp>
#include <boost/regex.hpp>
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::sprintf;
+ using ::strcpy;
+ using ::strcmp;
+}
+#endif
+
+
namespace boost{
namespace{
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA* expression, const char* ptr, int f)
{
- BOOST_RE_GUARD_STACK
if(expression->re_magic != magic_value)
{
expression->guts = 0;
#endif
}
// set default flags:
- boost::uint_fast32_t flags = (f & REG_EXTENDED) ? regex::extended : regex::basic;
+ boost::uint_fast32_t flags = (f & REG_PERLEX) ? 0 : ((f & REG_EXTENDED) ? regex::extended : regex::basic);
expression->eflags = (f & REG_NEWLINE) ? match_not_dot_newline : match_default;
// and translate those that are actually set:
}
if(f & REG_NOSUB)
- expression->eflags |= match_any;
+ {
+ //expression->eflags |= match_any;
+ flags |= regex::nosubs;
+ }
if(f & REG_NOSPEC)
flags |= regex::literal;
if(f & REG_ICASE)
flags |= regex::icase;
if(f & REG_ESCAPE_IN_LISTS)
- flags |= regex::escape_in_lists;
+ flags &= ~regex::no_escape_in_lists;
if(f & REG_NEWLINE_ALT)
flags |= regex::newline_alt;
-#ifndef BOOST_REGEX_V3
- if(f & REG_PERLEX)
- flags |= regex::perlex;
-#endif
const char* p2;
if(f & REG_PEND)
expression->re_nsub = static_cast<regex*>(expression->guts)->mark_count() - 1;
result = static_cast<regex*>(expression->guts)->error_code();
#ifndef BOOST_NO_EXCEPTIONS
- } catch(...)
+ }
+ catch(const boost::regex_error& be)
+ {
+ result = be.code();
+ }
+ catch(...)
{
result = REG_E_UNKNOWN;
}
BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA* e, char* buf, regsize_t buf_size)
{
- BOOST_RE_GUARD_STACK
std::size_t result = 0;
if(code & REG_ITOA)
{
code &= ~REG_ITOA;
- if(code <= REG_E_UNKNOWN)
+ if(code <= (int)REG_E_UNKNOWN)
{
result = std::strlen(names[code]) + 1;
if(buf_size >= result)
- std::strcpy(buf, names[code]);
+ re_detail::strcpy_s(buf, buf_size, names[code]);
return result;
}
return result;
char localbuf[5];
if(e == 0)
return 0;
- for(int i = 0; i <= REG_E_UNKNOWN; ++i)
+ for(int i = 0; i <= (int)REG_E_UNKNOWN; ++i)
{
if(std::strcmp(e->re_endp, names[i]) == 0)
{
- std::sprintf(localbuf, "%d", i);
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+ (::sprintf_s)(localbuf, 5, "%d", i);
+#else
+ (std::sprintf)(localbuf, "%d", i);
+#endif
if(std::strlen(localbuf) < buf_size)
- std::strcpy(buf, localbuf);
+ re_detail::strcpy_s(buf, buf_size, localbuf);
return std::strlen(localbuf) + 1;
}
}
- std::sprintf(localbuf, "%d", 0);
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+ (::sprintf_s)(localbuf, 5, "%d", 0);
+#else
+ (std::sprintf)(localbuf, "%d", 0);
+#endif
if(std::strlen(localbuf) < buf_size)
- std::strcpy(buf, localbuf);
+ re_detail::strcpy_s(buf, buf_size, localbuf);
return std::strlen(localbuf) + 1;
}
- if(code <= REG_E_UNKNOWN)
+ if(code <= (int)REG_E_UNKNOWN)
{
std::string p;
if((e) && (e->re_magic == magic_value))
- p = static_cast<regex*>(e->guts)->get_traits().error_string(code);
+ p = static_cast<regex*>(e->guts)->get_traits().error_string(static_cast< ::boost::regex_constants::error_type>(code));
else
{
- boost::regex_traits<char> t;
- p = t.error_string(code);
+ p = re_detail::get_default_error_string(static_cast< ::boost::regex_constants::error_type>(code));
}
std::size_t len = p.size();
if(len < buf_size)
{
- std::strcpy(buf, p.c_str());
+ re_detail::strcpy_s(buf, buf_size, p.c_str());
}
return len + 1;
}
BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecA(const regex_tA* expression, const char* buf, regsize_t n, regmatch_t* array, int eflags)
{
- BOOST_RE_GUARD_STACK
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4267)
+#endif
bool result = false;
match_flag_type flags = match_default | expression->eflags;
const char* end;
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);
return 0;
}
return REG_NOMATCH;
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
}
BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeA(regex_tA* expression)
{
- BOOST_RE_GUARD_STACK
if(expression->re_magic == magic_value)
{
delete static_cast<regex*>(expression->guts);
+++ /dev/null
-/*
- *
- * Copyright (c) 1998-2002
- * Dr John Maddock
- *
- * Use, modification and distribution are subject to the
- * Boost Software License, Version 1.0. (See accompanying file
- * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- *
- */
-
- /*
- * LOCATION: see http://www.boost.org for most recent version.
- * FILE: primary_transform.hpp
- * VERSION: see <boost/version.hpp>
- * DESCRIPTION: Heuristically determines the sort string format in use
- * by the current locale.
- */
-
-namespace boost{
- namespace re_detail{
-
-
-enum{
- sort_C,
- sort_fixed,
- sort_delim,
- sort_unknown
-};
-
-template <class S, class charT>
-unsigned count_chars(const S& s, charT c)
-{
- unsigned int count = 0;
- for(unsigned pos = 0; pos < s.size(); ++pos)
- {
- if(s[pos] == c) ++count;
- }
- return count;
-}
-
-
-template <class traits, class charT>
-unsigned find_sort_syntax(const traits* pt, charT* delim)
-{
- //
- // compare 'a' with 'A' to see how similar they are,
- // should really use a-accute but we can't portably do that,
- //
- typedef typename traits::string_type string_type;
- typedef typename traits::char_type char_type;
-
- // Suppress incorrect warning for MSVC
- (void)pt;
-
- string_type a(1, (char_type)'a');
- string_type sa;
- pt->transform(sa, a);
- if(sa == a)
- {
- *delim = 0;
- return sort_C;
- }
- string_type A(1, (char_type)'A');
- string_type sA;
- pt->transform(sA, A);
- string_type c(1, (char_type)';');
- string_type sc;
- pt->transform(sc, c);
-
- int pos = 0;
- while((pos <= static_cast<int>(sa.size())) && (pos <= static_cast<int>(sA.size())) && (sa[pos] == sA[pos])) ++pos;
- --pos;
- if(pos < 0)
- {
- *delim = 0;
- return sort_unknown;
- }
- //
- // at this point sa[pos] is either the end of a fixed with field
- // or the character that acts as a delimiter:
- //
- charT maybe_delim = sa[pos];
- if((pos != 0) && (count_chars(sa, maybe_delim) == count_chars(sA, maybe_delim)) && (count_chars(sa, maybe_delim) == count_chars(c, maybe_delim)))
- {
- *delim = maybe_delim;
- return sort_delim;
- }
- //
- // OK doen't look like a delimiter, try for fixed width field:
- //
- if((sa.size() == sA.size()) && (sa.size() == c.size()))
- {
- // note assumes that the fixed width field is less than
- // numeric_limits<charT>::max(), should be true for all types
- // I can't imagine 127 character fields...
- *delim = static_cast<charT>(++pos);
- return sort_fixed;
- }
- //
- // don't know what it is:
- //
- *delim = 0;
- return sort_unknown;
-}
-
-
- } // namespace re_detail
-} // namespace boost
-
-
-
-
-
-
-
-
/*
*
- * Copyright (c) 1998-2002
- * Dr John Maddock
+ * Copyright (c) 1998-2004
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && defined(_MSC_VER) && (_MSC_VER >= 1300)
# include <malloc.h>
#endif
+#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
+#define WIN32_LEAN_AND_MEAN
+#define NOMINMAX
+#define NOGDI
+#define NOUSER
+#include <windows.h>
+#endif
#if defined(BOOST_REGEX_NON_RECURSIVE) && !defined(BOOST_REGEX_V3)
#if BOOST_REGEX_MAX_CACHE_BLOCKS == 0
// that dll builds contain the Virtual table for these
// types - this ensures that exceptions can be thrown
// from the dll and caught in an exe.
-bad_pattern::~bad_pattern() throw() {}
-bad_expression::~bad_expression() throw() {}
+regex_error::regex_error(const std::string& s, regex_constants::error_type err, std::ptrdiff_t pos)
+ : std::runtime_error(s)
+ , m_error_code(err)
+ , m_position(pos)
+{
+}
+
+regex_error::regex_error(regex_constants::error_type err)
+ : std::runtime_error(::boost::re_detail::get_default_error_string(err))
+ , m_error_code(err)
+ , m_position(0)
+{
+}
-regbase::regbase()
- : _flags(regbase::failbit){}
+regex_error::~regex_error() throw()
+{
+}
+
+void regex_error::raise()const
+{
+#ifndef BOOST_NO_EXCEPTIONS
+ ::boost::throw_exception(*this);
+#endif
+}
-regbase::regbase(const regbase& b)
- : _flags(b._flags){}
namespace re_detail{
+BOOST_REGEX_DECL void BOOST_REGEX_CALL raise_runtime_error(const std::runtime_error& ex)
+{
+ ::boost::throw_exception(ex);
+}
//
// error checking API:
//
#ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
+static void execute_eror()
+{
+ // we only get here after a stack overflow,
+ // this has to be a separate proceedure because we
+ // can't mix __try{}__except block with local objects
+ // that have destructors:
+ reset_stack_guard_page();
+ std::runtime_error err("Out of stack space, while attempting to match a regular expression.");
+ raise_runtime_error(err);
+}
+
+bool BOOST_REGEX_CALL abstract_protected_call::execute()const
+{
+ __try{
+ return this->call();
+ }__except(EXCEPTION_STACK_OVERFLOW == GetExceptionCode())
+ {
+ execute_eror();
+ }
+ // We never really get here at all:
+ return false;
+}
+
BOOST_REGEX_DECL void BOOST_REGEX_CALL reset_stack_guard_page()
{
#if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && defined(_MSC_VER) && (_MSC_VER >= 1300)
}
#endif
-BOOST_REGEX_DECL void BOOST_REGEX_CALL raise_regex_exception(const std::string& msg)
-{
- bad_expression e(msg);
- throw_exception(e);
-}
-
#if defined(BOOST_REGEX_NON_RECURSIVE) && !defined(BOOST_REGEX_V3)
#if BOOST_REGEX_MAX_CACHE_BLOCKS == 0
#else
+#ifdef BOOST_HAS_THREADS
+mem_block_cache block_cache = { 0, 0, BOOST_STATIC_MUTEX_INIT, };
+#else
mem_block_cache block_cache = { 0, 0, };
+#endif
BOOST_REGEX_DECL void* BOOST_REGEX_CALL get_mem_block()
{
/*
*
- * Copyright (c) 1998-2002
- * Dr John Maddock
+ * Copyright (c) 1998-2004
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#include <boost/regex/config.hpp>
-#ifdef BOOST_REGEX_DEBUG
-
-#ifdef BOOST_MSVC
-#include <crtdbg.h>
-#endif
-
-#ifdef BOOST_REGEX_V3
-#include <boost/regex/v3/regex_raw_buffer.hpp>
-#else
-#include <boost/regex/v4/regex_raw_buffer.hpp>
-#endif
-#include <boost/regex.hpp>
-
-#ifndef BOOST_RE_OLD_IOSTREAM
-#include <ostream>
-#else
-#include <ostream.h>
-#endif
-
-namespace boost { namespace re_detail {
-std::ostream& operator<<(std::ostream& s, syntax_element_type x)
-{
- return s << static_cast<unsigned long>(x);
-}
-}} // namespace boost::re_detail
-
-
-namespace {
-
-char b1[32] = {0,};
-char guard_pattern[32]
-= { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
-16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, };
-char b2[32] = {0,};
-
-static const int guard_size = 32;
-
-bool check_pattern(void* p)
-{
- return p ? memcmp(p, guard_pattern, guard_size) : 0;
-}
-
-inline unsigned maxi(unsigned i, unsigned j)
-{
- return i < j ? j : i;
-}
-
-unsigned int allocated = 0;
-
-struct init
-{
- init();
- ~init();
-};
-
-init::init()
-{
-#ifdef BOOST_MSVC
- _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_DELAY_FREE_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
-#endif
-}
-
-init::~init()
-{
-}
-
-
-init i;
-
-void* get_mem(size_t n)
-{
- ++allocated;
- char* p = (char*)malloc(n + guard_size * 2 + maxi(sizeof(int) + sizeof(void*), boost::re_detail::padding_size) + boost::re_detail::padding_size);
- char* base = p;
- p = (char*)((std::ptrdiff_t)(p + boost::re_detail::padding_mask) & ~boost::re_detail::padding_mask);
- std::memcpy(p + maxi(sizeof(int) + sizeof(void*), boost::re_detail::padding_size), guard_pattern, guard_size);
- std::memcpy(p + maxi(sizeof(int) + sizeof(void*), boost::re_detail::padding_size) + guard_size + n, guard_pattern, guard_size);
- *(int*)p = n;
- *(void**)(p + sizeof(int)) = base;
- return p + guard_size + maxi(sizeof(int) + sizeof(void*), boost::re_detail::padding_size);
-}
-
-void free_mem(void* b)
-{
- if(b)
- {
- char* p = (char*)b;
- p -= (guard_size + maxi(sizeof(int) + sizeof(void*), boost::re_detail::padding_size));
- if(check_pattern(p + maxi(sizeof(int) + sizeof(void*), boost::re_detail::padding_size)) || check_pattern(p + maxi(sizeof(int) + sizeof(void*), boost::re_detail::padding_size) + guard_size + *(int*)p))
- {
- cerr << "Error: freed memory has been written past end..." << endl;
- }
- free(*(void**)(p + sizeof(int)));
- --allocated;
- }
-}
-
-} // namespace
-
-void* operator new(size_t n)
-{
- return get_mem(n);
-}
-
-void* operator new[](size_t n)
-{
- return get_mem(n);
-}
-
-void operator delete(void* p)
-{
- free_mem(p);
-}
-
-void operator delete[](void* p)
-{
- free_mem(p);
-}
-
-#include <set>
-
-namespace boost{
- namespace re_detail{
-
-std::set<debug_guard*, std::less<debug_guard*> >* patterns = 0;
-
-int pattern_count = 0;
-
-void check_patterns(const char* f, int l)
-{
- if(pattern_count)
- {
- std::set<debug_guard*, std::less<debug_guard*> >::iterator i, j;
- i = patterns->begin();
- j = patterns->end();
- while(i != j)
- {
- if(check_pattern((void*)(*i)->g1) || check_pattern((*i)->g2) || check_pattern((void*)(*i)->pc) || check_pattern((*i)->pnc))
- {
- cerr << "Error: static memory corruption at " << hex << *i << dec << " in " << (*i)->file << "@" << (*i)->line << " called from " << f << "@" << l << endl;
- }
- ++i;
- }
- }
-}
-
-debug_guard::debug_guard(const char* f, int l, const char* p1, char* p2)
-{
- if(++pattern_count == 1)
- patterns = new std::set<debug_guard*, std::less<debug_guard*> >;
- file = f;
- line = l;
- std::memcpy(g1, guard_pattern, guard_size);
- std::memcpy(g2, guard_pattern, guard_size);
- if(p1)
- {
- pc = p1;
- }
- else
- pc = 0;
- if(p2)
- {
- pnc = p2;
- std::memcpy(pnc, guard_pattern, guard_size);
- }
- else
- pnc = 0;
- patterns->insert(this);
-}
-
-debug_guard::~debug_guard()
-{
- check_patterns(file, line);
- if(check_pattern(g1) || check_pattern(g2))
- {
- cerr << "Error: memory corruption " << file << "@" << line << endl;
- }
- patterns->erase(this);
- if(--pattern_count == 0)
- {
- delete patterns;
- patterns = 0;
- }
-}
-
- } // namespace re_detail
-
-} // namespace boost
-
-
-
-#endif
-
//
// regex configuration information: this prints out the settings used
--- /dev/null
+/*
+ *
+ * Copyright (c) 2004
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_raw_buffer.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Member functions for class raw_storage.
+ */
+
+
+#define BOOST_REGEX_SOURCE
+#include <memory>
+#include <cstring>
+#include <boost/assert.hpp>
+#include <boost/regex/v4/regex_raw_buffer.hpp>
+
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::memcpy;
+ using ::memmove;
+}
+#endif
+
+
+namespace boost{ namespace re_detail{
+
+void BOOST_REGEX_CALL raw_storage::resize(size_type n)
+{
+ register size_type newsize = start ? last - start : 1024;
+ while(newsize < n)
+ newsize *= 2;
+ register size_type datasize = end - start;
+ // extend newsize to WORD/DWORD boundary:
+ newsize = (newsize + padding_mask) & ~(padding_mask);
+
+ // allocate and copy data:
+ register pointer ptr = static_cast<pointer>(::operator new(newsize));
+ BOOST_REGEX_NOEH_ASSERT(ptr)
+ std::memcpy(ptr, start, datasize);
+
+ // get rid of old buffer:
+ ::operator delete(start);
+
+ // and set up pointers:
+ start = ptr;
+ end = ptr + datasize;
+ last = ptr + newsize;
+}
+
+void* BOOST_REGEX_CALL raw_storage::insert(size_type pos, size_type n)
+{
+ BOOST_ASSERT(pos <= size_type(end - start));
+ if(size_type(last - end) < n)
+ resize(n + (end - start));
+ register void* result = start + pos;
+ std::memmove(start + pos + n, start + pos, (end - start) - pos);
+ end += n;
+ return result;
+}
+
+}} // namespaces
+++ /dev/null
-/*
- *
- * Copyright (c) 1998-2002
- * Dr John Maddock
- *
- * Use, modification and distribution are subject to the
- * Boost Software License, Version 1.0. (See accompanying file
- * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- *
- */
-
- /*
- * LOCATION: see http://www.boost.org for most recent version.
- * FILE: regex_synch.cpp
- * VERSION: see <boost/version.hpp>
- * DESCRIPTION: Thread synch helper functions, for regular
- * expression library.
- */
-
-
-#define BOOST_REGEX_SOURCE
-
-#include <boost/regex/config.hpp>
-#ifdef BOOST_REGEX_V3
-#include <boost/regex/v3/regex_synch.hpp>
-#else
-#include <boost/regex/v4/regex_synch.hpp>
-#endif
-
-namespace boost{
- namespace re_detail{
-
-void BOOST_REGEX_CALL re_init_threads()
-{
- BOOST_RE_GUARD_STACK
-#ifdef BOOST_HAS_THREADS
- if(p_re_lock == 0)
- p_re_lock = new critical_section();
- cs_guard g(*p_re_lock);
- ++re_lock_count;
-#endif
-}
-
-void BOOST_REGEX_CALL re_free_threads()
-{
- BOOST_RE_GUARD_STACK
-#ifdef BOOST_HAS_THREADS
- cs_guard g(*p_re_lock);
- --re_lock_count;
- if(re_lock_count == 0)
- {
- g.acquire(false);
- delete p_re_lock;
- p_re_lock = 0;
- }
-#endif
-}
-
-#ifdef BOOST_HAS_THREADS
-
-BOOST_REGEX_DECL critical_section* p_re_lock = 0;
-
-BOOST_REGEX_DECL unsigned int re_lock_count = 0;
-
-#endif
-
- } // namespace re_detail
-} // namespace boost
-
-
-
-
-
-
--- /dev/null
+/*
+ *
+ * Copyright (c) 2004
+ * John Maddock
+ *
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ *
+ */
+
+ /*
+ * LOCATION: see http://www.boost.org for most recent version.
+ * FILE regex_traits_defaults.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Declares API's for access to regex_traits default properties.
+ */
+
+#define BOOST_REGEX_SOURCE
+#include <boost/regex/regex_traits.hpp>
+
+#include <cctype>
+#ifndef BOOST_NO_WREGEX
+#include <cwctype>
+#endif
+
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+ using ::tolower;
+ using ::toupper;
+#ifndef BOOST_NO_WREGEX
+ using ::towlower;
+ using ::towupper;
+#endif
+}
+#endif
+
+
+namespace boost{ namespace re_detail{
+
+BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_syntax(regex_constants::syntax_type n)
+{
+ // if the user hasn't supplied a message catalog, then this supplies
+ // default "messages" for us to load in the range 1-100.
+ const char* messages[] = {
+ "",
+ "(",
+ ")",
+ "$",
+ "^",
+ ".",
+ "*",
+ "+",
+ "?",
+ "[",
+ "]",
+ "|",
+ "\\",
+ "#",
+ "-",
+ "{",
+ "}",
+ "0123456789",
+ "b",
+ "B",
+ "<",
+ ">",
+ "",
+ "",
+ "A`",
+ "z'",
+ "\n",
+ ",",
+ "a",
+ "f",
+ "n",
+ "r",
+ "t",
+ "v",
+ "x",
+ "c",
+ ":",
+ "=",
+ "e",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "E",
+ "Q",
+ "X",
+ "C",
+ "Z",
+ "G",
+ "!",
+ "p",
+ "P",
+ "N",
+ };
+
+ return ((n >= (sizeof(messages) / sizeof(messages[1]))) ? "" : messages[n]);
+}
+
+BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_error_string(regex_constants::error_type n)
+{
+ static const char* const s_default_error_messages[] = {
+ "Success", /* REG_NOERROR */
+ "No match", /* REG_NOMATCH */
+ "Invalid regular expression", /* REG_BADPAT */
+ "Invalid collation character", /* REG_ECOLLATE */
+ "Invalid character class name", /* REG_ECTYPE */
+ "Invalid or trailing backslash", /* REG_EESCAPE */
+ "Invalid back reference", /* REG_ESUBREG */
+ "Unmatched [ or [^", /* REG_EBRACK */
+ "Unmatched ( or \\(", /* REG_EPAREN */
+ "Unmatched { or \\{", /* REG_EBRACE */
+ "Invalid content of repeat range", /* REG_BADBR */
+ "Invalid range end", /* REG_ERANGE */
+ "Memory exhausted", /* REG_ESPACE */
+ "Invalid preceding regular expression", /* REG_BADRPT */
+ "Premature end of regular expression", /* REG_EEND */
+ "Regular expression too big", /* REG_ESIZE */
+ "Unmatched ) or \\)", /* REG_ERPAREN */
+ "Empty expression", /* REG_EMPTY */
+ "Complexity requirements exceeded", /* REG_ECOMPLEXITY */
+ "Out of stack space", /* REG_ESTACK */
+ "Unknown error", /* REG_E_UNKNOWN */
+ "",
+ "",
+ "",
+ };
+
+ return (n > ::boost::regex_constants::error_unknown) ? s_default_error_messages[ ::boost::regex_constants::error_unknown] : s_default_error_messages[n];
+}
+
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining_implementation(boost::uint_least16_t c)
+{
+ const boost::uint_least16_t combining_ranges[] = { 0x0300, 0x0361,
+ 0x0483, 0x0486,
+ 0x0903, 0x0903,
+ 0x093E, 0x0940,
+ 0x0949, 0x094C,
+ 0x0982, 0x0983,
+ 0x09BE, 0x09C0,
+ 0x09C7, 0x09CC,
+ 0x09D7, 0x09D7,
+ 0x0A3E, 0x0A40,
+ 0x0A83, 0x0A83,
+ 0x0ABE, 0x0AC0,
+ 0x0AC9, 0x0ACC,
+ 0x0B02, 0x0B03,
+ 0x0B3E, 0x0B3E,
+ 0x0B40, 0x0B40,
+ 0x0B47, 0x0B4C,
+ 0x0B57, 0x0B57,
+ 0x0B83, 0x0B83,
+ 0x0BBE, 0x0BBF,
+ 0x0BC1, 0x0BCC,
+ 0x0BD7, 0x0BD7,
+ 0x0C01, 0x0C03,
+ 0x0C41, 0x0C44,
+ 0x0C82, 0x0C83,
+ 0x0CBE, 0x0CBE,
+ 0x0CC0, 0x0CC4,
+ 0x0CC7, 0x0CCB,
+ 0x0CD5, 0x0CD6,
+ 0x0D02, 0x0D03,
+ 0x0D3E, 0x0D40,
+ 0x0D46, 0x0D4C,
+ 0x0D57, 0x0D57,
+ 0x0F7F, 0x0F7F,
+ 0x20D0, 0x20E1,
+ 0x3099, 0x309A,
+ 0xFE20, 0xFE23,
+ 0xffff, 0xffff, };
+
+ const boost::uint_least16_t* p = combining_ranges + 1;
+ while(*p < c) p += 2;
+ --p;
+ if((c >= *p) && (c <= *(p+1)))
+ return true;
+ return false;
+}
+
+//
+// these are the POSIX collating names:
+//
+BOOST_REGEX_DECL const char* def_coll_names[] = {
+"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "alert", "backspace", "tab", "newline",
+"vertical-tab", "form-feed", "carriage-return", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK",
+"SYN", "ETB", "CAN", "EM", "SUB", "ESC", "IS4", "IS3", "IS2", "IS1", "space", "exclamation-mark",
+"quotation-mark", "number-sign", "dollar-sign", "percent-sign", "ampersand", "apostrophe",
+"left-parenthesis", "right-parenthesis", "asterisk", "plus-sign", "comma", "hyphen",
+"period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
+"colon", "semicolon", "less-than-sign", "equals-sign", "greater-than-sign",
+"question-mark", "commercial-at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P",
+"Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "left-square-bracket", "backslash",
+"right-square-bracket", "circumflex", "underscore", "grave-accent", "a", "b", "c", "d", "e", "f",
+"g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "left-curly-bracket",
+"vertical-line", "right-curly-bracket", "tilde", "DEL", "",
+};
+
+// these multi-character collating elements
+// should keep most Western-European locales
+// happy - we should really localise these a
+// little more - but this will have to do for
+// now:
+
+BOOST_REGEX_DECL const char* def_multi_coll[] = {
+ "ae",
+ "Ae",
+ "AE",
+ "ch",
+ "Ch",
+ "CH",
+ "ll",
+ "Ll",
+ "LL",
+ "ss",
+ "Ss",
+ "SS",
+ "nj",
+ "Nj",
+ "NJ",
+ "dz",
+ "Dz",
+ "DZ",
+ "lj",
+ "Lj",
+ "LJ",
+ "",
+};
+
+
+
+BOOST_REGEX_DECL std::string BOOST_REGEX_CALL lookup_default_collate_name(const std::string& name)
+{
+ unsigned int i = 0;
+ while(*def_coll_names[i])
+ {
+ if(def_coll_names[i] == name)
+ {
+ return std::string(1, char(i));
+ }
+ ++i;
+ }
+ i = 0;
+ while(*def_multi_coll[i])
+ {
+ if(def_multi_coll[i] == name)
+ {
+ return def_multi_coll[i];
+ }
+ ++i;
+ }
+ return std::string();
+}
+
+BOOST_REGEX_DECL char BOOST_REGEX_CALL do_global_lower(char c)
+{
+ return static_cast<char>((std::tolower)((unsigned char)c));
+}
+
+BOOST_REGEX_DECL char BOOST_REGEX_CALL do_global_upper(char c)
+{
+ return static_cast<char>((std::toupper)((unsigned char)c));
+}
+#ifndef BOOST_NO_WREGEX
+BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL do_global_lower(wchar_t c)
+{
+ return (std::towlower)(c);
+}
+
+BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL do_global_upper(wchar_t c)
+{
+ return (std::towupper)(c);
+}
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL do_global_lower(unsigned short c)
+{
+ return (std::towlower)(c);
+}
+
+BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL do_global_upper(unsigned short c)
+{
+ return (std::towupper)(c);
+}
+#endif
+
+#endif
+
+BOOST_REGEX_DECL regex_constants::escape_syntax_type BOOST_REGEX_CALL get_default_escape_syntax_type(char c)
+{
+ //
+ // char_syntax determines how the compiler treats a given character
+ // in a regular expression.
+ //
+ static regex_constants::escape_syntax_type char_syntax[] = {
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /* */ // 32
+ regex_constants::escape_type_identity, /*!*/
+ regex_constants::escape_type_identity, /*"*/
+ regex_constants::escape_type_identity, /*#*/
+ regex_constants::escape_type_identity, /*$*/
+ regex_constants::escape_type_identity, /*%*/
+ regex_constants::escape_type_identity, /*&*/
+ regex_constants::escape_type_end_buffer, /*'*/
+ regex_constants::syntax_open_mark, /*(*/
+ regex_constants::syntax_close_mark, /*)*/
+ regex_constants::escape_type_identity, /***/
+ regex_constants::syntax_plus, /*+*/
+ regex_constants::escape_type_identity, /*,*/
+ regex_constants::escape_type_identity, /*-*/
+ regex_constants::escape_type_identity, /*.*/
+ regex_constants::escape_type_identity, /*/*/
+ regex_constants::escape_type_decimal, /*0*/
+ regex_constants::escape_type_backref, /*1*/
+ regex_constants::escape_type_backref, /*2*/
+ regex_constants::escape_type_backref, /*3*/
+ regex_constants::escape_type_backref, /*4*/
+ regex_constants::escape_type_backref, /*5*/
+ regex_constants::escape_type_backref, /*6*/
+ regex_constants::escape_type_backref, /*7*/
+ regex_constants::escape_type_backref, /*8*/
+ regex_constants::escape_type_backref, /*9*/
+ regex_constants::escape_type_identity, /*:*/
+ regex_constants::escape_type_identity, /*;*/
+ regex_constants::escape_type_left_word, /*<*/
+ regex_constants::escape_type_identity, /*=*/
+ regex_constants::escape_type_right_word, /*>*/
+ regex_constants::syntax_question, /*?*/
+ regex_constants::escape_type_identity, /*@*/
+ regex_constants::escape_type_start_buffer, /*A*/
+ regex_constants::escape_type_not_word_assert, /*B*/
+ regex_constants::escape_type_C, /*C*/
+ regex_constants::escape_type_not_class, /*D*/
+ regex_constants::escape_type_E, /*E*/
+ regex_constants::escape_type_not_class, /*F*/
+ regex_constants::escape_type_G, /*G*/
+ regex_constants::escape_type_not_class, /*H*/
+ regex_constants::escape_type_not_class, /*I*/
+ regex_constants::escape_type_not_class, /*J*/
+ regex_constants::escape_type_not_class, /*K*/
+ regex_constants::escape_type_not_class, /*L*/
+ regex_constants::escape_type_not_class, /*M*/
+ regex_constants::escape_type_named_char, /*N*/
+ regex_constants::escape_type_not_class, /*O*/
+ regex_constants::escape_type_not_property, /*P*/
+ regex_constants::escape_type_Q, /*Q*/
+ regex_constants::escape_type_not_class, /*R*/
+ regex_constants::escape_type_not_class, /*S*/
+ regex_constants::escape_type_not_class, /*T*/
+ regex_constants::escape_type_not_class, /*U*/
+ regex_constants::escape_type_not_class, /*V*/
+ regex_constants::escape_type_not_class, /*W*/
+ regex_constants::escape_type_X, /*X*/
+ regex_constants::escape_type_not_class, /*Y*/
+ regex_constants::escape_type_Z, /*Z*/
+ regex_constants::escape_type_identity, /*[*/
+ regex_constants::escape_type_identity, /*\*/
+ regex_constants::escape_type_identity, /*]*/
+ regex_constants::escape_type_identity, /*^*/
+ regex_constants::escape_type_identity, /*_*/
+ regex_constants::escape_type_start_buffer, /*`*/
+ regex_constants::escape_type_control_a, /*a*/
+ regex_constants::escape_type_word_assert, /*b*/
+ regex_constants::escape_type_ascii_control, /*c*/
+ regex_constants::escape_type_class, /*d*/
+ regex_constants::escape_type_e, /*e*/
+ regex_constants::escape_type_control_f, /*f*/
+ regex_constants::escape_type_class, /*g*/
+ regex_constants::escape_type_class, /*h*/
+ regex_constants::escape_type_class, /*i*/
+ regex_constants::escape_type_class, /*j*/
+ regex_constants::escape_type_class, /*k*/
+ regex_constants::escape_type_class, /*l*/
+ regex_constants::escape_type_class, /*m*/
+ regex_constants::escape_type_control_n, /*n*/
+ regex_constants::escape_type_class, /*o*/
+ regex_constants::escape_type_property, /*p*/
+ regex_constants::escape_type_class, /*q*/
+ regex_constants::escape_type_control_r, /*r*/
+ regex_constants::escape_type_class, /*s*/
+ regex_constants::escape_type_control_t, /*t*/
+ regex_constants::escape_type_class, /*u*/
+ regex_constants::escape_type_control_v, /*v*/
+ regex_constants::escape_type_class, /*w*/
+ regex_constants::escape_type_hex, /*x*/
+ regex_constants::escape_type_class, /*y*/
+ regex_constants::escape_type_end_buffer, /*z*/
+ regex_constants::syntax_open_brace, /*{*/
+ regex_constants::syntax_or, /*|*/
+ regex_constants::syntax_close_brace, /*}*/
+ regex_constants::escape_type_identity, /*~*/
+ regex_constants::escape_type_identity, /*\7f*/
+ regex_constants::escape_type_identity, /*\80*/
+ regex_constants::escape_type_identity, /*\81*/
+ regex_constants::escape_type_identity, /*\82*/
+ regex_constants::escape_type_identity, /*\83*/
+ regex_constants::escape_type_identity, /*\84*/
+ regex_constants::escape_type_identity, /*\85*/
+ regex_constants::escape_type_identity, /*\86*/
+ regex_constants::escape_type_identity, /*\87*/
+ regex_constants::escape_type_identity, /*\88*/
+ regex_constants::escape_type_identity, /*\89*/
+ regex_constants::escape_type_identity, /*\8a*/
+ regex_constants::escape_type_identity, /*\8b*/
+ regex_constants::escape_type_identity, /*\8c*/
+ regex_constants::escape_type_identity, /*\8d*/
+ regex_constants::escape_type_identity, /*\8e*/
+ regex_constants::escape_type_identity, /*\8f*/
+ regex_constants::escape_type_identity, /*\90*/
+ regex_constants::escape_type_identity, /*\91*/
+ regex_constants::escape_type_identity, /*\92*/
+ regex_constants::escape_type_identity, /*\93*/
+ regex_constants::escape_type_identity, /*\94*/
+ regex_constants::escape_type_identity, /*\95*/
+ regex_constants::escape_type_identity, /*\96*/
+ regex_constants::escape_type_identity, /*\97*/
+ regex_constants::escape_type_identity, /*\98*/
+ regex_constants::escape_type_identity, /*\99*/
+ regex_constants::escape_type_identity, /*\9a*/
+ regex_constants::escape_type_identity, /*\9b*/
+ regex_constants::escape_type_identity, /*\9c*/
+ regex_constants::escape_type_identity, /*\9d*/
+ regex_constants::escape_type_identity, /*\9e*/
+ regex_constants::escape_type_identity, /*\9f*/
+ regex_constants::escape_type_identity, /* */
+ regex_constants::escape_type_identity, /*¡*/
+ regex_constants::escape_type_identity, /*¢*/
+ regex_constants::escape_type_identity, /*£*/
+ regex_constants::escape_type_identity, /*¤*/
+ regex_constants::escape_type_identity, /*¥*/
+ regex_constants::escape_type_identity, /*¦*/
+ regex_constants::escape_type_identity, /*§*/
+ regex_constants::escape_type_identity, /*¨*/
+ regex_constants::escape_type_identity, /*©*/
+ regex_constants::escape_type_identity, /*ª*/
+ regex_constants::escape_type_identity, /*«*/
+ regex_constants::escape_type_identity, /*¬*/
+ regex_constants::escape_type_identity, /**/
+ regex_constants::escape_type_identity, /*®*/
+ regex_constants::escape_type_identity, /*¯*/
+ regex_constants::escape_type_identity, /*°*/
+ regex_constants::escape_type_identity, /*±*/
+ regex_constants::escape_type_identity, /*²*/
+ regex_constants::escape_type_identity, /*³*/
+ regex_constants::escape_type_identity, /*´*/
+ regex_constants::escape_type_identity, /*µ*/
+ regex_constants::escape_type_identity, /*¶*/
+ };
+
+ return char_syntax[(unsigned char)c];
+}
+
+BOOST_REGEX_DECL regex_constants::syntax_type BOOST_REGEX_CALL get_default_syntax_type(char c)
+{
+ //
+ // char_syntax determines how the compiler treats a given character
+ // in a regular expression.
+ //
+ static regex_constants::syntax_type char_syntax[] = {
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_newline, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /* */ // 32
+ regex_constants::syntax_not, /*!*/
+ regex_constants::syntax_char, /*"*/
+ regex_constants::syntax_hash, /*#*/
+ regex_constants::syntax_dollar, /*$*/
+ regex_constants::syntax_char, /*%*/
+ regex_constants::syntax_char, /*&*/
+ regex_constants::syntax_char, /*'*/
+ regex_constants::syntax_open_mark, /*(*/
+ regex_constants::syntax_close_mark, /*)*/
+ regex_constants::syntax_star, /***/
+ regex_constants::syntax_plus, /*+*/
+ regex_constants::syntax_comma, /*,*/
+ regex_constants::syntax_dash, /*-*/
+ regex_constants::syntax_dot, /*.*/
+ regex_constants::syntax_char, /*/*/
+ regex_constants::syntax_digit, /*0*/
+ regex_constants::syntax_digit, /*1*/
+ regex_constants::syntax_digit, /*2*/
+ regex_constants::syntax_digit, /*3*/
+ regex_constants::syntax_digit, /*4*/
+ regex_constants::syntax_digit, /*5*/
+ regex_constants::syntax_digit, /*6*/
+ regex_constants::syntax_digit, /*7*/
+ regex_constants::syntax_digit, /*8*/
+ regex_constants::syntax_digit, /*9*/
+ regex_constants::syntax_colon, /*:*/
+ regex_constants::syntax_char, /*;*/
+ regex_constants::escape_type_left_word, /*<*/
+ regex_constants::syntax_equal, /*=*/
+ regex_constants::escape_type_right_word, /*>*/
+ regex_constants::syntax_question, /*?*/
+ regex_constants::syntax_char, /*@*/
+ regex_constants::syntax_char, /*A*/
+ regex_constants::syntax_char, /*B*/
+ regex_constants::syntax_char, /*C*/
+ regex_constants::syntax_char, /*D*/
+ regex_constants::syntax_char, /*E*/
+ regex_constants::syntax_char, /*F*/
+ regex_constants::syntax_char, /*G*/
+ regex_constants::syntax_char, /*H*/
+ regex_constants::syntax_char, /*I*/
+ regex_constants::syntax_char, /*J*/
+ regex_constants::syntax_char, /*K*/
+ regex_constants::syntax_char, /*L*/
+ regex_constants::syntax_char, /*M*/
+ regex_constants::syntax_char, /*N*/
+ regex_constants::syntax_char, /*O*/
+ regex_constants::syntax_char, /*P*/
+ regex_constants::syntax_char, /*Q*/
+ regex_constants::syntax_char, /*R*/
+ regex_constants::syntax_char, /*S*/
+ regex_constants::syntax_char, /*T*/
+ regex_constants::syntax_char, /*U*/
+ regex_constants::syntax_char, /*V*/
+ regex_constants::syntax_char, /*W*/
+ regex_constants::syntax_char, /*X*/
+ regex_constants::syntax_char, /*Y*/
+ regex_constants::syntax_char, /*Z*/
+ regex_constants::syntax_open_set, /*[*/
+ regex_constants::syntax_escape, /*\*/
+ regex_constants::syntax_close_set, /*]*/
+ regex_constants::syntax_caret, /*^*/
+ regex_constants::syntax_char, /*_*/
+ regex_constants::syntax_char, /*`*/
+ regex_constants::syntax_char, /*a*/
+ regex_constants::syntax_char, /*b*/
+ regex_constants::syntax_char, /*c*/
+ regex_constants::syntax_char, /*d*/
+ regex_constants::syntax_char, /*e*/
+ regex_constants::syntax_char, /*f*/
+ regex_constants::syntax_char, /*g*/
+ regex_constants::syntax_char, /*h*/
+ regex_constants::syntax_char, /*i*/
+ regex_constants::syntax_char, /*j*/
+ regex_constants::syntax_char, /*k*/
+ regex_constants::syntax_char, /*l*/
+ regex_constants::syntax_char, /*m*/
+ regex_constants::syntax_char, /*n*/
+ regex_constants::syntax_char, /*o*/
+ regex_constants::syntax_char, /*p*/
+ regex_constants::syntax_char, /*q*/
+ regex_constants::syntax_char, /*r*/
+ regex_constants::syntax_char, /*s*/
+ regex_constants::syntax_char, /*t*/
+ regex_constants::syntax_char, /*u*/
+ regex_constants::syntax_char, /*v*/
+ regex_constants::syntax_char, /*w*/
+ regex_constants::syntax_char, /*x*/
+ regex_constants::syntax_char, /*y*/
+ regex_constants::syntax_char, /*z*/
+ regex_constants::syntax_open_brace, /*{*/
+ regex_constants::syntax_or, /*|*/
+ regex_constants::syntax_close_brace, /*}*/
+ regex_constants::syntax_char, /*~*/
+ regex_constants::syntax_char, /*\7f*/
+ regex_constants::syntax_char, /*\80*/
+ regex_constants::syntax_char, /*\81*/
+ regex_constants::syntax_char, /*\82*/
+ regex_constants::syntax_char, /*\83*/
+ regex_constants::syntax_char, /*\84*/
+ regex_constants::syntax_char, /*\85*/
+ regex_constants::syntax_char, /*\86*/
+ regex_constants::syntax_char, /*\87*/
+ regex_constants::syntax_char, /*\88*/
+ regex_constants::syntax_char, /*\89*/
+ regex_constants::syntax_char, /*\8a*/
+ regex_constants::syntax_char, /*\8b*/
+ regex_constants::syntax_char, /*\8c*/
+ regex_constants::syntax_char, /*\8d*/
+ regex_constants::syntax_char, /*\8e*/
+ regex_constants::syntax_char, /*\8f*/
+ regex_constants::syntax_char, /*\90*/
+ regex_constants::syntax_char, /*\91*/
+ regex_constants::syntax_char, /*\92*/
+ regex_constants::syntax_char, /*\93*/
+ regex_constants::syntax_char, /*\94*/
+ regex_constants::syntax_char, /*\95*/
+ regex_constants::syntax_char, /*\96*/
+ regex_constants::syntax_char, /*\97*/
+ regex_constants::syntax_char, /*\98*/
+ regex_constants::syntax_char, /*\99*/
+ regex_constants::syntax_char, /*\9a*/
+ regex_constants::syntax_char, /*\9b*/
+ regex_constants::syntax_char, /*\9c*/
+ regex_constants::syntax_char, /*\9d*/
+ regex_constants::syntax_char, /*\9e*/
+ regex_constants::syntax_char, /*\9f*/
+ regex_constants::syntax_char, /* */
+ regex_constants::syntax_char, /*¡*/
+ regex_constants::syntax_char, /*¢*/
+ regex_constants::syntax_char, /*£*/
+ regex_constants::syntax_char, /*¤*/
+ regex_constants::syntax_char, /*¥*/
+ regex_constants::syntax_char, /*¦*/
+ regex_constants::syntax_char, /*§*/
+ regex_constants::syntax_char, /*¨*/
+ regex_constants::syntax_char, /*©*/
+ regex_constants::syntax_char, /*ª*/
+ regex_constants::syntax_char, /*«*/
+ regex_constants::syntax_char, /*¬*/
+ regex_constants::syntax_char, /**/
+ regex_constants::syntax_char, /*®*/
+ regex_constants::syntax_char, /*¯*/
+ regex_constants::syntax_char, /*°*/
+ regex_constants::syntax_char, /*±*/
+ regex_constants::syntax_char, /*²*/
+ regex_constants::syntax_char, /*³*/
+ regex_constants::syntax_char, /*´*/
+ regex_constants::syntax_char, /*µ*/
+ regex_constants::syntax_char, /*¶*/
+ };
+
+ return char_syntax[(unsigned char)c];
+}
+
+
+} // re_detail
+} // boost
/*
*
- * Copyright (c) 1998-2002
- * Dr John Maddock
+ * Copyright (c) 2004
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
/*
* LOCATION: see http://www.boost.org for most recent version.
- * FILE: w32_regex_traits.cpp
- * VERSION: see <boost/version.hpp>
- * DESCRIPTION: Implements the w32_regex_traits<charT> traits class
+ * FILE w32_regex_traits.cpp
+ * VERSION see <boost/version.hpp>
+ * DESCRIPTION: Implements w32_regex_traits<char> (and associated helper classes).
*/
#define BOOST_REGEX_SOURCE
+#include <boost/regex/config.hpp>
-#include <clocale>
-#include <cstdio>
-#include <list>
-#include <cctype>
-#include <cstdio>
-#include <boost/regex/regex_traits.hpp>
#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
-#include <boost/cregex.hpp>
-#ifdef BOOST_REGEX_V3
-#include <boost/regex/v3/regex_synch.hpp>
-#include <boost/regex/v3/regex_cstring.hpp>
-#else
-#include <boost/regex/v4/regex_synch.hpp>
-#include <boost/regex/v4/regex_cstring.hpp>
-#endif
-#include <boost/scoped_array.hpp>
+#include <boost/regex/regex_traits.hpp>
+#include <boost/regex/pattern_except.hpp>
+#define WIN32_LEAN_AND_MEAN
+#define NOMINMAX
+#define NOGDI
+#include <windows.h>
-//
-// VC6 needs to link to user32.lib, as do all compilers that
-// claim to be VC6/7 compatible:
-//
-#if defined(_MSC_VER) && !defined(__BORLANDC__)
+#ifdef _MSC_VER
#pragma comment(lib, "user32.lib")
#endif
-namespace{
-
-//
-// character classes:
-
-boost::uint_fast32_t re_char_class_id[] = {
- boost::re_detail::w32_traits_base::char_class_alnum,
- boost::re_detail::w32_traits_base::char_class_alpha,
- boost::re_detail::w32_traits_base::char_class_cntrl,
- boost::re_detail::w32_traits_base::char_class_digit,
- boost::re_detail::w32_traits_base::char_class_graph,
- boost::re_detail::w32_traits_base::char_class_lower,
- boost::re_detail::w32_traits_base::char_class_print,
- boost::re_detail::w32_traits_base::char_class_punct,
- boost::re_detail::w32_traits_base::char_class_space,
- boost::re_detail::w32_traits_base::char_class_upper,
- boost::re_detail::w32_traits_base::char_class_xdigit,
- boost::re_detail::w32_traits_base::char_class_blank,
- boost::re_detail::w32_traits_base::char_class_word,
- boost::re_detail::w32_traits_base::char_class_unicode,
-};
-
-const char* re_char_class_names[] = {
-"alnum",
-"alpha",
-"cntrl",
-"digit",
-"graph",
-"lower",
-"print",
-"punct",
-"space",
-"upper",
-"xdigit",
-"blank",
-"word",
-"unicode",
-};
-
-std::string* pclasses = 0;
-const unsigned int re_classes_max = 14;
-
-//
-// collate names:
-
-struct collate_name_t
-{
- std::string name;
- std::string value;
- collate_name_t(){}
- collate_name_t(const char* p1, const char* p2, const char* p3, const char* p4)
- : name(p1, p2), value(p3, p4) {}
-};
-
-std::list<collate_name_t>* pcoll_names = 0;
-
-//
-// message handling:
-#ifndef BOOST_RE_MESSAGE_BASE
-#define BOOST_RE_MESSAGE_BASE 0
-#endif
-
-HINSTANCE hresmod = 0;
-
-char* re_custom_error_messages[] = {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
-};
-
-char re_zero;
-char re_ten;
-
-unsigned int entry_count = 0;
-bool is_init = false;
-
-enum syntax_map_size
-{
- map_size = UCHAR_MAX + 1
-};
-
-#ifndef BOOST_NO_WREGEX
-
-boost::regex_wchar_type re_zero_w;
-boost::regex_wchar_type re_ten_w;
-
-bool isPlatformNT = false;
-
-struct syntax_map_t
-{
- boost::regex_wchar_type c;
- unsigned int type;
-};
-
-std::list<syntax_map_t>* syntax;
-
-#endif
-
-std::size_t BOOST_REGEX_CALL _re_get_message(char* buf, std::size_t len, unsigned id);
-
-std::size_t BOOST_REGEX_CALL get_message(boost::regex_wchar_type* buf, std::size_t len, unsigned id)
-{
- std::size_t size = _re_get_message(static_cast<char*>(0), 0, id);
- if(len < size)
- return size;
- boost::scoped_array<char> cb(new char[size]);
- _re_get_message(cb.get(), size, id);
- size = boost::w32_regex_traits<boost::regex_wchar_type>::strwiden(buf, len, cb.get());
- return size;
-}
-
-inline std::size_t BOOST_REGEX_CALL get_message(char* buf, std::size_t len, unsigned id)
-{
- return _re_get_message(buf, len, id);
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std{
+ using ::memset;
}
+#endif
-std::size_t BOOST_REGEX_CALL _re_get_message(char* buf, std::size_t len, unsigned id)
-{
- BOOST_RE_GUARD_STACK
- // get the customised message if any:
- if(len < 255)
- return 255;
- std::size_t size = 0;
- if(hresmod)
- size = LoadStringA(hresmod, BOOST_RE_MESSAGE_BASE + id, buf, 255);
- if(size)
- return size;
-
- //
- // now get the default message if any:
- return boost::re_detail::re_get_default_message(buf, len, id);
-}
+namespace boost{ namespace re_detail{
-const char* BOOST_REGEX_CALL re_get_error_str(unsigned int id)
+void w32_regex_traits_char_layer<char>::init()
{
- BOOST_RE_GUARD_STACK
-#ifdef BOOST_HAS_THREADS
- boost::re_detail::cs_guard g(*boost::re_detail::p_re_lock);
-#endif
- if(re_custom_error_messages[id] == 0)
+ // we need to start by initialising our syntax map so we know which
+ // character is used for which purpose:
+ std::memset(m_char_map, 0, sizeof(m_char_map));
+ cat_type cat;
+ std::string cat_name(w32_regex_traits<char>::get_catalog_name());
+ if(cat_name.size())
{
- char buf[256];
- _re_get_message(buf, 256, id + 200);
- if(*buf)
+ cat = ::boost::re_detail::w32_cat_open(cat_name);
+ if(!cat)
{
- re_custom_error_messages[id] = boost::re_detail::re_strdup(buf);
- return re_custom_error_messages[id];
+ std::string m("Unable to open message catalog: ");
+ std::runtime_error err(m + cat_name);
+ ::boost::re_detail::raise_runtime_error(err);
}
- return boost::re_detail::re_default_error_messages[id];
}
- return re_custom_error_messages[id];
-}
-
-} // namespace
-
-namespace boost{
-
-namespace re_detail{
-
-char w32_traits_base::regex_message_catalogue[BOOST_REGEX_MAX_PATH] = {0};
-
-void BOOST_REGEX_CALL w32_traits_base::do_init()
-{
- BOOST_RE_GUARD_STACK
- if(is_init == 0)
+ //
+ // if we have a valid catalog then load our messages:
+ //
+ if(cat)
{
- //
- // update the messages first:
- is_init = true;
- if(*regex_message_catalogue)
- {
- hresmod = LoadLibraryA(regex_message_catalogue);
- if(hresmod == NULL)
- {
- std::string s("Unable to open dll: ");
- std::runtime_error err(s + regex_message_catalogue);
- boost::throw_exception(err);
- }
- }
- unsigned int i;
- for(i = 0; i < REG_E_UNKNOWN; ++i)
+ for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
{
- if(re_custom_error_messages[i])
+ string_type mss = ::boost::re_detail::w32_cat_get(cat, this->m_locale, i, get_default_syntax(i));
+ for(string_type::size_type j = 0; j < mss.size(); ++j)
{
- re_detail::re_strfree(re_custom_error_messages[i]);
- re_custom_error_messages[i] = 0;
+ m_char_map[static_cast<unsigned char>(mss[j])] = i;
}
}
-#ifndef BOOST_NO_WREGEX
- //
- // wide character strings:
- syntax = new std::list<syntax_map_t>();
- OSVERSIONINFO VersionInformation = {0};
- VersionInformation.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&VersionInformation);
- if(VersionInformation.dwPlatformId == VER_PLATFORM_WIN32_NT)
- isPlatformNT = true;
-#endif
- //
- // now the character classes:
- pclasses = new std::string[re_classes_max];
- char buf[map_size+2];
- for(i = 0; i < re_classes_max; ++i)
- {
- get_message(buf, 256, i+300);
- pclasses[i] = buf;
- }
- // start by updating the syntax map:
- std::memset(syntax_map, syntax_char, map_size);
- for(i = 1; i < syntax_max; ++i)
+ }
+ else
+ {
+ for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
{
- char* ptr = buf;
- get_message(buf, map_size, i+100);
- for(; *ptr; ++ptr)
+ const char* ptr = get_default_syntax(i);
+ while(ptr && *ptr)
{
- syntax_map[(unsigned char)*ptr] = (unsigned char)i;
+ m_char_map[static_cast<unsigned char>(*ptr)] = i;
+ ++ptr;
}
}
-
- // now update the character class map,
- // and lower case map:
- for(i = 0; i < map_size; ++i)
- {
- buf[i] = (char)i;
- }
- buf[map_size] = (char)0;
- GetStringTypeA(GetUserDefaultLCID(), CT_CTYPE1, buf, map_size, class_map);
- for(i = 0; i < map_size; ++i)
- {
- class_map[i] &= char_class_win;
- }
- class_map[(unsigned char)'_'] |= char_class_underscore;
- LCMapStringA(GetUserDefaultLCID(), LCMAP_LOWERCASE, buf, map_size, lower_case_map, map_size);
- //
- // update our collating elements:
- pcoll_names = new std::list<collate_name_t>();
- i = 400;
- get_message(buf, 256, i);
- while(*buf)
- {
- char* p1, *p2, *p3, *p4;;
- p1 = buf;
- while(*p1 && isspace(*p1))++p1;
- p2 = p1;
- while(*p2 && !isspace(*p2))++p2;
- p3 = p2;
- while(*p3 && isspace(*p3))++p3;
- p4 = p3;
- while(*p4 && !isspace(*p4))++p4;
- pcoll_names->push_back(collate_name_t(p1, p2, p3, p4));
- ++i;
- get_message(buf, 256, i);
- }
- std::string s;
- const char* p = "zero";
- if(w32_regex_traits<char>::lookup_collatename(s, p, p+4))
- {
- jm_assert(s.size() == 1);
- re_zero = *s.c_str();
- }
- else
- re_zero = '0';
-
- p = "ten";
- if(w32_regex_traits<char>::lookup_collatename(s, p, p+3))
- {
- jm_assert(s.size() == 1);
- re_ten = *s.c_str();
- }
- else
- re_ten = 'a';
-#ifndef BOOST_NO_WREGEX
- //
- // wide string data:
- std::basic_string<regex_wchar_type> ws;
- const regex_wchar_type* wp = (const regex_wchar_type*)L"zero";
- if(w32_regex_traits<regex_wchar_type>::lookup_collatename(ws, wp, wp+4))
- {
- jm_assert(ws.size() == 1);
- re_zero_w = *ws.c_str();
- }
- else
- re_zero_w = (regex_wchar_type)L'0';
-
- wp = (const regex_wchar_type*)L"ten";
- if(w32_regex_traits<regex_wchar_type>::lookup_collatename(ws, wp, wp+3))
+ }
+ //
+ // finish off by calculating our escape types:
+ //
+ unsigned char i = 'A';
+ do
+ {
+ if(m_char_map[i] == 0)
{
- jm_assert(ws.size() == 1);
- re_ten_w = *ws.c_str();
+ if(::boost::re_detail::w32_is(this->m_locale, 0x0002u, (char)i))
+ m_char_map[i] = regex_constants::escape_type_class;
+ else if(::boost::re_detail::w32_is(this->m_locale, 0x0001u, (char)i))
+ m_char_map[i] = regex_constants::escape_type_not_class;
}
- else
- re_ten_w = L'a';
+ }while(0xFF != i++);
- regex_wchar_type wbuf[256];
- syntax_map_t sm;
- syntax->clear();
- for(i = 1; i < syntax_max; ++i)
- {
- regex_wchar_type* ptr = wbuf;
- get_message(wbuf, 256, i+100);
- for(; *ptr; ++ptr)
- {
- sm.c = *ptr;
- sm.type = i;
- syntax->push_back(sm);
- }
- }
-#endif // BOOST_NO_WREGEX
+ //
+ // fill in lower case map:
+ //
+ char char_map[1 << CHAR_BIT];
+ for(int ii = 0; ii < (1 << CHAR_BIT); ++ii)
+ char_map[ii] = static_cast<char>(ii);
+ int r = ::LCMapStringA(this->m_locale, LCMAP_LOWERCASE, char_map, 1 << CHAR_BIT, this->m_lower_map, 1 << CHAR_BIT);
+ BOOST_ASSERT(r != 0);
+ if(r < (1 << CHAR_BIT))
+ {
+ // if we have multibyte characters then not all may have been given
+ // a lower case mapping:
+ for(int jj = r; jj < (1 << CHAR_BIT); ++jj)
+ this->m_lower_map[jj] = static_cast<char>(jj);
}
+ r = ::GetStringTypeExA(this->m_locale, CT_CTYPE1, char_map, 1 << CHAR_BIT, this->m_type_map);
+ BOOST_ASSERT(0 != r);
}
-void BOOST_REGEX_CALL w32_traits_base::do_free()
+BOOST_REGEX_DECL lcid_type BOOST_REGEX_CALL w32_get_default_locale()
{
- BOOST_RE_GUARD_STACK
- delete[] pclasses;
- pclasses = 0;
- delete pcoll_names;
- pcoll_names = 0;
-#ifndef BOOST_NO_WREGEX
- delete syntax;
- syntax = 0;
-#endif
- if(hresmod)
- {
- FreeLibrary(hresmod);
- hresmod = 0;
- }
- for(int i = 0; i < REG_E_UNKNOWN; ++i)
- {
- if(re_custom_error_messages[i])
- {
- re_detail::re_strfree(re_custom_error_messages[i]);
- re_custom_error_messages[i] = 0;
- }
- }
- is_init = false;
+ return ::GetUserDefaultLCID();
}
-std::string BOOST_REGEX_CALL w32_traits_base::error_string(unsigned id)
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(char c, lcid_type id)
{
- return re_get_error_str(id);
+ WORD mask;
+ if(::GetStringTypeExA(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER))
+ return true;
+ return false;
}
-boost::uint_fast32_t BOOST_REGEX_CALL w32_traits_base::do_lookup_class(const char* p)
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(wchar_t c, lcid_type id)
{
- BOOST_RE_GUARD_STACK
- unsigned int i;
- for(i = 0; i < re_classes_max; ++i)
- {
- if(pclasses[i] == p)
- {
- return re_char_class_id[i];
- }
- }
- for(i = 0; i < re_classes_max; ++i)
- {
- if(std::strcmp(re_char_class_names[i], p) == 0)
- {
- return re_char_class_id[i];
- }
- }
- return 0;
+ WORD mask;
+ if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER))
+ return true;
+ return false;
}
-
-bool BOOST_REGEX_CALL w32_traits_base::do_lookup_collate(std::string& buf, const char* p)
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(unsigned short ca, lcid_type id)
{
- BOOST_RE_GUARD_STACK
- std::list<collate_name_t>::iterator first, last;
- first = pcoll_names->begin();
- last = pcoll_names->end();
- while(first != last)
- {
- if((*first).name == p)
- {
- buf = (*first).value;
- return true;
- }
- ++first;
- }
-
- bool result = re_detail::re_lookup_def_collate_name(buf, p);
- if((result == 0) && (std::strlen(p) == 1))
- {
- result = true;
- buf = *p;
- }
- return result;
+ WORD mask;
+ wchar_t c = ca;
+ if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER))
+ return true;
+ return false;
}
+#endif
-std::string BOOST_REGEX_CALL w32_traits_base::set_message_catalogue(const std::string& l)
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(char c, lcid_type id)
{
- BOOST_RE_GUARD_STACK
- #ifdef BOOST_HAS_THREADS
- re_detail::cs_guard g(*re_detail::p_re_lock);
- #endif
- if(sizeof(regex_message_catalogue) <= l.size())
- return l;
- std::string old(regex_message_catalogue);
- std::strcpy(regex_message_catalogue, l.c_str());
- return old;
+ WORD mask;
+ if(::GetStringTypeExA(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER))
+ return true;
+ return false;
}
-unsigned char w32_traits_base::syntax_map[map_size];
-unsigned short w32_traits_base::class_map[map_size];
-char w32_traits_base::lower_case_map[map_size];
-
-} // namespace re_detail
-
-w32_regex_traits<char> w32_regex_traits<char>::i;
-
-void BOOST_REGEX_CALL w32_regex_traits<char>::update()
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(wchar_t c, lcid_type id)
{
- BOOST_RE_GUARD_STACK
- #ifdef BOOST_HAS_THREADS
- re_detail::cs_guard g(*re_detail::p_re_lock);
- #endif
- do_init();
+ WORD mask;
+ if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER))
+ return true;
+ return false;
}
-
-w32_regex_traits<char>::w32_regex_traits()
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(unsigned short ca, lcid_type id)
{
- BOOST_RE_GUARD_STACK
- #ifdef BOOST_HAS_THREADS
- re_detail::re_init_threads();
- re_detail::cs_guard g(*re_detail::p_re_lock);
- #endif
- ++entry_count;
+ WORD mask;
+ wchar_t c = ca;
+ if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_UPPER))
+ return true;
+ return false;
}
+#endif
-w32_regex_traits<char>::~w32_regex_traits()
+void free_module(void* mod)
{
- BOOST_RE_GUARD_STACK
-#ifdef BOOST_HAS_THREADS
- re_detail::cs_guard g(*re_detail::p_re_lock);
-#endif
- // add reference to static member here to ensure
- // that the linker includes it in the .exe:
- if((--entry_count == 0) && (0 != &w32_regex_traits<char>::i) && is_init)
- do_free();
-#ifdef BOOST_HAS_THREADS
- g.acquire(false);
- re_detail::re_free_threads();
-#endif
+ ::FreeLibrary(static_cast<HMODULE>(mod));
}
-void BOOST_REGEX_CALL w32_regex_traits<char>::transform(std::string& out, const std::string& in)
+BOOST_REGEX_DECL cat_type BOOST_REGEX_CALL w32_cat_open(const std::string& name)
{
- BOOST_RE_GUARD_STACK
- size_t n = LCMapStringA(GetUserDefaultLCID(), LCMAP_SORTKEY, in.c_str(), -1, 0, 0);
- if(n == (size_t)(-1))
- {
- out = in;
- return;
- }
- scoped_array<char> buf(new char[n+1]);
- n = LCMapStringA(GetUserDefaultLCID(), LCMAP_SORTKEY, in.c_str(), -1, buf.get(), (int)n);
- if(n == (size_t)(-1))
- {
- out = in;
- return;
- }
- out = buf.get();
+ cat_type result(::LoadLibraryA(name.c_str()), &free_module);
+ return result;
}
-void BOOST_REGEX_CALL w32_regex_traits<char>::transform_primary(std::string& out, const std::string& in)
+BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type, int i, const std::string& def)
{
- transform(out, in);
- for(unsigned int i = 0; i < out.size(); ++i)
+ char buf[256];
+ if(0 == ::LoadStringA(
+ static_cast<HMODULE>(cat.get()),
+ i,
+ buf,
+ 256
+ ))
{
- if((out[i] == 1) && (i+1 < out.size()))
- {
- out.erase(i+1);
- break;
- }
+ return def;
}
+ return std::string(buf);
}
-
-int BOOST_REGEX_CALL w32_regex_traits<char>::toi(char c)
-{
- if(is_class(c, char_class_digit))
- return c - re_zero;
- if(is_class(c, char_class_xdigit))
- return 10 + translate(c, true) - translate(re_ten, true);
- return -1; // error!!
-}
-
-int BOOST_REGEX_CALL w32_regex_traits<char>::toi(const char*& first, const char* last, int radix)
-{
- unsigned int maxval;
- if(radix < 0)
+#ifndef BOOST_NO_WREGEX
+BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type, int i, const std::wstring& def)
+{
+ wchar_t buf[256];
+ if(0 == ::LoadStringW(
+ static_cast<HMODULE>(cat.get()),
+ i,
+ buf,
+ 256
+ ))
{
- // if radix is less than zero, then restrict
- // return value to charT. NB assumes sizeof(charT) <= sizeof(int)
- radix *= -1;
- maxval = 1 << (sizeof(*first) * CHAR_BIT - 1);
- maxval /= radix;
- maxval *= 2;
- maxval -= 1;
+ return def;
}
- else
+ return std::wstring(buf);
+}
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type, int i, const std::basic_string<unsigned short>& def)
+{
+ unsigned short buf[256];
+ if(0 == ::LoadStringW(
+ static_cast<HMODULE>(cat.get()),
+ i,
+ (LPWSTR)buf,
+ 256
+ ))
{
- maxval = (unsigned int)-1;
- maxval /= radix;
+ return def;
}
-
- unsigned int result = 0;
- unsigned int type = (radix > 10) ? char_class_xdigit : char_class_digit;
- while((first != last) && is_class(*first, type) && (result <= maxval))
+ return std::basic_string<unsigned short>(buf);
+}
+#endif
+#endif
+BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const char* p1, const char* p2)
+{
+ int bytes = ::LCMapStringA(
+ id, // locale identifier
+ LCMAP_SORTKEY, // mapping transformation type
+ p1, // source string
+ static_cast<int>(p2 - p1), // number of characters in source string
+ 0, // destination buffer
+ 0 // size of destination buffer
+ );
+ if(!bytes)
+ return std::string(p1, p2);
+ std::string result(++bytes, '\0');
+ bytes = ::LCMapStringA(
+ id, // locale identifier
+ LCMAP_SORTKEY, // mapping transformation type
+ p1, // source string
+ static_cast<int>(p2 - p1), // number of characters in source string
+ &*result.begin(), // destination buffer
+ bytes // size of destination buffer
+ );
+ if(bytes > static_cast<int>(result.size()))
+ return std::string(p1, p2);
+ while(result.size() && result[result.size()-1] == '\0')
{
- result *= radix;
- result += toi(*first);
- ++first;
+ result.erase(result.size()-1);
}
return result;
}
#ifndef BOOST_NO_WREGEX
-
-bool BOOST_REGEX_CALL w32_regex_traits<regex_wchar_type>::lookup_collatename(std::basic_string<regex_wchar_type>& out, const regex_wchar_type* first, const regex_wchar_type* last)
-{
- BOOST_RE_GUARD_STACK
- std::basic_string<regex_wchar_type> s(first, last);
- std::size_t len = strnarrow(static_cast<char*>(0), 0, s.c_str());
- scoped_array<char> buf(new char[len]);
- strnarrow(buf.get(), len, s.c_str());
- std::string t_out;
- bool result = base_type::do_lookup_collate(t_out, buf.get());
- if(t_out.size() == 0) result = false;
- if(result)
+BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_transform(lcid_type id, const wchar_t* p1, const wchar_t* p2)
+{
+ int bytes = ::LCMapStringW(
+ id, // locale identifier
+ LCMAP_SORTKEY, // mapping transformation type
+ p1, // source string
+ static_cast<int>(p2 - p1), // number of characters in source string
+ 0, // destination buffer
+ 0 // size of destination buffer
+ );
+ if(!bytes)
+ return std::wstring(p1, p2);
+ std::string result(++bytes, '\0');
+ bytes = ::LCMapStringW(
+ id, // locale identifier
+ LCMAP_SORTKEY, // mapping transformation type
+ p1, // source string
+ static_cast<int>(p2 - p1), // number of characters in source string
+ reinterpret_cast<wchar_t*>(&*result.begin()), // destination buffer *of bytes*
+ bytes // size of destination buffer
+ );
+ if(bytes > static_cast<int>(result.size()))
+ return std::wstring(p1, p2);
+ while(result.size() && result[result.size()-1] == L'\0')
{
- if(t_out[0])
- {
- len = strwiden(static_cast<regex_wchar_type*>(0), 0, t_out.c_str());
- scoped_array<regex_wchar_type> wb(new regex_wchar_type[len]);
- strwiden(wb.get(), len, t_out.c_str());
- out = wb.get();
- }
- else
- out.append(1,(regex_wchar_type)0);
+ result.erase(result.size()-1);
}
- return result;
-}
-
-unsigned int BOOST_REGEX_CALL w32_regex_traits<regex_wchar_type>::syntax_type(size_type c)
-{
- BOOST_RE_GUARD_STACK
- std::list<syntax_map_t>::const_iterator first, last;
- first = syntax->begin();
- last = syntax->end();
- while(first != last)
+ std::wstring r2;
+ for(std::string::size_type i = 0; i < result.size(); ++i)
+ r2.append(1, static_cast<wchar_t>(static_cast<unsigned char>(result[i])));
+ return r2;
+}
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_transform(lcid_type id, const unsigned short* p1, const unsigned short* p2)
+{
+ int bytes = ::LCMapStringW(
+ id, // locale identifier
+ LCMAP_SORTKEY, // mapping transformation type
+ (LPCWSTR)p1, // source string
+ static_cast<int>(p2 - p1), // number of characters in source string
+ 0, // destination buffer
+ 0 // size of destination buffer
+ );
+ if(!bytes)
+ return std::basic_string<unsigned short>(p1, p2);
+ std::string result(++bytes, '\0');
+ bytes = ::LCMapStringW(
+ id, // locale identifier
+ LCMAP_SORTKEY, // mapping transformation type
+ (LPCWSTR)p1, // source string
+ static_cast<int>(p2 - p1), // number of characters in source string
+ reinterpret_cast<wchar_t*>(&*result.begin()), // destination buffer *of bytes*
+ bytes // size of destination buffer
+ );
+ if(bytes > static_cast<int>(result.size()))
+ return std::basic_string<unsigned short>(p1, p2);
+ while(result.size() && result[result.size()-1] == L'\0')
{
- if((size_type)(uchar_type)((*first).c) == c)
- return (*first).type;
- ++first;
+ result.erase(result.size()-1);
}
- return 0;
+ std::basic_string<unsigned short> r2;
+ for(std::string::size_type i = 0; i < result.size(); ++i)
+ r2.append(1, static_cast<unsigned short>(static_cast<unsigned char>(result[i])));
+ return r2;
}
-
-bool BOOST_REGEX_CALL w32_regex_traits<regex_wchar_type>::do_lookup_collate(std::basic_string<regex_wchar_type>& out, const regex_wchar_type* first, const regex_wchar_type* last)
+#endif
+#endif
+BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type id)
{
- BOOST_RE_GUARD_STACK
- std::basic_string<regex_wchar_type> s(first, last);
- std::size_t len = strnarrow(static_cast<char*>(0), 0, s.c_str());
- scoped_array<char> buf(new char[len]);
- strnarrow(buf.get(), len, s.c_str());
- std::string t_out;
- bool result = base_type::do_lookup_collate(t_out, buf.get());
- if(result)
- {
- len = strwiden(static_cast<regex_wchar_type*>(0), 0, t_out.c_str());
- scoped_array<regex_wchar_type> wb(new regex_wchar_type[len]);
- strwiden(wb.get(), len, t_out.c_str());
- out = wb.get();
- }
- return result;
+ char result[2];
+ int b = ::LCMapStringA(
+ id, // locale identifier
+ LCMAP_LOWERCASE, // mapping transformation type
+ &c, // source string
+ 1, // number of characters in source string
+ result, // destination buffer
+ 1); // size of destination buffer
+ if(b == 0)
+ return c;
+ return result[0];
}
-
-void BOOST_REGEX_CALL w32_regex_traits<regex_wchar_type>::update()
-{
- BOOST_RE_GUARD_STACK
-#ifdef BOOST_HAS_THREADS
- re_detail::cs_guard g(*re_detail::p_re_lock);
-#endif
- do_init();
+#ifndef BOOST_NO_WREGEX
+BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_tolower(wchar_t c, lcid_type id)
+{
+ wchar_t result[2];
+ int b = ::LCMapStringW(
+ id, // locale identifier
+ LCMAP_LOWERCASE, // mapping transformation type
+ &c, // source string
+ 1, // number of characters in source string
+ result, // destination buffer
+ 1); // size of destination buffer
+ if(b == 0)
+ return c;
+ return result[0];
+}
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_tolower(unsigned short c, lcid_type id)
+{
+ wchar_t result[2];
+ int b = ::LCMapStringW(
+ id, // locale identifier
+ LCMAP_LOWERCASE, // mapping transformation type
+ (wchar_t const*)&c, // source string
+ 1, // number of characters in source string
+ result, // destination buffer
+ 1); // size of destination buffer
+ if(b == 0)
+ return c;
+ return result[0];
}
-
-w32_regex_traits<regex_wchar_type>::w32_regex_traits()
-{
- BOOST_RE_GUARD_STACK
-#ifdef BOOST_HAS_THREADS
- re_detail::re_init_threads();
- re_detail::cs_guard g(*re_detail::p_re_lock);
#endif
- ++entry_count;
+#endif
+BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type id)
+{
+ char result[2];
+ int b = ::LCMapStringA(
+ id, // locale identifier
+ LCMAP_UPPERCASE, // mapping transformation type
+ &c, // source string
+ 1, // number of characters in source string
+ result, // destination buffer
+ 1); // size of destination buffer
+ if(b == 0)
+ return c;
+ return result[0];
}
-w32_regex_traits<regex_wchar_type>::~w32_regex_traits()
-{
- BOOST_RE_GUARD_STACK
-#ifdef BOOST_HAS_THREADS
- re_detail::cs_guard g(*re_detail::p_re_lock);
+#ifndef BOOST_NO_WREGEX
+BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_toupper(wchar_t c, lcid_type id)
+{
+ wchar_t result[2];
+ int b = ::LCMapStringW(
+ id, // locale identifier
+ LCMAP_UPPERCASE, // mapping transformation type
+ &c, // source string
+ 1, // number of characters in source string
+ result, // destination buffer
+ 1); // size of destination buffer
+ if(b == 0)
+ return c;
+ return result[0];
+}
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_toupper(unsigned short c, lcid_type id)
+{
+ wchar_t result[2];
+ int b = ::LCMapStringW(
+ id, // locale identifier
+ LCMAP_UPPERCASE, // mapping transformation type
+ (wchar_t const*)&c, // source string
+ 1, // number of characters in source string
+ result, // destination buffer
+ 1); // size of destination buffer
+ if(b == 0)
+ return c;
+ return result[0];
+}
#endif
- // add reference to static member here to ensure
- // that the linker includes it in the .exe:
- if((--entry_count == 0) && (0 != &w32_regex_traits<regex_wchar_type>::init_) && is_init)
- do_free();
-#ifdef BOOST_HAS_THREADS
- g.acquire(false);
- re_detail::re_free_threads();
#endif
-}
-
-bool BOOST_REGEX_CALL w32_regex_traits<regex_wchar_type>::do_iswclass(regex_wchar_type c, boost::uint_fast32_t f)
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, char c)
{
- BOOST_RE_GUARD_STACK
- if((c & ~0xFF) == 0)
- return BOOST_REGEX_MAKE_BOOL(re_detail::wide_unicode_classes[(uchar_type)c] & f & char_class_win);
WORD mask;
- if(f & char_class_unicode)
+ if(::GetStringTypeExA(id, CT_CTYPE1, &c, 1, &mask) && (mask & m & w32_regex_traits_implementation<char>::mask_base))
+ return true;
+ if((m & w32_regex_traits_implementation<char>::mask_word) && (c == '_'))
return true;
- else if(isPlatformNT && GetStringTypeW(CT_CTYPE1, (const wchar_t*)&c, 1, &mask))
- return BOOST_REGEX_MAKE_BOOL(mask & f & char_class_win);
- else if((f & char_class_graph) == char_class_graph)
- return true; // all wide characters are considered "graphics"
return false;
}
-void BOOST_REGEX_CALL w32_regex_traits<regex_wchar_type>::transform(std::basic_string<regex_wchar_type>& out, const std::basic_string<regex_wchar_type>& in)
-{
- BOOST_RE_GUARD_STACK
- scoped_array<char> alt;
- size_t n;
- if(isPlatformNT)
- n = LCMapStringW(GetUserDefaultLCID(), LCMAP_SORTKEY, (const wchar_t*)in.c_str(), -1, 0, 0);
- else
- {
- n = strnarrow(static_cast<char*>(0), 0, in.c_str());
- alt.reset(new char[n+1]);
- strnarrow(alt.get(), n+1, in.c_str());
- n = LCMapStringA(GetUserDefaultLCID(), LCMAP_SORTKEY, alt.get(), -1, 0, 0);
- }
- if((n == (size_t)(-1)) || (n == 0))
- {
- out = in;
- return;
- }
- scoped_array<regex_wchar_type> buf(new regex_wchar_type[n+1]);
- // under win32 we get mapped to an array of bytes
- // not characters; since the underlying engine has to
- // deal with chars we widen the bytes to regex_wchar_type to ensure
- // the sort order remains unchanged when we compare.
- scoped_array<char> t(new char[n+1]);
- if(isPlatformNT)
- n = LCMapStringW(GetUserDefaultLCID(), LCMAP_SORTKEY, (const wchar_t*)in.c_str(), -1, reinterpret_cast<wchar_t*>(t.get()), (int)n);
- else
- n = LCMapStringA(GetUserDefaultLCID(), LCMAP_SORTKEY, alt.get(), -1, t.get(), (int)n);
- int i = -1;
- do
- {
- ++i;
- buf[i] = (regex_wchar_type)(unsigned char)t[i];
- } while(t[i]);
- if(n == (size_t)(-1))
- {
- out = in;
- return;
- }
- out = buf.get();
-}
-
-void BOOST_REGEX_CALL w32_regex_traits<regex_wchar_type>::transform_primary(std::basic_string<regex_wchar_type>& out, const std::basic_string<regex_wchar_type>& in)
-{
- transform(out, in);
- for(unsigned int i = 0; i < out.size(); ++i)
- {
- if((out[i] == 1) && ((i + 1) < out.size()))
- {
- out.erase(i+1);
- break;
- }
- }
-}
-
-
-int BOOST_REGEX_CALL w32_regex_traits<regex_wchar_type>::toi(regex_wchar_type c)
-{
- if(is_class(c, char_class_digit))
- return c - re_zero_w;
- if(is_class(c, char_class_xdigit))
- return 10 + translate(c, true) - translate(re_ten_w, true);
- return -1; // error!!
-}
-
-int BOOST_REGEX_CALL w32_regex_traits<regex_wchar_type>::toi(const regex_wchar_type*& first, const regex_wchar_type* last, int radix)
-{
- unsigned int maxval;
- if(radix < 0)
- {
- // if radix is less than zero, then restrict
- // return value to charT. NB assumes sizeof(charT) <= sizeof(int)
- radix *= -1;
- maxval = 1 << (sizeof(*first) * CHAR_BIT - 1);
- maxval /= radix;
- maxval *= 2;
- maxval -= 1;
- }
- else
- {
- maxval = (unsigned int)-1;
- maxval /= radix;
- }
-
- unsigned int result = 0;
- unsigned int type = (radix > 10) ? char_class_xdigit : char_class_digit;
- while((first != last) && is_class(*first, type) && (result <= maxval))
- {
- result *= radix;
- result += toi(*first);
- ++first;
- }
- return result;
-}
-
-boost::uint_fast32_t BOOST_REGEX_CALL w32_regex_traits<regex_wchar_type>::lookup_classname(const regex_wchar_type* first, const regex_wchar_type* last)
-{
- std::basic_string<regex_wchar_type> s(first, last);
- std::size_t len = strnarrow(static_cast<char*>(0), 0, s.c_str());
- scoped_array<char> buf(new char[len]);
- strnarrow(buf.get(), len, s.c_str());
- boost::uint_fast32_t result = do_lookup_class(buf.get());
- return result;
-}
-
-regex_wchar_type BOOST_REGEX_CALL w32_regex_traits<regex_wchar_type>::wtolower(regex_wchar_type c)
-{
- BOOST_RE_GUARD_STACK
- if(isPlatformNT)
- return LOWORD(CharLowerW(reinterpret_cast<wchar_t*>(static_cast<unsigned short>(c))));
- return c;
-}
-
-
-w32_regex_traits<regex_wchar_type> w32_regex_traits<regex_wchar_type>::init_;
-
-std::size_t BOOST_REGEX_CALL w32_regex_traits<regex_wchar_type>::strnarrow(char *s1, std::size_t len, const regex_wchar_type *s2)
+#ifndef BOOST_NO_WREGEX
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, wchar_t c)
{
- BOOST_RE_GUARD_STACK
- std::size_t size = WideCharToMultiByte(CP_ACP, 0, (const wchar_t*)s2, -1, s1, 0, 0, 0);
- if(size > len)
- return size;
- return WideCharToMultiByte(CP_ACP, 0, (const wchar_t*)s2, -1, s1, (int)len, 0, 0);
+ WORD mask;
+ if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & m & w32_regex_traits_implementation<wchar_t>::mask_base))
+ return true;
+ if((m & w32_regex_traits_implementation<wchar_t>::mask_word) && (c == '_'))
+ return true;
+ if((m & w32_regex_traits_implementation<wchar_t>::mask_unicode) && (c > 0xff))
+ return true;
+ return false;
}
-
-std::size_t BOOST_REGEX_CALL w32_regex_traits<regex_wchar_type>::strwiden(regex_wchar_type *s1, std::size_t len, const char *s2)
+#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
+BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, unsigned short c)
{
- BOOST_RE_GUARD_STACK
- std::size_t size = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, s2, -1, (wchar_t*)s1, 0);
- if(size > len)
- return size;
- return MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, s2, -1, (wchar_t*)s1, (int)len);
+ WORD mask;
+ if(::GetStringTypeExW(id, CT_CTYPE1, (wchar_t const*)&c, 1, &mask) && (mask & m & w32_regex_traits_implementation<wchar_t>::mask_base))
+ return true;
+ if((m & w32_regex_traits_implementation<wchar_t>::mask_word) && (c == '_'))
+ return true;
+ if((m & w32_regex_traits_implementation<wchar_t>::mask_unicode) && (c > 0xff))
+ return true;
+ return false;
}
+#endif
+#endif
-unsigned short w32_regex_traits<regex_wchar_type>::wide_unicode_classes[] = {
- re_detail::w32_traits_base::char_class_cntrl, // '' 0
- re_detail::w32_traits_base::char_class_cntrl, // '' 1
- re_detail::w32_traits_base::char_class_cntrl, // '' 2
- re_detail::w32_traits_base::char_class_cntrl, // '' 3
- re_detail::w32_traits_base::char_class_cntrl, // '' 4
- re_detail::w32_traits_base::char_class_cntrl, // '' 5
- re_detail::w32_traits_base::char_class_cntrl, // '' 6
- re_detail::w32_traits_base::char_class_cntrl, // '' 7
- re_detail::w32_traits_base::char_class_cntrl, // '' 8
- re_detail::w32_traits_base::char_class_cntrl | re_detail::w32_traits_base::char_class_space | re_detail::w32_traits_base::char_class_blank, // '' 9
- re_detail::w32_traits_base::char_class_cntrl | re_detail::w32_traits_base::char_class_space, // '' 10
- re_detail::w32_traits_base::char_class_cntrl | re_detail::w32_traits_base::char_class_space, // '' 11
- re_detail::w32_traits_base::char_class_cntrl | re_detail::w32_traits_base::char_class_space, // '' 12
- re_detail::w32_traits_base::char_class_cntrl | re_detail::w32_traits_base::char_class_space, // '' 13
- re_detail::w32_traits_base::char_class_cntrl, // '.' 14
- re_detail::w32_traits_base::char_class_cntrl, // '.' 15
- re_detail::w32_traits_base::char_class_cntrl, // '.' 16
- re_detail::w32_traits_base::char_class_cntrl, // '.' 17
- re_detail::w32_traits_base::char_class_cntrl, // '.' 18
- re_detail::w32_traits_base::char_class_cntrl, // '.' 19
- re_detail::w32_traits_base::char_class_cntrl, // '.' 20
- re_detail::w32_traits_base::char_class_cntrl, // '.' 21
- re_detail::w32_traits_base::char_class_cntrl, // '.' 22
- re_detail::w32_traits_base::char_class_cntrl, // '.' 23
- re_detail::w32_traits_base::char_class_cntrl, // '.' 24
- re_detail::w32_traits_base::char_class_cntrl, // '' 25
- re_detail::w32_traits_base::char_class_cntrl, // '' 26
- re_detail::w32_traits_base::char_class_cntrl, // '' 27
- re_detail::w32_traits_base::char_class_cntrl, // '.' 28
- re_detail::w32_traits_base::char_class_cntrl, // '.' 29
- re_detail::w32_traits_base::char_class_cntrl, // '.' 30
- re_detail::w32_traits_base::char_class_cntrl, // '.' 31
- re_detail::w32_traits_base::char_class_space | re_detail::w32_traits_base::char_class_blank, // ' ' 32
- re_detail::w32_traits_base::char_class_punct, // '!' 33
- re_detail::w32_traits_base::char_class_punct, // '"' 34
- re_detail::w32_traits_base::char_class_punct, // '#' 35
- re_detail::w32_traits_base::char_class_punct, // '$' 36
- re_detail::w32_traits_base::char_class_punct, // '%' 37
- re_detail::w32_traits_base::char_class_punct, // '&' 38
- re_detail::w32_traits_base::char_class_punct, // ''' 39
- re_detail::w32_traits_base::char_class_punct, // '(' 40
- re_detail::w32_traits_base::char_class_punct, // ')' 41
- re_detail::w32_traits_base::char_class_punct, // '*' 42
- re_detail::w32_traits_base::char_class_punct, // '+' 43
- re_detail::w32_traits_base::char_class_punct, // ',' 44
- re_detail::w32_traits_base::char_class_punct, // '-' 45
- re_detail::w32_traits_base::char_class_punct, // '.' 46
- re_detail::w32_traits_base::char_class_punct, // '/' 47
- re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '0' 48
- re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '1' 49
- re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '2' 50
- re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '3' 51
- re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '4' 52
- re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '5' 53
- re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '6' 54
- re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '7' 55
- re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '8' 56
- re_detail::w32_traits_base::char_class_digit | re_detail::w32_traits_base::char_class_xdigit, // '9' 57
- re_detail::w32_traits_base::char_class_punct, // ':' 58
- re_detail::w32_traits_base::char_class_punct, // ';' 59
- re_detail::w32_traits_base::char_class_punct, // '<' 60
- re_detail::w32_traits_base::char_class_punct, // '=' 61
- re_detail::w32_traits_base::char_class_punct, // '>' 62
- re_detail::w32_traits_base::char_class_punct, // '?' 63
- re_detail::w32_traits_base::char_class_punct, // '@' 64
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper | re_detail::w32_traits_base::char_class_xdigit, // 'A' 65
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper | re_detail::w32_traits_base::char_class_xdigit, // 'B' 66
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper | re_detail::w32_traits_base::char_class_xdigit, // 'C' 67
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper | re_detail::w32_traits_base::char_class_xdigit, // 'D' 68
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper | re_detail::w32_traits_base::char_class_xdigit, // 'E' 69
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper | re_detail::w32_traits_base::char_class_xdigit, // 'F' 70
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'G' 71
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'H' 72
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'I' 73
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'J' 74
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'K' 75
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'L' 76
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'M' 77
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'N' 78
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'O' 79
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'P' 80
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Q' 81
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'R' 82
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'S' 83
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'T' 84
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'U' 85
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'V' 86
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'W' 87
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'X' 88
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Y' 89
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Z' 90
- re_detail::w32_traits_base::char_class_punct, // '[' 91
- re_detail::w32_traits_base::char_class_punct, // '\' 92
- re_detail::w32_traits_base::char_class_punct, // ']' 93
- re_detail::w32_traits_base::char_class_punct, // '^' 94
- re_detail::w32_traits_base::char_class_punct | re_detail::w32_traits_base::char_class_underscore, // '_' 95
- re_detail::w32_traits_base::char_class_punct, // '`' 96
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower | re_detail::w32_traits_base::char_class_xdigit, // 'a' 97
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower | re_detail::w32_traits_base::char_class_xdigit, // 'b' 98
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower | re_detail::w32_traits_base::char_class_xdigit, // 'c' 99
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower | re_detail::w32_traits_base::char_class_xdigit, // 'd' 100
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower | re_detail::w32_traits_base::char_class_xdigit, // 'e' 101
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower | re_detail::w32_traits_base::char_class_xdigit, // 'f' 102
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'g' 103
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'h' 104
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'i' 105
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'j' 106
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'k' 107
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'l' 108
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'm' 109
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'n' 110
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'o' 111
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'p' 112
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'q' 113
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'r' 114
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 's' 115
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 't' 116
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'u' 117
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'v' 118
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'w' 119
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'x' 120
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'y' 121
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'z' 122
- re_detail::w32_traits_base::char_class_punct, // '{' 123
- re_detail::w32_traits_base::char_class_punct, // '|' 124
- re_detail::w32_traits_base::char_class_punct, // '}' 125
- re_detail::w32_traits_base::char_class_punct, // '~' 126
-
- re_detail::w32_traits_base::char_class_cntrl, // '\7f' 127
- re_detail::w32_traits_base::char_class_cntrl, // '\80' 128
- re_detail::w32_traits_base::char_class_cntrl, // '\81' 129
- re_detail::w32_traits_base::char_class_cntrl, // '\82' 130
- re_detail::w32_traits_base::char_class_cntrl, // '\83' 131
- re_detail::w32_traits_base::char_class_cntrl, // '\84' 132
- re_detail::w32_traits_base::char_class_cntrl, // '\85' 133
- re_detail::w32_traits_base::char_class_cntrl, // '\86' 134
- re_detail::w32_traits_base::char_class_cntrl, // '\87' 135
- re_detail::w32_traits_base::char_class_cntrl, // '\88' 136
- re_detail::w32_traits_base::char_class_cntrl, // '\89' 137
- re_detail::w32_traits_base::char_class_cntrl, // '\8a' 138
- re_detail::w32_traits_base::char_class_cntrl, // '\8b' 139
- re_detail::w32_traits_base::char_class_cntrl, // '\8c' 140
- re_detail::w32_traits_base::char_class_cntrl, // '\8d' 141
- re_detail::w32_traits_base::char_class_cntrl, // '\8e' 142
- re_detail::w32_traits_base::char_class_cntrl, // '\8f' 143
- re_detail::w32_traits_base::char_class_cntrl, // '\90' 144
- re_detail::w32_traits_base::char_class_cntrl, // '\91' 145
- re_detail::w32_traits_base::char_class_cntrl, // '\92' 146
- re_detail::w32_traits_base::char_class_cntrl, // '\93' 147
- re_detail::w32_traits_base::char_class_cntrl, // '\94' 148
- re_detail::w32_traits_base::char_class_cntrl, // '\95' 149
- re_detail::w32_traits_base::char_class_cntrl, // '\96' 150
- re_detail::w32_traits_base::char_class_cntrl, // '\97' 151
- re_detail::w32_traits_base::char_class_cntrl, // '\98' 152
- re_detail::w32_traits_base::char_class_cntrl, // '\99' 153
- re_detail::w32_traits_base::char_class_cntrl, // '\9a' 154
- re_detail::w32_traits_base::char_class_cntrl, // '\9b' 155
- re_detail::w32_traits_base::char_class_cntrl, // '\9c' 156
- re_detail::w32_traits_base::char_class_cntrl, // '\9d' 157
- re_detail::w32_traits_base::char_class_cntrl, // '\9e' 158
- re_detail::w32_traits_base::char_class_cntrl, // '\9f' 159
- re_detail::w32_traits_base::char_class_space | re_detail::w32_traits_base::char_class_blank, // ' ' 160
- re_detail::w32_traits_base::char_class_punct, // '¡' 161
- re_detail::w32_traits_base::char_class_punct, // '¢' 162
- re_detail::w32_traits_base::char_class_punct, // '£' 163
- re_detail::w32_traits_base::char_class_punct, // '¤' 164
- re_detail::w32_traits_base::char_class_punct, // '¥' 165
- re_detail::w32_traits_base::char_class_punct, // '¦' 166
- re_detail::w32_traits_base::char_class_punct, // '§' 167
- re_detail::w32_traits_base::char_class_punct, // '¨' 168
- re_detail::w32_traits_base::char_class_punct, // '©' 169
- re_detail::w32_traits_base::char_class_punct, // 'ª' 170
- re_detail::w32_traits_base::char_class_punct, // '«' 171
- re_detail::w32_traits_base::char_class_punct, // '¬' 172
- re_detail::w32_traits_base::char_class_punct, // '' 173
- re_detail::w32_traits_base::char_class_punct, // '®' 174
- re_detail::w32_traits_base::char_class_punct, // '¯' 175
- re_detail::w32_traits_base::char_class_punct, // '°' 176
- re_detail::w32_traits_base::char_class_punct, // '±' 177
- re_detail::w32_traits_base::char_class_punct, // '²' 178
- re_detail::w32_traits_base::char_class_punct, // '³' 179
- re_detail::w32_traits_base::char_class_punct, // '´' 180
- re_detail::w32_traits_base::char_class_punct, // 'µ' 181
- re_detail::w32_traits_base::char_class_punct, // '¶' 182
- re_detail::w32_traits_base::char_class_punct, // '·' 183
- re_detail::w32_traits_base::char_class_punct, // '¸' 184
- re_detail::w32_traits_base::char_class_punct, // '¹' 185
- re_detail::w32_traits_base::char_class_punct, // 'º' 186
- re_detail::w32_traits_base::char_class_punct, // '»' 187
- re_detail::w32_traits_base::char_class_punct, // '¼' 188
- re_detail::w32_traits_base::char_class_punct, // '½' 189
- re_detail::w32_traits_base::char_class_punct, // '¾' 190
- re_detail::w32_traits_base::char_class_punct, // '¿' 191
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'À' 192
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Á' 193
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Â' 194
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ã' 195
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ä' 196
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Å' 197
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Æ' 198
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ç' 199
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'È' 200
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'É' 201
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ê' 202
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ë' 203
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ì' 204
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Í' 205
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Î' 206
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ï' 207
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ð' 208
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ñ' 209
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ò' 210
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ó' 211
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ô' 212
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Õ' 213
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ö' 214
- re_detail::w32_traits_base::char_class_punct, // '×' 215
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ø' 216
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ù' 217
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ú' 218
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Û' 219
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ü' 220
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Ý' 221
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_upper, // 'Þ' 222
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ß' 223
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'à' 224
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'á' 225
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'â' 226
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ã' 227
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ä' 228
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'å' 229
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'æ' 230
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ç' 231
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'è' 232
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'é' 233
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ê' 234
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ë' 235
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ì' 236
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'í' 237
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'î' 238
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ï' 239
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ð' 240
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ñ' 241
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ò' 242
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ó' 243
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ô' 244
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'õ' 245
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ö' 246
- re_detail::w32_traits_base::char_class_punct, // '÷' 247
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ø' 248
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ù' 249
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ú' 250
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'û' 251
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ü' 252
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ý' 253
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'þ' 254
- re_detail::w32_traits_base::char_class_alpha | re_detail::w32_traits_base::char_class_lower, // 'ÿ' 255
-};
-
-
-
-#endif // BOOST_NO_WREGEX
-
-
-} // namespace boost
-
-#endif // #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
-
-
-
-
+} // re_detail
+} // boost
+#endif
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#ifndef BOOST_NO_WREGEX
+#include <boost/cregex.hpp>
#include <boost/regex.hpp>
#include <cwchar>
#include <cstring>
#include <cstdio>
+#if defined(BOOST_NO_STDC_NAMESPACE)
+namespace std{
+# ifndef BOOST_NO_SWPRINTF
+ using ::swprintf;
+# endif
+}
+#endif
+
+
namespace boost{
namespace {
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;
#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:
}
if(f & REG_NOSUB)
- expression->eflags |= match_any;
+ {
+ //expression->eflags |= match_any;
+ flags |= wregex::nosubs;
+ }
if(f & REG_NOSPEC)
flags |= wregex::literal;
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)
expression->re_nsub = static_cast<wregex*>(expression->guts)->mark_count() - 1;
result = static_cast<wregex*>(expression->guts)->error_code();
#ifndef BOOST_NO_EXCEPTIONS
- } catch(...)
+ }
+ catch(const boost::regex_error& be)
+ {
+ result = be.code();
+ }
+ catch(...)
{
result = REG_E_UNKNOWN;
}
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)
{
code &= ~REG_ITOA;
- if(code <= REG_E_UNKNOWN)
+ if((code <= (int)REG_E_UNKNOWN) && (code >= 0))
{
result = std::wcslen(wnames[code]) + 1;
if(buf_size >= result)
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+ ::wcscpy_s(buf, buf_size, wnames[code]);
+#else
std::wcscpy(buf, wnames[code]);
+#endif
return result;
}
return result;
wchar_t localbuf[5];
if(e == 0)
return 0;
- for(int i = 0; i <= REG_E_UNKNOWN; ++i)
+ for(int i = 0; i <= (int)REG_E_UNKNOWN; ++i)
{
if(std::wcscmp(e->re_endp, wnames[i]) == 0)
{
- std::swprintf(localbuf, 5, L"%d", i);
+ (std::swprintf)(localbuf, 5, L"%d", i);
if(std::wcslen(localbuf) < buf_size)
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+ ::wcscpy_s(buf, buf_size, localbuf);
+#else
std::wcscpy(buf, localbuf);
+#endif
return std::wcslen(localbuf) + 1;
}
}
- std::swprintf(localbuf, 5, L"%d", 0);
+ (std::swprintf)(localbuf, 5, L"%d", 0);
if(std::wcslen(localbuf) < buf_size)
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+ ::wcscpy_s(buf, buf_size, localbuf);
+#else
std::wcscpy(buf, localbuf);
+#endif
return std::wcslen(localbuf) + 1;
}
#endif
- if(code <= REG_E_UNKNOWN)
+ if(code <= (int)REG_E_UNKNOWN)
{
- regex_traits<wchar_t> rt;
- const regex_traits<wchar_t>* pt = &rt;
- if(e && (e->re_magic == wmagic_value))
- 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());
+ std::string p;
+ if((e) && (e->re_magic == wmagic_value))
+ p = static_cast<wregex*>(e->guts)->get_traits().error_string(static_cast< ::boost::regex_constants::error_type>(code));
+ else
+ {
+ p = re_detail::get_default_error_string(static_cast< ::boost::regex_constants::error_type>(code));
+ }
+ std::size_t len = p.size();
if(len < buf_size)
{
- pt->strwiden(buf, buf_size, p.c_str());
+ re_detail::copy(p.c_str(), p.c_str() + p.size() + 1, buf);
}
return len + 1;
}
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
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4267)
+#endif
bool result = false;
match_flag_type flags = match_default | expression->eflags;
const wchar_t* end;
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);
return 0;
}
return REG_NOMATCH;
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
}
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);
/*
*
* Copyright (c) 1998-2002
- * Dr John Maddock
+ * John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
#endif
+
+
typedef std::list<connection_slot_pair> group_list;
typedef group_list::iterator slot_pair_iterator;
-typedef std::map<any, group_list, compare_type> slot_container_type;
+typedef std::map<stored_group, group_list, compare_type> slot_container_type;
typedef slot_container_type::iterator group_iterator;
typedef slot_container_type::const_iterator const_group_iterator;
-class named_slot_map::impl
-{
-public:
- impl(const compare_type& compare) : groups(compare)
- {
- clear();
- }
-
- void clear()
- {
- groups.clear();
- groups[front_type()];
- groups[back_type()];
- back = groups.end();
- --back;
- }
-
- slot_container_type groups;
- group_iterator back;
-
- bool empty(const_group_iterator group) const
- {
- return (group->second.empty() && group != groups.begin() && group != back);
- }
-};
-
-class named_slot_map_iterator::impl
-{
-public:
- impl() : slot_assigned(false) {}
-
- impl(group_iterator group, group_iterator last_group)
- : group(group), last_group(last_group), slot_assigned(false)
- { init_next_group(); }
-
- impl(group_iterator group, group_iterator last_group,
- slot_pair_iterator slot_)
- : group(group), last_group(last_group), slot_(slot_), slot_assigned(true)
- { }
-
- impl(const impl& other)
- : group(other.group), last_group(other.last_group),
- slot_assigned(other.slot_assigned)
- {
- if (slot_assigned) slot_ = other.slot_;
- }
-
- impl& operator=(const impl& other)
- {
- group = other.group;
- last_group = other.last_group;
- slot_assigned = other.slot_assigned;
- if (slot_assigned) slot_ = other.slot_;
- return *this;
- }
-
- void init_next_group()
- {
- while (group != last_group && group->second.empty()) ++group;
- if (group != last_group) {
- slot_ = group->second.begin();
- slot_assigned = true;
- }
- }
-
- group_iterator group;
- group_iterator last_group;
- slot_pair_iterator slot_;
- bool slot_assigned;
-};
+named_slot_map_iterator::named_slot_map_iterator() : slot_assigned(false) {}
-named_slot_map_iterator::named_slot_map_iterator() {}
-
-named_slot_map_iterator::named_slot_map_iterator(std::auto_ptr<impl> impl_)
- : impl_(impl_) {}
-
-named_slot_map_iterator
- ::named_slot_map_iterator(const named_slot_map_iterator& other)
+named_slot_map_iterator::
+named_slot_map_iterator(const named_slot_map_iterator& other)
+ : group(other.group), last_group(other.last_group),
+ slot_assigned(other.slot_assigned)
{
- impl_.reset(new impl(*other.impl_));
+ if (slot_assigned) slot_ = other.slot_;
}
-named_slot_map_iterator::~named_slot_map_iterator() {}
-
named_slot_map_iterator&
named_slot_map_iterator::operator=(const named_slot_map_iterator& other)
{
- if (impl_) *impl_ = *other.impl_;
- else impl_.reset(new impl(*other.impl_));
+ slot_assigned = other.slot_assigned;
+ group = other.group;
+ last_group = other.last_group;
+ if (slot_assigned) slot_ = other.slot_;
return *this;
}
+
connection_slot_pair& named_slot_map_iterator::dereference() const
-{ return *impl_->slot_; }
+{ return *slot_; }
void named_slot_map_iterator::increment()
{
- ++impl_->slot_;
- if (impl_->slot_ == impl_->group->second.end()) {
- ++impl_->group;
- impl_->init_next_group();
+ ++slot_;
+ if (slot_ == group->second.end()) {
+ ++group;
+ init_next_group();
}
}
-bool
+bool
named_slot_map_iterator::equal(const named_slot_map_iterator& other) const
{
- return (impl_->group == other.impl_->group
- && (impl_->group == impl_->last_group
- || impl_->slot_ == other.impl_->slot_));
+ return (group == other.group
+ && (group == last_group
+ || slot_ == other.slot_));
}
-#if BOOST_WORKAROUND(BOOST_MSVC, <= 0x1701)
+#if BOOST_WORKAROUND(_MSC_VER, <= 1400)
void named_slot_map_iterator::decrement() { assert(false); }
void named_slot_map_iterator::advance(difference_type) { assert(false); }
#endif
-named_slot_map::named_slot_map(const compare_type& compare)
+named_slot_map::named_slot_map(const compare_type& compare) : groups(compare)
{
- impl_.reset(new impl(compare));
+ clear();
}
-named_slot_map::~named_slot_map() {}
-
-void named_slot_map::clear() { impl_->clear(); }
+void named_slot_map::clear()
+{
+ groups.clear();
+ groups[stored_group(stored_group::sk_front)];
+ groups[stored_group(stored_group::sk_back)];
+ back = groups.end();
+ --back;
+}
named_slot_map::iterator named_slot_map::begin()
{
- typedef named_slot_map::iterator::impl iterator_impl;
-
- std::auto_ptr<iterator_impl>
- it(new iterator_impl(impl_->groups.begin(),
- impl_->groups.end()));
- return named_slot_map::iterator(it);
+ return named_slot_map::iterator(groups.begin(), groups.end());
}
named_slot_map::iterator named_slot_map::end()
{
- typedef named_slot_map::iterator::impl iterator_impl;
-
- std::auto_ptr<iterator_impl>
- it(new iterator_impl(impl_->groups.end(),
- impl_->groups.end()));
- return named_slot_map::iterator(it);
+ return named_slot_map::iterator(groups.end(), groups.end());
}
named_slot_map::iterator
-named_slot_map::insert(const any& name, const connection& con, const any& slot,
- connect_position at)
+named_slot_map::insert(const stored_group& name, const connection& con,
+ const any& slot, connect_position at)
{
group_iterator group;
if (name.empty()) {
switch (at) {
- case at_front: group = impl_->groups.begin(); break;
- case at_back: group = impl_->back; break;
+ case at_front: group = groups.begin(); break;
+ case at_back: group = back; break;
}
} else {
- group = impl_->groups.find(name);
- if (group == impl_->groups.end()) {
+ group = groups.find(name);
+ if (group == groups.end()) {
slot_container_type::value_type v(name, group_list());
- group = impl_->groups.insert(v).first;
+ group = groups.insert(v).first;
}
}
- typedef named_slot_map::iterator::impl iterator_impl;
- std::auto_ptr<iterator_impl> it(new iterator_impl);
- it->group = group;
- it->last_group = impl_->groups.end();
+ iterator it;
+ it.group = group;
+ it.last_group = groups.end();
switch (at) {
case at_back:
group->second.push_back(connection_slot_pair(con, slot));
- it->slot_ = group->second.end();
- it->slot_assigned = true;
- --(it->slot_);
+ it.slot_ = group->second.end();
+ it.slot_assigned = true;
+ --(it.slot_);
break;
case at_front:
group->second.push_front(connection_slot_pair(con, slot));
- it->slot_ = group->second.begin();
- it->slot_assigned = true;
+ it.slot_ = group->second.begin();
+ it.slot_assigned = true;
break;
}
- return iterator(it);
+ return it;
}
-void named_slot_map::disconnect(const any& name)
+void named_slot_map::disconnect(const stored_group& name)
{
- group_iterator group = impl_->groups.find(name);
- if (group != impl_->groups.end()) {
+ group_iterator group = groups.find(name);
+ if (group != groups.end()) {
slot_pair_iterator i = group->second.begin();
while (i != group->second.end()) {
slot_pair_iterator next = i;
i->first.disconnect();
i = next;
}
- impl_->groups.erase(group);
+ groups.erase(group);
}
}
void named_slot_map::erase(iterator pos)
{
// Erase the slot
- pos.impl_->slot_->first.disconnect();
- // pos.impl_->group->second.erase(pos.impl_->slot_); ?
+ pos.slot_->first.disconnect();
+ pos.group->second.erase(pos.slot_);
}
void named_slot_map::remove_disconnected_slots()
{
// Remove any disconnected slots
- group_iterator g = impl_->groups.begin();
- while (g != impl_->groups.end()) {
+ group_iterator g = groups.begin();
+ while (g != groups.end()) {
slot_pair_iterator s = g->second.begin();
while (s != g->second.end()) {
if (s->first.connected()) ++s;
}
// Clear out empty groups
- if (impl_->empty(g)) impl_->groups.erase(g++);
+ if (empty(g)) groups.erase(g++);
else ++g;
}
}
connection
signal_base_impl::
connect_slot(const any& slot_,
- const any& name,
+ const stored_group& name,
shared_ptr<slot_base::data_t> data,
connect_position at)
{
std::auto_ptr<iterator> saved_iter(new iterator);
// Add the slot to the list.
- iterator pos =
+ iterator pos =
slots_.insert(name, data->watch_bound_objects, slot_, at);
// The assignment operation here absolutely must not throw, which
// Fill out the connection object appropriately. None of these
// operations can throw
data->watch_bound_objects.get_connection()->signal = this;
- data->watch_bound_objects.get_connection()->signal_data =
+ data->watch_bound_objects.get_connection()->signal_data =
saved_iter.release();
- data->watch_bound_objects.get_connection()->signal_disconnect =
+ data->watch_bound_objects.get_connection()->signal_disconnect =
&signal_base_impl::slot_disconnected;
// Make the copy of the connection in the list disconnect when it is
return count;
}
- void signal_base_impl::disconnect(const any& group)
+ void signal_base_impl::disconnect(const stored_group& group)
{ slots_.disconnect(group); }
void signal_base_impl::slot_disconnected(void* obj, void* data)
// signal for the connection to be connected.
con->signal = static_cast<void*>(this);
con->signal_data = 0;
+ con->blocked_ = false ;
con->signal_disconnect = &bound_object_destructed;
}
// Now notify each of the bound objects that they are connected to this
// slot.
- for(std::vector<const trackable*>::iterator i =
- data->bound_objects.begin();
+ for(std::vector<const trackable*>::iterator i =
+ data->bound_objects.begin();
i != data->bound_objects.end(); ++i) {
// Notify the object that the slot is connecting to it
BOOST_SIGNALS_NAMESPACE::detail::bound_object binding;