]> git.lyx.org Git - features.git/commitdiff
boost: update to 1.42.0
authorPeter Kümmel <syntheticpp@gmx.net>
Wed, 17 Feb 2010 20:54:47 +0000 (20:54 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Wed, 17 Feb 2010 20:54:47 +0000 (20:54 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33490 a592a061-630c-0410-9148-cb99ea01b6c8

82 files changed:
boost/boost/array.hpp
boost/boost/bind/bind.hpp
boost/boost/bind/mem_fn_template.hpp
boost/boost/config/compiler/borland.hpp
boost/boost/config/compiler/codegear.hpp
boost/boost/config/compiler/visualc.hpp
boost/boost/cstdint.hpp
boost/boost/detail/interlocked.hpp
boost/boost/detail/sp_typeinfo.hpp
boost/boost/exception/all.hpp
boost/boost/exception/current_exception_cast.hpp
boost/boost/exception/detail/attribute_noreturn.hpp
boost/boost/exception/detail/error_info_impl.hpp
boost/boost/exception/detail/exception_ptr.hpp [new file with mode: 0644]
boost/boost/exception/detail/is_output_streamable.hpp
boost/boost/exception/detail/object_hex_dump.hpp
boost/boost/exception/detail/type_info.hpp
boost/boost/exception/diagnostic_information.hpp
boost/boost/exception/errinfo_errno.hpp
boost/boost/exception/errinfo_nested_exception.hpp [new file with mode: 0644]
boost/boost/exception/exception.hpp
boost/boost/exception/get_error_info.hpp
boost/boost/exception/info.hpp
boost/boost/exception/info_tuple.hpp
boost/boost/exception/to_string.hpp
boost/boost/exception/to_string_stub.hpp
boost/boost/function/function_base.hpp
boost/boost/functional/hash/detail/float_functions.hpp
boost/boost/functional/hash/hash.hpp
boost/boost/integer.hpp
boost/boost/integer/integer_mask.hpp
boost/boost/integer/static_log2.hpp
boost/boost/integer/static_min_max.hpp
boost/boost/integer_fwd.hpp
boost/boost/integer_traits.hpp
boost/boost/memory_order.hpp
boost/boost/regex/concepts.hpp
boost/boost/regex/config.hpp
boost/boost/regex/icu.hpp
boost/boost/regex/pending/object_cache.hpp
boost/boost/regex/pending/static_mutex.hpp
boost/boost/regex/v4/basic_regex_creator.hpp
boost/boost/regex/v4/basic_regex_parser.hpp
boost/boost/regex/v4/cpp_regex_traits.hpp
boost/boost/regex/v4/cregex.hpp
boost/boost/regex/v4/error_type.hpp
boost/boost/regex/v4/match_flags.hpp
boost/boost/regex/v4/match_results.hpp
boost/boost/regex/v4/perl_matcher.hpp
boost/boost/regex/v4/perl_matcher_non_recursive.hpp
boost/boost/regex/v4/perl_matcher_recursive.hpp
boost/boost/regex/v4/regex_format.hpp
boost/boost/regex/v4/regex_replace.hpp
boost/boost/regex/v4/regex_traits_defaults.hpp
boost/boost/regex/v4/states.hpp
boost/boost/regex/v4/u32regex_iterator.hpp
boost/boost/regex/v4/u32regex_token_iterator.hpp
boost/boost/smart_ptr/detail/lwm_pthreads.hpp
boost/boost/smart_ptr/detail/quick_allocator.hpp
boost/boost/smart_ptr/detail/sp_convertible.hpp
boost/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp
boost/boost/smart_ptr/detail/sp_has_sync.hpp
boost/boost/smart_ptr/intrusive_ptr.hpp
boost/boost/smart_ptr/make_shared.hpp
boost/boost/smart_ptr/shared_ptr.hpp
boost/boost/smart_ptr/weak_ptr.hpp
boost/boost/throw_exception.hpp
boost/boost/type_traits/has_new_operator.hpp
boost/boost/type_traits/intrinsics.hpp
boost/boost/type_traits/is_base_of_tr1.hpp [new file with mode: 0644]
boost/boost/type_traits/is_signed.hpp
boost/boost/type_traits/is_unsigned.hpp
boost/boost/utility/value_init.hpp
boost/boost/version.hpp
boost/libs/regex/src/cpp_regex_traits.cpp
boost/libs/regex/src/cregex.cpp
boost/libs/regex/src/fileiter.cpp
boost/libs/regex/src/posix_api.cpp
boost/libs/regex/src/regex_traits_defaults.cpp
boost/libs/regex/src/static_mutex.cpp
boost/libs/regex/src/usinstances.cpp
boost/libs/regex/src/wide_posix_api.cpp

index 8ef73c42508c1d465bf31d0e40bb6fc68dfad200..d58b93ad54b22197afcc231b297db4982ccbdf5d 100644 (file)
 #ifndef BOOST_ARRAY_HPP
 #define BOOST_ARRAY_HPP
 
+#include <boost/detail/workaround.hpp>
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)  
+# pragma warning(push)  
+# pragma warning(disable:4996) // 'std::equal': Function call with parameters that may be unsafe
+#endif
+
 #include <cstddef>
 #include <stdexcept>
 #include <boost/assert.hpp>
@@ -320,4 +327,9 @@ namespace boost {
 
 } /* namespace boost */
 
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)  
+# pragma warning(pop)  
+#endif 
+
 #endif /*BOOST_ARRAY_HPP*/
index 1e5c9e032490ed8b2ed2ff3469fcd7053e48cd10..a63d2a026b90a009aaf62cc8bb26a962aa4e1e08 100644 (file)
@@ -207,6 +207,13 @@ public:
     }
 };
 
+#ifdef BOOST_MSVC
+// MSVC is bright enough to realise that the parameter rhs 
+// in operator==may be unused for some template argument types:
+#pragma warning(push)
+#pragma warning(disable:4100)
+#endif
+
 template< class A1 > class list1: private storage1< A1 >
 {
 private:
@@ -846,6 +853,10 @@ public:
     }
 };
 
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
 // bind_t
 
 #ifndef BOOST_NO_VOID_RETURNS
@@ -1629,7 +1640,7 @@ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, cl
 // data member pointers
 
 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \
-    || ( defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, <= 0x610 ) )
+    || ( defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x620 ) ) )
 
 template<class R, class T, class A1>
 _bi::bind_t< R, _mfi::dm<R, T>, typename _bi::list_av_1<A1>::type >
@@ -1654,7 +1665,14 @@ template< class M, class T > struct add_cref< M T::*, 0 >
 
 template< class M, class T > struct add_cref< M T::*, 1 >
 {
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4180)
+#endif
     typedef M const & type;
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
 };
 
 template< class R, class T > struct add_cref< R (T::*) (), 1 >
index 1db0713b772fbf9104b027f5eae9271b72c4831b..b26d585dbc8ca1e84d5d711400e9e8b9a854413c 100644 (file)
@@ -51,14 +51,16 @@ public:
 
     template<class U> R operator()(U & u) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p);
     }
 
 #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
 
     template<class U> R operator()(U const & u) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p);
     }
 
 #endif
@@ -109,7 +111,8 @@ public:
 
     template<class U> R operator()(U const & u) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p);
     }
 
     R operator()(T const & t) const
@@ -164,14 +167,16 @@ public:
 
     template<class U> R operator()(U & u, A1 a1) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1);
     }
 
 #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
 
     template<class U> R operator()(U const & u, A1 a1) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1);
     }
 
 #endif
@@ -223,7 +228,8 @@ public:
 
     template<class U> R operator()(U const & u, A1 a1) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1);
     }
 
     R operator()(T const & t, A1 a1) const
@@ -276,14 +282,16 @@ public:
 
     template<class U> R operator()(U & u, A1 a1, A2 a2) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2);
     }
 
 #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
 
     template<class U> R operator()(U const & u, A1 a1, A2 a2) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2);
     }
 
 #endif
@@ -333,7 +341,8 @@ public:
 
     template<class U> R operator()(U const & u, A1 a1, A2 a2) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2);
     }
 
     R operator()(T const & t, A1 a1, A2 a2) const
@@ -386,14 +395,16 @@ public:
 
     template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3);
     }
 
 #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
 
     template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3);
     }
 
 #endif
@@ -443,7 +454,8 @@ public:
 
     template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3);
     }
 
     R operator()(T const & t, A1 a1, A2 a2, A3 a3) const
@@ -496,14 +508,16 @@ public:
 
     template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4);
     }
 
 #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
 
     template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4);
     }
 
 #endif
@@ -553,7 +567,8 @@ public:
 
     template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4);
     }
 
     R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4) const
@@ -606,14 +621,16 @@ public:
 
     template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5);
     }
 
 #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
 
     template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5);
     }
 
 #endif
@@ -663,7 +680,8 @@ public:
 
     template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5);
     }
 
     R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
@@ -716,14 +734,16 @@ public:
 
     template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6);
     }
 
 #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
 
     template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6);
     }
 
 #endif
@@ -773,7 +793,8 @@ public:
 
     template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6);
     }
 
     R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
@@ -826,14 +847,16 @@ public:
 
     template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7);
     }
 
 #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
 
     template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7);
     }
 
 #endif
@@ -883,7 +906,8 @@ public:
 
     template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7);
     }
 
     R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
@@ -936,14 +960,16 @@ public:
 
     template<class U> R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8);
     }
 
 #ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS
 
     template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8);
     }
 
 #endif
@@ -998,7 +1024,8 @@ public:
 
     template<class U> R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
     {
-        BOOST_MEM_FN_RETURN call(u, &u, a1, a2, a3, a4, a5, a6, a7, a8);
+        U const * p = 0;
+        BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8);
     }
 
     R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
index 91f064c68e492cd531f68700b4d44330b19b5709..6a7b988d166b9edfbebc4c25a024992d5ee406ae 100644 (file)
@@ -66,7 +66,6 @@
 
 // Borland C++ Builder 6 and below:
 #if (__BORLANDC__ <= 0x564)
-#  define BOOST_NO_INTEGRAL_INT64_T
 
 #  ifdef NDEBUG
       // fix broken <cstring> so that Boost.test works:
 #endif
 
 // Borland C++ Builder 2008 and below:
+#  define BOOST_NO_INTEGRAL_INT64_T
 #  define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
 #  define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
 #  define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
index 3915cd54f95a12e94519efdffd1835047eccbf73..698624ece2971f946149f87c322420f9d27ed845 100644 (file)
@@ -19,8 +19,8 @@
 #endif
 //
 // versions check:
-// last known and checked version is 0x610
-#if (__CODEGEARC__ > 0x613)
+// last known and checked version is 0x620
+#if (__CODEGEARC__ > 0x620)
 #  if defined(BOOST_ASSERT_CONFIG)
 #     error "Unknown compiler version - please run the configure tests and report the results"
 #  else
 
 // CodeGear C++ Builder 2009
 #if (__CODEGEARC__ <= 0x613)
-#  define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
+#  define BOOST_NO_INTEGRAL_INT64_T
 #  define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
-#  define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
 #  define BOOST_NO_PRIVATE_IN_AGGREGATE
-#  define BOOST_NO_TWO_PHASE_NAME_LOOKUP
 #  define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
-#  define BOOST_NO_USING_TEMPLATE
    // we shouldn't really need this - but too many things choke
    // without it, this needs more investigation:
 #  define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
-#  define BOOST_NO_TYPENAME_WITH_CTOR    // Cannot use typename keyword when making temporaries of a dependant type
-#  define BOOST_NO_NESTED_FRIENDSHIP     // TC1 gives nested classes access rights as any other member
 #  define BOOST_SP_NO_SP_CONVERTIBLE
+#endif
 
+// CodeGear C++ Builder 2010
+#if (__CODEGEARC__ <= 0x620)
+#  define BOOST_NO_TYPENAME_WITH_CTOR    // Cannot use typename keyword when making temporaries of a dependant type
+#  define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
+#  define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#  define BOOST_NO_NESTED_FRIENDSHIP     // TC1 gives nested classes access rights as any other member
+#  define BOOST_NO_USING_TEMPLATE
+#  define BOOST_NO_TWO_PHASE_NAME_LOOKUP
 // Temporary hack, until specific MPL preprocessed headers are generated
 #  define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
 
@@ -59,7 +63,6 @@
 #  endif
 
 #endif
-
 //
 // C++0x macros:
 //
index fd21f26bab05aa91c78aa3b28dad7f0e78172d5d..990901f0489871fbba8854700befdc4f53785955 100644 (file)
 #if (_MSC_VER >= 1200)
 #   define BOOST_HAS_MS_INT64
 #endif
-#if (_MSC_VER >= 1310) && defined(_MSC_EXTENSIONS)
+#if (_MSC_VER >= 1310) && (defined(_MSC_EXTENSIONS) || (_MSC_VER >= 1500))
 #   define BOOST_HAS_LONG_LONG
 #else
 #   define BOOST_NO_LONG_LONG
index d55a4840b955ff7e3b4a3d13fe4765bbdd7ff2a3..47e6a160c6c50829233f18a6b4ac97cf3d0f1664 100644 (file)
 #ifndef BOOST_CSTDINT_HPP
 #define BOOST_CSTDINT_HPP
 
-#include <boost/config.hpp>
+//
+// Since we always define the INT#_C macros as per C++0x, 
+// define __STDC_CONSTANT_MACROS so that <stdint.h> does the right
+// thing if possible, and so that the user knows that the macros 
+// are actually defined as per C99.
+//
+#ifndef __STDC_CONSTANT_MACROS
+#  define __STDC_CONSTANT_MACROS
+#endif
 
+#include <boost/config.hpp>
 
-#ifdef BOOST_HAS_STDINT_H
+//
+// Note that GLIBC is a bit inconsistent about whether int64_t is defined or not
+// depending upon what headers happen to have been included first...
+// so we disable use of stdint.h when GLIBC does not define __GLIBC_HAVE_LONG_LONG.
+// See https://svn.boost.org/trac/boost/ticket/3548 and http://sources.redhat.com/bugzilla/show_bug.cgi?id=10990
+//
+#if defined(BOOST_HAS_STDINT_H) && (!defined(__GLIBC__) || defined(__GLIBC_HAVE_LONG_LONG))
 
 // The following #include is an implementation artifact; not part of interface.
 # ifdef __hpux
@@ -220,6 +235,15 @@ namespace boost
      typedef unsigned short  uint_least16_t;
      typedef unsigned short  uint_fast16_t;
 #  endif
+# elif (USHRT_MAX == 0xffffffff) && defined(__MTA__) 
+      // On MTA / XMT short is 32 bits unless the -short16 compiler flag is specified 
+      // MTA / XMT does support the following non-standard integer types 
+      typedef __short16           int16_t; 
+      typedef __short16           int_least16_t; 
+      typedef __short16           int_fast16_t; 
+      typedef unsigned __short16  uint16_t; 
+      typedef unsigned __short16  uint_least16_t; 
+      typedef unsigned __short16  uint_fast16_t; 
 # elif (USHRT_MAX == 0xffffffff) && defined(CRAY)
      // no 16-bit types on Cray:
      typedef short           int_least16_t;
@@ -246,6 +270,14 @@ namespace boost
      typedef unsigned int    uint32_t;
      typedef unsigned int    uint_least32_t;
      typedef unsigned int    uint_fast32_t;
+# elif (UINT_MAX == 0xffffffffffffffff) && defined(__MTA__) 
+      // Integers are 64 bits on the MTA / XMT 
+      typedef __int32           int32_t; 
+      typedef __int32           int_least32_t; 
+      typedef __int32           int_fast32_t; 
+      typedef unsigned __int32  uint32_t; 
+      typedef unsigned __int32  uint_least32_t; 
+      typedef unsigned __int32  uint_fast32_t; 
 # else
 #    error defaults not correct; you must hand modify boost/cstdint.hpp
 # endif
@@ -326,19 +358,16 @@ namespace boost
 
 Macro definition section:
 
-Define various INTXX_C macros only if
-__STDC_CONSTANT_MACROS is defined.
-
-Undefine the macros if __STDC_CONSTANT_MACROS is
-not defined and the macros are (cf <cassert>).
-
 Added 23rd September 2000 (John Maddock).
 Modified 11th September 2001 to be excluded when
 BOOST_HAS_STDINT_H is defined (John Maddock).
+Modified 11th Dec 2009 to always define the
+INT#_C macros if they're not already defined (John Maddock).
 
 ******************************************************/
 
-#if defined(__STDC_CONSTANT_MACROS) && !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(BOOST_HAS_STDINT_H)
+#if !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(INT8_C)
+#include <limits.h>
 # define BOOST__STDC_CONSTANT_MACROS_DEFINED
 # if defined(BOOST_HAS_MS_INT64)
 //
@@ -390,27 +419,40 @@ BOOST_HAS_STDINT_H is defined (John Maddock).
 //  64-bit types + intmax_t and uintmax_t  ----------------------------------//
 
 #  if defined(BOOST_HAS_LONG_LONG) && \
-    (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
+    (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX) || defined(_LLONG_MAX))
 
 #    if defined(__hpux)
-     // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions
-#    elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615U) ||  \
-        (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615U) ||  \
-        (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615U)
-
+        // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions
+#       define INT64_C(value) value##LL
+#       define UINT64_C(value) value##uLL
+#    elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) ||  \
+        (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) ||  \
+        (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL) || \
+        (defined(_LLONG_MAX) && _LLONG_MAX == 18446744073709551615ULL)
+
+#       define INT64_C(value) value##LL
+#       define UINT64_C(value) value##uLL
 #    else
 #       error defaults not correct; you must hand modify boost/cstdint.hpp
 #    endif
-#    define INT64_C(value) value##LL
-#    define UINT64_C(value) value##uLL
 #  elif ULONG_MAX != 0xffffffff
 
-#    if ULONG_MAX == 18446744073709551615 // 2**64 - 1
+#    if ULONG_MAX == 18446744073709551615U // 2**64 - 1
 #       define INT64_C(value) value##L
 #       define UINT64_C(value) value##uL
 #    else
 #       error defaults not correct; you must hand modify boost/cstdint.hpp
 #    endif
+#  elif defined(BOOST_HAS_LONG_LONG)
+     // Usual macros not defined, work things out for ourselves:
+#    if(~0uLL == 18446744073709551615ULL)
+#       define INT64_C(value) value##LL
+#       define UINT64_C(value) value##uLL
+#    else
+#       error defaults not correct; you must hand modify boost/cstdint.hpp
+#    endif
+#  else
+#    error defaults not correct; you must hand modify boost/cstdint.hpp
 #  endif
 
 #  ifdef BOOST_NO_INT64_T
@@ -423,23 +465,7 @@ BOOST_HAS_STDINT_H is defined (John Maddock).
 
 # endif // Borland/Microsoft specific width suffixes
 
-
-#elif defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(__STDC_CONSTANT_MACROS) && !defined(BOOST_HAS_STDINT_H)
-//
-// undef all the macros:
-//
-# undef INT8_C
-# undef INT16_C
-# undef INT32_C
-# undef INT64_C
-# undef UINT8_C
-# undef UINT16_C
-# undef UINT32_C
-# undef UINT64_C
-# undef INTMAX_C
-# undef UINTMAX_C
-
-#endif // __STDC_CONSTANT_MACROS_DEFINED etc.
+#endif // INT#_C macros.
 
 
 
index b6c8d750018823af63f94a5892718db1d62a40a8..fccebc3f707cdec7688303f17f9e3bb22d31e641 100644 (file)
@@ -54,11 +54,23 @@ extern "C" long __cdecl InterlockedExchangeAdd( long*, long );
 
 #elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN )
 
+#if defined( __CLRCALL_PURE_OR_CDECL )
+
+extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedIncrement( long volatile * );
+extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedDecrement( long volatile * );
+extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedCompareExchange( long volatile *, long, long );
+extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchange( long volatile *, long );
+extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchangeAdd( long volatile *, long );
+
+#else
+
 extern "C" long __cdecl _InterlockedIncrement( long volatile * );
 extern "C" long __cdecl _InterlockedDecrement( long volatile * );
 extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long );
-extern "C" long __cdecl _InterlockedExchange( long volatile *, long);
-extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long);
+extern "C" long __cdecl _InterlockedExchange( long volatile *, long );
+extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long );
+
+#endif
 
 # pragma intrinsic( _InterlockedIncrement )
 # pragma intrinsic( _InterlockedDecrement )
index e78c94316a1b0556fdffdc25c8ffc1d8e8f95c2b..636fe277bc0e867c4142bd9810e616b9b8ac6921 100755 (executable)
 
 #if defined( BOOST_NO_TYPEID )
 
+#include <boost/current_function.hpp>
+#include <functional>
+
 namespace boost
 {
 
 namespace detail
 {
 
-typedef void* sp_typeinfo;
+class sp_typeinfo
+{
+private:
+
+    sp_typeinfo( sp_typeinfo const& );
+    sp_typeinfo& operator=( sp_typeinfo const& );
+
+    char const * name_;
+
+public:
+
+    explicit sp_typeinfo( char const * name ): name_( name )
+    {
+    }
+
+    bool operator==( sp_typeinfo const& rhs ) const
+    {
+        return this == &rhs;
+    }
+
+    bool operator!=( sp_typeinfo const& rhs ) const
+    {
+        return this != &rhs;
+    }
+
+    bool before( sp_typeinfo const& rhs ) const
+    {
+        return std::less< sp_typeinfo const* >()( this, &rhs );
+    }
+
+    char const* name() const
+    {
+        return name_;
+    }
+};
 
 template<class T> struct sp_typeid_
 {
-    static char v_;
+    static sp_typeinfo ti_;
+
+    static char const * name()
+    {
+        return BOOST_CURRENT_FUNCTION;
+    }
 };
 
-template<class T> char sp_typeid_< T >::v_;
+template<class T> sp_typeinfo sp_typeid_< T >::ti_( sp_typeid_< T >::name() );
+
+template<class T> struct sp_typeid_< T & >: sp_typeid_< T >
+{
+};
 
 template<class T> struct sp_typeid_< T const >: sp_typeid_< T >
 {
@@ -50,7 +96,7 @@ template<class T> struct sp_typeid_< T const volatile >: sp_typeid_< T >
 
 } // namespace boost
 
-#define BOOST_SP_TYPEID(T) (&boost::detail::sp_typeid_<T>::v_)
+#define BOOST_SP_TYPEID(T) (boost::detail::sp_typeid_<T>::ti_)
 
 #else
 
index c47738b2c6db4e2e6b98f4b3b3ca75a3e2fa9ec6..9ffe42a9d0cf15cb5abb309795df82c6e880363e 100644 (file)
@@ -5,6 +5,12 @@
 
 #ifndef UUID_316FDA946C0D11DEA9CBAE5255D89593
 #define UUID_316FDA946C0D11DEA9CBAE5255D89593
+#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
 
 #include <boost/exception/diagnostic_information.hpp>
 #include <boost/exception/error_info.hpp>
@@ -24,4 +30,7 @@
 #include <boost/exception_ptr.hpp>
 #endif
 
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
 #endif
index 228b6ea10ec45f2c0d61e401cacdb7f7e2ed66ce..af2f15311300795128bb672a0f9f8dd7a6402e2b 100644 (file)
@@ -5,6 +5,12 @@
 
 #ifndef UUID_7E83C166200811DE885E826156D89593
 #define UUID_7E83C166200811DE885E826156D89593
+#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
 
 namespace
 boost
@@ -31,4 +37,7 @@ boost
         }
     }
 
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
 #endif
index 1cb0763efdc97e362b91d813bf4c74d03eedb088..f6a0b5903e36bed2e827e6430e14f2a150ce9645 100644 (file)
@@ -6,9 +6,7 @@
 #ifndef UUID_61531AB0680611DEADD5846855D89593
 #define UUID_61531AB0680611DEADD5846855D89593
 
-#include <boost/config.hpp>
-
-#if defined(BOOST_MSVC)
+#if defined(_MSC_VER)
 #define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn)
 #elif defined(__GNUC__)
 #define BOOST_ATTRIBUTE_NORETURN __attribute__((noreturn))
index a25d066fd1d8a5f5f648ae620447a33d7c4f5fb1..32113b1391e52a1f3fb2dbcfa6049f0b9c2f990a 100644 (file)
@@ -5,6 +5,12 @@
 
 #ifndef UUID_CE6983AC753411DDA764247956D89593
 #define UUID_CE6983AC753411DDA764247956D89593
+#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
 
 #include <string>
 
@@ -24,7 +30,6 @@ boost
 
             protected:
 
-            virtual
             ~error_info_base() throw()
                 {
                 }
@@ -64,4 +69,7 @@ boost
         };
     }
 
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
 #endif
