diff --git a/boost/boost/aligned_storage.hpp b/boost/boost/aligned_storage.hpp index cfaf7877a1..ce277ab702 100644 --- a/boost/boost/aligned_storage.hpp +++ b/boost/boost/aligned_storage.hpp @@ -54,6 +54,14 @@ struct aligned_storage_imp , type_with_alignment >::type align_; } data_; + void* address() const { return const_cast(this); } +}; + +template< std::size_t alignment_ > +struct aligned_storage_imp<0u,alignment_> +{ + /* intentionally empty */ + void* address() const { return 0; } }; }} // namespace detail::aligned_storage @@ -62,12 +70,15 @@ template < std::size_t size_ , std::size_t alignment_ = std::size_t(-1) > -class aligned_storage +class aligned_storage : +#ifndef __BORLANDC__ + private +#else + public +#endif + detail::aligned_storage::aligned_storage_imp { -private: // representation - - detail::aligned_storage::aligned_storage_imp data_; - + public: // constants typedef detail::aligned_storage::aligned_storage_imp type; @@ -118,14 +129,14 @@ public: // accessors void* address() { - return this; + return static_cast(this)->address(); } #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) const void* address() const { - return this; + return static_cast(this)->address(); } #else // MSVC6 diff --git a/boost/boost/array.hpp b/boost/boost/array.hpp index 52218aac51..8ef73c4250 100644 --- a/boost/boost/array.hpp +++ b/boost/boost/array.hpp @@ -27,6 +27,7 @@ #include #include #include +#include // Handles broken standard libraries better than #include @@ -131,7 +132,8 @@ namespace boost { // swap (note: linear complexity) void swap (array& y) { - std::swap_ranges(begin(),end(),y.begin()); + for (size_type i = 0; i < N; ++i) + boost::swap(elems[i],y.elems[i]); } // direct access to data (read-only) @@ -209,19 +211,19 @@ namespace boost { } // operator[] - reference operator[](size_type i) + reference operator[](size_type /*i*/) { return failed_rangecheck(); } - const_reference operator[](size_type i) const + const_reference operator[](size_type /*i*/) const { return failed_rangecheck(); } // at() with range check - reference at(size_type i) { return failed_rangecheck(); } - const_reference at(size_type i) const { return failed_rangecheck(); } + reference at(size_type /*i*/) { return failed_rangecheck(); } + const_reference at(size_type /*i*/) const { return failed_rangecheck(); } // front() and back() reference front() @@ -250,7 +252,7 @@ namespace boost { static size_type max_size() { return 0; } enum { static_size = 0 }; - void swap (array& y) { + void swap (array& /*y*/) { } // direct access to data (read-only) diff --git a/boost/boost/bind/protect.hpp b/boost/boost/bind/protect.hpp index b1ff2a2a8e..749e158c34 100644 --- a/boost/boost/bind/protect.hpp +++ b/boost/boost/bind/protect.hpp @@ -5,12 +5,16 @@ // protect.hpp // // Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2009 Steven Watanabe // // 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 +#include + namespace boost { @@ -47,6 +51,22 @@ public: return f_(a1); } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(const A1 & a1) + { + return f_(a1); + } + + template result_type operator()(const A1 & a1) const + { + return f_(a1); + } + +#endif + template result_type operator()(A1 & a1, A2 & a2) { return f_(a1, a2); @@ -57,6 +77,41 @@ public: return f_(a1, a2); } +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 & a2) + { + return f_(a1, a2); + } + + template result_type operator()(A1 const & a1, A2 & a2) const + { + return f_(a1, a2); + } + + template result_type operator()(A1 & a1, A2 const & a2) + { + return f_(a1, a2); + } + + template result_type operator()(A1 & a1, A2 const & a2) const + { + return f_(a1, a2); + } + + template result_type operator()(A1 const & a1, A2 const & a2) + { + return f_(a1, a2); + } + + template result_type operator()(A1 const & a1, A2 const & a2) const + { + return f_(a1, a2); + } + +#endif + template result_type operator()(A1 & a1, A2 & a2, A3 & a3) { return f_(a1, a2, a3); @@ -66,6 +121,21 @@ public: { return f_(a1, a2, a3); } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) + { + return f_(a1, a2, a3); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) const + { + return f_(a1, a2, a3); + } + +#endif template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) { @@ -76,6 +146,21 @@ public: { return f_(a1, a2, a3, a4); } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) + { + return f_(a1, a2, a3, a4); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) const + { + return f_(a1, a2, a3, a4); + } + +#endif template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) { @@ -86,6 +171,21 @@ public: { return f_(a1, a2, a3, a4, a5); } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) + { + return f_(a1, a2, a3, a4, a5); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) const + { + return f_(a1, a2, a3, a4, a5); + } + +#endif template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) { @@ -96,6 +196,21 @@ public: { return f_(a1, a2, a3, a4, a5, a6); } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) + { + return f_(a1, a2, a3, a4, a5, a6); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) const + { + return f_(a1, a2, a3, a4, a5, a6); + } + +#endif template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) { @@ -106,6 +221,21 @@ public: { return f_(a1, a2, a3, a4, a5, a6, a7); } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) + { + return f_(a1, a2, a3, a4, a5, a6, a7); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) const + { + return f_(a1, a2, a3, a4, a5, a6, a7); + } + +#endif template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) { @@ -116,6 +246,21 @@ public: { return f_(a1, a2, a3, a4, a5, a6, a7, a8); } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) + { + return f_(a1, a2, a3, a4, a5, a6, a7, a8); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) const + { + return f_(a1, a2, a3, a4, a5, a6, a7, a8); + } + +#endif template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) { @@ -126,6 +271,21 @@ public: { return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9); } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) + { + return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) const + { + return f_(a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + +#endif private: diff --git a/boost/boost/config/compiler/borland.hpp b/boost/boost/config/compiler/borland.hpp index c6413b3a1d..16a70687f4 100644 --- a/boost/boost/config/compiler/borland.hpp +++ b/boost/boost/config/compiler/borland.hpp @@ -129,6 +129,8 @@ # define BOOST_NO_TWO_PHASE_NAME_LOOKUP # define BOOST_NO_USING_TEMPLATE # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE +# define BOOST_NO_NESTED_FRIENDSHIP +# define BOOST_NO_TYPENAME_WITH_CTOR #endif // @@ -141,7 +143,16 @@ // // C++0x Macros: // -#if defined( BOOST_CODEGEAR_0X_SUPPORT ) && (__BORLANDC__ >= 0x610) +#if !defined( BOOST_CODEGEAR_0X_SUPPORT ) || (__BORLANDC__ < 0x610) +# define BOOST_NO_CHAR16_T +# define BOOST_NO_CHAR32_T +# define BOOST_NO_DECLTYPE +# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_RVALUE_REFERENCES +# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_STATIC_ASSERT +#else # define BOOST_HAS_ALIGNOF # define BOOST_HAS_CHAR16_T # define BOOST_HAS_CHAR32_T @@ -150,35 +161,23 @@ # define BOOST_HAS_REF_QUALIFIER # define BOOST_HAS_RVALUE_REFS # define BOOST_HAS_STATIC_ASSERT - -# define BOOST_NO_EXTERN_TEMPLATE -# define BOOST_NO_SCOPED_ENUMS -# define BOOST_NO_VARIADIC_TEMPLATES -# define BOOST_NO_CONSTEXPR -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_DELETED_FUNCTIONS -# define BOOST_NO_RAW_LITERALS -# define BOOST_NO_UNICODE_LITERALS // UTF-8 still not supported -#else -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T -# define BOOST_NO_DECLTYPE -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_EXTERN_TEMPLATE -# define BOOST_NO_SCOPED_ENUMS -# define BOOST_NO_STATIC_ASSERT -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_VARIADIC_TEMPLATES -# define BOOST_NO_CONSTEXPR -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_DELETED_FUNCTIONS -# define BOOST_NO_RAW_LITERALS -# define BOOST_NO_UNICODE_LITERALS #endif #define BOOST_NO_AUTO_DECLARATIONS #define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CONCEPTS +#define BOOST_NO_CONSTEXPR +#define BOOST_NO_DEFAULTED_FUNCTIONS +#define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR +#define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_TEMPLATE_ALIASES +#define BOOST_NO_UNICODE_LITERALS // UTF-8 still not supported +#define BOOST_NO_VARIADIC_TEMPLATES #if __BORLANDC__ >= 0x590 # define BOOST_HAS_TR1_HASH diff --git a/boost/boost/config/compiler/codegear.hpp b/boost/boost/config/compiler/codegear.hpp index f393282a77..39a6906436 100644 --- a/boost/boost/config/compiler/codegear.hpp +++ b/boost/boost/config/compiler/codegear.hpp @@ -73,18 +73,22 @@ // #define BOOST_HAS_STATIC_ASSERT #define BOOST_HAS_STD_TYPE_TRAITS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_SCOPED_ENUMS -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS +#define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_VARIADIC_TEMPLATES // // TR1 macros: diff --git a/boost/boost/config/compiler/common_edg.hpp b/boost/boost/config/compiler/common_edg.hpp index 3e62bb0f59..75c2f57f1e 100644 --- a/boost/boost/config/compiler/common_edg.hpp +++ b/boost/boost/config/compiler/common_edg.hpp @@ -43,11 +43,6 @@ # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #endif -#if (__EDG_VERSION__ <= 310) || !defined(BOOST_STRICT_CONFIG) -// No support for initializer lists -# define BOOST_NO_INITIALIZER_LISTS -#endif - // See also kai.hpp which checks a Kai-specific symbol for EH # if !defined(__KCC) && !defined(__EXCEPTIONS) # define BOOST_NO_EXCEPTIONS @@ -64,22 +59,32 @@ // // See above for BOOST_NO_LONG_LONG // +#if (__EDG_VERSION__ <= 310) || !defined(BOOST_STRICT_CONFIG) +// No support for initializer lists +# define BOOST_NO_INITIALIZER_LISTS +#endif + +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS + #ifdef c_plusplus // EDG has "long long" in non-strict mode // However, some libraries have insufficient "long long" support diff --git a/boost/boost/config/compiler/digitalmars.hpp b/boost/boost/config/compiler/digitalmars.hpp index f0c3c88c21..c0e770277a 100644 --- a/boost/boost/config/compiler/digitalmars.hpp +++ b/boost/boost/config/compiler/digitalmars.hpp @@ -26,7 +26,6 @@ #define BOOST_NO_SFINAE #define BOOST_NO_USING_TEMPLATE #define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL -#define BOOST_NO_INITIALIZER_LISTS #endif // @@ -59,22 +58,28 @@ // // C++0x features // +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS + #if __DMC__ < 0x800 #error "Compiler not supported or configured - please reconfigure" #endif diff --git a/boost/boost/config/compiler/gcc.hpp b/boost/boost/config/compiler/gcc.hpp index 62bf45e6c7..94653c8990 100644 --- a/boost/boost/config/compiler/gcc.hpp +++ b/boost/boost/config/compiler/gcc.hpp @@ -101,23 +101,21 @@ # endif #endif +// C++0x features not implemented in any GCC version // -// C++0x features -// - -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T #define BOOST_NO_CONSTEXPR -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS +// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_SCOPED_ENUMS until it +// gets fixed. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064 #define BOOST_NO_SCOPED_ENUMS -#define BOOST_NO_UNICODE_LITERALS -// See below for BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_TEMPLATE_ALIASES +// C++0x features in 4.3.n and later +// #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) && defined(__GXX_EXPERIMENTAL_CXX0X__) // C++0x features are only enabled when -std=c++0x or -std=gnu++0x are // passed on the command line, which in turn defines @@ -140,9 +138,18 @@ # endif #endif -#if !defined(__GXX_EXPERIMENTAL_CXX0X__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) -# define BOOST_NO_INITIALIZER_LISTS +// C++0x features in 4.4.n and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) # define BOOST_NO_AUTO_DECLARATIONS +# define BOOST_NO_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CHAR16_T +# define BOOST_NO_CHAR32_T +# define BOOST_NO_DEFAULTED_FUNCTIONS +# define BOOST_NO_DELETED_FUNCTIONS +# define BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_UNICODE_LITERALS #endif // ConceptGCC compiler: @@ -150,6 +157,8 @@ #ifdef __GXX_CONCEPTS__ # define BOOST_HAS_CONCEPTS # define BOOST_COMPILER "ConceptGCC version " __VERSION__ +#else +# define BOOST_NO_CONCEPTS #endif #ifndef BOOST_COMPILER diff --git a/boost/boost/config/compiler/hp_acc.hpp b/boost/boost/config/compiler/hp_acc.hpp index 0c3cc9af54..a24fc16bed 100644 --- a/boost/boost/config/compiler/hp_acc.hpp +++ b/boost/boost/config/compiler/hp_acc.hpp @@ -90,22 +90,30 @@ // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // +#if !defined(__EDG__) + +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS +#endif // // last known and checked version for HP-UX/ia64 is 61300 diff --git a/boost/boost/config/compiler/intel.hpp b/boost/boost/config/compiler/intel.hpp index e4d1b07dbb..1ab029ed46 100644 --- a/boost/boost/config/compiler/intel.hpp +++ b/boost/boost/config/compiler/intel.hpp @@ -157,28 +157,6 @@ template<> struct assert_intrinsic_wchar_t {}; # define BOOST_NO_TWO_PHASE_NAME_LOOKUP #endif -// -// C++0x features -// -// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG -// -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS - // // last known and checked version: #if (BOOST_INTEL_CXX_VERSION > 1100) diff --git a/boost/boost/config/compiler/kai.hpp b/boost/boost/config/compiler/kai.hpp index de16f1a675..ea06f9f4d0 100644 --- a/boost/boost/config/compiler/kai.hpp +++ b/boost/boost/config/compiler/kai.hpp @@ -21,8 +21,6 @@ # define BOOST_NO_EXCEPTIONS # endif -#define BOOST_COMPILER "Kai C++ version " BOOST_STRINGIZE(__KCC_VERSION) - // // last known and checked version is 4001: #if (__KCC_VERSION > 4001) diff --git a/boost/boost/config/compiler/metrowerks.hpp b/boost/boost/config/compiler/metrowerks.hpp index 5f6e0fe593..e1e9329c46 100644 --- a/boost/boost/config/compiler/metrowerks.hpp +++ b/boost/boost/config/compiler/metrowerks.hpp @@ -39,10 +39,9 @@ // the "|| !defined(BOOST_STRICT_CONFIG)" part should apply to the last // tested version *only*: -# if(__MWERKS__ <= 0x3206) || !defined(BOOST_STRICT_CONFIG) // 9.5 +# if(__MWERKS__ <= 0x3207) || !defined(BOOST_STRICT_CONFIG) // 9.6 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_IS_ABSTRACT -# define BOOST_NO_INITIALIZER_LISTS # endif #if !__option(wchar_type) @@ -74,6 +73,8 @@ # define BOOST_COMPILER_VERSION 9.4 # elif __MWERKS__ == 0x3206 # define BOOST_COMPILER_VERSION 9.5 +# elif __MWERKS__ == 0x3207 +# define BOOST_COMPILER_VERSION 9.6 # else # define BOOST_COMPILER_VERSION __MWERKS__ # endif @@ -91,21 +92,26 @@ #else # define BOOST_NO_RVALUE_REFERENCES #endif +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) diff --git a/boost/boost/config/compiler/mpw.hpp b/boost/boost/config/compiler/mpw.hpp index 1d72406566..ac536c0001 100644 --- a/boost/boost/config/compiler/mpw.hpp +++ b/boost/boost/config/compiler/mpw.hpp @@ -33,7 +33,6 @@ # define BOOST_NO_STD_ALLOCATOR /* actually a bug with const reference overloading */ -# define BOOST_NO_INITIALIZER_LISTS #endif // @@ -41,22 +40,27 @@ // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS // // versions check: diff --git a/boost/boost/config/compiler/pgi.hpp b/boost/boost/config/compiler/pgi.hpp index fe5f3d840f..bbb7cf97f6 100644 --- a/boost/boost/config/compiler/pgi.hpp +++ b/boost/boost/config/compiler/pgi.hpp @@ -21,7 +21,6 @@ #define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #define BOOST_NO_SWPRINTF -#define BOOST_NO_INITIALIZER_LISTS #else @@ -33,22 +32,27 @@ // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS // // version check: diff --git a/boost/boost/config/compiler/sgi_mipspro.hpp b/boost/boost/config/compiler/sgi_mipspro.hpp index f6a86ad50f..90688314ad 100644 --- a/boost/boost/config/compiler/sgi_mipspro.hpp +++ b/boost/boost/config/compiler/sgi_mipspro.hpp @@ -22,29 +22,6 @@ #undef BOOST_NO_SWPRINTF #undef BOOST_DEDUCED_TYPENAME -#define BOOST_NO_INITIALIZER_LISTS -// -// C++0x features -// -// See boost\config\suffix.hpp for BOOST_NO_LONG_LONG -// -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS - // // version check: // probably nothing to do here? diff --git a/boost/boost/config/compiler/sunpro_cc.hpp b/boost/boost/config/compiler/sunpro_cc.hpp index 6553a46502..c4407232d0 100644 --- a/boost/boost/config/compiler/sunpro_cc.hpp +++ b/boost/boost/config/compiler/sunpro_cc.hpp @@ -74,7 +74,6 @@ // #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #define BOOST_NO_ADL_BARRIER -#define BOOST_NO_INITIALIZER_LISTS // // C++0x features @@ -86,22 +85,27 @@ # define BOOST_NO_LONG_LONG #endif +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS // // Version diff --git a/boost/boost/config/compiler/vacpp.hpp b/boost/boost/config/compiler/vacpp.hpp index eb75cdbf86..b526a6b0fe 100644 --- a/boost/boost/config/compiler/vacpp.hpp +++ b/boost/boost/config/compiler/vacpp.hpp @@ -47,7 +47,7 @@ #endif // // last known and checked version is 600: -#if (__IBMCPP__ > 600) +#if (__IBMCPP__ > 1010) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # endif @@ -61,22 +61,26 @@ // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR #define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_LAMBDAS +#define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_RVALUE_REFERENCES #define BOOST_NO_SCOPED_ENUMS #define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS diff --git a/boost/boost/config/compiler/visualc.hpp b/boost/boost/config/compiler/visualc.hpp index 552e5bb160..2c3a2adf00 100644 --- a/boost/boost/config/compiler/visualc.hpp +++ b/boost/boost/config/compiler/visualc.hpp @@ -131,10 +131,10 @@ // disable Win32 API's if compiler extentions are // turned off: // -#ifndef _MSC_EXTENSIONS +#if !defined(_MSC_EXTENSIONS) && !defined(BOOST_DISABLE_WIN32) # define BOOST_DISABLE_WIN32 #endif -#ifndef _CPPRTTI +#if !defined(_CPPRTTI) && !defined(BOOST_NO_RTTI) # define BOOST_NO_RTTI #endif @@ -142,31 +142,40 @@ // all versions support __declspec: // #define BOOST_HAS_DECLSPEC + // // C++0x features // // See above for BOOST_NO_LONG_LONG + +// C++ features supported by VC++ 10 (aka 2010) +// +#if _MSC_VER < 1600 +#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_AUTO_MULTIDECLARATIONS +#define BOOST_NO_DECLTYPE +#define BOOST_NO_LAMBDAS +#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_STATIC_ASSERT +#endif // _MSC_VER < 1600 + +// C++0x features not supported by any versions #define BOOST_NO_CHAR16_T #define BOOST_NO_CHAR32_T +#define BOOST_NO_CONCEPTS #define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE #define BOOST_NO_DEFAULTED_FUNCTIONS #define BOOST_NO_DELETED_FUNCTIONS #define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_EXTERN_TEMPLATE +#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_NULLPTR #define BOOST_NO_RAW_LITERALS #define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_TEMPLATE_ALIASES #define BOOST_NO_UNICODE_LITERALS #define BOOST_NO_VARIADIC_TEMPLATES -// MSVC 2010 CTP has some support for C++0x, but we still disable it until the compiler release -// #if _MSC_VER < 1600 -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -// #endif // _MSC_VER < 1600 - // // prefix and suffix headers: // @@ -231,7 +240,7 @@ #error "Compiler not supported or configured - please reconfigure" #endif // -// last known and checked version is 1500 (VC9): +// last known and checked version is 1600 (VC10, aka 2010): #if (_MSC_VER > 1600) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" diff --git a/boost/boost/config/platform/vxworks.hpp b/boost/boost/config/platform/vxworks.hpp new file mode 100755 index 0000000000..75b14ca02a --- /dev/null +++ b/boost/boost/config/platform/vxworks.hpp @@ -0,0 +1,31 @@ +// (C) Copyright Dustin Spicuzza 2009. +// 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. + +// vxWorks specific config options: + +#define BOOST_PLATFORM "vxWorks" + +#define BOOST_NO_CWCHAR +#define BOOST_NO_INTRINSIC_WCHAR_T + +#if defined(__GNUC__) && defined(__STRICT_ANSI__) +#define BOOST_NO_INT64_T +#endif + +#define BOOST_HAS_UNISTD_H + +// these allow posix_features to work, since vxWorks doesn't +// define them itself +#define _POSIX_TIMERS 1 +#define _POSIX_THREADS 1 + +// vxworks doesn't work with asio serial ports +#define BOOST_ASIO_DISABLE_SERIAL_PORT + +// boilerplate code: +#include + diff --git a/boost/boost/config/select_platform_config.hpp b/boost/boost/config/select_platform_config.hpp index 4ce2c01546..615bb064ff 100644 --- a/boost/boost/config/select_platform_config.hpp +++ b/boost/boost/config/select_platform_config.hpp @@ -61,6 +61,10 @@ // QNX: # define BOOST_PLATFORM_CONFIG "boost/config/platform/qnxnto.hpp" +#elif defined(__VXWORKS__) +// vxWorks: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/vxworks.hpp" + #else # if defined(unix) \ diff --git a/boost/boost/config/select_stdlib_config.hpp b/boost/boost/config/select_stdlib_config.hpp index 13e5e4cef0..2a1430aef4 100644 --- a/boost/boost/config/select_stdlib_config.hpp +++ b/boost/boost/config/select_stdlib_config.hpp @@ -11,13 +11,10 @@ // locate which std lib we are using and define BOOST_STDLIB_CONFIG as needed: -// we need to include a std lib header here in order to detect which -// library is in use, use as it's about the smallest -// of the std lib headers - do not rely on this header being included - -// users can short-circuit this header if they know whose std lib -// they are using. - -#include +// First include to determine if some version of STLport is in use as the std lib +// (do not rely on this header being included since users can short-circuit this header +// if they know whose std lib they are using.) +#include #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) // STLPort library; this _must_ come first, otherwise since @@ -25,7 +22,17 @@ // can end up detecting that first rather than STLport: # define BOOST_STDLIB_CONFIG "boost/config/stdlib/stlport.hpp" -#elif defined(__LIBCOMO__) +#else + +// If our std lib was not some version of STLport, then include as it is about +// the smallest of the std lib headers that includes real C++ stuff. (Some std libs do not +// include their C++-related macros in so this additional include makes sure +// we get those definitions) +// (again do not rely on this header being included since users can short-circuit this +// header if they know whose std lib they are using.) +#include + +#if defined(__LIBCOMO__) // Comeau STL: #define BOOST_STDLIB_CONFIG "boost/config/stdlib/libcomo.hpp" @@ -64,5 +71,7 @@ #endif +#endif + diff --git a/boost/boost/config/stdlib/dinkumware.hpp b/boost/boost/config/stdlib/dinkumware.hpp index ff1aed9438..addf3357c8 100644 --- a/boost/boost/config/stdlib/dinkumware.hpp +++ b/boost/boost/config/stdlib/dinkumware.hpp @@ -78,17 +78,42 @@ # define BOOST_NO_STD_ITERATOR_TRAITS #endif -// -// No std::unordered_* containers yet: -// -#define BOOST_NO_STD_UNORDERED - #if defined(__ICL) && (__ICL < 800) && defined(_CPPLIB_VER) && (_CPPLIB_VER <= 310) // Intel C++ chokes over any non-trivial use of // this may be an overly restrictive define, but regex fails without it: # define BOOST_NO_STD_LOCALE #endif +// C++0x headers implemented in 520 (as shipped by Microsoft) +// +#if !defined(_CPPLIB_VER) || _CPPLIB_VER < 520 +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET +#endif + +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE + #ifdef _CPPLIB_VER # define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER #else diff --git a/boost/boost/config/stdlib/libcomo.hpp b/boost/boost/config/stdlib/libcomo.hpp index 3114094ecc..06731e32e7 100644 --- a/boost/boost/config/stdlib/libcomo.hpp +++ b/boost/boost/config/stdlib/libcomo.hpp @@ -32,10 +32,31 @@ # define BOOST_HAS_HASH # define BOOST_HAS_SLIST #endif + +// C++0x headers not yet implemented // -// We never have the new C++0x unordered containers: -// -#define BOOST_NO_STD_UNORDERED +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET // // Intrinsic type_traits support. diff --git a/boost/boost/config/stdlib/libstdcpp3.hpp b/boost/boost/config/stdlib/libstdcpp3.hpp index 8e1c811b1a..6a57319ffd 100644 --- a/boost/boost/config/stdlib/libstdcpp3.hpp +++ b/boost/boost/config/stdlib/libstdcpp3.hpp @@ -77,7 +77,51 @@ # endif #endif -#ifndef __GXX_EXPERIMENTAL_CXX0X__ -# define BOOST_NO_STD_UNORDERED +// stdlibc++ C++0x support is detected via __GNUC__, __GNUC_MINOR__, and possibly +// __GNUC_PATCHLEVEL__ at the suggestion of Jonathan Wakely, one of the stdlibc++ +// developers. He also commented: +// +// "I'm not sure how useful __GLIBCXX__ is for your purposes, for instance in +// GCC 4.2.4 it is set to 20080519 but in GCC 4.3.0 it is set to 20080305. +// Although 4.3.0 was released earlier than 4.2.4, it has better C++0x support +// than any release in the 4.2 series." +// +// Another resource for understanding stdlibc++ features is: +// http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#manual.intro.status.standard.200x + +// C++0x headers in GCC 4.3.0 and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET #endif +// C++0x headers in GCC 4.4.0 and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +#endif + +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS + +// --- end --- diff --git a/boost/boost/config/stdlib/modena.hpp b/boost/boost/config/stdlib/modena.hpp index e488d13aab..7bd50cecb7 100644 --- a/boost/boost/config/stdlib/modena.hpp +++ b/boost/boost/config/stdlib/modena.hpp @@ -21,10 +21,31 @@ #ifndef MSIPL_WCHART #define BOOST_NO_STD_WSTRING #endif + +// C++0x headers not yet implemented // -// We never have the new C++0x unordered containers: -// -#define BOOST_NO_STD_UNORDERED +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET #define BOOST_STDLIB "Modena C++ standard library" diff --git a/boost/boost/config/stdlib/msl.hpp b/boost/boost/config/stdlib/msl.hpp index 746878debe..6bcd232a57 100644 --- a/boost/boost/config/stdlib/msl.hpp +++ b/boost/boost/config/stdlib/msl.hpp @@ -45,11 +45,31 @@ # define BOOST_NO_STD_USE_FACET # define BOOST_HAS_TWO_ARG_USE_FACET #endif -// -// We never have the new C++0x unordered containers: -// -#define BOOST_NO_STD_UNORDERED +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET #define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__) diff --git a/boost/boost/config/stdlib/roguewave.hpp b/boost/boost/config/stdlib/roguewave.hpp index 3e5888245a..cba2f54a1a 100644 --- a/boost/boost/config/stdlib/roguewave.hpp +++ b/boost/boost/config/stdlib/roguewave.hpp @@ -152,8 +152,28 @@ # endif #endif +// C++0x headers not yet implemented // -// We never have the new C++0x unordered containers: -// -#define BOOST_NO_STD_UNORDERED +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET diff --git a/boost/boost/config/stdlib/sgi.hpp b/boost/boost/config/stdlib/sgi.hpp index b493d49cbd..c505008b7d 100644 --- a/boost/boost/config/stdlib/sgi.hpp +++ b/boost/boost/config/stdlib/sgi.hpp @@ -76,7 +76,6 @@ // #define BOOST_HAS_HASH #define BOOST_HAS_SLIST -#define BOOST_NO_STD_UNORDERED // // If this is GNU libstdc++2, then no and no std::wstring: @@ -106,6 +105,31 @@ // #define BOOST_HAS_SGI_TYPE_TRAITS +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET + #define BOOST_STDLIB "SGI standard library" diff --git a/boost/boost/config/stdlib/stlport.hpp b/boost/boost/config/stdlib/stlport.hpp index 82e4cff5d2..3dfd529eff 100644 --- a/boost/boost/config/stdlib/stlport.hpp +++ b/boost/boost/config/stdlib/stlport.hpp @@ -61,9 +61,14 @@ # endif #endif -#if defined(_STLPORT_VERSION) && (_STLPORT_VERSION < 0x500) +#if defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x500) || (_STLPORT_VERSION >= 0x520)) # define BOOST_NO_STD_UNORDERED #endif + +#if defined(_STLPORT_VERSION) && (_STLPORT_VERSION >= 0x520) +# define BOOST_HAS_TR1_UNORDERED_SET +# define BOOST_HAS_TR1_UNORDERED_MAP +#endif // // Without member template support enabled, their are no template // iterate constructors, and no std::allocator: @@ -195,6 +200,31 @@ namespace std{ using _STLP_VENDOR_CSTD::strcmp; using _STLP_VENDOR_CSTD::strcpy; namespace boost { using std::min; using std::max; } #endif +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET + #define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT) diff --git a/boost/boost/config/stdlib/vacpp.hpp b/boost/boost/config/stdlib/vacpp.hpp index c6c45660fc..c8d6d5ad69 100644 --- a/boost/boost/config/stdlib/vacpp.hpp +++ b/boost/boost/config/stdlib/vacpp.hpp @@ -11,7 +11,31 @@ #define BOOST_HAS_MACRO_USE_FACET #define BOOST_NO_STD_MESSAGES -#define BOOST_NO_STD_UNORDERED + +// C++0x headers not yet implemented +// +# define BOOST_NO_0X_HDR_ARRAY +# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_0X_HDR_CODECVT +# define BOOST_NO_0X_HDR_CONCEPTS +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS +# define BOOST_NO_0X_HDR_FORWARD_LIST +# define BOOST_NO_0X_HDR_FUTURE +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS +# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS +# define BOOST_NO_0X_HDR_MUTEX +# define BOOST_NO_0X_HDR_RANDOM +# define BOOST_NO_0X_HDR_RATIO +# define BOOST_NO_0X_HDR_REGEX +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_0X_HDR_TYPE_TRAITS +# define BOOST_NO_STD_UNORDERED // deprecated; see following +# define BOOST_NO_0X_HDR_UNORDERED_MAP +# define BOOST_NO_0X_HDR_UNORDERED_SET #define BOOST_STDLIB "Visual Age default standard library" diff --git a/boost/boost/config/suffix.hpp b/boost/boost/config/suffix.hpp index ca80330672..fa44986946 100644 --- a/boost/boost/config/suffix.hpp +++ b/boost/boost/config/suffix.hpp @@ -306,6 +306,14 @@ # define BOOST_HASH_MAP_HEADER #endif +// +// Set BOOST_NO_INITIALIZER_LISTS if there is no library support. +// + +#if defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS) +# define BOOST_NO_INITIALIZER_LISTS +#endif + // BOOST_HAS_ABI_HEADERS // This macro gets set if we have headers that fix the ABI, // and prevent ODR violations when linking to external libraries: diff --git a/boost/boost/crc.hpp b/boost/boost/crc.hpp index e70c834033..6be5aa1d8b 100644 --- a/boost/boost/crc.hpp +++ b/boost/boost/crc.hpp @@ -464,6 +464,10 @@ namespace detail // for some reason Borland's command line compiler (version 0x560) // chokes over this unless we do the calculation for it: typedef value_type table_type[ 0x100 ]; +#elif defined(__GNUC__) + // old versions of GCC (before 4.0.2) choke on using byte_combos + // as a constant expression when compiling with -pedantic. + typedef value_type table_type[1ul << CHAR_BIT]; #else typedef value_type table_type[ byte_combos ]; #endif diff --git a/boost/boost/detail/allocator_utilities.hpp b/boost/boost/detail/allocator_utilities.hpp index 91b0fa7b39..5d6ef48b05 100755 --- a/boost/boost/detail/allocator_utilities.hpp +++ b/boost/boost/detail/allocator_utilities.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2008 Joaquin M Lopez Munoz. +/* Copyright 2003-2009 Joaquin M Lopez Munoz. * 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) @@ -178,12 +178,31 @@ void construct(void* p,const Type& t) new (p) Type(t); } +#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) +/* MSVC++ issues spurious warnings about unreferencend formal parameters + * in destroy when Type is a class with trivial dtor. + */ + +#pragma warning(push) +#pragma warning(disable:4100) +#endif + template void destroy(const Type* p) { + +#if BOOST_WORKAROUND(__SUNPRO_CC,BOOST_TESTED_AT(0x590)) + const_cast(p)->~Type(); +#else p->~Type(); +#endif + } +#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) +#pragma warning(pop) +#endif + } /* namespace boost::detail::allocator */ } /* namespace boost::detail */ diff --git a/boost/boost/detail/container_fwd.hpp b/boost/boost/detail/container_fwd.hpp index 67031b9a63..04f2ac5135 100644 --- a/boost/boost/detail/container_fwd.hpp +++ b/boost/boost/detail/container_fwd.hpp @@ -13,12 +13,6 @@ #include #include -#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) -#define BOOST_HASH_CHAR_TRAITS string_char_traits -#else -#define BOOST_HASH_CHAR_TRAITS char_traits -#endif - #if ((defined(__GLIBCPP__) || defined(__GLIBCXX__)) && defined(_GLIBCXX_DEBUG)) \ || BOOST_WORKAROUND(__BORLANDC__, > 0x551) \ || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \ @@ -65,7 +59,13 @@ namespace std { template class allocator; template class basic_string; - template struct BOOST_HASH_CHAR_TRAITS; + +#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) + template struct string_char_traits; +#else + template struct char_traits; +#endif + template class complex; } diff --git a/boost/boost/detail/is_incrementable.hpp b/boost/boost/detail/is_incrementable.hpp index cb7d7a7b59..1c8fd5785b 100644 --- a/boost/boost/detail/is_incrementable.hpp +++ b/boost/boost/detail/is_incrementable.hpp @@ -63,7 +63,12 @@ namespace is_incrementable_ tag operator,(tag,int); # define BOOST_comma(a,b) (a,b) # endif - + +# if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable:4913) // Warning about operator, +# endif + // two check overloads help us identify which operator++ was picked char (& check(tag) )[2]; @@ -92,6 +97,11 @@ namespace is_incrementable_ , value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1 ); }; + +# if defined(BOOST_MSVC) +# pragma warning(pop) +# endif + } # undef BOOST_comma diff --git a/boost/boost/detail/scoped_enum_emulation.hpp b/boost/boost/detail/scoped_enum_emulation.hpp new file mode 100755 index 0000000000..e5fe984111 --- /dev/null +++ b/boost/boost/detail/scoped_enum_emulation.hpp @@ -0,0 +1,56 @@ +// scoped_enum_emulation.hpp ---------------------------------------------------------// + +// Copyright Beman Dawes, 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x +// scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS +// macro is used to detect feature support. +// +// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a +// description of the scoped enum feature. Note that the committee changed the name +// from strongly typed enum to scoped enum. +// +// Caution: only the syntax is emulated; the semantics are not emulated and +// the syntax emulation doesn't include being able to specify the underlying +// representation type. +// +// The emulation is via struct rather than namespace to allow use within classes. +// Thanks to Andrey Semashev for pointing that out. +// +// Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott, +// Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vincente +// Botet, and Daniel James. +// +// Sample usage: +// +// BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END +// ... +// BOOST_SCOPED_ENUM(algae) sample( algae::red ); +// void foo( BOOST_SCOPED_ENUM(algae) color ); +// ... +// sample = algae::green; +// foo( algae::cyan ); + +#ifndef BOOST_SCOPED_ENUM_EMULATION_HPP +#define BOOST_SCOPED_ENUM_EMULATION_HPP + +#include + +#ifdef BOOST_NO_SCOPED_ENUMS + +# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_t +# define BOOST_SCOPED_ENUM_END }; +# define BOOST_SCOPED_ENUM(name) name::enum_t + +#else + +# define BOOST_SCOPED_ENUM_START(name) enum class name +# define BOOST_SCOPED_ENUM_END +# define BOOST_SCOPED_ENUM(name) name + +#endif + +#endif // BOOST_SCOPED_ENUM_EMULATION_HPP diff --git a/boost/boost/detail/utf8_codecvt_facet.hpp b/boost/boost/detail/utf8_codecvt_facet.hpp index ac7e7bfded..b777ff934e 100755 --- a/boost/boost/detail/utf8_codecvt_facet.hpp +++ b/boost/boost/detail/utf8_codecvt_facet.hpp @@ -79,25 +79,18 @@ // specialized on those types for this to work. #include -// for mbstate_t -#include -// for std::size_t -#include +#include // for mbstate_t +#include // for std::size_t #include #include +#if defined(BOOST_NO_STDC_NAMESPACE) namespace std { - #if defined(__LIBCOMO__) - using ::mbstate_t; - #elif defined(BOOST_DINKUMWARE_STDLIB) && !defined(__BORLANDC__) - using ::mbstate_t; - #elif defined(__SGI_STL_PORT) - #elif defined(BOOST_NO_STDC_NAMESPACE) - using ::mbstate_t; - using ::codecvt; - #endif -} // namespace std + using ::mbstate_t; + using ::size_t; +} +#endif #if !defined(__MSL_CPP__) && !defined(__LIBCOMO__) #define BOOST_CODECVT_DO_LENGTH_CONST const diff --git a/boost/boost/exception/all.hpp b/boost/boost/exception/all.hpp new file mode 100644 index 0000000000..13ab3a7a7d --- /dev/null +++ b/boost/boost/exception/all.hpp @@ -0,0 +1,26 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_316FDA946C0D11DEA9CBAE5255D89593 +#define UUID_316FDA946C0D11DEA9CBAE5255D89593 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef BOOST_NO_EXCEPTIONS +#include +#endif + +#endif diff --git a/boost/boost/exception/detail/attribute_noreturn.hpp b/boost/boost/exception/detail/attribute_noreturn.hpp new file mode 100644 index 0000000000..9d2102c3d3 --- /dev/null +++ b/boost/boost/exception/detail/attribute_noreturn.hpp @@ -0,0 +1,19 @@ +//Copyright (c) 2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_61531AB0680611DEADD5846855D89593 +#define UUID_61531AB0680611DEADD5846855D89593 + +#include + +#if defined(BOOST_MSVC) +#define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn) +#elif defined(__GNUC__) +#define BOOST_ATTRIBUTE_NORETURN __attribute__((noreturn)) +#else +#define BOOST_ATTRIBUTE_NORETURN +#endif + +#endif diff --git a/boost/boost/exception/detail/exception_ptr_base.hpp b/boost/boost/exception/detail/exception_ptr_base.hpp new file mode 100644 index 0000000000..a5bcbebe69 --- /dev/null +++ b/boost/boost/exception/detail/exception_ptr_base.hpp @@ -0,0 +1,26 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_DC4208C6417811DEBF11E1EC55D89593 +#define UUID_DC4208C6417811DEBF11E1EC55D89593 + +namespace +boost + { + namespace + exception_detail + { + class + exception_ptr_base + { + public: + + virtual void _rethrow() const=0; + virtual bool _empty() const=0; + }; + } + } + +#endif diff --git a/boost/boost/exception/diagnostic_information.hpp b/boost/boost/exception/diagnostic_information.hpp index 2c66220198..01f7b35823 100755 --- a/boost/boost/exception/diagnostic_information.hpp +++ b/boost/boost/exception/diagnostic_information.hpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -41,16 +42,6 @@ boost enum e { value = !enable_boost_exception_overload::value && sizeof(check((T*)0))==sizeof(yes) }; }; -#ifndef BOOST_NO_RTTI - template - inline - std::string - dynamic_exception_type( T const & x ) - { - return std::string("Dynamic exception type: ") + BOOST_EXCEPTION_DYNAMIC_TYPEID(x).name(); - } -#endif - inline char const * get_diagnostic_information( exception const & x ) @@ -72,43 +63,41 @@ boost inline std::string - boost_diagnostic_information( exception const & x ) + diagnostic_information_impl( boost::exception const * be, std::exception const * se ) { + BOOST_ASSERT(be||se); +#ifndef BOOST_NO_RTTI + if( !se ) + se = dynamic_cast(be); + if( !be ) + be = dynamic_cast(se); +#endif std::ostringstream tmp; - if( char const * const * f=get_error_info(x) ) + if( be ) { - tmp << *f; - if( int const * l=get_error_info(x) ) - tmp << '(' << *l << "): "; + if( char const * const * f=get_error_info(*be) ) + { + tmp << *f; + if( int const * l=get_error_info(*be) ) + tmp << '(' << *l << "): "; + } + tmp << "Throw in function "; + if( char const * const * fn=get_error_info(*be) ) + tmp << *fn; + else + tmp << "(unknown)"; + tmp << '\n'; } - tmp << "Throw in function "; - if( char const * const * fn=get_error_info(x) ) - tmp << *fn; - else - tmp << "(unknown)"; - tmp << std::endl; #ifndef BOOST_NO_RTTI - tmp << dynamic_exception_type(x) << std::endl; - if( std::exception const * e=dynamic_cast(&x) ) - tmp << "std::exception::what: " << e->what() << std::endl; + tmp << std::string("Dynamic exception type: ") << + (be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).name() << '\n'; #endif - if( char const * s=exception_detail::get_diagnostic_information(x) ) - if( *s ) - tmp << s; - return tmp.str(); - } - - inline - std::string - std_diagnostic_information( std::exception const & x ) - { - std::ostringstream tmp; -#ifndef BOOST_NO_RTTI - if( exception const * e=dynamic_cast(&x) ) - return boost_diagnostic_information(*e); - tmp << dynamic_exception_type(x) << std::endl; -#endif - tmp << "std::exception::what: " << x.what() << std::endl; + if( se ) + tmp << "std::exception::what: " << se->what() << '\n'; + if( be ) + if( char const * s=exception_detail::get_diagnostic_information(*be) ) + if( *s ) + tmp << s; return tmp.str(); } } @@ -118,7 +107,7 @@ boost typename enable_if,std::string>::type diagnostic_information( T const & e ) { - return exception_detail::boost_diagnostic_information(e); + return exception_detail::diagnostic_information_impl(&e,0); } template @@ -126,7 +115,7 @@ boost typename enable_if,std::string>::type diagnostic_information( T const & e ) { - return exception_detail::std_diagnostic_information(e); + return exception_detail::diagnostic_information_impl(0,&e); } } @@ -139,14 +128,31 @@ boost std::string current_exception_diagnostic_information() { - if( boost::exception const * e=current_exception_cast() ) - return diagnostic_information(*e); - else if( std::exception const * e=current_exception_cast() ) - return diagnostic_information(*e); + boost::exception const * be=current_exception_cast(); + std::exception const * se=current_exception_cast(); + if( be || se ) + return exception_detail::diagnostic_information_impl(be,se); else return "No diagnostic information available."; } - } + + inline + std::string + diagnostic_information( exception_detail::exception_ptr_base const & p ) + { + if( !p._empty() ) + try + { + p._rethrow(); + } + catch( + ... ) + { + return current_exception_diagnostic_information(); + } + return ""; + } + } #endif #endif diff --git a/boost/boost/exception/errinfo_api_function.hpp b/boost/boost/exception/errinfo_api_function.hpp new file mode 100644 index 0000000000..7b6a9fee76 --- /dev/null +++ b/boost/boost/exception/errinfo_api_function.hpp @@ -0,0 +1,22 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_DDFBB4546C1211DEA4659E9055D89593 +#define UUID_DDFBB4546C1211DEA4659E9055D89593 + +#include "boost/exception/error_info.hpp" + +namespace +boost + { + //Usage hint: + //if( api_function(....)!=0 ) + // BOOST_THROW_EXCEPTION( + // failure() << + // errinfo_api_function("api_function") ); + typedef error_info errinfo_api_function; + } + +#endif diff --git a/boost/boost/exception/errinfo_at_line.hpp b/boost/boost/exception/errinfo_at_line.hpp new file mode 100644 index 0000000000..cc422ce53b --- /dev/null +++ b/boost/boost/exception/errinfo_at_line.hpp @@ -0,0 +1,18 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_E7255CE26C1211DE85800C9155D89593 +#define UUID_E7255CE26C1211DE85800C9155D89593 + +namespace +boost + { + template class error_info; + + //Use with parsing errors exceptions, for example in a XML file parser. + typedef error_info errinfo_at_line; + } + +#endif diff --git a/boost/boost/exception/errinfo_errno.hpp b/boost/boost/exception/errinfo_errno.hpp new file mode 100644 index 0000000000..2e781f469e --- /dev/null +++ b/boost/boost/exception/errinfo_errno.hpp @@ -0,0 +1,35 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_F0EE17BE6C1211DE87FF459155D89593 +#define UUID_F0EE17BE6C1211DE87FF459155D89593 + +#include "boost/exception/info.hpp" +#include +#include + +namespace +boost + { + typedef error_info errinfo_errno; + + //Usage hint: + //if( c_function(....)!=0 ) + // BOOST_THROW_EXCEPTION( + // failure() << + // errinfo_errno(errno) << + // errinfo_api_function("c_function") ); + inline + std::string + to_string( errinfo_errno const & e ) + { + std::ostringstream tmp; + int v=e.value(); + tmp << v << ", \"" << strerror(v) << "\""; + return tmp.str(); + } + } + +#endif diff --git a/boost/boost/exception/errinfo_file_handle.hpp b/boost/boost/exception/errinfo_file_handle.hpp new file mode 100644 index 0000000000..5b9673d70e --- /dev/null +++ b/boost/boost/exception/errinfo_file_handle.hpp @@ -0,0 +1,20 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_F79E6EE26C1211DEB26E929155D89593 +#define UUID_F79E6EE26C1211DEB26E929155D89593 + +#include + +namespace +boost + { + template class weak_ptr; + template class error_info; + + typedef error_info > errinfo_file_handle; + } + +#endif diff --git a/boost/boost/exception/errinfo_file_name.hpp b/boost/boost/exception/errinfo_file_name.hpp new file mode 100644 index 0000000000..c6f1c9e104 --- /dev/null +++ b/boost/boost/exception/errinfo_file_name.hpp @@ -0,0 +1,26 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_FEE5120A6C1211DE94E8BC9155D89593 +#define UUID_FEE5120A6C1211DE94E8BC9155D89593 + +#include + +namespace +boost + { + template class error_info; + + //Usage hint: + //FILE * f=fopen(name,mode); + //if( !f ) + // BOOST_THROW_EXCEPTION( + // file_open_error() << + // errinfo_file_name(name) << + // errinfo_file_open_mode(mode) ); + typedef error_info errinfo_file_name; + } + +#endif diff --git a/boost/boost/exception/errinfo_file_open_mode.hpp b/boost/boost/exception/errinfo_file_open_mode.hpp new file mode 100644 index 0000000000..c1bbaa1593 --- /dev/null +++ b/boost/boost/exception/errinfo_file_open_mode.hpp @@ -0,0 +1,26 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_056F1F266C1311DE8E74299255D89593 +#define UUID_056F1F266C1311DE8E74299255D89593 + +#include + +namespace +boost + { + template class error_info; + + //Usage hint: + //FILE * f=fopen(name,mode); + //if( !f ) + // BOOST_THROW_EXCEPTION( + // file_open_error() << + // errinfo_file_name(name) << + // errinfo_file_open_mode(mode) ); + typedef error_info errinfo_file_open_mode; + } + +#endif diff --git a/boost/boost/exception/errinfo_type_info_name.hpp b/boost/boost/exception/errinfo_type_info_name.hpp new file mode 100644 index 0000000000..dbd9abff09 --- /dev/null +++ b/boost/boost/exception/errinfo_type_info_name.hpp @@ -0,0 +1,23 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_0E11109E6C1311DEB7EA649255D89593 +#define UUID_0E11109E6C1311DEB7EA649255D89593 + +#include + +namespace +boost + { + template class error_info; + + //Usage hint: + //BOOST_THROW_EXCEPTION( + // bad_type() << + // errinfo_type_info_name(typeid(x).name()) ); + typedef error_info errinfo_type_info_name; + } + +#endif diff --git a/boost/boost/exception/exception.hpp b/boost/boost/exception/exception.hpp index 6df93aca8b..6233f19b3a 100755 --- a/boost/boost/exception/exception.hpp +++ b/boost/boost/exception/exception.hpp @@ -80,13 +80,13 @@ boost template class error_info; - typedef error_info throw_function; - typedef error_info throw_file; - typedef error_info throw_line; + typedef error_info throw_function; + typedef error_info throw_file; + typedef error_info throw_line; template <> class - error_info + error_info { public: typedef char const * value_type; @@ -100,7 +100,7 @@ boost template <> class - error_info + error_info { public: typedef char const * value_type; @@ -114,7 +114,7 @@ boost template <> class - error_info + error_info { public: typedef int value_type; diff --git a/boost/boost/exception/info.hpp b/boost/boost/exception/info.hpp index 92a347eb5f..328563865d 100755 --- a/boost/boost/exception/info.hpp +++ b/boost/boost/exception/info.hpp @@ -106,7 +106,7 @@ boost for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i ) { shared_ptr const & x = i->second; - tmp << '[' << x->tag_typeid_name() << "] = " << x->value_as_string() << std::endl; + tmp << '[' << x->tag_typeid_name() << "] = " << x->value_as_string() << '\n'; } tmp.str().swap(diagnostic_info_str_); } diff --git a/boost/boost/format/format_implementation.hpp b/boost/boost/format/format_implementation.hpp index 28300e579f..9dd93a5acf 100644 --- a/boost/boost/format/format_implementation.hpp +++ b/boost/boost/format/format_implementation.hpp @@ -37,7 +37,7 @@ namespace boost { template< class Ch, class Tr, class Alloc> basic_format:: basic_format(const Ch* s, const std::locale & loc) : style_(0), cur_arg_(0), num_args_(0), dumped_(false), - loc_(loc), exceptions_(io::all_error_bits) + exceptions_(io::all_error_bits), loc_(loc) { if(s) parse( s ); } @@ -45,7 +45,7 @@ namespace boost { template< class Ch, class Tr, class Alloc> basic_format:: basic_format(const string_type& s, const std::locale & loc) : style_(0), cur_arg_(0), num_args_(0), dumped_(false), - loc_(loc), exceptions_(io::all_error_bits) + exceptions_(io::all_error_bits), loc_(loc) { parse(s); } diff --git a/boost/boost/format/parsing.hpp b/boost/boost/format/parsing.hpp index c4621ac372..b14ca82c98 100644 --- a/boost/boost/format/parsing.hpp +++ b/boost/boost/format/parsing.hpp @@ -48,7 +48,7 @@ namespace detail { #if ! defined( BOOST_NO_LOCALE_ISDIGIT ) return fac.is(std::ctype::digit, c); # else - (void) fac; // remove "unused parameter" warning + (void) fac; // remove "unused parameter" warning using namespace std; return isdigit(c); #endif diff --git a/boost/boost/function/function_base.hpp b/boost/boost/function/function_base.hpp index 6612fb8415..c4663c35a8 100644 --- a/boost/boost/function/function_base.hpp +++ b/boost/boost/function/function_base.hpp @@ -18,6 +18,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -42,7 +45,7 @@ #endif // Define BOOST_FUNCTION_STD_NS to the namespace that contains type_info. -#ifdef BOOST_NO_EXCEPTION_STD_NAMESPACE +#ifdef BOOST_NO_STD_TYPEINFO // Embedded VC++ does not have type_info in namespace std # define BOOST_FUNCTION_STD_NS #else @@ -259,6 +262,12 @@ namespace boost { A(a) { } + + functor_wrapper(const functor_wrapper& f) : + F(static_cast(f)), + A(static_cast(f)) + { + } }; /** @@ -625,7 +634,7 @@ public: if (!vtable) return typeid(void); detail::function::function_buffer type; - vtable->manager(functor, type, detail::function::get_functor_type_tag); + get_vtable()->manager(functor, type, detail::function::get_functor_type_tag); return *type.type.type; } @@ -638,7 +647,7 @@ public: type_result.type.type = &typeid(Functor); type_result.type.const_qualified = is_const::value; type_result.type.volatile_qualified = is_volatile::value; - vtable->manager(functor, type_result, + get_vtable()->manager(functor, type_result, detail::function::check_functor_type_tag); return static_cast(type_result.obj_ptr); } @@ -656,7 +665,7 @@ public: type_result.type.type = &typeid(Functor); type_result.type.const_qualified = true; type_result.type.volatile_qualified = is_volatile::value; - vtable->manager(functor, type_result, + get_vtable()->manager(functor, type_result, detail::function::check_functor_type_tag); // GCC 2.95.3 gets the CV qualifiers wrong here, so we // can't do the static_cast that we should do. @@ -702,6 +711,15 @@ public: #endif public: // should be protected, but GCC 2.95.3 will fail to allow access + detail::function::vtable_base* get_vtable() const { + return reinterpret_cast( + reinterpret_cast(vtable) & ~(std::size_t)0x01); + } + + bool has_trivial_copy_and_destroy() const { + return reinterpret_cast(vtable) & 0x01; + } + detail::function::vtable_base* vtable; mutable detail::function::function_buffer functor; }; @@ -877,4 +895,8 @@ namespace detail { #undef BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL #undef BOOST_FUNCTION_COMPARE_TYPE_ID +#if defined(BOOST_MSVC) +# pragma warning( pop ) +#endif + #endif // BOOST_FUNCTION_BASE_HEADER diff --git a/boost/boost/function/function_fwd.hpp b/boost/boost/function/function_fwd.hpp index 0879263199..cc09283812 100644 --- a/boost/boost/function/function_fwd.hpp +++ b/boost/boost/function/function_fwd.hpp @@ -21,7 +21,7 @@ namespace boost { namespace python { namespace objects { #if defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ || defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \ - || !(BOOST_STRICT_CONFIG || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540) + || !(defined(BOOST_STRICT_CONFIG) || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540) # define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX #endif diff --git a/boost/boost/function/function_template.hpp b/boost/boost/function/function_template.hpp index 584abe96ba..6a99109ab1 100644 --- a/boost/boost/function/function_template.hpp +++ b/boost/boost/function/function_template.hpp @@ -11,6 +11,7 @@ // Note: this header is a header template and must NOT have multiple-inclusion // protection. #include +#include #if defined(BOOST_MSVC) # pragma warning( push ) @@ -624,14 +625,10 @@ namespace boost { assign_to(const reference_wrapper& f, function_buffer& functor, function_obj_ref_tag) { - if (!boost::detail::function::has_empty_target(f.get_pointer())) { - functor.obj_ref.obj_ptr = (void *)f.get_pointer(); - functor.obj_ref.is_const_qualified = is_const::value; - functor.obj_ref.is_volatile_qualified = is_volatile::value; - return true; - } else { - return false; - } + functor.obj_ref.obj_ptr = (void *)f.get_pointer(); + functor.obj_ref.is_const_qualified = is_const::value; + functor.obj_ref.is_volatile_qualified = is_volatile::value; + return true; } template bool @@ -678,6 +675,11 @@ namespace boost { R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS> vtable_type; + vtable_type* get_vtable() const { + return reinterpret_cast( + reinterpret_cast(vtable) & ~(std::size_t)0x01); + } + struct clear_type {}; public: @@ -757,7 +759,7 @@ namespace boost { if (this->empty()) boost::throw_exception(bad_function_call()); - return static_cast(vtable)->invoker + return get_vtable()->invoker (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); } #else @@ -781,24 +783,26 @@ namespace boost { operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) { this->clear(); - try { + BOOST_TRY { this->assign_to(f); - } catch (...) { + } BOOST_CATCH (...) { vtable = 0; - throw; + BOOST_RETHROW; } + BOOST_CATCH_END return *this; } template void assign(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a) { this->clear(); - try { + BOOST_TRY{ this->assign_to_a(f,a); - } catch (...) { + } BOOST_CATCH (...) { vtable = 0; - throw; + BOOST_RETHROW; } + BOOST_CATCH_END } #ifndef BOOST_NO_SFINAE @@ -823,12 +827,13 @@ namespace boost { return *this; this->clear(); - try { + BOOST_TRY { this->assign_to_own(f); - } catch (...) { + } BOOST_CATCH (...) { vtable = 0; - throw; + BOOST_RETHROW; } + BOOST_CATCH_END return *this; } @@ -847,7 +852,8 @@ namespace boost { void clear() { if (vtable) { - reinterpret_cast(vtable)->clear(this->functor); + if (!this->has_trivial_copy_and_destroy()) + get_vtable()->clear(this->functor); vtable = 0; } } @@ -876,8 +882,11 @@ namespace boost { { if (!f.empty()) { this->vtable = f.vtable; - f.vtable->manager(f.functor, this->functor, - boost::detail::function::clone_functor_tag); + if (this->has_trivial_copy_and_destroy()) + this->functor = f.functor; + else + get_vtable()->base.manager(f.functor, this->functor, + boost::detail::function::clone_functor_tag); } } @@ -903,8 +912,15 @@ namespace boost { static vtable_type stored_vtable = { { &manager_type::manage }, &invoker_type::invoke }; - if (stored_vtable.assign_to(f, functor)) vtable = &stored_vtable.base; - else vtable = 0; + if (stored_vtable.assign_to(f, functor)) { + std::size_t value = reinterpret_cast(&stored_vtable.base); + if (boost::has_trivial_copy_constructor::value && + boost::has_trivial_destructor::value && + detail::function::function_allows_small_object_optimization::value) + value |= (std::size_t)0x01; + vtable = reinterpret_cast(value); + } else + vtable = 0; } template @@ -930,8 +946,15 @@ namespace boost { static vtable_type stored_vtable = { { &manager_type::manage }, &invoker_type::invoke }; - if (stored_vtable.assign_to_a(f, functor, a)) vtable = &stored_vtable.base; - else vtable = 0; + if (stored_vtable.assign_to_a(f, functor, a)) { + std::size_t value = reinterpret_cast(&stored_vtable.base); + if (boost::has_trivial_copy_constructor::value && + boost::has_trivial_destructor::value && + detail::function::function_allows_small_object_optimization::value) + value |= (std::size_t)0x01; + vtable = reinterpret_cast(value); + } else + vtable = 0; } // Moves the value from the specified argument to *this. If the argument @@ -942,23 +965,23 @@ namespace boost { if (&f == this) return; -#if !defined(BOOST_NO_EXCEPTIONS) - try { -#endif + BOOST_TRY { if (!f.empty()) { this->vtable = f.vtable; - f.vtable->manager(f.functor, this->functor, - boost::detail::function::move_functor_tag); - f.vtable = 0; -#if !defined(BOOST_NO_EXCEPTIONS) + if (this->has_trivial_copy_and_destroy()) + this->functor = f.functor; + else + get_vtable()->base.manager(f.functor, this->functor, + boost::detail::function::move_functor_tag); + f.vtable = 0; } else { clear(); } - } catch (...) { + } BOOST_CATCH (...) { vtable = 0; - throw; + BOOST_RETHROW; } -#endif + BOOST_CATCH_END } }; @@ -979,13 +1002,14 @@ namespace boost { template typename BOOST_FUNCTION_FUNCTION< R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS>::result_type - BOOST_FUNCTION_FUNCTION + inline + BOOST_FUNCTION_FUNCTION ::operator()(BOOST_FUNCTION_PARMS) const { if (this->empty()) boost::throw_exception(bad_function_call()); - return reinterpret_cast(vtable)->invoker + return get_vtable()->invoker (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); } #endif diff --git a/boost/boost/functional/detail/container_fwd.hpp b/boost/boost/functional/detail/container_fwd.hpp new file mode 100644 index 0000000000..2388e645d0 --- /dev/null +++ b/boost/boost/functional/detail/container_fwd.hpp @@ -0,0 +1,19 @@ + +// Copyright 2005-2008 Daniel James. +// 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) + +// Forwarding header for container_fwd.hpp's new location. +// This header is deprecated, I'll be adding a warning in a future release, +// then converting it to an error and finally removing this header completely. + +#if !defined(BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP) +#define BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include + +#endif diff --git a/boost/boost/functional/hash.hpp b/boost/boost/functional/hash.hpp new file mode 100644 index 0000000000..80f7fa9a8c --- /dev/null +++ b/boost/boost/functional/hash.hpp @@ -0,0 +1,7 @@ + +// Copyright 2005-2009 Daniel James. +// 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 + diff --git a/boost/boost/functional/hash/detail/float_functions.hpp b/boost/boost/functional/hash/detail/float_functions.hpp new file mode 100644 index 0000000000..b46b6735f8 --- /dev/null +++ b/boost/boost/functional/hash/detail/float_functions.hpp @@ -0,0 +1,246 @@ + +// Copyright 2005-2009 Daniel James. +// 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) + +#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP) +#define BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP + +#include +#include + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// The C++ standard requires that the C float functions are overloarded +// for float, double and long double in the std namespace, but some of the older +// library implementations don't support this. On some that don't, the C99 +// float functions (frexpf, frexpl, etc.) are available. +// +// The following tries to automatically detect which are available. + +namespace boost { + namespace hash_detail { + + // Returned by dummy versions of the float functions. + + struct not_found { + // Implicitly convertible to float and long double in order to avoid + // a compile error when the dummy float functions are used. + + inline operator float() const { return 0; } + inline operator long double() const { return 0; } + }; + + // A type for detecting the return type of functions. + + template struct is; + template <> struct is { char x[10]; }; + template <> struct is { char x[20]; }; + template <> struct is { char x[30]; }; + template <> struct is { char x[40]; }; + + // Used to convert the return type of a function to a type for sizeof. + + template is float_type(T); + + // call_ldexp + // + // This will get specialized for float and long double + + template struct call_ldexp + { + typedef double float_type; + + inline double operator()(double a, int b) const + { + using namespace std; + return ldexp(a, b); + } + }; + + // call_frexp + // + // This will get specialized for float and long double + + template struct call_frexp + { + typedef double float_type; + + inline double operator()(double a, int* b) const + { + using namespace std; + return frexp(a, b); + } + }; + } +} + +// A namespace for dummy functions to detect when the actual function we want +// isn't available. ldexpl, ldexpf etc. might be added tby the macros below. +// +// AFAICT these have to be outside of the boost namespace, as if they're in +// the boost namespace they'll always be preferable to any other function +// (since the arguments are built in types, ADL can't be used). + +namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS { + template boost::hash_detail::not_found ldexp(Float, int); + template boost::hash_detail::not_found frexp(Float, int*); +} + +// Macros for generating specializations of call_ldexp and call_frexp. +// +// check_cpp and check_c99 check if the C++ or C99 functions are available. +// +// Then the call_* functions select an appropriate implementation. +// +// I used c99_func in a few places just to get a unique name. +// +// Important: when using 'using namespace' at namespace level, include as +// little as possible in that namespace, as Visual C++ has an odd bug which +// can cause the namespace to be imported at the global level. This seems to +// happen mainly when there's a template in the same namesapce. + +#define BOOST_HASH_CALL_FLOAT_FUNC(cpp_func, c99_func, type1, type2) \ +namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS { \ + template \ + boost::hash_detail::not_found c99_func(Float, type2); \ +} \ + \ +namespace boost { \ + namespace hash_detail { \ + namespace c99_func##_detect { \ + using namespace std; \ + using namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS; \ + \ + struct check { \ + static type1 x; \ + static type2 y; \ + BOOST_STATIC_CONSTANT(bool, cpp = \ + sizeof(float_type(cpp_func(x,y))) \ + == sizeof(is)); \ + BOOST_STATIC_CONSTANT(bool, c99 = \ + sizeof(float_type(c99_func(x,y))) \ + == sizeof(is)); \ + }; \ + } \ + \ + template \ + struct call_c99_##c99_func : \ + boost::hash_detail::call_##cpp_func {}; \ + \ + template <> \ + struct call_c99_##c99_func { \ + typedef type1 float_type; \ + \ + template \ + inline type1 operator()(type1 a, T b) const \ + { \ + using namespace std; \ + return c99_func(a, b); \ + } \ + }; \ + \ + template \ + struct call_cpp_##c99_func : \ + call_c99_##c99_func< \ + ::boost::hash_detail::c99_func##_detect::check::c99 \ + > {}; \ + \ + template <> \ + struct call_cpp_##c99_func { \ + typedef type1 float_type; \ + \ + template \ + inline type1 operator()(type1 a, T b) const \ + { \ + using namespace std; \ + return cpp_func(a, b); \ + } \ + }; \ + \ + template <> \ + struct call_##cpp_func : \ + call_cpp_##c99_func< \ + ::boost::hash_detail::c99_func##_detect::check::cpp \ + > {}; \ + } \ +} + +#define BOOST_HASH_CALL_FLOAT_MACRO(cpp_func, c99_func, type1, type2) \ +namespace boost { \ + namespace hash_detail { \ + \ + template <> \ + struct call_##cpp_func { \ + typedef type1 float_type; \ + inline type1 operator()(type1 x, type2 y) const { \ + return c99_func(x, y); \ + } \ + }; \ + } \ +} + +#if defined(ldexpf) +BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpf, float, int) +#else +BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpf, float, int) +#endif + +#if defined(ldexpl) +BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpl, long double, int) +#else +BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpl, long double, int) +#endif + +#if defined(frexpf) +BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpf, float, int*) +#else +BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpf, float, int*) +#endif + +#if defined(frexpl) +BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpl, long double, int*) +#else +BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpl, long double, int*) +#endif + +#undef BOOST_HASH_CALL_FLOAT_MACRO +#undef BOOST_HASH_CALL_FLOAT_FUNC + + +namespace boost +{ + namespace hash_detail + { + template + struct select_hash_type_impl { + typedef double type; + }; + + template <> + struct select_hash_type_impl { + typedef float type; + }; + + template <> + struct select_hash_type_impl { + typedef long double type; + }; + + + // select_hash_type + // + // If there is support for a particular floating point type, use that + // otherwise use double (there's always support for double). + + template + struct select_hash_type : select_hash_type_impl< + BOOST_DEDUCED_TYPENAME call_ldexp::float_type, + BOOST_DEDUCED_TYPENAME call_frexp::float_type + > {}; + } +} + +#endif diff --git a/boost/boost/functional/hash/detail/hash_float.hpp b/boost/boost/functional/hash/detail/hash_float.hpp new file mode 100644 index 0000000000..8108f4650c --- /dev/null +++ b/boost/boost/functional/hash/detail/hash_float.hpp @@ -0,0 +1,101 @@ + +// Copyright 2005-2009 Daniel James. +// 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) + +#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER) +#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include +#include +#include +#include + +// Include hash implementation for the current platform. + +// Cygwn +#if defined(__CYGWIN__) +# if defined(__i386__) || defined(_M_IX86) +# include +# else +# include +# endif +#else +# include +#endif + +// Can we use fpclassify? + +// STLport +#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) +#define BOOST_HASH_USE_FPCLASSIFY 0 + +// GNU libstdc++ 3 +#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) +# if (defined(__USE_ISOC99) || defined(_GLIBCXX_USE_C99_MATH)) && \ + !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) +# define BOOST_HASH_USE_FPCLASSIFY 1 +# else +# define BOOST_HASH_USE_FPCLASSIFY 0 +# endif + +// Everything else +#else +# define BOOST_HASH_USE_FPCLASSIFY 0 +#endif + +#if BOOST_HASH_USE_FPCLASSIFY + +#include + +namespace boost +{ + namespace hash_detail + { + template + inline std::size_t float_hash_value(T v) + { + using namespace std; + switch (fpclassify(v)) { + case FP_ZERO: + return 0; + case FP_INFINITE: + return (std::size_t)(v > 0 ? -1 : -2); + case FP_NAN: + return (std::size_t)(-3); + case FP_NORMAL: + case FP_SUBNORMAL: + return float_hash_impl(v); + default: + BOOST_ASSERT(0); + return 0; + } + } + } +} + +#else // !BOOST_HASH_USE_FPCLASSIFY + +namespace boost +{ + namespace hash_detail + { + template + inline std::size_t float_hash_value(T v) + { + return v == 0 ? 0 : float_hash_impl(v); + } + } +} + +#endif // BOOST_HASH_USE_FPCLASSIFY + +#undef BOOST_HASH_USE_FPCLASSIFY + +#endif diff --git a/boost/boost/functional/hash/detail/hash_float_generic.hpp b/boost/boost/functional/hash/detail/hash_float_generic.hpp new file mode 100644 index 0000000000..abb16a6518 --- /dev/null +++ b/boost/boost/functional/hash/detail/hash_float_generic.hpp @@ -0,0 +1,93 @@ + +// Copyright 2005-2009 Daniel James. +// 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) + +// A general purpose hash function for non-zero floating point values. + +#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER) +#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER + +#include +#include +#include + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(BOOST_MSVC) +#pragma warning(push) +#if BOOST_MSVC >= 1400 +#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does + // not satisfy test. Loop body not executed +#endif +#endif + +namespace boost +{ + namespace hash_detail + { + inline void hash_float_combine(std::size_t& seed, std::size_t value) + { + seed ^= value + (seed<<6) + (seed>>2); + } + + template + inline std::size_t float_hash_impl2(T v) + { + boost::hash_detail::call_frexp frexp; + boost::hash_detail::call_ldexp ldexp; + + int exp = 0; + + v = frexp(v, &exp); + + // A postive value is easier to hash, so combine the + // sign with the exponent and use the absolute value. + if(v < 0) { + v = -v; + exp += limits::max_exponent - + limits::min_exponent; + } + + // The result of frexp is always between 0.5 and 1, so its + // top bit will always be 1. Subtract by 0.5 to remove that. + v -= T(0.5); + v = ldexp(v, limits::digits + 1); + std::size_t seed = static_cast(v); + v -= seed; + + // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1; + std::size_t const length + = (limits::digits * + boost::static_log2::radix>::value - 1) + / limits::digits; + + for(std::size_t i = 0; i != length; ++i) + { + v = ldexp(v, limits::digits); + std::size_t part = static_cast(v); + v -= part; + hash_float_combine(seed, part); + } + + hash_float_combine(seed, exp); + + return seed; + } + + template + inline std::size_t float_hash_impl(T v) + { + typedef BOOST_DEDUCED_TYPENAME select_hash_type::type type; + return float_hash_impl2(static_cast(v)); + } + } +} + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + +#endif diff --git a/boost/boost/functional/hash/detail/hash_float_x86.hpp b/boost/boost/functional/hash/detail/hash_float_x86.hpp new file mode 100644 index 0000000000..ee8e75810b --- /dev/null +++ b/boost/boost/functional/hash/detail/hash_float_x86.hpp @@ -0,0 +1,56 @@ + +// Copyright 2005-2009 Daniel James. +// 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) + +// A non-portable hash function form non-zero floats on x86. +// +// Even if you're on an x86 platform, this might not work if their floating +// point isn't set up as this expects. So this should only be used if it's +// absolutely certain that it will work. + +#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER) +#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER + +#include + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +namespace boost +{ + namespace hash_detail + { + inline void hash_float_combine(std::size_t& seed, std::size_t value) + { + seed ^= value + (seed<<6) + (seed>>2); + } + + inline std::size_t float_hash_impl(float v) + { + boost::uint32_t* ptr = (boost::uint32_t*)&v; + std::size_t seed = *ptr; + return seed; + } + + inline std::size_t float_hash_impl(double v) + { + boost::uint32_t* ptr = (boost::uint32_t*)&v; + std::size_t seed = *ptr++; + hash_float_combine(seed, *ptr); + return seed; + } + + inline std::size_t float_hash_impl(long double v) + { + boost::uint32_t* ptr = (boost::uint32_t*)&v; + std::size_t seed = *ptr++; + hash_float_combine(seed, *ptr++); + hash_float_combine(seed, *(boost::uint16_t*)ptr); + return seed; + } + } +} + +#endif diff --git a/boost/boost/functional/hash/detail/limits.hpp b/boost/boost/functional/hash/detail/limits.hpp new file mode 100644 index 0000000000..e684593673 --- /dev/null +++ b/boost/boost/functional/hash/detail/limits.hpp @@ -0,0 +1,61 @@ + +// Copyright 2005-2009 Daniel James. +// 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) +// +// On some platforms std::limits gives incorrect values for long double. +// This tries to work around them. + +#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER) +#define BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include + +// On OpenBSD, numeric_limits is not reliable for long doubles, but +// the macros defined in are and support long double when STLport +// doesn't. + +#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE) +#include +#endif + +namespace boost +{ + namespace hash_detail + { + template + struct limits : std::numeric_limits {}; + +#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE) + template <> + struct limits + : std::numeric_limits + { + static long double epsilon() { + return LDBL_EPSILON; + } + + static long double (max)() { + return LDBL_MAX; + } + + static long double (min)() { + return LDBL_MIN; + } + + BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG); + BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP); + BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP); +#if defined(_STLP_NO_LONG_DOUBLE) + BOOST_STATIC_CONSTANT(int, radix = FLT_RADIX); +#endif + }; +#endif // __OpenBSD__ + } +} + +#endif diff --git a/boost/boost/functional/hash/extensions.hpp b/boost/boost/functional/hash/extensions.hpp new file mode 100644 index 0000000000..eea32efaa6 --- /dev/null +++ b/boost/boost/functional/hash/extensions.hpp @@ -0,0 +1,286 @@ + +// Copyright 2005-2009 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +// This implements the extensions to the standard. +// It's undocumented, so you shouldn't use it.... + +#if !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) +#define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP + +#include +#include + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) +#include +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) +#include +#endif + +namespace boost +{ + template + std::size_t hash_value(std::pair const&); + template + std::size_t hash_value(std::vector const&); + template + std::size_t hash_value(std::list const& v); + template + std::size_t hash_value(std::deque const& v); + template + std::size_t hash_value(std::set const& v); + template + std::size_t hash_value(std::multiset const& v); + template + std::size_t hash_value(std::map const& v); + template + std::size_t hash_value(std::multimap const& v); + + template + std::size_t hash_value(std::complex const&); + + template + std::size_t hash_value(std::pair const& v) + { + std::size_t seed = 0; + hash_combine(seed, v.first); + hash_combine(seed, v.second); + return seed; + } + + template + std::size_t hash_value(std::vector const& v) + { + return hash_range(v.begin(), v.end()); + } + + template + std::size_t hash_value(std::list const& v) + { + return hash_range(v.begin(), v.end()); + } + + template + std::size_t hash_value(std::deque const& v) + { + return hash_range(v.begin(), v.end()); + } + + template + std::size_t hash_value(std::set const& v) + { + return hash_range(v.begin(), v.end()); + } + + template + std::size_t hash_value(std::multiset const& v) + { + return hash_range(v.begin(), v.end()); + } + + template + std::size_t hash_value(std::map const& v) + { + return hash_range(v.begin(), v.end()); + } + + template + std::size_t hash_value(std::multimap const& v) + { + return hash_range(v.begin(), v.end()); + } + + template + std::size_t hash_value(std::complex const& v) + { + boost::hash hasher; + std::size_t seed = hasher(v.imag()); + seed ^= hasher(v.real()) + (seed<<6) + (seed>>2); + return seed; + } + + // + // call_hash_impl + // + + // On compilers without function template ordering, this deals with arrays. + +#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + namespace hash_detail + { + template + struct call_hash_impl + { + template + struct inner + { + static std::size_t call(T const& v) + { + using namespace boost; + return hash_value(v); + } + }; + }; + + template <> + struct call_hash_impl + { + template + struct inner + { +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + static std::size_t call(Array const& v) +#else + static std::size_t call(Array& v) +#endif + { + const int size = sizeof(v) / sizeof(*v); + return boost::hash_range(v, v + size); + } + }; + }; + + template + struct call_hash + : public call_hash_impl::value> + ::BOOST_NESTED_TEMPLATE inner + { + }; + } +#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING + + // + // boost::hash + // + + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + + template struct hash + : std::unary_function + { +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + std::size_t operator()(T const& val) const + { + return hash_value(val); + } +#else + std::size_t operator()(T const& val) const + { + return hash_detail::call_hash::call(val); + } +#endif + }; + +#if BOOST_WORKAROUND(__DMC__, <= 0x848) + template struct hash + : std::unary_function + { + std::size_t operator()(const T* val) const + { + return boost::hash_range(val, val+n); + } + }; +#endif + +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + // On compilers without partial specialization, boost::hash + // has already been declared to deal with pointers, so just + // need to supply the non-pointer version of hash_impl. + + namespace hash_detail + { + template + struct hash_impl; + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) + + template <> + struct hash_impl + { + template + struct inner + : std::unary_function + { +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + std::size_t operator()(T const& val) const + { + return hash_value(val); + } +#else + std::size_t operator()(T const& val) const + { + return hash_detail::call_hash::call(val); + } +#endif + }; + }; + +#else // Visual C++ 6.5 + + // Visual C++ 6.5 has problems with nested member functions and + // applying const to const types in templates. So we get this: + + template + struct hash_impl_msvc + { + template + struct inner + : public std::unary_function + { + std::size_t operator()(T const& val) const + { + return hash_detail::call_hash::call(val); + } + + std::size_t operator()(T& val) const + { + return hash_detail::call_hash::call(val); + } + }; + }; + + template <> + struct hash_impl_msvc + { + template + struct inner + : public std::unary_function + { + std::size_t operator()(T& val) const + { + return hash_detail::call_hash::call(val); + } + }; + }; + + template + struct hash_impl_msvc2 + : public hash_impl_msvc::value> + ::BOOST_NESTED_TEMPLATE inner {}; + + template <> + struct hash_impl + { + template + struct inner : public hash_impl_msvc2 {}; + }; + +#endif // Visual C++ 6.5 + } +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +} + +#endif diff --git a/boost/boost/functional/hash/hash.hpp b/boost/boost/functional/hash/hash.hpp new file mode 100644 index 0000000000..337a98655c --- /dev/null +++ b/boost/boost/functional/hash/hash.hpp @@ -0,0 +1,478 @@ + +// Copyright 2005-2009 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +#if !defined(BOOST_FUNCTIONAL_HASH_HASH_HPP) +#define BOOST_FUNCTIONAL_HASH_HASH_HPP + +#include +#include +#include +#include +#include + +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#include +#endif + +#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) +#define BOOST_HASH_CHAR_TRAITS string_char_traits +#else +#define BOOST_HASH_CHAR_TRAITS char_traits +#endif + +namespace boost +{ + std::size_t hash_value(bool); + std::size_t hash_value(char); + std::size_t hash_value(unsigned char); + std::size_t hash_value(signed char); + std::size_t hash_value(short); + std::size_t hash_value(unsigned short); + std::size_t hash_value(int); + std::size_t hash_value(unsigned int); + std::size_t hash_value(long); + std::size_t hash_value(unsigned long); + +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) + std::size_t hash_value(wchar_t); +#endif + +#if defined(BOOST_HAS_LONG_LONG) + std::size_t hash_value(boost::long_long_type); + std::size_t hash_value(boost::ulong_long_type); +#endif + +#if !BOOST_WORKAROUND(__DMC__, <= 0x848) + template std::size_t hash_value(T* const&); +#else + template std::size_t hash_value(T*); +#endif + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + template< class T, unsigned N > + std::size_t hash_value(const T (&x)[N]); + + template< class T, unsigned N > + std::size_t hash_value(T (&x)[N]); +#endif + + std::size_t hash_value(float v); + std::size_t hash_value(double v); + std::size_t hash_value(long double v); + + template + std::size_t hash_value(std::basic_string, A> const&); + + // Implementation + + namespace hash_detail + { + template + inline std::size_t hash_value_signed(T val) + { + const int size_t_bits = std::numeric_limits::digits; + // ceiling(std::numeric_limits::digits / size_t_bits) - 1 + const int length = (std::numeric_limits::digits - 1) + / size_t_bits; + + std::size_t seed = 0; + T positive = val < 0 ? -1 - val : val; + + // Hopefully, this loop can be unrolled. + for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits) + { + seed ^= (std::size_t) (positive >> i) + (seed<<6) + (seed>>2); + } + seed ^= (std::size_t) val + (seed<<6) + (seed>>2); + + return seed; + } + + template + inline std::size_t hash_value_unsigned(T val) + { + const int size_t_bits = std::numeric_limits::digits; + // ceiling(std::numeric_limits::digits / size_t_bits) - 1 + const int length = (std::numeric_limits::digits - 1) + / size_t_bits; + + std::size_t seed = 0; + + // Hopefully, this loop can be unrolled. + for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits) + { + seed ^= (std::size_t) (val >> i) + (seed<<6) + (seed>>2); + } + seed ^= (std::size_t) val + (seed<<6) + (seed>>2); + + return seed; + } + } + + inline std::size_t hash_value(bool v) + { + return static_cast(v); + } + + inline std::size_t hash_value(char v) + { + return static_cast(v); + } + + inline std::size_t hash_value(unsigned char v) + { + return static_cast(v); + } + + inline std::size_t hash_value(signed char v) + { + return static_cast(v); + } + + inline std::size_t hash_value(short v) + { + return static_cast(v); + } + + inline std::size_t hash_value(unsigned short v) + { + return static_cast(v); + } + + inline std::size_t hash_value(int v) + { + return static_cast(v); + } + + inline std::size_t hash_value(unsigned int v) + { + return static_cast(v); + } + + inline std::size_t hash_value(long v) + { + return static_cast(v); + } + + inline std::size_t hash_value(unsigned long v) + { + return static_cast(v); + } + +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) + inline std::size_t hash_value(wchar_t v) + { + return static_cast(v); + } +#endif + +#if defined(BOOST_HAS_LONG_LONG) + inline std::size_t hash_value(boost::long_long_type v) + { + return hash_detail::hash_value_signed(v); + } + + inline std::size_t hash_value(boost::ulong_long_type v) + { + return hash_detail::hash_value_unsigned(v); + } +#endif + + // Implementation by Alberto Barbati and Dave Harris. +#if !BOOST_WORKAROUND(__DMC__, <= 0x848) + template std::size_t hash_value(T* const& v) +#else + template std::size_t hash_value(T* v) +#endif + { + std::size_t x = static_cast( + reinterpret_cast(v)); + + return x + (x >> 3); + } + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + template + inline void hash_combine(std::size_t& seed, T& v) +#else + template + inline void hash_combine(std::size_t& seed, T const& v) +#endif + { + boost::hash hasher; + seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2); + } + + template + inline std::size_t hash_range(It first, It last) + { + std::size_t seed = 0; + + for(; first != last; ++first) + { + hash_combine(seed, *first); + } + + return seed; + } + + template + inline void hash_range(std::size_t& seed, It first, It last) + { + for(; first != last; ++first) + { + hash_combine(seed, *first); + } + } + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) + template + inline std::size_t hash_range(T* first, T* last) + { + std::size_t seed = 0; + + for(; first != last; ++first) + { + boost::hash hasher; + seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2); + } + + return seed; + } + + template + inline void hash_range(std::size_t& seed, T* first, T* last) + { + for(; first != last; ++first) + { + boost::hash hasher; + seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2); + } + } +#endif + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + template< class T, unsigned N > + inline std::size_t hash_value(const T (&x)[N]) + { + return hash_range(x, x + N); + } + + template< class T, unsigned N > + inline std::size_t hash_value(T (&x)[N]) + { + return hash_range(x, x + N); + } +#endif + + template + inline std::size_t hash_value(std::basic_string, A> const& v) + { + return hash_range(v.begin(), v.end()); + } + + inline std::size_t hash_value(float v) + { + return boost::hash_detail::float_hash_value(v); + } + + inline std::size_t hash_value(double v) + { + return boost::hash_detail::float_hash_value(v); + } + + inline std::size_t hash_value(long double v) + { + return boost::hash_detail::float_hash_value(v); + } + + // + // boost::hash + // + + // Define the specializations required by the standard. The general purpose + // boost::hash is defined later in extensions.hpp if BOOST_HASH_NO_EXTENSIONS + // is not defined. + + // BOOST_HASH_SPECIALIZE - define a specialization for a type which is + // passed by copy. + // + // BOOST_HASH_SPECIALIZE_REF - define a specialization for a type which is + // passed by copy. + // + // These are undefined later. + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) +#define BOOST_HASH_SPECIALIZE(type) \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(type v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; + +#define BOOST_HASH_SPECIALIZE_REF(type) \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(type const& v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; +#else +#define BOOST_HASH_SPECIALIZE(type) \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(type v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; \ + \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(const type v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; + +#define BOOST_HASH_SPECIALIZE_REF(type) \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(type const& v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; \ + \ + template <> struct hash \ + : public std::unary_function \ + { \ + std::size_t operator()(type const& v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; +#endif + + BOOST_HASH_SPECIALIZE(bool) + BOOST_HASH_SPECIALIZE(char) + BOOST_HASH_SPECIALIZE(signed char) + BOOST_HASH_SPECIALIZE(unsigned char) +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) + BOOST_HASH_SPECIALIZE(wchar_t) +#endif + BOOST_HASH_SPECIALIZE(short) + BOOST_HASH_SPECIALIZE(unsigned short) + BOOST_HASH_SPECIALIZE(int) + BOOST_HASH_SPECIALIZE(unsigned int) + BOOST_HASH_SPECIALIZE(long) + BOOST_HASH_SPECIALIZE(unsigned long) + + BOOST_HASH_SPECIALIZE(float) + BOOST_HASH_SPECIALIZE(double) + BOOST_HASH_SPECIALIZE(long double) + + BOOST_HASH_SPECIALIZE_REF(std::string) +#if !defined(BOOST_NO_STD_WSTRING) + BOOST_HASH_SPECIALIZE_REF(std::wstring) +#endif + +#if defined(BOOST_HAS_LONG_LONG) + BOOST_HASH_SPECIALIZE(boost::long_long_type) + BOOST_HASH_SPECIALIZE(boost::ulong_long_type) +#endif + +#undef BOOST_HASH_SPECIALIZE +#undef BOOST_HASH_SPECIALIZE_REF + +// Specializing boost::hash for pointers. + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + + template + struct hash + : public std::unary_function + { + std::size_t operator()(T* v) const + { +#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) + return boost::hash_value(v); +#else + std::size_t x = static_cast( + reinterpret_cast(v)); + + return x + (x >> 3); +#endif + } + }; + +#else + + // For compilers without partial specialization, we define a + // boost::hash for all remaining types. But hash_impl is only defined + // for pointers in 'extensions.hpp' - so when BOOST_HASH_NO_EXTENSIONS + // is defined there will still be a compile error for types not supported + // in the standard. + + namespace hash_detail + { + template + struct hash_impl; + + template <> + struct hash_impl + { + template + struct inner + : public std::unary_function + { + std::size_t operator()(T val) const + { +#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 590) + return boost::hash_value(val); +#else + std::size_t x = static_cast( + reinterpret_cast(val)); + + return x + (x >> 3); +#endif + } + }; + }; + } + + template struct hash + : public boost::hash_detail::hash_impl::value> + ::BOOST_NESTED_TEMPLATE inner + { + }; + +#endif +} + +#undef BOOST_HASH_CHAR_TRAITS + +#endif // BOOST_FUNCTIONAL_HASH_HASH_HPP + +// Include this outside of the include guards in case the file is included +// twice - once with BOOST_HASH_NO_EXTENSIONS defined, and then with it +// undefined. + +#if !defined(BOOST_HASH_NO_EXTENSIONS) \ + && !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) +#include +#endif diff --git a/boost/boost/functional/hash/hash_fwd.hpp b/boost/boost/functional/hash/hash_fwd.hpp new file mode 100644 index 0000000000..1d0d06680b --- /dev/null +++ b/boost/boost/functional/hash/hash_fwd.hpp @@ -0,0 +1,40 @@ + +// Copyright 2005-2009 Daniel James. +// 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) + +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. + +#if !defined(BOOST_FUNCTIONAL_HASH_FWD_HPP) +#define BOOST_FUNCTIONAL_HASH_FWD_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include +#include +#include + +namespace boost +{ + template struct hash; + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + template void hash_combine(std::size_t& seed, T& v); +#else + template void hash_combine(std::size_t& seed, T const& v); +#endif + + template std::size_t hash_range(It, It); + template void hash_range(std::size_t&, It, It); + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) + template inline std::size_t hash_range(T*, T*); + template inline void hash_range(std::size_t&, T*, T*); +#endif +} + +#endif diff --git a/boost/boost/functional/hash_fwd.hpp b/boost/boost/functional/hash_fwd.hpp new file mode 100644 index 0000000000..b8f8c9a26c --- /dev/null +++ b/boost/boost/functional/hash_fwd.hpp @@ -0,0 +1,7 @@ + +// Copyright 2005-2009 Daniel James. +// 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 + diff --git a/boost/boost/integer/static_log2.hpp b/boost/boost/integer/static_log2.hpp index 19e048bd03..219a48e341 100644 --- a/boost/boost/integer/static_log2.hpp +++ b/boost/boost/integer/static_log2.hpp @@ -48,7 +48,7 @@ namespace boost { template struct choose_initial_n { - enum { c = (argument_type(1) << n << n) != 0 }; + BOOST_STATIC_CONSTANT(bool, c = (argument_type(1) << n << n) != 0); BOOST_STATIC_CONSTANT( result_type, value = !c*n + choose_initial_n<2*c*n>::value @@ -85,7 +85,7 @@ namespace boost { template struct static_log2_impl { - enum { c = (x >> n) > 0 }; // x >= 2**n ? + BOOST_STATIC_CONSTANT(bool, c = (x >> n) > 0); // x >= 2**n ? BOOST_STATIC_CONSTANT( result_type, value = c*n + (static_log2_impl< (x>>c*n), n/2 >::value) diff --git a/boost/boost/mpl/aux_/config/compiler.hpp b/boost/boost/mpl/aux_/config/compiler.hpp index 01ff8b85e9..3238963c0c 100644 --- a/boost/boost/mpl/aux_/config/compiler.hpp +++ b/boost/boost/mpl/aux_/config/compiler.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Id: compiler.hpp 49272 2008-10-11 06:50:46Z agurtovoy $ -// $Date: 2008-10-11 02:50:46 -0400 (Sat, 11 Oct 2008) $ -// $Revision: 49272 $ +// $Id: compiler.hpp 53189 2009-05-22 20:07:55Z hkaiser $ +// $Date: 2009-05-22 16:07:55 -0400 (Fri, 22 May 2009) $ +// $Revision: 53189 $ #if !defined(BOOST_MPL_CFG_COMPILER_DIR) @@ -35,7 +35,7 @@ # elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) # if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES) # define BOOST_MPL_CFG_COMPILER_DIR bcc551 -# elseif BOOST_WORKAROUND(__BORLANDC__, >= 0x590) +# elif BOOST_WORKAROUND(__BORLANDC__, >= 0x590) # define BOOST_MPL_CFG_COMPILER_DIR bcc # else # define BOOST_MPL_CFG_COMPILER_DIR bcc_pre590 diff --git a/boost/boost/mpl/aux_/inserter_algorithm.hpp b/boost/boost/mpl/aux_/inserter_algorithm.hpp index 563ecf0d1d..a6f340c782 100755 --- a/boost/boost/mpl/aux_/inserter_algorithm.hpp +++ b/boost/boost/mpl/aux_/inserter_algorithm.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Id: inserter_algorithm.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ -// $Revision: 49267 $ +// $Id: inserter_algorithm.hpp 55648 2009-08-18 05:16:53Z agurtovoy $ +// $Date: 2009-08-18 01:16:53 -0400 (Tue, 18 Aug 2009) $ +// $Revision: 55648 $ #include #include @@ -49,7 +49,7 @@ template< \ BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \ > \ struct name< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P),na > \ - : if_< has_push_back \ + : if_< has_push_back< typename clear::type> \ , aux::name##_impl< \ BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \ , back_inserter< typename clear::type > \ diff --git a/boost/boost/mpl/aux_/push_back_impl.hpp b/boost/boost/mpl/aux_/push_back_impl.hpp index 54e945cd31..2f839cb88a 100755 --- a/boost/boost/mpl/aux_/push_back_impl.hpp +++ b/boost/boost/mpl/aux_/push_back_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Id: push_back_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ -// $Revision: 49267 $ +// $Id: push_back_impl.hpp 55679 2009-08-20 07:50:16Z agurtovoy $ +// $Date: 2009-08-20 03:50:16 -0400 (Thu, 20 Aug 2009) $ +// $Revision: 55679 $ #include #include @@ -25,8 +25,7 @@ namespace boost { namespace mpl { -template< typename Tag > -struct has_push_back_impl; +struct has_push_back_arg {}; // agurt 05/feb/04: no default implementation; the stub definition is needed // to enable the default 'has_push_back' implementation below @@ -39,7 +38,7 @@ struct push_back_impl // if you've got an assert here, you are requesting a 'push_back' // specialization that doesn't exist. BOOST_MPL_ASSERT_MSG( - ( boost::is_same< T, has_push_back_impl >::value ) + ( boost::is_same< T, has_push_back_arg >::value ) , REQUESTED_PUSH_BACK_SPECIALIZATION_FOR_SEQUENCE_DOES_NOT_EXIST , ( Sequence ) ); @@ -51,13 +50,13 @@ struct has_push_back_impl { template< typename Seq > struct apply #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING) - : aux::has_type< push_back< Seq, has_push_back_impl > > + : aux::has_type< push_back< Seq, has_push_back_arg > > { #else { - typedef aux::has_type< push_back< Seq, has_push_back_impl > > type; + typedef aux::has_type< push_back< Seq, has_push_back_arg > > type; BOOST_STATIC_CONSTANT(bool, value = - (aux::has_type< push_back< Seq, has_push_back_impl > >::value) + (aux::has_type< push_back< Seq, has_push_back_arg > >::value) ); #endif }; diff --git a/boost/boost/mpl/aux_/push_front_impl.hpp b/boost/boost/mpl/aux_/push_front_impl.hpp index dfc126170d..6723ea3894 100755 --- a/boost/boost/mpl/aux_/push_front_impl.hpp +++ b/boost/boost/mpl/aux_/push_front_impl.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Id: push_front_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ -// $Revision: 49267 $ +// $Id: push_front_impl.hpp 55679 2009-08-20 07:50:16Z agurtovoy $ +// $Date: 2009-08-20 03:50:16 -0400 (Thu, 20 Aug 2009) $ +// $Revision: 55679 $ #include #include @@ -25,8 +25,7 @@ namespace boost { namespace mpl { -template< typename Tag > -struct has_push_front_impl; +struct has_push_front_arg {}; // agurt 05/feb/04: no default implementation; the stub definition is needed // to enable the default 'has_push_front' implementation below @@ -40,7 +39,7 @@ struct push_front_impl // if you've got an assert here, you are requesting a 'push_front' // specialization that doesn't exist. BOOST_MPL_ASSERT_MSG( - ( boost::is_same< T, has_push_front_impl >::value ) + ( boost::is_same< T, has_push_front_arg >::value ) , REQUESTED_PUSH_FRONT_SPECIALIZATION_FOR_SEQUENCE_DOES_NOT_EXIST , ( Sequence ) ); @@ -52,13 +51,13 @@ struct has_push_front_impl { template< typename Seq > struct apply #if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING) - : aux::has_type< push_front< Seq, has_push_front_impl > > + : aux::has_type< push_front< Seq, has_push_front_arg > > { #else { - typedef aux::has_type< push_front< Seq, has_push_front_impl > > type; + typedef aux::has_type< push_front< Seq, has_push_front_arg > > type; BOOST_STATIC_CONSTANT(bool, value = - (aux::has_type< push_front< Seq, has_push_front_impl > >::value) + (aux::has_type< push_front< Seq, has_push_front_arg > >::value) ); #endif }; diff --git a/boost/boost/mpl/char.hpp b/boost/boost/mpl/char.hpp new file mode 100755 index 0000000000..366ec05604 --- /dev/null +++ b/boost/boost/mpl/char.hpp @@ -0,0 +1,22 @@ + +#ifndef BOOST_MPL_CHAR_HPP_INCLUDED +#define BOOST_MPL_CHAR_HPP_INCLUDED + +// Copyright Eric Niebler 2008 +// +// 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$ +// $Date: 2008-06-14 08:41:37 -0700 (Sat, 16 Jun 2008) $ +// $Revision: 24874 $ + +#include + +#define AUX_WRAPPER_VALUE_TYPE char +#include + +#endif // BOOST_MPL_CHAR_HPP_INCLUDED diff --git a/boost/boost/mpl/char_fwd.hpp b/boost/boost/mpl/char_fwd.hpp new file mode 100755 index 0000000000..65d741c3a5 --- /dev/null +++ b/boost/boost/mpl/char_fwd.hpp @@ -0,0 +1,27 @@ + +#ifndef BOOST_MPL_CHAR_FWD_HPP_INCLUDED +#define BOOST_MPL_CHAR_FWD_HPP_INCLUDED + +// Copyright Eric Niebler 2008 +// +// 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$ +// $Date: 2008-06-14 08:41:37 -0700 (Sat, 16 Jun 2008) $ +// $Revision: 24874 $ + +#include +#include + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN + +template< BOOST_MPL_AUX_NTTP_DECL(char, N) > struct char_; + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE +BOOST_MPL_AUX_ADL_BARRIER_DECL(char_) + +#endif // BOOST_MPL_CHAR_FWD_HPP_INCLUDED diff --git a/boost/boost/mpl/for_each.hpp b/boost/boost/mpl/for_each.hpp index 668ec6aeea..89abc85d5e 100755 --- a/boost/boost/mpl/for_each.hpp +++ b/boost/boost/mpl/for_each.hpp @@ -10,9 +10,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Id: for_each.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ -// $Revision: 49267 $ +// $Id: for_each.hpp 55648 2009-08-18 05:16:53Z agurtovoy $ +// $Date: 2009-08-18 01:16:53 -0400 (Tue, 18 Aug 2009) $ +// $Revision: 55648 $ #include #include @@ -76,7 +76,7 @@ struct for_each_impl typedef typename mpl::next::type iter; for_each_impl::value> - ::execute((iter*)0, (LastIterator*)0, (TransformFunc*)0, f); + ::execute( static_cast(0), static_cast(0), static_cast(0), f); } }; @@ -98,7 +98,7 @@ void for_each(F f, Sequence* = 0, TransformOp* = 0) typedef typename end::type last; aux::for_each_impl< boost::is_same::value > - ::execute((first*)0, (last*)0, (TransformOp*)0, f); + ::execute(static_cast(0), static_cast(0), static_cast(0), f); } template< diff --git a/boost/boost/mpl/limits/string.hpp b/boost/boost/mpl/limits/string.hpp new file mode 100644 index 0000000000..c51c0ef794 --- /dev/null +++ b/boost/boost/mpl/limits/string.hpp @@ -0,0 +1,21 @@ + +#ifndef BOOST_MPL_LIMITS_STRING_HPP_INCLUDED +#define BOOST_MPL_LIMITS_STRING_HPP_INCLUDED + +// Copyright Eric Niebler 2009 +// +// 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. + +// $Id: string.hpp 49239 2009-04-01 09:10:26Z eric_niebler $ +// $Date: 2009-04-01 02:10:26 -0700 (Wed, 1 Apr 2009) $ +// $Revision: 49239 $ + +#if !defined(BOOST_MPL_LIMIT_STRING_SIZE) +# define BOOST_MPL_LIMIT_STRING_SIZE 32 +#endif + +#endif // BOOST_MPL_LIMITS_STRING_HPP_INCLUDED diff --git a/boost/boost/mpl/map/aux_/insert_impl.hpp b/boost/boost/mpl/map/aux_/insert_impl.hpp index c37c134cea..411909f8f2 100755 --- a/boost/boost/mpl/map/aux_/insert_impl.hpp +++ b/boost/boost/mpl/map/aux_/insert_impl.hpp @@ -11,9 +11,9 @@ // // See http://www.boost.org/libs/mpl for documentation. -// $Id: insert_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ -// $Revision: 49267 $ +// $Id: insert_impl.hpp 55751 2009-08-24 04:11:00Z agurtovoy $ +// $Date: 2009-08-24 00:11:00 -0400 (Mon, 24 Aug 2009) $ +// $Revision: 55751 $ #include #include @@ -39,7 +39,7 @@ struct map_insert_impl > #else , m_item< - next< typename Map::size >::type::value + Map::order::value , typename Pair::first , typename Pair::second , Map diff --git a/boost/boost/mpl/string.hpp b/boost/boost/mpl/string.hpp new file mode 100755 index 0000000000..f3b161372f --- /dev/null +++ b/boost/boost/mpl/string.hpp @@ -0,0 +1,559 @@ + +#ifndef BOOST_MPL_STRING_HPP_INCLUDED +#define BOOST_MPL_STRING_HPP_INCLUDED + +// Copyright Eric Niebler 2009 +// +// 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. + +// $Id: string.hpp 49239 2009-04-01 09:10:26Z eric_niebler $ +// $Date: 2009-04-01 02:10:26 -0700 (Wed, 1 Apr 2009) $ +// $Revision: 49239 $ +// +// Thanks to: +// Dmitry Goncharov for porting this to the Sun compiler + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include // for bidirectional_iterator_tag +#include + +namespace boost { namespace mpl +{ + #define BOOST_MPL_STRING_MAX_PARAMS \ + BOOST_PP_DIV(BOOST_PP_ADD(BOOST_MPL_LIMIT_STRING_SIZE, 3), 4) + + // Low-level bit-twiddling is done by macros. Any implementation-defined behavior of + // multi-character literals should be localized to these macros. + + #define BOOST_MPL_MULTICHAR_LENGTH(c) \ + (std::size_t)((c0xffffff)+(c>0xffff)+(c>0xff)+1)) + + #if defined(BOOST_LITTLE_ENDIAN) && defined(__SUNPRO_CC) + + #define BOOST_MPL_MULTICHAR_AT(c,i) \ + (char)(0xff&((unsigned)(c)>>(8*(std::size_t)(i)))) + + #define BOOST_MPL_MULTICHAR_PUSH_BACK(c,i) \ + ((((unsigned char)(i))<<(BOOST_MPL_MULTICHAR_LENGTH(c)*8))|(unsigned)(c)) + + #define BOOST_MPL_MULTICHAR_PUSH_FRONT(c,i) \ + (((unsigned)(c)<<8)|(unsigned char)(i)) + + #define BOOST_MPL_MULTICHAR_POP_BACK(c) \ + (((1<<((BOOST_MPL_MULTICHAR_LENGTH(c)-1)*8))-1)&(unsigned)(c)) + + #define BOOST_MPL_MULTICHAR_POP_FRONT(c) \ + ((unsigned)(c)>>8) + + #else + + #define BOOST_MPL_MULTICHAR_AT(c,i) \ + (char)(0xff&((unsigned)(c)>>(8*(BOOST_MPL_MULTICHAR_LENGTH(c)-(std::size_t)(i)-1)))) + + #define BOOST_MPL_MULTICHAR_PUSH_BACK(c,i) \ + (((unsigned)(c)<<8)|(unsigned char)(i)) + + #define BOOST_MPL_MULTICHAR_PUSH_FRONT(c,i) \ + ((((unsigned char)(i))<<(BOOST_MPL_MULTICHAR_LENGTH(c)*8))|(unsigned)(c)) + + #define BOOST_MPL_MULTICHAR_POP_BACK(c) \ + ((unsigned)(c)>>8) + + #define BOOST_MPL_MULTICHAR_POP_FRONT(c) \ + (((1<<((BOOST_MPL_MULTICHAR_LENGTH(c)-1)*8))-1)&(unsigned)(c)) + + #endif + + struct string_tag; + struct string_iterator_tag; + + template + struct string; + + template + struct string_iterator; + + template + struct sequence_tag; + + template + struct size_impl; + + template<> + struct size_impl + { + template + struct apply; + + #define M0(z, n, data) \ + + BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C,n)) + + #define M1(z, n, data) \ + template \ + struct apply > \ + : mpl::size_t<(0 BOOST_PP_REPEAT_ ## z(n, M0, ~))> \ + {}; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_MPL_STRING_MAX_PARAMS), M1, ~) + #undef M0 + #undef M1 + }; + + template<> + struct size_impl::apply > + : mpl::size_t<0> + {}; + + template + struct begin_impl; + + template<> + struct begin_impl + { + template + struct apply + { + typedef mpl::string_iterator type; + }; + }; + + template + struct end_impl; + + template<> + struct end_impl + { + template + struct apply; + + #define M0(z,n,data) \ + template \ + struct apply > \ + { \ + typedef mpl::string_iterator, n, 0> type; \ + }; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_MPL_STRING_MAX_PARAMS), M0, ~) + #undef M0 + }; + + template<> + struct end_impl::apply > + { + typedef mpl::string_iterator, 0, 0> type; + }; + + template + struct push_back_impl; + + template<> + struct push_back_impl + { + template + struct apply + { + BOOST_MPL_ASSERT_MSG( + (BOOST_MPL_LIMIT_STRING_SIZE != mpl::size::type::value) + , PUSH_BACK_FAILED_MPL_STRING_IS_FULL + , (Sequence) + ); + // If the above assertion didn't fire, then the string is sparse. + // Repack the string and retry the push_back + typedef + typename mpl::push_back< + typename mpl::copy< + Sequence + , mpl::back_inserter > + >::type + , Value + >::type + type; + }; + + template + struct apply, Value, false> + { + typedef mpl::string<(char)Value::value> type; + }; + + #define M0(z,n,data) \ + template \ + struct apply, Value, false> \ + { \ + typedef \ + mpl::string< \ + BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), C) \ + BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \ + ((unsigned)BOOST_PP_CAT(C,BOOST_PP_DEC(n))>0xffffff) \ + ?BOOST_PP_CAT(C,BOOST_PP_DEC(n)) \ + :BOOST_MPL_MULTICHAR_PUSH_BACK(BOOST_PP_CAT(C,BOOST_PP_DEC(n)), Value::value) \ + , ((unsigned)BOOST_PP_CAT(C,BOOST_PP_DEC(n))>0xffffff) \ + ?(char)Value::value \ + :0 \ + > \ + type; \ + }; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_MPL_STRING_MAX_PARAMS, M0, ~) + #undef M0 + + template + struct apply, Value, false> + { + typedef + mpl::string< + BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS), C) + , BOOST_MPL_MULTICHAR_PUSH_BACK(BOOST_PP_CAT(C,BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS)), Value::value) + > + type; + }; + }; + + template + struct pop_back_impl; + + template<> + struct pop_back_impl + { + template + struct apply; + + #define M0(z,n,data) \ + template \ + struct apply > \ + { \ + BOOST_MPL_ASSERT_MSG((C0 != 0), POP_BACK_FAILED_MPL_STRING_IS_EMPTY, (mpl::string<>)); \ + typedef \ + mpl::string< \ + BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_DEC(n), C) \ + BOOST_PP_COMMA_IF(BOOST_PP_DEC(n)) \ + BOOST_MPL_MULTICHAR_POP_BACK(BOOST_PP_CAT(C,BOOST_PP_DEC(n))) \ + > \ + type; \ + }; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_PP_INC(BOOST_MPL_STRING_MAX_PARAMS), M0, ~) + #undef M0 + }; + + template + struct push_front_impl; + + template<> + struct push_front_impl + { + template + struct apply + { + BOOST_MPL_ASSERT_MSG( + (BOOST_MPL_LIMIT_STRING_SIZE != mpl::size::type::value) + , PUSH_FRONT_FAILED_MPL_STRING_IS_FULL + , (Sequence) + ); + // If the above assertion didn't fire, then the string is sparse. + // Repack the string and retry the push_front. + typedef + typename mpl::push_front< + typename mpl::reverse_copy< + Sequence + , mpl::front_inserter > + >::type + , Value + >::type + type; + }; + + #if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) + template + struct apply, Value, false> + { + typedef mpl::string<(char)Value::value> type; + }; + #endif + + #define M0(z,n,data) \ + template \ + struct apply, Value, true> \ + { \ + typedef \ + mpl::string< \ + (char)Value::value \ + BOOST_PP_ENUM_TRAILING_PARAMS_Z(z, n, C) \ + > \ + type; \ + }; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_MPL_STRING_MAX_PARAMS, M0, ~) + #undef M0 + + template + struct apply, Value, false> + { + typedef + mpl::string< + BOOST_MPL_MULTICHAR_PUSH_FRONT(C0, Value::value) + , BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C) + > + type0; + + #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) + typedef + typename mpl::if_< + mpl::empty > + , mpl::string<(char)Value::value> + , type0 + >::type + type; + #else + typedef type0 type; + #endif + }; + }; + + template + struct pop_front_impl; + + template<> + struct pop_front_impl + { + template + struct apply; + + #define M0(z,n,data) \ + template \ + struct apply, true> \ + { \ + BOOST_MPL_ASSERT_MSG((C0 != 0), POP_FRONT_FAILED_MPL_STRING_IS_EMPTY, (mpl::string<>)); \ + typedef \ + mpl::string \ + type; \ + }; + + BOOST_PP_REPEAT_FROM_TO(1, BOOST_MPL_STRING_MAX_PARAMS, M0, ~) + #undef M0 + + template + struct apply, false> + { + typedef + mpl::string< + BOOST_MPL_MULTICHAR_POP_FRONT(C0) + , BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_MPL_STRING_MAX_PARAMS, C) + > + type; + }; + }; + + template + struct insert_range_impl; + + template<> + struct insert_range_impl + { + template + struct apply + : mpl::copy< + mpl::joint_view< + mpl::iterator_range< + mpl::string_iterator + , Pos + > + , mpl::joint_view< + Range + , mpl::iterator_range< + Pos + , typename mpl::end::type + > + > + > + , mpl::back_inserter > + > + {}; + }; + + template + struct insert_impl; + + template<> + struct insert_impl + { + template + struct apply + : mpl::insert_range > + {}; + }; + + template + struct erase_impl; + + template<> + struct erase_impl + { + template + struct apply + : mpl::copy< + mpl::joint_view< + mpl::iterator_range< + mpl::string_iterator + , First + > + , mpl::iterator_range< + typename mpl::if_na::type>::type + , typename mpl::end::type + > + > + , mpl::back_inserter > + > + {}; + }; + + template + struct clear_impl; + + template<> + struct clear_impl + { + template + struct apply + { + typedef mpl::string<> type; + }; + }; + + #define M0(z, n, data) \ + template \ + struct string_iterator, n, J> \ + { \ + enum { eomc_ = (BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, n)) == J + 1) }; \ + typedef mpl::string string; \ + typedef std::bidirectional_iterator_tag category; \ + typedef \ + mpl::string_iterator \ + next; \ + typedef \ + mpl::string_iterator \ + prior; \ + typedef mpl::char_ type; \ + }; \ + template \ + struct string_iterator, n, 0> \ + { \ + enum { eomc_ = (BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, n)) == 1) }; \ + typedef mpl::string string; \ + typedef std::bidirectional_iterator_tag category; \ + typedef \ + mpl::string_iterator \ + next; \ + typedef \ + mpl::string_iterator< \ + string \ + , n - 1 \ + , BOOST_MPL_MULTICHAR_LENGTH(BOOST_PP_CAT(C, BOOST_PP_DEC(n))) - 1 \ + > \ + prior; \ + typedef mpl::char_ type; \ + }; + + BOOST_PP_REPEAT(BOOST_MPL_STRING_MAX_PARAMS, M0, ~) + #undef M0 + + template + struct string + { + /// INTERNAL ONLY + enum + { + front_ = C0 + , back_ = BOOST_PP_CAT(C, BOOST_PP_DEC(BOOST_MPL_STRING_MAX_PARAMS)) + }; + + typedef char value_type; + typedef string type; + typedef string_tag tag; + }; + + namespace aux_ + { + template + struct next_unless + : mpl::next + {}; + + template + struct next_unless + { + typedef End type; + }; + + template + struct deref_unless + : mpl::deref + {}; + + template + struct deref_unless + { + typedef mpl::char_<'\0'> type; + }; + } + + template + struct c_str + { + typedef typename mpl::end::type iend; + typedef typename mpl::begin::type i0; + #define M0(z, n, data) \ + typedef \ + typename mpl::aux_::next_unless::type \ + BOOST_PP_CAT(i, BOOST_PP_INC(n)); + BOOST_PP_REPEAT(BOOST_MPL_LIMIT_STRING_SIZE, M0, ~) + #undef M0 + + typedef c_str type; + static typename Sequence::value_type const value[BOOST_MPL_LIMIT_STRING_SIZE+1]; + }; + + template + typename Sequence::value_type const c_str::value[BOOST_MPL_LIMIT_STRING_SIZE+1] = + { + #define M0(z, n, data) \ + mpl::aux_::deref_unless::type::value, + BOOST_PP_REPEAT(BOOST_MPL_LIMIT_STRING_SIZE, M0, ~) + #undef M0 + '\0' + }; + +}} // namespace boost + +#endif // BOOST_MPL_STRING_HPP_INCLUDED diff --git a/boost/boost/operators.hpp b/boost/boost/operators.hpp index b3b1bd72a4..4b47ba40c1 100644 --- a/boost/boost/operators.hpp +++ b/boost/boost/operators.hpp @@ -8,6 +8,9 @@ // See http://www.boost.org/libs/utility/operators.htm for documentation. // Revision History +// 07 Aug 08 Added "euclidean" spelling. (Daniel Frey) +// 03 Apr 08 Make sure "convertible to bool" is sufficient +// for T::operator<, etc. (Daniel Frey) // 24 May 07 Changed empty_base to depend on T, see // http://svn.boost.org/trac/boost/ticket/979 // 21 Oct 02 Modified implementation of operators to allow compilers with a @@ -124,34 +127,34 @@ namespace boost template > struct less_than_comparable2 : B { - friend bool operator<=(const T& x, const U& y) { return !(x > y); } - friend bool operator>=(const T& x, const U& y) { return !(x < y); } + friend bool operator<=(const T& x, const U& y) { return !static_cast(x > y); } + friend bool operator>=(const T& x, const U& y) { return !static_cast(x < y); } friend bool operator>(const U& x, const T& y) { return y < x; } friend bool operator<(const U& x, const T& y) { return y > x; } - friend bool operator<=(const U& x, const T& y) { return !(y < x); } - friend bool operator>=(const U& x, const T& y) { return !(y > x); } + friend bool operator<=(const U& x, const T& y) { return !static_cast(y < x); } + friend bool operator>=(const U& x, const T& y) { return !static_cast(y > x); } }; template > struct less_than_comparable1 : B { friend bool operator>(const T& x, const T& y) { return y < x; } - friend bool operator<=(const T& x, const T& y) { return !(y < x); } - friend bool operator>=(const T& x, const T& y) { return !(x < y); } + friend bool operator<=(const T& x, const T& y) { return !static_cast(y < x); } + friend bool operator>=(const T& x, const T& y) { return !static_cast(x < y); } }; template > struct equality_comparable2 : B { friend bool operator==(const U& y, const T& x) { return x == y; } - friend bool operator!=(const U& y, const T& x) { return !(x == y); } - friend bool operator!=(const T& y, const U& x) { return !(y == x); } + friend bool operator!=(const U& y, const T& x) { return !static_cast(x == y); } + friend bool operator!=(const T& y, const U& x) { return !static_cast(y == x); } }; template > struct equality_comparable1 : B { - friend bool operator!=(const T& x, const T& y) { return !(x == y); } + friend bool operator!=(const T& x, const T& y) { return !static_cast(x == y); } }; // A macro which produces "name_2left" from "name". @@ -356,7 +359,7 @@ struct equivalent2 : B { friend bool operator==(const T& x, const U& y) { - return !(x < y) && !(x > y); + return !static_cast(x < y) && !static_cast(x > y); } }; @@ -365,7 +368,7 @@ struct equivalent1 : B { friend bool operator==(const T&x, const T&y) { - return !(x < y) && !(y < x); + return !static_cast(x < y) && !static_cast(y < x); } }; @@ -373,17 +376,17 @@ template > struct partially_ordered2 : B { friend bool operator<=(const T& x, const U& y) - { return (x < y) || (x == y); } + { return static_cast(x < y) || static_cast(x == y); } friend bool operator>=(const T& x, const U& y) - { return (x > y) || (x == y); } + { return static_cast(x > y) || static_cast(x == y); } friend bool operator>(const U& x, const T& y) { return y < x; } friend bool operator<(const U& x, const T& y) { return y > x; } friend bool operator<=(const U& x, const T& y) - { return (y > x) || (y == x); } + { return static_cast(y > x) || static_cast(y == x); } friend bool operator>=(const U& x, const T& y) - { return (y < x) || (y == x); } + { return static_cast(y < x) || static_cast(y == x); } }; template > @@ -392,9 +395,9 @@ struct partially_ordered1 : B friend bool operator>(const T& x, const T& y) { return y < x; } friend bool operator<=(const T& x, const T& y) - { return (x < y) || (x == y); } + { return static_cast(x < y) || static_cast(x == y); } friend bool operator>=(const T& x, const T& y) - { return (y < x) || (x == y); } + { return static_cast(y < x) || static_cast(x == y); } }; // Combined operator classes (contributed by Daryle Walker) ----------------// @@ -580,7 +583,35 @@ struct ordered_euclidian_ring_operators1 : totally_ordered1 > {}; - + +template > +struct euclidean_ring_operators2 + : ring_operators2 > > > > {}; + +template > +struct euclidean_ring_operators1 + : ring_operators1 > > {}; + +template > +struct ordered_euclidean_ring_operators2 + : totally_ordered2 > {}; + +template > +struct ordered_euclidean_ring_operators1 + : totally_ordered1 > {}; + template > struct input_iteratable : equality_comparable1 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost { - - //========================================================================= - // property_traits class - - template - struct property_traits { - typedef typename PA::key_type key_type; - typedef typename PA::value_type value_type; - typedef typename PA::reference reference; - typedef typename PA::category category; - }; - - //========================================================================= - // property_traits category tags - - namespace detail { - enum ePropertyMapID { READABLE_PA, WRITABLE_PA, - READ_WRITE_PA, LVALUE_PA, OP_BRACKET_PA, - RAND_ACCESS_ITER_PA, LAST_PA }; - } - struct readable_property_map_tag { enum { id = detail::READABLE_PA }; }; - struct writable_property_map_tag { enum { id = detail::WRITABLE_PA }; }; - struct read_write_property_map_tag : - public readable_property_map_tag, - public writable_property_map_tag - { enum { id = detail::READ_WRITE_PA }; }; - - struct lvalue_property_map_tag : public read_write_property_map_tag - { enum { id = detail::LVALUE_PA }; }; - - //========================================================================= - // property_traits specialization for pointers - -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - // The user will just have to create their own specializations for - // other pointers types if the compiler does not have partial - // specializations. Sorry! -#define BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(TYPE) \ - template <> \ - struct property_traits { \ - typedef TYPE value_type; \ - typedef value_type& reference; \ - typedef std::ptrdiff_t key_type; \ - typedef lvalue_property_map_tag category; \ - }; \ - template <> \ - struct property_traits { \ - typedef TYPE value_type; \ - typedef const value_type& reference; \ - typedef std::ptrdiff_t key_type; \ - typedef lvalue_property_map_tag category; \ - } - - BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(long); - BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned long); - BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(int); - BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned int); - BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(short); - BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned short); - BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(char); - BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(unsigned char); - BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(signed char); - BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(bool); - BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(float); - BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(double); - BOOST_SPECIALIZE_PROPERTY_TRAITS_PTR(long double); - - // This may need to be turned off for some older compilers that don't have - // wchar_t intrinsically. -# ifndef BOOST_NO_INTRINSIC_WCHAR_T - template <> - struct property_traits { - typedef wchar_t value_type; - typedef value_type& reference; - typedef std::ptrdiff_t key_type; - typedef lvalue_property_map_tag category; - }; - template <> - struct property_traits { - typedef wchar_t value_type; - typedef const value_type& reference; - typedef std::ptrdiff_t key_type; - typedef lvalue_property_map_tag category; - }; -# endif - -#else - template - struct property_traits { - typedef T value_type; - typedef value_type& reference; - typedef std::ptrdiff_t key_type; - typedef lvalue_property_map_tag category; - }; - template - struct property_traits { - typedef T value_type; - typedef const value_type& reference; - typedef std::ptrdiff_t key_type; - typedef lvalue_property_map_tag category; - }; +#if BOOST_VERSION >= 103800 +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +# pragma message ("Warning: This header is deprecated. Please use: boost/property_map/property_map.hpp") +#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) +# warning "This header is deprecated. Please use: boost/property_map/property_map.hpp" +#endif #endif -#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) - // MSVC doesn't have Koenig lookup, so the user has to - // do boost::get() anyways, and the using clause - // doesn't really work for MSVC. -} // namespace boost -#endif - - // These need to go in global namespace because Koenig - // lookup does not apply to T*. - - // V must be convertible to T - template - inline void put(T* pa, std::ptrdiff_t k, const V& val) { pa[k] = val; } - - template - inline const T& get(const T* pa, std::ptrdiff_t k) { return pa[k]; } - -#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) -namespace boost { - using ::put; - using ::get; -#endif - - //========================================================================= - // concept checks for property maps - - template - struct ReadablePropertyMapConcept - { - typedef typename property_traits::key_type key_type; - typedef typename property_traits::reference reference; - typedef typename property_traits::category Category; - typedef boost::readable_property_map_tag ReadableTag; - void constraints() { - function_requires< ConvertibleConcept >(); - - val = get(pmap, k); - } - PMap pmap; - Key k; - typename property_traits::value_type val; - }; - template - struct readable_property_map_archetype { - typedef KeyArchetype key_type; - typedef ValueArchetype value_type; - typedef convertible_to_archetype reference; - typedef readable_property_map_tag category; - }; - template - const typename readable_property_map_archetype::reference& - get(const readable_property_map_archetype&, - const typename readable_property_map_archetype::key_type&) - { - typedef typename readable_property_map_archetype::reference R; - return static_object::get(); - } - - - template - struct WritablePropertyMapConcept - { - typedef typename property_traits::key_type key_type; - typedef typename property_traits::category Category; - typedef boost::writable_property_map_tag WritableTag; - void constraints() { - function_requires< ConvertibleConcept >(); - put(pmap, k, val); - } - PMap pmap; - Key k; - typename property_traits::value_type val; - }; - template - struct writable_property_map_archetype { - typedef KeyArchetype key_type; - typedef ValueArchetype value_type; - typedef void reference; - typedef writable_property_map_tag category; - }; - template - void put(const writable_property_map_archetype&, - const typename writable_property_map_archetype::key_type&, - const typename writable_property_map_archetype::value_type&) { } - - - template - struct ReadWritePropertyMapConcept - { - typedef typename property_traits::category Category; - typedef boost::read_write_property_map_tag ReadWriteTag; - void constraints() { - function_requires< ReadablePropertyMapConcept >(); - function_requires< WritablePropertyMapConcept >(); - function_requires< ConvertibleConcept >(); - } - }; - template - struct read_write_property_map_archetype - : public readable_property_map_archetype, - public writable_property_map_archetype - { - typedef KeyArchetype key_type; - typedef ValueArchetype value_type; - typedef convertible_to_archetype reference; - typedef read_write_property_map_tag category; - }; - - - template - struct LvaluePropertyMapConcept - { - typedef typename property_traits::category Category; - typedef boost::lvalue_property_map_tag LvalueTag; - typedef typename property_traits::reference reference; - - void constraints() { - function_requires< ReadablePropertyMapConcept >(); - function_requires< ConvertibleConcept >(); - - typedef typename property_traits::value_type value_type; - BOOST_MPL_ASSERT((boost::mpl::or_< - boost::is_same, - boost::is_same >)); - - reference ref = pmap[k]; - ignore_unused_variable_warning(ref); - } - PMap pmap; - Key k; - }; - template - struct lvalue_property_map_archetype - : public readable_property_map_archetype - { - typedef KeyArchetype key_type; - typedef ValueArchetype value_type; - typedef const ValueArchetype& reference; - typedef lvalue_property_map_tag category; - const value_type& operator[](const key_type&) const { - return static_object::get(); - } - }; - - template - struct Mutable_LvaluePropertyMapConcept - { - typedef typename property_traits::category Category; - typedef boost::lvalue_property_map_tag LvalueTag; - typedef typename property_traits::reference reference; - void constraints() { - boost::function_requires< ReadWritePropertyMapConcept >(); - boost::function_requires >(); - - typedef typename property_traits::value_type value_type; - BOOST_MPL_ASSERT((boost::is_same)); - - reference ref = pmap[k]; - ignore_unused_variable_warning(ref); - } - PMap pmap; - Key k; - }; - template - struct mutable_lvalue_property_map_archetype - : public readable_property_map_archetype, - public writable_property_map_archetype - { - typedef KeyArchetype key_type; - typedef ValueArchetype value_type; - typedef ValueArchetype& reference; - typedef lvalue_property_map_tag category; - value_type& operator[](const key_type&) const { - return static_object::get(); - } - }; - - struct identity_property_map; - - // A helper class for constructing a property map - // from a class that implements operator[] - - template - struct put_get_helper { }; - - template - inline Reference - get(const put_get_helper& pa, const K& k) - { - Reference v = static_cast(pa)[k]; - return v; - } - template - inline void - put(const put_get_helper& pa, K k, const V& v) - { - static_cast(pa)[k] = v; - } - - //========================================================================= - // Adapter to turn a RandomAccessIterator into a property map - - template ::value_type - , class R = typename std::iterator_traits::reference -#endif - > - class iterator_property_map - : public boost::put_get_helper< R, - iterator_property_map > - { - public: - typedef typename property_traits::key_type key_type; - typedef T value_type; - typedef R reference; - typedef boost::lvalue_property_map_tag category; - - inline iterator_property_map( - RandomAccessIterator cc = RandomAccessIterator(), - const IndexMap& _id = IndexMap() ) - : iter(cc), index(_id) { } - inline R operator[](key_type v) const { return *(iter + get(index, v)) ; } - protected: - RandomAccessIterator iter; - IndexMap index; - }; - -#if !defined BOOST_NO_STD_ITERATOR_TRAITS - template - inline iterator_property_map< - RAIter, ID, - typename std::iterator_traits::value_type, - typename std::iterator_traits::reference> - make_iterator_property_map(RAIter iter, ID id) { - function_requires< RandomAccessIteratorConcept >(); - typedef iterator_property_map< - RAIter, ID, - typename std::iterator_traits::value_type, - typename std::iterator_traits::reference> PA; - return PA(iter, id); - } -#endif - template - inline iterator_property_map - make_iterator_property_map(RAIter iter, ID id, Value) { - function_requires< RandomAccessIteratorConcept >(); - typedef iterator_property_map PMap; - return PMap(iter, id); - } - - template ::value_type - , class R = typename std::iterator_traits::reference -#endif - > - class safe_iterator_property_map - : public boost::put_get_helper< R, - safe_iterator_property_map > - { - public: - typedef typename property_traits::key_type key_type; - typedef T value_type; - typedef R reference; - typedef boost::lvalue_property_map_tag category; - - inline safe_iterator_property_map( - RandomAccessIterator first, - std::size_t n_ = 0, - const IndexMap& _id = IndexMap() ) - : iter(first), n(n_), index(_id) { } - inline safe_iterator_property_map() { } - inline R operator[](key_type v) const { - assert(get(index, v) < n); - return *(iter + get(index, v)) ; - } - typename property_traits::value_type size() const { return n; } - protected: - RandomAccessIterator iter; - typename property_traits::value_type n; - IndexMap index; - }; - -#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template - inline safe_iterator_property_map< - RAIter, ID, - typename boost::detail::iterator_traits::value_type, - typename boost::detail::iterator_traits::reference> - make_safe_iterator_property_map(RAIter iter, std::size_t n, ID id) { - function_requires< RandomAccessIteratorConcept >(); - typedef safe_iterator_property_map< - RAIter, ID, - typename boost::detail::iterator_traits::value_type, - typename boost::detail::iterator_traits::reference> PA; - return PA(iter, n, id); - } -#endif - template - inline safe_iterator_property_map - make_safe_iterator_property_map(RAIter iter, std::size_t n, ID id, Value) { - function_requires< RandomAccessIteratorConcept >(); - typedef safe_iterator_property_map PMap; - return PMap(iter, n, id); - } - - //========================================================================= - // An adaptor to turn a Unique Pair Associative Container like std::map or - // std::hash_map into an Lvalue Property Map. - - template - class associative_property_map - : public boost::put_get_helper< - typename UniquePairAssociativeContainer::value_type::second_type&, - associative_property_map > - { - typedef UniquePairAssociativeContainer C; - public: - typedef typename C::key_type key_type; - typedef typename C::value_type::second_type value_type; - typedef value_type& reference; - typedef lvalue_property_map_tag category; - associative_property_map() : m_c(0) { } - associative_property_map(C& c) : m_c(&c) { } - reference operator[](const key_type& k) const { - return (*m_c)[k]; - } - private: - C* m_c; - }; - - template - associative_property_map - make_assoc_property_map(UniquePairAssociativeContainer& c) - { - return associative_property_map(c); - } - - template - class const_associative_property_map - : public boost::put_get_helper< - const typename UniquePairAssociativeContainer::value_type::second_type&, - const_associative_property_map > - { - typedef UniquePairAssociativeContainer C; - public: - typedef typename C::key_type key_type; - typedef typename C::value_type::second_type value_type; - typedef const value_type& reference; - typedef lvalue_property_map_tag category; - const_associative_property_map() : m_c(0) { } - const_associative_property_map(const C& c) : m_c(&c) { } - reference operator[](const key_type& k) const { - return m_c->find(k)->second; - } - private: - C const* m_c; - }; - - template - const_associative_property_map - make_assoc_property_map(const UniquePairAssociativeContainer& c) - { - return const_associative_property_map(c); - } - - //========================================================================= - // A property map that always returns a reference to the same object. - // -template -class ref_property_map : - public - boost::put_get_helper > -{ - ValueType* value; -public: - typedef KeyType key_type; - typedef ValueType value_type; - typedef ValueType& reference; - typedef lvalue_property_map_tag category; - ref_property_map(ValueType& v) : value(&v) {} - ValueType& operator[](key_type const&) const { return *value; } - -}; - - - //========================================================================= - // A property map that applies the identity function to integers - struct identity_property_map - : public boost::put_get_helper - { - typedef std::size_t key_type; - typedef std::size_t value_type; - typedef std::size_t reference; - typedef boost::readable_property_map_tag category; - - inline value_type operator[](const key_type& v) const { return v; } - }; - - //========================================================================= - // A property map that does not do anything, for - // when you have to supply a property map, but don't need it. - namespace detail { - struct dummy_pmap_reference { - template - dummy_pmap_reference& operator=(const T&) { return *this; } - operator int() { return 0; } - }; - } - class dummy_property_map - : public boost::put_get_helper - { - public: - typedef void key_type; - typedef int value_type; - typedef detail::dummy_pmap_reference reference; - typedef boost::read_write_property_map_tag category; - inline dummy_property_map() : c(0) { } - inline dummy_property_map(value_type cc) : c(cc) { } - inline dummy_property_map(const dummy_property_map& x) - : c(x.c) { } - template - inline reference operator[](Vertex) const { return reference(); } - protected: - value_type c; - }; - - -} // namespace boost - - -#endif /* BOOST_PROPERTY_MAP_HPP */ - +#include diff --git a/boost/boost/property_map_iterator.hpp b/boost/boost/property_map_iterator.hpp index 9874cbf4ad..30799712fa 100644 --- a/boost/boost/property_map_iterator.hpp +++ b/boost/boost/property_map_iterator.hpp @@ -1,113 +1,19 @@ -// (C) Copyright Jeremy Siek, 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) +/*============================================================================= +Copyright (c) 2009 Trustees of Indiana University -// See http://www.boost.org/libs/property_map for documentation. +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) +=============================================================================*/ +// Redirect/warning header, adapted from the version in Spirit -#ifndef BOOST_PROPERTY_MAP_ITERATOR_HPP -#define BOOST_PROPERTY_MAP_ITERATOR_HPP +#include -#include -#include -#include -#include - -namespace boost { - - //====================================================================== - // property iterator, generalized from ideas by François Faure - - namespace detail { - - template - class lvalue_pmap_iter - : public iterator_adaptor< lvalue_pmap_iter< Iterator, LvaluePropertyMap >, - Iterator, - typename property_traits::value_type, - use_default, - typename property_traits::reference> - { - friend class boost::iterator_core_access; - - typedef iterator_adaptor< lvalue_pmap_iter< Iterator, LvaluePropertyMap >, - Iterator, - typename property_traits::value_type, - use_default, - typename property_traits::reference> super_t; - - public: - lvalue_pmap_iter() { } - lvalue_pmap_iter(Iterator const& it, - LvaluePropertyMap m) - : super_t(it), - m_map(m) {} - - private: - typename super_t::reference - dereference() const - { - return m_map[*(this->base_reference())]; - } - - LvaluePropertyMap m_map; - }; - - template - class readable_pmap_iter : - public iterator_adaptor< readable_pmap_iter< Iterator, ReadablePropertyMap >, - Iterator, - typename property_traits::value_type, - use_default, - typename property_traits::value_type> - - - { - friend class boost::iterator_core_access; - - typedef iterator_adaptor< readable_pmap_iter< Iterator, ReadablePropertyMap >, - Iterator, - typename property_traits::value_type, - use_default, - typename property_traits::value_type> super_t; - - public: - readable_pmap_iter() { } - readable_pmap_iter(Iterator const& it, - ReadablePropertyMap m) - : super_t(it), - m_map(m) {} - - private: - typename super_t::reference - dereference() const - { - return get(m_map, *(this->base_reference())); - } - - ReadablePropertyMap m_map; - }; - - - } // namespace detail - - template - struct property_map_iterator_generator : - mpl::if_< is_same< typename property_traits::category, lvalue_property_map_tag>, - detail::lvalue_pmap_iter, - detail::readable_pmap_iter > - {}; - - template - typename property_map_iterator_generator::type - make_property_map_iterator(PropertyMap pmap, Iterator iter) - { - typedef typename property_map_iterator_generator::type Iter; - return Iter(iter, pmap); - } - -} // namespace boost - -#endif // BOOST_PROPERTY_MAP_ITERATOR_HPP +#if BOOST_VERSION >= 103800 +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__) +# pragma message ("Warning: This header is deprecated. Please use: boost/property_map/property_map_iterator.hpp") +#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__) +# warning "This header is deprecated. Please use: boost/property_map/property_map_iterator.hpp" +#endif +#endif +#include diff --git a/boost/boost/ref.hpp b/boost/boost/ref.hpp index 0d747bd1b6..6058d69831 100644 --- a/boost/boost/ref.hpp +++ b/boost/boost/ref.hpp @@ -173,6 +173,12 @@ class unwrap_reference # endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template inline typename unwrap_reference::type& +unwrap_ref(T& t) +{ + return t; +} + template inline T* get_pointer( reference_wrapper const & r ) { return r.get_pointer(); diff --git a/boost/boost/regex/concepts.hpp b/boost/boost/regex/concepts.hpp index d30dae5f5a..00a38ab3f1 100644 --- a/boost/boost/regex/concepts.hpp +++ b/boost/boost/regex/concepts.hpp @@ -844,6 +844,42 @@ struct BoostRegexConcept m_string = m_char + m_sub; ignore_unused_variable_warning(m_string); + // Named sub-expressions: + m_sub = m_cresults[&m_char]; + ignore_unused_variable_warning(m_sub); + m_sub = m_cresults[m_string]; + ignore_unused_variable_warning(m_sub); + m_sub = m_cresults[""]; + ignore_unused_variable_warning(m_sub); + m_sub = m_cresults[std::string("")]; + ignore_unused_variable_warning(m_sub); + m_string = m_cresults.str(&m_char); + ignore_unused_variable_warning(m_string); + m_string = m_cresults.str(m_string); + ignore_unused_variable_warning(m_string); + m_string = m_cresults.str(""); + ignore_unused_variable_warning(m_string); + m_string = m_cresults.str(std::string("")); + ignore_unused_variable_warning(m_string); + + typename match_results_type::difference_type diff; + diff = m_cresults.length(&m_char); + ignore_unused_variable_warning(diff); + diff = m_cresults.length(m_string); + ignore_unused_variable_warning(diff); + diff = m_cresults.length(""); + ignore_unused_variable_warning(diff); + diff = m_cresults.length(std::string("")); + ignore_unused_variable_warning(diff); + diff = m_cresults.position(&m_char); + ignore_unused_variable_warning(diff); + diff = m_cresults.position(m_string); + ignore_unused_variable_warning(diff); + diff = m_cresults.position(""); + ignore_unused_variable_warning(diff); + diff = m_cresults.position(std::string("")); + ignore_unused_variable_warning(diff); + #ifndef BOOST_NO_STD_LOCALE m_stream << m_sub; m_stream << m_cresults; diff --git a/boost/boost/regex/config.hpp b/boost/boost/regex/config.hpp index 8c8f5248fb..8306f3ff9a 100644 --- a/boost/boost/regex/config.hpp +++ b/boost/boost/regex/config.hpp @@ -164,7 +164,7 @@ # pragma warning(push) # pragma warning(disable : 4251 4231 4660) # endif -# ifdef _DLL +# if defined(_DLL) && defined(BOOST_MSVC) && (BOOST_MSVC < 1600) # include extern template class __declspec(dllimport) std::basic_string; # endif diff --git a/boost/boost/regex/icu.hpp b/boost/boost/regex/icu.hpp index 601d03e168..622ddc2275 100644 --- a/boost/boost/regex/icu.hpp +++ b/boost/boost/regex/icu.hpp @@ -184,7 +184,9 @@ private: offset_underscore = U_CHAR_CATEGORY_COUNT+3, offset_unicode = U_CHAR_CATEGORY_COUNT+4, offset_any = U_CHAR_CATEGORY_COUNT+5, - offset_ascii = U_CHAR_CATEGORY_COUNT+6 + offset_ascii = U_CHAR_CATEGORY_COUNT+6, + offset_horizontal = U_CHAR_CATEGORY_COUNT+7, + offset_vertical = U_CHAR_CATEGORY_COUNT+8 }; // @@ -197,6 +199,8 @@ private: static const char_class_type mask_unicode; static const char_class_type mask_any; static const char_class_type mask_ascii; + static const char_class_type mask_horizontal; + static const char_class_type mask_vertical; static char_class_type lookup_icu_mask(const ::UChar32* p1, const ::UChar32* p2); @@ -311,12 +315,12 @@ inline u32regex do_make_u32regex(InputIterator i, boost::regex_constants::syntax_option_type opt, const boost::mpl::int_<4>*) { - typedef std::vector vector_type; + typedef std::vector vector_type; vector_type v; while(i != j) { - v.push_back((UCHAR32)(*i)); - ++a; + v.push_back((UChar32)(*i)); + ++i; } if(v.size()) return u32regex(&*v.begin(), v.size(), opt); diff --git a/boost/boost/regex/v4/basic_regex.hpp b/boost/boost/regex/v4/basic_regex.hpp index cb9ff3c51c..09b0467b40 100644 --- a/boost/boost/regex/v4/basic_regex.hpp +++ b/boost/boost/regex/v4/basic_regex.hpp @@ -19,6 +19,9 @@ #ifndef BOOST_REGEX_V4_BASIC_REGEX_HPP #define BOOST_REGEX_V4_BASIC_REGEX_HPP +#include +#include + #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4103) @@ -44,12 +47,160 @@ namespace re_detail{ template class basic_regex_parser; +template +void bubble_down_one(I first, I last) +{ + if(first != last) + { + I next = last - 1; + while((next != first) && !(*(next-1) < *next)) + { + (next-1)->swap(*next); + --next; + } + } +} + +// +// Class named_subexpressions +// Contains information about named subexpressions within the regex. +// +template +class named_subexpressions_base +{ +public: + virtual int get_id(const charT* i, const charT* j)const = 0; + virtual int get_id(std::size_t hash)const = 0; +#ifdef __GNUC__ + // warning supression: + virtual ~named_subexpressions_base(){} +#endif +}; + +template +inline std::size_t hash_value_from_capture_name(Iterator i, Iterator j) +{ + std::size_t r = boost::hash_range(i, j); + r %= ((std::numeric_limits::max)() - 10001); + r += 10000; + return r; +} + +template +class named_subexpressions : public named_subexpressions_base +{ + struct name + { + name(const charT* i, const charT* j, int idx) + : /*n(i, j), */ index(idx) + { + hash = hash_value_from_capture_name(i, j); + } + name(std::size_t h, int idx) + : index(idx), hash(h) + { + } + //std::vector n; + int index; + std::size_t hash; + bool operator < (const name& other)const + { + return hash < other.hash; //std::lexicographical_compare(n.begin(), n.end(), other.n.begin(), other.n.end()); + } + bool operator == (const name& other)const + { + return hash == other.hash; //n == other.n; + } + void swap(name& other) + { + //n.swap(other.n); + std::swap(index, other.index); + std::swap(hash, other.hash); + } + }; +public: + named_subexpressions(){} + void set_name(const charT* i, const charT* j, int index) + { + m_sub_names.push_back(name(i, j, index)); + bubble_down_one(m_sub_names.begin(), m_sub_names.end()); + } + int get_id(const charT* i, const charT* j)const + { + name t(i, j, 0); + typename std::vector::const_iterator pos = std::lower_bound(m_sub_names.begin(), m_sub_names.end(), t); + if((pos != m_sub_names.end()) && (*pos == t)) + { + return pos->index; + } + return -1; + } + int get_id(std::size_t h)const + { + name t(h, 0); + typename std::vector::const_iterator pos = std::lower_bound(m_sub_names.begin(), m_sub_names.end(), t); + if((pos != m_sub_names.end()) && (*pos == t)) + { + return pos->index; + } + return -1; + } +private: + std::vector m_sub_names; +}; + +template +class named_subexpressions_converter : public named_subexpressions_base +{ + boost::shared_ptr > m_converter; +public: + named_subexpressions_converter(boost::shared_ptr > s) + : m_converter(s) {} + int get_id(const charT* i, const charT* j)const + { + if(i == j) + return -1; + std::vector v; + while(i != j) + { + v.push_back(*i); + ++i; + } + return m_converter->get_id(&v[0], &v[0] + v.size()); + } + int get_id(std::size_t h)const + { + return m_converter->get_id(h); + } +}; + +template +inline boost::shared_ptr > convert_to_named_subs_imp( + boost::shared_ptr > s, + boost::integral_constant const&) +{ + return s; +} +template +inline boost::shared_ptr > convert_to_named_subs_imp( + boost::shared_ptr > s, + boost::integral_constant const&) +{ + return boost::shared_ptr >(new named_subexpressions_converter(s)); +} +template +inline boost::shared_ptr > convert_to_named_subs( + boost::shared_ptr > s) +{ + typedef typename boost::is_same::type tag_type; + return convert_to_named_subs_imp(s, tag_type()); +} // // class regex_data: // represents the data we wish to expose to the matching algorithms. // template -struct regex_data +struct regex_data : public named_subexpressions { typedef regex_constants::syntax_option_type flag_type; typedef std::size_t size_type; @@ -77,6 +228,7 @@ struct regex_data std::vector< std::pair< std::size_t, std::size_t> > m_subs; // Position of sub-expressions within the *string*. + bool m_has_recursions; // whether we have recursive expressions; }; // // class basic_regex_implementation @@ -520,6 +672,10 @@ public: BOOST_ASSERT(0 != m_pimpl.get()); return m_pimpl->get_data(); } + boost::shared_ptr > get_named_subs()const + { + return m_pimpl; + } private: shared_ptr > m_pimpl; diff --git a/boost/boost/regex/v4/basic_regex_creator.hpp b/boost/boost/regex/v4/basic_regex_creator.hpp index 9f2cbeec92..6f0050542d 100644 --- a/boost/boost/regex/v4/basic_regex_creator.hpp +++ b/boost/boost/regex/v4/basic_regex_creator.hpp @@ -240,6 +240,7 @@ protected: 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; + bool m_has_recursions; // set when we have recursive expresisons to fixup 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 @@ -250,6 +251,7 @@ private: basic_regex_creator(const basic_regex_creator&); void fixup_pointers(re_syntax_base* state); + void fixup_recursions(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); @@ -263,7 +265,7 @@ private: template basic_regex_creator::basic_regex_creator(regex_data* 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(data), m_traits(*(data->m_ptraits)), m_last_state(0), m_repeater_id(0), m_has_backrefs(false), m_backrefs(0), m_has_recursions(false) { m_pdata->m_data.clear(); m_pdata->m_status = ::boost::regex_constants::error_ok; @@ -692,6 +694,13 @@ void basic_regex_creator::finalize(const charT* p1, const charT* m_pdata->m_first_state = static_cast(m_pdata->m_data.data()); // fixup pointers in the machine: fixup_pointers(m_pdata->m_first_state); + if(m_has_recursions) + { + m_pdata->m_has_recursions = true; + fixup_recursions(m_pdata->m_first_state); + } + else + m_pdata->m_has_recursions = false; // create nested startmaps: create_startmaps(m_pdata->m_first_state); // create main startmap: @@ -713,6 +722,13 @@ void basic_regex_creator::fixup_pointers(re_syntax_base* state) { switch(state->type) { + case syntax_element_recurse: + m_has_recursions = true; + if(state->next.i) + state->next.p = getaddress(state->next.i, state); + else + state->next.p = 0; + break; case syntax_element_rep: case syntax_element_dot_rep: case syntax_element_char_rep: @@ -738,6 +754,93 @@ void basic_regex_creator::fixup_pointers(re_syntax_base* state) } } +template +void basic_regex_creator::fixup_recursions(re_syntax_base* state) +{ + re_syntax_base* base = state; + while(state) + { + switch(state->type) + { + case syntax_element_assert_backref: + { + // just check that the index is valid: + int id = static_cast(state)->index; + if(id < 0) + { + id = -id-1; + if(id >= 10000) + { + id = m_pdata->get_id(id); + if(id <= 0) + { + // check of sub-expression that doesn't exist: + 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(); + } + } + } + } + } + break; + case syntax_element_recurse: + { + bool ok = false; + re_syntax_base* p = base; + int id = static_cast(state)->alt.i; + if(id > 10000) + id = m_pdata->get_id(id); + while(p) + { + if((p->type == syntax_element_startmark) && (static_cast(p)->index == id)) + { + static_cast(state)->alt.p = p; + ok = true; + break; + } + p = p->next.p; + } + if(!ok) + { + // recursion to sub-expression that doesn't exist: + 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(); + } + } + } + default: + break; + } + state = state->next.p; + } +} + template void basic_regex_creator::create_startmaps(re_syntax_base* state) { @@ -953,6 +1056,7 @@ void basic_regex_creator::create_startmap(re_syntax_base* state, create_startmap(state->next.p, 0, pnull, mask); return; } + case syntax_element_recurse: case syntax_element_backref: // can be null, and any character can match: if(pnull) diff --git a/boost/boost/regex/v4/basic_regex_parser.hpp b/boost/boost/regex/v4/basic_regex_parser.hpp index b8bc99630d..7d2f5543e2 100644 --- a/boost/boost/regex/v4/basic_regex_parser.hpp +++ b/boost/boost/regex/v4/basic_regex_parser.hpp @@ -78,6 +78,8 @@ private: 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 + int m_mark_reset; // used to indicate that we're inside a (?|...) block. + unsigned m_max_mark; // largest mark count seen inside a (?|...) block. 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 @@ -96,7 +98,7 @@ private: template basic_regex_parser::basic_regex_parser(regex_data* data) - : basic_regex_creator(data), m_mark_count(0), m_paren_start(0), m_alt_insert_point(0), m_has_case_change(false) + : basic_regex_creator(data), m_mark_count(0), m_mark_reset(-1), m_max_mark(0), m_paren_start(0), m_alt_insert_point(0), m_has_case_change(false) { } @@ -123,8 +125,16 @@ void basic_regex_parser::parse(const charT* p1, const charT* p2, switch(l_flags & regbase::main_option_type) { case regbase::perl_syntax_group: - m_parser_proc = &basic_regex_parser::parse_extended; - break; + { + m_parser_proc = &basic_regex_parser::parse_extended; + // + // Add a leading paren with index zero to give recursions a target: + // + re_brace* br = static_cast(this->append_state(syntax_element_startmark, sizeof(re_brace))); + br->index = 0; + br->icase = this->flags() & regbase::icase; + break; + } case regbase::basic_syntax_group: m_parser_proc = &basic_regex_parser::parse_basic; break; @@ -375,11 +385,17 @@ bool basic_regex_parser::parse_open_paren() if(0 == (this->flags() & regbase::nosubs)) { markid = ++m_mark_count; +#ifndef BOOST_NO_STD_DISTANCE if(this->flags() & regbase::save_subexpression_location) this->m_pdata->m_subs.push_back(std::pair(std::distance(m_base, m_position) - 1, 0)); +#else + if(this->flags() & regbase::save_subexpression_location) + this->m_pdata->m_subs.push_back(std::pair((m_position - m_base) - 1, 0)); +#endif } re_brace* pb = static_cast(this->append_state(syntax_element_startmark, sizeof(re_brace))); pb->index = markid; + pb->icase = this->flags() & regbase::icase; 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; @@ -392,6 +408,11 @@ bool basic_regex_parser::parse_open_paren() bool old_case_change = m_has_case_change; m_has_case_change = false; // no changes to this scope as yet... // + // Back up branch reset data in case we have a nested (?|...) + // + int mark_reset = m_mark_reset; + m_mark_reset = -1; + // // now recursively add more states, this will terminate when we get to a // matching ')' : // @@ -416,6 +437,10 @@ bool basic_regex_parser::parse_open_paren() this->flags(opts); m_has_case_change = old_case_change; // + // restore branch reset: + // + m_mark_reset = mark_reset; + // // we either have a ')' or we have run out of characters prematurely: // if(m_position == m_end) @@ -424,14 +449,20 @@ bool basic_regex_parser::parse_open_paren() return false; } BOOST_ASSERT(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_mark); +#ifndef BOOST_NO_STD_DISTANCE if(markid && (this->flags() & regbase::save_subexpression_location)) this->m_pdata->m_subs.at(markid - 1).second = std::distance(m_base, m_position); +#else + if(markid && (this->flags() & regbase::save_subexpression_location)) + this->m_pdata->m_subs.at(markid - 1).second = (m_position - m_base); +#endif ++m_position; // // append closing parenthesis state: // pb = static_cast(this->append_state(syntax_element_endmark, sizeof(re_brace))); pb->index = markid; + pb->icase = this->flags() & regbase::icase; this->m_paren_start = last_paren_start; // // restore the alternate insertion point: @@ -600,6 +631,7 @@ bool basic_regex_parser::parse_extended_escape() // fall through: case regex_constants::escape_type_class: { +escape_type_class_jump: typedef typename traits::char_class_type mask_type; mask_type m = this->m_traits.lookup_classname(m_position, m_position+1); if(m != 0) @@ -709,7 +741,104 @@ bool basic_regex_parser::parse_extended_escape() return true; } fail(regex_constants::error_ctype, m_position - m_base); + return false; } + case regex_constants::escape_type_reset_start_mark: + if(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex))) + { + re_brace* pb = static_cast(this->append_state(syntax_element_startmark, sizeof(re_brace))); + pb->index = -5; + pb->icase = this->flags() & regbase::icase; + this->m_pdata->m_data.align(); + ++m_position; + return true; + } + goto escape_type_class_jump; + case regex_constants::escape_type_line_ending: + if(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex))) + { + const charT* e = get_escape_R_string(); + const charT* old_position = m_position; + const charT* old_end = m_end; + const charT* old_base = m_base; + m_position = e; + m_base = e; + m_end = e + traits::length(e); + bool r = parse_all(); + m_position = ++old_position; + m_end = old_end; + m_base = old_base; + return r; + } + goto escape_type_class_jump; + case regex_constants::escape_type_extended_backref: + if(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex))) + { + bool have_brace = false; + bool negative = false; + if(++m_position == m_end) + { + fail(regex_constants::error_escape, m_position - m_base); + return false; + } + // maybe have \g{ddd} + if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_open_brace) + { + if(++m_position == m_end) + { + fail(regex_constants::error_escape, m_position - m_base); + return false; + } + have_brace = true; + } + negative = (*m_position == static_cast('-')); + if((negative) && (++m_position == m_end)) + { + fail(regex_constants::error_escape, m_position - m_base); + return false; + } + const charT* pc = m_position; + int i = this->m_traits.toi(pc, m_end, 10); + if(i < 0) + { + // Check for a named capture: + const charT* base = m_position; + while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace)) + ++m_position; + i = this->m_pdata->get_id(base, m_position); + pc = m_position; + } + if(negative) + i = 1 + m_mark_count - i; + if((i > 0) && (this->m_backrefs & (1u << (i-1)))) + { + m_position = pc; + re_brace* pb = static_cast(this->append_state(syntax_element_backref, sizeof(re_brace))); + pb->index = i; + pb->icase = this->flags() & regbase::icase; + } + else + { + fail(regex_constants::error_backref, m_position - m_end); + return false; + } + m_position = pc; + if(have_brace) + { + if((m_position == m_end) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace)) + { + fail(regex_constants::error_escape, m_position - m_base); + return false; + } + ++m_position; + } + return true; + } + goto escape_type_class_jump; + case regex_constants::escape_type_control_v: + if(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex))) + goto escape_type_class_jump; + // fallthrough: default: this->append_literal(unescape_character()); break; @@ -737,6 +866,7 @@ template bool basic_regex_parser::parse_repeat(std::size_t low, std::size_t high) { bool greedy = true; + bool pocessive = false; std::size_t insert_point; // // when we get to here we may have a non-greedy ? mark still to come: @@ -748,12 +878,19 @@ bool basic_regex_parser::parse_repeat(std::size_t low, std::size_ ) ) { - // OK we have a perl regex, check for a '?': + // OK we have a perl or emacs regex, check for a '?': if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_question) { greedy = false; ++m_position; } + // for perl regexes only check for pocessive ++ repeats. + if((0 == (this->flags() & regbase::main_option_type)) + && (this->m_traits.syntax_type(*m_position) == regex_constants::syntax_plus)) + { + pocessive = true; + ++m_position; + } } if(0 == this->m_last_state) { @@ -822,6 +959,22 @@ bool basic_regex_parser::parse_repeat(std::size_t low, std::size_ // now fill in the alt jump for the repeat: rep = static_cast(this->getaddress(rep_off)); rep->alt.i = this->m_pdata->m_data.size() - rep_off; + // + // If the repeat is pocessive then bracket the repeat with a (?>...) + // independent sub-expression construct: + // + if(pocessive) + { + re_brace* pb = static_cast(this->insert_state(insert_point, syntax_element_startmark, sizeof(re_brace))); + pb->index = -3; + pb->icase = this->flags() & regbase::icase; + re_jump* jmp = static_cast(this->insert_state(insert_point + sizeof(re_brace), syntax_element_jump, sizeof(re_jump))); + this->m_pdata->m_data.align(); + jmp->alt.i = this->m_pdata->m_data.size() - this->getoffset(jmp); + pb = static_cast(this->append_state(syntax_element_endmark, sizeof(re_brace))); + pb->index = -3; + pb->icase = this->flags() & regbase::icase; + } return true; } @@ -944,6 +1097,14 @@ bool basic_regex_parser::parse_alt() fail(regex_constants::error_empty, this->m_position - this->m_base); return false; } + // + // Reset mark count if required: + // + if(m_max_mark < m_mark_count) + m_max_mark = m_mark_count; + if(m_mark_reset >= 0) + m_mark_count = m_mark_reset; + ++m_position; // // we need to append a trailing jump: @@ -1462,7 +1623,7 @@ charT basic_regex_parser::unescape_character() int i = this->m_traits.toi(m_position, m_end, 16); if((m_position == m_end) || (i < 0) - || ((std::numeric_limits::is_specialized) && (charT(i) > (std::numeric_limits::max)())) + || ((std::numeric_limits::is_specialized) && (i > (int)(std::numeric_limits::max)())) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace)) { fail(regex_constants::error_badbrace, m_position - m_base); @@ -1568,6 +1729,7 @@ bool basic_regex_parser::parse_backref() m_position = pc; re_brace* pb = static_cast(this->append_state(syntax_element_backref, sizeof(re_brace))); pb->index = i; + pb->icase = this->flags() & regbase::icase; } else { @@ -1655,6 +1817,7 @@ bool basic_regex_parser::parse_perl_extension() int markid = 0; std::ptrdiff_t jump_offset = 0; re_brace* pb = static_cast(this->append_state(syntax_element_startmark, sizeof(re_brace))); + pb->icase = this->flags() & regbase::icase; 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; @@ -1665,11 +1828,18 @@ bool basic_regex_parser::parse_perl_extension() regex_constants::syntax_option_type old_flags = this->flags(); bool old_case_change = m_has_case_change; m_has_case_change = false; + charT name_delim; + int mark_reset = m_mark_reset; + m_mark_reset = -1; + int v; // // select the actual extension used: // switch(this->m_traits.syntax_type(*m_position)) { + case regex_constants::syntax_or: + m_mark_reset = m_mark_count; + // fall through: case regex_constants::syntax_colon: // // a non-capturing mark: @@ -1677,6 +1847,57 @@ bool basic_regex_parser::parse_perl_extension() pb->index = markid = 0; ++m_position; break; + case regex_constants::syntax_digit: + { + // + // a recursive subexpression: + // + v = this->m_traits.toi(m_position, m_end, 10); + if((v < 0) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) + { + fail(regex_constants::error_backref, m_position - m_base); + return false; + } +insert_recursion: + pb->index = markid = 0; + static_cast(this->append_state(syntax_element_recurse, sizeof(re_jump)))->alt.i = v; + static_cast( + this->append_state(syntax_element_toggle_case, sizeof(re_case)) + )->icase = this->flags() & regbase::icase; + break; + } + case regex_constants::syntax_plus: + // + // A forward-relative recursive subexpression: + // + ++m_position; + v = this->m_traits.toi(m_position, m_end, 10); + if((v <= 0) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) + { + fail(regex_constants::error_backref, m_position - m_base); + return false; + } + v += m_mark_count; + goto insert_recursion; + case regex_constants::syntax_dash: + // + // Possibly a backward-relative recursive subexpression: + // + ++m_position; + v = this->m_traits.toi(m_position, m_end, 10); + if(v <= 0) + { + --m_position; + // Oops not a relative recursion at all, but a (?-imsx) group: + goto option_group_jump; + } + v = m_mark_count + 1 - v; + if(v <= 0) + { + fail(regex_constants::error_backref, m_position - m_base); + return false; + } + goto insert_recursion; case regex_constants::syntax_equal: pb->index = markid = -1; ++m_position; @@ -1706,8 +1927,10 @@ bool basic_regex_parser::parse_perl_extension() pb->index = markid = -1; else { - fail(regex_constants::error_badrepeat, m_position - m_base); - return false; + // Probably a named capture which also starts (?< : + name_delim = '>'; + --m_position; + goto named_capture_jump; } ++m_position; jump_offset = this->getoffset(this->append_state(syntax_element_jump, sizeof(re_jump))); @@ -1736,7 +1959,95 @@ bool basic_regex_parser::parse_perl_extension() return false; } int v = this->m_traits.toi(m_position, m_end, 10); - if(v > 0) + if(*m_position == charT('R')) + { + if(++m_position == m_end) + { + fail(regex_constants::error_badrepeat, m_position - m_base); + return false; + } + if(*m_position == charT('&')) + { + const charT* base = ++m_position; + while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) + ++m_position; + if(m_position == m_end) + { + fail(regex_constants::error_badrepeat, m_position - m_base); + return false; + } + v = -static_cast(hash_value_from_capture_name(base, m_position)); + } + else + { + v = -this->m_traits.toi(m_position, m_end, 10); + } + re_brace* br = static_cast(this->append_state(syntax_element_assert_backref, sizeof(re_brace))); + br->index = v < 0 ? (v - 1) : 0; + 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 if((*m_position == charT('\'')) || (*m_position == charT('<'))) + { + const charT* base = ++m_position; + while((m_position != m_end) && (*m_position != charT('>')) && (*m_position != charT('\''))) + ++m_position; + if(m_position == m_end) + { + fail(regex_constants::error_badrepeat, m_position - m_base); + return false; + } + v = static_cast(hash_value_from_capture_name(base, m_position)); + re_brace* br = static_cast(this->append_state(syntax_element_assert_backref, sizeof(re_brace))); + br->index = v; + if((*m_position != charT('>')) && (*m_position != charT('\'')) || (++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_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 if(*m_position == charT('D')) + { + const char* def = "DEFINE"; + while(*def && (m_position != m_end) && (*m_position == charT(*def))) + ++m_position, ++def; + if((m_position == m_end) || *def) + { + fail(regex_constants::error_badrepeat, m_position - m_base); + return false; + } + re_brace* br = static_cast(this->append_state(syntax_element_assert_backref, sizeof(re_brace))); + br->index = 9999; // special magic value! + 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 if(v > 0) { re_brace* br = static_cast(this->append_state(syntax_element_assert_backref, sizeof(re_brace))); br->index = v; @@ -1784,7 +2095,7 @@ bool basic_regex_parser::parse_perl_extension() 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); + fail(regex_constants::error_paren, m_position - m_base); return false; } m_position -= 2; @@ -1795,10 +2106,93 @@ bool basic_regex_parser::parse_perl_extension() case regex_constants::syntax_close_mark: fail(regex_constants::error_badrepeat, m_position - m_base); return false; + case regex_constants::escape_type_end_buffer: + { + name_delim = *m_position; +named_capture_jump: + markid = 0; + if(0 == (this->flags() & regbase::nosubs)) + { + markid = ++m_mark_count; + #ifndef BOOST_NO_STD_DISTANCE + if(this->flags() & regbase::save_subexpression_location) + this->m_pdata->m_subs.push_back(std::pair(std::distance(m_base, m_position) - 2, 0)); + #else + if(this->flags() & regbase::save_subexpression_location) + this->m_pdata->m_subs.push_back(std::pair((m_position - m_base) - 2, 0)); + #endif + } + pb->index = markid; + const charT* base = ++m_position; + if(m_position == m_end) + { + fail(regex_constants::error_paren, m_position - m_base); + return false; + } + while((m_position != m_end) && (*m_position != name_delim)) + ++m_position; + if(m_position == m_end) + { + fail(regex_constants::error_paren, m_position - m_base); + return false; + } + this->m_pdata->set_name(base, m_position, markid); + ++m_position; + break; + } default: + if(*m_position == charT('R')) + { + ++m_position; + v = 0; + if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark) + { + fail(regex_constants::error_backref, m_position - m_base); + return false; + } + goto insert_recursion; + } + if(*m_position == charT('&')) + { + ++m_position; + const charT* base = m_position; + while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) + ++m_position; + if(m_position == m_end) + { + fail(regex_constants::error_backref, m_position - m_base); + return false; + } + v = static_cast(hash_value_from_capture_name(base, m_position)); + goto insert_recursion; + } + if(*m_position == charT('P')) + { + ++m_position; + if(m_position == m_end) + { + fail(regex_constants::error_backref, m_position - m_base); + return false; + } + if(*m_position == charT('>')) + { + ++m_position; + const charT* base = m_position; + while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) + ++m_position; + if(m_position == m_end) + { + fail(regex_constants::error_backref, m_position - m_base); + return false; + } + v = static_cast(hash_value_from_capture_name(base, m_position)); + goto insert_recursion; + } + } // // lets assume that we have a (?imsx) group and try and parse it: // +option_group_jump: regex_constants::syntax_option_type opts = parse_options(); if(m_position == m_end) return false; @@ -1897,9 +2291,20 @@ bool basic_regex_parser::parse_perl_extension() } else if(this->getaddress(static_cast(b)->alt.i, b)->type == syntax_element_alt) { + // Can't have seen more than one alternative: fail(regex_constants::error_bad_pattern, m_position - m_base); return false; } + else + { + // We must *not* have seen an alternative inside a (DEFINE) block: + b = this->getaddress(b->next.i, b); + if((b->type == syntax_element_assert_backref) && (static_cast(b)->index == 9999)) + { + fail(regex_constants::error_bad_pattern, m_position - m_base); + return false; + } + } // check for invalid repetition of next state: b = this->getaddress(expected_alt_point); b = this->getaddress(static_cast(b)->next.i, b); @@ -1915,6 +2320,7 @@ bool basic_regex_parser::parse_perl_extension() // pb = static_cast(this->append_state(syntax_element_endmark, sizeof(re_brace))); pb->index = markid; + pb->icase = this->flags() & regbase::icase; this->m_paren_start = last_paren_start; // // restore the alternate insertion point: @@ -1924,6 +2330,31 @@ bool basic_regex_parser::parse_perl_extension() // and the case change data: // m_has_case_change = old_case_change; + // + // And the mark_reset data: + // + if(m_max_mark > m_mark_count) + { + m_mark_count = m_max_mark; + } + m_mark_reset = mark_reset; + + + if(markid > 0) + { +#ifndef BOOST_NO_STD_DISTANCE + if(this->flags() & regbase::save_subexpression_location) + this->m_pdata->m_subs.at(markid - 1).second = std::distance(m_base, m_position) - 1; +#else + if(this->flags() & regbase::save_subexpression_location) + this->m_pdata->m_subs.at(markid - 1).second = (m_position - m_base) - 1; +#endif + // + // allow backrefs to this mark: + // + if((markid > 0) && (markid < (int)(sizeof(unsigned) * CHAR_BIT))) + this->m_backrefs |= 1u << (markid - 1); + } return true; } diff --git a/boost/boost/regex/v4/cpp_regex_traits.hpp b/boost/boost/regex/v4/cpp_regex_traits.hpp index 89fe49d824..7ce3ed300e 100644 --- a/boost/boost/regex/v4/cpp_regex_traits.hpp +++ b/boost/boost/regex/v4/cpp_regex_traits.hpp @@ -394,7 +394,9 @@ enum char_class_graph=char_class_alnum|char_class_punct, char_class_blank=1<<9, char_class_word=1<<10, - char_class_unicode=1<<11 + char_class_unicode=1<<11, + char_class_horizontal_space=1<<12, + char_class_vertical_space=1<<13 }; #endif @@ -413,6 +415,8 @@ public: 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); + BOOST_STATIC_CONSTANT(char_class_type, mask_horizontal = 1u << 27); + BOOST_STATIC_CONSTANT(char_class_type, mask_vertical = 1u << 28); #endif typedef std::basic_string string_type; @@ -477,6 +481,10 @@ template typename cpp_regex_traits_implementation::char_class_type const cpp_regex_traits_implementation::mask_word; template typename cpp_regex_traits_implementation::char_class_type const cpp_regex_traits_implementation::mask_unicode; +template +typename cpp_regex_traits_implementation::char_class_type const cpp_regex_traits_implementation::mask_vertical; +template +typename cpp_regex_traits_implementation::char_class_type const cpp_regex_traits_implementation::mask_horizontal; #endif #endif @@ -688,18 +696,20 @@ void cpp_regex_traits_implementation::init() // Custom class names: // #ifndef BOOST_REGEX_BUGGY_CTYPE_FACET - static const char_class_type masks[14] = + static const char_class_type masks[16] = { std::ctype::alnum, std::ctype::alpha, std::ctype::cntrl, std::ctype::digit, std::ctype::graph, + cpp_regex_traits_implementation::mask_horizontal, std::ctype::lower, std::ctype::print, std::ctype::punct, std::ctype::space, std::ctype::upper, + cpp_regex_traits_implementation::mask_vertical, std::ctype::xdigit, cpp_regex_traits_implementation::mask_blank, cpp_regex_traits_implementation::mask_word, @@ -713,11 +723,13 @@ void cpp_regex_traits_implementation::init() ::boost::re_detail::char_class_cntrl, ::boost::re_detail::char_class_digit, ::boost::re_detail::char_class_graph, + ::boost::re_detail::char_class_horizontal_space, ::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_vertical_space, ::boost::re_detail::char_class_xdigit, ::boost::re_detail::char_class_blank, ::boost::re_detail::char_class_word, @@ -744,7 +756,7 @@ typename cpp_regex_traits_implementation::char_class_type cpp_regex_traits_implementation::lookup_classname_imp(const charT* p1, const charT* p2) const { #ifndef BOOST_REGEX_BUGGY_CTYPE_FACET - static const char_class_type masks[20] = + static const char_class_type masks[22] = { 0, std::ctype::alnum, @@ -754,6 +766,7 @@ typename cpp_regex_traits_implementation::char_class_type std::ctype::digit, std::ctype::digit, std::ctype::graph, + cpp_regex_traits_implementation::mask_horizontal, std::ctype::lower, std::ctype::lower, std::ctype::print, @@ -763,12 +776,13 @@ typename cpp_regex_traits_implementation::char_class_type std::ctype::upper, cpp_regex_traits_implementation::mask_unicode, std::ctype::upper, + cpp_regex_traits_implementation::mask_vertical, std::ctype::alnum | cpp_regex_traits_implementation::mask_word, std::ctype::alnum | cpp_regex_traits_implementation::mask_word, std::ctype::xdigit, }; #else - static const char_class_type masks[20] = + static const char_class_type masks[22] = { 0, ::boost::re_detail::char_class_alnum, @@ -778,6 +792,7 @@ typename cpp_regex_traits_implementation::char_class_type ::boost::re_detail::char_class_digit, ::boost::re_detail::char_class_digit, ::boost::re_detail::char_class_graph, + ::boost::re_detail::char_class_horizontal_space, ::boost::re_detail::char_class_lower, ::boost::re_detail::char_class_lower, ::boost::re_detail::char_class_print, @@ -787,6 +802,7 @@ typename cpp_regex_traits_implementation::char_class_type ::boost::re_detail::char_class_upper, ::boost::re_detail::char_class_unicode, ::boost::re_detail::char_class_upper, + ::boost::re_detail::char_class_vertical_space, ::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, @@ -820,7 +836,9 @@ bool cpp_regex_traits_implementation::isctype(const charT c, char_class_t || ((mask & ::boost::re_detail::char_class_xdigit) && (m_pctype->is(std::ctype::xdigit, c))) || ((mask & ::boost::re_detail::char_class_blank) && (m_pctype->is(std::ctype::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)); + || ((mask & ::boost::re_detail::char_class_unicode) && ::boost::re_detail::is_extended(c)) + || ((mask & ::boost::re_detail::char_class_vertical) && (is_separator(c) || (c == '\v'))) + || ((mask & ::boost::re_detail::char_class_horizontal) && m_pctype->is(std::ctype::space, c) && !(is_separator(c) || (c == '\v'))); } #endif @@ -930,6 +948,12 @@ public: && m_pimpl->m_pctype->is(std::ctype::space, c) && !re_detail::is_separator(c)) return true; + else if((f & re_detail::cpp_regex_traits_implementation::mask_vertical) + && (::boost::re_detail::is_separator(c) || (c == '\v'))) + return true; + else if((f & re_detail::cpp_regex_traits_implementation::mask_horizontal) + && this->isctype(c, std::ctype::space) && !this->isctype(c, re_detail::cpp_regex_traits_implementation::mask_vertical)) + return true; return false; #else return m_pimpl->isctype(c, f); diff --git a/boost/boost/regex/v4/iterator_category.hpp b/boost/boost/regex/v4/iterator_category.hpp index 20870a0ced..9e40142378 100644 --- a/boost/boost/regex/v4/iterator_category.hpp +++ b/boost/boost/regex/v4/iterator_category.hpp @@ -31,10 +31,14 @@ namespace detail{ template struct is_random_imp { +#ifndef BOOST_NO_STD_ITERATOR_TRAITS private: typedef typename std::iterator_traits::iterator_category cat; public: BOOST_STATIC_CONSTANT(bool, value = (::boost::is_convertible::value)); +#else + BOOST_STATIC_CONSTANT(bool, value = false); +#endif }; template diff --git a/boost/boost/regex/v4/match_results.hpp b/boost/boost/regex/v4/match_results.hpp index acf509fa7f..09dd31f009 100644 --- a/boost/boost/regex/v4/match_results.hpp +++ b/boost/boost/regex/v4/match_results.hpp @@ -36,6 +36,13 @@ namespace boost{ #pragma warning(disable : 4251 4231 4660) #endif +namespace re_detail{ + +template +class named_subexpressions; + +} + template class match_results { @@ -62,13 +69,14 @@ public: typedef typename re_detail::regex_iterator_traits< BidiIterator>::value_type char_type; typedef std::basic_string string_type; + typedef re_detail::named_subexpressions_base named_sub_type; // construct/copy/destroy: explicit match_results(const Allocator& a = Allocator()) #ifndef BOOST_NO_STD_ALLOCATOR - : m_subs(a), m_base() {} + : m_subs(a), m_base(), m_last_closed_paren(0) {} #else - : m_subs(), m_base() { (void)a; } + : m_subs(), m_base(), m_last_closed_paren(0) { (void)a; } #endif match_results(const match_results& m) : m_subs(m.m_subs), m_base(m.m_base) {} @@ -95,6 +103,24 @@ public: return m_subs[sub].length(); return 0; } + difference_type length(const char_type* sub) const + { + const char_type* end = sub; + while(*end) ++end; + return length(named_subexpression_index(sub, end)); + } + template + difference_type length(const charT* sub) const + { + const charT* end = sub; + while(*end) ++end; + return length(named_subexpression_index(sub, end)); + } + template + difference_type length(const std::basic_string& sub) const + { + return length(sub.c_str()); + } difference_type position(size_type sub = 0) const { sub += 2; @@ -108,6 +134,24 @@ public: } return ~static_cast(0); } + difference_type position(const char_type* sub) const + { + const char_type* end = sub; + while(*end) ++end; + return position(named_subexpression_index(sub, end)); + } + template + difference_type position(const charT* sub) const + { + const charT* end = sub; + while(*end) ++end; + return position(named_subexpression_index(sub, end)); + } + template + difference_type position(const std::basic_string& sub) const + { + return position(sub.c_str()); + } string_type str(int sub = 0) const { sub += 2; @@ -122,6 +166,25 @@ public: } return result; } + string_type str(const char_type* sub) const + { + return (*this)[sub].str(); + } + template + string_type str(const std::basic_string& sub) const + { + return (*this)[sub].str(); + } + template + string_type str(const charT* sub) const + { + return (*this)[sub].str(); + } + template + string_type str(const std::basic_string& sub) const + { + return (*this)[sub].str(); + } const_reference operator[](int sub) const { sub += 2; @@ -131,6 +194,75 @@ public: } return m_null; } + // + // Named sub-expressions: + // + const_reference named_subexpression(const char_type* i, const char_type* j) const + { + int index = m_named_subs->get_id(i, j); + return index > 0 ? (*this)[index] : m_null; + } + template + const_reference named_subexpression(const charT* i, const charT* j) const + { + BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type)); + if(i == j) + return m_null; + std::vector s; + while(i != j) + s.insert(s.end(), *i++); + return named_subexpression(&*s.begin(), &*s.begin() + s.size()); + } + int named_subexpression_index(const char_type* i, const char_type* j) const + { + int index = m_named_subs->get_id(i, j); + return index > 0 ? index : -20; + } + template + int named_subexpression_index(const charT* i, const charT* j) const + { + BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type)); + if(i == j) + return -20; + std::vector s; + while(i != j) + s.insert(s.end(), *i++); + return named_subexpression_index(&*s.begin(), &*s.begin() + s.size()); + } + template + const_reference operator[](const std::basic_string& s) const + { + return named_subexpression(s.c_str(), s.c_str() + s.size()); + } + const_reference operator[](const char_type* p) const + { + const char_type* e = p; + while(*e) ++e; + return named_subexpression(p, e); + } + + template + const_reference operator[](const charT* p) const + { + BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type)); + if(*p == 0) + return m_null; + std::vector s; + while(*p) + s.insert(s.end(), *p++); + return named_subexpression(&*s.begin(), &*s.begin() + s.size()); + } + template + const_reference operator[](const std::basic_string& ns) const + { + BOOST_STATIC_ASSERT(sizeof(charT) <= sizeof(char_type)); + if(ns.empty()) + return m_null; + std::vector s; + for(unsigned i = 0; i < ns.size(); ++i) + s.insert(s.end(), ns[i]); + return named_subexpression(&*s.begin(), &*s.begin() + s.size()); + } const_reference prefix() const { @@ -186,6 +318,10 @@ public: ::boost::re_detail::regex_format_imp(i, *this, fmt.data(), fmt.data() + fmt.size(), flags, re.get_traits()); return result; } + const_reference get_last_closed_paren()const + { + return m_last_closed_paren == 0 ? m_null : (*this)[m_last_closed_paren]; + } allocator_type get_allocator() const { @@ -230,13 +366,15 @@ public: m_null.matched = false; } - void BOOST_REGEX_CALL set_second(BidiIterator i, size_type pos, bool m = true) + void BOOST_REGEX_CALL set_second(BidiIterator i, size_type pos, bool m = true, bool escape_k = false) { + if(pos) + m_last_closed_paren = pos; pos += 2; BOOST_ASSERT(m_subs.size() > pos); m_subs[pos].second = i; m_subs[pos].matched = m; - if(pos == 2) + if((pos == 2) && !escape_k) { m_subs[0].first = i; m_subs[0].matched = (m_subs[0].first != m_subs[0].second); @@ -261,6 +399,7 @@ public: m_subs.insert(m_subs.end(), n+2-len, v); } m_subs[1].first = i; + m_last_closed_paren = 0; } void BOOST_REGEX_CALL set_base(BidiIterator pos) { @@ -284,21 +423,34 @@ public: m_subs[n].matched = false; } } - void BOOST_REGEX_CALL set_first(BidiIterator i, size_type pos) + void BOOST_REGEX_CALL set_first(BidiIterator i, size_type pos, bool escape_k = false) { BOOST_ASSERT(pos+2 < m_subs.size()); - if(pos) + if(pos || escape_k) + { m_subs[pos+2].first = i; + if(escape_k) + { + m_subs[1].second = i; + m_subs[1].matched = (m_subs[1].first != m_subs[1].second); + } + } else set_first(i); } void BOOST_REGEX_CALL maybe_assign(const match_results& m); + void BOOST_REGEX_CALL set_named_subs(boost::shared_ptr subs) + { + m_named_subs = subs; + } private: vector_type m_subs; // subexpressions BidiIterator m_base; // where the search started from sub_match m_null; // a null match + boost::shared_ptr m_named_subs; + int m_last_closed_paren; }; template diff --git a/boost/boost/regex/v4/perl_matcher.hpp b/boost/boost/regex/v4/perl_matcher.hpp index 33afe6e9a0..726c2881e5 100644 --- a/boost/boost/regex/v4/perl_matcher.hpp +++ b/boost/boost/regex/v4/perl_matcher.hpp @@ -285,7 +285,8 @@ public: } ~repeater_count() { - *stack = next; + if(next) + *stack = next; } std::size_t get_count() { return count; } int get_id() { return state_id; } @@ -325,6 +326,17 @@ enum saved_state_type saved_state_count = 14 }; +template +struct recursion_info +{ + typedef typename Results::value_type value_type; + typedef typename value_type::iterator iterator; + int id; + const re_syntax_base* preturn_address; + Results results; + repeater_count* repeater_stack; +}; + #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable : 4251 4231 4660) @@ -340,6 +352,7 @@ public: typedef std::size_t traits_size_type; typedef typename is_byte::width_type width_type; typedef typename regex_iterator_traits::difference_type difference_type; + typedef match_results results_type; perl_matcher(BidiIterator first, BidiIterator end, match_results& what, @@ -348,7 +361,7 @@ public: BidiIterator l_base) : m_result(what), base(first), last(end), position(first), backstop(l_base), re(e), traits_inst(e.get_traits()), - m_independent(false), next_count(&rep_obj), rep_obj(&next_count) + m_independent(false), next_count(&rep_obj), rep_obj(&next_count), recursion_stack_position(0) { construct_init(e, f); } @@ -403,12 +416,17 @@ private: bool match_char_repeat(); bool match_dot_repeat_fast(); bool match_dot_repeat_slow(); + bool match_dot_repeat_dispatch() + { + return ::boost::is_random_access_iterator::value ? match_dot_repeat_fast() : match_dot_repeat_slow(); + } bool match_backstep(); bool match_assert_backref(); bool match_toggle_case(); #ifdef BOOST_REGEX_RECURSIVE bool backtrack_till_match(std::size_t count); #endif + bool match_recursion(); // find procs stored in s_find_vtable: bool find_restart_any(); @@ -464,6 +482,9 @@ private: 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; + // recursion information: + recursion_info recursion_stack[50]; + unsigned recursion_stack_position; #ifdef BOOST_REGEX_NON_RECURSIVE // @@ -487,6 +508,8 @@ private: bool unwind_short_set_repeat(bool); bool unwind_long_set_repeat(bool); bool unwind_non_greedy_repeat(bool); + bool unwind_recursion(bool); + bool unwind_recursion_pop(bool); void destroy_single_repeat(); void push_matched_paren(int index, const sub_match& sub); void push_recursion_stopper(); @@ -495,7 +518,8 @@ private: void push_repeater_count(int i, repeater_count** s); void push_single_repeat(std::size_t c, const re_repeat* r, BidiIterator last_position, int state_id); void push_non_greedy_repeat(const re_syntax_base* ps); - + void push_recursion(int id, const re_syntax_base* p, results_type* presults); + void push_recursion_pop(); // pointer to base of stack: saved_state* m_stack_base; diff --git a/boost/boost/regex/v4/perl_matcher_common.hpp b/boost/boost/regex/v4/perl_matcher_common.hpp index 399caa3bc9..fd439f84b6 100644 --- a/boost/boost/regex/v4/perl_matcher_common.hpp +++ b/boost/boost/regex/v4/perl_matcher_common.hpp @@ -200,12 +200,13 @@ bool perl_matcher::match_imp() m_match_flags |= regex_constants::match_all; m_presult->set_size((m_match_flags & match_nosubs) ? 1 : re.mark_count(), search_base, last); m_presult->set_base(base); + m_presult->set_named_subs(re_detail::convert_to_named_subs::char_type>(this->re.get_named_subs())); if(m_match_flags & match_posix) m_result = *m_presult; verify_options(re.flags(), m_match_flags); if(0 == match_prefix()) return false; - return m_result[0].second == last; + return (m_result[0].second == last) && (m_result[0].first == base); #if defined(BOOST_REGEX_NON_RECURSIVE) && !defined(BOOST_NO_EXCEPTIONS) } @@ -261,6 +262,7 @@ bool perl_matcher::find_imp() 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_presult->set_named_subs(re_detail::convert_to_named_subs::char_type>(this->re.get_named_subs())); m_match_flags |= regex_constants::match_init; } else @@ -343,25 +345,6 @@ bool perl_matcher::match_prefix() return m_has_found_match; } -template -bool perl_matcher::match_endmark() -{ - int index = static_cast(pstate)->index; - if(index > 0) - { - if((m_match_flags & match_nosubs) == 0) - m_presult->set_second(position, index); - } - else if((index < 0) && (index != -4)) - { - // matched forward lookahead: - pstate = 0; - return true; - } - pstate = pstate->next.p; - return true; -} - template bool perl_matcher::match_literal() { @@ -462,35 +445,6 @@ bool perl_matcher::match_wild() return true; } -template -bool perl_matcher::match_match() -{ - if((m_match_flags & match_not_null) && (position == (*m_presult)[0].first)) - return false; - if((m_match_flags & match_all) && (position != last)) - return false; - if((m_match_flags & regex_constants::match_not_initial_null) && (position == search_base)) - return false; - m_presult->set_second(position); - pstate = 0; - m_has_found_match = true; - if((m_match_flags & match_posix) == match_posix) - { - m_result.maybe_assign(*m_presult); - if((m_match_flags & match_any) == 0) - return false; - } -#ifdef BOOST_REGEX_MATCH_EXTRA - if(match_extra & m_match_flags) - { - for(unsigned i = 0; i < m_presult->size(); ++i) - if((*m_presult)[i].matched) - ((*m_presult)[i]).get_captures().push_back((*m_presult)[i]); - } -#endif - return true; -} - template bool perl_matcher::match_word_boundary() { @@ -758,8 +712,32 @@ template inline bool perl_matcher::match_assert_backref() { // return true if marked sub-expression N has been matched: - bool result = (*m_presult)[static_cast(pstate)->index].matched; - pstate = pstate->next.p; + int index = static_cast(pstate)->index; + bool result; + if(index == 9999) + { + // Magic value for a (DEFINE) block: + return false; + } + else if(index > 0) + { + // Check if index is a hash value: + if(index >= 10000) + index = re.get_data().get_id(index); + // Have we matched subexpression "index"? + result = (*m_presult)[index].matched; + pstate = pstate->next.p; + } + else + { + // Have we recursed into subexpression "index"? + // If index == 0 then check for any recursion at all, otherwise for recursion to -index-1. + int id = -index-1; + if(id >= 10000) + id = re.get_data().get_id(id); + result = recursion_stack_position && ((recursion_stack[recursion_stack_position-1].id == id) || (index == 0)); + pstate = pstate->next.p; + } return result; } diff --git a/boost/boost/regex/v4/perl_matcher_non_recursive.hpp b/boost/boost/regex/v4/perl_matcher_non_recursive.hpp index 10e0347726..2ce7ebe034 100644 --- a/boost/boost/regex/v4/perl_matcher_non_recursive.hpp +++ b/boost/boost/regex/v4/perl_matcher_non_recursive.hpp @@ -127,10 +127,21 @@ struct saved_single_repeat : public saved_state : saved_state(arg_id), count(c), rep(r), last_position(lp){} }; +template +struct saved_recursion : public saved_state +{ + saved_recursion(int id, const re_syntax_base* p, Results* pr) + : saved_state(14), recursion_id(id), preturn_address(p), results(*pr) + {} + int recursion_id; + const re_syntax_base* preturn_address; + Results results; +}; + template bool perl_matcher::match_all_states() { - static matcher_proc_type const s_match_vtable[29] = + static matcher_proc_type const s_match_vtable[30] = { (&perl_matcher::match_startmark), &perl_matcher::match_endmark, @@ -154,13 +165,18 @@ bool perl_matcher::match_all_states() &perl_matcher::match_combining, &perl_matcher::match_soft_buffer_end, &perl_matcher::match_restart_continue, - (::boost::is_random_access_iterator::value ? &perl_matcher::match_dot_repeat_fast : &perl_matcher::match_dot_repeat_slow), + // Although this next line *should* be evaluated at compile time, in practice + // some compilers (VC++) emit run-time initialisation which breaks thread + // safety, so use a dispatch function instead: + //(::boost::is_random_access_iterator::value ? &perl_matcher::match_dot_repeat_fast : &perl_matcher::match_dot_repeat_slow), + &perl_matcher::match_dot_repeat_dispatch, &perl_matcher::match_char_repeat, &perl_matcher::match_set_repeat, &perl_matcher::match_long_set_repeat, &perl_matcher::match_backstep, &perl_matcher::match_assert_backref, &perl_matcher::match_toggle_case, + &perl_matcher::match_recursion, }; push_recursion_stopper(); @@ -209,7 +225,7 @@ void perl_matcher::extend_stack() template inline void perl_matcher::push_matched_paren(int index, const sub_match& sub) { - BOOST_ASSERT(index); + //BOOST_ASSERT(index); saved_matched_paren* pmp = static_cast*>(m_backup_state); --pmp; if(pmp < m_stack_base) @@ -312,10 +328,26 @@ inline void perl_matcher::push_single_repeat(st m_backup_state = pmp; } +template +inline void perl_matcher::push_recursion(int id, const re_syntax_base* p, results_type* presults) +{ + saved_recursion* pmp = static_cast*>(m_backup_state); + --pmp; + if(pmp < m_stack_base) + { + extend_stack(); + pmp = static_cast*>(m_backup_state); + --pmp; + } + (void) new (pmp)saved_recursion(id, p, presults); + m_backup_state = pmp; +} + template bool perl_matcher::match_startmark() { int index = static_cast(pstate)->index; + icase = static_cast(pstate)->icase; switch(index) { case 0: @@ -400,6 +432,13 @@ bool perl_matcher::match_startmark() break; } } + case -5: + { + push_matched_paren(0, (*m_presult)[0]); + m_presult->set_first(position, 0, true); + pstate = pstate->next.p; + break; + } default: { BOOST_ASSERT(index > 0); @@ -848,6 +887,100 @@ bool perl_matcher::match_long_set_repeat() #endif } +template +bool perl_matcher::match_recursion() +{ + BOOST_ASSERT(pstate->type == syntax_element_recurse); + // + // Backup call stack: + // + push_recursion_pop(); + // + // Set new call stack: + // + if(recursion_stack_position >= static_cast(sizeof(recursion_stack)/sizeof(recursion_stack[0]))) + { + return false; + } + recursion_stack[recursion_stack_position].preturn_address = pstate->next.p; + recursion_stack[recursion_stack_position].results = *m_presult; + pstate = static_cast(pstate)->alt.p; + recursion_stack[recursion_stack_position].id = static_cast(pstate)->index; + ++recursion_stack_position; + //BOOST_ASSERT(recursion_stack[recursion_stack_position-1].id); + return true; +} + +template +bool perl_matcher::match_endmark() +{ + int index = static_cast(pstate)->index; + icase = static_cast(pstate)->icase; + if(index > 0) + { + if((m_match_flags & match_nosubs) == 0) + { + m_presult->set_second(position, index); + } + if(recursion_stack_position) + { + if(index == recursion_stack[recursion_stack_position-1].id) + { + --recursion_stack_position; + pstate = recursion_stack[recursion_stack_position].preturn_address; + *m_presult = recursion_stack[recursion_stack_position].results; + push_recursion(recursion_stack[recursion_stack_position].id, recursion_stack[recursion_stack_position].preturn_address, &recursion_stack[recursion_stack_position].results); + } + } + } + else if((index < 0) && (index != -4)) + { + // matched forward lookahead: + pstate = 0; + return true; + } + pstate = pstate->next.p; + return true; +} + +template +bool perl_matcher::match_match() +{ + if(recursion_stack_position) + { + BOOST_ASSERT(0 == recursion_stack[recursion_stack_position-1].id); + --recursion_stack_position; + pstate = recursion_stack[recursion_stack_position].preturn_address; + *m_presult = recursion_stack[recursion_stack_position].results; + push_recursion(recursion_stack[recursion_stack_position].id, recursion_stack[recursion_stack_position].preturn_address, &recursion_stack[recursion_stack_position].results); + return true; + } + if((m_match_flags & match_not_null) && (position == (*m_presult)[0].first)) + return false; + if((m_match_flags & match_all) && (position != last)) + return false; + if((m_match_flags & regex_constants::match_not_initial_null) && (position == search_base)) + return false; + m_presult->set_second(position); + pstate = 0; + m_has_found_match = true; + if((m_match_flags & match_posix) == match_posix) + { + m_result.maybe_assign(*m_presult); + if((m_match_flags & match_any) == 0) + return false; + } +#ifdef BOOST_REGEX_MATCH_EXTRA + if(match_extra & m_match_flags) + { + for(unsigned i = 0; i < m_presult->size(); ++i) + if((*m_presult)[i].matched) + ((*m_presult)[i]).get_captures().push_back((*m_presult)[i]); + } +#endif + return true; +} + /**************************************************************************** Unwind and associated proceedures follow, these perform what normal stack @@ -858,7 +991,7 @@ unwinding does in the recursive implementation. template bool perl_matcher::unwind(bool have_match) { - static unwind_proc_type const s_unwind_table[14] = + static unwind_proc_type const s_unwind_table[18] = { &perl_matcher::unwind_end, &perl_matcher::unwind_paren, @@ -874,6 +1007,8 @@ bool perl_matcher::unwind(bool have_match) &perl_matcher::unwind_short_set_repeat, &perl_matcher::unwind_long_set_repeat, &perl_matcher::unwind_non_greedy_repeat, + &perl_matcher::unwind_recursion, + &perl_matcher::unwind_recursion_pop, }; m_recursive_result = have_match; @@ -907,8 +1042,8 @@ bool perl_matcher::unwind_paren(bool have_match // restore previous values if no match was found: if(have_match == false) { - m_presult->set_first(pmp->sub.first, pmp->index); - m_presult->set_second(pmp->sub.second, pmp->index, pmp->sub.matched); + m_presult->set_first(pmp->sub.first, pmp->index, pmp->index == 0); + m_presult->set_second(pmp->sub.second, pmp->index, pmp->sub.matched, pmp->index == 0); } #ifdef BOOST_REGEX_MATCH_EXTRA // @@ -1377,6 +1512,106 @@ bool perl_matcher::unwind_non_greedy_repeat(boo return r; } +template +bool perl_matcher::unwind_recursion(bool r) +{ + saved_recursion* pmp = static_cast*>(m_backup_state); + if(!r) + { + recursion_stack[recursion_stack_position].id = pmp->recursion_id; + recursion_stack[recursion_stack_position].preturn_address = pmp->preturn_address; + recursion_stack[recursion_stack_position].results = pmp->results; + ++recursion_stack_position; + } + boost::re_detail::inplace_destroy(pmp++); + m_backup_state = pmp; + return true; +} + +template +bool perl_matcher::unwind_recursion_pop(bool r) +{ + saved_state* pmp = static_cast(m_backup_state); + if(!r) + { + --recursion_stack_position; + } + boost::re_detail::inplace_destroy(pmp++); + m_backup_state = pmp; + return true; +} + +template +void perl_matcher::push_recursion_pop() +{ + saved_state* pmp = static_cast(m_backup_state); + --pmp; + if(pmp < m_stack_base) + { + extend_stack(); + pmp = static_cast(m_backup_state); + --pmp; + } + (void) new (pmp)saved_state(15); + m_backup_state = pmp; +} +/* +template +bool perl_matcher::unwind_parenthesis_pop(bool r) +{ + saved_state* pmp = static_cast(m_backup_state); + if(!r) + { + --parenthesis_stack_position; + } + boost::re_detail::inplace_destroy(pmp++); + m_backup_state = pmp; + return true; +} + +template +void perl_matcher::push_parenthesis_pop() +{ + saved_state* pmp = static_cast(m_backup_state); + --pmp; + if(pmp < m_stack_base) + { + extend_stack(); + pmp = static_cast(m_backup_state); + --pmp; + } + (void) new (pmp)saved_state(16); + m_backup_state = pmp; +} + +template +bool perl_matcher::unwind_parenthesis_push(bool r) +{ + saved_position* pmp = static_cast*>(m_backup_state); + if(!r) + { + parenthesis_stack[parenthesis_stack_position++] = pmp->position; + } + boost::re_detail::inplace_destroy(pmp++); + m_backup_state = pmp; + return true; +} + +template +inline void perl_matcher::push_parenthesis_push(BidiIterator p) +{ + saved_position* pmp = static_cast*>(m_backup_state); + --pmp; + if(pmp < m_stack_base) + { + extend_stack(); + pmp = static_cast*>(m_backup_state); + --pmp; + } + (void) new (pmp)saved_position(0, p, 17); + m_backup_state = pmp; +} +*/ } // namespace re_detail } // namespace boost diff --git a/boost/boost/regex/v4/perl_matcher_recursive.hpp b/boost/boost/regex/v4/perl_matcher_recursive.hpp index 68e1aac9b4..48f08b7b8d 100644 --- a/boost/boost/regex/v4/perl_matcher_recursive.hpp +++ b/boost/boost/regex/v4/perl_matcher_recursive.hpp @@ -51,8 +51,8 @@ public: template void restore(match_results& w) { - w.set_first(sub.first, index); - w.set_second(sub.second, index, sub.matched); + w.set_first(sub.first, index, index == 0); + w.set_second(sub.second, index, sub.matched, index == 0); } const sub_match& get() { return sub; } }; @@ -60,7 +60,7 @@ public: template bool perl_matcher::match_all_states() { - static matcher_proc_type const s_match_vtable[29] = + static matcher_proc_type const s_match_vtable[30] = { (&perl_matcher::match_startmark), &perl_matcher::match_endmark, @@ -84,13 +84,18 @@ bool perl_matcher::match_all_states() &perl_matcher::match_combining, &perl_matcher::match_soft_buffer_end, &perl_matcher::match_restart_continue, - (::boost::is_random_access_iterator::value ? &perl_matcher::match_dot_repeat_fast : &perl_matcher::match_dot_repeat_slow), + // Although this next line *should* be evaluated at compile time, in practice + // some compilers (VC++) emit run-time initialisation which breaks thread + // safety, so use a dispatch function instead: + //(::boost::is_random_access_iterator::value ? &perl_matcher::match_dot_repeat_fast : &perl_matcher::match_dot_repeat_slow), + &perl_matcher::match_dot_repeat_dispatch, &perl_matcher::match_char_repeat, &perl_matcher::match_set_repeat, &perl_matcher::match_long_set_repeat, &perl_matcher::match_backstep, &perl_matcher::match_assert_backref, &perl_matcher::match_toggle_case, + &perl_matcher::match_recursion, }; if(state_count > max_state_count) @@ -113,6 +118,7 @@ template bool perl_matcher::match_startmark() { int index = static_cast(pstate)->index; + icase = static_cast(pstate)->icase; bool r = true; switch(index) { @@ -205,6 +211,17 @@ bool perl_matcher::match_startmark() break; } } + case -5: + { + // Reset start of $0, since we have a \K escape + backup_subex sub(*m_presult, 0); + m_presult->set_first(position, 0, true); + pstate = pstate->next.p; + r = match_all_states(); + if(r == false) + sub.restore(*m_presult); + break; + } default: { BOOST_ASSERT(index > 0); @@ -833,6 +850,127 @@ bool perl_matcher::backtrack_till_match(std::si #endif } +template +bool perl_matcher::match_recursion() +{ + BOOST_ASSERT(pstate->type == syntax_element_recurse); + // + // Set new call stack: + // + if(recursion_stack_position >= static_cast(sizeof(recursion_stack)/sizeof(recursion_stack[0]))) + { + return false; + } + recursion_stack[recursion_stack_position].preturn_address = pstate->next.p; + recursion_stack[recursion_stack_position].results = *m_presult; + recursion_stack[recursion_stack_position].repeater_stack = next_count; + pstate = static_cast(pstate)->alt.p; + recursion_stack[recursion_stack_position].id = static_cast(pstate)->index; + ++recursion_stack_position; + + repeater_count* saved = next_count; + repeater_count r(&next_count); // resets all repeat counts since we're recursing and starting fresh on those + next_count = &r; + bool result = match_all_states(); + next_count = saved; + + if(!result) + { + --recursion_stack_position; + next_count = recursion_stack[recursion_stack_position].repeater_stack; + *m_presult = recursion_stack[recursion_stack_position].results; + return false; + } + return true; +} + +template +bool perl_matcher::match_endmark() +{ + int index = static_cast(pstate)->index; + icase = static_cast(pstate)->icase; + if(index > 0) + { + if((m_match_flags & match_nosubs) == 0) + { + m_presult->set_second(position, index); + } + if(recursion_stack_position) + { + if(index == recursion_stack[recursion_stack_position-1].id) + { + --recursion_stack_position; + recursion_info saved = recursion_stack[recursion_stack_position]; + const re_syntax_base* saved_state = pstate = saved.preturn_address; + repeater_count* saved_count = next_count; + next_count = saved.repeater_stack; + *m_presult = saved.results; + if(!match_all_states()) + { + recursion_stack[recursion_stack_position] = saved; + ++recursion_stack_position; + next_count = saved_count; + return false; + } + } + } + } + else if((index < 0) && (index != -4)) + { + // matched forward lookahead: + pstate = 0; + return true; + } + pstate = pstate ? pstate->next.p : 0; + return true; +} + +template +bool perl_matcher::match_match() +{ + if(recursion_stack_position) + { + BOOST_ASSERT(0 == recursion_stack[recursion_stack_position-1].id); + --recursion_stack_position; + const re_syntax_base* saved_state = pstate = recursion_stack[recursion_stack_position].preturn_address; + *m_presult = recursion_stack[recursion_stack_position].results; + if(!match_all_states()) + { + recursion_stack[recursion_stack_position].preturn_address = saved_state; + recursion_stack[recursion_stack_position].results = *m_presult; + ++recursion_stack_position; + return false; + } + return true; + } + if((m_match_flags & match_not_null) && (position == (*m_presult)[0].first)) + return false; + if((m_match_flags & match_all) && (position != last)) + return false; + if((m_match_flags & regex_constants::match_not_initial_null) && (position == search_base)) + return false; + m_presult->set_second(position); + pstate = 0; + m_has_found_match = true; + if((m_match_flags & match_posix) == match_posix) + { + m_result.maybe_assign(*m_presult); + if((m_match_flags & match_any) == 0) + return false; + } +#ifdef BOOST_REGEX_MATCH_EXTRA + if(match_extra & m_match_flags) + { + for(unsigned i = 0; i < m_presult->size(); ++i) + if((*m_presult)[i].matched) + ((*m_presult)[i]).get_captures().push_back((*m_presult)[i]); + } +#endif + return true; +} + + + } // namespace re_detail } // namespace boost #ifdef BOOST_MSVC diff --git a/boost/boost/regex/v4/regex_format.hpp b/boost/boost/regex/v4/regex_format.hpp index d114c2ed29..4e95112f90 100644 --- a/boost/boost/regex/v4/regex_format.hpp +++ b/boost/boost/regex/v4/regex_format.hpp @@ -107,6 +107,7 @@ private: void format_escape(); void format_conditional(); void format_until_scope_end(); + bool handle_perl_verb(bool have_brace); const traits& m_traits; // the traits class for localised formatting operations const Results& m_results; // the match_results being used. @@ -250,6 +251,25 @@ void basic_regex_formatter::format_perl() case '$': put(*m_position++); break; + case '+': + if((++m_position != m_end) && (*m_position == '{')) + { + const char_type* base = ++m_position; + while((m_position != m_end) && (*m_position != '}')) ++m_position; + if(m_position != m_end) + { + // Named sub-expression: + put(this->m_results.named_subexpression(base, m_position)); + ++m_position; + break; + } + else + { + m_position = --base; + } + } + put((this->m_results)[this->m_results.size() > 1 ? this->m_results.size() - 1 : 1]); + break; case '{': have_brace = true; ++m_position; @@ -258,14 +278,18 @@ void basic_regex_formatter::format_perl() // see if we have a number: { std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end); - len = (std::min)(static_cast(2), len); + //len = (std::min)(static_cast(2), len); int v = m_traits.toi(m_position, m_position + len, 10); if((v < 0) || (have_brace && ((m_position == m_end) || (*m_position != '}')))) { - // leave the $ as is, and carry on: - m_position = --save_position; - put(*m_position); - ++m_position; + // Look for a Perl-5.10 verb: + if(!handle_perl_verb(have_brace)) + { + // leave the $ as is, and carry on: + m_position = --save_position; + put(*m_position); + ++m_position; + } break; } // otherwise output sub v: @@ -276,6 +300,123 @@ void basic_regex_formatter::format_perl() } } +template +bool basic_regex_formatter::handle_perl_verb(bool have_brace) +{ + // + // We may have a capitalised string containing a Perl action: + // + static const char_type MATCH[] = { 'M', 'A', 'T', 'C', 'H' }; + static const char_type PREMATCH[] = { 'P', 'R', 'E', 'M', 'A', 'T', 'C', 'H' }; + static const char_type POSTMATCH[] = { 'P', 'O', 'S', 'T', 'M', 'A', 'T', 'C', 'H' }; + static const char_type LAST_PAREN_MATCH[] = { 'L', 'A', 'S', 'T', '_', 'P', 'A', 'R', 'E', 'N', '_', 'M', 'A', 'T', 'C', 'H' }; + static const char_type LAST_SUBMATCH_RESULT[] = { 'L', 'A', 'S', 'T', '_', 'S', 'U', 'B', 'M', 'A', 'T', 'C', 'H', '_', 'R', 'E', 'S', 'U', 'L', 'T' }; + static const char_type LAST_SUBMATCH_RESULT_ALT[] = { '^', 'N' }; + + if(have_brace && (*m_position == '^')) + ++m_position; + + int max_len = m_end - m_position; + + if((max_len >= 5) && std::equal(m_position, m_position + 5, MATCH)) + { + m_position += 5; + if(have_brace) + { + if(*m_position == '}') + ++m_position; + else + { + m_position -= 5; + return false; + } + } + put(this->m_results[0]); + return true; + } + if((max_len >= 8) && std::equal(m_position, m_position + 8, PREMATCH)) + { + m_position += 8; + if(have_brace) + { + if(*m_position == '}') + ++m_position; + else + { + m_position -= 8; + return false; + } + } + put(this->m_results.prefix()); + return true; + } + if((max_len >= 9) && std::equal(m_position, m_position + 9, POSTMATCH)) + { + m_position += 9; + if(have_brace) + { + if(*m_position == '}') + ++m_position; + else + { + m_position -= 9; + return false; + } + } + put(this->m_results.suffix()); + return true; + } + if((max_len >= 16) && std::equal(m_position, m_position + 16, LAST_PAREN_MATCH)) + { + m_position += 16; + if(have_brace) + { + if(*m_position == '}') + ++m_position; + else + { + m_position -= 16; + return false; + } + } + put((this->m_results)[this->m_results.size() > 1 ? this->m_results.size() - 1 : 1]); + return true; + } + if((max_len >= 20) && std::equal(m_position, m_position + 20, LAST_SUBMATCH_RESULT)) + { + m_position += 20; + if(have_brace) + { + if(*m_position == '}') + ++m_position; + else + { + m_position -= 20; + return false; + } + } + put(this->m_results.get_last_closed_paren()); + return true; + } + if((max_len >= 2) && std::equal(m_position, m_position + 2, LAST_SUBMATCH_RESULT_ALT)) + { + m_position += 2; + if(have_brace) + { + if(*m_position == '}') + ++m_position; + else + { + m_position -= 2; + return false; + } + } + put(this->m_results.get_last_closed_paren()); + return true; + } + return false; +} + template void basic_regex_formatter::format_escape() { @@ -440,9 +581,35 @@ void basic_regex_formatter::format_conditional( put(static_cast('?')); return; } - std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end); - len = (std::min)(static_cast(2), len); - int v = m_traits.toi(m_position, m_position + len, 10); + int v; + if(*m_position == '{') + { + const char_type* base = m_position; + ++m_position; + v = m_traits.toi(m_position, m_end, 10); + if(v < 0) + { + // Try a named subexpression: + while((m_position != m_end) && (*m_position != '}')) + ++m_position; + v = m_results.named_subexpression_index(base + 1, m_position); + } + if((v < 0) || (*m_position != '}')) + { + m_position = base; + // oops trailing '?': + put(static_cast('?')); + return; + } + // Skip trailing '}': + ++m_position; + } + else + { + std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end); + len = (std::min)(static_cast(2), len); + v = m_traits.toi(m_position, m_position + len, 10); + } if(v < 0) { // oops not a number: diff --git a/boost/boost/regex/v4/regex_traits_defaults.hpp b/boost/boost/regex/v4/regex_traits_defaults.hpp index 42428dd8a6..5b2c6bc338 100644 --- a/boost/boost/regex/v4/regex_traits_defaults.hpp +++ b/boost/boost/regex/v4/regex_traits_defaults.hpp @@ -159,7 +159,7 @@ struct character_pointer_range template int get_default_class_id(const charT* p1, const charT* p2) { - static const charT data[72] = { + static const charT data[73] = { 'a', 'l', 'n', 'u', 'm', 'a', 'l', 'p', 'h', 'a', 'b', 'l', 'a', 'n', 'k', @@ -172,11 +172,12 @@ int get_default_class_id(const charT* p1, const charT* p2) 's', 'p', 'a', 'c', 'e', 'u', 'n', 'i', 'c', 'o', 'd', 'e', 'u', 'p', 'p', 'e', 'r', + 'v', 'w', 'o', 'r', 'd', 'x', 'd', 'i', 'g', 'i', 't', }; - static const character_pointer_range ranges[19] = + static const character_pointer_range ranges[21] = { {data+0, data+5,}, // alnum {data+5, data+10,}, // alpha @@ -185,6 +186,7 @@ int get_default_class_id(const charT* p1, const charT* p2) {data+20, data+21,}, // d {data+20, data+25,}, // digit {data+25, data+30,}, // graph + {data+29, data+30,}, // h {data+30, data+31,}, // l {data+30, data+35,}, // lower {data+35, data+40,}, // print @@ -194,9 +196,10 @@ int get_default_class_id(const charT* p1, const charT* p2) {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 + {data+62, data+63,}, // v + {data+63, data+64,}, // w + {data+63, data+67,}, // word + {data+67, data+73,}, // xdigit }; static const character_pointer_range* ranges_begin = ranges; static const character_pointer_range* ranges_end = ranges + (sizeof(ranges)/sizeof(ranges[0])); @@ -314,6 +317,43 @@ int global_toi(const charT*& p1, const charT* p2, int radix, const traits& t) return result; } +template +inline const charT* get_escape_R_string() +{ +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable:4309) +#endif + static const charT e1[] = { '(', '?', '>', '\x0D', '\x0A', '?', + '|', '[', '\x0A', '\x0B', '\x0C', '\x85', '\\', 'x', '{', '2', '0', '2', '8', '}', + '\\', 'x', '{', '2', '0', '2', '9', '}', ']', ')', '\0' }; + static const charT e2[] = { '(', '?', '>', '\x0D', '\x0A', '?', + '|', '[', '\x0A', '\x0B', '\x0C', '\x85', ']', ')', '\0' }; + + charT c = static_cast(0x2029u); + bool b = (static_cast(c) == 0x2029u); + + return (b ? e1 : e2); +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif +} + +template <> +inline const char* get_escape_R_string() +{ +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable:4309) +#endif + static const char e2[] = { '(', '?', '>', '\x0D', '\x0A', '?', + '|', '[', '\x0A', '\x0B', '\x0C', '\x85', ']', ')', '\0' }; + return e2; +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif +} + } // re_detail } // boost diff --git a/boost/boost/regex/v4/regex_workaround.hpp b/boost/boost/regex/v4/regex_workaround.hpp index fc3c212319..06527f1a1f 100644 --- a/boost/boost/regex/v4/regex_workaround.hpp +++ b/boost/boost/regex/v4/regex_workaround.hpp @@ -124,7 +124,7 @@ inline void pointer_construct(T* p, const T& t) #ifdef __cplusplus namespace boost{ namespace re_detail{ -#if BOOST_WORKAROUND(BOOST_MSVC,>=1400) && defined(_CPPLIB_VER) && defined(BOOST_DINKUMWARE_STDLIB) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) +#if BOOST_WORKAROUND(BOOST_MSVC,>=1400) && BOOST_WORKAROUND(BOOST_MSVC, <1600) && defined(_CPPLIB_VER) && defined(BOOST_DINKUMWARE_STDLIB) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) // // MSVC 8 will either emit warnings or else refuse to compile // code that makes perfectly legitimate use of std::copy, when diff --git a/boost/boost/regex/v4/states.hpp b/boost/boost/regex/v4/states.hpp index 44dd2b4ad9..efdebbe59f 100644 --- a/boost/boost/regex/v4/states.hpp +++ b/boost/boost/regex/v4/states.hpp @@ -118,7 +118,9 @@ enum syntax_element_type 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 + syntax_element_toggle_case = syntax_element_assert_backref + 1, + // a recursive expression: + syntax_element_recurse = syntax_element_toggle_case + 1 }; #ifdef BOOST_REGEX_DEBUG @@ -156,6 +158,7 @@ struct re_brace : public re_syntax_base // The index to match, can be zero (don't mark the sub-expression) // or negative (for perl style (?...) extentions): int index; + bool icase; }; /*** struct re_dot ************************************************** diff --git a/boost/boost/regex/v4/syntax_type.hpp b/boost/boost/regex/v4/syntax_type.hpp index 92c00d4c55..3efdf0b0f9 100644 --- a/boost/boost/regex/v4/syntax_type.hpp +++ b/boost/boost/regex/v4/syntax_type.hpp @@ -92,8 +92,11 @@ static const escape_syntax_type escape_type_G = 52; / 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 escape_type_extended_backref = 57; // for \g +static const escape_syntax_type escape_type_reset_start_mark = 58; // for \K +static const escape_syntax_type escape_type_line_ending = 59; // for \R -static const escape_syntax_type syntax_max = 57; +static const escape_syntax_type syntax_max = 60; } } diff --git a/boost/boost/regex/v4/w32_regex_traits.hpp b/boost/boost/regex/v4/w32_regex_traits.hpp index 21a9694aa9..d55620726d 100644 --- a/boost/boost/regex/v4/w32_regex_traits.hpp +++ b/boost/boost/regex/v4/w32_regex_traits.hpp @@ -294,6 +294,8 @@ public: typedef typename w32_regex_traits::char_class_type char_class_type; BOOST_STATIC_CONSTANT(char_class_type, mask_word = 0x0400); // must be C1_DEFINED << 1 BOOST_STATIC_CONSTANT(char_class_type, mask_unicode = 0x0800); // must be C1_DEFINED << 2 + BOOST_STATIC_CONSTANT(char_class_type, mask_horizontal = 0x1000); // must be C1_DEFINED << 3 + BOOST_STATIC_CONSTANT(char_class_type, mask_vertical = 0x2000); // must be C1_DEFINED << 4 BOOST_STATIC_CONSTANT(char_class_type, mask_base = 0x3ff); // all the masks used by the CT_CTYPE1 group typedef std::basic_string string_type; @@ -510,7 +512,7 @@ template typename w32_regex_traits_implementation::char_class_type w32_regex_traits_implementation::lookup_classname_imp(const charT* p1, const charT* p2) const { - static const char_class_type masks[20] = + static const char_class_type masks[22] = { 0, 0x0104u, // C1_ALPHA | C1_DIGIT @@ -520,6 +522,7 @@ typename w32_regex_traits_implementation::char_class_type 0x0004u, // C1_DIGIT 0x0004u, // C1_DIGIT (~(0x0020u|0x0008u|0x0040) & 0x01ffu) | 0x0400u, // not C1_CNTRL or C1_SPACE or C1_BLANK + w32_regex_traits_implementation::mask_horizontal, 0x0002u, // C1_LOWER 0x0002u, // C1_LOWER (~0x0020u & 0x01ffu) | 0x0400, // not C1_CNTRL @@ -529,6 +532,7 @@ typename w32_regex_traits_implementation::char_class_type 0x0001u, // C1_UPPER w32_regex_traits_implementation::mask_unicode, 0x0001u, // C1_UPPER + w32_regex_traits_implementation::mask_vertical, 0x0104u | w32_regex_traits_implementation::mask_word, 0x0104u | w32_regex_traits_implementation::mask_word, 0x0080u, // C1_XDIGIT @@ -628,6 +632,12 @@ public: return true; else if((f & re_detail::w32_regex_traits_implementation::mask_word) && (c == '_')) return true; + else if((f & re_detail::w32_regex_traits_implementation::mask_vertical) + && (::boost::re_detail::is_separator(c) || (c == '\v'))) + return true; + else if((f & re_detail::w32_regex_traits_implementation::mask_horizontal) + && this->isctype(c, 0x0008u) && !this->isctype(c, re_detail::w32_regex_traits_implementation::mask_vertical)) + return true; return false; } int toi(const charT*& p1, const charT* p2, int radix)const diff --git a/boost/boost/signals/signal1.hpp b/boost/boost/signals/signal1.hpp index 8363494bd8..645f7ab234 100644 --- a/boost/boost/signals/signal1.hpp +++ b/boost/boost/signals/signal1.hpp @@ -19,7 +19,7 @@ #define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1; #define BOOST_SIGNALS_COPY_PARMS T1 ia1 #define BOOST_SIGNALS_INIT_ARGS :a1(ia1) -#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; +#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; #include diff --git a/boost/boost/signals/signal10.hpp b/boost/boost/signals/signal10.hpp index 07185495d6..e043563151 100644 --- a/boost/boost/signals/signal10.hpp +++ b/boost/boost/signals/signal10.hpp @@ -19,7 +19,7 @@ #define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;T6 a6;T7 a7;T8 a8;T9 a9;T10 a10; #define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5, T6 ia6, T7 ia7, T8 ia8, T9 ia9, T10 ia10 #define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5), a6(ia6), a7(ia7), a8(ia8), a9(ia9), a10(ia10) -#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type; typedef T6 arg7_type; typedef T7 arg8_type; typedef T8 arg9_type; typedef T9 arg10_type; typedef T10 arg11_type; +#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type; typedef T5 arg5_type; typedef T6 arg6_type; typedef T7 arg7_type; typedef T8 arg8_type; typedef T9 arg9_type; typedef T10 arg10_type; #include diff --git a/boost/boost/signals/signal2.hpp b/boost/boost/signals/signal2.hpp index 361014eabf..e75f5e7d79 100644 --- a/boost/boost/signals/signal2.hpp +++ b/boost/boost/signals/signal2.hpp @@ -19,7 +19,7 @@ #define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2; #define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2 #define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2) -#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; +#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; #include diff --git a/boost/boost/signals/signal3.hpp b/boost/boost/signals/signal3.hpp index 542a56eac6..0a695c5b84 100644 --- a/boost/boost/signals/signal3.hpp +++ b/boost/boost/signals/signal3.hpp @@ -19,7 +19,7 @@ #define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3; #define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3 #define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3) -#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; +#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; #include diff --git a/boost/boost/signals/signal4.hpp b/boost/boost/signals/signal4.hpp index 695f70f9c9..56ba360719 100644 --- a/boost/boost/signals/signal4.hpp +++ b/boost/boost/signals/signal4.hpp @@ -19,7 +19,7 @@ #define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4; #define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4 #define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4) -#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; +#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type; #include diff --git a/boost/boost/signals/signal5.hpp b/boost/boost/signals/signal5.hpp index ba2f3c2a4a..027cda9aa2 100644 --- a/boost/boost/signals/signal5.hpp +++ b/boost/boost/signals/signal5.hpp @@ -19,7 +19,7 @@ #define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5; #define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5 #define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5) -#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type; +#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type; typedef T5 arg5_type; #include diff --git a/boost/boost/signals/signal6.hpp b/boost/boost/signals/signal6.hpp index b46afce874..39553189ac 100644 --- a/boost/boost/signals/signal6.hpp +++ b/boost/boost/signals/signal6.hpp @@ -19,7 +19,7 @@ #define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;T6 a6; #define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5, T6 ia6 #define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5), a6(ia6) -#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type; typedef T6 arg7_type; +#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type; typedef T5 arg5_type; typedef T6 arg6_type; #include diff --git a/boost/boost/signals/signal7.hpp b/boost/boost/signals/signal7.hpp index 86f11427da..d4530eca6d 100644 --- a/boost/boost/signals/signal7.hpp +++ b/boost/boost/signals/signal7.hpp @@ -19,7 +19,7 @@ #define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;T6 a6;T7 a7; #define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5, T6 ia6, T7 ia7 #define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5), a6(ia6), a7(ia7) -#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type; typedef T6 arg7_type; typedef T7 arg8_type; +#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type; typedef T5 arg5_type; typedef T6 arg6_type; typedef T7 arg7_type; #include diff --git a/boost/boost/signals/signal8.hpp b/boost/boost/signals/signal8.hpp index e2b86ce68b..094cd9776c 100644 --- a/boost/boost/signals/signal8.hpp +++ b/boost/boost/signals/signal8.hpp @@ -19,7 +19,7 @@ #define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;T6 a6;T7 a7;T8 a8; #define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5, T6 ia6, T7 ia7, T8 ia8 #define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5), a6(ia6), a7(ia7), a8(ia8) -#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type; typedef T6 arg7_type; typedef T7 arg8_type; typedef T8 arg9_type; +#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type; typedef T5 arg5_type; typedef T6 arg6_type; typedef T7 arg7_type; typedef T8 arg8_type; #include diff --git a/boost/boost/signals/signal9.hpp b/boost/boost/signals/signal9.hpp index bb6a57afa7..a551c16bed 100644 --- a/boost/boost/signals/signal9.hpp +++ b/boost/boost/signals/signal9.hpp @@ -19,7 +19,7 @@ #define BOOST_SIGNALS_ARGS_AS_MEMBERS T1 a1;T2 a2;T3 a3;T4 a4;T5 a5;T6 a6;T7 a7;T8 a8;T9 a9; #define BOOST_SIGNALS_COPY_PARMS T1 ia1, T2 ia2, T3 ia3, T4 ia4, T5 ia5, T6 ia6, T7 ia7, T8 ia8, T9 ia9 #define BOOST_SIGNALS_INIT_ARGS :a1(ia1), a2(ia2), a3(ia3), a4(ia4), a5(ia5), a6(ia6), a7(ia7), a8(ia8), a9(ia9) -#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type; typedef T6 arg7_type; typedef T7 arg8_type; typedef T8 arg9_type; typedef T9 arg10_type; +#define BOOST_SIGNALS_ARG_TYPES typedef T1 arg1_type; typedef T2 arg2_type; typedef T3 arg3_type; typedef T4 arg4_type; typedef T5 arg5_type; typedef T6 arg6_type; typedef T7 arg7_type; typedef T8 arg8_type; typedef T9 arg9_type; #include diff --git a/boost/boost/smart_ptr/detail/shared_count.hpp b/boost/boost/smart_ptr/detail/shared_count.hpp index eb43d9998b..ce1beb0c98 100644 --- a/boost/boost/smart_ptr/detail/shared_count.hpp +++ b/boost/boost/smart_ptr/detail/shared_count.hpp @@ -333,6 +333,20 @@ public: if(pi_ != 0) pi_->weak_add_ref(); } +// Move support + +#if defined( BOOST_HAS_RVALUE_REFS ) + + weak_count(weak_count && r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(weak_count_id) +#endif + { + r.pi_ = 0; + } + +#endif + ~weak_count() // nothrow { if(pi_ != 0) pi_->weak_release(); diff --git a/boost/boost/smart_ptr/detail/sp_convertible.hpp b/boost/boost/smart_ptr/detail/sp_convertible.hpp index 693bfa6e41..b446f203d4 100644 --- a/boost/boost/smart_ptr/detail/sp_convertible.hpp +++ b/boost/boost/smart_ptr/detail/sp_convertible.hpp @@ -45,7 +45,7 @@ template< class Y, class T > struct sp_convertible static yes f( T* ); static no f( ... ); - enum _vt { value = sizeof( f( (Y*)0 ) ) == sizeof(yes) }; + enum _vt { value = sizeof( f( static_cast(0) ) ) == sizeof(yes) }; }; struct sp_empty diff --git a/boost/boost/smart_ptr/enable_shared_from_this2.hpp b/boost/boost/smart_ptr/enable_shared_from_this2.hpp new file mode 100755 index 0000000000..fcbce06a9c --- /dev/null +++ b/boost/boost/smart_ptr/enable_shared_from_this2.hpp @@ -0,0 +1,132 @@ +#ifndef BOOST_ENABLE_SHARED_FROM_THIS2_HPP_INCLUDED +#define BOOST_ENABLE_SHARED_FROM_THIS2_HPP_INCLUDED + +// +// enable_shared_from_this2.hpp +// +// Copyright 2002, 2009 Peter Dimov +// Copyright 2008 Frank Mori Hess +// +// 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 +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +class esft2_deleter_wrapper +{ +private: + + shared_ptr deleter_; + +public: + + esft2_deleter_wrapper() + { + } + + template< class T > void set_deleter( shared_ptr const & deleter ) + { + deleter_ = deleter; + } + + template< class T> void operator()( T* ) + { + BOOST_ASSERT( deleter_.use_count() <= 1 ); + deleter_.reset(); + } +}; + +} // namespace detail + +template< class T > class enable_shared_from_this2 +{ +protected: + + enable_shared_from_this2() + { + } + + enable_shared_from_this2( enable_shared_from_this2 const & ) + { + } + + enable_shared_from_this2 & operator=( enable_shared_from_this2 const & ) + { + return *this; + } + + ~enable_shared_from_this2() + { + BOOST_ASSERT( shared_this_.use_count() <= 1 ); // make sure no dangling shared_ptr objects exist + } + +private: + + mutable weak_ptr weak_this_; + mutable shared_ptr shared_this_; + +public: + + shared_ptr shared_from_this() + { + init_weak_once(); + return shared_ptr( weak_this_ ); + } + + shared_ptr shared_from_this() const + { + init_weak_once(); + return shared_ptr( weak_this_ ); + } + +private: + + void init_weak_once() const + { + if( weak_this_._empty() ) + { + shared_this_.reset( static_cast< T* >( 0 ), detail::esft2_deleter_wrapper() ); + weak_this_ = shared_this_; + } + } + +public: // actually private, but avoids compiler template friendship issues + + // Note: invoked automatically by shared_ptr; do not call + template void _internal_accept_owner( shared_ptr * ppx, Y * py ) const + { + BOOST_ASSERT( ppx != 0 ); + + if( weak_this_.use_count() == 0 ) + { + weak_this_ = shared_ptr( *ppx, py ); + } + else if( shared_this_.use_count() != 0 ) + { + BOOST_ASSERT( ppx->unique() ); // no weak_ptrs should exist either, but there's no way to check that + + detail::esft2_deleter_wrapper * pd = boost::get_deleter( shared_this_ ); + BOOST_ASSERT( pd != 0 ); + + pd->set_deleter( *ppx ); + + ppx->reset( shared_this_, ppx->get() ); + shared_this_.reset(); + } + } +}; + +} // namespace boost + +#endif // #ifndef BOOST_ENABLE_SHARED_FROM_THIS2_HPP_INCLUDED diff --git a/boost/boost/smart_ptr/intrusive_ptr.hpp b/boost/boost/smart_ptr/intrusive_ptr.hpp index 0bd1730832..84558983e7 100644 --- a/boost/boost/smart_ptr/intrusive_ptr.hpp +++ b/boost/boost/smart_ptr/intrusive_ptr.hpp @@ -109,6 +109,23 @@ public: return *this; } +#endif + +// Move support + +#if defined( BOOST_HAS_RVALUE_REFS ) + + intrusive_ptr(intrusive_ptr && rhs): px( rhs.px ) + { + rhs.px = 0; + } + + intrusive_ptr & operator=(intrusive_ptr && rhs) + { + this_type(std::move(rhs)).swap(*this); + return *this; + } + #endif intrusive_ptr & operator=(intrusive_ptr const & rhs) diff --git a/boost/boost/smart_ptr/shared_ptr.hpp b/boost/boost/smart_ptr/shared_ptr.hpp index 6d1d7ccc04..3a89fc7e4a 100644 --- a/boost/boost/smart_ptr/shared_ptr.hpp +++ b/boost/boost/smart_ptr/shared_ptr.hpp @@ -61,6 +61,7 @@ namespace boost template class shared_ptr; template class weak_ptr; template class enable_shared_from_this; +template class enable_shared_from_this2; namespace detail { @@ -109,6 +110,14 @@ template< class X, class Y, class T > inline void sp_enable_shared_from_this( bo } } +template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::shared_ptr * ppx, Y const * py, boost::enable_shared_from_this2< T > const * pe ) +{ + if( pe != 0 ) + { + pe->_internal_accept_owner( ppx, const_cast< Y* >( py ) ); + } +} + #ifdef _MANAGED // Avoid C4793, ... causes native code generation @@ -359,14 +368,14 @@ public: shared_ptr & operator=( shared_ptr && r ) // never throws { - this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); + this_type( std::move( r ) ).swap( *this ); return *this; } template shared_ptr & operator=( shared_ptr && r ) // never throws { - this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); + this_type( std::move( r ) ).swap( *this ); return *this; } diff --git a/boost/boost/smart_ptr/weak_ptr.hpp b/boost/boost/smart_ptr/weak_ptr.hpp index a0c83f15b7..317ea44350 100644 --- a/boost/boost/smart_ptr/weak_ptr.hpp +++ b/boost/boost/smart_ptr/weak_ptr.hpp @@ -70,11 +70,43 @@ public: weak_ptr( weak_ptr const & r ) #endif - : pn(r.pn) // never throws + : px(r.lock().get()), pn(r.pn) // never throws { - px = r.lock().get(); } +#if defined( BOOST_HAS_RVALUE_REFS ) + + template +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + weak_ptr( weak_ptr && r, typename detail::sp_enable_if_convertible::type = detail::sp_empty() ) + +#else + + weak_ptr( weak_ptr && r ) + +#endif + : px(r.lock().get()), pn(std::move(r.pn)) // never throws + { + r.px = 0; + } + + // for better efficiency in the T == Y case + weak_ptr( weak_ptr && r ): px( r.px ), pn(std::move(r.pn)) // never throws + { + r.px = 0; + } + + // for better efficiency in the T == Y case + weak_ptr & operator=( weak_ptr && r ) // never throws + { + this_type( std::move( r ) ).swap( *this ); + return *this; + } + + +#endif + template #if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) @@ -99,6 +131,17 @@ public: return *this; } +#if defined( BOOST_HAS_RVALUE_REFS ) + + template + weak_ptr & operator=(weak_ptr && r) + { + this_type( std::move( r ) ).swap( *this ); + return *this; + } + +#endif + template weak_ptr & operator=(shared_ptr const & r) // never throws { @@ -124,6 +167,11 @@ public: return pn.use_count() == 0; } + bool _empty() const // extension, not in std::weak_ptr + { + return pn.empty(); + } + void reset() // never throws in 1.30+ { this_type().swap(*this); diff --git a/boost/boost/swap.hpp b/boost/boost/swap.hpp new file mode 100644 index 0000000000..f16f7b2e7d --- /dev/null +++ b/boost/boost/swap.hpp @@ -0,0 +1,12 @@ +// Copyright (C) 2007 Joseph Gauterin +// +// 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_SWAP_HPP +#define BOOST_SWAP_HPP + +#include "boost/utility/swap.hpp" + +#endif diff --git a/boost/boost/throw_exception.hpp b/boost/boost/throw_exception.hpp index da143393db..2250befb90 100644 --- a/boost/boost/throw_exception.hpp +++ b/boost/boost/throw_exception.hpp @@ -20,7 +20,7 @@ // http://www.boost.org/libs/utility/throw_exception.html // -#include +#include #include #include @@ -54,7 +54,7 @@ void throw_exception( std::exception const & e ); // user defined inline void throw_exception_assert_compatibility( std::exception const & ) { } -template inline void throw_exception( E const & e ) +template BOOST_ATTRIBUTE_NORETURN inline void throw_exception( E const & e ) { //All boost exceptions are required to derive std::exception, //to ensure compatibility with BOOST_NO_EXCEPTIONS. diff --git a/boost/boost/tuple/detail/tuple_basic.hpp b/boost/boost/tuple/detail/tuple_basic.hpp index ba59441f27..348fd80894 100644 --- a/boost/boost/tuple/detail/tuple_basic.hpp +++ b/boost/boost/tuple/detail/tuple_basic.hpp @@ -213,7 +213,7 @@ struct element_impl<0, T, true /* IsConst */> template -struct element: +struct element: public detail::element_impl::value> { }; @@ -488,11 +488,20 @@ struct length > { BOOST_STATIC_CONSTANT(int, value = 0); }; +template<> +struct length const> { + BOOST_STATIC_CONSTANT(int, value = 0); +}; + template<> struct length { BOOST_STATIC_CONSTANT(int, value = 0); }; +template<> +struct length { + BOOST_STATIC_CONSTANT(int, value = 0); +}; namespace detail { diff --git a/boost/boost/tuple/tuple_io.hpp b/boost/boost/tuple/tuple_io.hpp index b355e56dc0..10cdb1cc26 100644 --- a/boost/boost/tuple/tuple_io.hpp +++ b/boost/boost/tuple/tuple_io.hpp @@ -285,6 +285,21 @@ print(std::basic_ostream& o, const cons& t) { } // namespace detail #if defined (BOOST_NO_TEMPLATED_STREAMS) + +inline std::ostream& operator<<(std::ostream& o, const null_type& t) { + if (!o.good() ) return o; + + const char l = + detail::format_info::get_manipulator(o, detail::format_info::open); + const char r = + detail::format_info::get_manipulator(o, detail::format_info::close); + + o << l; + o << r; + + return o; +} + template inline std::ostream& operator<<(std::ostream& o, const cons& t) { if (!o.good() ) return o; @@ -305,6 +320,23 @@ inline std::ostream& operator<<(std::ostream& o, const cons& t) { #else +template +inline std::basic_ostream& +operator<<(std::basic_ostream& o, + const null_type& t) { + if (!o.good() ) return o; + + const CharType l = + detail::format_info::get_manipulator(o, detail::format_info::open); + const CharType r = + detail::format_info::get_manipulator(o, detail::format_info::close); + + o << l; + o << r; + + return o; +} + template inline std::basic_ostream& operator<<(std::basic_ostream& o, diff --git a/boost/boost/type_traits/alignment_of.hpp b/boost/boost/type_traits/alignment_of.hpp index 564d3bba00..51357ce560 100644 --- a/boost/boost/type_traits/alignment_of.hpp +++ b/boost/boost/type_traits/alignment_of.hpp @@ -57,11 +57,11 @@ template< typename T > struct alignment_of_impl { #if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400) - // - // With MSVC both the native __alignof operator - // and our own logic gets things wrong from time to time :-( - // Using a combination of the two seems to make the most of a bad job: - // + // + // With MSVC both the native __alignof operator + // and our own logic gets things wrong from time to time :-( + // Using a combination of the two seems to make the most of a bad job: + // BOOST_STATIC_CONSTANT(std::size_t, value = (::boost::detail::alignment_logic< sizeof(::boost::detail::alignment_of_hack) - sizeof(T), diff --git a/boost/boost/utility/addressof.hpp b/boost/boost/utility/addressof.hpp index ac42a51738..95cd92fca9 100644 --- a/boost/boost/utility/addressof.hpp +++ b/boost/boost/utility/addressof.hpp @@ -27,6 +27,9 @@ template struct addr_impl_ref inline addr_impl_ref( T & v ): v_( v ) {} inline operator T& () const { return v_; } + +private: + addr_impl_ref & operator=(const addr_impl_ref &); }; template struct addressof_impl diff --git a/boost/boost/utility/result_of.hpp b/boost/boost/utility/result_of.hpp index dc4203020f..26cab6f9f3 100644 --- a/boost/boost/utility/result_of.hpp +++ b/boost/boost/utility/result_of.hpp @@ -70,8 +70,8 @@ struct result_of_nested_result : F::template result template struct result_of_impl : mpl::if_, - result_of_void_impl, - result_of_nested_result >::type + result_of_void_impl, + result_of_nested_result >::type {}; } // end namespace detail diff --git a/boost/boost/version.hpp b/boost/boost/version.hpp index 8269beb280..49cfe766fb 100644 --- a/boost/boost/version.hpp +++ b/boost/boost/version.hpp @@ -19,7 +19,7 @@ // BOOST_VERSION / 100 % 1000 is the minor version // BOOST_VERSION / 100000 is the major version -#define BOOST_VERSION 103900 +#define BOOST_VERSION 104000 // // BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION @@ -27,7 +27,7 @@ // number, y is the minor version number, and z is the patch level if not 0. // This is used by to select which library version to link to. -#define BOOST_LIB_VERSION "1_39" +#define BOOST_LIB_VERSION "1_40" #endif diff --git a/boost/libs/regex/src/CMakeLists.txt b/boost/libs/regex/src/CMakeLists.txt new file mode 100755 index 0000000000..bbd03f92ac --- /dev/null +++ b/boost/libs/regex/src/CMakeLists.txt @@ -0,0 +1,40 @@ +# +# Copyright Troy D. Straszheim +# +# Distributed under the Boost Software License, Version 1.0. +# See http://www.boost.org/LICENSE_1_0.txt +# +# Look for the ICU library. If we find it, we'll compile in support for ICU +include(FindICU) +set(BOOST_REGEX_LIBRARIES) +if (ICU_FOUND AND ICU_I18N_FOUND) + add_definitions(-DBOOST_HAS_ICU=1) + include_directories(${ICU_INCLUDE_DIRS}) + set(BOOST_REGEX_LIBRARIES ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES}) +endif (ICU_FOUND AND ICU_I18N_FOUND) + +boost_add_library(boost_regex + c_regex_traits.cpp + cpp_regex_traits.cpp + cregex.cpp + fileiter.cpp + icu.cpp + instances.cpp + posix_api.cpp + regex.cpp + regex_debug.cpp + regex_raw_buffer.cpp + regex_traits_defaults.cpp + static_mutex.cpp + w32_regex_traits.cpp + wc_regex_traits.cpp + wide_posix_api.cpp + winstances.cpp + usinstances.cpp + LINK_LIBS ${BOOST_REGEX_LIBRARIES} + SHARED_COMPILE_FLAGS -DBOOST_REGEX_DYN_LINK=1) + + + + + diff --git a/boost/libs/regex/src/c_regex_traits.cpp b/boost/libs/regex/src/c_regex_traits.cpp index da960eb0c5..6466bc422e 100644 --- a/boost/libs/regex/src/c_regex_traits.cpp +++ b/boost/libs/regex/src/c_regex_traits.cpp @@ -122,7 +122,9 @@ enum char_class_graph=char_class_alnum|char_class_punct, char_class_blank=1<<9, char_class_word=1<<10, - char_class_unicode=1<<11 + char_class_unicode=1<<11, + char_class_horizontal=1<<12, + char_class_vertical=1<<13 }; c_regex_traits::char_class_type BOOST_REGEX_CALL c_regex_traits::lookup_classname(const char* p1, const char* p2) @@ -137,6 +139,7 @@ c_regex_traits::char_class_type BOOST_REGEX_CALL c_regex_traits::loo char_class_digit, char_class_digit, char_class_graph, + char_class_horizontal, char_class_lower, char_class_lower, char_class_print, @@ -146,6 +149,7 @@ c_regex_traits::char_class_type BOOST_REGEX_CALL c_regex_traits::loo char_class_upper, char_class_unicode, char_class_upper, + char_class_vertical, char_class_alnum | char_class_word, char_class_alnum | char_class_word, char_class_xdigit, @@ -176,7 +180,9 @@ bool BOOST_REGEX_CALL c_regex_traits::isctype(char c, char_class_type mask || ((mask & char_class_punct) && (std::ispunct)(static_cast(c))) || ((mask & char_class_xdigit) && (std::isxdigit)(static_cast(c))) || ((mask & char_class_blank) && (std::isspace)(static_cast(c)) && !::boost::re_detail::is_separator(c)) - || ((mask & char_class_word) && (c == '_')); + || ((mask & char_class_word) && (c == '_')) + || ((mask & char_class_vertical) && (::boost::re_detail::is_separator(c) || (c == '\v'))) + || ((mask & char_class_horizontal) && (std::isspace)(static_cast(c)) && !::boost::re_detail::is_separator(c) && (c != '\v')); } c_regex_traits::string_type BOOST_REGEX_CALL c_regex_traits::lookup_collatename(const char* p1, const char* p2) diff --git a/boost/libs/regex/src/cregex.cpp b/boost/libs/regex/src/cregex.cpp index 234f0467f9..fb12373a2f 100644 --- a/boost/libs/regex/src/cregex.cpp +++ b/boost/libs/regex/src/cregex.cpp @@ -28,6 +28,10 @@ typedef boost::match_flag_type match_flag_type; #include +#ifdef BOOST_MSVC +#pragma warning(disable:4309) +#endif + namespace boost{ #ifdef __BORLANDC__ @@ -559,7 +563,7 @@ std::string RegEx::What(int i)const return result; } -#if defined(BOOST_HAS_LONG_LONG) && !defined(_MSC_VER) +#ifdef BOOST_HAS_LONG_LONG const std::size_t RegEx::npos = static_cast(~0ULL); #else const std::size_t RegEx::npos = static_cast(~0UL); @@ -641,3 +645,4 @@ basic_string::replace(wchar_t* f1, wchar_t* f2, const w + diff --git a/boost/libs/regex/src/icu.cpp b/boost/libs/regex/src/icu.cpp new file mode 100755 index 0000000000..c5eb538dac --- /dev/null +++ b/boost/libs/regex/src/icu.cpp @@ -0,0 +1,503 @@ +/* + * + * 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 icu.cpp + * VERSION see + * DESCRIPTION: Unicode regular expressions on top of the ICU Library. + */ +#define BOOST_REGEX_SOURCE + +#include +#ifdef BOOST_HAS_ICU +#define BOOST_REGEX_ICU_INSTANTIATE +#include + +namespace boost{ + +namespace re_detail{ + +icu_regex_traits_implementation::string_type icu_regex_traits_implementation::do_transform(const char_type* p1, const char_type* p2, const U_NAMESPACE_QUALIFIER Collator* pcoll) const +{ + // TODO make thread safe!!!! : + typedef u32_to_u16_iterator itt; + itt i(p1), j(p2); +#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS + std::vector< ::UChar> t(i, j); +#else + std::vector< ::UChar> t; + while(i != j) + t.push_back(*i++); +#endif + ::uint8_t result[100]; + ::int32_t len; + if(t.size()) + len = pcoll->getSortKey(&*t.begin(), static_cast< ::int32_t>(t.size()), result, sizeof(result)); + else + len = pcoll->getSortKey(static_cast(0), static_cast< ::int32_t>(0), result, sizeof(result)); + if(std::size_t(len) > sizeof(result)) + { + scoped_array< ::uint8_t> presult(new ::uint8_t[len+1]); + if(t.size()) + len = pcoll->getSortKey(&*t.begin(), static_cast< ::int32_t>(t.size()), presult.get(), len+1); + else + len = pcoll->getSortKey(static_cast(0), static_cast< ::int32_t>(0), presult.get(), len+1); + if((0 == presult[len-1]) && (len > 1)) + --len; +#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS + return string_type(presult.get(), presult.get()+len); +#else + string_type sresult; + ::uint8_t const* ia = presult.get(); + ::uint8_t const* ib = presult.get()+len; + while(ia != ib) + sresult.push_back(*ia++); + return sresult; +#endif + } + if((0 == result[len-1]) && (len > 1)) + --len; +#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS + return string_type(result, result+len); +#else + string_type sresult; + ::uint8_t const* ia = result; + ::uint8_t const* ib = result+len; + while(ia != ib) + sresult.push_back(*ia++); + return sresult; +#endif +} + +} + +icu_regex_traits::size_type icu_regex_traits::length(const char_type* p) +{ + size_type result = 0; + while(*p) + { + ++p; + ++result; + } + return result; +} + +// +// define our bitmasks: +// +const icu_regex_traits::char_class_type icu_regex_traits::mask_blank = icu_regex_traits::char_class_type(1) << offset_blank; +const icu_regex_traits::char_class_type icu_regex_traits::mask_space = icu_regex_traits::char_class_type(1) << offset_space; +const icu_regex_traits::char_class_type icu_regex_traits::mask_xdigit = icu_regex_traits::char_class_type(1) << offset_xdigit; +const icu_regex_traits::char_class_type icu_regex_traits::mask_underscore = icu_regex_traits::char_class_type(1) << offset_underscore; +const icu_regex_traits::char_class_type icu_regex_traits::mask_unicode = icu_regex_traits::char_class_type(1) << offset_unicode; +const icu_regex_traits::char_class_type icu_regex_traits::mask_any = icu_regex_traits::char_class_type(1) << offset_any; +const icu_regex_traits::char_class_type icu_regex_traits::mask_ascii = icu_regex_traits::char_class_type(1) << offset_ascii; +const icu_regex_traits::char_class_type icu_regex_traits::mask_horizontal = icu_regex_traits::char_class_type(1) << offset_horizontal; +const icu_regex_traits::char_class_type icu_regex_traits::mask_vertical = icu_regex_traits::char_class_type(1) << offset_vertical; + +icu_regex_traits::char_class_type icu_regex_traits::lookup_icu_mask(const ::UChar32* p1, const ::UChar32* p2) +{ + static const ::UChar32 prop_name_table[] = { + /* any */ 'a', 'n', 'y', + /* ascii */ 'a', 's', 'c', 'i', 'i', + /* assigned */ 'a', 's', 's', 'i', 'g', 'n', 'e', 'd', + /* c* */ 'c', '*', + /* cc */ 'c', 'c', + /* cf */ 'c', 'f', + /* closepunctuation */ 'c', 'l', 'o', 's', 'e', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', + /* cn */ 'c', 'n', + /* co */ 'c', 'o', + /* connectorpunctuation */ 'c', 'o', 'n', 'n', 'e', 'c', 't', 'o', 'r', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', + /* control */ 'c', 'o', 'n', 't', 'r', 'o', 'l', + /* cs */ 'c', 's', + /* currencysymbol */ 'c', 'u', 'r', 'r', 'e', 'n', 'c', 'y', 's', 'y', 'm', 'b', 'o', 'l', + /* dashpunctuation */ 'd', 'a', 's', 'h', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', + /* decimaldigitnumber */ 'd', 'e', 'c', 'i', 'm', 'a', 'l', 'd', 'i', 'g', 'i', 't', 'n', 'u', 'm', 'b', 'e', 'r', + /* enclosingmark */ 'e', 'n', 'c', 'l', 'o', 's', 'i', 'n', 'g', 'm', 'a', 'r', 'k', + /* finalpunctuation */ 'f', 'i', 'n', 'a', 'l', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', + /* format */ 'f', 'o', 'r', 'm', 'a', 't', + /* initialpunctuation */ 'i', 'n', 'i', 't', 'i', 'a', 'l', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', + /* l* */ 'l', '*', + /* letter */ 'l', 'e', 't', 't', 'e', 'r', + /* letternumber */ 'l', 'e', 't', 't', 'e', 'r', 'n', 'u', 'm', 'b', 'e', 'r', + /* lineseparator */ 'l', 'i', 'n', 'e', 's', 'e', 'p', 'a', 'r', 'a', 't', 'o', 'r', + /* ll */ 'l', 'l', + /* lm */ 'l', 'm', + /* lo */ 'l', 'o', + /* lowercaseletter */ 'l', 'o', 'w', 'e', 'r', 'c', 'a', 's', 'e', 'l', 'e', 't', 't', 'e', 'r', + /* lt */ 'l', 't', + /* lu */ 'l', 'u', + /* m* */ 'm', '*', + /* mark */ 'm', 'a', 'r', 'k', + /* mathsymbol */ 'm', 'a', 't', 'h', 's', 'y', 'm', 'b', 'o', 'l', + /* mc */ 'm', 'c', + /* me */ 'm', 'e', + /* mn */ 'm', 'n', + /* modifierletter */ 'm', 'o', 'd', 'i', 'f', 'i', 'e', 'r', 'l', 'e', 't', 't', 'e', 'r', + /* modifiersymbol */ 'm', 'o', 'd', 'i', 'f', 'i', 'e', 'r', 's', 'y', 'm', 'b', 'o', 'l', + /* n* */ 'n', '*', + /* nd */ 'n', 'd', + /* nl */ 'n', 'l', + /* no */ 'n', 'o', + /* nonspacingmark */ 'n', 'o', 'n', 's', 'p', 'a', 'c', 'i', 'n', 'g', 'm', 'a', 'r', 'k', + /* notassigned */ 'n', 'o', 't', 'a', 's', 's', 'i', 'g', 'n', 'e', 'd', + /* number */ 'n', 'u', 'm', 'b', 'e', 'r', + /* openpunctuation */ 'o', 'p', 'e', 'n', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', + /* other */ 'o', 't', 'h', 'e', 'r', + /* otherletter */ 'o', 't', 'h', 'e', 'r', 'l', 'e', 't', 't', 'e', 'r', + /* othernumber */ 'o', 't', 'h', 'e', 'r', 'n', 'u', 'm', 'b', 'e', 'r', + /* otherpunctuation */ 'o', 't', 'h', 'e', 'r', 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', + /* othersymbol */ 'o', 't', 'h', 'e', 'r', 's', 'y', 'm', 'b', 'o', 'l', + /* p* */ 'p', '*', + /* paragraphseparator */ 'p', 'a', 'r', 'a', 'g', 'r', 'a', 'p', 'h', 's', 'e', 'p', 'a', 'r', 'a', 't', 'o', 'r', + /* pc */ 'p', 'c', + /* pd */ 'p', 'd', + /* pe */ 'p', 'e', + /* pf */ 'p', 'f', + /* pi */ 'p', 'i', + /* po */ 'p', 'o', + /* privateuse */ 'p', 'r', 'i', 'v', 'a', 't', 'e', 'u', 's', 'e', + /* ps */ 'p', 's', + /* punctuation */ 'p', 'u', 'n', 'c', 't', 'u', 'a', 't', 'i', 'o', 'n', + /* s* */ 's', '*', + /* sc */ 's', 'c', + /* separator */ 's', 'e', 'p', 'a', 'r', 'a', 't', 'o', 'r', + /* sk */ 's', 'k', + /* sm */ 's', 'm', + /* so */ 's', 'o', + /* spaceseparator */ 's', 'p', 'a', 'c', 'e', 's', 'e', 'p', 'a', 'r', 'a', 't', 'o', 'r', + /* spacingcombiningmark */ 's', 'p', 'a', 'c', 'i', 'n', 'g', 'c', 'o', 'm', 'b', 'i', 'n', 'i', 'n', 'g', 'm', 'a', 'r', 'k', + /* surrogate */ 's', 'u', 'r', 'r', 'o', 'g', 'a', 't', 'e', + /* symbol */ 's', 'y', 'm', 'b', 'o', 'l', + /* titlecase */ 't', 'i', 't', 'l', 'e', 'c', 'a', 's', 'e', + /* titlecaseletter */ 't', 'i', 't', 'l', 'e', 'c', 'a', 's', 'e', 'l', 'e', 't', 't', 'e', 'r', + /* uppercaseletter */ 'u', 'p', 'p', 'e', 'r', 'c', 'a', 's', 'e', 'l', 'e', 't', 't', 'e', 'r', + /* z* */ 'z', '*', + /* zl */ 'z', 'l', + /* zp */ 'z', 'p', + /* zs */ 'z', 's', + }; + + static const re_detail::character_pointer_range< ::UChar32> range_data[] = { + { prop_name_table+0, prop_name_table+3, }, // any + { prop_name_table+3, prop_name_table+8, }, // ascii + { prop_name_table+8, prop_name_table+16, }, // assigned + { prop_name_table+16, prop_name_table+18, }, // c* + { prop_name_table+18, prop_name_table+20, }, // cc + { prop_name_table+20, prop_name_table+22, }, // cf + { prop_name_table+22, prop_name_table+38, }, // closepunctuation + { prop_name_table+38, prop_name_table+40, }, // cn + { prop_name_table+40, prop_name_table+42, }, // co + { prop_name_table+42, prop_name_table+62, }, // connectorpunctuation + { prop_name_table+62, prop_name_table+69, }, // control + { prop_name_table+69, prop_name_table+71, }, // cs + { prop_name_table+71, prop_name_table+85, }, // currencysymbol + { prop_name_table+85, prop_name_table+100, }, // dashpunctuation + { prop_name_table+100, prop_name_table+118, }, // decimaldigitnumber + { prop_name_table+118, prop_name_table+131, }, // enclosingmark + { prop_name_table+131, prop_name_table+147, }, // finalpunctuation + { prop_name_table+147, prop_name_table+153, }, // format + { prop_name_table+153, prop_name_table+171, }, // initialpunctuation + { prop_name_table+171, prop_name_table+173, }, // l* + { prop_name_table+173, prop_name_table+179, }, // letter + { prop_name_table+179, prop_name_table+191, }, // letternumber + { prop_name_table+191, prop_name_table+204, }, // lineseparator + { prop_name_table+204, prop_name_table+206, }, // ll + { prop_name_table+206, prop_name_table+208, }, // lm + { prop_name_table+208, prop_name_table+210, }, // lo + { prop_name_table+210, prop_name_table+225, }, // lowercaseletter + { prop_name_table+225, prop_name_table+227, }, // lt + { prop_name_table+227, prop_name_table+229, }, // lu + { prop_name_table+229, prop_name_table+231, }, // m* + { prop_name_table+231, prop_name_table+235, }, // mark + { prop_name_table+235, prop_name_table+245, }, // mathsymbol + { prop_name_table+245, prop_name_table+247, }, // mc + { prop_name_table+247, prop_name_table+249, }, // me + { prop_name_table+249, prop_name_table+251, }, // mn + { prop_name_table+251, prop_name_table+265, }, // modifierletter + { prop_name_table+265, prop_name_table+279, }, // modifiersymbol + { prop_name_table+279, prop_name_table+281, }, // n* + { prop_name_table+281, prop_name_table+283, }, // nd + { prop_name_table+283, prop_name_table+285, }, // nl + { prop_name_table+285, prop_name_table+287, }, // no + { prop_name_table+287, prop_name_table+301, }, // nonspacingmark + { prop_name_table+301, prop_name_table+312, }, // notassigned + { prop_name_table+312, prop_name_table+318, }, // number + { prop_name_table+318, prop_name_table+333, }, // openpunctuation + { prop_name_table+333, prop_name_table+338, }, // other + { prop_name_table+338, prop_name_table+349, }, // otherletter + { prop_name_table+349, prop_name_table+360, }, // othernumber + { prop_name_table+360, prop_name_table+376, }, // otherpunctuation + { prop_name_table+376, prop_name_table+387, }, // othersymbol + { prop_name_table+387, prop_name_table+389, }, // p* + { prop_name_table+389, prop_name_table+407, }, // paragraphseparator + { prop_name_table+407, prop_name_table+409, }, // pc + { prop_name_table+409, prop_name_table+411, }, // pd + { prop_name_table+411, prop_name_table+413, }, // pe + { prop_name_table+413, prop_name_table+415, }, // pf + { prop_name_table+415, prop_name_table+417, }, // pi + { prop_name_table+417, prop_name_table+419, }, // po + { prop_name_table+419, prop_name_table+429, }, // privateuse + { prop_name_table+429, prop_name_table+431, }, // ps + { prop_name_table+431, prop_name_table+442, }, // punctuation + { prop_name_table+442, prop_name_table+444, }, // s* + { prop_name_table+444, prop_name_table+446, }, // sc + { prop_name_table+446, prop_name_table+455, }, // separator + { prop_name_table+455, prop_name_table+457, }, // sk + { prop_name_table+457, prop_name_table+459, }, // sm + { prop_name_table+459, prop_name_table+461, }, // so + { prop_name_table+461, prop_name_table+475, }, // spaceseparator + { prop_name_table+475, prop_name_table+495, }, // spacingcombiningmark + { prop_name_table+495, prop_name_table+504, }, // surrogate + { prop_name_table+504, prop_name_table+510, }, // symbol + { prop_name_table+510, prop_name_table+519, }, // titlecase + { prop_name_table+519, prop_name_table+534, }, // titlecaseletter + { prop_name_table+534, prop_name_table+549, }, // uppercaseletter + { prop_name_table+549, prop_name_table+551, }, // z* + { prop_name_table+551, prop_name_table+553, }, // zl + { prop_name_table+553, prop_name_table+555, }, // zp + { prop_name_table+555, prop_name_table+557, }, // zs + }; + + static const icu_regex_traits::char_class_type icu_class_map[] = { + icu_regex_traits::mask_any, // any + icu_regex_traits::mask_ascii, // ascii + (0x3FFFFFFFu) & ~(U_GC_CN_MASK), // assigned + U_GC_C_MASK, // c* + U_GC_CC_MASK, // cc + U_GC_CF_MASK, // cf + U_GC_PE_MASK, // closepunctuation + U_GC_CN_MASK, // cn + U_GC_CO_MASK, // co + U_GC_PC_MASK, // connectorpunctuation + U_GC_CC_MASK, // control + U_GC_CS_MASK, // cs + U_GC_SC_MASK, // currencysymbol + U_GC_PD_MASK, // dashpunctuation + U_GC_ND_MASK, // decimaldigitnumber + U_GC_ME_MASK, // enclosingmark + U_GC_PF_MASK, // finalpunctuation + U_GC_CF_MASK, // format + U_GC_PI_MASK, // initialpunctuation + U_GC_L_MASK, // l* + U_GC_L_MASK, // letter + U_GC_NL_MASK, // letternumber + U_GC_ZL_MASK, // lineseparator + U_GC_LL_MASK, // ll + U_GC_LM_MASK, // lm + U_GC_LO_MASK, // lo + U_GC_LL_MASK, // lowercaseletter + U_GC_LT_MASK, // lt + U_GC_LU_MASK, // lu + U_GC_M_MASK, // m* + U_GC_M_MASK, // mark + U_GC_SM_MASK, // mathsymbol + U_GC_MC_MASK, // mc + U_GC_ME_MASK, // me + U_GC_MN_MASK, // mn + U_GC_LM_MASK, // modifierletter + U_GC_SK_MASK, // modifiersymbol + U_GC_N_MASK, // n* + U_GC_ND_MASK, // nd + U_GC_NL_MASK, // nl + U_GC_NO_MASK, // no + U_GC_MN_MASK, // nonspacingmark + U_GC_CN_MASK, // notassigned + U_GC_N_MASK, // number + U_GC_PS_MASK, // openpunctuation + U_GC_C_MASK, // other + U_GC_LO_MASK, // otherletter + U_GC_NO_MASK, // othernumber + U_GC_PO_MASK, // otherpunctuation + U_GC_SO_MASK, // othersymbol + U_GC_P_MASK, // p* + U_GC_ZP_MASK, // paragraphseparator + U_GC_PC_MASK, // pc + U_GC_PD_MASK, // pd + U_GC_PE_MASK, // pe + U_GC_PF_MASK, // pf + U_GC_PI_MASK, // pi + U_GC_PO_MASK, // po + U_GC_CO_MASK, // privateuse + U_GC_PS_MASK, // ps + U_GC_P_MASK, // punctuation + U_GC_S_MASK, // s* + U_GC_SC_MASK, // sc + U_GC_Z_MASK, // separator + U_GC_SK_MASK, // sk + U_GC_SM_MASK, // sm + U_GC_SO_MASK, // so + U_GC_ZS_MASK, // spaceseparator + U_GC_MC_MASK, // spacingcombiningmark + U_GC_CS_MASK, // surrogate + U_GC_S_MASK, // symbol + U_GC_LT_MASK, // titlecase + U_GC_LT_MASK, // titlecaseletter + U_GC_LU_MASK, // uppercaseletter + U_GC_Z_MASK, // z* + U_GC_ZL_MASK, // zl + U_GC_ZP_MASK, // zp + U_GC_ZS_MASK, // zs + }; + + + static const re_detail::character_pointer_range< ::UChar32>* ranges_begin = range_data; + static const re_detail::character_pointer_range< ::UChar32>* ranges_end = range_data + (sizeof(range_data)/sizeof(range_data[0])); + + re_detail::character_pointer_range< ::UChar32> t = { p1, p2, }; + const re_detail::character_pointer_range< ::UChar32>* p = std::lower_bound(ranges_begin, ranges_end, t); + if((p != ranges_end) && (t == *p)) + return icu_class_map[p - ranges_begin]; + return 0; +} + +icu_regex_traits::char_class_type icu_regex_traits::lookup_classname(const char_type* p1, const char_type* p2) const +{ + static const char_class_type masks[] = + { + 0, + U_GC_L_MASK | U_GC_ND_MASK, + U_GC_L_MASK, + mask_blank, + U_GC_CC_MASK | U_GC_CF_MASK | U_GC_ZL_MASK | U_GC_ZP_MASK, + U_GC_ND_MASK, + U_GC_ND_MASK, + (0x3FFFFFFFu) & ~(U_GC_CC_MASK | U_GC_CF_MASK | U_GC_CS_MASK | U_GC_CN_MASK | U_GC_Z_MASK), + mask_horizontal, + U_GC_LL_MASK, + U_GC_LL_MASK, + ~(U_GC_C_MASK), + U_GC_P_MASK, + char_class_type(U_GC_Z_MASK) | mask_space, + char_class_type(U_GC_Z_MASK) | mask_space, + U_GC_LU_MASK, + mask_unicode, + U_GC_LU_MASK, + mask_vertical, + char_class_type(U_GC_L_MASK | U_GC_ND_MASK | U_GC_MN_MASK) | mask_underscore, + char_class_type(U_GC_L_MASK | U_GC_ND_MASK | U_GC_MN_MASK) | mask_underscore, + char_class_type(U_GC_ND_MASK) | mask_xdigit, + }; + + int id = ::boost::re_detail::get_default_class_id(p1, p2); + if(id >= 0) + return masks[id+1]; + char_class_type result = lookup_icu_mask(p1, p2); + if(result != 0) + return result; + + if(id < 0) + { + string_type s(p1, p2); + string_type::size_type i = 0; + while(i < s.size()) + { + s[i] = static_cast((::u_tolower)(s[i])); + if(::u_isspace(s[i]) || (s[i] == '-') || (s[i] == '_')) + s.erase(s.begin()+i, s.begin()+i+1); + else + { + s[i] = static_cast((::u_tolower)(s[i])); + ++i; + } + } + if(s.size()) + id = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size()); + if(id >= 0) + return masks[id+1]; + if(s.size()) + result = lookup_icu_mask(&*s.begin(), &*s.begin() + s.size()); + if(result != 0) + return result; + } + BOOST_ASSERT(std::size_t(id+1) < sizeof(masks) / sizeof(masks[0])); + return masks[id+1]; +} + +icu_regex_traits::string_type icu_regex_traits::lookup_collatename(const char_type* p1, const char_type* p2) const +{ + string_type result; + if(std::find_if(p1, p2, std::bind2nd(std::greater< ::UChar32>(), 0x7f)) == p2) + { +#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS + std::string s(p1, p2); +#else + std::string s; + const char_type* p3 = p1; + while(p3 != p2) + s.append(1, *p3++); +#endif + // Try Unicode name: + UErrorCode err = U_ZERO_ERROR; + UChar32 c = ::u_charFromName(U_UNICODE_CHAR_NAME, s.c_str(), &err); + if(U_SUCCESS(err)) + { + result.push_back(c); + return result; + } + // Try Unicode-extended name: + err = U_ZERO_ERROR; + c = ::u_charFromName(U_EXTENDED_CHAR_NAME, s.c_str(), &err); + if(U_SUCCESS(err)) + { + result.push_back(c); + return result; + } + // try POSIX name: + s = ::boost::re_detail::lookup_default_collate_name(s); +#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS + result.assign(s.begin(), s.end()); +#else + result.clear(); + std::string::const_iterator si, sj; + si = s.begin(); + sj = s.end(); + while(si != sj) + result.push_back(*si++); +#endif + } + if(result.empty() && (p2-p1 == 1)) + result.push_back(*p1); + return result; +} + +bool icu_regex_traits::isctype(char_type c, char_class_type f) const +{ + // check for standard catagories first: + char_class_type m = char_class_type(1u << u_charType(c)); + if((m & f) != 0) + return true; + // now check for special cases: + if(((f & mask_blank) != 0) && u_isblank(c)) + return true; + if(((f & mask_space) != 0) && u_isspace(c)) + return true; + if(((f & mask_xdigit) != 0) && (u_digit(c, 16) >= 0)) + return true; + if(((f & mask_unicode) != 0) && (c >= 0x100)) + return true; + if(((f & mask_underscore) != 0) && (c == '_')) + return true; + if(((f & mask_any) != 0) && (c <= 0x10FFFF)) + return true; + if(((f & mask_ascii) != 0) && (c <= 0x7F)) + return true; + if(((f & mask_vertical) != 0) && (::boost::re_detail::is_separator(c) || (c == static_cast('\v')) || (m == U_GC_ZL_MASK) || (m == U_GC_ZP_MASK))) + return true; + if(((f & mask_horizontal) != 0) && !::boost::re_detail::is_separator(c) && u_isspace(c) && (c != static_cast('\v'))) + return true; + return false; +} + +} + +#endif // BOOST_HAS_ICU diff --git a/boost/libs/regex/src/regex_traits_defaults.cpp b/boost/libs/regex/src/regex_traits_defaults.cpp index 8f76c09e4f..c9596a3daf 100644 --- a/boost/libs/regex/src/regex_traits_defaults.cpp +++ b/boost/libs/regex/src/regex_traits_defaults.cpp @@ -100,6 +100,9 @@ BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_syntax(regex_constants "p", "P", "N", + "g", + "K", + "R", }; return ((n >= (sizeof(messages) / sizeof(messages[1]))) ? "" : messages[n]); @@ -375,14 +378,14 @@ BOOST_REGEX_DECL regex_constants::escape_syntax_type BOOST_REGEX_CALL get_defaul 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_reset_start_mark, /*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_line_ending, /*R*/ regex_constants::escape_type_not_class, /*S*/ regex_constants::escape_type_not_class, /*T*/ regex_constants::escape_type_not_class, /*U*/ @@ -403,11 +406,11 @@ BOOST_REGEX_DECL regex_constants::escape_syntax_type BOOST_REGEX_CALL get_defaul 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_extended_backref, /*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_extended_backref, /*k*/ regex_constants::escape_type_class, /*l*/ regex_constants::escape_type_class, /*m*/ regex_constants::escape_type_control_n, /*n*/ @@ -534,7 +537,7 @@ BOOST_REGEX_DECL regex_constants::syntax_type BOOST_REGEX_CALL get_default_synta regex_constants::syntax_dollar, /*$*/ regex_constants::syntax_char, /*%*/ regex_constants::syntax_char, /*&*/ - regex_constants::syntax_char, /*'*/ + regex_constants::escape_type_end_buffer, /*'*/ regex_constants::syntax_open_mark, /*(*/ regex_constants::syntax_close_mark, /*)*/ regex_constants::syntax_star, /***/ diff --git a/boost/libs/regex/src/static_mutex.cpp b/boost/libs/regex/src/static_mutex.cpp new file mode 100755 index 0000000000..b200f29755 --- /dev/null +++ b/boost/libs/regex/src/static_mutex.cpp @@ -0,0 +1,179 @@ +/* + * + * 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 static_mutex.cpp + * VERSION see + * DESCRIPTION: Declares static_mutex lock type. + */ + +#define BOOST_REGEX_SOURCE +#include + +#ifdef BOOST_HAS_THREADS + +#include + +#if defined(BOOST_HAS_WINTHREADS) +#ifndef NOMINMAX +# define NOMINMAX +#endif +#define WIN32_LEAN_AND_MEAN +#include +#include +#endif + + +namespace boost{ + +#if defined(BOOST_HAS_PTHREADS) && defined(PTHREAD_MUTEX_INITIALIZER) + +scoped_static_mutex_lock::scoped_static_mutex_lock(static_mutex& m, bool lk) +: m_mutex(m), m_have_lock(false) +{ + if(lk) + lock(); +} + +scoped_static_mutex_lock::~scoped_static_mutex_lock() +{ + if(m_have_lock) + unlock(); +} + +void scoped_static_mutex_lock::lock() +{ + if(0 == m_have_lock) + { + pthread_mutex_lock(&(m_mutex.m_mutex)); + m_have_lock = true; + } +} + +void scoped_static_mutex_lock::unlock() +{ + if(m_have_lock) + { + pthread_mutex_unlock(&(m_mutex.m_mutex)); + m_have_lock = false; + } +} + +#elif defined(BOOST_HAS_WINTHREADS) + +BOOST_STATIC_ASSERT(sizeof(LONG) == sizeof(boost::int32_t)); + +scoped_static_mutex_lock::scoped_static_mutex_lock(static_mutex& m, bool lk) +: m_mutex(m), m_have_lock(false) +{ + if(lk) + lock(); +} + +scoped_static_mutex_lock::~scoped_static_mutex_lock() +{ + if(m_have_lock) + unlock(); +} + +void scoped_static_mutex_lock::lock() +{ + if(0 == m_have_lock) + { +#if !defined(InterlockedCompareExchangePointer) + while(0 != InterlockedCompareExchange(reinterpret_cast((boost::uint_least16_t*)&(m_mutex.m_mutex)), (void*)1, 0)) +#else + while(0 != InterlockedCompareExchange(reinterpret_cast(&(m_mutex.m_mutex)), 1, 0)) +#endif + { + Sleep(0); + } + m_have_lock = true; + } +} + +void scoped_static_mutex_lock::unlock() +{ + if(m_have_lock) + { +#if !defined(InterlockedCompareExchangePointer) + InterlockedExchange((LONG*)&(m_mutex.m_mutex), 0); +#else + InterlockedExchange(reinterpret_cast(&(m_mutex.m_mutex)), 0); +#endif + m_have_lock = false; + } +} + +#else +// +// Portable version of a static mutex based on Boost.Thread library: +// +#include +#include + +boost::recursive_mutex* static_mutex::m_pmutex = 0; +boost::once_flag static_mutex::m_once = BOOST_ONCE_INIT; + +extern "C" BOOST_REGEX_DECL void free_static_mutex() +{ + delete static_mutex::m_pmutex; + static_mutex::m_pmutex = 0; +} + +void static_mutex::init() +{ + m_pmutex = new boost::recursive_mutex(); + int r = atexit(free_static_mutex); + BOOST_ASSERT(0 == r); +} + +scoped_static_mutex_lock::scoped_static_mutex_lock(static_mutex& , bool lk) +: m_plock(0), m_have_lock(false) +{ + if(lk) + lock(); +} + +scoped_static_mutex_lock::~scoped_static_mutex_lock() +{ + if(m_have_lock) + unlock(); + delete m_plock; +} + +void scoped_static_mutex_lock::lock() +{ + if(0 == m_have_lock) + { + boost::call_once(static_mutex::m_once,&static_mutex::init); + if(0 == m_plock) + m_plock = new boost::recursive_mutex::scoped_lock(*static_mutex::m_pmutex, false); + m_plock->lock(); + m_have_lock = true; + } +} + +void scoped_static_mutex_lock::unlock() +{ + if(m_have_lock) + { + m_plock->unlock(); + m_have_lock = false; + } +} + +#endif + +} + +#endif // BOOST_HAS_THREADS diff --git a/boost/libs/regex/src/usinstances.cpp b/boost/libs/regex/src/usinstances.cpp new file mode 100755 index 0000000000..8d6352e1b0 --- /dev/null +++ b/boost/libs/regex/src/usinstances.cpp @@ -0,0 +1,78 @@ +/* + * + * 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: winstances.cpp + * VERSION: see + * DESCRIPTION: regex unsigned short template instances (MSVC only). + */ + +#define BOOST_REGEX_SOURCE + +#include +#include +#include + +#if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE) && defined(_NATIVE_WCHAR_T_DEFINED) \ + && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER))\ + && BOOST_WORKAROUND(BOOST_MSVC, <1600) +// +// This is a horrible workaround, but without declaring these symbols extern we get +// duplicate symbol errors when linking if the application is built without +// /Zc:wchar_t +// +#ifdef _CRTIMP2_PURE +# define BOOST_REGEX_STDLIB_DECL _CRTIMP2_PURE +#else +# define BOOST_REGEX_STDLIB_DECL _CRTIMP2 +#endif + +namespace std{ + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +template class BOOST_REGEX_STDLIB_DECL allocator; +template class BOOST_REGEX_STDLIB_DECL _String_val >; +template class BOOST_REGEX_STDLIB_DECL basic_string, allocator >; +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) && BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) +template<> BOOST_REGEX_STDLIB_DECL std::size_t __cdecl char_traits::length(unsigned short const*); +#endif + +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==( + const basic_string, allocator >&, + const basic_string, allocator >&); +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==( + const unsigned short *, + const basic_string, allocator >&); +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==( + const basic_string, allocator >&, + const unsigned short *); +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator<( + const basic_string, allocator >&, + const basic_string, allocator >&); +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator>( + const basic_string, allocator >&, + const basic_string, allocator >&); +} +#endif + +#include + +#if !defined(BOOST_NO_WREGEX) && defined(BOOST_REGEX_HAS_OTHER_WCHAR_T) && !defined(BOOST_REGEX_NO_EXTERNAL_TEMPLATES) +#define BOOST_REGEX_US_INSTANTIATE + +#include + +#endif + + diff --git a/boost/libs/regex/src/wc_regex_traits.cpp b/boost/libs/regex/src/wc_regex_traits.cpp new file mode 100755 index 0000000000..52132febee --- /dev/null +++ b/boost/libs/regex/src/wc_regex_traits.cpp @@ -0,0 +1,320 @@ +/* + * + * 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: wc_regex_traits.cpp + * VERSION: see + * DESCRIPTION: Implements out of line members for c_regex_traits + */ + + +#define BOOST_REGEX_SOURCE + +#include +#include +#include + +#if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE) && defined(_NATIVE_WCHAR_T_DEFINED) \ + && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER))\ + && BOOST_WORKAROUND(BOOST_MSVC, <1600) +// +// This is a horrible workaround, but without declaring these symbols extern we get +// duplicate symbol errors when linking if the application is built without +// /Zc:wchar_t +// +#ifdef _CRTIMP2_PURE +# define BOOST_REGEX_STDLIB_DECL _CRTIMP2_PURE +#else +# define BOOST_REGEX_STDLIB_DECL _CRTIMP2 +#endif + +namespace std{ + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +template class BOOST_REGEX_STDLIB_DECL allocator; +template class BOOST_REGEX_STDLIB_DECL _String_val >; +template class BOOST_REGEX_STDLIB_DECL basic_string, allocator >; +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) && BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) +template<> BOOST_REGEX_STDLIB_DECL std::size_t __cdecl char_traits::length(unsigned short const*); +#endif + +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==( + const basic_string, allocator >&, + const basic_string, allocator >&); +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==( + const unsigned short *, + const basic_string, allocator >&); +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator==( + const basic_string, allocator >&, + const unsigned short *); +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator<( + const basic_string, allocator >&, + const basic_string, allocator >&); +template BOOST_REGEX_STDLIB_DECL bool __cdecl operator>( + const basic_string, allocator >&, + const basic_string, allocator >&); +} +#endif + +#include +#include + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x560) + +#include +#ifndef BOOST_NO_WREGEX +#include +#include + +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::wcstol; +} +#endif + +namespace boost{ + +c_regex_traits::string_type BOOST_REGEX_CALL c_regex_traits::transform(const wchar_t* p1, const wchar_t* p2) +{ + std::size_t r; + std::size_t s = 10; + std::wstring src(p1, p2); + std::wstring result(s, L' '); + while(s < (r = std::wcsxfrm(&*result.begin(), src.c_str(), s))) + { + result.append(r - s + 3, L' '); + s = result.size(); + } + result.erase(r); + return result; +} + +c_regex_traits::string_type BOOST_REGEX_CALL c_regex_traits::transform_primary(const wchar_t* p1, const wchar_t* p2) +{ + static wchar_t s_delim; + static const int s_collate_type = ::boost::re_detail::find_sort_syntax(static_cast*>(0), &s_delim); + std::wstring result; + // + // What we do here depends upon the format of the sort key returned by + // sort key returned by this->transform: + // + switch(s_collate_type) + { + 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: + { + result.assign(p1, p2); + for(std::wstring::size_type i = 0; i < result.size(); ++i) + result[i] = (std::towlower)(result[i]); + result = c_regex_traits::transform(&*result.begin(), &*result.begin() + result.size()); + break; + } + case ::boost::re_detail::sort_fixed: + { + // get a regular sort key, and then truncate it: + result = c_regex_traits::transform(&*result.begin(), &*result.begin() + result.size()); + result.erase(s_delim); + break; + } + case ::boost::re_detail::sort_delim: + // get a regular sort key, and then truncate everything after the delim: + result = c_regex_traits::transform(&*result.begin(), &*result.begin() + result.size()); + 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; + } + result.erase(i); + break; + } + if(result.empty()) + result = std::wstring(1, char(0)); + return result; +} + +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, + char_class_horizontal=1<<12, + char_class_vertical=1<<13 +}; + +c_regex_traits::char_class_type BOOST_REGEX_CALL c_regex_traits::lookup_classname(const wchar_t* p1, const wchar_t* 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_horizontal, + 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_vertical, + 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::wstring s(p1, p2); + for(std::wstring::size_type i = 0; i < s.size(); ++i) + s[i] = (std::towlower)(s[i]); + id = ::boost::re_detail::get_default_class_id(&*s.begin(), &*s.begin() + s.size()); + } + BOOST_ASSERT(id+1 < static_cast(sizeof(masks) / sizeof(masks[0]))); + return masks[id+1]; +} + +bool BOOST_REGEX_CALL c_regex_traits::isctype(wchar_t c, char_class_type mask) +{ + return + ((mask & char_class_space) && (std::iswspace)(c)) + || ((mask & char_class_print) && (std::iswprint)(c)) + || ((mask & char_class_cntrl) && (std::iswcntrl)(c)) + || ((mask & char_class_upper) && (std::iswupper)(c)) + || ((mask & char_class_lower) && (std::iswlower)(c)) + || ((mask & char_class_alpha) && (std::iswalpha)(c)) + || ((mask & char_class_digit) && (std::iswdigit)(c)) + || ((mask & char_class_punct) && (std::iswpunct)(c)) + || ((mask & char_class_xdigit) && (std::iswxdigit)(c)) + || ((mask & char_class_blank) && (std::iswspace)(c) && !::boost::re_detail::is_separator(c)) + || ((mask & char_class_word) && (c == '_')) + || ((mask & char_class_unicode) && (c & ~static_cast(0xff))) + || ((mask & char_class_vertical) && (::boost::re_detail::is_separator(c) || (c == L'\v'))) + || ((mask & char_class_horizontal) && (std::iswspace)(c) && !::boost::re_detail::is_separator(c) && (c != L'\v')); +} + +c_regex_traits::string_type BOOST_REGEX_CALL c_regex_traits::lookup_collatename(const wchar_t* p1, const wchar_t* p2) +{ +#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 wchar_t* p0 = p1; + while(p0 != p2) + name.append(1, char(*p0++)); +#endif + name = ::boost::re_detail::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, wchar_t(*b++)); + return result; + } +#endif + if(p2 - p1 == 1) + return string_type(1, *p1); + return string_type(); +} + +int BOOST_REGEX_CALL c_regex_traits::value(wchar_t c, int radix) +{ +#ifdef __BORLANDC__ + // workaround for broken wcstol: + if((std::iswxdigit)(c) == 0) + return -1; +#endif + wchar_t b[2] = { c, '\0', }; + wchar_t* ep; + int result = std::wcstol(b, &ep, radix); + if(ep == b) + return -1; + return result; +} + +#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T +c_regex_traits::string_type BOOST_REGEX_CALL c_regex_traits::transform(const unsigned short* p1, const unsigned short* p2) +{ + std::wstring result = c_regex_traits::transform((const wchar_t*)p1, (const wchar_t*)p2); + return string_type(result.begin(), result.end()); +} + +c_regex_traits::string_type BOOST_REGEX_CALL c_regex_traits::transform_primary(const unsigned short* p1, const unsigned short* p2) +{ + std::wstring result = c_regex_traits::transform_primary((const wchar_t*)p1, (const wchar_t*)p2); + return string_type(result.begin(), result.end()); +} + +c_regex_traits::char_class_type BOOST_REGEX_CALL c_regex_traits::lookup_classname(const unsigned short* p1, const unsigned short* p2) +{ + return c_regex_traits::lookup_classname((const wchar_t*)p1, (const wchar_t*)p2); +} + +c_regex_traits::string_type BOOST_REGEX_CALL c_regex_traits::lookup_collatename(const unsigned short* p1, const unsigned short* p2) +{ + std::wstring result = c_regex_traits::lookup_collatename((const wchar_t*)p1, (const wchar_t*)p2); + return string_type(result.begin(), result.end()); +} + +bool BOOST_REGEX_CALL c_regex_traits::isctype(unsigned short c, char_class_type m) +{ + return c_regex_traits::isctype(c, m); +} + +int BOOST_REGEX_CALL c_regex_traits::value(unsigned short c, int radix) +{ + return c_regex_traits::value(c, radix); +} + +#endif + +} + +#endif // BOOST_NO_WREGEX + +#endif // __BORLANDC__ + diff --git a/boost/libs/regex/src/wide_posix_api.cpp b/boost/libs/regex/src/wide_posix_api.cpp index 83d651b884..c8a919027b 100644 --- a/boost/libs/regex/src/wide_posix_api.cpp +++ b/boost/libs/regex/src/wide_posix_api.cpp @@ -29,7 +29,7 @@ #include #include -#if defined(BOOST_NO_STDC_NAMESPACE) +#if defined(BOOST_NO_STDC_NAMESPACE) || defined(__NetBSD__) namespace std{ # ifndef BOOST_NO_SWPRINTF using ::swprintf; diff --git a/boost/libs/signals/src/CMakeLists.txt b/boost/libs/signals/src/CMakeLists.txt new file mode 100755 index 0000000000..462ad71c28 --- /dev/null +++ b/boost/libs/signals/src/CMakeLists.txt @@ -0,0 +1,13 @@ +# +# Copyright Troy D. Straszheim +# +# Distributed under the Boost Software License, Version 1.0. +# See http://www.boost.org/LICENSE_1_0.txt +# +add_definitions(-DBOOST_SIGNALS_NO_LIB=1) + +boost_add_library( + boost_signals + trackable.cpp connection.cpp named_slot_map.cpp signal_base.cpp slot.cpp + SHARED_COMPILE_FLAGS "-DBOOST_SIGNALS_DYN_LINK=1" + )