diff --git a/include/boost/detail/allocator_utilities.hpp b/include/boost/detail/allocator_utilities.hpp index a81f386..ed3de84 100644 --- a/include/boost/detail/allocator_utilities.hpp +++ b/include/boost/detail/allocator_utilities.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2009 Joaquin M Lopez Munoz. +/* Copyright 2003-2013 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) diff --git a/include/boost/detail/catch_exceptions.hpp b/include/boost/detail/catch_exceptions.hpp index b1a3c76..823ebd1 100644 --- a/include/boost/detail/catch_exceptions.hpp +++ b/include/boost/detail/catch_exceptions.hpp @@ -24,11 +24,7 @@ #include // for exception, bad_exception #include // for std exception hierarchy #include // for exit codes -# if __GNUC__ != 2 || __GNUC_MINOR__ > 96 -# include // for ostream -# else -# include // workaround GNU missing ostream header -# endif +#include // for ostream # if defined(__BORLANDC__) && (__BORLANDC__ <= 0x0551) # define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT diff --git a/include/boost/detail/container_fwd.hpp b/include/boost/detail/container_fwd.hpp index ef17498..04ce972 100644 --- a/include/boost/detail/container_fwd.hpp +++ b/include/boost/detail/container_fwd.hpp @@ -8,7 +8,7 @@ #if !defined(BOOST_DETAIL_CONTAINER_FWD_HPP) #define BOOST_DETAIL_CONTAINER_FWD_HPP -#if defined(_MSC_VER) && (_MSC_VER >= 1020) && \ +#if defined(_MSC_VER) && \ !defined(BOOST_DETAIL_TEST_CONFIG_ONLY) # pragma once #endif @@ -119,12 +119,7 @@ namespace std template class allocator; template class basic_string; -#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) - - template struct string_char_traits; -#else template struct char_traits; -#endif #if defined(BOOST_CONTAINER_FWD_COMPLEX_STRUCT) template struct complex; diff --git a/include/boost/detail/identifier.hpp b/include/boost/detail/identifier.hpp index 688a664..063d238 100644 --- a/include/boost/detail/identifier.hpp +++ b/include/boost/detail/identifier.hpp @@ -57,9 +57,7 @@ namespace boost identifier() {} explicit identifier( value_type v ) : m_value(v) {} - #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // 1300 == VC++ 7.0 bug workaround private: - #endif T m_value; }; diff --git a/include/boost/detail/indirect_traits.hpp b/include/boost/detail/indirect_traits.hpp old mode 100755 new mode 100644 index f9c0cd6..7c8f76b --- a/include/boost/detail/indirect_traits.hpp +++ b/include/boost/detail/indirect_traits.hpp @@ -26,15 +26,11 @@ # include # include -# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include -# endif namespace boost { namespace detail { namespace indirect_traits { -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template struct is_reference_to_const : mpl::false_ { @@ -199,284 +195,6 @@ struct is_pointer_to_class BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_class,(T)) }; -# else - -using namespace boost::detail::is_function_ref_tester_; - -typedef char (&inner_yes_type)[3]; -typedef char (&inner_no_type)[2]; -typedef char (&outer_no_type)[1]; - -template -struct is_const_help -{ - typedef typename mpl::if_< - is_const - , inner_yes_type - , inner_no_type - >::type type; -}; - -template -struct is_volatile_help -{ - typedef typename mpl::if_< - is_volatile - , inner_yes_type - , inner_no_type - >::type type; -}; - -template -struct is_pointer_help -{ - typedef typename mpl::if_< - is_pointer - , inner_yes_type - , inner_no_type - >::type type; -}; - -template -struct is_class_help -{ - typedef typename mpl::if_< - is_class - , inner_yes_type - , inner_no_type - >::type type; -}; - -template -struct is_reference_to_function_aux -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value = sizeof(detail::is_function_ref_tester(t,0)) == sizeof(::boost::type_traits::yes_type)); - typedef mpl::bool_ type; - }; - -template -struct is_reference_to_function - : mpl::if_, is_reference_to_function_aux, mpl::bool_ >::type -{ -}; - -template -struct is_pointer_to_function_aux -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = sizeof(::boost::type_traits::is_function_ptr_tester(t)) == sizeof(::boost::type_traits::yes_type)); - typedef mpl::bool_ type; -}; - -template -struct is_pointer_to_function - : mpl::if_, is_pointer_to_function_aux, mpl::bool_ >::type -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_function,(T)) -}; - -struct false_helper1 -{ - template - struct apply : mpl::false_ - { - }; -}; - -template -typename is_const_help::type reference_to_const_helper(V&); -outer_no_type -reference_to_const_helper(...); - -struct true_helper1 -{ - template - struct apply - { - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = sizeof(reference_to_const_helper(t)) == sizeof(inner_yes_type)); - typedef mpl::bool_ type; - }; -}; - -template -struct is_reference_to_const_helper1 : true_helper1 -{ -}; - -template <> -struct is_reference_to_const_helper1 : false_helper1 -{ -}; - - -template -struct is_reference_to_const - : is_reference_to_const_helper1::value>::template apply -{ -}; - - -template -struct is_reference_to_non_const_helper1 -{ - template - struct apply - { - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = sizeof(reference_to_const_helper(t)) == sizeof(inner_no_type)); - - typedef mpl::bool_ type; - }; -}; - -template <> -struct is_reference_to_non_const_helper1 : false_helper1 -{ -}; - - -template -struct is_reference_to_non_const - : is_reference_to_non_const_helper1::value>::template apply -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_non_const,(T)) -}; - - -template -typename is_volatile_help::type reference_to_volatile_helper(V&); -outer_no_type -reference_to_volatile_helper(...); - -template -struct is_reference_to_volatile_helper1 -{ - template - struct apply - { - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = sizeof(reference_to_volatile_helper(t)) == sizeof(inner_yes_type)); - typedef mpl::bool_ type; - }; -}; - -template <> -struct is_reference_to_volatile_helper1 : false_helper1 -{ -}; - - -template -struct is_reference_to_volatile - : is_reference_to_volatile_helper1::value>::template apply -{ -}; - -template -typename is_pointer_help::type reference_to_pointer_helper(V&); -outer_no_type reference_to_pointer_helper(...); - -template -struct reference_to_pointer_impl -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = (sizeof((reference_to_pointer_helper)(t)) == sizeof(inner_yes_type)) - ); - - typedef mpl::bool_ type; -}; - -template -struct is_reference_to_pointer - : mpl::eval_if, reference_to_pointer_impl, mpl::false_>::type -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_pointer,(T)) -}; - -template -struct is_reference_to_function_pointer - : mpl::eval_if, is_pointer_to_function_aux, mpl::false_>::type -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_function_pointer,(T)) -}; - - -template -struct is_member_function_pointer_help - : mpl::if_, inner_yes_type, inner_no_type> -{}; - -template -typename is_member_function_pointer_help::type member_function_pointer_helper(V&); -outer_no_type member_function_pointer_helper(...); - -template -struct is_pointer_to_member_function_aux -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = sizeof((member_function_pointer_helper)(t)) == sizeof(inner_yes_type)); - typedef mpl::bool_ type; -}; - -template -struct is_reference_to_member_function_pointer - : mpl::if_< - is_reference - , is_pointer_to_member_function_aux - , mpl::bool_ - >::type -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T)) -}; - -template -typename is_class_help::type reference_to_class_helper(V const volatile&); -outer_no_type reference_to_class_helper(...); - -template -struct is_reference_to_class -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = (is_reference::value - & (sizeof(reference_to_class_helper(t)) == sizeof(inner_yes_type))) - ); - typedef mpl::bool_ type; - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T)) -}; - -template -typename is_class_help::type pointer_to_class_helper(V const volatile*); -outer_no_type pointer_to_class_helper(...); - -template -struct is_pointer_to_class -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = (is_pointer::value - && sizeof(pointer_to_class_helper(t)) == sizeof(inner_yes_type)) - ); - typedef mpl::bool_ type; -}; -# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } diff --git a/include/boost/detail/is_function_ref_tester.hpp b/include/boost/detail/is_function_ref_tester.hpp deleted file mode 100644 index 8e7d1d7..0000000 --- a/include/boost/detail/is_function_ref_tester.hpp +++ /dev/null @@ -1,136 +0,0 @@ - -// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, -// Aleksey Gurtovoy, Howard Hinnant & John Maddock 2000. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#if !defined(BOOST_PP_IS_ITERATING) - -///// header body - -#ifndef BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED -#define BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED - -#include "boost/type_traits/detail/yes_no_type.hpp" -#include "boost/type_traits/config.hpp" - -#if defined(BOOST_TT_PREPROCESSING_MODE) -# include "boost/preprocessor/iterate.hpp" -# include "boost/preprocessor/enum_params.hpp" -# include "boost/preprocessor/comma_if.hpp" -#endif - -namespace boost { -namespace detail { -namespace is_function_ref_tester_ { - -template -boost::type_traits::no_type BOOST_TT_DECL is_function_ref_tester(T& ...); - -#if !defined(BOOST_TT_PREPROCESSING_MODE) -// preprocessor-generated part, don't edit by hand! - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23), int); - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24), int); - -#else - -#define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, 25, "boost/detail/is_function_ref_tester.hpp")) -#include BOOST_PP_ITERATE() - -#endif // BOOST_TT_PREPROCESSING_MODE - -} // namespace detail -} // namespace python -} // namespace boost - -#endif // BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED - -///// iteration - -#else -#define i BOOST_PP_FRAME_ITERATION(1) - -template -boost::type_traits::yes_type is_function_ref_tester(R (&)(BOOST_PP_ENUM_PARAMS(i,T)), int); - -#undef i -#endif // BOOST_PP_IS_ITERATING - diff --git a/include/boost/detail/is_incrementable.hpp b/include/boost/detail/is_incrementable.hpp index e7ef9dc..6b36378 100644 --- a/include/boost/detail/is_incrementable.hpp +++ b/include/boost/detail/is_incrementable.hpp @@ -55,8 +55,7 @@ namespace is_incrementable_ # endif -# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \ - || BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) # define BOOST_comma(a,b) (a) # else // In case an operator++ is found that returns void, we'll use ++x,0 diff --git a/include/boost/detail/is_xxx.hpp b/include/boost/detail/is_xxx.hpp old mode 100755 new mode 100644 index cb64fb3..3f9a126 --- a/include/boost/detail/is_xxx.hpp +++ b/include/boost/detail/is_xxx.hpp @@ -8,39 +8,6 @@ # include # include -# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -# include -# include - -# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \ -template \ -struct is_##name \ -{ \ - typedef char yes; \ - typedef char (&no)[2]; \ - \ - static typename add_reference::type dummy; \ - \ - struct helpers \ - { \ - template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class U) > \ - static yes test( \ - qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, U) >&, int \ - ); \ - \ - template \ - static no test(U&, ...); \ - }; \ - \ - BOOST_STATIC_CONSTANT( \ - bool, value \ - = !is_reference::value \ - & (sizeof(helpers::test(dummy, 0)) == sizeof(yes))); \ - \ - typedef mpl::bool_ type; \ -}; - -# else # define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \ template \ @@ -56,6 +23,5 @@ struct is_##name< \ { \ }; -# endif #endif // BOOST_DETAIL_IS_XXX_DWA20051011_HPP diff --git a/include/boost/detail/iterator.hpp b/include/boost/detail/iterator.hpp index 5bb9c62..abaee26 100644 --- a/include/boost/detail/iterator.hpp +++ b/include/boost/detail/iterator.hpp @@ -71,7 +71,6 @@ # endif // STLPort <= 4.1b4 && no partial specialization # if !defined(BOOST_NO_STD_ITERATOR_TRAITS) \ - && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ && !defined(BOOST_MSVC_STD_ITERATOR) namespace boost { namespace detail { @@ -87,8 +86,7 @@ using std::distance; # else -# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && !defined(BOOST_MSVC_STD_ITERATOR) +# if !defined(BOOST_MSVC_STD_ITERATOR) // This is the case where everything conforms except BOOST_NO_STD_ITERATOR_TRAITS @@ -135,10 +133,6 @@ struct iterator_traits # include # include -# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include -# include -# endif # ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION # include # endif @@ -262,7 +256,6 @@ struct stlport_40_debug_iterator_traits template struct pointer_iterator_traits; -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template struct pointer_iterator_traits { @@ -272,50 +265,6 @@ struct pointer_iterator_traits typedef std::random_access_iterator_tag iterator_category; typedef std::ptrdiff_t difference_type; }; -# else - -// In case of no template partial specialization, and if T is a -// pointer, iterator_traits::value_type can still be computed. For -// some basic types, remove_pointer is manually defined in -// type_traits/broken_compiler_spec.hpp. For others, do it yourself. - -template class please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee; - -template -struct pointer_value_type - : mpl::if_< - is_same::type> - , please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee

- , typename remove_const< - typename remove_pointer

::type - >::type - > -{ -}; - - -template -struct pointer_reference - : mpl::if_< - is_same::type> - , please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee

- , typename remove_pointer

::type& - > -{ -}; - -template -struct pointer_iterator_traits -{ - typedef T pointer; - typedef std::random_access_iterator_tag iterator_category; - typedef std::ptrdiff_t difference_type; - - typedef typename pointer_value_type::type value_type; - typedef typename pointer_reference::type reference; -}; - -# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // We'll sort iterator types into one of these classifications, from which we // can determine the difference_type, pointer, reference, and value_type diff --git a/include/boost/detail/lightweight_test.hpp b/include/boost/detail/lightweight_test.hpp index 49dd5e4..8704d5c 100644 --- a/include/boost/detail/lightweight_test.hpp +++ b/include/boost/detail/lightweight_test.hpp @@ -3,7 +3,7 @@ // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/include/boost/detail/lightweight_thread.hpp b/include/boost/detail/lightweight_thread.hpp deleted file mode 100644 index 6fe70a6..0000000 --- a/include/boost/detail/lightweight_thread.hpp +++ /dev/null @@ -1,135 +0,0 @@ -#ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED -#define BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// boost/detail/lightweight_thread.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include -#include -#include - -// pthread_create, pthread_join - -#if defined( BOOST_HAS_PTHREADS ) - -#include - -#else - -#include -#include - -typedef HANDLE pthread_t; - -int pthread_create( pthread_t * thread, void const *, unsigned (__stdcall * start_routine) (void*), void* arg ) -{ - HANDLE h = (HANDLE)_beginthreadex( 0, 0, start_routine, arg, 0, 0 ); - - if( h != 0 ) - { - *thread = h; - return 0; - } - else - { - return EAGAIN; - } -} - -int pthread_join( pthread_t thread, void ** /*value_ptr*/ ) -{ - ::WaitForSingleObject( thread, INFINITE ); - ::CloseHandle( thread ); - return 0; -} - -#endif - -// template int lw_thread_create( pthread_t & pt, F f ); - -namespace boost -{ - -namespace detail -{ - -class lw_abstract_thread -{ -public: - - virtual ~lw_abstract_thread() {} - virtual void run() = 0; -}; - -#if defined( BOOST_HAS_PTHREADS ) - -extern "C" void * lw_thread_routine( void * pv ) -{ - std::auto_ptr pt( static_cast( pv ) ); - - pt->run(); - - return 0; -} - -#else - -unsigned __stdcall lw_thread_routine( void * pv ) -{ - std::auto_ptr pt( static_cast( pv ) ); - - pt->run(); - - return 0; -} - -#endif - -template class lw_thread_impl: public lw_abstract_thread -{ -public: - - explicit lw_thread_impl( F f ): f_( f ) - { - } - - void run() - { - f_(); - } - -private: - - F f_; -}; - -template int lw_thread_create( pthread_t & pt, F f ) -{ - std::auto_ptr p( new lw_thread_impl( f ) ); - - int r = pthread_create( &pt, 0, lw_thread_routine, p.get() ); - - if( r == 0 ) - { - p.release(); - } - - return r; -} - -} // namespace detail -} // namespace boost - -#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED diff --git a/include/boost/detail/no_exceptions_support.hpp b/include/boost/detail/no_exceptions_support.hpp index d94e358..89336f6 100644 --- a/include/boost/detail/no_exceptions_support.hpp +++ b/include/boost/detail/no_exceptions_support.hpp @@ -1,7 +1,7 @@ #ifndef BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_ #define BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_ -#if (defined _MSC_VER) && (_MSC_VER >= 1200) +#if defined(_MSC_VER) # pragma once #endif diff --git a/include/boost/detail/numeric_traits.hpp b/include/boost/detail/numeric_traits.hpp index 6325d70..2f97ebf 100644 --- a/include/boost/detail/numeric_traits.hpp +++ b/include/boost/detail/numeric_traits.hpp @@ -74,7 +74,7 @@ namespace boost { namespace detail { template struct is_signed { -#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_MSVC) && BOOST_MSVC <= 1300 +#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) BOOST_STATIC_CONSTANT(bool, value = (Number(-1) < Number(0))); #else BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits::is_signed); @@ -128,15 +128,6 @@ namespace boost { namespace detail { private: typedef Integer integer_type; typedef std::numeric_limits x; -# if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // for some reason, MSVC asserts when it shouldn't unless we make these - // local definitions - BOOST_STATIC_CONSTANT(bool, is_integer = x::is_integer); - BOOST_STATIC_CONSTANT(bool, is_specialized = x::is_specialized); - - BOOST_STATIC_ASSERT(is_integer); - BOOST_STATIC_ASSERT(is_specialized); -# endif public: typedef typename if_true<(int(x::is_signed) diff --git a/include/boost/detail/quick_allocator.hpp b/include/boost/detail/quick_allocator.hpp deleted file mode 100644 index d54b3a7..0000000 --- a/include/boost/detail/quick_allocator.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED -#define BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/quick_allocator.hpp -// -// Copyright (c) 2003 David Abrahams -// Copyright (c) 2003 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// - -#include - -#endif // #ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED diff --git a/include/boost/detail/reference_content.hpp b/include/boost/detail/reference_content.hpp index daf56a8..36b80d2 100644 --- a/include/boost/detail/reference_content.hpp +++ b/include/boost/detail/reference_content.hpp @@ -15,13 +15,8 @@ #include "boost/config.hpp" -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) # include "boost/mpl/bool.hpp" # include "boost/type_traits/has_nothrow_copy.hpp" -#else -# include "boost/mpl/if.hpp" -# include "boost/type_traits/is_reference.hpp" -#endif #include "boost/mpl/void.hpp" @@ -78,7 +73,6 @@ public: // queries template struct make_reference_content; -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template struct make_reference_content @@ -92,19 +86,6 @@ struct make_reference_content< T& > typedef reference_content type; }; -#else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - -template -struct make_reference_content - : mpl::if_< - is_reference - , reference_content - , T - > -{ -}; - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround template <> struct make_reference_content< mpl::void_ > @@ -124,7 +105,6 @@ struct make_reference_content< mpl::void_ > // reference_content type traits specializations // -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template struct has_nothrow_copy< @@ -134,7 +114,6 @@ struct has_nothrow_copy< { }; -#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) } // namespace boost diff --git a/include/boost/detail/utf8_codecvt_facet.hpp b/include/boost/detail/utf8_codecvt_facet.hpp index b777ff9..753b339 100644 --- a/include/boost/detail/utf8_codecvt_facet.hpp +++ b/include/boost/detail/utf8_codecvt_facet.hpp @@ -122,9 +122,13 @@ protected: ) const; virtual std::codecvt_base::result do_out( - std::mbstate_t & state, const wchar_t * from, - const wchar_t * from_end, const wchar_t* & from_next, - char * to, char * to_end, char * & to_next + std::mbstate_t & state, + const wchar_t * from, + const wchar_t * from_end, + const wchar_t* & from_next, + char * to, + char * to_end, + char * & to_next ) const; bool invalid_continuing_octet(unsigned char octet_1) const { @@ -137,17 +141,19 @@ protected: } // continuing octets = octets except for the leading octet - static unsigned int get_cont_octet_count(unsigned char lead_octet) { + static unsigned int get_cont_octet_count(unsigned char lead_octet) { return get_octet_count(lead_octet) - 1; } - static unsigned int get_octet_count(unsigned char lead_octet); + static unsigned int get_octet_count(unsigned char lead_octet); // How many "continuing octets" will be needed for this word // == total octets - 1. int get_cont_octet_out_count(wchar_t word) const ; - virtual bool do_always_noconv() const throw() { return false; } + virtual bool do_always_noconv() const BOOST_NOEXCEPT_OR_NOTHROW { + return false; + } // UTF-8 isn't really stateful since we rewind on partial conversions virtual std::codecvt_base::result do_unshift( @@ -155,13 +161,12 @@ protected: char * from, char * /*to*/, char * & next - ) const - { + ) const { next = from; return ok; } - virtual int do_encoding() const throw() { + virtual int do_encoding() const BOOST_NOEXCEPT_OR_NOTHROW { const int variable_byte_external_encoding=0; return variable_byte_external_encoding; } @@ -173,14 +178,10 @@ protected: const char * from, const char * from_end, std::size_t max_limit -#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) - ) const throw(); -#else - ) const; -#endif + ) const; // Largest possible value do_length(state,from,from_end,1) could return. - virtual int do_max_length() const throw () { + virtual int do_max_length() const BOOST_NOEXCEPT_OR_NOTHROW { return 6; // largest UTF-8 encoding of a UCS-4 character } }; diff --git a/include/boost/detail/winapi/basic_types.hpp b/include/boost/detail/winapi/basic_types.hpp index e9ca370..09d907b 100644 --- a/include/boost/detail/winapi/basic_types.hpp +++ b/include/boost/detail/winapi/basic_types.hpp @@ -9,9 +9,9 @@ #ifndef BOOST_DETAIL_WINAPI_BASIC_TYPES_HPP #define BOOST_DETAIL_WINAPI_BASIC_TYPES_HPP -#include #include #include +#include #if defined( BOOST_USE_WINDOWS_H ) # include @@ -31,6 +31,9 @@ # define WINAPI __stdcall # endif # endif +# ifndef NTAPI +# define NTAPI __stdcall +# endif #else # error "Win32 functions not available" #endif @@ -44,11 +47,20 @@ namespace detail { namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) typedef ::BOOL BOOL_; + typedef ::BOOLEAN BOOLEAN_; + typedef ::PBOOLEAN PBOOLEAN_; + typedef ::BYTE BYTE_; typedef ::WORD WORD_; typedef ::DWORD DWORD_; typedef ::HANDLE HANDLE_; + typedef ::HMODULE HMODULE_; typedef ::LONG LONG_; + typedef ::ULONG ULONG_; typedef ::LONGLONG LONGLONG_; + typedef ::ULONGLONG ULONGLONG_; + typedef ::INT_PTR INT_PTR_; + typedef ::UINT_PTR UINT_PTR_; + typedef ::LONG_PTR LONG_PTR_; typedef ::ULONG_PTR ULONG_PTR_; typedef ::LARGE_INTEGER LARGE_INTEGER_; typedef ::PLARGE_INTEGER PLARGE_INTEGER_; @@ -63,32 +75,37 @@ namespace winapi { #else extern "C" { typedef int BOOL_; + typedef unsigned char BYTE_; + typedef BYTE_ BOOLEAN_; + typedef BOOLEAN_* PBOOLEAN_; typedef unsigned short WORD_; typedef unsigned long DWORD_; typedef void* HANDLE_; + typedef void* HMODULE_; typedef long LONG_; + typedef unsigned long ULONG_; -// @FIXME Which condition must be tested -//~ #if !defined(_M_IX86) -//~ #if defined(BOOST_NO_INT64_T) - //~ typedef double LONGLONG_; -//~ #else - //~ typedef __int64 LONGLONG_; -//~ #endif -//~ #else - //~ typedef double LONGLONG_; -//~ #endif typedef boost::int64_t LONGLONG_; + typedef boost::uint64_t ULONGLONG_; // @FIXME Which condition must be tested # ifdef _WIN64 #if defined(__CYGWIN__) + typedef long INT_PTR_; + typedef unsigned long UINT_PTR_; + typedef long LONG_PTR_; typedef unsigned long ULONG_PTR_; #else + typedef __int64 INT_PTR_; + typedef unsigned __int64 UINT_PTR_; + typedef __int64 LONG_PTR_; typedef unsigned __int64 ULONG_PTR_; #endif # else + typedef int INT_PTR_; + typedef unsigned int UINT_PTR_; + typedef long LONG_PTR_; typedef unsigned long ULONG_PTR_; # endif @@ -113,4 +130,5 @@ extern "C" { } } } -#endif // BOOST_DETAIL_WINAPI_TIME_HPP + +#endif // BOOST_DETAIL_WINAPI_BASIC_TYPES_HPP diff --git a/include/boost/detail/winapi/config.hpp b/include/boost/detail/winapi/config.hpp new file mode 100644 index 0000000..2b0cdfb --- /dev/null +++ b/include/boost/detail/winapi/config.hpp @@ -0,0 +1,53 @@ +// config.hpp --------------------------------------------------------------// + +// Copyright 2013 Andrey Semashev + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_CONFIG_HPP_INCLUDED_ +#define BOOST_DETAIL_WINAPI_CONFIG_HPP_INCLUDED_ + +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +// These constants reflect _WIN32_WINNT_* macros from sdkddkver.h +// See also: http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745%28v=vs.85%29.aspx#setting_winver_or__win32_winnt +#define BOOST_WINAPI_VERSION_NT4 0x0400 +#define BOOST_WINAPI_VERSION_WIN2K 0x0500 +#define BOOST_WINAPI_VERSION_WINXP 0x0501 +#define BOOST_WINAPI_VERSION_WS03 0x0502 +#define BOOST_WINAPI_VERSION_WIN6 0x0600 +#define BOOST_WINAPI_VERSION_VISTA 0x0600 +#define BOOST_WINAPI_VERSION_WS08 0x0600 +#define BOOST_WINAPI_VERSION_LONGHORN 0x0600 +#define BOOST_WINAPI_VERSION_WIN7 0x0601 +#define BOOST_WINAPI_VERSION_WIN8 0x0602 +#define BOOST_WINAPI_VERSION_WINBLUE 0x0603 + +#if !defined(BOOST_USE_WINAPI_VERSION) +#if defined(_WIN32_WINNT) +#define BOOST_USE_WINAPI_VERSION _WIN32_WINNT +#elif defined(WINVER) +#define BOOST_USE_WINAPI_VERSION WINVER +#else +// By default use Windows XP API +#define BOOST_USE_WINAPI_VERSION BOOST_WINAPI_VERSION_WINXP +#endif +#endif + +#if defined(BOOST_USE_WINDOWS_H) +// We have to define the version macros so that windows.h provides the necessary symbols +#if !defined(_WIN32_WINNT) +#define _WIN32_WINNT BOOST_USE_WINAPI_VERSION +#endif +#if !defined(WINVER) +#define WINVER BOOST_USE_WINAPI_VERSION +#endif +#endif + +#endif // BOOST_DETAIL_WINAPI_CONFIG_HPP_INCLUDED_ diff --git a/include/boost/detail/winapi/dll.hpp b/include/boost/detail/winapi/dll.hpp index ed45272..2ec5a73 100644 --- a/include/boost/detail/winapi/dll.hpp +++ b/include/boost/detail/winapi/dll.hpp @@ -23,33 +23,64 @@ namespace detail namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) - using ::LoadLibrary; + typedef ::FARPROC FARPROC_; + typedef ::NEARPROC NEARPROC_; + typedef ::PROC PROC_; + +# ifdef BOOST_NO_ANSI_APIS + using ::LoadLibraryW; + using ::GetModuleHandleW; +# else + using ::LoadLibraryA; + using ::GetModuleHandleA; +# endif using ::FreeLibrary; using ::GetProcAddress; - using ::GetModuleHandleA; #else -extern "C" { - __declspec(dllimport) HMODULE_ __stdcall - LoadLibrary( - LPCTSTR_ lpFileName +extern "C" { +# ifdef _WIN64 + typedef INT_PTR_ (WINAPI *FARPROC_)(); + typedef INT_PTR_ (WINAPI *NEARPROC_)(); + typedef INT_PTR_ (WINAPI *PROC_)(); +# else + typedef int (WINAPI *FARPROC_)(); + typedef int (WINAPI *NEARPROC_)(); + typedef int (WINAPI *PROC_)(); +# endif // _WIN64 + +# ifdef BOOST_NO_ANSI_APIS + __declspec(dllimport) HMODULE_ WINAPI + LoadLibraryW( + LPCWSTR_ lpFileName ); - __declspec(dllimport) BOOL_ __stdcall + __declspec(dllimport) HMODULE_ WINAPI + GetModuleHandleW( + LPCWSTR_ lpFileName + ); +# else + __declspec(dllimport) HMODULE_ WINAPI + LoadLibraryA( + LPCSTR_ lpFileName + ); + __declspec(dllimport) HMODULE_ WINAPI + GetModuleHandleA( + LPCSTR_ lpFileName + ); +# endif + + __declspec(dllimport) BOOL_ WINAPI FreeLibrary( HMODULE_ hModule ); - __declspec(dllimport) FARPROC_ __stdcall + __declspec(dllimport) FARPROC_ WINAPI GetProcAddress( HMODULE_ hModule, LPCSTR_ lpProcName ); - __declspec(dllimport) FARPROC_ __stdcall - GetModuleHandleA( - LPCSTR_ lpProcName - ); -} +} #endif } } } -#endif // BOOST_DETAIL_WINAPI_THREAD_HPP +#endif // BOOST_DETAIL_WINAPI_DLL_HPP diff --git a/include/boost/detail/winapi/handles.hpp b/include/boost/detail/winapi/handles.hpp index d4cffc8..7108daa 100644 --- a/include/boost/detail/winapi/handles.hpp +++ b/include/boost/detail/winapi/handles.hpp @@ -24,14 +24,20 @@ namespace winapi #if defined( BOOST_USE_WINDOWS_H ) using ::CloseHandle; using ::DuplicateHandle; + + const DWORD_ duplicate_close_source = DUPLICATE_CLOSE_SOURCE; + const DWORD_ duplicate_same_access = DUPLICATE_SAME_ACCESS; + const HANDLE_ invalid_handle_value = INVALID_HANDLE_VALUE; #else -extern "C" { - __declspec(dllimport) int __stdcall +extern "C" { + __declspec(dllimport) int __stdcall CloseHandle(void*); - __declspec(dllimport) int __stdcall + __declspec(dllimport) int __stdcall DuplicateHandle(void*,void*,void*,void**,unsigned long,int,unsigned long); } - + const DWORD_ duplicate_close_source = 1; + const DWORD_ duplicate_same_access = 2; + const HANDLE_ invalid_handle_value = (HANDLE_)(-1); #endif } } diff --git a/include/boost/detail/winapi/process.hpp b/include/boost/detail/winapi/process.hpp index 411ffaf..de287b1 100644 --- a/include/boost/detail/winapi/process.hpp +++ b/include/boost/detail/winapi/process.hpp @@ -23,10 +23,9 @@ namespace winapi { using ::GetCurrentProcessId; #else # ifndef UNDER_CE -extern "C" { - __declspec(dllimport) unsigned long __stdcall - GetCurrentProcessId(void); -} +extern "C" { + __declspec(dllimport) DWORD_ WINAPI GetCurrentProcessId(void); +} # else using ::GetCurrentProcessId; # endif diff --git a/include/boost/detail/winapi/synchronization.hpp b/include/boost/detail/winapi/synchronization.hpp index 5d3327a..b9497cb 100644 --- a/include/boost/detail/winapi/synchronization.hpp +++ b/include/boost/detail/winapi/synchronization.hpp @@ -25,7 +25,26 @@ namespace winapi typedef ::CRITICAL_SECTION CRITICAL_SECTION_; typedef ::PAPCFUNC PAPCFUNC_; +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + typedef ::INIT_ONCE INIT_ONCE_; + typedef ::PINIT_ONCE PINIT_ONCE_; + typedef ::LPINIT_ONCE LPINIT_ONCE_; + #define BOOST_DETAIL_WINAPI_INIT_ONCE_STATIC_INIT INIT_ONCE_STATIC_INIT + typedef ::PINIT_ONCE_FN PINIT_ONCE_FN_; + + typedef ::SRWLOCK SRWLOCK_; + typedef ::PSRWLOCK PSRWLOCK_; + #define BOOST_DETAIL_WINAPI_SRWLOCK_INIT SRWLOCK_INIT + + typedef ::CONDITION_VARIABLE CONDITION_VARIABLE_; + typedef ::PCONDITION_VARIABLE PCONDITION_VARIABLE_; + #define BOOST_DETAIL_WINAPI_CONDITION_VARIABLE_INIT CONDITION_VARIABLE_INIT +#endif + using ::InitializeCriticalSection; +#if BOOST_USE_WINAPI_VERSION >= 0x0403 + using ::InitializeCriticalSectionAndSpinCount; +#endif using ::EnterCriticalSection; using ::TryEnterCriticalSection; using ::LeaveCriticalSection; @@ -33,14 +52,18 @@ namespace winapi # ifdef BOOST_NO_ANSI_APIS using ::CreateMutexW; + using ::OpenMutexW; using ::CreateEventW; using ::OpenEventW; using ::CreateSemaphoreW; + using ::OpenSemaphoreW; # else using ::CreateMutexA; + using ::OpenMutexA; using ::CreateEventA; using ::OpenEventA; using ::CreateSemaphoreA; + using ::OpenSemaphoreA; # endif using ::ReleaseMutex; using ::ReleaseSemaphore; @@ -50,17 +73,47 @@ namespace winapi using ::WaitForSingleObject; using ::QueueUserAPC; +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + using ::InitOnceInitialize; + using ::InitOnceExecuteOnce; + using ::InitOnceBeginInitialize; + using ::InitOnceComplete; + + using ::InitializeSRWLock; + using ::AcquireSRWLockExclusive; + using ::TryAcquireSRWLockExclusive; + using ::ReleaseSRWLockExclusive; + using ::AcquireSRWLockShared; + using ::TryAcquireSRWLockShared; + using ::ReleaseSRWLockShared; + + using ::InitializeConditionVariable; + using ::WakeConditionVariable; + using ::WakeAllConditionVariable; + using ::SleepConditionVariableCS; + using ::SleepConditionVariableSRW; +#endif + const DWORD_ infinite = INFINITE; const DWORD_ wait_abandoned = WAIT_ABANDONED; const DWORD_ wait_object_0 = WAIT_OBJECT_0; const DWORD_ wait_timeout = WAIT_TIMEOUT; const DWORD_ wait_failed = WAIT_FAILED; +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + const DWORD_ init_once_async = INIT_ONCE_ASYNC; + const DWORD_ init_once_check_only = INIT_ONCE_CHECK_ONLY; + const DWORD_ init_once_init_failed = INIT_ONCE_INIT_FAILED; + const DWORD_ init_once_ctx_reserved_bits = INIT_ONCE_CTX_RESERVED_BITS; + + const ULONG_ condition_variable_lockmode_shared = CONDITION_VARIABLE_LOCKMODE_SHARED; +#endif + #else // defined( BOOST_USE_WINDOWS_H ) extern "C" { - struct CRITICAL_SECTION_ + typedef struct CRITICAL_SECTION_ { struct critical_section_debug * DebugInfo; long LockCount; @@ -72,73 +125,167 @@ extern "C" { #else unsigned long SpinCount; #endif - }; + } + *PCRITICAL_SECTION_; - __declspec(dllimport) void __stdcall - InitializeCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) void __stdcall - EnterCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) bool __stdcall - TryEnterCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) void __stdcall - LeaveCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) void __stdcall - DeleteCriticalSection(CRITICAL_SECTION_ *); +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + typedef union INIT_ONCE_ + { + PVOID_ Ptr; + } + *PINIT_ONCE_, *LPINIT_ONCE_; + #define BOOST_DETAIL_WINAPI_INIT_ONCE_STATIC_INIT {0} + typedef BOOL_ (WINAPI *PINIT_ONCE_FN_)(PINIT_ONCE_ InitOnce, PVOID_ Parameter, PVOID_ *Context); - struct _SECURITY_ATTRIBUTES; + typedef struct SRWLOCK_ + { + PVOID_ Ptr; + } + * PSRWLOCK_; + #define BOOST_DETAIL_WINAPI_SRWLOCK_INIT {0} + + typedef struct CONDITION_VARIABLE_ + { + PVOID_ Ptr; + } + * PCONDITION_VARIABLE_; + #define BOOST_DETAIL_WINAPI_CONDITION_VARIABLE_INIT {0} + +#endif + + __declspec(dllimport) void WINAPI + InitializeCriticalSection(PCRITICAL_SECTION_); +#if BOOST_USE_WINAPI_VERSION >= 0x0403 + __declspec(dllimport) BOOL_ WINAPI + InitializeCriticalSectionAndSpinCount(CRITICAL_SECTION_* lpCS, DWORD_ dwSpinCount); +#endif + __declspec(dllimport) void WINAPI + EnterCriticalSection(PCRITICAL_SECTION_); + __declspec(dllimport) BOOL_ WINAPI + TryEnterCriticalSection(PCRITICAL_SECTION_); + __declspec(dllimport) void WINAPI + LeaveCriticalSection(PCRITICAL_SECTION_); + __declspec(dllimport) void WINAPI + DeleteCriticalSection(PCRITICAL_SECTION_); + + struct _SECURITY_ATTRIBUTES; # ifdef BOOST_NO_ANSI_APIS - __declspec(dllimport) void* __stdcall - CreateMutexW(_SECURITY_ATTRIBUTES*,int,wchar_t const*); - __declspec(dllimport) void* __stdcall - CreateSemaphoreW(_SECURITY_ATTRIBUTES*,long,long,wchar_t const*); - __declspec(dllimport) void* __stdcall - CreateEventW(_SECURITY_ATTRIBUTES*,int,int,wchar_t const*); - __declspec(dllimport) void* __stdcall - OpenEventW(unsigned long,int,wchar_t const*); + __declspec(dllimport) HANDLE_ WINAPI + CreateMutexW(_SECURITY_ATTRIBUTES*, BOOL_, LPCWSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenMutexW(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCWSTR_ lpName); + __declspec(dllimport) HANDLE_ WINAPI + CreateSemaphoreW(_SECURITY_ATTRIBUTES*, LONG_, LONG_, LPCWSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenSemaphoreW(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCWSTR_ lpName); + __declspec(dllimport) HANDLE_ WINAPI + CreateEventW(_SECURITY_ATTRIBUTES*, BOOL_, BOOL_, LPCWSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenEventW(DWORD_, BOOL_, LPCWSTR_); # else - __declspec(dllimport) void* __stdcall - CreateMutexA(_SECURITY_ATTRIBUTES*,int,char const*); - __declspec(dllimport) void* __stdcall - CreateSemaphoreA(_SECURITY_ATTRIBUTES*,long,long,char const*); - __declspec(dllimport) void* __stdcall - CreateEventA(_SECURITY_ATTRIBUTES*,int,int,char const*); - __declspec(dllimport) void* __stdcall - OpenEventA(unsigned long,int,char const*); -# endif - __declspec(dllimport) int __stdcall - ReleaseMutex(void*); - __declspec(dllimport) unsigned long __stdcall - WaitForSingleObject(void*,unsigned long); - __declspec(dllimport) unsigned long __stdcall - WaitForMultipleObjects(unsigned long nCount, - void* const * lpHandles, - int bWaitAll, - unsigned long dwMilliseconds); - __declspec(dllimport) int __stdcall - ReleaseSemaphore(void*,long,long*); - typedef void (__stdcall *PAPCFUNC8)(ULONG_PTR_); - __declspec(dllimport) unsigned long __stdcall - QueueUserAPC(PAPCFUNC8,void*,ULONG_PTR_); -# ifndef UNDER_CE - __declspec(dllimport) int __stdcall - SetEvent(void*); - __declspec(dllimport) int __stdcall - ResetEvent(void*); -# else - using ::SetEvent; - using ::ResetEvent; + __declspec(dllimport) HANDLE_ WINAPI + CreateMutexA(_SECURITY_ATTRIBUTES*, BOOL_, LPCSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenMutexA(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCSTR_ lpName); + __declspec(dllimport) HANDLE_ WINAPI + CreateSemaphoreA(_SECURITY_ATTRIBUTES*, LONG_, LONG_, LPCSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenSemaphoreA(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCSTR_ lpName); + __declspec(dllimport) HANDLE_ WINAPI + CreateEventA(_SECURITY_ATTRIBUTES*, BOOL_, BOOL_, LPCSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenEventA(DWORD_, BOOL_, LPCSTR_); # endif + __declspec(dllimport) BOOL_ WINAPI + ReleaseMutex(HANDLE_); + __declspec(dllimport) DWORD_ WINAPI + WaitForSingleObject(HANDLE_, DWORD_); + __declspec(dllimport) DWORD_ WINAPI + WaitForMultipleObjects(DWORD_ nCount, + HANDLE_ const * lpHandles, + BOOL_ bWaitAll, + DWORD_ dwMilliseconds); + __declspec(dllimport) BOOL_ WINAPI + ReleaseSemaphore(HANDLE_, LONG_, LONG_*); + __declspec(dllimport) BOOL_ WINAPI + SetEvent(HANDLE_); + __declspec(dllimport) BOOL_ WINAPI + ResetEvent(HANDLE_); + + typedef void (__stdcall *PAPCFUNC_)(ULONG_PTR_); + __declspec(dllimport) DWORD_ WINAPI + QueueUserAPC(PAPCFUNC_, HANDLE_, ULONG_PTR_); + +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + __declspec(dllimport) void WINAPI InitOnceInitialize(PINIT_ONCE_); + __declspec(dllimport) BOOL_ WINAPI InitOnceExecuteOnce(PINIT_ONCE_ InitOnce, PINIT_ONCE_FN_ InitFn, PVOID_ Parameter, LPVOID_* Context); + __declspec(dllimport) BOOL_ WINAPI InitOnceBeginInitialize(LPINIT_ONCE_ lpInitOnce, DWORD_ dwFlags, BOOL_* fPending, LPVOID_* lpContext); + __declspec(dllimport) BOOL_ WINAPI InitOnceComplete(LPINIT_ONCE_ lpInitOnce, DWORD_ dwFlags, LPVOID_* lpContext); + + + __declspec(dllimport) void WINAPI InitializeSRWLock(PSRWLOCK_ SRWLock); + __declspec(dllimport) void WINAPI AcquireSRWLockExclusive(PSRWLOCK_ SRWLock); + __declspec(dllimport) BOOLEAN_ WINAPI TryAcquireSRWLockExclusive(PSRWLOCK_ SRWLock); + __declspec(dllimport) void WINAPI ReleaseSRWLockExclusive(PSRWLOCK_ SRWLock); + __declspec(dllimport) void WINAPI AcquireSRWLockShared(PSRWLOCK_ SRWLock); + __declspec(dllimport) BOOLEAN_ WINAPI TryAcquireSRWLockShared(PSRWLOCK_ SRWLock); + __declspec(dllimport) void WINAPI ReleaseSRWLockShared(PSRWLOCK_ SRWLock); + + __declspec(dllimport) void WINAPI InitializeConditionVariable(PCONDITION_VARIABLE_ ConditionVariable); + __declspec(dllimport) void WINAPI WakeConditionVariable(PCONDITION_VARIABLE_ ConditionVariable); + __declspec(dllimport) void WINAPI WakeAllConditionVariable(PCONDITION_VARIABLE_ ConditionVariable); + __declspec(dllimport) BOOL_ WINAPI SleepConditionVariableCS(PCONDITION_VARIABLE_ ConditionVariable, PCRITICAL_SECTION_ CriticalSection, DWORD_ dwMilliseconds); + __declspec(dllimport) BOOL_ WINAPI SleepConditionVariableSRW(PCONDITION_VARIABLE_ ConditionVariable, PSRWLOCK_ SRWLock, DWORD_ dwMilliseconds, ULONG_ Flags); +#endif } // extern "C" - const DWORD_ infinite = (DWORD_)0xFFFFFFFF; - const DWORD_ wait_abandoned = 0x00000080L; - const DWORD_ wait_object_0 = 0x00000000L; - const DWORD_ wait_timeout = 0x00000102L; - const DWORD_ wait_failed = (DWORD_)0xFFFFFFFF; +const DWORD_ infinite = (DWORD_)0xFFFFFFFF; +const DWORD_ wait_abandoned = 0x00000080L; +const DWORD_ wait_object_0 = 0x00000000L; +const DWORD_ wait_timeout = 0x00000102L; +const DWORD_ wait_failed = (DWORD_)0xFFFFFFFF; + +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 +const DWORD_ init_once_async = 0x00000002UL; +const DWORD_ init_once_check_only = 0x00000001UL; +const DWORD_ init_once_init_failed = 0x00000004UL; +const DWORD_ init_once_ctx_reserved_bits = 2; + +const ULONG_ condition_variable_lockmode_shared = 0x00000001; +#endif #endif // defined( BOOST_USE_WINDOWS_H ) +const DWORD_ max_non_infinite_wait = (DWORD_)0xFFFFFFFE; + +BOOST_FORCEINLINE HANDLE_ create_anonymous_mutex(_SECURITY_ATTRIBUTES* lpAttributes, BOOL_ bInitialOwner) +{ +#ifdef BOOST_NO_ANSI_APIS + return CreateMutexW(lpAttributes, bInitialOwner, 0); +#else + return CreateMutexA(lpAttributes, bInitialOwner, 0); +#endif +} + +BOOST_FORCEINLINE HANDLE_ create_anonymous_semaphore(_SECURITY_ATTRIBUTES* lpAttributes, LONG_ lInitialCount, LONG_ lMaximumCount) +{ +#ifdef BOOST_NO_ANSI_APIS + return CreateSemaphoreW(lpAttributes, lInitialCount, lMaximumCount, 0); +#else + return CreateSemaphoreA(lpAttributes, lInitialCount, lMaximumCount, 0); +#endif +} + +BOOST_FORCEINLINE HANDLE_ create_anonymous_event(_SECURITY_ATTRIBUTES* lpAttributes, BOOL_ bManualReset, BOOL_ bInitialState) +{ +#ifdef BOOST_NO_ANSI_APIS + return CreateEventW(lpAttributes, bManualReset, bInitialState, 0); +#else + return CreateEventA(lpAttributes, bManualReset, bInitialState, 0); +#endif +} + } } } diff --git a/include/boost/detail/winapi/thread.hpp b/include/boost/detail/winapi/thread.hpp index 3c1be66..ee0dac6 100644 --- a/include/boost/detail/winapi/thread.hpp +++ b/include/boost/detail/winapi/thread.hpp @@ -26,21 +26,21 @@ namespace winapi using ::GetCurrentThreadId; using ::SleepEx; using ::Sleep; + using ::SwitchToThread; #else -extern "C" { +extern "C" { # ifndef UNDER_CE - __declspec(dllimport) unsigned long __stdcall - GetCurrentThreadId(void); - __declspec(dllimport) unsigned long __stdcall - SleepEx(unsigned long,int); - __declspec(dllimport) void __stdcall - Sleep(unsigned long); + __declspec(dllimport) DWORD_ WINAPI GetCurrentThreadId(void); + __declspec(dllimport) DWORD_ WINAPI SleepEx(DWORD_, BOOL_); + __declspec(dllimport) void WINAPI Sleep(DWORD_); + __declspec(dllimport) BOOL_ WINAPI SwitchToThread(void); #else using ::GetCurrentThreadId; using ::SleepEx; using ::Sleep; -#endif -} + using ::SwitchToThread; +#endif +} #endif } } diff --git a/include/boost/detail/winapi/thread_pool.hpp b/include/boost/detail/winapi/thread_pool.hpp new file mode 100644 index 0000000..57059dc --- /dev/null +++ b/include/boost/detail/winapi/thread_pool.hpp @@ -0,0 +1,96 @@ +// thread_pool.hpp --------------------------------------------------------------// + +// Copyright 2013 Andrey Semashev + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_THREAD_POOL_HPP +#define BOOST_DETAIL_WINAPI_THREAD_POOL_HPP + +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN2K + +namespace boost +{ +namespace detail +{ +namespace winapi +{ +#if defined( BOOST_USE_WINDOWS_H ) + +typedef ::WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACKFUNC_; +typedef ::WAITORTIMERCALLBACK WAITORTIMERCALLBACK_; + +using ::RegisterWaitForSingleObject; +using ::UnregisterWait; +using ::UnregisterWaitEx; + +const ULONG_ wt_execute_default = WT_EXECUTEDEFAULT; +const ULONG_ wt_execute_in_io_thread = WT_EXECUTEINIOTHREAD; +const ULONG_ wt_execute_in_ui_thread = WT_EXECUTEINUITHREAD; +const ULONG_ wt_execute_in_wait_thread = WT_EXECUTEINWAITTHREAD; +const ULONG_ wt_execute_only_once = WT_EXECUTEONLYONCE; +const ULONG_ wt_execute_in_timer_thread = WT_EXECUTEINTIMERTHREAD; +const ULONG_ wt_execute_long_function = WT_EXECUTELONGFUNCTION; +const ULONG_ wt_execute_in_persistent_io_thread = WT_EXECUTEINPERSISTENTIOTHREAD; +const ULONG_ wt_execute_in_persistent_thread = WT_EXECUTEINPERSISTENTTHREAD; +const ULONG_ wt_transfer_impersonation = WT_TRANSFER_IMPERSONATION; + +inline ULONG_ wt_set_max_threadpool_threads(ULONG_ flags, ULONG_ limit) +{ + return WT_SET_MAX_THREADPOOL_THREADS(flags, limit); +} + +#else + +extern "C" { + +typedef void (NTAPI* WAITORTIMERCALLBACKFUNC_) (PVOID_, BOOLEAN_); +typedef WAITORTIMERCALLBACKFUNC_ WAITORTIMERCALLBACK_; + +__declspec(dllimport) BOOL_ WINAPI RegisterWaitForSingleObject +( + HANDLE_* phNewWaitObject, + HANDLE_ hObject, + WAITORTIMERCALLBACK_ Callback, + PVOID_ Context, + ULONG_ dwMilliseconds, + ULONG_ dwFlags +); + +__declspec(dllimport) BOOL_ WINAPI UnregisterWait(HANDLE_ WaitHandle); +__declspec(dllimport) BOOL_ WINAPI UnregisterWaitEx(HANDLE_ WaitHandle, HANDLE_ CompletionEvent); + +} // extern "C" + +const ULONG_ wt_execute_default = 0x00000000; +const ULONG_ wt_execute_in_io_thread = 0x00000001; +const ULONG_ wt_execute_in_ui_thread = 0x00000002; +const ULONG_ wt_execute_in_wait_thread = 0x00000004; +const ULONG_ wt_execute_only_once = 0x00000008; +const ULONG_ wt_execute_in_timer_thread = 0x00000020; +const ULONG_ wt_execute_long_function = 0x00000010; +const ULONG_ wt_execute_in_persistent_io_thread = 0x00000040; +const ULONG_ wt_execute_in_persistent_thread = 0x00000080; +const ULONG_ wt_transfer_impersonation = 0x00000100; + +inline ULONG_ wt_set_max_threadpool_threads(ULONG_ flags, ULONG_ limit) +{ + return flags | (limit << 16); +} + +#endif +} +} +} + +#endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN2K + +#endif // BOOST_DETAIL_WINAPI_THREAD_POOL_HPP diff --git a/include/boost/detail/winapi/time.hpp b/include/boost/detail/winapi/time.hpp index b3e4c44..b58df63 100644 --- a/include/boost/detail/winapi/time.hpp +++ b/include/boost/detail/winapi/time.hpp @@ -18,7 +18,9 @@ namespace boost { namespace detail { namespace winapi { + #if defined( BOOST_USE_WINDOWS_H ) + typedef FILETIME FILETIME_; typedef PFILETIME PFILETIME_; typedef LPFILETIME LPFILETIME_; @@ -33,8 +35,12 @@ namespace winapi { using ::GetSystemTime; using ::SystemTimeToFileTime; using ::GetTickCount; + #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + using ::GetTickCount64; + #endif #else + extern "C" { typedef struct _FILETIME { DWORD_ dwLowDateTime; @@ -66,7 +72,12 @@ extern "C" { FILETIME_* lpFileTime); __declspec(dllimport) DWORD_ WINAPI GetTickCount(); + #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + __declspec(dllimport) ULONGLONG_ WINAPI + GetTickCount64(); + #endif } + #endif #ifndef BOOST_HAS_GETSYSTEMTIMEASFILETIME diff --git a/include/boost/detail/winapi/tls.hpp b/include/boost/detail/winapi/tls.hpp new file mode 100644 index 0000000..d948693 --- /dev/null +++ b/include/boost/detail/winapi/tls.hpp @@ -0,0 +1,49 @@ +// tls.hpp --------------------------------------------------------------// + +// Copyright 2013 Andrey Semashev + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_TLS_HPP +#define BOOST_DETAIL_WINAPI_TLS_HPP + +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost +{ +namespace detail +{ +namespace winapi +{ +#if defined( BOOST_USE_WINDOWS_H ) + +using ::TlsAlloc; +using ::TlsGetValue; +using ::TlsSetValue; +using ::TlsFree; + +const DWORD_ tls_out_of_indexes = TLS_OUT_OF_INDEXES; + +#else + +extern "C" { +__declspec(dllimport) DWORD_ WINAPI TlsAlloc(void); +__declspec(dllimport) LPVOID_ WINAPI TlsGetValue(DWORD_ dwTlsIndex); +__declspec(dllimport) BOOL_ WINAPI TlsSetValue(DWORD_ dwTlsIndex, LPVOID_ lpTlsValue); +__declspec(dllimport) BOOL_ WINAPI TlsFree(DWORD_ dwTlsIndex); +} + +const DWORD_ tls_out_of_indexes = 0xFFFFFFFF; + +#endif +} +} +} + +#endif // BOOST_DETAIL_WINAPI_TLS_HPP diff --git a/include/boost/detail/winapi/waitable_timer.hpp b/include/boost/detail/winapi/waitable_timer.hpp new file mode 100644 index 0000000..52a7338 --- /dev/null +++ b/include/boost/detail/winapi/waitable_timer.hpp @@ -0,0 +1,110 @@ +// waitable_timer.hpp --------------------------------------------------------------// + +// Copyright 2013 Andrey Semashev + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_WAITABLE_TIMER_HPP +#define BOOST_DETAIL_WINAPI_WAITABLE_TIMER_HPP + +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost +{ +namespace detail +{ +namespace winapi +{ +#if defined( BOOST_USE_WINDOWS_H ) + +typedef ::PTIMERAPCROUTINE PTIMERAPCROUTINE_; + +# ifdef BOOST_NO_ANSI_APIS +using ::CreateWaitableTimerW; +using ::OpenWaitableTimerW; +# else +using ::CreateWaitableTimerA; +using ::OpenWaitableTimerA; +# endif +using ::SetWaitableTimer; +using ::CancelWaitableTimer; + +#else + +extern "C" { + +struct _SECURITY_ATTRIBUTES; + +typedef void (WINAPI* PTIMERAPCROUTINE_) +( + LPVOID_ lpArgToCompletionRoutine, + DWORD_ dwTimerLowValue, + DWORD_ dwTimerHighValue +); + +# ifdef BOOST_NO_ANSI_APIS +__declspec(dllimport) HANDLE_ WINAPI CreateWaitableTimerW +( + _SECURITY_ATTRIBUTES* lpTimerAttributes, + BOOL_ bManualReset, + LPCWSTR_ lpTimerName +); + +__declspec(dllimport) HANDLE_ WINAPI OpenWaitableTimerW +( + DWORD_ dwDesiredAccess, + BOOL_ bInheritHandle, + LPCWSTR_ lpTimerName +); +# else +__declspec(dllimport) HANDLE_ WINAPI CreateWaitableTimerA +( + _SECURITY_ATTRIBUTES* lpTimerAttributes, + BOOL_ bManualReset, + LPCSTR_ lpTimerName +); + +__declspec(dllimport) HANDLE_ WINAPI OpenWaitableTimerA +( + DWORD_ dwDesiredAccess, + BOOL_ bInheritHandle, + LPCSTR_ lpTimerName +); +# endif + +__declspec(dllimport) BOOL_ WINAPI SetWaitableTimer +( + HANDLE_ hTimer, + const LARGE_INTEGER_ *lpDueTime, + LONG_ lPeriod, + PTIMERAPCROUTINE_ pfnCompletionRoutine, + LPVOID_ lpArgToCompletionRoutine, + BOOL_ fResume +); + +__declspec(dllimport) BOOL_ WINAPI CancelWaitableTimer(HANDLE_ hTimer); + +} + +#endif + +BOOST_FORCEINLINE HANDLE_ create_anonymous_waitable_timer(_SECURITY_ATTRIBUTES* lpTimerAttributes, BOOL_ bManualReset) +{ +#ifdef BOOST_NO_ANSI_APIS + return CreateWaitableTimerW(lpTimerAttributes, bManualReset, 0); +#else + return CreateWaitableTimerA(lpTimerAttributes, bManualReset, 0); +#endif +} + +} +} +} + +#endif // BOOST_DETAIL_WINAPI_WAITABLE_TIMER_HPP