diff --git a/boost/boost/exception/detail/exception_ptr.hpp b/boost/boost/exception/detail/exception_ptr.hpp
new file mode 100644 (file)
index 0000000..78db17c
--- /dev/null
@@ -0,0 +1,490 @@
+//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_618474C2DE1511DEB74A388C56D89593
+#define UUID_618474C2DE1511DEB74A388C56D89593
+#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_EXCEPTIONS
+#error This header requires exception handling to be enabled.
+#endif
+#include <boost/exception/exception.hpp>
+#include <boost/exception/info.hpp>
+#include <boost/exception/diagnostic_information.hpp>
+#include <boost/exception/detail/type_info.hpp>
+#include <boost/shared_ptr.hpp>
+#include <stdexcept>
+#include <new>
+#include <ios>
+
+namespace
+boost
+    {
+#ifndef BOOST_NO_RTTI
+    typedef error_info<struct tag_original_exception_type,std::type_info const *> original_exception_type;
+
+    inline
+    std::string
+    to_string( original_exception_type const & x )
+        {
+        return x.value()->name();
+        }
+#endif
+
+    class exception_ptr;
+    exception_ptr current_exception();
+    void rethrow_exception( exception_ptr const & );
+
+    class
+    exception_ptr
+        {
+        typedef bool exception_ptr::*unspecified_bool_type;
+        friend exception_ptr current_exception();
+        friend void rethrow_exception( exception_ptr const & );
+
+        shared_ptr<exception_detail::clone_base const> c_;
+        bool bad_alloc_;
+
+        struct
+        bad_alloc_tag
+            {
+            };
+
+        explicit
+        exception_ptr( bad_alloc_tag ):
+            bad_alloc_(true)
+            {
+            }
+
+        explicit
+        exception_ptr( shared_ptr<exception_detail::clone_base const> const & c ):
+            c_(c),
+            bad_alloc_(false)
+            {
+            BOOST_ASSERT(c);
+            }
+
+        void
+        rethrow() const
+            {
+            BOOST_ASSERT(*this);
+            if( bad_alloc_ )
+                throw enable_current_exception(std::bad_alloc());
+            else
+                c_->rethrow();
+            }
+
+        bool
+        empty() const
+            {
+            return !bad_alloc_ && !c_;
+            }
+
+        public:
+
+        exception_ptr():
+            bad_alloc_(false)
+            {
+            }
+
+        ~exception_ptr() throw()
+            {
+            }
+
+        operator unspecified_bool_type() const
+            {
+            return empty() ? 0 : &exception_ptr::bad_alloc_;
+            }
+
+        friend
+        bool
+        operator==( exception_ptr const & a, exception_ptr const & b )
+            {
+            return a.c_==b.c_ && a.bad_alloc_==b.bad_alloc_;
+            }
+
+        friend
+        bool
+        operator!=( exception_ptr const & a, exception_ptr const & b )
+            {
+            return !(a==b);
+            }
+        };
+
+    class
+    unknown_exception:
+        public exception,
+        public std::exception,
+        public exception_detail::clone_base
+        {
+        public:
+
+        unknown_exception()
+            {
+            }
+
+        explicit
+        unknown_exception( std::exception const & e )
+            {
+            add_original_type(e);
+            }
+
+        explicit
+        unknown_exception( boost::exception const & e ):
+            boost::exception(e)
+            {
+            add_original_type(e);
+            }
+
+        ~unknown_exception() throw()
+            {
+            }
+
+        private:
+
+        exception_detail::clone_base const *
+        clone() const
+            {
+            return new unknown_exception(*this);
+            }
+
+        void
+        rethrow() const
+            {
+            throw*this;
+            }
+
+        template <class E>
+        void
+        add_original_type( E const & e )
+            {
+#ifndef BOOST_NO_RTTI
+            (*this) << original_exception_type(&typeid(e));
+#endif
+            }
+        };
+
+    namespace
+    exception_detail
+        {
+        template <class T>
+        class
+        current_exception_std_exception_wrapper:
+            public T,
+            public boost::exception,
+            public clone_base
+            {
+            public:
+
+            explicit
+            current_exception_std_exception_wrapper( T const & e1 ):
+                T(e1)
+                {
+                add_original_type(e1);
+                }
+
+            current_exception_std_exception_wrapper( T const & e1, boost::exception const & e2 ):
+                T(e1),
+                boost::exception(e2)
+                {
+                add_original_type(e1);
+                }
+
+            ~current_exception_std_exception_wrapper() throw()
+                {
+                }
+
+            private:
+
+            clone_base const *
+            clone() const
+                {
+                return new current_exception_std_exception_wrapper(*this);
+                }
+
+            void
+            rethrow() const
+                {
+                throw *this;
+                }
+
+            template <class E>
+            void
+            add_original_type( E const & e )
+                {
+#ifndef BOOST_NO_RTTI
+                (*this) << original_exception_type(&typeid(e));
+#endif
+                }
+            };
+
+#ifdef BOOST_NO_RTTI
+        template <class T>
+        exception const *
+        get_boost_exception( T const * )
+            {
+            try
+                {
+                throw;
+                }
+            catch(
+            exception & x )
+                {
+                return &x;
+                }
+            catch(...)
+                {
+                return 0;
+                }
+            }
+#else
+        template <class T>
+        exception const *
+        get_boost_exception( T const * x )
+            {
+            return dynamic_cast<exception const *>(x);
+            }
+#endif
+
+        template <class T>
+        inline
+        shared_ptr<clone_base const>
+        current_exception_std_exception( T const & e1 )
+            {
+            if( boost::exception const * e2 = get_boost_exception(&e1) )
+                return shared_ptr<current_exception_std_exception_wrapper<T> const>(new current_exception_std_exception_wrapper<T>(e1,*e2));
+            else
+                return shared_ptr<current_exception_std_exception_wrapper<T> const>(new current_exception_std_exception_wrapper<T>(e1));
+            }
+
+        inline
+        shared_ptr<clone_base const>
+        current_exception_unknown_exception()
+            {
+            return shared_ptr<unknown_exception const>(new unknown_exception());
+            }
+
+        inline
+        shared_ptr<clone_base const>
+        current_exception_unknown_boost_exception( boost::exception const & e )
+            {
+            return shared_ptr<unknown_exception const>(new unknown_exception(e));
+            }
+
+        inline
+        shared_ptr<clone_base const>
+        current_exception_unknown_std_exception( std::exception const & e )
+            {
+            if( boost::exception const * be = get_boost_exception(&e) )
+                return current_exception_unknown_boost_exception(*be);
+            else
+                return shared_ptr<unknown_exception const>(new unknown_exception(e));
+            }
+
+        inline
+        shared_ptr<clone_base const>
+        current_exception_impl()
+            {
+            try
+                {
+                throw;
+                }
+            catch(
+            exception_detail::clone_base & e )
+                {
+                return shared_ptr<exception_detail::clone_base const>(e.clone());
+                }
+            catch(
+            std::domain_error & e )
+                {
+                return exception_detail::current_exception_std_exception(e);
+                }
+            catch(
+            std::invalid_argument & e )
+                {
+                return exception_detail::current_exception_std_exception(e);
+                }
+            catch(
+            std::length_error & e )
+                {
+                return exception_detail::current_exception_std_exception(e);
+                }
+            catch(
+            std::out_of_range & e )
+                {
+                return exception_detail::current_exception_std_exception(e);
+                }
+            catch(
+            std::logic_error & e )
+                {
+                return exception_detail::current_exception_std_exception(e);
+                }
+            catch(
+            std::range_error & e )
+                {
+                return exception_detail::current_exception_std_exception(e);
+                }
+            catch(
+            std::overflow_error & e )
+                {
+                return exception_detail::current_exception_std_exception(e);
+                }
+            catch(
+            std::underflow_error & e )
+                {
+                return exception_detail::current_exception_std_exception(e);
+                }
+            catch(
+            std::ios_base::failure & e )
+                {
+                return exception_detail::current_exception_std_exception(e);
+                }
+            catch(
+            std::runtime_error & e )
+                {
+                return exception_detail::current_exception_std_exception(e);
+                }
+            catch(
+            std::bad_alloc & e )
+                {
+                return exception_detail::current_exception_std_exception(e);
+                }
+#ifndef BOOST_NO_TYPEID
+            catch(
+            std::bad_cast & e )
+                {
+                return exception_detail::current_exception_std_exception(e);
+                }
+            catch(
+            std::bad_typeid & e )
+                {
+                return exception_detail::current_exception_std_exception(e);
+                }
+#endif
+            catch(
+            std::bad_exception & e )
+                {
+                return exception_detail::current_exception_std_exception(e);
+                }
+            catch(
+            std::exception & e )
+                {
+                return exception_detail::current_exception_unknown_std_exception(e);
+                }
+            catch(
+            boost::exception & e )
+                {
+                return exception_detail::current_exception_unknown_boost_exception(e);
+                }
+            catch(
+            ... )
+                {
+                return exception_detail::current_exception_unknown_exception();
+                }
+            }
+        }
+
+    inline
+    exception_ptr
+    current_exception()
+        {
+        try
+            {
+            return exception_ptr(exception_detail::current_exception_impl());
+            }
+        catch(
+        std::bad_alloc & )
+            {
+            }
+        catch(
+        ... )
+            {
+            try
+                {
+                return exception_ptr(exception_detail::current_exception_std_exception(std::bad_exception()));
+                }
+            catch(
+            std::bad_alloc & )
+                {
+                }
+            catch(
+            ... )
+                {
+                BOOST_ASSERT(0);
+                }
+            }
+        return exception_ptr(exception_ptr::bad_alloc_tag());
+        }
+
+    template <class T>
+    inline
+    exception_ptr
+    copy_exception( T const & e )
+        {
+        try
+            {
+            throw enable_current_exception(e);
+            }
+        catch(
+        ... )
+            {
+            return current_exception();
+            }
+        }
+
+    inline
+    void
+    rethrow_exception( exception_ptr const & p )
+        {
+        p.rethrow();
+        }
+
+    inline
+    std::string
+    diagnostic_information( exception_ptr const & p )
+        {
+        if( p )
+            try
+                {
+                rethrow_exception(p);
+                }
+            catch(
+            ... )
+                {
+                return current_exception_diagnostic_information();
+                }
+        return "<empty>";
+        }
+
+    inline
+    std::string
+    to_string( exception_ptr const & p )
+        {
+        std::string s='\n'+diagnostic_information(p);
+        std::string padding("  ");
+        std::string r;
+        bool f=false;
+        for( std::string::const_iterator i=s.begin(),e=s.end(); i!=e; ++i )
+            {
+            if( f )
+                r+=padding;
+            char c=*i;
+            r+=c;
+            f=(c=='\n');
+            }
+        return r;
+        }
+    }
+
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
+#endif
index af59cb8d2f6a034f4fcae6a456eb163bf9c27c74..5eb1695d2a20ae8ddd4f8316b8da153637f4a11b 100755 (executable)
@@ -5,6 +5,12 @@
 
 #ifndef UUID_898984B4076411DD973EDFA055D89593
 #define UUID_898984B4076411DD973EDFA055D89593
+#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
 
 #include <ostream>
 
@@ -35,4 +41,7 @@ boost
         };
     }
 
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
 #endif
index f535944ea297dc5c46875ffa1a565775c17e6dc6..ccf1bac3f74006920f3860385b4c5db97d51fdb9 100755 (executable)
@@ -5,12 +5,19 @@
 
 #ifndef UUID_6F463AC838DF11DDA3E6909F56D89593
 #define UUID_6F463AC838DF11DDA3E6909F56D89593
+#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
 
 #include <boost/exception/detail/type_info.hpp>
 #include <iomanip>
 #include <ios>
 #include <string>
 #include <sstream>
+#include <cstdlib>
 
 namespace
 boost
@@ -21,11 +28,11 @@ boost
         template <class T>
         inline
         std::string
-        object_hex_dump( T const & x, size_t max_size=16 )
+        object_hex_dump( T const & x, std::size_t max_size=16 )
             {
             std::ostringstream s;
             s << "type: " << type_name<T>() << ", size: " << sizeof(T) << ", dump: ";
-            size_t n=sizeof(T)>max_size?max_size:sizeof(T);
+            std::size_t n=sizeof(T)>max_size?max_size:sizeof(T);
             s.fill('0');
             s.width(2);
             unsigned char const * b=reinterpret_cast<unsigned char const *>(&x);
@@ -37,4 +44,7 @@ boost
         }
     }
 
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
 #endif
index ac0960db68af6a4aee8cb8a731e17ca2eb27d1f9..60709a1f6c08991262c371b7eb9d0085bec401c0 100644 (file)
@@ -5,9 +5,16 @@
 
 #ifndef UUID_C3E1741C754311DDB2834CCA55D89593
 #define UUID_C3E1741C754311DDB2834CCA55D89593
+#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
 
 #include <boost/detail/sp_typeinfo.hpp>
 #include <boost/current_function.hpp>
+#include <boost/config.hpp>
 
 namespace
 boost
@@ -39,92 +46,34 @@ boost
     namespace
     exception_detail
         {
-#ifdef BOOST_NO_TYPEID
         struct
         type_info_
             {
-            detail::sp_typeinfo type_;
-            char const * name_;
-
-            explicit
-            type_info_( detail::sp_typeinfo type, char const * name ):
-                type_(type),
-                name_(name)
-                {
-                }
-
-            friend
-            bool
-            operator==( type_info_ const & a, type_info_ const & b )
-                {
-                return a.type_==b.type_;
-                }
-
-            friend
-            bool
-            operator<( type_info_ const & a, type_info_ const & b )
-                {
-                return a.type_<b.type_;
-                }
-
-            char const *
-            name() const
-                {
-                return name_;
-                }
-            };
-#else
-        struct
-        type_info_
-            {
-            detail::sp_typeinfo const * type_;
+            detail::sp_typeinfo const & type_;
 
             explicit
             type_info_( detail::sp_typeinfo const & type ):
-                type_(&type)
-                {
-                }
-
-            type_info_( detail::sp_typeinfo const & type, char const * ):
-                type_(&type)
-                {
-                }
-
-            friend
-            bool
-            operator==( type_info_ const & a, type_info_ const & b )
+                type_(type)
                 {
-                return (*a.type_)==(*b.type_);
                 }
 
             friend
             bool
             operator<( type_info_ const & a, type_info_ const & b )
                 {
-                return 0!=(a.type_->before(*b.type_));
-                }
-
-            char const *
-            name() const
-                {
-                return type_->name();
+                return 0!=(a.type_.before(b.type_));
                 }
             };
-#endif
-
-        inline
-        bool
-        operator!=( type_info_ const & a, type_info_ const & b )
-            {
-            return !(a==b);
-            }
         }
     }
 
-#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_SP_TYPEID(T),::boost::tag_type_name<T>())
+#define BOOST_EXCEPTION_STATIC_TYPEID(T) ::boost::exception_detail::type_info_(BOOST_SP_TYPEID(T))
 
 #ifndef BOOST_NO_RTTI
 #define BOOST_EXCEPTION_DYNAMIC_TYPEID(x) ::boost::exception_detail::type_info_(typeid(x))
 #endif
 
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
 #endif
index 1ea9dc1bab6a4965fcd08e28e76ba4f9da896eeb..632a5a333978c07049c620da7735c0f794a07ffb 100755 (executable)
@@ -5,42 +5,79 @@
 
 #ifndef UUID_0552D49838DD11DD90146B8956D89593
 #define UUID_0552D49838DD11DD90146B8956D89593
+#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
 
 #include <boost/config.hpp>
 #include <boost/exception/get_error_info.hpp>
-#include <boost/exception/detail/exception_ptr_base.hpp>
 #include <boost/utility/enable_if.hpp>
+#include <boost/config.hpp>
 #include <exception>
 #include <sstream>
 #include <string>
 
+#ifndef BOOST_NO_EXCEPTIONS
+#include <boost/exception/current_exception_cast.hpp>
 namespace
 boost
     {
     namespace
     exception_detail
         {
-        template <class T>
-        struct
-        enable_boost_exception_overload
+        std::string diagnostic_information_impl( boost::exception const *, std::exception const *, bool );
+        }
+
+    inline
+    std::string
+    current_exception_diagnostic_information()
+        {
+        boost::exception const * be=current_exception_cast<boost::exception const>();
+        std::exception const * se=current_exception_cast<std::exception const>();
+        if( be || se )
+            return exception_detail::diagnostic_information_impl(be,se,true);
+        else
+            return "No diagnostic information available.";
+        }
+    }
+#endif
+
+namespace
+boost
+    {
+    namespace
+    exception_detail
+        {
+        inline
+        exception const *
+        get_boost_exception( exception const * e )
             {
-            struct yes { char q[100]; };
-            typedef char no;
-            static yes check(exception const *);
-            static no check(...);
-            enum e { value=sizeof(check((T*)0))==sizeof(yes) };
-            };
+            return e;
+            }
 
-        template <class T>
-        struct
-        enable_std_exception_overload
+        inline
+        exception const *
+        get_boost_exception( ... )
+            {
+            return 0;
+            }
+
+        inline
+        std::exception const *
+        get_std_exception( std::exception const * e )
+            {
+            return e;
+            }
+
+        inline
+        std::exception const *
+        get_std_exception( ... )
             {
-            struct yes { char q[100]; };
-            typedef char no;
-            static yes check(std::exception const *);
-            static no check(...);
-            enum e { value = !enable_boost_exception_overload<T>::value && sizeof(check((T*)0))==sizeof(yes) };
-            };
+            return 0;
+            }
 
         inline
         char const *
@@ -65,12 +102,13 @@ boost
         std::string
         diagnostic_information_impl( boost::exception const * be, std::exception const * se, bool with_what )
             {
-            BOOST_ASSERT(be||se);
+            if( !be && !se )
+                return "Unknown exception.";
 #ifndef BOOST_NO_RTTI
-            if( !se )
-                se = dynamic_cast<std::exception const *>(be);
             if( !be )
-                be = dynamic_cast<boost::exception const *>(se);
+                be=dynamic_cast<boost::exception const *>(se);
+            if( !se )
+                se=dynamic_cast<std::exception const *>(be);
 #endif
             char const * wh=0;
             if( with_what && se )
@@ -97,7 +135,7 @@ boost
                 }
 #ifndef BOOST_NO_RTTI
             tmp << std::string("Dynamic exception type: ") <<
-                (be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).name() << '\n';
+                (be?BOOST_EXCEPTION_DYNAMIC_TYPEID(*be):BOOST_EXCEPTION_DYNAMIC_TYPEID(*se)).type_.name() << '\n';
 #endif
             if( with_what && se )
                 tmp << "std::exception::what: " << wh << '\n';
@@ -110,19 +148,10 @@ boost
         }
 
     template <class T>
-    inline
-    typename enable_if<exception_detail::enable_boost_exception_overload<T>,std::string>::type
-    diagnostic_information( T const & e )
-        {
-        return exception_detail::diagnostic_information_impl(&e,0,true);
-        }
-
-    template <class T>
-    inline
-    typename enable_if<exception_detail::enable_std_exception_overload<T>,std::string>::type
+    std::string
     diagnostic_information( T const & e )
         {
-        return exception_detail::diagnostic_information_impl(0,&e,true);
+        return exception_detail::diagnostic_information_impl(exception_detail::get_boost_exception(&e),exception_detail::get_std_exception(&e),true);
         }
 
     inline
@@ -147,40 +176,7 @@ boost
         }
     }
 
-#ifndef BOOST_NO_EXCEPTIONS
-#include <boost/exception/current_exception_cast.hpp>
-namespace
-boost
-    {
-    inline
-    std::string
-    current_exception_diagnostic_information()
-        {
-        boost::exception const * be=current_exception_cast<boost::exception const>();
-        std::exception const * se=current_exception_cast<std::exception const>();
-        if( be || se )
-            return exception_detail::diagnostic_information_impl(be,se,true);
-        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 "<empty>";
-        }
-    }
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
 #endif
-
 #endif
index 310ceb78d0fcd07d1aff421b8dafb36a54fc697f..ea74010c9445bb16dee101f5108ed25211da4ef9 100644 (file)
@@ -5,6 +5,12 @@
 
 #ifndef UUID_F0EE17BE6C1211DE87FF459155D89593
 #define UUID_F0EE17BE6C1211DE87FF459155D89593
+#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
 
 #include "boost/exception/info.hpp"
 #include <errno.h>
@@ -32,4 +38,7 @@ boost
         }
     }
 
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
 #endif
diff --git a/boost/boost/exception/errinfo_nested_exception.hpp b/boost/boost/exception/errinfo_nested_exception.hpp
new file mode 100644 (file)
index 0000000..de055e0
--- /dev/null
@@ -0,0 +1,17 @@
+//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_45CC9A82B77511DEB330FC4956D89593
+#define UUID_45CC9A82B77511DEB330FC4956D89593
+
+namespace
+boost
+    {
+    template <class Tag,class T> class error_info;
+    class exception_ptr;
+    typedef error_info<struct errinfo_nested_exception_,exception_ptr> errinfo_nested_exception;
+    }
+
+#endif
index e7faf594c4b3aded37c37f960c8c11fc7fc5feda..79b273999c3a5d59ed8ba409e8aa856f5d978fd6 100755 (executable)
@@ -5,6 +5,12 @@
 
 #ifndef UUID_274DA366004E11DCB1DDFE2E56D89593
 #define UUID_274DA366004E11DCB1DDFE2E56D89593
+#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
 
 namespace
 boost
@@ -129,6 +135,15 @@ boost
     template <class E,class Tag,class T>
     E const & operator<<( E const &, error_info<Tag,T> const & );
 
+    template <class E>
+    E const & operator<<( E const &, throw_function const & );
+
+    template <class E>
+    E const & operator<<( E const &, throw_file const & );
+
+    template <class E>
+    E const & operator<<( E const &, throw_line const & );
+
     class exception;
 
     template <class>
@@ -151,7 +166,6 @@ boost
 
             protected:
 
-            virtual
             ~error_info_container() throw()
                 {
                 }
@@ -202,34 +216,19 @@ boost
 #endif
             ;
 
+#if defined(__MWERKS__) && __MWERKS__<=0x3207
+        public:
+#else
         private:
 
         template <class E>
-        friend
-        E const &
-        operator<<( E const & x, throw_function const & y )
-            {
-            x.throw_function_=y.v_;
-            return x;
-            }
+        friend E const & operator<<( E const &, throw_function const & );
 
         template <class E>
-        friend
-        E const &
-        operator<<( E const & x, throw_file const & y )
-            {
-            x.throw_file_=y.v_;
-            return x;
-            }
+        friend E const & operator<<( E const &, throw_file const & );
 
         template <class E>
-        friend
-        E const &
-        operator<<( E const & x, throw_line const & y )
-            {
-            x.throw_line_=y.v_;
-            return x;
-            }
+        friend E const & operator<<( E const &, throw_line const & );
 
         friend char const * exception_detail::get_diagnostic_information( exception const &, char const * );
 
@@ -241,7 +240,7 @@ boost
         friend struct exception_detail::get_info<throw_function>;
         friend struct exception_detail::get_info<throw_file>;
         friend struct exception_detail::get_info<throw_line>;
-
+#endif
         mutable exception_detail::refcount_ptr<exception_detail::error_info_container> data_;
         mutable char const * throw_function_;
         mutable char const * throw_file_;
@@ -254,6 +253,30 @@ boost
         {
         }
 
+    template <class E>
+    E const &
+    operator<<( E const & x, throw_function const & y )
+        {
+        x.throw_function_=y.v_;
+        return x;
+        }
+
+    template <class E>
+    E const &
+    operator<<( E const & x, throw_file const & y )
+        {
+        x.throw_file_=y.v_;
+        return x;
+        }
+
+    template <class E>
+    E const &
+    operator<<( E const & x, throw_line const & y )
+        {
+        x.throw_line_=y.v_;
+        return x;
+        }
+
     ////////////////////////////////////////////////////////////////////////
 
     namespace
@@ -303,7 +326,7 @@ boost
         struct
         enable_error_info_return_type
             {
-            typedef typename enable_error_info_helper<T,sizeof(dispatch((T*)0))>::type type;
+            typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch((T*)0))>::type type;
             };
         }
 
@@ -393,4 +416,7 @@ boost
         }
     }
 
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
 #endif
index 640a612f3d20b5682c99acf5144accd2463c2dd7..046f05aeefd0bf9153c4fba259bd5b45fe32f3cb 100644 (file)
@@ -5,6 +5,12 @@
 
 #ifndef UUID_1A590226753311DD9E4CCF6156D89593
 #define UUID_1A590226753311DD9E4CCF6156D89593
+#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
 
 #include <boost/exception/exception.hpp>
 #include <boost/exception/detail/error_info_impl.hpp>
@@ -118,4 +124,7 @@ boost
 #endif
     }
 
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
 #endif
index c1b76c02cf61a7461dd104d4c1096c502d388f2e..cbbc2c0b2f1349985c1aa638205815244f6dd01b 100755 (executable)
@@ -5,11 +5,18 @@
 
 #ifndef UUID_8D22C4CA9CC811DCAA9133D256D89593
 #define UUID_8D22C4CA9CC811DCAA9133D256D89593
+#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
 
 #include <boost/exception/exception.hpp>
 #include <boost/exception/to_string_stub.hpp>
 #include <boost/exception/detail/error_info_impl.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/config.hpp>
 #include <map>
 
 namespace
@@ -90,7 +97,7 @@ boost
                     {
                     shared_ptr<error_info_base> const & p = i->second;
 #ifndef BOOST_NO_RTTI
-                    BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p)==ti );
+                    BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==ti.type_ );
 #endif
                     return p;
                     }
@@ -146,12 +153,15 @@ boost
         {
         typedef error_info<Tag,T> error_info_tag_t;
         shared_ptr<error_info_tag_t> p( new error_info_tag_t(v) );
-        exception_detail::error_info_container * c;
-        if( !(c=x.data_.get()) )
+        exception_detail::error_info_container * c=x.data_.get();
+        if( !c )
             x.data_.adopt(c=new exception_detail::error_info_container_impl);
         c->set(p,BOOST_EXCEPTION_STATIC_TYPEID(error_info_tag_t));
         return x;
         }
     }
 
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
 #endif
index 38b2512626831c70e100062dd259ad6eea534491..34afe421b16fe36d4e77579bfe8fee7defbc4ba8 100755 (executable)
@@ -5,6 +5,12 @@
 
 #ifndef UUID_63EE924290FB11DC87BB856555D89593
 #define UUID_63EE924290FB11DC87BB856555D89593
+#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
 
 #include <boost/exception/info.hpp>
 #include <boost/tuple/tuple.hpp>
@@ -64,4 +70,7 @@ boost
         }
     }
 
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
 #endif
index 5d88efa4676a007e3f30cae7fdd4b93ee440d3ff..59bf83d4c01bd43ba2dba8c11fbc25d0656006ea 100755 (executable)
@@ -5,6 +5,12 @@
 
 #ifndef UUID_7E48761AD92811DC9011477D56D89593
 #define UUID_7E48761AD92811DC9011477D56D89593
+#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
 
 #include <boost/utility/enable_if.hpp>
 #include <boost/exception/detail/is_output_streamable.hpp>
@@ -71,4 +77,7 @@ boost
         }
     }
 
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
 #endif
index 4b7028144fc422ac371163bb6624ff89d328cd41..e41d3697751535349736a43c8a172add2bbcb65a 100755 (executable)
@@ -5,6 +5,12 @@
 
 #ifndef UUID_E788439ED9F011DCB181F25B55D89593
 #define UUID_E788439ED9F011DCB181F25B55D89593
+#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma GCC system_header
+#endif
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(push,1)
+#endif
 
 #include <boost/exception/to_string.hpp>
 #include <boost/exception/detail/object_hex_dump.hpp>
@@ -97,4 +103,7 @@ boost
         }
     }
 
+#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
+#pragma warning(pop)
+#endif
 #endif
index c4663c35a873f168995c4cdf79a2f48e48e668aa..eb201a80e9ca5da9d0f7ae537a3d63475f8119b1 100644 (file)
@@ -15,8 +15,8 @@
 #include <string>
 #include <memory>
 #include <new>
-#include <typeinfo>
 #include <boost/config.hpp>
+#include <boost/detail/sp_typeinfo.hpp>
 #include <boost/assert.hpp>
 #include <boost/integer.hpp>
 #include <boost/type_traits/has_trivial_copy.hpp>
@@ -54,7 +54,9 @@
 
 // Borrowed from Boost.Python library: determines the cases where we
 // need to use std::type_info::name to compare instead of operator==.
-# if (defined(__GNUC__) && __GNUC__ >= 3) \
+#if defined( BOOST_NO_TYPEID )
+#  define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) ((X)==(Y))
+#elif (defined(__GNUC__) && __GNUC__ >= 3) \
  || defined(_AIX) \
  || (   defined(__sgi) && defined(__host_mips))
 #  include <cstring>
@@ -103,7 +105,7 @@ namespace boost {
         // For pointers to std::type_info objects
         struct type_t {
           // (get_functor_type_tag, check_functor_type_tag).
-          const BOOST_FUNCTION_STD_NS::type_info* type;
+          const detail::sp_typeinfo* type;
 
           // Whether the type is const-qualified.
           bool const_qualified;
@@ -215,12 +217,12 @@ namespace boost {
 
           case check_functor_type_tag:
             {
-              const BOOST_FUNCTION_STD_NS::type_info& check_type 
+              const detail::sp_typeinfo& check_type 
                 = *out_buffer.type.type;
 
               // Check whether we have the same type. We can add
               // cv-qualifiers, but we can't take them away.
-              if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(F))
+              if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, BOOST_SP_TYPEID(F))
                   && (!in_buffer.obj_ref.is_const_qualified 
                       || out_buffer.type.const_qualified)
                   && (!in_buffer.obj_ref.is_volatile_qualified
@@ -232,7 +234,7 @@ namespace boost {
             return;
 
           case get_functor_type_tag:
-            out_buffer.type.type = &typeid(F);
+            out_buffer.type.type = &BOOST_SP_TYPEID(F);
             out_buffer.type.const_qualified = in_buffer.obj_ref.is_const_qualified;
             out_buffer.type.volatile_qualified = in_buffer.obj_ref.is_volatile_qualified;
             return;
@@ -292,14 +294,14 @@ namespace boost {
           } else if (op == destroy_functor_tag)
             out_buffer.func_ptr = 0;
           else if (op == check_functor_type_tag) {
-            const BOOST_FUNCTION_STD_NS::type_info& check_type 
+            const detail::sp_typeinfo& check_type 
               = *out_buffer.type.type;
-            if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor)))
+            if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, BOOST_SP_TYPEID(Functor)))
               out_buffer.obj_ptr = &in_buffer.func_ptr;
             else
               out_buffer.obj_ptr = 0;
           } else /* op == get_functor_type_tag */ {
-            out_buffer.type.type = &typeid(Functor);
+            out_buffer.type.type = &BOOST_SP_TYPEID(Functor);
             out_buffer.type.const_qualified = false;
             out_buffer.type.volatile_qualified = false;
           }
@@ -322,14 +324,14 @@ namespace boost {
             // Some compilers (Borland, vc6, ...) are unhappy with ~functor_type.
             reinterpret_cast<functor_type*>(&out_buffer.data)->~Functor();
           } else if (op == check_functor_type_tag) {
-            const BOOST_FUNCTION_STD_NS::type_info& check_type 
+            const detail::sp_typeinfo& check_type 
               = *out_buffer.type.type;
-            if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor)))
+            if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, BOOST_SP_TYPEID(Functor)))
               out_buffer.obj_ptr = &in_buffer.data;
             else
               out_buffer.obj_ptr = 0;
           } else /* op == get_functor_type_tag */ {
-            out_buffer.type.type = &typeid(Functor);
+            out_buffer.type.type = &BOOST_SP_TYPEID(Functor);
             out_buffer.type.const_qualified = false;
             out_buffer.type.volatile_qualified = false;            
           }
@@ -381,14 +383,14 @@ namespace boost {
             delete f;
             out_buffer.obj_ptr = 0;
           } else if (op == check_functor_type_tag) {
-            const BOOST_FUNCTION_STD_NS::type_info& check_type
+            const detail::sp_typeinfo& check_type
               = *out_buffer.type.type;
-            if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor)))
+            if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, BOOST_SP_TYPEID(Functor)))
               out_buffer.obj_ptr = in_buffer.obj_ptr;
             else
               out_buffer.obj_ptr = 0;
           } else /* op == get_functor_type_tag */ {
-            out_buffer.type.type = &typeid(Functor);
+            out_buffer.type.type = &BOOST_SP_TYPEID(Functor);
             out_buffer.type.const_qualified = false;
             out_buffer.type.volatile_qualified = false;
           }
@@ -423,7 +425,7 @@ namespace boost {
           typedef typename get_function_tag<functor_type>::type tag_type;
           switch (op) {
           case get_functor_type_tag:
-            out_buffer.type.type = &typeid(functor_type);
+            out_buffer.type.type = &BOOST_SP_TYPEID(functor_type);
             out_buffer.type.const_qualified = false;
             out_buffer.type.volatile_qualified = false;
             return;
@@ -492,14 +494,14 @@ namespace boost {
             wrapper_allocator.deallocate(victim,1);
             out_buffer.obj_ptr = 0;
           } else if (op == check_functor_type_tag) {
-            const BOOST_FUNCTION_STD_NS::type_info& check_type 
+            const detail::sp_typeinfo& check_type 
               = *out_buffer.type.type;
-            if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor)))
+            if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, BOOST_SP_TYPEID(Functor)))
               out_buffer.obj_ptr = in_buffer.obj_ptr;
             else
               out_buffer.obj_ptr = 0;
           } else /* op == get_functor_type_tag */ {
-            out_buffer.type.type = &typeid(Functor);
+            out_buffer.type.type = &BOOST_SP_TYPEID(Functor);
             out_buffer.type.const_qualified = false;
             out_buffer.type.volatile_qualified = false;
           }
@@ -526,7 +528,7 @@ namespace boost {
           typedef typename get_function_tag<functor_type>::type tag_type;
           switch (op) {
           case get_functor_type_tag:
-            out_buffer.type.type = &typeid(functor_type);
+            out_buffer.type.type = &BOOST_SP_TYPEID(functor_type);
             out_buffer.type.const_qualified = false;
             out_buffer.type.volatile_qualified = false;
             return;
@@ -627,11 +629,11 @@ public:
   /** Determine if the function is empty (i.e., has no target). */
   bool empty() const { return !vtable; }
 
-  /** Retrieve the type of the stored function object, or typeid(void)
+  /** Retrieve the type of the stored function object, or BOOST_SP_TYPEID(void)
       if this is empty. */
-  const BOOST_FUNCTION_STD_NS::type_info& target_type() const
+  const detail::sp_typeinfo& target_type() const
   {
-    if (!vtable) return typeid(void);
+    if (!vtable) return BOOST_SP_TYPEID(void);
 
     detail::function::function_buffer type;
     get_vtable()->manager(functor, type, detail::function::get_functor_type_tag);
@@ -644,7 +646,7 @@ public:
       if (!vtable) return 0;
 
       detail::function::function_buffer type_result;
-      type_result.type.type = &typeid(Functor);
+      type_result.type.type = &BOOST_SP_TYPEID(Functor);
       type_result.type.const_qualified = is_const<Functor>::value;
       type_result.type.volatile_qualified = is_volatile<Functor>::value;
       get_vtable()->manager(functor, type_result, 
@@ -662,7 +664,7 @@ public:
       if (!vtable) return 0;
 
       detail::function::function_buffer type_result;
-      type_result.type.type = &typeid(Functor);
+      type_result.type.type = &BOOST_SP_TYPEID(Functor);
       type_result.type.const_qualified = true;
       type_result.type.volatile_qualified = is_volatile<Functor>::value;
       get_vtable()->manager(functor, type_result, 
index 01cac097224c4cab9d7b9bae64ed2760d734927a..ae03ff091ee270b578ef9ef9c25eb77765b861b3 100644 (file)
@@ -84,7 +84,7 @@ namespace boost {
 // 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 {
+namespace boost_hash_detect_float_functions {
     template <class Float> boost::hash_detail::not_found ldexp(Float, int);
     template <class Float> boost::hash_detail::not_found frexp(Float, int*);    
 }
@@ -103,7 +103,7 @@ namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS {
 // 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 {                           \
+namespace boost_hash_detect_float_functions {                           \
     template <class Float>                                              \
     boost::hash_detail::not_found c99_func(Float, type2);               \
 }                                                                       \
@@ -112,7 +112,7 @@ namespace boost {                                                       \
     namespace hash_detail {                                             \
         namespace c99_func##_detect {                                   \
             using namespace std;                                        \
-            using namespace BOOST_HASH_DETECT_FLOAT_FUNCTIONS;          \
+            using namespace boost_hash_detect_float_functions;          \
                                                                         \
             struct check {                                              \
                 static type1 x;                                         \
index 6784f3ef6b040ff5e1845330ecd3b5abe5d8f847..1f33b9ea9d9bfaf08b6fd68742b995d4c52e4919 100644 (file)
@@ -20,7 +20,8 @@
 #include <boost/type_traits/is_pointer.hpp>
 #endif
 
-#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
+#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
@@ -67,7 +68,8 @@ namespace boost
     std::size_t hash_value(long double v);
 
     template <class Ch, class A>
-    std::size_t hash_value(std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&);
+    std::size_t hash_value(
+        std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&);
 
     // Implementation
 
@@ -197,6 +199,16 @@ namespace boost
         return x + (x >> 3);
     }
 
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#if BOOST_MSVC <= 1400
+#pragma warning(disable:4267) // 'argument' : conversion from 'size_t' to
+                              // 'unsigned int', possible loss of data
+                              // A misguided attempt to detect 64-bit
+                              // incompatability.
+#endif
+#endif
+
 #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
     template <class T>
     inline void hash_combine(std::size_t& seed, T& v)
@@ -209,6 +221,10 @@ namespace boost
         seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
     }
 
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
     template <class It>
     inline std::size_t hash_range(It first, It last)
     {
@@ -272,7 +288,8 @@ namespace boost
 #endif
 
     template <class Ch, class A>
-    inline std::size_t hash_value(std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v)
+    inline std::size_t hash_value(
+        std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v)
     {
         return hash_range(v.begin(), v.end());
     }
@@ -297,8 +314,8 @@ namespace boost
     //
     
     // 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 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.
index dc57dff778b5f2c63cc1c63ed8eb10a478edb757..3393c81ea81f86931f9feef80f7e51ba91018ddc 100644 (file)
 
 #include <boost/integer_fwd.hpp>  // self include
 
-#include <boost/integer_traits.hpp>  // for boost::integer_traits
-#include <boost/limits.hpp>          // for std::numeric_limits
+#include <boost/integer_traits.hpp>  // for boost::::boost::integer_traits
+#include <boost/limits.hpp>          // for ::std::numeric_limits
+#include <boost/cstdint.hpp>         // for boost::int64_t and BOOST_NO_INTEGRAL_INT64_T
+
+//
+// We simply cannot include this header on gcc without getting copious warnings of the kind:
+//
+// boost/integer.hpp:77:30: warning: use of C99 long long integer constant
+//
+// And yet there is no other reasonable implementation, so we declare this a system header
+// to suppress these warnings.
+//
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+#pragma GCC system_header
+#endif
 
 namespace boost
 {
@@ -28,7 +41,13 @@ namespace boost
   //  fast integers from least integers
   //  int_fast_t<> works correctly for unsigned too, in spite of the name.
   template< typename LeastInt >
-  struct int_fast_t { typedef LeastInt fast; }; // imps may specialize
+  struct int_fast_t 
+  { 
+     typedef LeastInt fast; 
+     typedef fast     type;
+  }; // imps may specialize
+
+  namespace detail{
 
   //  convert category to type 
   template< int Category > struct int_least_helper {}; // default is empty
@@ -36,89 +55,196 @@ namespace boost
   //  specializatons: 1=long, 2=int, 3=short, 4=signed char,
   //     6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned char
   //  no specializations for 0 and 5: requests for a type > long are in error
-  template<> struct int_least_helper<1> { typedef long least; };
-  template<> struct int_least_helper<2> { typedef int least; };
-  template<> struct int_least_helper<3> { typedef short least; };
-  template<> struct int_least_helper<4> { typedef signed char least; };
-  template<> struct int_least_helper<6> { typedef unsigned long least; };
-  template<> struct int_least_helper<7> { typedef unsigned int least; };
-  template<> struct int_least_helper<8> { typedef unsigned short least; };
-  template<> struct int_least_helper<9> { typedef unsigned char least; };
+#ifdef BOOST_HAS_LONG_LONG
+  template<> struct int_least_helper<1> { typedef boost::long_long_type least; };
+#endif
+  template<> struct int_least_helper<2> { typedef long least; };
+  template<> struct int_least_helper<3> { typedef int least; };
+  template<> struct int_least_helper<4> { typedef short least; };
+  template<> struct int_least_helper<5> { typedef signed char least; };
+#ifdef BOOST_HAS_LONG_LONG
+  template<> struct int_least_helper<6> { typedef boost::ulong_long_type least; };
+#endif
+  template<> struct int_least_helper<7> { typedef unsigned long least; };
+  template<> struct int_least_helper<8> { typedef unsigned int least; };
+  template<> struct int_least_helper<9> { typedef unsigned short least; };
+  template<> struct int_least_helper<10> { typedef unsigned char least; };
+
+  template <int Bits>
+  struct exact_signed_base_helper{};
+  template <int Bits>
+  struct exact_unsigned_base_helper{};
+
+  template <> struct exact_signed_base_helper<sizeof(signed char)* CHAR_BIT> { typedef signed char exact; };
+  template <> struct exact_unsigned_base_helper<sizeof(unsigned char)* CHAR_BIT> { typedef unsigned char exact; };
+#if USHRT_MAX != UCHAR_MAX
+  template <> struct exact_signed_base_helper<sizeof(short)* CHAR_BIT> { typedef short exact; };
+  template <> struct exact_unsigned_base_helper<sizeof(unsigned short)* CHAR_BIT> { typedef unsigned short exact; };
+#endif
+#if UINT_MAX != USHRT_MAX
+  template <> struct exact_signed_base_helper<sizeof(int)* CHAR_BIT> { typedef int exact; };
+  template <> struct exact_unsigned_base_helper<sizeof(unsigned int)* CHAR_BIT> { typedef unsigned int exact; };
+#endif
+#if ULONG_MAX != UINT_MAX
+  template <> struct exact_signed_base_helper<sizeof(long)* CHAR_BIT> { typedef long exact; };
+  template <> struct exact_unsigned_base_helper<sizeof(unsigned long)* CHAR_BIT> { typedef unsigned long exact; };
+#endif
+#if defined(BOOST_HAS_LONG_LONG) &&\
+   ((defined(ULLONG_MAX) && (ULLONG_MAX != ULONG_MAX)) ||\
+    (defined(ULONG_LONG_MAX) && (ULONG_LONG_MAX != ULONG_MAX)) ||\
+    (defined(ULONGLONG_MAX) && (ULONGLONG_MAX != ULONG_MAX)) ||\
+    (defined(_ULLONG_MAX) && (_ULLONG_MAX != ULONG_MAX)))
+  template <> struct exact_signed_base_helper<sizeof(boost::long_long_type)* CHAR_BIT> { typedef boost::long_long_type exact; };
+  template <> struct exact_unsigned_base_helper<sizeof(boost::ulong_long_type)* CHAR_BIT> { typedef boost::ulong_long_type exact; };
+#endif
+
+
+  } // namespace detail
 
   //  integer templates specifying number of bits  ---------------------------//
 
   //  signed
   template< int Bits >   // bits (including sign) required
-  struct int_t 
+  struct int_t : public detail::exact_signed_base_helper<Bits>
   {
-      typedef typename int_least_helper
+      typedef typename detail::int_least_helper
         <
-          (Bits-1 <= std::numeric_limits<long>::digits) +
-          (Bits-1 <= std::numeric_limits<int>::digits) +
-          (Bits-1 <= std::numeric_limits<short>::digits) +
-          (Bits-1 <= std::numeric_limits<signed char>::digits)
+#ifdef BOOST_HAS_LONG_LONG
+          (Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) +
+#else
+           1 +
+#endif
+          (Bits-1 <= ::std::numeric_limits<long>::digits) +
+          (Bits-1 <= ::std::numeric_limits<int>::digits) +
+          (Bits-1 <= ::std::numeric_limits<short>::digits) +
+          (Bits-1 <= ::std::numeric_limits<signed char>::digits)
         >::least  least;
-      typedef typename int_fast_t<least>::fast  fast;
+      typedef typename int_fast_t<least>::type  fast;
   };
 
   //  unsigned
   template< int Bits >   // bits required
-  struct uint_t 
+  struct uint_t : public detail::exact_unsigned_base_helper<Bits>
   {
-      typedef typename int_least_helper
+#if (defined(__BORLANDC__) || defined(__CODEGEAR__)) && defined(BOOST_NO_INTEGRAL_INT64_T)
+     // It's really not clear why this workaround should be needed... shrug I guess!  JM
+     BOOST_STATIC_CONSTANT(int, s = 
+           6 +
+          (Bits <= ::std::numeric_limits<unsigned long>::digits) +
+          (Bits <= ::std::numeric_limits<unsigned int>::digits) +
+          (Bits <= ::std::numeric_limits<unsigned short>::digits) +
+          (Bits <= ::std::numeric_limits<unsigned char>::digits));
+     typedef typename detail::int_least_helper< ::boost::uint_t<Bits>::s>::least least;
+#else
+      typedef typename detail::int_least_helper
         < 
           5 +
-          (Bits <= std::numeric_limits<unsigned long>::digits) +
-          (Bits <= std::numeric_limits<unsigned int>::digits) +
-          (Bits <= std::numeric_limits<unsigned short>::digits) +
-          (Bits <= std::numeric_limits<unsigned char>::digits)
+#ifdef BOOST_HAS_LONG_LONG
+          (Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) +
+#else
+           1 +
+#endif
+          (Bits <= ::std::numeric_limits<unsigned long>::digits) +
+          (Bits <= ::std::numeric_limits<unsigned int>::digits) +
+          (Bits <= ::std::numeric_limits<unsigned short>::digits) +
+          (Bits <= ::std::numeric_limits<unsigned char>::digits)
         >::least  least;
-      typedef typename int_fast_t<least>::fast  fast;
+#endif
+      typedef typename int_fast_t<least>::type  fast;
       // int_fast_t<> works correctly for unsigned too, in spite of the name.
   };
 
   //  integer templates specifying extreme value  ----------------------------//
 
   //  signed
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+  template< boost::long_long_type MaxValue >   // maximum value to require support
+#else
   template< long MaxValue >   // maximum value to require support
+#endif
   struct int_max_value_t 
   {
-      typedef typename int_least_helper
+      typedef typename detail::int_least_helper
         <
-          (MaxValue <= integer_traits<long>::const_max) +
-          (MaxValue <= integer_traits<int>::const_max) +
-          (MaxValue <= integer_traits<short>::const_max) +
-          (MaxValue <= integer_traits<signed char>::const_max)
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+          (MaxValue <= ::boost::integer_traits<boost::long_long_type>::const_max) +
+#else
+           1 +
+#endif
+          (MaxValue <= ::boost::integer_traits<long>::const_max) +
+          (MaxValue <= ::boost::integer_traits<int>::const_max) +
+          (MaxValue <= ::boost::integer_traits<short>::const_max) +
+          (MaxValue <= ::boost::integer_traits<signed char>::const_max)
         >::least  least;
-      typedef typename int_fast_t<least>::fast  fast;
+      typedef typename int_fast_t<least>::type  fast;
   };
 
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+  template< boost::long_long_type MinValue >   // minimum value to require support
+#else
   template< long MinValue >   // minimum value to require support
+#endif
   struct int_min_value_t 
   {
-      typedef typename int_least_helper
+      typedef typename detail::int_least_helper
         <
-          (MinValue >= integer_traits<long>::const_min) +
-          (MinValue >= integer_traits<int>::const_min) +
-          (MinValue >= integer_traits<short>::const_min) +
-          (MinValue >= integer_traits<signed char>::const_min)
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+          (MinValue >= ::boost::integer_traits<boost::long_long_type>::const_min) +
+#else
+           1 +
+#endif
+          (MinValue >= ::boost::integer_traits<long>::const_min) +
+          (MinValue >= ::boost::integer_traits<int>::const_min) +
+          (MinValue >= ::boost::integer_traits<short>::const_min) +
+          (MinValue >= ::boost::integer_traits<signed char>::const_min)
         >::least  least;
-      typedef typename int_fast_t<least>::fast  fast;
+      typedef typename int_fast_t<least>::type  fast;
   };
 
   //  unsigned
-  template< unsigned long Value >   // maximum value to require support
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+  template< boost::ulong_long_type MaxValue >   // minimum value to require support
+#else
+  template< unsigned long MaxValue >   // minimum value to require support
+#endif
   struct uint_value_t 
   {
-      typedef typename int_least_helper
+#if (defined(__BORLANDC__) || defined(__CODEGEAR__))
+     // It's really not clear why this workaround should be needed... shrug I guess!  JM
+#if defined(BOOST_NO_INTEGRAL_INT64_T)
+      BOOST_STATIC_CONSTANT(unsigned, which = 
+           6 +
+          (MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
+          (MaxValue <= ::boost::integer_traits<unsigned int>::const_max) +
+          (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) +
+          (MaxValue <= ::boost::integer_traits<unsigned char>::const_max));
+      typedef typename detail::int_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least;
+#else // BOOST_NO_INTEGRAL_INT64_T
+      BOOST_STATIC_CONSTANT(unsigned, which = 
+           5 +
+          (MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) +
+          (MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
+          (MaxValue <= ::boost::integer_traits<unsigned int>::const_max) +
+          (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) +
+          (MaxValue <= ::boost::integer_traits<unsigned char>::const_max));
+      typedef typename detail::int_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least;
+#endif // BOOST_NO_INTEGRAL_INT64_T
+#else
+      typedef typename detail::int_least_helper
         < 
           5 +
-          (Value <= integer_traits<unsigned long>::const_max) +
-          (Value <= integer_traits<unsigned int>::const_max) +
-          (Value <= integer_traits<unsigned short>::const_max) +
-          (Value <= integer_traits<unsigned char>::const_max)
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+          (MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) +
+#else
+           1 +
+#endif
+          (MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
+          (MaxValue <= ::boost::integer_traits<unsigned int>::const_max) +
+          (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) +
+          (MaxValue <= ::boost::integer_traits<unsigned char>::const_max)
         >::least  least;
-      typedef typename int_fast_t<least>::fast  fast;
+#endif
+      typedef typename int_fast_t<least>::type  fast;
   };
 
 
index 0a092d385037a16e9d8ed28103009e122f4eebd8..8c4e1bb1c4dce14ea82c0e1103d8d43c664d250b 100644 (file)
@@ -70,6 +70,11 @@ struct low_bits_mask_t
       BOOST_STATIC_CONSTANT( std::size_t, bit_count = limits_type::digits );    \
   }
 
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4245)  // 'initializing' : conversion from 'int' to 'const boost::low_bits_mask_t<8>::least', signed/unsigned mismatch
+#endif
+
 BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned char );
 
 #if USHRT_MAX > UCHAR_MAX
@@ -84,6 +89,10 @@ BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned int );
 BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned long );
 #endif
 
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
 #undef BOOST_LOW_BITS_MASK_SPECIALIZE
 
 
index 219a48e34116ef5b61027afafc634c5ef239630f..56c7a001251a25a7c9a37fed5729317a8d0e2918 100644 (file)
@@ -16,7 +16,7 @@
 #ifndef BOOST_INTEGER_STATIC_LOG2_HPP
 #define BOOST_INTEGER_STATIC_LOG2_HPP
 
-#include "boost/config.hpp" // for BOOST_STATIC_CONSTANT
+#include "boost/integer_fwd.hpp" // for boost::intmax_t
 
 namespace boost {
 
@@ -41,9 +41,8 @@ namespace boost {
      // terminates with x = 1 and n = 0 (see the algorithm's
      // invariant).
 
-     typedef unsigned long argument_type;
-     typedef          int  result_type;
-
+     typedef boost::static_log2_argument_type argument_type;
+     typedef boost::static_log2_result_type result_type;
 
      template <result_type n>
      struct choose_initial_n {
@@ -107,10 +106,6 @@ namespace boost {
  // static_log2<x>
  // ----------------------------------------
 
- typedef detail::static_log2_impl::argument_type static_log2_argument_type;
- typedef detail::static_log2_impl::result_type   static_log2_result_type;
-
-
  template <static_log2_argument_type x>
  struct static_log2 {
 
index 264603727f405a1bcb6c35b68b5ccbda15e66a87..ee76fd424a127a8fe82b86bbd070327a12b6d4dd 100644 (file)
 
 #include <boost/integer_fwd.hpp>  // self include
 
-#include <boost/config.hpp>  // for BOOST_STATIC_CONSTANT
-
-
 namespace boost
 {
 
-
 //  Compile-time extrema class declarations  ---------------------------------//
 //  Get the minimum or maximum of two values, signed or unsigned.
 
-template < long Value1, long Value2 >
+template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
 struct static_signed_min
 {
-    BOOST_STATIC_CONSTANT( long, value = (Value1 > Value2) ? Value2 : Value1 );
+    BOOST_STATIC_CONSTANT(static_min_max_signed_type, value = (Value1 > Value2) ? Value2 : Value1 );
 };
 
-template < long Value1, long Value2 >
+template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
 struct static_signed_max
 {
-    BOOST_STATIC_CONSTANT( long, value = (Value1 < Value2) ? Value2 : Value1 );
+    BOOST_STATIC_CONSTANT(static_min_max_signed_type, value = (Value1 < Value2) ? Value2 : Value1 );
 };
 
-template < unsigned long Value1, unsigned long Value2 >
+template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
 struct static_unsigned_min
 {
-    BOOST_STATIC_CONSTANT( unsigned long, value
+    BOOST_STATIC_CONSTANT(static_min_max_unsigned_type, value
      = (Value1 > Value2) ? Value2 : Value1 );
 };
 
-template < unsigned long Value1, unsigned long Value2 >
+template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
 struct static_unsigned_max
 {
-    BOOST_STATIC_CONSTANT( unsigned long, value
+    BOOST_STATIC_CONSTANT(static_min_max_unsigned_type, value
      = (Value1 < Value2) ? Value2 : Value1 );
 };
 
index 33cfc9986f382c400cc3a8ac7898367a956a2a24..01b0a0844f82a03755e133fdd64f6f74f6925641 100644 (file)
 
 #include <boost/config.hpp>  // for BOOST_NO_INTRINSIC_WCHAR_T
 #include <boost/limits.hpp>  // for std::numeric_limits
+#include <boost/cstdint.hpp>  // For intmax_t
 
 
 namespace boost
 {
 
+#ifdef BOOST_NO_INTEGRAL_INT64_T
+     typedef unsigned long static_log2_argument_type;
+     typedef          int  static_log2_result_type;
+     typedef long          static_min_max_signed_type;
+     typedef unsigned long static_min_max_unsigned_type;
+#else
+     typedef boost::uintmax_t static_min_max_unsigned_type;
+     typedef boost::intmax_t  static_min_max_signed_type;
+     typedef boost::uintmax_t static_log2_argument_type;
+     typedef int              static_log2_result_type;
+#endif
 
 //  From <boost/cstdint.hpp>  ------------------------------------------------//
 
@@ -65,7 +77,7 @@ template <  >
 template <  >
     class integer_traits< unsigned long >;
 
-#ifdef ULLONG_MAX
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && (defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64))
 template <  >
     class integer_traits<  ::boost::long_long_type>;
 
@@ -85,13 +97,25 @@ template< int Bits >
 template< int Bits >
     struct uint_t;
 
-template< long MaxValue >
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+    template< boost::long_long_type MaxValue >   // maximum value to require support
+#else
+  template< long MaxValue >   // maximum value to require support
+#endif
     struct int_max_value_t;
 
-template< long MinValue >
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+  template< boost::long_long_type MinValue >   // minimum value to require support
+#else
+  template< long MinValue >   // minimum value to require support
+#endif
     struct int_min_value_t;
 
-template< unsigned long Value >
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+  template< boost::ulong_long_type MaxValue >   // maximum value to require support
+#else
+  template< unsigned long MaxValue >   // maximum value to require support
+#endif
     struct uint_value_t;
 
 
@@ -124,28 +148,26 @@ template <  >
 
 //  From <boost/integer/static_log2.hpp>  ------------------------------------//
 
-template < unsigned long Value >
+template <static_log2_argument_type Value >
     struct static_log2;
 
-template <  >
-    struct static_log2< 0ul >;
+template <> struct static_log2<0u>;
 
 
 //  From <boost/integer/static_min_max.hpp>  ---------------------------------//
 
-template < long Value1, long Value2 >
+template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
     struct static_signed_min;
 
-template < long Value1, long Value2 >
+template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
     struct static_signed_max;
 
-template < unsigned long Value1, unsigned long Value2 >
+template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
     struct static_unsigned_min;
 
-template < unsigned long Value1, unsigned long Value2 >
+template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
     struct static_unsigned_max;
 
-
 }  // namespace boost
 
 
index ac4ef32f307ae3b770baf38d7cefdf77819d4585..129ce82c65375180deea6af122dee7fa90945ec1 100644 (file)
@@ -5,7 +5,7 @@
  * accompanying file LICENSE_1_0.txt or copy at
  * http://www.boost.org/LICENSE_1_0.txt)
  *
- * $Id: integer_traits.hpp 32576 2006-02-05 10:19:42Z johnmaddock $
+ * $Id: integer_traits.hpp 58381 2009-12-14 18:14:48Z johnmaddock $
  *
  * Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers
  */
 #include <wchar.h>
 #endif
 
+//
+// We simply cannot include this header on gcc without getting copious warnings of the kind:
+//
+// ../../../boost/integer_traits.hpp:164:66: warning: use of C99 long long integer constant
+//
+// And yet there is no other reasonable implementation, so we declare this a system header
+// to suppress these warnings.
+//
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+#pragma GCC system_header
+#endif
 
 namespace boost {
 template<class T>
@@ -225,6 +236,20 @@ class integer_traits< ::boost::ulong_long_type>
     public detail::integer_traits_base< ::boost::ulong_long_type, 0, ~0uLL>
 { };
 
+#elif defined(BOOST_HAS_MS_INT64)
+
+template<>
+class integer_traits< __int64>
+  : public std::numeric_limits< __int64>,
+    public detail::integer_traits_base< __int64, _I64_MIN, _I64_MAX>
+{ };
+
+template<>
+class integer_traits< unsigned __int64>
+  : public std::numeric_limits< unsigned __int64>,
+    public detail::integer_traits_base< unsigned __int64, 0, _UI64_MAX>
+{ };
+
 #endif
 #endif
 
index 2524e8aa43c4cfeb4965e96aa01335df4580e045..4945af623b265a3f298d261038202235200e5079 100755 (executable)
@@ -11,7 +11,7 @@
 //
 //  Defines enum boost::memory_order per the C++0x working draft
 //
-//  Copyright (c) 2008 Peter Dimov
+//  Copyright (c) 2008, 2009 Peter Dimov
 //
 //  Distributed under the Boost Software License, Version 1.0.
 //  See accompanying file LICENSE_1_0.txt or copy at
 namespace boost
 {
 
+//
+// Enum values are chosen so that code that needs to insert
+// a trailing fence for acquire semantics can use a single
+// test such as:
+//
+// if( mo & memory_order_acquire ) { ...fence... }
+//
+// For leading fences one can use:
+//
+// if( mo & memory_order_release ) { ...fence... }
+//
+// Architectures such as Alpha that need a fence on consume
+// can use:
+//
+// if( mo & ( memory_order_acquire | memory_order_consume ) ) { ...fence... }
+//
+
 enum memory_order
 {
     memory_order_relaxed = 0,
     memory_order_acquire = 1,
     memory_order_release = 2,
     memory_order_acq_rel = 3, // acquire | release
-    memory_order_seq_cst = 7  // acq_rel | 4
+    memory_order_seq_cst = 7, // acq_rel | 4
+    memory_order_consume = 8
 };
 
 } // namespace boost
index 98fd59413fd4d795d2acbea1e9c56f88ea2df7bf..fa2ea48c92886b3d4b4ade9ab278dff8b57676a6 100644 (file)
@@ -747,6 +747,46 @@ struct RegexConcept
 };
 
 #ifndef BOOST_REGEX_TEST_STD
+
+template <class M>
+struct functor1
+{
+   typedef typename M::char_type char_type;
+   const char_type* operator()(const M&)
+   {
+      static const char_type c = static_cast<char_type>(0);
+      return &c;
+   }
+};
+template <class M>
+struct functor1b
+{
+   typedef typename M::char_type char_type;
+   std::vector<char_type> operator()(const M&)
+   {
+      static const std::vector<char_type> c;
+      return c;
+   }
+};
+template <class M>
+struct functor2
+{
+   template <class O>
+   O operator()(const M& /*m*/, O i)
+   {
+      return i;
+   }
+};
+template <class M>
+struct functor3
+{
+   template <class O>
+   O operator()(const M& /*m*/, O i, regex_constants::match_flag_type)
+   {
+      return i;
+   }
+};
+
 //
 // BoostRegexConcept:
 // Test every interface in the Boost implementation:
@@ -764,6 +804,7 @@ struct BoostRegexConcept
    typedef std::basic_string<value_type> string_type;
    typedef typename Regex::const_iterator const_iterator;
    typedef bidirectional_iterator_archetype<value_type> BidiIterator;
+   typedef output_iterator_archetype<value_type> OutputIterator;
    typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
    typedef global_regex_namespace::match_results<BidiIterator> match_results_type;
 
@@ -884,6 +925,58 @@ struct BoostRegexConcept
       m_stream << m_sub;
       m_stream << m_cresults;
 #endif
+      //
+      // Extended formatting with a functor:
+      //
+      regex_constants::match_flag_type f = regex_constants::match_default;
+      OutputIterator out = static_object<OutputIterator>::get();
+      functor3<match_results_type> func3;
+      out = regex_format(out, m_cresults, func3, f);
+      out = regex_format(out, m_cresults, func3);
+      functor2<match_results_type> func2;
+      out = regex_format(out, m_cresults, func2, f);
+      out = regex_format(out, m_cresults, func2);
+      functor1<match_results_type> func1;
+      out = regex_format(out, m_cresults, func1, f);
+      out = regex_format(out, m_cresults, func1);
+
+      m_string += regex_format(m_cresults, func3, f);
+      m_string += regex_format(m_cresults, func3);
+      m_string += regex_format(m_cresults, func2, f);
+      m_string += regex_format(m_cresults, func2);
+      m_string += regex_format(m_cresults, func1, f);
+      m_string += regex_format(m_cresults, func1);
+
+      out = m_cresults.format(out, func3, f);
+      out = m_cresults.format(out, func3);
+      out = m_cresults.format(out, func2, f);
+      out = m_cresults.format(out, func2);
+      out = m_cresults.format(out, func1, f);
+      out = m_cresults.format(out, func1);
+
+      m_string += m_cresults.format(func3, f);
+      m_string += m_cresults.format(func3);
+      m_string += m_cresults.format(func2, f);
+      m_string += m_cresults.format(func2);
+      m_string += m_cresults.format(func1, f);
+      m_string += m_cresults.format(func1);
+
+      out = regex_replace(out, m_in, m_in, ce, func3, f);
+      out = regex_replace(out, m_in, m_in, ce, func3);
+      out = regex_replace(out, m_in, m_in, ce, func2, f);
+      out = regex_replace(out, m_in, m_in, ce, func2);
+      out = regex_replace(out, m_in, m_in, ce, func1, f);
+      out = regex_replace(out, m_in, m_in, ce, func1);
+
+      functor3<match_results<typename string_type::const_iterator> > func3s;
+      functor2<match_results<typename string_type::const_iterator> > func2s;
+      functor1<match_results<typename string_type::const_iterator> > func1s;
+      m_string += regex_replace(m_string, ce, func3s, f);
+      m_string += regex_replace(m_string, ce, func3s);
+      m_string += regex_replace(m_string, ce, func2s, f);
+      m_string += regex_replace(m_string, ce, func2s);
+      m_string += regex_replace(m_string, ce, func1s, f);
+      m_string += regex_replace(m_string, ce, func1s);
    }
 
    std::basic_ostream<value_type> m_stream;
@@ -893,6 +986,7 @@ struct BoostRegexConcept
    const value_type m_char;
    match_results_type m_results;
    const match_results_type m_cresults;
+   BidiIterator m_in;
 
    BoostRegexConcept();
    BoostRegexConcept(const BoostRegexConcept&);
index 8306f3ff9ab4d0c2c29510b022aac7aef4b309a0..e4b21384b579c12f9de85b19619bcfde6e6ed33e 100644 (file)
 #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
 #  define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
 #endif
+/*
+ * Shared regex lib will crash without this, frankly it looks a lot like a gcc bug:
+ */
+#if defined(__MINGW32__)
+#  define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
+#endif
 
 /*
  * If there isn't good enough wide character support then there will
index 247155724e25a07e4d7bc7435d03c5412020322e..c8770c6d1695559bb26a5765c72efc1e3df228da 100644 (file)
@@ -376,7 +376,7 @@ inline u32regex make_u32regex(const std::basic_string<C, T, A>& s, boost::regex_
 //
 // Construction from ICU string type:
 //
-inline u32regex make_u32regex(const UnicodeString& s, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
+inline u32regex make_u32regex(const U_NAMESPACE_QUALIFIER UnicodeString& s, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
 {
    return re_detail::do_make_u32regex(s.getBuffer(), s.getBuffer() + s.length(), opt, static_cast<boost::mpl::int_<2> const*>(0));
 }
@@ -498,7 +498,7 @@ inline bool u32regex_match(const std::wstring& s,
    return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
 }
 #endif
-inline bool u32regex_match(const UnicodeString& s, 
+inline bool u32regex_match(const U_NAMESPACE_QUALIFIER UnicodeString& s, 
                         match_results<const UChar*>& m, 
                         const u32regex& e, 
                         match_flag_type flags = match_default)
@@ -562,7 +562,7 @@ inline bool u32regex_match(const std::wstring& s,
    return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
 }
 #endif
-inline bool u32regex_match(const UnicodeString& s, 
+inline bool u32regex_match(const U_NAMESPACE_QUALIFIER UnicodeString& s, 
                         const u32regex& e, 
                         match_flag_type flags = match_default)
 {
@@ -683,7 +683,7 @@ inline bool u32regex_search(const std::wstring& s,
    return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
 }
 #endif
-inline bool u32regex_search(const UnicodeString& s, 
+inline bool u32regex_search(const U_NAMESPACE_QUALIFIER UnicodeString& s, 
                         match_results<const UChar*>& m, 
                         const u32regex& e, 
                         match_flag_type flags = match_default)
@@ -744,7 +744,7 @@ inline bool u32regex_search(const std::wstring& s,
    return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
 }
 #endif
-inline bool u32regex_search(const UnicodeString& s, 
+inline bool u32regex_search(const U_NAMESPACE_QUALIFIER UnicodeString& s, 
                         const u32regex& e, 
                         match_flag_type flags = match_default)
 {
@@ -921,7 +921,7 @@ inline OutputIterator u32regex_replace(OutputIterator out,
                          Iterator first,
                          Iterator last,
                          const u32regex& e, 
-                         const UnicodeString& fmt,
+                         const U_NAMESPACE_QUALIFIER UnicodeString& fmt,
                          match_flag_type flags = match_default)
 {
    return re_detail::extract_output_base
@@ -966,9 +966,9 @@ namespace re_detail{
 
 class unicode_string_out_iterator
 {
-   UnicodeString* out;
+   U_NAMESPACE_QUALIFIER UnicodeString* out;
 public:
-   unicode_string_out_iterator(UnicodeString& s) : out(&s) {}
+   unicode_string_out_iterator(U_NAMESPACE_QUALIFIER UnicodeString& s) : out(&s) {}
    unicode_string_out_iterator& operator++() { return *this; }
    unicode_string_out_iterator& operator++(int) { return *this; }
    unicode_string_out_iterator& operator*() { return *this; }
@@ -986,23 +986,23 @@ public:
 
 }
 
-inline UnicodeString u32regex_replace(const UnicodeString& s,
+inline U_NAMESPACE_QUALIFIER UnicodeString u32regex_replace(const U_NAMESPACE_QUALIFIER UnicodeString& s,
                          const u32regex& e, 
                          const UChar* fmt,
                          match_flag_type flags = match_default)
 {
-   UnicodeString result;
+   U_NAMESPACE_QUALIFIER UnicodeString result;
    re_detail::unicode_string_out_iterator i(result);
    u32regex_replace(i, s.getBuffer(), s.getBuffer()+s.length(), e, fmt, flags);
    return result;
 }
 
-inline UnicodeString u32regex_replace(const UnicodeString& s,
+inline U_NAMESPACE_QUALIFIER UnicodeString u32regex_replace(const U_NAMESPACE_QUALIFIER UnicodeString& s,
                          const u32regex& e, 
-                         const UnicodeString& fmt,
+                         const U_NAMESPACE_QUALIFIER UnicodeString& fmt,
                          match_flag_type flags = match_default)
 {
-   UnicodeString result;
+   U_NAMESPACE_QUALIFIER UnicodeString result;
    re_detail::unicode_string_out_iterator i(result);
    re_detail::do_regex_replace(
          re_detail::make_utf32_out(i, static_cast<mpl::int_<2> const*>(0)),
index 2a7e00bc0a29a54d7444702fdb8972c410b3e998..e1aa191da2474cc4a9ce8b486c919e8be4b5c85b 100644 (file)
@@ -73,7 +73,9 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, siz
    // for now just throw, but we should never really get here...
    //
    ::boost::throw_exception(std::runtime_error("Error in thread safety code: could not acquire a lock"));
+#ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION
    return boost::shared_ptr<Object>();
+#endif
 #else
    return do_get(k, max_cache_size);
 #endif
index 218169c3c88ede8b3971f6cf3b33c18f41ca2908..334ef27d32e15e58da2a135dec1690daafccaba2 100644 (file)
@@ -140,7 +140,7 @@ inline bool scoped_static_mutex_lock::locked()const
 namespace boost{
 
 class BOOST_REGEX_DECL scoped_static_mutex_lock;
-extern "C" BOOST_REGEX_DECL void free_static_mutex();
+extern "C" BOOST_REGEX_DECL void boost_regex_free_static_mutex();
 
 class BOOST_REGEX_DECL static_mutex
 {
index 6f0050542dccb7c9bad5b9f69c1d53ae02e01989..ee207d0874451d29caacd0a9f3ef38a243cf649e 100644 (file)
@@ -677,6 +677,8 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
 template <class charT, class traits>
 void basic_regex_creator<charT, traits>::finalize(const charT* p1, const charT* p2)
 {
+   if(this->m_pdata->m_status)
+      return;
    // we've added all the states we need, now finish things off.
    // start by adding a terminating state:
    append_state(syntax_element_match);
@@ -698,6 +700,8 @@ void basic_regex_creator<charT, traits>::finalize(const charT* p1, const charT*
    {
       m_pdata->m_has_recursions = true;
       fixup_recursions(m_pdata->m_first_state);
+      if(this->m_pdata->m_status)
+         return;
    }
    else
       m_pdata->m_has_recursions = false;
@@ -787,7 +791,7 @@ void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state)
                      //
                      if(0 == (this->flags() & regex_constants::no_except))
                      {
-                        std::string message = this->m_pdata->m_ptraits->error_string(boost::regex_constants::error_bad_pattern);
+                        std::string message = "Encountered a forward reference to a marked sub-expression that does not exist.";
                         boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0);
                         e.raise();
                      }
@@ -807,8 +811,43 @@ void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state)
             {
                if((p->type == syntax_element_startmark) && (static_cast<re_brace*>(p)->index == id))
                {
+                  //
+                  // We've found the target of the recursion, set the jump target:
+                  //
                   static_cast<re_jump*>(state)->alt.p = p;
                   ok = true;
+                  // 
+                  // Now scan the target for nested repeats:
+                  //
+                  p = p->next.p;
+                  int next_rep_id = 0;
+                  while(p)
+                  {
+                     switch(p->type)
+                     {
+                     case syntax_element_rep:
+                     case syntax_element_dot_rep:
+                     case syntax_element_char_rep:
+                     case syntax_element_short_set_rep:
+                     case syntax_element_long_set_rep:
+                        next_rep_id = static_cast<re_repeat*>(p)->state_id;
+                        break;
+                     case syntax_element_endmark:
+                        if(static_cast<const re_brace*>(p)->index == id)
+                           next_rep_id = -1;
+                        break;
+                     default: 
+                        break;
+                     }
+                     if(next_rep_id)
+                        break;
+                     p = p->next.p;
+                  }
+                  if(next_rep_id > 0)
+                  {
+                     static_cast<re_recurse*>(state)->state_id = next_rep_id - 1;
+                  }
+
                   break;
                }
                p = p->next.p;
@@ -828,7 +867,7 @@ void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state)
                //
                if(0 == (this->flags() & regex_constants::no_except))
                {
-                  std::string message = this->m_pdata->m_ptraits->error_string(boost::regex_constants::error_bad_pattern);
+                  std::string message = "Encountered a forward reference to a recursive sub-expression that does not exist.";
                   boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0);
                   e.raise();
                }
@@ -893,7 +932,7 @@ void basic_regex_creator<charT, traits>::create_startmaps(re_syntax_base* state)
             //
             if(0 == (this->flags() & regex_constants::no_except))
             {
-               std::string message = this->m_pdata->m_ptraits->error_string(boost::regex_constants::error_bad_pattern);
+               std::string message = "Invalid lookbehind assertion encountered in the regular expression.";
                boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0);
                e.raise();
             }
@@ -1012,6 +1051,9 @@ template <class charT, class traits>
 void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state, unsigned char* l_map, unsigned int* pnull, unsigned char mask)
 {
    int not_last_jump = 1;
+   re_syntax_base* recursion_start = 0;
+   int recursion_sub = 0;
+   re_syntax_base* recursion_restart = 0;
 
    // track case sensitivity:
    bool l_icase = m_icase;
@@ -1057,6 +1099,40 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
          return;
       }
       case syntax_element_recurse:
+         {
+            if(recursion_start == state)
+            {
+               // Infinite recursion!!
+               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 = "Encountered an infinite recursion.";
+                  boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0);
+                  e.raise();
+               }
+            }
+            else if(recursion_start == 0)
+            {
+               recursion_start = state;
+               recursion_restart = state->next.p;
+               state = static_cast<re_jump*>(state)->alt.p;
+               if(state->type == syntax_element_startmark)
+                  recursion_sub = static_cast<re_brace*>(state)->index;
+               else
+                  recursion_sub = 0;
+               break;
+            }
+            // fall through, can't handle nested recursion here...
+         }
       case syntax_element_backref:
          // can be null, and any character can match:
          if(pnull)
@@ -1215,12 +1291,45 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
                *pnull |= mask;
             return;
          }
-         else
+         else if(recursion_start && (recursion_sub != 0) && (recursion_sub == static_cast<re_brace*>(state)->index))
          {
-            state = state->next.p;
+            // recursion termination:
+            recursion_start = 0;
+            state = recursion_restart;
             break;
          }
 
+         //
+         // Normally we just go to the next state... but if this sub-expression is
+         // the target of a recursion, then we might be ending a recursion, in which
+         // case we should check whatever follows that recursion, as well as whatever
+         // follows this state:
+         //
+         if(m_pdata->m_has_recursions && static_cast<re_brace*>(state)->index)
+         {
+            bool ok = false;
+            re_syntax_base* p = m_pdata->m_first_state;
+            while(p)
+            {
+               if((p->type == syntax_element_recurse))
+               {
+                  re_brace* p2 = static_cast<re_brace*>(static_cast<re_jump*>(p)->alt.p);
+                  if((p2->type == syntax_element_startmark) && (p2->index == static_cast<re_brace*>(state)->index))
+                  {
+                     ok = true;
+                     break;
+                  }
+               }
+               p = p->next.p;
+            }
+            if(ok)
+            {
+               create_startmap(p->next.p, l_map, pnull, mask);
+            }
+         }
+         state = state->next.p;
+         break;
+
       case syntax_element_startmark:
          // need to handle independent subs as a special case:
          if(static_cast<re_brace*>(state)->index == -3)
index ebec35b60d98c17bb3ab40655e431a5f8d72e099..3ea4d6453da6fa5ec9a26b0f18c3e19d970c90a9 100644 (file)
@@ -45,6 +45,11 @@ public:
    basic_regex_parser(regex_data<charT, traits>* data);
    void parse(const charT* p1, const charT* p2, unsigned flags);
    void fail(regex_constants::error_type error_code, std::ptrdiff_t position);
+   void fail(regex_constants::error_type error_code, std::ptrdiff_t position, std::string message, std::ptrdiff_t start_pos);
+   void fail(regex_constants::error_type error_code, std::ptrdiff_t position, const std::string& message)
+   {
+      fail(error_code, position, message, position);
+   }
 
    bool parse_all();
    bool parse_basic();
@@ -141,6 +146,11 @@ void basic_regex_parser<charT, traits>::parse(const charT* p1, const charT* p2,
    case regbase::literal:
       m_parser_proc = &basic_regex_parser<charT, traits>::parse_literal;
       break;
+   default:
+      // Ooops, someone has managed to set more than one of the main option flags, 
+      // so this must be an error:
+      fail(regex_constants::error_unknown, 0, "An invalid combination of regular expression syntax flags was used.");
+      return;
    }
 
    // parse all our characters:
@@ -155,7 +165,7 @@ void basic_regex_parser<charT, traits>::parse(const charT* p1, const charT* p2,
    // have had an unexpected ')' :
    if(!result)
    {
-      fail(regex_constants::error_paren, ::boost::re_detail::distance(m_base, m_position));
+      fail(regex_constants::error_paren, ::boost::re_detail::distance(m_base, m_position), "Found a closing ) with no corresponding openening parenthesis.");
       return;
    }
    // if an error has been set then give up now:
@@ -168,13 +178,40 @@ void basic_regex_parser<charT, traits>::parse(const charT* p1, const charT* p2,
 
 template <class charT, class traits>
 void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_code, std::ptrdiff_t position)
+{
+   // get the error message:
+   std::string message = this->m_pdata->m_ptraits->error_string(error_code);
+   fail(error_code, position, message);
+}
+
+template <class charT, class traits>
+void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_code, std::ptrdiff_t position, std::string message, std::ptrdiff_t start_pos)
 {
    if(0 == this->m_pdata->m_status) // update the error code if not already set
       this->m_pdata->m_status = error_code;
    m_position = m_end; // don't bother parsing anything else
-   // get the error message:
-   std::string message = this->m_pdata->m_ptraits->error_string(error_code);
-   // and raise the exception, this will do nothing if exceptions are disabled:
+
+   //
+   // Augment error message with the regular expression text:
+   //
+   if(start_pos == position)
+      start_pos = (std::max)(static_cast<std::ptrdiff_t>(0), position - static_cast<std::ptrdiff_t>(10));
+   std::ptrdiff_t end_pos = (std::min)(position + static_cast<std::ptrdiff_t>(10), static_cast<std::ptrdiff_t>(m_end - m_base));
+   if(error_code != regex_constants::error_empty)
+   {
+      if((start_pos != 0) || (end_pos != (m_end - m_base)))
+         message += "  The error occured while parsing the regular expression fragment: '";
+      else
+         message += "  The error occured while parsing the regular expression: '";
+      if(start_pos != end_pos)
+      {
+         message += std::string(m_base + start_pos, m_base + position);
+         message += ">>>HERE>>>";
+         message += std::string(m_base + position, m_base + end_pos);
+      }
+      message += "'.";
+   }
+
 #ifndef BOOST_NO_EXCEPTIONS
    if(0 == (this->flags() & regex_constants::no_except))
    {
@@ -282,7 +319,7 @@ bool basic_regex_parser<charT, traits>::parse_extended()
    case regex_constants::syntax_star:
       if(m_position == this->m_base)
       {
-         fail(regex_constants::error_badrepeat, 0);
+         fail(regex_constants::error_badrepeat, 0, "The repeat operator \"*\" cannot start a regular expression.");
          return false;
       }
       ++m_position;
@@ -290,7 +327,7 @@ bool basic_regex_parser<charT, traits>::parse_extended()
    case regex_constants::syntax_question:
       if(m_position == this->m_base)
       {
-         fail(regex_constants::error_badrepeat, 0);
+         fail(regex_constants::error_badrepeat, 0, "The repeat operator \"?\" cannot start a regular expression.");
          return false;
       }
       ++m_position;
@@ -298,7 +335,7 @@ bool basic_regex_parser<charT, traits>::parse_extended()
    case regex_constants::syntax_plus:
       if(m_position == this->m_base)
       {
-         fail(regex_constants::error_badrepeat, 0);
+         fail(regex_constants::error_badrepeat, 0, "The repeat operator \"+\" cannot start a regular expression.");
          return false;
       }
       ++m_position;
@@ -307,7 +344,7 @@ bool basic_regex_parser<charT, traits>::parse_extended()
       ++m_position;
       return parse_repeat_range(false);
    case regex_constants::syntax_close_brace:
-      fail(regex_constants::error_brace, this->m_position - this->m_end);
+      fail(regex_constants::error_brace, this->m_position - this->m_base, "Found a closing repetition operator } with no corresponding {.");
       return false;
    case regex_constants::syntax_or:
       return parse_alt();
@@ -512,7 +549,7 @@ bool basic_regex_parser<charT, traits>::parse_basic_escape()
    case regex_constants::syntax_close_brace:
       if(this->flags() & regbase::no_intervals)
          return parse_literal();
-      fail(regex_constants::error_brace, this->m_position - this->m_base);
+      fail(regex_constants::error_brace, this->m_position - this->m_base, "Found a closing repetition operator } with no corresponding {.");
       return false;
    case regex_constants::syntax_or:
       if(this->flags() & regbase::bk_vbar)
@@ -607,7 +644,7 @@ bool basic_regex_parser<charT, traits>::parse_basic_escape()
          case 'c':
          case 'C':
             // not supported yet:
-            fail(regex_constants::error_escape, m_position - m_base);
+            fail(regex_constants::error_escape, m_position - m_base, "The \\c and \\C escape sequences are not supported by POSIX basic regular expressions: try the Perl syntax instead.");
             return false;
          default:
             break;
@@ -705,7 +742,7 @@ escape_type_class_jump:
          char_class_type m;
          if(m_position == m_end)
          {
-            fail(regex_constants::error_escape, m_position - m_base);
+            fail(regex_constants::error_escape, m_position - m_base, "Incomplete property escape found.");
             return false;
          }
          // maybe have \p{ddd}
@@ -717,7 +754,7 @@ escape_type_class_jump:
                ++m_position;
             if(m_position == m_end)
             {
-               fail(regex_constants::error_escape, m_position - m_base);
+               fail(regex_constants::error_escape, m_position - m_base, "Closing } missing from property escape sequence.");
                return false;
             }
             m = this->m_traits.lookup_classname(++base, m_position++);
@@ -740,7 +777,7 @@ escape_type_class_jump:
             }
             return true;
          }
-         fail(regex_constants::error_ctype, m_position - m_base);
+         fail(regex_constants::error_ctype, m_position - m_base, "Escape sequence was neither a valid property nor a valid character class name.");
          return false;
       }
    case regex_constants::escape_type_reset_start_mark:
@@ -776,9 +813,10 @@ escape_type_class_jump:
       {
          bool have_brace = false;
          bool negative = false;
+         static const char* incomplete_message = "Incomplete \\g escape found.";
          if(++m_position == m_end)
          {
-            fail(regex_constants::error_escape, m_position - m_base);
+            fail(regex_constants::error_escape, m_position - m_base, incomplete_message);
             return false;
          }
          // maybe have \g{ddd}
@@ -786,7 +824,7 @@ escape_type_class_jump:
          {
             if(++m_position == m_end)
             {
-               fail(regex_constants::error_escape, m_position - m_base);
+               fail(regex_constants::error_escape, m_position - m_base, incomplete_message);
                return false;
             }
             have_brace = true;
@@ -794,7 +832,7 @@ escape_type_class_jump:
          negative = (*m_position == static_cast<charT>('-'));
          if((negative) && (++m_position == m_end))
          {
-            fail(regex_constants::error_escape, m_position - m_base);
+            fail(regex_constants::error_escape, m_position - m_base, incomplete_message);
             return false;
          }
          const charT* pc = m_position;
@@ -819,7 +857,7 @@ escape_type_class_jump:
          }
          else
          {
-            fail(regex_constants::error_backref, m_position - m_end);
+            fail(regex_constants::error_backref, m_position - m_base);
             return false;
          }
          m_position = pc;
@@ -827,7 +865,7 @@ escape_type_class_jump:
          {
             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);
+               fail(regex_constants::error_escape, m_position - m_base, incomplete_message);
                return false;
             }
             ++m_position;
@@ -894,7 +932,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
    }
    if(0 == this->m_last_state)
    {
-      fail(regex_constants::error_badrepeat, ::boost::re_detail::distance(m_base, m_position));
+      fail(regex_constants::error_badrepeat, ::boost::re_detail::distance(m_base, m_position), "Nothing to repeat.");
       return false;
    }
    if(this->m_last_state->type == syntax_element_endmark)
@@ -968,7 +1006,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
       re_brace* pb = static_cast<re_brace*>(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<re_jump*>(this->insert_state(insert_point + sizeof(re_brace), syntax_element_jump, sizeof(re_jump)));
+      jmp = static_cast<re_jump*>(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<re_brace*>(this->append_state(syntax_element_endmark, sizeof(re_brace)));
@@ -981,6 +1019,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
 template <class charT, class traits>
 bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
 {
+   static const char* incomplete_message = "Missing } in quantified repetition.";
    //
    // parse a repeat-range:
    //
@@ -992,7 +1031,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
    // fail if at end:
    if(this->m_position == this->m_end)
    {
-      fail(regex_constants::error_brace, this->m_position - this->m_base);
+      fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
       return false;
    }
    // get min:
@@ -1007,7 +1046,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
    }
    else if(this->m_position == this->m_end)
    {
-      fail(regex_constants::error_brace, this->m_position - this->m_base);
+      fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
       return false;
    }
    min = v;
@@ -1021,7 +1060,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
          ++m_position;
       if(this->m_position == this->m_end)
       {
-         fail(regex_constants::error_brace, this->m_position - this->m_base);
+         fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
          return false;
       }
       // get the value if any:
@@ -1039,7 +1078,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
    // OK now check trailing }:
    if(this->m_position == this->m_end)
    {
-      fail(regex_constants::error_brace, this->m_position - this->m_base);
+      fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
       return false;
    }
    if(isbasic)
@@ -1049,13 +1088,13 @@ bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
          ++m_position;
          if(this->m_position == this->m_end)
          {
-            fail(regex_constants::error_brace, this->m_position - this->m_base);
+            fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
             return false;
          }
       }
       else
       {
-         fail(regex_constants::error_badbrace, this->m_position - this->m_base);
+         fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
          return false;
       }
    }
@@ -1063,7 +1102,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
       ++m_position;
    else
    {
-      fail(regex_constants::error_badbrace, this->m_position - this->m_base);
+      fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message);
       return false;
    }
    //
@@ -1071,7 +1110,11 @@ bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
    //
    if(min > max)
    {
-      fail(regex_constants::error_badbrace, this->m_position - this->m_base);
+      // Backtrack to error location:
+      m_position -= 2;
+      while(this->m_traits.isctype(*m_position, this->m_word_mask)) --m_position;
+         ++m_position;
+      fail(regex_constants::error_badbrace, m_position - m_base);
       return false;
    }
    return parse_repeat(min, max);
@@ -1094,7 +1137,7 @@ bool basic_regex_parser<charT, traits>::parse_alt()
         )
       )
    {
-      fail(regex_constants::error_empty, this->m_position - this->m_base);
+      fail(regex_constants::error_empty, this->m_position - this->m_base, "A regular expression can start with the alternation operator |.");
       return false;
    }
    //
@@ -1146,10 +1189,11 @@ bool basic_regex_parser<charT, traits>::parse_alt()
 template <class charT, class traits>
 bool basic_regex_parser<charT, traits>::parse_set()
 {
+   static const char* incomplete_message = "Character set declaration starting with [ terminated prematurely - either no ] was found or the set had no content.";
    ++m_position;
    if(m_position == m_end)
    {
-      fail(regex_constants::error_brack, m_position - m_base);
+      fail(regex_constants::error_brack, m_position - m_base, incomplete_message);
       return false;
    }
    basic_char_set<charT, traits> char_set;
@@ -1182,7 +1226,7 @@ bool basic_regex_parser<charT, traits>::parse_set()
             ++m_position;
             if(0 == this->append_set(char_set))
             {
-               fail(regex_constants::error_range, m_position - m_base);
+               fail(regex_constants::error_ctype, m_position - m_base);
                return false;
             }
          }
@@ -1237,6 +1281,7 @@ bool basic_regex_parser<charT, traits>::parse_set()
 template <class charT, class traits>
 bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, traits>& char_set)
 {
+   static const char* incomplete_message = "Character class declaration starting with [ terminated prematurely - either no ] was found or the set had no content.";
    //
    // we have either a character class [:name:]
    // a collating element [.name.]
@@ -1244,7 +1289,7 @@ bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, tr
    //
    if(m_end == ++m_position)
    {
-      fail(regex_constants::error_brack, m_position - m_base);
+      fail(regex_constants::error_brack, m_position - m_base, incomplete_message);
       return false;
    }
    switch(this->m_traits.syntax_type(*m_position))
@@ -1269,14 +1314,14 @@ bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, tr
       // skip the ':'
       if(m_end == ++m_position)
       {
-         fail(regex_constants::error_brack, m_position - m_base);
+         fail(regex_constants::error_brack, m_position - m_base, incomplete_message);
          return false;
       }
       const charT* name_first = m_position;
       // skip at least one character, then find the matching ':]'
       if(m_end == ++m_position)
       {
-         fail(regex_constants::error_brack, m_position - m_base);
+         fail(regex_constants::error_brack, m_position - m_base, incomplete_message);
          return false;
       }
       while((m_position != m_end) 
@@ -1285,13 +1330,13 @@ bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, tr
       const charT* name_last = m_position;
       if(m_end == m_position)
       {
-         fail(regex_constants::error_brack, m_position - m_base);
+         fail(regex_constants::error_brack, m_position - m_base, incomplete_message);
          return false;
       }
       if((m_end == ++m_position) 
          || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set))
       {
-         fail(regex_constants::error_brack, m_position - m_base);
+         fail(regex_constants::error_brack, m_position - m_base, incomplete_message);
          return false;
       }
       //
@@ -1346,14 +1391,14 @@ bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, tr
       // skip the '='
       if(m_end == ++m_position)
       {
-         fail(regex_constants::error_brack, m_position - m_base);
+         fail(regex_constants::error_brack, m_position - m_base, incomplete_message);
          return false;
       }
       const charT* name_first = m_position;
       // skip at least one character, then find the matching '=]'
       if(m_end == ++m_position)
       {
-         fail(regex_constants::error_brack, m_position - m_base);
+         fail(regex_constants::error_brack, m_position - m_base, incomplete_message);
          return false;
       }
       while((m_position != m_end) 
@@ -1362,13 +1407,13 @@ bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, tr
       const charT* name_last = m_position;
       if(m_end == m_position)
       {
-         fail(regex_constants::error_brack, m_position - m_base);
+         fail(regex_constants::error_brack, m_position - m_base, incomplete_message);
          return false;
       }
       if((m_end == ++m_position) 
          || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set))
       {
-         fail(regex_constants::error_brack, m_position - m_base);
+         fail(regex_constants::error_brack, m_position - m_base, incomplete_message);
          return false;
       }
       string_type m = this->m_traits.lookup_collatename(name_first, name_last);
@@ -1558,7 +1603,7 @@ charT basic_regex_parser<charT, traits>::unescape_character()
    charT result(0);
    if(m_position == m_end)
    {
-      fail(regex_constants::error_escape, m_position - m_base);
+      fail(regex_constants::error_escape, m_position - m_base, "Escape sequence terminated prematurely.");
       return false;
    }
    switch(this->m_traits.escape_syntax_type(*m_position))
@@ -1591,24 +1636,22 @@ charT basic_regex_parser<charT, traits>::unescape_character()
       ++m_position;
       if(m_position == m_end)
       {
-         fail(regex_constants::error_escape, m_position - m_base);
-         return result;
-      }
-      /*
-      if((*m_position < charT('@'))
-            || (*m_position > charT(125)) )
-      {
-         fail(regex_constants::error_escape, m_position - m_base);
+         // Rewind to start of escape:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
+         fail(regex_constants::error_escape, m_position - m_base, "ASCII escape sequence terminated prematurely.");
          return result;
       }
-      */
       result = static_cast<charT>(*m_position % 32);
       break;
    case regex_constants::escape_type_hex:
       ++m_position;
       if(m_position == m_end)
       {
-         fail(regex_constants::error_escape, m_position - m_base);
+         // Rewind to start of escape:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
+         fail(regex_constants::error_escape, m_position - m_base, "Hexadecimal escape sequence terminated prematurely.");
          return result;
       }
       // maybe have \x{ddd}
@@ -1617,7 +1660,10 @@ charT basic_regex_parser<charT, traits>::unescape_character()
          ++m_position;
          if(m_position == m_end)
          {
-            fail(regex_constants::error_escape, m_position - m_base);
+            // Rewind to start of escape:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
+            fail(regex_constants::error_escape, m_position - m_base, "Missing } in hexadecimal escape sequence.");
             return result;
          }
          int i = this->m_traits.toi(m_position, m_end, 16);
@@ -1626,7 +1672,10 @@ charT basic_regex_parser<charT, traits>::unescape_character()
             || ((std::numeric_limits<charT>::is_specialized) && (i > (int)(std::numeric_limits<charT>::max)()))
             || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace))
          {
-            fail(regex_constants::error_badbrace, m_position - m_base);
+            // Rewind to start of escape:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
+            fail(regex_constants::error_badbrace, m_position - m_base, "Hexadecimal escape sequence was invalid.");
             return result;
          }
          ++m_position;
@@ -1634,12 +1683,15 @@ charT basic_regex_parser<charT, traits>::unescape_character()
       }
       else
       {
-         std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(2), m_end - m_position);
+         std::ptrdiff_t len = (std::min)(static_cast<std::ptrdiff_t>(2), static_cast<std::ptrdiff_t>(m_end - m_position));
          int i = this->m_traits.toi(m_position, m_position + len, 16);
          if((i < 0)
             || !valid_value(charT(0), i))
          {
-            fail(regex_constants::error_escape, m_position - m_base);
+            // Rewind to start of escape:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
+            fail(regex_constants::error_escape, m_position - m_base, "Escape sequence did not encode a valid character.");
             return result;
          }
          result = charT(i);
@@ -1654,14 +1706,20 @@ charT basic_regex_parser<charT, traits>::unescape_character()
       int val = this->m_traits.toi(bp, bp + 1, 8);
       if(val != 0)
       {
+         // Rewind to start of escape:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
          // Oops not an octal escape after all:
-         fail(regex_constants::error_escape, m_position - m_base);
+         fail(regex_constants::error_escape, m_position - m_base, "Invalid octal escape sequence.");
          return result;
       }
       val = this->m_traits.toi(m_position, m_position + len, 8);
       if(val < 0) 
       {
-         fail(regex_constants::error_escape, m_position - m_base);
+         // Rewind to start of escape:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
+         fail(regex_constants::error_escape, m_position - m_base, "Octal escape sequence is invalid.");
          return result;
       }
       return static_cast<charT>(val);
@@ -1671,6 +1729,9 @@ charT basic_regex_parser<charT, traits>::unescape_character()
          ++m_position;
          if(m_position == m_end)
          {
+            // Rewind to start of escape:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
             fail(regex_constants::error_escape, m_position - m_base);
             return false;
          }
@@ -1683,12 +1744,18 @@ charT basic_regex_parser<charT, traits>::unescape_character()
                ++m_position;
             if(m_position == m_end)
             {
+               // Rewind to start of escape:
+               --m_position;
+               while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
                fail(regex_constants::error_escape, m_position - m_base);
                return false;
             }
             string_type s = this->m_traits.lookup_collatename(++base, m_position++);
             if(s.empty())
             {
+               // Rewind to start of escape:
+               --m_position;
+               while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
                fail(regex_constants::error_collate, m_position - m_base);
                return false;
             }
@@ -1698,6 +1765,9 @@ charT basic_regex_parser<charT, traits>::unescape_character()
             }
          }
          // fall through is a failure:
+         // Rewind to start of escape:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
          fail(regex_constants::error_escape, m_position - m_base);
          return false;
       }
@@ -1733,7 +1803,10 @@ bool basic_regex_parser<charT, traits>::parse_backref()
    }
    else
    {
-      fail(regex_constants::error_backref, m_position - m_end);
+      // Rewind to start of escape:
+      --m_position;
+      while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
+      fail(regex_constants::error_backref, m_position - m_base);
       return false;
    }
    return true;
@@ -1765,7 +1838,7 @@ bool basic_regex_parser<charT, traits>::parse_QE()
       }
       if(++m_position == m_end) // skip the escape
       {
-         fail(regex_constants::error_escape, m_position - m_base);
+         fail(regex_constants::error_escape, m_position - m_base, "Unterminated \\Q...\\E sequence.");
          return false;
       }
       // check to see if it's a \E:
@@ -1796,7 +1869,10 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
 {
    if(++m_position == m_end)
    {
-      fail(regex_constants::error_badrepeat, m_position - m_base);
+      // Rewind to start of (? sequence:
+      --m_position;
+      while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+      fail(regex_constants::error_perl_extension, m_position - m_base);
       return false;
    }
    //
@@ -1855,12 +1931,17 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
       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);
+         // Rewind to start of (? sequence:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+         fail(regex_constants::error_perl_extension, m_position - m_base, "The recursive sub-expression refers to an invalid marking group, or is unterminated.");
          return false;
       }
 insert_recursion:
       pb->index = markid = 0;
-      static_cast<re_jump*>(this->append_state(syntax_element_recurse, sizeof(re_jump)))->alt.i = v;
+      re_recurse* pr = static_cast<re_recurse*>(this->append_state(syntax_element_recurse, sizeof(re_recurse)));
+      pr->alt.i = v;
+      pr->state_id = 0;
       static_cast<re_case*>(
             this->append_state(syntax_element_toggle_case, sizeof(re_case))
             )->icase = this->flags() & regbase::icase;
@@ -1874,7 +1955,10 @@ insert_recursion:
       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);
+         // Rewind to start of (? sequence:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+         fail(regex_constants::error_perl_extension, m_position - m_base, "An invalid or unterminated recursive sub-expression.");
          return false;
       }
       v += m_mark_count;
@@ -1894,7 +1978,10 @@ insert_recursion:
       v = m_mark_count + 1 - v;
       if(v <= 0)
       {
-         fail(regex_constants::error_backref, m_position - m_base);
+         // Rewind to start of (? sequence:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+         fail(regex_constants::error_perl_extension, m_position - m_base, "An invalid or unterminated recursive sub-expression.");
          return false;
       }
       goto insert_recursion;
@@ -1917,7 +2004,10 @@ insert_recursion:
          // a lookbehind assertion:
          if(++m_position == m_end)
          {
-            fail(regex_constants::error_badrepeat, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
          regex_constants::syntax_type t = this->m_traits.syntax_type(*m_position);
@@ -1955,15 +2045,21 @@ insert_recursion:
       pb->index = markid = -4;
       if(++m_position == m_end)
       {
-         fail(regex_constants::error_badrepeat, m_position - m_base);
+         // Rewind to start of (? sequence:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+         fail(regex_constants::error_perl_extension, m_position - m_base);
          return false;
       }
-      int v = this->m_traits.toi(m_position, m_end, 10);
+      v = this->m_traits.toi(m_position, m_end, 10);
       if(*m_position == charT('R'))
       {
          if(++m_position == m_end)
          {
-            fail(regex_constants::error_badrepeat, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
          if(*m_position == charT('&'))
@@ -1973,7 +2069,10 @@ insert_recursion:
                ++m_position;
             if(m_position == m_end)
             {
-               fail(regex_constants::error_badrepeat, m_position - m_base);
+               // Rewind to start of (? sequence:
+               --m_position;
+               while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+               fail(regex_constants::error_perl_extension, m_position - m_base);
                return false;
             }
             v = -static_cast<int>(hash_value_from_capture_name(base, m_position));
@@ -1986,12 +2085,18 @@ insert_recursion:
          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);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
          if(++m_position == m_end)
          {
-            fail(regex_constants::error_badrepeat, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
       }
@@ -2002,7 +2107,10 @@ insert_recursion:
             ++m_position;
          if(m_position == m_end)
          {
-            fail(regex_constants::error_badrepeat, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
          v = static_cast<int>(hash_value_from_capture_name(base, m_position));
@@ -2010,17 +2118,26 @@ insert_recursion:
          br->index = v;
          if(((*m_position != charT('>')) && (*m_position != charT('\''))) || (++m_position == m_end))
          {
-            fail(regex_constants::error_badrepeat, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base, "Unterminated named capture.");
             return false;
          }
          if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)
          {
-            fail(regex_constants::error_badrepeat, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
          if(++m_position == m_end)
          {
-            fail(regex_constants::error_badrepeat, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
       }
@@ -2031,19 +2148,28 @@ insert_recursion:
             ++m_position, ++def;
          if((m_position == m_end) || *def)
          {
-            fail(regex_constants::error_badrepeat, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
          re_brace* br = static_cast<re_brace*>(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);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
          if(++m_position == m_end)
          {
-            fail(regex_constants::error_badrepeat, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
       }
@@ -2053,12 +2179,18 @@ insert_recursion:
          br->index = v;
          if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)
          {
-            fail(regex_constants::error_badrepeat, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
          if(++m_position == m_end)
          {
-            fail(regex_constants::error_badrepeat, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
       }
@@ -2067,25 +2199,37 @@ insert_recursion:
          // verify that we have a lookahead or lookbehind assert:
          if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_question)
          {
-            fail(regex_constants::error_badrepeat, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
          if(++m_position == m_end)
          {
-            fail(regex_constants::error_badrepeat, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
          if(this->m_traits.syntax_type(*m_position) == regex_constants::escape_type_left_word)
          {
             if(++m_position == m_end)
             {
-               fail(regex_constants::error_badrepeat, m_position - m_base);
+               // Rewind to start of (? sequence:
+               --m_position;
+               while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+               fail(regex_constants::error_perl_extension, m_position - m_base);
                return false;
             }
             if((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);
+               // Rewind to start of (? sequence:
+               --m_position;
+               while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+               fail(regex_constants::error_perl_extension, m_position - m_base);
                return false;
             }
             m_position -= 3;
@@ -2095,7 +2239,10 @@ insert_recursion:
             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_paren, m_position - m_base);
+               // Rewind to start of (? sequence:
+               --m_position;
+               while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+               fail(regex_constants::error_perl_extension, m_position - m_base);
                return false;
             }
             m_position -= 2;
@@ -2104,7 +2251,10 @@ insert_recursion:
       break;
       }
    case regex_constants::syntax_close_mark:
-      fail(regex_constants::error_badrepeat, m_position - m_base);
+      // Rewind to start of (? sequence:
+      --m_position;
+      while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+      fail(regex_constants::error_perl_extension, m_position - m_base);
       return false;
    case regex_constants::escape_type_end_buffer:
       {
@@ -2126,14 +2276,20 @@ named_capture_jump:
       const charT* base = ++m_position;
       if(m_position == m_end)
       {
-         fail(regex_constants::error_paren, m_position - m_base);
+         // Rewind to start of (? sequence:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+         fail(regex_constants::error_perl_extension, m_position - m_base);
          return false;
       }
       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);
+         // Rewind to start of (? sequence:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+         fail(regex_constants::error_perl_extension, m_position - m_base);
          return false;
       }
       this->m_pdata->set_name(base, m_position, markid);
@@ -2147,7 +2303,10 @@ named_capture_jump:
          v = 0;
          if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)
          {
-            fail(regex_constants::error_backref, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
          goto insert_recursion;
@@ -2160,7 +2319,10 @@ named_capture_jump:
             ++m_position;
          if(m_position == m_end)
          {
-            fail(regex_constants::error_backref, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
          v = static_cast<int>(hash_value_from_capture_name(base, m_position));
@@ -2171,7 +2333,10 @@ named_capture_jump:
          ++m_position;
          if(m_position == m_end)
          {
-            fail(regex_constants::error_backref, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_perl_extension, m_position - m_base);
             return false;
          }
          if(*m_position == charT('>'))
@@ -2182,7 +2347,10 @@ named_capture_jump:
                ++m_position;
             if(m_position == m_end)
             {
-               fail(regex_constants::error_backref, m_position - m_base);
+               // Rewind to start of (? sequence:
+               --m_position;
+               while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+               fail(regex_constants::error_perl_extension, m_position - m_base);
                return false;
             }
             v = static_cast<int>(hash_value_from_capture_name(base, m_position));
@@ -2195,7 +2363,13 @@ named_capture_jump:
 option_group_jump:
       regex_constants::syntax_option_type opts = parse_options();
       if(m_position == m_end)
+      {
+         // Rewind to start of (? sequence:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+         fail(regex_constants::error_perl_extension, m_position - m_base);
          return false;
+      }
       // make a note of whether we have a case change:
       m_has_case_change = ((opts & regbase::icase) != (this->flags() & regbase::icase));
       pb->index = markid = 0;
@@ -2214,7 +2388,10 @@ option_group_jump:
       }
       else
       {
-         fail(regex_constants::error_badrepeat, m_position - m_base);
+         // Rewind to start of (? sequence:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+         fail(regex_constants::error_perl_extension, m_position - m_base);
          return false;
       }
 
@@ -2236,12 +2413,21 @@ option_group_jump:
    // Unwind alternatives:
    //
    if(0 == unwind_alts(last_paren_start))
+   {
+      // Rewind to start of (? sequence:
+      --m_position;
+      while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+      fail(regex_constants::error_perl_extension, m_position - m_base, "Invalid alternation operators within (?...) block.");
       return false;
+   }
    //
    // we either have a ')' or we have run out of characters prematurely:
    //
    if(m_position == m_end)
    {
+      // Rewind to start of (? sequence:
+      --m_position;
+      while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
       this->fail(regex_constants::error_paren, ::boost::re_detail::distance(m_base, m_end));
       return false;
    }
@@ -2272,7 +2458,10 @@ option_group_jump:
       if(this->m_last_state == jmp)
       {
          // Oops... we didn't have anything inside the assertion:
-         fail(regex_constants::error_empty, m_position - m_base);
+         // Rewind to start of (? sequence:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+         fail(regex_constants::error_perl_extension, m_position - m_base, "Invalid or empty zero width assertion.");
          return false;
       }
    }
@@ -2292,7 +2481,10 @@ option_group_jump:
       else if(this->getaddress(static_cast<re_alt*>(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);
+         // Rewind to start of (? sequence:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+         fail(regex_constants::error_bad_pattern, m_position - m_base, "More than one alternation operator | was encountered inside a conditional expression.");
          return false;
       }
       else
@@ -2301,7 +2493,10 @@ option_group_jump:
          b = this->getaddress(b->next.i, b);
          if((b->type == syntax_element_assert_backref) && (static_cast<re_brace*>(b)->index == 9999))
          {
-            fail(regex_constants::error_bad_pattern, m_position - m_base);
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+            fail(regex_constants::error_bad_pattern, m_position - m_base, "Alternation operators are not allowed inside a DEFINE block.");
             return false;
          }
       }
@@ -2311,7 +2506,10 @@ option_group_jump:
       if((b->type != syntax_element_assert_backref)
          && (b->type != syntax_element_startmark))
       {
-         fail(regex_constants::error_badrepeat, m_position - m_base);
+         // Rewind to start of (? sequence:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
+         fail(regex_constants::error_badrepeat, m_position - m_base, "A repetition operator cannot be applied to a zero-width assertion.");
          return false;
       }
    }
@@ -2366,6 +2564,9 @@ bool basic_regex_parser<charT, traits>::add_emacs_code(bool negate)
    //
    if(++m_position == m_end)
    {
+      // Rewind to start of sequence:
+      --m_position;
+      while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape) --m_position;
       fail(regex_constants::error_escape, m_position - m_base);
       return false;
    }
@@ -2466,6 +2667,9 @@ regex_constants::syntax_option_type basic_regex_parser<charT, traits>::parse_opt
       }
       if(++m_position == m_end)
       {
+         // Rewind to start of (? sequence:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
          fail(regex_constants::error_paren, m_position - m_base);
          return false;
       }
@@ -2476,6 +2680,9 @@ regex_constants::syntax_option_type basic_regex_parser<charT, traits>::parse_opt
    {
       if(++m_position == m_end)
       {
+         // Rewind to start of (? sequence:
+         --m_position;
+         while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
          fail(regex_constants::error_paren, m_position - m_base);
          return false;
       }
@@ -2502,6 +2709,9 @@ regex_constants::syntax_option_type basic_regex_parser<charT, traits>::parse_opt
          }
          if(++m_position == m_end)
          {
+            // Rewind to start of (? sequence:
+            --m_position;
+            while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
             fail(regex_constants::error_paren, m_position - m_base);
             return false;
          }
@@ -2528,7 +2738,7 @@ bool basic_regex_parser<charT, traits>::unwind_alts(std::ptrdiff_t last_paren_st
         )
       )
    {
-      fail(regex_constants::error_empty, this->m_position - this->m_base);
+      fail(regex_constants::error_empty, this->m_position - this->m_base, "Can't terminate a sub-expression with an alternation operator |.");
       return false;
    }
    // 
index 7ce3ed300eba55bf0104719f48f679fdaf8ea323..bb40aa1ed879eddde63b1975b6895afe5f2dc53c 100644 (file)
@@ -187,6 +187,7 @@ struct cpp_regex_traits_base
 #ifndef BOOST_NO_STD_MESSAGES
          if(m_pmessages == b.m_pmessages)
          {
+            return m_pcollate < b.m_pcollate;
          }
          return m_pmessages < b.m_pmessages;
 #else
@@ -212,7 +213,7 @@ std::locale cpp_regex_traits_base<charT>::imbue(const std::locale& l)
    m_locale = l;
    m_pctype = &BOOST_USE_FACET(std::ctype<charT>, l);
 #ifndef BOOST_NO_STD_MESSAGES
-   m_pmessages = &BOOST_USE_FACET(std::messages<charT>, l);
+   m_pmessages = BOOST_HAS_FACET(std::messages<charT>, l) ? &BOOST_USE_FACET(std::messages<charT>, l) : 0;
 #endif
    m_pcollate = &BOOST_USE_FACET(std::collate<charT>, l);
    return result;
@@ -276,7 +277,7 @@ void cpp_regex_traits_char_layer<charT>::init()
    typename std::messages<charT>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
 #endif
    std::string cat_name(cpp_regex_traits<charT>::get_catalog_name());
-   if(cat_name.size())
+   if(cat_name.size() && (this->m_pmessages != 0))
    {
       cat = this->m_pmessages->open(
          cat_name, 
@@ -309,7 +310,8 @@ void cpp_regex_traits_char_layer<charT>::init()
       }
       catch(...)
       {
-         this->m_pmessages->close(cat);
+         if(this->m_pmessages)
+            this->m_pmessages->close(cat);
          throw;
       }
 #endif
@@ -653,7 +655,7 @@ void cpp_regex_traits_implementation<charT>::init()
    typename std::messages<charT>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
 #endif
    std::string cat_name(cpp_regex_traits<charT>::get_catalog_name());
-   if(cat_name.size())
+   if(cat_name.size() && (this->m_pmessages != 0))
    {
       cat = this->m_pmessages->open(
          cat_name, 
@@ -716,7 +718,7 @@ void cpp_regex_traits_implementation<charT>::init()
          cpp_regex_traits_implementation<charT>::mask_unicode,
       };
 #else
-      static const char_class_type masks[14] = 
+      static const char_class_type masks[16] = 
       {
          ::boost::re_detail::char_class_alnum,
          ::boost::re_detail::char_class_alpha,
@@ -837,8 +839,8 @@ bool cpp_regex_traits_implementation<charT>::isctype(const charT c, char_class_t
       || ((mask & ::boost::re_detail::char_class_blank) && (m_pctype->is(std::ctype<charT>::space, c)) && !::boost::re_detail::is_separator(c))
       || ((mask & ::boost::re_detail::char_class_word) && (c == '_'))
       || ((mask & ::boost::re_detail::char_class_unicode) && ::boost::re_detail::is_extended(c))
-      || ((mask & ::boost::re_detail::char_class_vertical) && (is_separator(c) || (c == '\v')))
-      || ((mask & ::boost::re_detail::char_class_horizontal) && m_pctype->is(std::ctype<charT>::space, c) && !(is_separator(c) || (c == '\v')));
+      || ((mask & ::boost::re_detail::char_class_vertical_space) && (is_separator(c) || (c == '\v')))
+      || ((mask & ::boost::re_detail::char_class_horizontal_space) && m_pctype->is(std::ctype<charT>::space, c) && !(is_separator(c) || (c == '\v')));
 }
 #endif
 
index cafe396cd96373dff169752d5f440656c0faaaff..7b3df1e510830b16eedeec3ea8a9822697758c27 100644 (file)
@@ -124,11 +124,11 @@ typedef enum{
    REG_STARTEND =  00004
 } reg_exec_flags;
 
-//
-// POSIX error codes:
-//
+/*
+ * POSIX error codes:
+ */
 typedef unsigned reg_error_t;
-typedef reg_error_t reg_errcode_t;  // backwards compatibility
+typedef reg_error_t reg_errcode_t;  /* backwards compatibility */
 
 static const reg_error_t REG_NOERROR = 0;   /* Success.  */
 static const reg_error_t REG_NOMATCH = 1;   /* Didn't find a match (for regexec).  */
@@ -154,8 +154,9 @@ static const reg_error_t REG_EMPTY = 17;    /* empty expression */
 static const reg_error_t REG_E_MEMORY = 15; /* = REG_ESIZE : out of memory */
 static const reg_error_t REG_ECOMPLEXITY = 18; /* complexity too high */
 static const reg_error_t REG_ESTACK = 19;   /* out of stack space */
-static const reg_error_t REG_E_UNKNOWN = 20; /* unknown error */
-static const reg_error_t REG_ENOSYS = 20;   /* = REG_E_UNKNOWN : Reserved. */
+static const reg_error_t REG_E_PERL = 20;   /* Perl (?...) error */
+static const reg_error_t REG_E_UNKNOWN = 21; /* unknown error */
+static const reg_error_t REG_ENOSYS = 21;   /* = REG_E_UNKNOWN : Reserved. */
 
 BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompA(regex_tA*, const char*, int);
 BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int, const regex_tA*, char*, regsize_t);
@@ -195,14 +196,14 @@ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW*);
 #endif
 
 #ifdef __cplusplus
-} // extern "C"
-} // namespace
+} /* extern "C" */
+} /* namespace */
 #endif
 
-//
-// C++ high level wrapper goes here:
-//
 #if defined(__cplusplus)
+/*
+ * C++ high level wrapper goes here:
+ */
 #include <string>
 #include <vector>
 namespace boost{
@@ -228,7 +229,7 @@ struct pred2;
 struct pred3;
 struct pred4;
 
-}  // namespace re_detail
+}  /* namespace re_detail */
 
 #if (defined(BOOST_MSVC) || defined(__BORLANDC__)) && !defined(BOOST_DISABLE_WIN32)
 typedef bool (__cdecl *GrepCallback)(const RegEx& expression);
@@ -257,9 +258,9 @@ public:
    unsigned int SetExpression(const std::string& s, bool icase = false){ return SetExpression(s.c_str(), icase); }
    std::string Expression()const;
    unsigned int error_code()const;
-   //
-   // now matching operators:
-   //
+   /*
+    * now matching operators:
+    */
    bool Match(const char* p, match_flag_type flags = match_default);
    bool Match(const std::string& s, match_flag_type flags = match_default) { return Match(s.c_str(), flags); }
    bool Search(const char* p, match_flag_type flags = match_default);
@@ -283,9 +284,9 @@ public:
                        bool copy = true, match_flag_type flags = match_default);
 
    std::size_t Split(std::vector<std::string>& v, std::string& s, match_flag_type flags = match_default, unsigned max_count = ~0);
-   //
-   // now operators for returning what matched in more detail:
-   //
+   /*
+    * now operators for returning what matched in more detail:
+    */
    std::size_t Position(int i = 0)const;
    std::size_t Length(int i = 0)const;
    bool Matched(int i = 0)const;
@@ -312,11 +313,11 @@ public:
 #pragma warning(pop)
 #endif
 
-} // namespace boost
+} /* namespace boost */
 
-#endif
+#endif /* __cplusplus */
 
-#endif // include guard
+#endif /* include guard */
 
 
 
index b6633a0092f282209d16efca600dc7b3cfd278ce..afcc71e3d84a0758a5dea8e74a1066f2dce29bef 100644 (file)
@@ -28,8 +28,8 @@ namespace regex_constants{
 
 enum error_type{
 
-   error_ok = 0,         // not used
-   error_no_match = 1,   // not used
+   error_ok = 0,         /* not used */
+   error_no_match = 1,   /* not used */
    error_bad_pattern = 2,
    error_collate = 3,
    error_ctype = 4,
@@ -42,17 +42,18 @@ enum error_type{
    error_range = 11,
    error_space = 12,
    error_badrepeat = 13,
-   error_end = 14,    // not used
+   error_end = 14,    /* not used */
    error_size = 15,
-   error_right_paren = 16,  // not used
+   error_right_paren = 16,  /* not used */
    error_empty = 17,
    error_complexity = 18,
    error_stack = 19,
-   error_unknown = 20
+   error_perl_extension = 20,
+   error_unknown = 21
 };
 
 }
 }
-#endif // __cplusplus
+#endif /* __cplusplus */
 
 #endif
index 9585aca8b23bdb641ef9b32c915c983c90071b5a..26bde9a51b627eebd0947e50b7fbfd8f24c1f735 100644 (file)
@@ -31,43 +31,43 @@ namespace boost{
 typedef enum _match_flags
 {
    match_default = 0,
-   match_not_bol = 1,                                // first is not start of line
-   match_not_eol = match_not_bol << 1,               // last is not end of line
-   match_not_bob = match_not_eol << 1,               // first is not start of buffer
-   match_not_eob = match_not_bob << 1,               // last is not end of buffer
-   match_not_bow = match_not_eob << 1,               // first is not start of word
-   match_not_eow = match_not_bow << 1,               // last is not end of word
-   match_not_dot_newline = match_not_eow << 1,       // \n is not matched by '.'
-   match_not_dot_null = match_not_dot_newline << 1,  // '\0' is not matched by '.'
-   match_prev_avail = match_not_dot_null << 1,       // *--first is a valid expression
-   match_init = match_prev_avail << 1,               // internal use
-   match_any = match_init << 1,                      // don't care what we match
-   match_not_null = match_any << 1,                  // string can't be null
-   match_continuous = match_not_null << 1,           // each grep match must continue from
-                                                     // uninterupted from the previous one
-   match_partial = match_continuous << 1,            // find partial matches
+   match_not_bol = 1,                                /* first is not start of line */
+   match_not_eol = match_not_bol << 1,               /* last is not end of line */
+   match_not_bob = match_not_eol << 1,               /* first is not start of buffer */
+   match_not_eob = match_not_bob << 1,               /* last is not end of buffer */
+   match_not_bow = match_not_eob << 1,               /* first is not start of word */
+   match_not_eow = match_not_bow << 1,               /* last is not end of word */
+   match_not_dot_newline = match_not_eow << 1,       /* \n is not matched by '.' */
+   match_not_dot_null = match_not_dot_newline << 1,  /* '\0' is not matched by '.' */
+   match_prev_avail = match_not_dot_null << 1,       /* *--first is a valid expression */
+   match_init = match_prev_avail << 1,               /* internal use */
+   match_any = match_init << 1,                      /* don't care what we match */
+   match_not_null = match_any << 1,                  /* string can't be null */
+   match_continuous = match_not_null << 1,           /* each grep match must continue from */
+                                                     /* uninterupted from the previous one */
+   match_partial = match_continuous << 1,            /* find partial matches */
    
-   match_stop = match_partial << 1,                  // stop after first match (grep) V3 only
-   match_not_initial_null = match_stop,              // don't match initial null, V4 only
-   match_all = match_stop << 1,                      // must find the whole of input even if match_any is set
-   match_perl = match_all << 1,                      // Use perl matching rules
-   match_posix = match_perl << 1,                    // Use POSIX matching rules
-   match_nosubs = match_posix << 1,                  // don't trap marked subs
-   match_extra = match_nosubs << 1,                  // include full capture information for repeated captures
-   match_single_line = match_extra << 1,             // treat text as single line and ignor any \n's when matching ^ and $.
-   match_unused1 = match_single_line << 1,           // unused
-   match_unused2 = match_unused1 << 1,               // unused
-   match_unused3 = match_unused2 << 1,               // unused
+   match_stop = match_partial << 1,                  /* stop after first match (grep) V3 only */
+   match_not_initial_null = match_stop,              /* don't match initial null, V4 only */
+   match_all = match_stop << 1,                      /* must find the whole of input even if match_any is set */
+   match_perl = match_all << 1,                      /* Use perl matching rules */
+   match_posix = match_perl << 1,                    /* Use POSIX matching rules */
+   match_nosubs = match_posix << 1,                  /* don't trap marked subs */
+   match_extra = match_nosubs << 1,                  /* include full capture information for repeated captures */
+   match_single_line = match_extra << 1,             /* treat text as single line and ignor any \n's when matching ^ and $. */
+   match_unused1 = match_single_line << 1,           /* unused */
+   match_unused2 = match_unused1 << 1,               /* unused */
+   match_unused3 = match_unused2 << 1,               /* unused */
    match_max = match_unused3,
 
-   format_perl = 0,                                  // perl style replacement
-   format_default = 0,                               // ditto.
-   format_sed = match_max << 1,                      // sed style replacement.
-   format_all = format_sed << 1,                     // enable all extentions to sytax.
-   format_no_copy = format_all << 1,                 // don't copy non-matching segments.
-   format_first_only = format_no_copy << 1,          // Only replace first occurance.
-   format_is_if = format_first_only << 1,            // internal use only.
-   format_literal = format_is_if << 1                // treat string as a literal
+   format_perl = 0,                                  /* perl style replacement */
+   format_default = 0,                               /* ditto. */
+   format_sed = match_max << 1,                      /* sed style replacement. */
+   format_all = format_sed << 1,                     /* enable all extentions to sytax. */
+   format_no_copy = format_all << 1,                 /* don't copy non-matching segments. */
+   format_first_only = format_no_copy << 1,          /* Only replace first occurance. */
+   format_is_if = format_first_only << 1,            /* internal use only. */
+   format_literal = format_is_if << 1                /* treat string as a literal */
 
 } match_flags;
 
@@ -96,10 +96,10 @@ inline match_flags& operator^=(match_flags& m1, match_flags m2)
 #endif
 
 #ifdef __cplusplus
-} // namespace regex_constants
-//
-// import names into boost for backwards compatiblity:
-//
+} /* namespace regex_constants */
+/*
+ * import names into boost for backwards compatiblity:
+ */
 using regex_constants::match_flag_type;
 using regex_constants::match_default;
 using regex_constants::match_not_bol;
@@ -111,28 +111,28 @@ using regex_constants::match_not_eow;
 using regex_constants::match_not_dot_newline;
 using regex_constants::match_not_dot_null;
 using regex_constants::match_prev_avail;
-//using regex_constants::match_init;
+/* using regex_constants::match_init; */
 using regex_constants::match_any;
 using regex_constants::match_not_null;
 using regex_constants::match_continuous;
 using regex_constants::match_partial;
-//using regex_constants::match_stop;
+/*using regex_constants::match_stop; */
 using regex_constants::match_all;
 using regex_constants::match_perl;
 using regex_constants::match_posix;
 using regex_constants::match_nosubs;
 using regex_constants::match_extra;
 using regex_constants::match_single_line;
-//using regex_constants::match_max;
+/*using regex_constants::match_max; */
 using regex_constants::format_all;
 using regex_constants::format_sed;
 using regex_constants::format_perl;
 using regex_constants::format_default;
 using regex_constants::format_no_copy;
 using regex_constants::format_first_only;
-//using regex_constants::format_is_if;
+/*using regex_constants::format_is_if;*/
 
-} // namespace boost
-#endif // __cplusplus
-#endif // include guard
+} /* namespace boost */
+#endif /* __cplusplus */
+#endif /* include guard */
 
index 09dd31f009ccb286055a1712748d34793d49cb4a..cd6b9eb5567d24735138cef5241a61a9bca71660 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- * Copyright (c) 1998-2002
+ * Copyright (c) 1998-2009
  * John Maddock
  *
  * Use, modification and distribution are subject to the 
@@ -74,16 +74,30 @@ public:
    // construct/copy/destroy:
    explicit match_results(const Allocator& a = Allocator())
 #ifndef BOOST_NO_STD_ALLOCATOR
-      : m_subs(a), m_base(), m_last_closed_paren(0) {}
+      : m_subs(a), m_base(), m_last_closed_paren(0), m_is_singular(true) {}
 #else
-      : m_subs(), m_base(), m_last_closed_paren(0) { (void)a; }
+      : m_subs(), m_base(), m_last_closed_paren(0), m_is_singular(true) { (void)a; }
 #endif
    match_results(const match_results& m)
-      : m_subs(m.m_subs), m_base(m.m_base) {}
+      : m_subs(m.m_subs), m_named_subs(m.m_named_subs), m_last_closed_paren(m.m_last_closed_paren), m_is_singular(m.m_is_singular) 
+   {
+      if(!m_is_singular)
+      {
+         m_base = m.m_base;
+         m_null = m.m_null;
+      }
+   }
    match_results& operator=(const match_results& m)
    {
       m_subs = m.m_subs;
-      m_base = m.m_base;
+      m_named_subs = m.m_named_subs;
+      m_last_closed_paren = m.m_last_closed_paren;
+      m_is_singular = m.m_is_singular;
+      if(!m_is_singular)
+      {
+         m_base = m.m_base;
+         m_null = m.m_null;
+      }
       return *this;
    }
    ~match_results(){}
@@ -98,6 +112,8 @@ public:
    // element access:
    difference_type length(int sub = 0) const
    {
+      if(m_is_singular)
+         raise_logic_error();
       sub += 2;
       if((sub < (int)m_subs.size()) && (sub > 0))
          return m_subs[sub].length();
@@ -105,16 +121,20 @@ public:
    }
    difference_type length(const char_type* sub) const
    {
-      const char_type* end = sub;
-      while(*end) ++end;
-      return length(named_subexpression_index(sub, end));
+      if(m_is_singular)
+         raise_logic_error();
+      const char_type* sub_end = sub;
+      while(*sub_end) ++sub_end;
+      return length(named_subexpression_index(sub, sub_end));
    }
    template <class charT>
    difference_type length(const charT* sub) const
    {
-      const charT* end = sub;
-      while(*end) ++end;
-      return length(named_subexpression_index(sub, end));
+      if(m_is_singular)
+         raise_logic_error();
+      const charT* sub_end = sub;
+      while(*sub_end) ++sub_end;
+      return length(named_subexpression_index(sub, sub_end));
    }
    template <class charT, class Traits, class A>
    difference_type length(const std::basic_string<charT, Traits, A>& sub) const
@@ -123,6 +143,8 @@ public:
    }
    difference_type position(size_type sub = 0) const
    {
+      if(m_is_singular)
+         raise_logic_error();
       sub += 2;
       if(sub < m_subs.size())
       {
@@ -136,16 +158,16 @@ public:
    }
    difference_type position(const char_type* sub) const
    {
-      const char_type* end = sub;
-      while(*end) ++end;
-      return position(named_subexpression_index(sub, end));
+      const char_type* sub_end = sub;
+      while(*sub_end) ++sub_end;
+      return position(named_subexpression_index(sub, sub_end));
    }
    template <class charT>
    difference_type position(const charT* sub) const
    {
-      const charT* end = sub;
-      while(*end) ++end;
-      return position(named_subexpression_index(sub, end));
+      const charT* sub_end = sub;
+      while(*sub_end) ++sub_end;
+      return position(named_subexpression_index(sub, sub_end));
    }
    template <class charT, class Traits, class A>
    difference_type position(const std::basic_string<charT, Traits, A>& sub) const
@@ -154,6 +176,8 @@ public:
    }
    string_type str(int sub = 0) const
    {
+      if(m_is_singular)
+         raise_logic_error();
       sub += 2;
       string_type result;
       if(sub < (int)m_subs.size() && (sub > 0))
@@ -187,6 +211,8 @@ public:
    }
    const_reference operator[](int sub) const
    {
+      if(m_is_singular && m_subs.empty())
+         raise_logic_error();
       sub += 2;
       if(sub < (int)m_subs.size() && (sub >= 0))
       {
@@ -199,6 +225,8 @@ public:
    //
    const_reference named_subexpression(const char_type* i, const char_type* j) const
    {
+      if(m_is_singular)
+         raise_logic_error();
       int index = m_named_subs->get_id(i, j);
       return index > 0 ? (*this)[index] : m_null;
    }
@@ -215,6 +243,8 @@ public:
    }
    int named_subexpression_index(const char_type* i, const char_type* j) const
    {
+      if(m_is_singular)
+         raise_logic_error();
       int index = m_named_subs->get_id(i, j);
       return index > 0 ? index : -20;
    }
@@ -266,11 +296,15 @@ public:
 
    const_reference prefix() const
    {
+      if(m_is_singular)
+         raise_logic_error();
       return (*this)[-1];
    }
 
    const_reference suffix() const
    {
+      if(m_is_singular)
+         raise_logic_error();
       return (*this)[-2];
    }
    const_iterator begin() const
@@ -282,44 +316,67 @@ public:
       return m_subs.end();
    }
    // format:
-   template <class OutputIterator>
+   template <class OutputIterator, class Functor>
    OutputIterator format(OutputIterator out,
-                         const string_type& fmt,
+                         Functor fmt,
                          match_flag_type flags = format_default) const
    {
-      re_detail::trivial_format_traits<char_type> traits;
-      return re_detail::regex_format_imp(out, *this, fmt.data(), fmt.data() + fmt.size(), flags, traits);
+      if(m_is_singular)
+         raise_logic_error();
+      typedef typename re_detail::compute_functor_type<Functor, match_results<BidiIterator, Allocator>, OutputIterator>::type F;
+      F func(fmt);
+      return func(*this, out, flags);
    }
-   string_type format(const string_type& fmt,
-                      match_flag_type flags = format_default) const
+   template <class Functor>
+   string_type format(Functor fmt, match_flag_type flags = format_default) const
    {
-      string_type result;
-      re_detail::string_out_iterator<string_type> i(result);
-      re_detail::trivial_format_traits<char_type> traits;
-      re_detail::regex_format_imp(i, *this, fmt.data(), fmt.data() + fmt.size(), flags, traits);
+      if(m_is_singular)
+         raise_logic_error();
+      std::basic_string<char_type> result;
+      re_detail::string_out_iterator<std::basic_string<char_type> > i(result);
+
+      typedef typename re_detail::compute_functor_type<Functor, match_results<BidiIterator, Allocator>, re_detail::string_out_iterator<std::basic_string<char_type> > >::type F;
+      F func(fmt);
+
+      func(*this, i, flags);
       return result;
    }
    // format with locale:
-   template <class OutputIterator, class RegexT>
+   template <class OutputIterator, class Functor, class RegexT>
    OutputIterator format(OutputIterator out,
-                         const string_type& fmt,
+                         Functor fmt,
                          match_flag_type flags,
                          const RegexT& re) const
    {
-      return ::boost::re_detail::regex_format_imp(out, *this, fmt.data(), fmt.data() + fmt.size(), flags, re.get_traits());
+      if(m_is_singular)
+         raise_logic_error();
+      typedef ::boost::regex_traits_wrapper<typename RegexT::traits_type> traits_type;
+      typedef typename re_detail::compute_functor_type<Functor, match_results<BidiIterator, Allocator>, OutputIterator, traits_type>::type F;
+      F func(fmt);
+      return func(*this, out, flags, re.get_traits());
    }
-   template <class RegexT>
-   string_type format(const string_type& fmt,
+   template <class RegexT, class Functor>
+   string_type format(Functor fmt,
                       match_flag_type flags,
                       const RegexT& re) const
    {
-      string_type result;
-      re_detail::string_out_iterator<string_type> i(result);
-      ::boost::re_detail::regex_format_imp(i, *this, fmt.data(), fmt.data() + fmt.size(), flags, re.get_traits());
+      if(m_is_singular)
+         raise_logic_error();
+      typedef ::boost::regex_traits_wrapper<typename RegexT::traits_type> traits_type;
+      std::basic_string<char_type> result;
+      re_detail::string_out_iterator<std::basic_string<char_type> > i(result);
+
+      typedef typename re_detail::compute_functor_type<Functor, match_results<BidiIterator, Allocator>, re_detail::string_out_iterator<std::basic_string<char_type> >, traits_type >::type F;
+      F func(fmt);
+
+      func(*this, i, flags, re.get_traits());
       return result;
    }
+
    const_reference get_last_closed_paren()const
    {
+      if(m_is_singular)
+         raise_logic_error();
       return m_last_closed_paren == 0 ? m_null : (*this)[m_last_closed_paren];
    }
 
@@ -334,11 +391,39 @@ public:
    void swap(match_results& that)
    {
       std::swap(m_subs, that.m_subs);
-      std::swap(m_base, that.m_base);
+      std::swap(m_named_subs, that.m_named_subs);
+      std::swap(m_last_closed_paren, that.m_last_closed_paren);
+      std::swap(m_is_singular, that.m_is_singular);
+      if(m_is_singular)
+      {
+         if(!that.m_is_singular)
+         {
+            m_base = that.m_base;
+            m_null = that.m_null;
+         }
+      }
+      else if(that.m_is_singular)
+      {
+         that.m_base = m_base;
+         that.m_null = m_null;
+      }
+      else
+      {
+         std::swap(m_base, that.m_base);
+         std::swap(m_null, that.m_null);
+      }
    }
    bool operator==(const match_results& that)const
    {
-      return (m_subs == that.m_subs) && (m_base == that.m_base);
+      if(m_is_singular)
+      {
+         return that.m_is_singular;
+      }
+      else if(that.m_is_singular)
+      {
+         return false;
+      }
+      return (m_subs == that.m_subs) && (m_base == that.m_base) && (m_last_closed_paren == that.m_last_closed_paren);
    }
    bool operator!=(const match_results& that)const
    { return !(*this == that); }
@@ -348,6 +433,8 @@ public:
 
    const capture_sequence_type& captures(int i)const
    {
+      if(m_is_singular)
+         raise_logic_error();
       return (*this)[i].captures();
    }
 #endif
@@ -364,6 +451,7 @@ public:
       m_null.first = i;
       m_null.second = i;
       m_null.matched = false;
+      m_is_singular = false;
    }
 
    void BOOST_REGEX_CALL set_second(BidiIterator i, size_type pos, bool m = true, bool escape_k = false)
@@ -381,6 +469,7 @@ public:
          m_null.first = i;
          m_null.second = i;
          m_null.matched = false;
+         m_is_singular = false;
       }
    }
    void BOOST_REGEX_CALL set_size(size_type n, BidiIterator i, BidiIterator j)
@@ -411,6 +500,7 @@ public:
    }
    void BOOST_REGEX_CALL set_first(BidiIterator i)
    {
+      BOOST_ASSERT(m_subs.size() > 2);
       // set up prefix:
       m_subs[1].second = i;
       m_subs[1].matched = (m_subs[1].first != i);
@@ -446,16 +536,32 @@ public:
    }
 
 private:
-   vector_type            m_subs; // subexpressions
-   BidiIterator   m_base; // where the search started from
-   sub_match<BidiIterator> m_null; // a null match
-   boost::shared_ptr<named_sub_type> m_named_subs;
-   int m_last_closed_paren;
+   //
+   // Error handler called when an uninitialized match_results is accessed:
+   //
+   static void raise_logic_error()
+   {
+      std::logic_error e("Attempt to access an uninitialzed boost::match_results<> class.");
+      boost::throw_exception(e);
+   }
+
+
+   vector_type            m_subs;                      // subexpressions
+   BidiIterator   m_base;                              // where the search started from
+   sub_match<BidiIterator> m_null;                     // a null match
+   boost::shared_ptr<named_sub_type> m_named_subs;     // Shared copy of named subs in the regex object
+   int m_last_closed_paren;                            // Last ) to be seen - used for formatting
+   bool m_is_singular;                                 // True if our stored iterators are singular
 };
 
 template <class BidiIterator, class Allocator>
 void BOOST_REGEX_CALL match_results<BidiIterator, Allocator>::maybe_assign(const match_results<BidiIterator, Allocator>& m)
 {
+   if(m_is_singular)
+   {
+      *this = m;
+      return;
+   }
    const_iterator p1, p2;
    p1 = begin();
    p2 = m.begin();
index 726c2881e5b17f705910c0ee805ab317ff12858a..52e0bcecb54ee4a1699867146191c395648c9076 100644 (file)
@@ -61,7 +61,7 @@ inline bool can_start(unsigned short c, const unsigned char* map, unsigned char
 {
    return ((c >= (1 << CHAR_BIT)) ? true : map[c] & mask);
 }
-#if !defined(__hpux) // WCHAR_MIN not usable in pp-directives.
+#if !defined(__hpux) && !defined(__WINSCW__)// WCHAR_MIN not usable in pp-directives.
 #if defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
 inline bool can_start(wchar_t c, const unsigned char* map, unsigned char mask)
 {
@@ -277,10 +277,15 @@ public:
       else
       {
          repeater_count* p = next;
-         while(p->state_id != state_id)
+         while(p && (p->state_id != state_id))
             p = p->next;
-         count = p->count;
-         start_pos = p->start_pos;
+         if(p)
+         {
+            count = p->count;
+            start_pos = p->start_pos;
+         }
+         else
+            count = 0;
       }
    }
    ~repeater_count()
index 2ce7ebe03439846767988a46551ed5431c879e9a..0fcd45482a073fbafdb06f440f6f173ec9a953e3 100644 (file)
@@ -188,7 +188,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_all_states()
          if(!(this->*proc)())
          {
             if(state_count > max_state_count)
-               raise_error(traits_inst, regex_constants::error_space);
+               raise_error(traits_inst, regex_constants::error_complexity);
             if((m_match_flags & match_partial) && (position == last) && (position != search_base))
                m_has_partial_match = true;
             bool successful_unwind = unwind(false);
@@ -219,7 +219,7 @@ void perl_matcher<BidiIterator, Allocator, traits>::extend_stack()
       m_backup_state = block;
    }
    else
-      raise_error(traits_inst, regex_constants::error_size);
+      raise_error(traits_inst, regex_constants::error_stack);
 }
 
 template <class BidiIterator, class Allocator, class traits>
@@ -904,10 +904,15 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_recursion()
    }
    recursion_stack[recursion_stack_position].preturn_address = pstate->next.p;
    recursion_stack[recursion_stack_position].results = *m_presult;
+   if(static_cast<const re_recurse*>(pstate)->state_id > 0)
+   {
+      push_repeater_count(static_cast<const re_recurse*>(pstate)->state_id, &next_count);
+   }
    pstate = static_cast<const re_jump*>(pstate)->alt.p;
    recursion_stack[recursion_stack_position].id = static_cast<const re_brace*>(pstate)->index;
    ++recursion_stack_position;
    //BOOST_ASSERT(recursion_stack[recursion_stack_position-1].id);
+
    return true;
 }
 
index 48f08b7b8dea3f1776930494303495615a9d118b..d0de8025ee66c78789f2c5627a03ce62462711dc 100644 (file)
@@ -99,7 +99,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_all_states()
    };
 
    if(state_count > max_state_count)
-      raise_error(traits_inst, regex_constants::error_space);
+      raise_error(traits_inst, regex_constants::error_complexity);
    while(pstate)
    {
       matcher_proc_type proc = s_match_vtable[pstate->type];
index 4e95112f908b97747ed8b359d12b56d2850da3df..0ca9baa7aed0d3f2ca9ead08ef07e4e0892dd727 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *
- * Copyright (c) 1998-2002
- * John Maddock
+ * Copyright (c) 1998-2009 John Maddock
+ * Copyright 2008 Eric Niebler. 
  *
  * Use, modification and distribution are subject to the 
  * Boost Software License, Version 1.0. (See accompanying file 
 #ifndef BOOST_REGEX_FORMAT_HPP
 #define BOOST_REGEX_FORMAT_HPP
 
+#include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/is_function.hpp>
+#include <boost/type_traits/is_class.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/type_traits/remove_pointer.hpp>
+#include <boost/type_traits/remove_cv.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/not.hpp>
+#ifndef BOOST_NO_SFINAE
+#include <boost/mpl/has_xxx.hpp>
+#endif
 
 namespace boost{
 
@@ -76,15 +89,15 @@ struct trivial_format_traits
    }
 };
 
-template <class OutputIterator, class Results, class traits>
+template <class OutputIterator, class Results, class traits, class ForwardIter>
 class basic_regex_formatter
 {
 public:
    typedef typename traits::char_type char_type;
    basic_regex_formatter(OutputIterator o, const Results& r, const traits& t)
       : m_traits(t), m_results(r), m_out(o), m_state(output_copy), m_restore_state(output_copy), m_have_conditional(false) {}
-   OutputIterator format(const char_type* p1, const char_type* p2, match_flag_type f);
-   OutputIterator format(const char_type* p1, match_flag_type f)
+   OutputIterator format(ForwardIter p1, ForwardIter p2, match_flag_type f);
+   OutputIterator format(ForwardIter p1, match_flag_type f)
    {
       return format(p1, p1 + m_traits.length(p1), f);
    }
@@ -109,22 +122,75 @@ private:
    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.
-   OutputIterator m_out;         // where to send output.
-   const char_type* m_position;  // format string, current position
-   const char_type* m_end;       // format string end
-   match_flag_type m_flags;      // format flags to use
-   output_state    m_state;      // what to do with the next character
-   output_state    m_restore_state;  // what state to restore to.
-   bool            m_have_conditional; // we are parsing a conditional
+   inline typename Results::value_type const& get_named_sub(ForwardIter i, ForwardIter j, const mpl::false_&)
+   {
+      std::vector<char_type> v(i, j);
+      return (i != j) ? this->m_results.named_subexpression(&v[0], &v[0] + v.size())
+         : this->m_results.named_subexpression(static_cast<const char_type*>(0), static_cast<const char_type*>(0));
+   }
+   inline typename Results::value_type const& get_named_sub(ForwardIter i, ForwardIter j, const mpl::true_&)
+   {
+      return this->m_results.named_subexpression(i, j);
+   }
+   inline typename Results::value_type const& get_named_sub(ForwardIter i, ForwardIter j)
+   {
+      typedef typename boost::is_convertible<ForwardIter, const char_type*>::type tag_type;
+      return get_named_sub(i, j, tag_type());
+   }
+   inline int get_named_sub_index(ForwardIter i, ForwardIter j, const mpl::false_&)
+   {
+      std::vector<char_type> v(i, j);
+      return (i != j) ? this->m_results.named_subexpression_index(&v[0], &v[0] + v.size())
+         : this->m_results.named_subexpression_index(static_cast<const char_type*>(0), static_cast<const char_type*>(0));
+   }
+   inline int get_named_sub_index(ForwardIter i, ForwardIter j, const mpl::true_&)
+   {
+      return this->m_results.named_subexpression_index(i, j);
+   }
+   inline int get_named_sub_index(ForwardIter i, ForwardIter j)
+   {
+      typedef typename boost::is_convertible<ForwardIter, const char_type*>::type tag_type;
+      return get_named_sub_index(i, j, tag_type());
+   }
+   inline int toi(ForwardIter& i, ForwardIter j, int base, const boost::mpl::false_&)
+   {
+      if(i != j)
+      {
+         std::vector<char_type> v(i, j);
+         const char_type* start = &v[0];
+         const char_type* pos = start;
+         int r = m_traits.toi(pos, &v[0] + v.size(), base);
+         std::advance(i, pos - start);
+         return r;
+      }
+      return -1;
+   }
+   inline int toi(ForwardIter& i, ForwardIter j, int base, const boost::mpl::true_&)
+   {
+      return m_traits.toi(i, j, base);
+   }
+   inline int toi(ForwardIter& i, ForwardIter j, int base)
+   {
+      typedef typename boost::is_convertible<ForwardIter, const char_type*&>::type tag_type;
+      return toi(i, j, base, tag_type());
+   }
+
+   const traits&    m_traits;       // the traits class for localised formatting operations
+   const Results&   m_results;     // the match_results being used.
+   OutputIterator   m_out;         // where to send output.
+   ForwardIter      m_position;  // format string, current position
+   ForwardIter      m_end;       // format string end
+   match_flag_type  m_flags;      // format flags to use
+   output_state     m_state;      // what to do with the next character
+   output_state     m_restore_state;  // what state to restore to.
+   bool             m_have_conditional; // we are parsing a conditional
 private:
    basic_regex_formatter(const basic_regex_formatter&);
    basic_regex_formatter& operator=(const basic_regex_formatter&);
 };
 
-template <class OutputIterator, class Results, class traits>
-OutputIterator basic_regex_formatter<OutputIterator, Results, traits>::format(const char_type* p1, const char_type* p2, match_flag_type f)
+template <class OutputIterator, class Results, class traits, class ForwardIter>
+OutputIterator basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format(ForwardIter p1, ForwardIter p2, match_flag_type f)
 {
    m_position = p1;
    m_end = p2;
@@ -133,8 +199,8 @@ OutputIterator basic_regex_formatter<OutputIterator, Results, traits>::format(co
    return m_out;
 }
 
-template <class OutputIterator, class Results, class traits>
-void basic_regex_formatter<OutputIterator, Results, traits>::format_all()
+template <class OutputIterator, class Results, class traits, class ForwardIter>
+void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_all()
 {
    // over and over:
    while(m_position != m_end)
@@ -211,8 +277,8 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_all()
    }
 }
 
-template <class OutputIterator, class Results, class traits>
-void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
+template <class OutputIterator, class Results, class traits, class ForwardIter>
+void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_perl()
 {
    //
    // On entry *m_position points to a '$' character
@@ -233,7 +299,7 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
    // OK find out what kind it is:
    //
    bool have_brace = false;
-   const char_type* save_position = m_position;
+   ForwardIter save_position = m_position;
    switch(*m_position)
    {
    case '&':
@@ -254,12 +320,12 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
    case '+':
       if((++m_position != m_end) && (*m_position == '{'))
       {
-         const char_type* base = ++m_position;
+         ForwardIter 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));
+            put(get_named_sub(base, m_position));
             ++m_position;
             break;
          }
@@ -279,7 +345,7 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
       {
          std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end);
          //len = (std::min)(static_cast<std::ptrdiff_t>(2), len);
-         int v = m_traits.toi(m_position, m_position + len, 10);
+         int v = this->toi(m_position, m_position + len, 10);
          if((v < 0) || (have_brace && ((m_position == m_end) || (*m_position != '}'))))
          {
             // Look for a Perl-5.10 verb:
@@ -300,8 +366,8 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_perl()
    }
 }
 
-template <class OutputIterator, class Results, class traits>
-bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bool have_brace)
+template <class OutputIterator, class Results, class traits, class ForwardIter>
+bool basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::handle_perl_verb(bool have_brace)
 {
    // 
    // We may have a capitalised string containing a Perl action:
@@ -313,6 +379,8 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
    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(m_position == m_end)
+      return false;
    if(have_brace && (*m_position == '^'))
       ++m_position;
 
@@ -323,7 +391,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
       m_position += 5;
       if(have_brace)
       {
-         if(*m_position == '}')
+         if((m_position != m_end) && (*m_position == '}'))
             ++m_position;
          else
          {
@@ -339,7 +407,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
       m_position += 8;
       if(have_brace)
       {
-         if(*m_position == '}')
+         if((m_position != m_end) && (*m_position == '}'))
             ++m_position;
          else
          {
@@ -355,7 +423,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
       m_position += 9;
       if(have_brace)
       {
-         if(*m_position == '}')
+         if((m_position != m_end) && (*m_position == '}'))
             ++m_position;
          else
          {
@@ -371,7 +439,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
       m_position += 16;
       if(have_brace)
       {
-         if(*m_position == '}')
+         if((m_position != m_end) && (*m_position == '}'))
             ++m_position;
          else
          {
@@ -387,7 +455,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
       m_position += 20;
       if(have_brace)
       {
-         if(*m_position == '}')
+         if((m_position != m_end) && (*m_position == '}'))
             ++m_position;
          else
          {
@@ -403,7 +471,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
       m_position += 2;
       if(have_brace)
       {
-         if(*m_position == '}')
+         if((m_position != m_end) && (*m_position == '}'))
             ++m_position;
          else
          {
@@ -417,8 +485,8 @@ bool basic_regex_formatter<OutputIterator, Results, traits>::handle_perl_verb(bo
    return false;
 }
 
-template <class OutputIterator, class Results, class traits>
-void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
+template <class OutputIterator, class Results, class traits, class ForwardIter>
+void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_escape()
 {
    // skip the escape and check for trailing escape:
    if(++m_position == m_end)
@@ -463,7 +531,7 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
       if(*m_position == static_cast<char_type>('{'))
       {
          ++m_position;
-         int val = m_traits.toi(m_position, m_end, 16);
+         int val = this->toi(m_position, m_end, 16);
          if(val < 0)
          {
             // invalid value treat everything as literals:
@@ -471,8 +539,9 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
             put(static_cast<char_type>('{'));
             return;
          }
-         if(*m_position != static_cast<char_type>('}'))
+         if((m_position == m_end) || (*m_position != static_cast<char_type>('}')))
          {
+            --m_position;
             while(*m_position != static_cast<char_type>('\\'))
                --m_position;
             ++m_position;
@@ -487,7 +556,7 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
       {
          std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end);
          len = (std::min)(static_cast<std::ptrdiff_t>(2), len);
-         int val = m_traits.toi(m_position, m_position + len, 16);
+         int val = this->toi(m_position, m_position + len, 16);
          if(val < 0)
          {
             --m_position;
@@ -549,7 +618,9 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
             break;
       }
       // see if we have a \n sed style backreference:
-      int v = m_traits.toi(m_position, m_position+1, 10);
+      std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end);
+      len = (std::min)(static_cast<std::ptrdiff_t>(1), len);
+      int v = this->toi(m_position, m_position+len, 10);
       if((v > 0) || ((v == 0) && (m_flags & ::boost::regex_constants::format_sed)))
       {
          put(m_results[v]);
@@ -559,9 +630,9 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
       {
          // octal ecape sequence:
          --m_position;
-         std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end);
+         len = ::boost::re_detail::distance(m_position, m_end);
          len = (std::min)(static_cast<std::ptrdiff_t>(4), len);
-         v = m_traits.toi(m_position, m_position + len, 8);
+         v = this->toi(m_position, m_position + len, 8);
          BOOST_ASSERT(v >= 0);
          put(static_cast<char_type>(v));
          break;
@@ -572,8 +643,8 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_escape()
    }
 }
 
-template <class OutputIterator, class Results, class traits>
-void basic_regex_formatter<OutputIterator, Results, traits>::format_conditional()
+template <class OutputIterator, class Results, class traits, class ForwardIter>
+void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_conditional()
 {
    if(m_position == m_end)
    {
@@ -584,15 +655,15 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_conditional(
    int v;
    if(*m_position == '{')
    {
-      const char_type* base = m_position;
+      ForwardIter base = m_position;
       ++m_position;
-      v = m_traits.toi(m_position, m_end, 10);
+      v = this->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);
+         v = this->get_named_sub_index(base + 1, m_position);
       }
       if((v < 0) || (*m_position != '}'))
       {
@@ -608,7 +679,7 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_conditional(
    {
       std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end);
       len = (std::min)(static_cast<std::ptrdiff_t>(2), len);
-      v = m_traits.toi(m_position, m_position + len, 10);
+      v = this->toi(m_position, m_position + len, 10);
    }
    if(v < 0)
    {
@@ -657,8 +728,8 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_conditional(
    }
 }
 
-template <class OutputIterator, class Results, class traits>
-void basic_regex_formatter<OutputIterator, Results, traits>::format_until_scope_end()
+template <class OutputIterator, class Results, class traits, class ForwardIter>
+void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_until_scope_end()
 {
    do
    {
@@ -669,8 +740,8 @@ void basic_regex_formatter<OutputIterator, Results, traits>::format_until_scope_
    }while(m_position != m_end);
 }
 
-template <class OutputIterator, class Results, class traits>
-void basic_regex_formatter<OutputIterator, Results, traits>::put(char_type c)
+template <class OutputIterator, class Results, class traits, class ForwardIter>
+void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::put(char_type c)
 {
    // write a single character to output
    // according to which case translation mode we are in:
@@ -699,8 +770,8 @@ void basic_regex_formatter<OutputIterator, Results, traits>::put(char_type c)
    ++m_out;
 }
 
-template <class OutputIterator, class Results, class traits>
-void basic_regex_formatter<OutputIterator, Results, traits>::put(const sub_match_type& sub)
+template <class OutputIterator, class Results, class traits, class ForwardIter>
+void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::put(const sub_match_type& sub)
 {
    typedef typename sub_match_type::iterator iterator_type;
    iterator_type i = sub.first;
@@ -738,10 +809,10 @@ public:
 #endif
 };
 
-template <class OutputIterator, class Iterator, class Alloc, class charT, class traits>
+template <class OutputIterator, class Iterator, class Alloc, class ForwardIter, class traits>
 OutputIterator regex_format_imp(OutputIterator out,
                           const match_results<Iterator, Alloc>& m,
-                          const charT* p1, const charT* p2,
+                          ForwardIter p1, ForwardIter p2,
                           match_flag_type flags,
                           const traits& t
                          )
@@ -754,57 +825,289 @@ OutputIterator regex_format_imp(OutputIterator out,
    re_detail::basic_regex_formatter<
       OutputIterator, 
       match_results<Iterator, Alloc>, 
-      traits > f(out, m, t);
+      traits, ForwardIter> f(out, m, t);
    return f.format(p1, p2, flags);
 }
 
+#ifndef BOOST_NO_SFINAE
 
-} // namespace re_detail
+BOOST_MPL_HAS_XXX_TRAIT_DEF(const_iterator)
 
-template <class OutputIterator, class Iterator, class charT>
-OutputIterator regex_format(OutputIterator out,
-                          const match_results<Iterator>& m,
-                          const charT* fmt,
-                          match_flag_type flags = format_all
-                         )
+struct any_type { any_type(...); };
+typedef char no_type;
+typedef char (&unary_type)[2];
+typedef char (&binary_type)[3];
+typedef char (&ternary_type)[4];
+
+no_type check_is_formatter(unary_type, binary_type, ternary_type);
+template<typename T>
+unary_type check_is_formatter(T const &, binary_type, ternary_type);
+template<typename T>
+binary_type check_is_formatter(unary_type, T const &, ternary_type);
+template<typename T, typename U>
+binary_type check_is_formatter(T const &, U const &, ternary_type);
+template<typename T>
+ternary_type check_is_formatter(unary_type, binary_type, T const &);
+template<typename T, typename U>
+ternary_type check_is_formatter(T const &, binary_type, U const &);
+template<typename T, typename U>
+ternary_type check_is_formatter(unary_type, T const &, U const &);
+template<typename T, typename U, typename V>
+ternary_type check_is_formatter(T const &, U const &, V const &);
+
+struct unary_binary_ternary
 {
-   re_detail::trivial_format_traits<charT> traits;
-   return re_detail::regex_format_imp(out, m, fmt, fmt + traits.length(fmt), flags, traits);
-}
+    typedef unary_type (*unary_fun)(any_type);
+    typedef binary_type (*binary_fun)(any_type, any_type);
+    typedef ternary_type (*ternary_fun)(any_type, any_type, any_type);
+    operator unary_fun();
+    operator binary_fun();
+    operator ternary_fun();
+};
 
-template <class OutputIterator, class Iterator, class charT>
-OutputIterator regex_format(OutputIterator out,
-                          const match_results<Iterator>& m,
-                          const std::basic_string<charT>& fmt,
-                          match_flag_type flags = format_all
-                         )
+template<typename Formatter, bool IsFunction = boost::is_function<Formatter>::value>
+struct formatter_wrapper
+  : Formatter
+  , unary_binary_ternary
 {
-   re_detail::trivial_format_traits<charT> traits;
-   return re_detail::regex_format_imp(out, m, fmt.data(), fmt.data() + fmt.size(), flags, traits);
-}  
+   formatter_wrapper(){}
+};
 
-template <class Iterator, class charT>
-std::basic_string<charT> regex_format(const match_results<Iterator>& m, 
-                                      const charT* fmt, 
-                                      match_flag_type flags = format_all)
+template<typename Formatter>
+struct formatter_wrapper<Formatter, true>
+  : unary_binary_ternary
+{
+    operator Formatter *();
+};
+
+template<typename Formatter>
+struct formatter_wrapper<Formatter *, false>
+  : unary_binary_ternary
+{
+    operator Formatter *();
+};
+
+template <class F, class M, class O>
+struct format_traits_imp
+{
+private:
+   //
+   // F must be a pointer, a function, or a class with a function call operator:
+   //
+   BOOST_STATIC_ASSERT((::boost::is_pointer<F>::value || ::boost::is_function<F>::value || ::boost::is_class<F>::value));
+   static formatter_wrapper<F> f;
+   static M m;
+   static O out;
+   static boost::regex_constants::match_flag_type flags;
+public:
+   BOOST_STATIC_CONSTANT(int, value = sizeof(check_is_formatter(f(m), f(m, out), f(m, out, flags))));
+};
+
+template <class F, class M, class O>
+struct format_traits
+{
+public:
+   // 
+   // Type is mpl::int_<N> where N is one of:
+   //
+   // 0 : F is a pointer to a presumably null-terminated string.
+   // 1 : F is a character-container such as a std::string.
+   // 2 : F is a Unary Functor.
+   // 3 : F is a Binary Functor.
+   // 4 : F is a Ternary Functor.
+   //
+   typedef typename boost::mpl::if_<
+      boost::mpl::and_<boost::is_pointer<F>, boost::mpl::not_<boost::is_function<typename boost::remove_pointer<F>::type> > >,
+      boost::mpl::int_<0>,
+      typename boost::mpl::if_<
+         has_const_iterator<F>,
+         boost::mpl::int_<1>,
+         boost::mpl::int_<format_traits_imp<F, M, O>::value>
+      >::type
+   >::type type;
+   //
+   // This static assertion will fail if the functor passed does not accept
+   // the same type of arguments passed.
+   //
+   BOOST_STATIC_ASSERT( boost::is_class<F>::value && !has_const_iterator<F>::value ? (type::value > 1) : true);
+};
+
+#else // BOOST_NO_SFINAE
+
+template <class F, class M, class O>
+struct format_traits
+{
+public:
+   // 
+   // Type is mpl::int_<N> where N is one of:
+   //
+   // 0 : F is a pointer to a presumably null-terminated string.
+   // 1 : F is a character-container such as a std::string.
+   //
+   // Other options such as F being a Functor are not supported without
+   // SFINAE support.
+   //
+   typedef typename boost::mpl::if_<
+      boost::is_pointer<F>,
+      boost::mpl::int_<0>,
+      boost::mpl::int_<1>
+   >::type type;
+};
+
+#endif // BOOST_NO_SFINAE
+
+template <class Base, class Match>
+struct format_functor3
+{
+   format_functor3(Base b) : func(b) {}
+   template <class OutputIter>
+   OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f)
+   {
+      return func(m, i, f);
+   }
+   template <class OutputIter, class Traits>
+   OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&)
+   {
+      return (*this)(m, i, f);
+   }
+private:
+   Base func;
+   format_functor3(const format_functor3&);
+   format_functor3& operator=(const format_functor3&);
+};
+
+template <class Base, class Match>
+struct format_functor2
+{
+   format_functor2(Base b) : func(b) {}
+   template <class OutputIter>
+   OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type /*f*/)
+   {
+      return func(m, i);
+   }
+   template <class OutputIter, class Traits>
+   OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&)
+   {
+      return (*this)(m, i, f);
+   }
+private:
+   Base func;
+   format_functor2(const format_functor2&);
+   format_functor2& operator=(const format_functor2&);
+};
+
+template <class Base, class Match>
+struct format_functor1
+{
+   format_functor1(Base b) : func(b) {}
+
+   template <class S, class OutputIter>
+   OutputIter do_format_string(const S& s, OutputIter i)
+   {
+      return re_detail::copy(s.begin(), s.end(), i);
+   }
+   template <class S, class OutputIter>
+   inline OutputIter do_format_string(const S* s, OutputIter i)
+   {
+      while(s && *s)
+      {
+         *i = *s;
+         ++i;
+         ++s;
+      }
+      return i;
+   }
+   template <class OutputIter>
+   OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type /*f*/)
+   {
+      return do_format_string(func(m), i);
+   }
+   template <class OutputIter, class Traits>
+   OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&)
+   {
+      return (*this)(m, i, f);
+   }
+private:
+   Base func;
+   format_functor1(const format_functor1&);
+   format_functor1& operator=(const format_functor1&);
+};
+
+template <class charT, class Match, class Traits>
+struct format_functor_c_string
+{
+   format_functor_c_string(const charT* ps) : func(ps) {}
+
+   template <class OutputIter>
+   OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits& t = Traits())
+   {
+      typedef typename Match::char_type char_type;
+      const charT* end = func;
+      while(*end) ++end;
+      return regex_format_imp(i, m, func, end, f, t);
+   }
+private:
+   const charT* func;
+   format_functor_c_string(const format_functor_c_string&);
+   format_functor_c_string& operator=(const format_functor_c_string&);
+};
+
+template <class Container, class Match, class Traits>
+struct format_functor_container
+{
+   format_functor_container(const Container& c) : func(c) {}
+
+   template <class OutputIter>
+   OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits& t = Traits())
+   {
+      typedef typename Match::char_type char_type;
+      return re_detail::regex_format_imp(i, m, func.begin(), func.end(), f, t);
+   }
+private:
+   const Container& func;
+   format_functor_container(const format_functor_container&);
+   format_functor_container& operator=(const format_functor_container&);
+};
+
+template <class Func, class Match, class OutputIterator, class Traits = re_detail::trivial_format_traits<typename Match::char_type> >
+struct compute_functor_type
+{
+   typedef typename format_traits<Func, Match, OutputIterator>::type tag;
+   typedef typename boost::remove_cv< typename boost::remove_pointer<Func>::type>::type maybe_char_type;
+
+   typedef typename mpl::if_<
+      ::boost::is_same<tag, mpl::int_<0> >, format_functor_c_string<maybe_char_type, Match, Traits>,
+      typename mpl::if_<
+         ::boost::is_same<tag, mpl::int_<1> >, format_functor_container<Func, Match, Traits>,
+         typename mpl::if_<
+            ::boost::is_same<tag, mpl::int_<2> >, format_functor1<Func, Match>,
+            typename mpl::if_<
+               ::boost::is_same<tag, mpl::int_<3> >, format_functor2<Func, Match>, 
+               format_functor3<Func, Match>
+            >::type
+         >::type
+      >::type
+   >::type type;
+};
+
+} // namespace re_detail
+
+template <class OutputIterator, class Iterator, class Allocator, class Functor>
+inline OutputIterator regex_format(OutputIterator out,
+                          const match_results<Iterator, Allocator>& m,
+                          Functor fmt,
+                          match_flag_type flags = format_all
+                         )
 {
-   std::basic_string<charT> result;
-   re_detail::string_out_iterator<std::basic_string<charT> > i(result);
-   re_detail::trivial_format_traits<charT> traits;
-   re_detail::regex_format_imp(i, m, fmt, fmt + traits.length(fmt), flags, traits);
-   return result;
+   return m.format(out, fmt, flags);
 }
 
-template <class Iterator, class charT>
-std::basic_string<charT> regex_format(const match_results<Iterator>& m, 
-                                      const std::basic_string<charT>& fmt, 
+template <class Iterator, class Allocator, class Functor>
+inline std::basic_string<typename match_results<Iterator, Allocator>::char_type> regex_format(const match_results<Iterator, Allocator>& m, 
+                                      Functor fmt, 
                                       match_flag_type flags = format_all)
 {
-   std::basic_string<charT> result;
-   re_detail::string_out_iterator<std::basic_string<charT> > i(result);
-   re_detail::trivial_format_traits<charT> traits;
-   re_detail::regex_format_imp(i, m, fmt.data(), fmt.data() + fmt.size(), flags, traits);
-   return result;
+   return m.format(fmt, flags);
 }
 
 #ifdef BOOST_MSVC
index c4544c05b9d6e61f30bf3612609484f815d90089..ac8e3c81e279ba6772af66bd3cdf30bc093e8853 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- * Copyright (c) 1998-2002
+ * Copyright (c) 1998-2009
  * John Maddock
  *
  * Use, modification and distribution are subject to the 
@@ -35,12 +35,12 @@ namespace boost{
 #pragma warning(pop)
 #endif
 
-template <class OutputIterator, class BidirectionalIterator, class traits, class charT>
+template <class OutputIterator, class BidirectionalIterator, class traits, class charT, class Formatter>
 OutputIterator regex_replace(OutputIterator out,
                          BidirectionalIterator first,
                          BidirectionalIterator last,
                          const basic_regex<charT, traits>& e, 
-                         const charT* fmt, 
+                         Formatter fmt, 
                          match_flag_type flags = match_default)
 {
    regex_iterator<BidirectionalIterator, charT, traits> i(first, last, e, flags);
@@ -69,21 +69,10 @@ OutputIterator regex_replace(OutputIterator out,
    return out;
 }
 
-template <class OutputIterator, class Iterator, class traits, class charT>
-inline OutputIterator regex_replace(OutputIterator out,
-                         Iterator first,
-                         Iterator last,
-                         const basic_regex<charT, traits>& e, 
-                         const std::basic_string<charT>& fmt,
-                         match_flag_type flags = match_default)
-{
-   return regex_replace(out, first, last, e, fmt.c_str(), flags);
-}
-
-template <class traits, class charT>
+template <class traits, class charT, class Formatter>
 std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
                          const basic_regex<charT, traits>& e, 
-                         const charT* fmt,
+                         Formatter fmt,
                          match_flag_type flags = match_default)
 {
    std::basic_string<charT> result;
@@ -92,18 +81,6 @@ std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
    return result;
 }
 
-template <class traits, class charT>
-std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
-                         const basic_regex<charT, traits>& e, 
-                         const std::basic_string<charT>& fmt,
-                         match_flag_type flags = match_default)
-{
-   std::basic_string<charT> result;
-   re_detail::string_out_iterator<std::basic_string<charT> > i(result);
-   regex_replace(i, s.begin(), s.end(), e, fmt.c_str(), flags);
-   return result;
-}
-
 #ifdef BOOST_MSVC
 #pragma warning(push)
 #pragma warning(disable: 4103)
index 5b2c6bc338c4a516c4bc87d681d1ccbbe8585b26..ca13f195dceb3be11aa6115040c8d44910efde35 100644 (file)
@@ -84,7 +84,7 @@ inline bool is_combining<unsigned char>(unsigned char)
 {
    return false;
 }
-#ifndef __hpux // can't use WCHAR_MAX/MIN in pp-directives
+#if !defined(__hpux) && !defined(__WINSCW__) // can't use WCHAR_MAX/MIN in pp-directives
 #ifdef _MSC_VER 
 template<>
 inline bool is_combining<wchar_t>(wchar_t c)
@@ -322,7 +322,7 @@ inline const charT* get_escape_R_string()
 {
 #ifdef BOOST_MSVC
 #  pragma warning(push)
-#  pragma warning(disable:4309)
+#  pragma warning(disable:4309 4245)
 #endif
    static const charT e1[] = { '(', '?', '>', '\x0D', '\x0A', '?', 
       '|', '[', '\x0A', '\x0B', '\x0C', '\x85', '\\', 'x', '{', '2', '0', '2', '8', '}', 
index efdebbe59f7dc8e54aee436f3af5e5e8e1d724a7..38690b2299082998435ce4320d696eab4d18e6c4 100644 (file)
@@ -248,6 +248,14 @@ struct re_repeat : public re_alt
    bool          greedy;    // True if this is a greedy repeat
 };
 
+/*** struct re_recurse ************************************************
+Recurse to a particular subexpression.
+**********************************************************************/
+struct re_recurse : public re_jump
+{
+   int state_id;             // identifier of first nested repeat within the recursion.
+};
+
 /*** enum re_jump_size_type *******************************************
 Provides compiled size of re_jump structure (allowing for trailing alignment).
 We provide this so we know how manybytes to insert when constructing the machine
index 7e893e6951b398a77bc7bb4404d4f85451ad76f0..65ebd7f8ea5c0e04758259bbc5fa046281f410d8 100644 (file)
@@ -178,7 +178,7 @@ inline u32regex_iterator<typename std::basic_string<charT, Traits, Alloc>::const
    typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
    return u32regex_iterator<iter_type>(p.begin(), p.end(), e, m);
 }
-inline u32regex_iterator<const UChar*> make_u32regex_iterator(const UnicodeString& s, const u32regex& e, regex_constants::match_flag_type m = regex_constants::match_default)
+inline u32regex_iterator<const UChar*> make_u32regex_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, regex_constants::match_flag_type m = regex_constants::match_default)
 {
    return u32regex_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, m);
 }
index 2726d486fd81f263616f41b29bfd3c901178d71a..c47a2192c7daac95986a0f31db41a1c33357f361 100644 (file)
@@ -294,7 +294,7 @@ inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>:
    typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
    return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m);
 }
-inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UnicodeString& s, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
+inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
 {
    return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m);
 }
@@ -327,7 +327,7 @@ inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>:
    return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m);
 }
 template <std::size_t N>
-inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UnicodeString& s, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
+inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
 {
    return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m);
 }
@@ -356,7 +356,7 @@ inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>:
    typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
    return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m);
 }
-inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UnicodeString& s, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
+inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
 {
    return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m);
 }
index fc20dbb14515f6bb1f7ac3e54aca73ad63864571..8eda51823383bfd6dd17486a657a5fde8c884e0a 100644 (file)
@@ -17,6 +17,7 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 //
 
+#include <boost/assert.hpp>
 #include <pthread.h>
 
 namespace boost
@@ -42,15 +43,15 @@ public:
 // HPUX 10.20 / DCE has a nonstandard pthread_mutex_init
 
 #if defined(__hpux) && defined(_DECTHREADS_)
-        pthread_mutex_init(&m_, pthread_mutexattr_default);
+        BOOST_VERIFY( pthread_mutex_init( &m_, pthread_mutexattr_default ) == 0 );
 #else
-        pthread_mutex_init(&m_, 0);
+        BOOST_VERIFY( pthread_mutex_init( &m_, 0 ) == 0 );
 #endif
     }
 
     ~lightweight_mutex()
     {
-        pthread_mutex_destroy(&m_);
+        BOOST_VERIFY( pthread_mutex_destroy( &m_ ) == 0 );
     }
 
     class scoped_lock;
@@ -69,12 +70,12 @@ public:
 
         scoped_lock(lightweight_mutex & m): m_(m.m_)
         {
-            pthread_mutex_lock(&m_);
+            BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 );
         }
 
         ~scoped_lock()
         {
-            pthread_mutex_unlock(&m_);
+            BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 );
         }
     };
 };
index 6d136f82d73f2dbb25561260ecd9d0aa6c1978c3..159bd5e7aa88e86cf8b519ac39af944a189bd5e0 100644 (file)
@@ -74,8 +74,9 @@ template<unsigned size, unsigned align_> struct allocator_impl
 
     static lightweight_mutex & mutex()
     {
-        static lightweight_mutex m;
-        return m;
+        static freeblock< sizeof( lightweight_mutex ), boost::alignment_of< lightweight_mutex >::value > fbm;
+        static lightweight_mutex * pm = new( &fbm ) lightweight_mutex;
+        return *pm;
     }
 
     static lightweight_mutex * mutex_init;
index 66e5ec7338aeb326f1fb0b24a0e6d7257bafae91..b7f0ea8f2ddd26ee0bde8762dead3b7c61143fc0 100644 (file)
@@ -25,7 +25,7 @@
 # define BOOST_SP_NO_SP_CONVERTIBLE
 #endif
 
-#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x610 )
+#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x620 )
 # define BOOST_SP_NO_SP_CONVERTIBLE
 #endif
 
index 8af6f0a972ab11f1157573e5c6e5a4e496ab84fb..21fa59dcc4fa3cc58dd95b1b2af2fcc952f74f15 100644 (file)
@@ -30,9 +30,9 @@ namespace detail
 
 inline int32_t compare_and_swap( int32_t * dest_, int32_t compare_, int32_t swap_ )
 {
-    __asm__ __volatile__( "cas %0, %2, %1"
-                        : "+m" (*dest_), "+r" (swap_)
-                        : "r" (compare_)
+    __asm__ __volatile__( "cas [%1], %2, %0"
+                        : "+r" (swap_)
+                        : "r" (dest_), "r" (compare_)
                         : "memory" );
 
     return swap_;
index cb0282dbad7bb528a4c991980229aba9d2e5eff9..7fcd09ef08bf89f62b1be1d20bf08c194b0b2f8a 100644 (file)
@@ -40,7 +40,7 @@
 #undef BOOST_SP_HAS_SYNC
 #endif
 
-#if defined( __INTEL_COMPILER ) && !defined( __ia64__ )
+#if defined( __INTEL_COMPILER ) && !defined( __ia64__ ) && ( __INTEL_COMPILER < 1100 )
 #undef BOOST_SP_HAS_SYNC
 #endif
 
index 6927a591850fac6197616a0342279c1488ccf68c..e72eb2186985d93acbb9387e874895a23bdf1e79 100644 (file)
@@ -77,7 +77,7 @@ public:
     template<class U>
 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
 
-    intrusive_ptr( intrusive_ptr<U> const & rhs, typename detail::sp_enable_if_convertible<U,T>::type = detail::sp_empty() )
+    intrusive_ptr( intrusive_ptr<U> const & rhs, typename boost::detail::sp_enable_if_convertible<U,T>::type = boost::detail::sp_empty() )
 
 #else
 
@@ -122,7 +122,7 @@ public:
 
     intrusive_ptr & operator=(intrusive_ptr && rhs)
     {
-        this_type(std::move(rhs)).swap(*this);
+        this_type( static_cast< intrusive_ptr && >( rhs ) ).swap(*this);
         return *this;
     }
 
index 7e1e793e1934d4a31cc2efb160bce68a9403c90a..d47718808c44c0473ba5ba0f2ebcb75028609509 100644 (file)
@@ -86,10 +86,12 @@ public:
     }
 };
 
-template< class T > T forward( T t )
+#if defined( BOOST_HAS_RVALUE_REFS )
+template< class T > T&& forward( T &&t )
 {
     return t;
 }
+#endif
 
 } // namespace detail
 
index 1b367f0f4da8da05719b8df75b52cea3f1299db8..609cce903221ab5687ccbabc9d651348e883dc76 100644 (file)
@@ -228,7 +228,7 @@ public:
     template<class Y>
 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
 
-    shared_ptr( shared_ptr<Y> const & r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
+    shared_ptr( shared_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
 
 #else
 
@@ -353,7 +353,7 @@ public:
     template<class Y>
 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
 
-    shared_ptr( shared_ptr<Y> && r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
+    shared_ptr( shared_ptr<Y> && r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
 
 #else
 
@@ -368,14 +368,14 @@ public:
 
     shared_ptr & operator=( shared_ptr && r ) // never throws
     {
-        this_type( std::move( r ) ).swap( *this );
+        this_type( static_cast< shared_ptr && >( r ) ).swap( *this );
         return *this;
     }
 
     template<class Y>
     shared_ptr & operator=( shared_ptr<Y> && r ) // never throws
     {
-        this_type( std::move( r ) ).swap( *this );
+        this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );
         return *this;
     }
 
@@ -448,7 +448,7 @@ public:
         return pn < rhs.pn;
     }
 
-    void * _internal_get_deleter( detail::sp_typeinfo const & ti ) const
+    void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const
     {
         return pn.get_deleter( ti );
     }
index 621c433a0356c37ef46cb6a8f55cd0c49bddb6f8..d314b0df3eabca979f96ab0041250ff38335273b 100644 (file)
@@ -63,7 +63,7 @@ public:
     template<class Y>
 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
 
-    weak_ptr( weak_ptr<Y> const & r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
+    weak_ptr( weak_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
 
 #else
 
@@ -79,20 +79,20 @@ public:
     template<class Y>
 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
 
-    weak_ptr( weak_ptr<Y> && r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
+    weak_ptr( weak_ptr<Y> && r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
 
 #else
 
     weak_ptr( weak_ptr<Y> && r )
 
 #endif
-    : px(r.lock().get()), pn(std::move(r.pn)) // never throws
+    : px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( 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
+    weak_ptr( weak_ptr && r ): px( r.px ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) // never throws
     {
         r.px = 0;
     }
@@ -100,7 +100,7 @@ public:
     // for better efficiency in the T == Y case
     weak_ptr & operator=( weak_ptr && r ) // never throws
     {
-        this_type( std::move( r ) ).swap( *this );
+        this_type( static_cast< weak_ptr && >( r ) ).swap( *this );
         return *this;
     }
 
@@ -110,7 +110,7 @@ public:
     template<class Y>
 #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
 
-    weak_ptr( shared_ptr<Y> const & r, typename detail::sp_enable_if_convertible<Y,T>::type = detail::sp_empty() )
+    weak_ptr( shared_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
 
 #else
 
@@ -134,9 +134,9 @@ public:
 #if defined( BOOST_HAS_RVALUE_REFS )
 
     template<class Y>
-    weak_ptr & operator=(weak_ptr<Y> && r)
+    weak_ptr & operator=( weak_ptr<Y> && r )
     {
-        this_type( std::move( r ) ).swap( *this );
+        this_type( static_cast< weak_ptr<Y> && >( r ) ).swap( *this );
         return *this;
     }
 
index a5a5f9ea0bf96d9999a1bd32882293b16525e4a2..656b8de31e23a90c65b926243128ccbd9767f42a 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <boost/exception/detail/attribute_noreturn.hpp>
 #include <boost/detail/workaround.hpp>
+#include <boost/config.hpp>
 #include <exception>
 
 #if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x593) )
@@ -38,7 +39,7 @@
 # define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(::boost::enable_error_info(x) <<\
     ::boost::throw_function(BOOST_CURRENT_FUNCTION) <<\
     ::boost::throw_file(__FILE__) <<\
-    ::boost::throw_line((int)__LINE__))
+    ::boost::throw_line(__LINE__))
 #else
 # define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x)
 #endif
index 6d5351e080096bf2803a9503ce19dde94baad5cb..2c2c32228f26682ebf708aa46deec1a220151b5b 100644 (file)
@@ -26,7 +26,7 @@ namespace detail {
     template <typename T>
     struct has_new_operator_impl {
         template<class U>
-        static type_traits::yes_type check_sig(
+        static type_traits::yes_type check_sig1(
             U*, 
             test<
             void *(*)(std::size_t),
@@ -34,7 +34,10 @@ namespace detail {
             >* = NULL
         );
         template<class U>
-        static type_traits::yes_type check_sig(
+        static type_traits::no_type check_sig1(...);
+
+        template<class U>
+        static type_traits::yes_type check_sig2(
             U*, 
             test<
             void *(*)(std::size_t, const std::nothrow_t&),
@@ -42,7 +45,10 @@ namespace detail {
             >* = NULL
         );
         template<class U>
-        static type_traits::yes_type check_sig(
+        static type_traits::no_type check_sig2(...);
+
+        template<class U>
+        static type_traits::yes_type check_sig3(
             U*, 
             test<
             void *(*)(std::size_t, void*),
@@ -50,10 +56,11 @@ namespace detail {
             >* = NULL
         );
         template<class U>
-        static type_traits::no_type check_sig(...);
+        static type_traits::no_type check_sig3(...);
+
 
         template<class U>
-        static type_traits::yes_type check_sig2(
+        static type_traits::yes_type check_sig4(
             U*, 
             test<
             void *(*)(std::size_t),
@@ -61,7 +68,10 @@ namespace detail {
             >* = NULL
         );
         template<class U>
-        static type_traits::yes_type check_sig2(
+        static type_traits::no_type check_sig4(...);
+
+        template<class U>
+        static type_traits::yes_type check_sig5(
             U*, 
             test<
             void *(*)(std::size_t, const std::nothrow_t&),
@@ -69,7 +79,10 @@ namespace detail {
             >* = NULL
         );
         template<class U>
-        static type_traits::yes_type check_sig2(
+        static type_traits::no_type check_sig5(...);
+
+        template<class U>
+        static type_traits::yes_type check_sig6(
             U*, 
             test<
             void *(*)(std::size_t, void*),
@@ -77,21 +90,29 @@ namespace detail {
             >* = NULL
         );
         template<class U>
-        static type_traits::no_type check_sig2(...);
+        static type_traits::no_type check_sig6(...);
 
         // GCC2 won't even parse this template if we embed the computation
         // of s1 in the computation of value.
         #ifdef __GNUC__
-            BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(has_new_operator_impl<T>::template check_sig<T>(0)));
+            BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(has_new_operator_impl<T>::template check_sig1<T>(0)));
             BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(has_new_operator_impl<T>::template check_sig2<T>(0)));
+            BOOST_STATIC_CONSTANT(unsigned, s3 = sizeof(has_new_operator_impl<T>::template check_sig3<T>(0)));
+            BOOST_STATIC_CONSTANT(unsigned, s4 = sizeof(has_new_operator_impl<T>::template check_sig4<T>(0)));
+            BOOST_STATIC_CONSTANT(unsigned, s5 = sizeof(has_new_operator_impl<T>::template check_sig5<T>(0)));
+            BOOST_STATIC_CONSTANT(unsigned, s6 = sizeof(has_new_operator_impl<T>::template check_sig6<T>(0)));
         #else
             #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
                 #pragma warning(push)
                 #pragma warning(disable:6334)
             #endif
 
-            BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(check_sig<T>(0)));
+            BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(check_sig1<T>(0)));
             BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(check_sig2<T>(0)));
+            BOOST_STATIC_CONSTANT(unsigned, s3 = sizeof(check_sig3<T>(0)));
+            BOOST_STATIC_CONSTANT(unsigned, s4 = sizeof(check_sig4<T>(0)));
+            BOOST_STATIC_CONSTANT(unsigned, s5 = sizeof(check_sig5<T>(0)));
+            BOOST_STATIC_CONSTANT(unsigned, s6 = sizeof(check_sig6<T>(0)));
 
             #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000)
                 #pragma warning(pop)
@@ -100,7 +121,11 @@ namespace detail {
         BOOST_STATIC_CONSTANT(bool, value = 
            (::boost::type_traits::ice_or<
             (s1 == sizeof(type_traits::yes_type)),
-            (s2 == sizeof(type_traits::yes_type))
+            (s2 == sizeof(type_traits::yes_type)),
+            (s3 == sizeof(type_traits::yes_type)),
+            (s4 == sizeof(type_traits::yes_type)),
+            (s5 == sizeof(type_traits::yes_type)),
+            (s6 == sizeof(type_traits::yes_type))
            >::value)
         );
     };
index 74b64a7d43df3d7c9c200c092bb79a809ccb1997..8f88036e20294005835611c2782df89a6f005104 100644 (file)
 #   define BOOST_IS_CLASS(T) __is_class(T)
 #   define BOOST_IS_ENUM(T) __is_enum(T)
 #   define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T)
-#   if !defined(unix) || defined(__LP64__)
+#   if (!defined(unix) && !defined(__unix__)) || defined(__LP64__)
       // GCC sometimes lies about alignment requirements
       // of type double on 32-bit unix platforms, use the
       // old implementation instead in that case:
diff --git a/boost/boost/type_traits/is_base_of_tr1.hpp b/boost/boost/type_traits/is_base_of_tr1.hpp
new file mode 100644 (file)
index 0000000..177e62b
--- /dev/null
@@ -0,0 +1,50 @@
+
+//  (C) Copyright Rani Sharoni 2003-2005.
+//  Use, modification and distribution are subject to the Boost Software License,
+//  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+//  http://www.boost.org/LICENSE_1_0.txt).
+//
+//  See http://www.boost.org/libs/type_traits for most recent version including documentation.
+#ifndef BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED
+#define BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED
+
+#include <boost/type_traits/is_base_and_derived.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_class.hpp>
+#include <boost/type_traits/detail/ice_or.hpp>
+
+// should be the last #include
+#include <boost/type_traits/detail/bool_trait_def.hpp>
+
+namespace boost { namespace tr1{
+
+   namespace detail{
+      template <class B, class D>
+      struct is_base_of_imp
+      {
+          typedef typename remove_cv<B>::type ncvB;
+          typedef typename remove_cv<D>::type ncvD;
+          BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_or<      
+            (::boost::detail::is_base_and_derived_impl<ncvB,ncvD>::value),
+            (::boost::is_same<ncvB,ncvD>::value)>::value));
+      };
+   }
+
+BOOST_TT_AUX_BOOL_TRAIT_DEF2(
+      is_base_of
+    , Base
+    , Derived
+    , (::boost::tr1::detail::is_base_of_imp<Base, Derived>::value))
+
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived,false)
+BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base,Derived&,false)
+BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived&,false)
+#endif
+
+} } // namespace boost
+
+#include <boost/type_traits/detail/bool_trait_undef.hpp>
+
+#endif // BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED
index e06b47cc85aa9ed2660015fb99324a5c9e4cb7b8..bf7bbfdb7686c7ead861ecf0aae62d9f0e7c2acd 100644 (file)
@@ -26,11 +26,19 @@ namespace detail{
 
 #if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238)
 
+template <class T>
+struct is_signed_values
+{
+   typedef typename remove_cv<T>::type no_cv_t;
+   BOOST_STATIC_CONSTANT(no_cv_t, minus_one = (static_cast<no_cv_t>(-1)));
+   BOOST_STATIC_CONSTANT(no_cv_t, zero = (static_cast<no_cv_t>(0)));
+};
+
 template <class T>
 struct is_signed_helper
 {
    typedef typename remove_cv<T>::type no_cv_t;
-   BOOST_STATIC_CONSTANT(bool, value = (!(static_cast<no_cv_t>(-1) > 0)));
+   BOOST_STATIC_CONSTANT(bool, value = (!(::boost::detail::is_signed_values<T>::minus_one  > boost::detail::is_signed_values<T>::zero)));
 };
 
 template <bool integral_type>
index 486648692fab9eafa860d3429fc8685d74510671..98baf4e94e38130b825720c20b639fc516d4f14e 100644 (file)
@@ -27,10 +27,17 @@ namespace detail{
 #if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238)
 
 template <class T>
-struct is_ununsigned_helper
+struct is_unsigned_values
 {
    typedef typename remove_cv<T>::type no_cv_t;
-   BOOST_STATIC_CONSTANT(bool, value = (static_cast<no_cv_t>(-1) > 0));
+   BOOST_STATIC_CONSTANT(no_cv_t, minus_one = (static_cast<no_cv_t>(-1)));
+   BOOST_STATIC_CONSTANT(no_cv_t, zero = (static_cast<no_cv_t>(0)));
+};
+
+template <class T>
+struct is_ununsigned_helper
+{
+   BOOST_STATIC_CONSTANT(bool, value = (::boost::detail::is_unsigned_values<T>::minus_one > ::boost::detail::is_unsigned_values<T>::zero));
 };
 
 template <bool integral_type>
index 177fe743450c2135ba873a239bf2e14b0b9592bb..5aefac928d94e65af05dc18b9410d47e26047a8e 100644 (file)
@@ -114,8 +114,6 @@ class value_initialized
 
 
 
-
-
 template<class T>
 T const& get ( value_initialized<T> const& x )
 {
index ad3435917b9986dd57b6947f66b0cf33f1418e44..e95ff85e710b0ce21c7a4534f16206e1c3f1d5ff 100644 (file)
@@ -19,7 +19,7 @@
 //  BOOST_VERSION / 100 % 1000 is the minor version
 //  BOOST_VERSION / 100000 is the major version
 
-#define BOOST_VERSION 104100
+#define BOOST_VERSION 104200
 
 //
 //  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 <config/auto_link.hpp> to select which library version to link to.
 
-#define BOOST_LIB_VERSION "1_41"
+#define BOOST_LIB_VERSION "1_42"
 
 #endif
 
index 9ed66be646763f8f5e70034a1947f91c10392106..1d24cc1a5ffab82d5d1eeda33bccd3f73225648b 100644 (file)
@@ -42,7 +42,7 @@ void cpp_regex_traits_char_layer<char>::init()
    std::messages<char>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1);
 #endif
    std::string cat_name(cpp_regex_traits<char>::get_catalog_name());
-   if(cat_name.size())
+   if(cat_name.size() && (m_pmessages != 0))
    {
       cat = this->m_pmessages->open(
          cat_name, 
index fb12373a2f5841763657faa933b2a328d0756914..f67d37185a5703704ec429e4c7a9a2ebf878b6fa 100644 (file)
@@ -563,11 +563,7 @@ std::string RegEx::What(int i)const
    return result;
 }
 
-#ifdef BOOST_HAS_LONG_LONG
-const std::size_t RegEx::npos = static_cast<std::size_t>(~0ULL);
-#else
-const std::size_t RegEx::npos = static_cast<std::size_t>(~0UL);
-#endif
+const std::size_t RegEx::npos = ~static_cast<std::size_t>(0);
 
 } // namespace boost
 
index 7d9c7f8847bb46f071803616efa5ad250237b3d8..ff1d11198fb36a4a876553352062cdcc5054bdd3 100644 (file)
@@ -258,11 +258,22 @@ void mapfile::lock(pointer* node)const
             *p = 0;
             *(reinterpret_cast<int*>(*node)) = 1;
          }
-         std::fseek(hfile, (node - _first) * buf_size, SEEK_SET);
-         if(node == _last - 1)
-            std::fread(*node + sizeof(int), _size % buf_size, 1, hfile);
-         else
-            std::fread(*node + sizeof(int), buf_size, 1, hfile);
+        std::size_t read_size = 0; 
+        int read_pos = std::fseek(hfile, (node - _first) * buf_size, SEEK_SET); 
+
+        if(0 == read_pos && node == _last - 1) 
+           read_size = std::fread(*node + sizeof(int), _size % buf_size, 1, hfile); 
+        else
+           read_size = std::fread(*node + sizeof(int), buf_size, 1, hfile);
+#ifndef BOOST_NO_EXCEPTIONS 
+        if((read_size == 0) || (std::ferror(hfile)))
+        { 
+           throw std::runtime_error("Unable to read file."); 
+        } 
+#else 
+        BOOST_REGEX_NOEH_ASSERT((0 == std::ferror(hfile)) && (read_size != 0)); 
+#endif 
       }
       else
       {
index 1564cedb0d7560403c7c720596b7802f086df2b0..37ed4221be3400a0ba9967d8d2b6a77413b7a872 100644 (file)
@@ -58,6 +58,7 @@ const char* names[] = {
       "REG_EMPTY",
       "REG_ECOMPLEXITY",
       "REG_ESTACK",
+      "REG_E_PERL",
       "REG_E_UNKNOWN",
 };
 } // namespace
index c9596a3daf62f770677c1f8b4f07574b034501c0..31b79184ec3471bc2e3f6ba82fa13e1de705457e 100644 (file)
@@ -111,30 +111,31 @@ BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_syntax(regex_constants
 BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_error_string(regex_constants::error_type n)
 {
    static const char* const s_default_error_messages[] = {
-      "Success",             /* REG_NOERROR */
-      "No match",             /* REG_NOMATCH */
-      "Invalid regular expression",    /* REG_BADPAT */
-      "Invalid collation character",      /* REG_ECOLLATE */
-      "Invalid character class name",     /* REG_ECTYPE */
-      "Invalid or trailing backslash",         /* REG_EESCAPE */
-      "Invalid back reference",        /* REG_ESUBREG */
-      "Unmatched [ or [^",       /* REG_EBRACK */
-      "Unmatched ( or \\(",         /* REG_EPAREN */
-      "Unmatched { or \\{",           /* REG_EBRACE */
-      "Invalid content of repeat range",     /* REG_BADBR */
-      "Invalid range end",       /* REG_ERANGE */
-      "Memory exhausted",           /* REG_ESPACE */
-      "Invalid preceding regular expression",   /* REG_BADRPT */
-      "Premature end of regular expression", /* REG_EEND */
-      "Regular expression too big",    /* REG_ESIZE */
-      "Unmatched ) or \\)",         /* REG_ERPAREN */
-      "Empty expression",           /* REG_EMPTY */
-      "Complexity requirements exceeded",  /* REG_ECOMPLEXITY */
-      "Out of stack space", /* REG_ESTACK */
-      "Unknown error",    /* REG_E_UNKNOWN */
-      "",
-      "",
-      "",
+      "Success",                                                            /* REG_NOERROR 0 error_ok */
+      "No match",                                                           /* REG_NOMATCH 1 error_no_match */
+      "Invalid regular expression.",                                        /* REG_BADPAT 2 error_bad_pattern */
+      "Invalid collation character.",                                       /* REG_ECOLLATE 3 error_collate */
+      "Invalid character class name, collating name, or character range.",  /* REG_ECTYPE 4 error_ctype */
+      "Invalid or unterminated escape sequence.",                           /* REG_EESCAPE 5 error_escape */
+      "Invalid back reference: specified capturing group does not exist.",  /* REG_ESUBREG 6 error_backref */
+      "Unmatched [ or [^ in character class declaration.",                  /* REG_EBRACK 7 error_brack */
+      "Unmatched marking parenthesis ( or \\(.",                            /* REG_EPAREN 8 error_paren */
+      "Unmatched quantified repeat operator { or \\{.",                     /* REG_EBRACE 9 error_brace */
+      "Invalid content of repeat range.",                                   /* REG_BADBR 10 error_badbrace */
+      "Invalid range end in character class",                               /* REG_ERANGE 11 error_range */
+      "Out of memory.",                                                     /* REG_ESPACE 12 error_space NOT USED */
+      "Invalid preceding regular expression prior to repetition operator.", /* REG_BADRPT 13 error_badrepeat */
+      "Premature end of regular expression",                                /* REG_EEND 14 error_end NOT USED */
+      "Regular expression is too large.",                                   /* REG_ESIZE 15 error_size NOT USED */
+      "Unmatched ) or \\)",                                                 /* REG_ERPAREN 16 error_right_paren NOT USED */
+      "Empty regular expression.",                                          /* REG_EMPTY 17 error_empty */
+      "The complexity of matching the regular expression exceeded predefined bounds.  "
+      "Try refactoring the regular expression to make each choice made by the state machine unambiguous.  "
+      "This exception is thrown to prevent \"eternal\" matches that take an "
+      "indefinite period time to locate.",                                  /* REG_ECOMPLEXITY 18 error_complexity */
+      "Ran out of stack space trying to match the regular expression.",     /* REG_ESTACK 19 error_stack */
+      "Invalid or unterminated Perl (?...) sequence.",                      /* REG_E_PERL 20 error_perl */
+      "Unknown error.",                                                     /* REG_E_UNKNOWN 21 error_unknown */
    };
 
    return (n > ::boost::regex_constants::error_unknown) ? s_default_error_messages[ ::boost::regex_constants::error_unknown] : s_default_error_messages[n];
index cef76783bfffefdbf5b90f06bcc36a88f2ffd452..d14feb1e9b96132d0b3b3724de6de09cf212fc75 100755 (executable)
@@ -124,7 +124,7 @@ void scoped_static_mutex_lock::unlock()
 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()
+extern "C" BOOST_REGEX_DECL void boost_regex_free_static_mutex()
 {
    delete static_mutex::m_pmutex;
    static_mutex::m_pmutex = 0;
@@ -133,7 +133,7 @@ extern "C" BOOST_REGEX_DECL void free_static_mutex()
 void static_mutex::init()
 {
    m_pmutex = new boost::recursive_mutex();
-   int r = atexit(free_static_mutex);
+   int r = atexit(boost_regex_free_static_mutex);
    BOOST_ASSERT(0 == r);
 }
 
@@ -157,7 +157,7 @@ void scoped_static_mutex_lock::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 = new boost::recursive_mutex::scoped_lock(*static_mutex::m_pmutex, boost::defer_lock);
       m_plock->lock();
       m_have_lock = true;
    }
index ca7b1dc94c4d50b8e7db9dbbc55d95c78899e15f..44ebd28dfb55e4a2c79060577cf38bdf4cdf7959 100755 (executable)
@@ -17,6 +17,9 @@
   */
 
 #define BOOST_REGEX_SOURCE
+#ifdef _MSC_VER
+#pragma warning(disable:4506) // 'no definition for inline function'
+#endif
 
 #include <boost/detail/workaround.hpp>
 #include <memory>
index c8a919027ba5ebb0cbe0edbfb5c8c25a52522e31..bdb7580e158d02275640ec31e22ffc4461eb8594 100644 (file)
@@ -65,6 +65,7 @@ const wchar_t* wnames[] = {
       L"REG_EMPTY",
       L"REG_ECOMPLEXITY",
       L"REG_ESTACK",
+      L"REG_E_PERL",
       L"REG_E_UNKNOWN",
 };
 }