From 92216628cac2313c03f7c4effec5aefb6b003261 Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Tue, 30 Nov 2004 07:29:46 +0000 Subject: [PATCH] Removed part of the Boost files from the SPIRIT_MINIBOOST branch. [SVN r26366] --- include/boost/python/arg_from_python.hpp | 76 -- include/boost/python/args.hpp | 175 ----- include/boost/python/args_fwd.hpp | 52 -- include/boost/python/back_reference.hpp | 102 --- include/boost/python/base_type_traits.hpp | 43 - include/boost/python/bases.hpp | 68 -- include/boost/python/borrowed.hpp | 21 - include/boost/python/call.hpp | 79 -- include/boost/python/call_method.hpp | 79 -- include/boost/python/cast.hpp | 106 --- include/boost/python/class.hpp | 611 -------------- include/boost/python/class_fwd.hpp | 24 - .../python/converter/arg_from_python.hpp | 343 -------- .../boost/python/converter/arg_to_python.hpp | 261 ------ .../python/converter/arg_to_python_base.hpp | 32 - .../converter/as_to_python_function.hpp | 46 -- .../python/converter/builtin_converters.hpp | 144 ---- .../python/converter/constructor_function.hpp | 17 - .../converter/context_result_converter.hpp | 17 - .../python/converter/convertible_function.hpp | 14 - .../boost/python/converter/from_python.hpp | 41 - include/boost/python/converter/implicit.hpp | 42 - .../converter/obj_mgr_arg_from_python.hpp | 121 --- .../boost/python/converter/object_manager.hpp | 230 ------ .../python/converter/pointer_type_id.hpp | 68 -- .../python/converter/pyobject_traits.hpp | 41 - .../boost/python/converter/pyobject_type.hpp | 34 - .../converter/pytype_object_mgr_traits.hpp | 42 - include/boost/python/converter/registered.hpp | 59 -- .../python/converter/registered_pointee.hpp | 62 -- .../boost/python/converter/registrations.hpp | 84 -- include/boost/python/converter/registry.hpp | 49 -- .../python/converter/return_from_python.hpp | 162 ---- .../converter/rvalue_from_python_data.hpp | 140 ---- .../python/converter/shared_ptr_deleter.hpp | 22 - .../converter/shared_ptr_from_python.hpp | 52 -- .../python/converter/shared_ptr_to_python.hpp | 28 - .../converter/to_python_function_type.hpp | 19 - include/boost/python/copy_const_reference.hpp | 43 - .../boost/python/copy_non_const_reference.hpp | 43 - include/boost/python/data_members.hpp | 316 -------- include/boost/python/def.hpp | 114 --- include/boost/python/def_visitor.hpp | 86 -- .../boost/python/default_call_policies.hpp | 84 -- .../boost/python/detail/aix_init_module.hpp | 26 - .../boost/python/detail/api_placeholder.hpp | 18 - include/boost/python/detail/borrowed_ptr.hpp | 111 --- include/boost/python/detail/caller.hpp | 220 ------ include/boost/python/detail/config.hpp | 116 --- include/boost/python/detail/construct.hpp | 42 - include/boost/python/detail/convertible.hpp | 38 - .../python/detail/copy_ctor_mutates_rhs.hpp | 21 - include/boost/python/detail/cv_category.hpp | 36 - include/boost/python/detail/dealloc.hpp | 17 - .../boost/python/detail/decorated_type_id.hpp | 76 -- include/boost/python/detail/decref_guard.hpp | 21 - include/boost/python/detail/def_helper.hpp | 212 ----- .../boost/python/detail/def_helper_fwd.hpp | 17 - include/boost/python/detail/defaults_def.hpp | 291 ------- include/boost/python/detail/defaults_gen.hpp | 388 --------- include/boost/python/detail/dependent.hpp | 27 - include/boost/python/detail/destroy.hpp | 106 --- include/boost/python/detail/enable_if.hpp | 72 -- .../boost/python/detail/exception_handler.hpp | 48 -- .../boost/python/detail/force_instantiate.hpp | 32 - include/boost/python/detail/if_else.hpp | 116 --- .../boost/python/detail/indirect_traits.hpp | 13 - include/boost/python/detail/invoke.hpp | 100 --- include/boost/python/detail/is_auto_ptr.hpp | 30 - include/boost/python/detail/is_shared_ptr.hpp | 17 - include/boost/python/detail/is_wrapper.hpp | 29 - include/boost/python/detail/is_xxx.hpp | 62 -- .../python/detail/make_keyword_range_fn.hpp | 69 -- include/boost/python/detail/make_tuple.hpp | 32 - include/boost/python/detail/map_entry.hpp | 43 - include/boost/python/detail/mpl_lambda.hpp | 12 - include/boost/python/detail/msvc_typeinfo.hpp | 75 -- include/boost/python/detail/none.hpp | 20 - include/boost/python/detail/not_specified.hpp | 14 - .../detail/nullary_function_adaptor.hpp | 46 -- include/boost/python/detail/operator_id.hpp | 55 -- include/boost/python/detail/overloads_fwd.hpp | 18 - include/boost/python/detail/pointee.hpp | 35 - include/boost/python/detail/prefix.hpp | 16 - include/boost/python/detail/preprocessor.hpp | 66 -- include/boost/python/detail/python22_fixed.h | 150 ---- include/boost/python/detail/raw_pyobject.hpp | 32 - .../boost/python/detail/referent_storage.hpp | 76 -- include/boost/python/detail/result.hpp | 131 ---- include/boost/python/detail/scope.hpp | 16 - include/boost/python/detail/sfinae.hpp | 13 - include/boost/python/detail/signature.hpp | 88 --- .../boost/python/detail/string_literal.hpp | 88 --- include/boost/python/detail/target.hpp | 82 -- .../python/detail/translate_exception.hpp | 67 -- include/boost/python/detail/type_list.hpp | 39 - .../boost/python/detail/type_list_impl.hpp | 57 -- .../python/detail/type_list_impl_no_pts.hpp | 107 --- .../boost/python/detail/unwrap_type_id.hpp | 31 - .../boost/python/detail/unwrap_wrapper.hpp | 48 -- include/boost/python/detail/value_arg.hpp | 27 - .../python/detail/value_is_shared_ptr.hpp | 17 - include/boost/python/detail/value_is_xxx.hpp | 62 -- include/boost/python/detail/void_ptr.hpp | 35 - include/boost/python/detail/void_return.hpp | 42 - include/boost/python/detail/wrap_python.hpp | 167 ---- include/boost/python/detail/wrapper_base.hpp | 90 --- include/boost/python/dict.hpp | 152 ---- include/boost/python/enum.hpp | 102 --- include/boost/python/errors.hpp | 55 -- include/boost/python/exception_translator.hpp | 27 - include/boost/python/extract.hpp | 254 ------ include/boost/python/handle.hpp | 264 ------- include/boost/python/handle_fwd.hpp | 16 - include/boost/python/has_back_reference.hpp | 24 - include/boost/python/implicit.hpp | 29 - include/boost/python/init.hpp | 421 ---------- include/boost/python/instance_holder.hpp | 57 -- include/boost/python/iterator.hpp | 127 --- include/boost/python/list.hpp | 141 ---- include/boost/python/long.hpp | 68 -- include/boost/python/lvalue_from_pytype.hpp | 105 --- include/boost/python/make_constructor.hpp | 279 ------- include/boost/python/make_function.hpp | 153 ---- include/boost/python/manage_new_object.hpp | 41 - include/boost/python/module.hpp | 13 - include/boost/python/module_init.hpp | 69 -- include/boost/python/numeric.hpp | 232 ------ include/boost/python/object.hpp | 16 - .../boost/python/object/add_to_namespace.hpp | 23 - include/boost/python/object/class.hpp | 62 -- include/boost/python/object/class_detail.hpp | 19 - .../boost/python/object/class_metadata.hpp | 269 ------- include/boost/python/object/class_wrapper.hpp | 42 - include/boost/python/object/enum_base.hpp | 34 - include/boost/python/object/find_instance.hpp | 18 - include/boost/python/object/forward.hpp | 194 ----- include/boost/python/object/function.hpp | 76 -- .../boost/python/object/function_handle.hpp | 44 -- .../boost/python/object/function_object.hpp | 40 - include/boost/python/object/inheritance.hpp | 132 ---- .../boost/python/object/inheritance_query.hpp | 17 - include/boost/python/object/instance.hpp | 51 -- include/boost/python/object/iterator.hpp | 254 ------ include/boost/python/object/iterator_core.hpp | 17 - include/boost/python/object/life_support.hpp | 15 - include/boost/python/object/make_holder.hpp | 97 --- include/boost/python/object/make_instance.hpp | 75 -- .../boost/python/object/make_ptr_instance.hpp | 67 -- .../boost/python/object/pickle_support.hpp | 124 --- .../boost/python/object/pointer_holder.hpp | 204 ----- include/boost/python/object/py_function.hpp | 163 ---- include/boost/python/object/value_holder.hpp | 164 ---- .../boost/python/object/value_holder_fwd.hpp | 16 - include/boost/python/object_attributes.hpp | 68 -- include/boost/python/object_call.hpp | 23 - include/boost/python/object_core.hpp | 485 ------------ include/boost/python/object_fwd.hpp | 18 - include/boost/python/object_items.hpp | 89 --- include/boost/python/object_operators.hpp | 132 ---- include/boost/python/object_protocol.hpp | 79 -- include/boost/python/object_protocol_core.hpp | 53 -- include/boost/python/object_slices.hpp | 142 ---- .../boost/python/opaque_pointer_converter.hpp | 135 ---- include/boost/python/operators.hpp | 356 --------- include/boost/python/other.hpp | 114 --- include/boost/python/overloads.hpp | 13 - include/boost/python/override.hpp | 132 ---- include/boost/python/pointee.hpp | 43 - include/boost/python/proxy.hpp | 101 --- include/boost/python/ptr.hpp | 128 --- include/boost/python/pure_virtual.hpp | 126 --- include/boost/python/raw_function.hpp | 61 -- include/boost/python/refcount.hpp | 41 - .../python/reference_existing_object.hpp | 46 -- .../boost/python/register_ptr_to_python.hpp | 31 - include/boost/python/return_arg.hpp | 96 --- include/boost/python/return_by_value.hpp | 31 - .../python/return_internal_reference.hpp | 43 - .../boost/python/return_opaque_pointer.hpp | 56 -- include/boost/python/return_value_policy.hpp | 21 - include/boost/python/scope.hpp | 78 -- include/boost/python/self.hpp | 33 - include/boost/python/signature.hpp | 179 ----- include/boost/python/slice.hpp | 266 ------- include/boost/python/slice_nil.hpp | 44 -- include/boost/python/str.hpp | 414 ---------- .../python/suite/indexing/container_utils.hpp | 52 -- .../indexing/detail/indexing_suite_detail.hpp | 742 ------------------ .../python/suite/indexing/indexing_suite.hpp | 293 ------- .../suite/indexing/map_indexing_suite.hpp | 181 ----- .../suite/indexing/vector_indexing_suite.hpp | 242 ------ include/boost/python/tag.hpp | 18 - include/boost/python/to_python_converter.hpp | 40 - include/boost/python/to_python_indirect.hpp | 103 --- include/boost/python/to_python_value.hpp | 124 --- include/boost/python/tuple.hpp | 70 -- include/boost/python/type_id.hpp | 166 ---- .../boost/python/with_custodian_and_ward.hpp | 117 --- include/boost/python/wrapper.hpp | 35 - 200 files changed, 19282 deletions(-) delete mode 100755 include/boost/python/arg_from_python.hpp delete mode 100644 include/boost/python/args.hpp delete mode 100644 include/boost/python/args_fwd.hpp delete mode 100644 include/boost/python/back_reference.hpp delete mode 100755 include/boost/python/base_type_traits.hpp delete mode 100644 include/boost/python/bases.hpp delete mode 100755 include/boost/python/borrowed.hpp delete mode 100644 include/boost/python/call.hpp delete mode 100644 include/boost/python/call_method.hpp delete mode 100755 include/boost/python/cast.hpp delete mode 100644 include/boost/python/class.hpp delete mode 100644 include/boost/python/class_fwd.hpp delete mode 100755 include/boost/python/converter/arg_from_python.hpp delete mode 100755 include/boost/python/converter/arg_to_python.hpp delete mode 100755 include/boost/python/converter/arg_to_python_base.hpp delete mode 100644 include/boost/python/converter/as_to_python_function.hpp delete mode 100644 include/boost/python/converter/builtin_converters.hpp delete mode 100644 include/boost/python/converter/constructor_function.hpp delete mode 100755 include/boost/python/converter/context_result_converter.hpp delete mode 100644 include/boost/python/converter/convertible_function.hpp delete mode 100644 include/boost/python/converter/from_python.hpp delete mode 100644 include/boost/python/converter/implicit.hpp delete mode 100644 include/boost/python/converter/obj_mgr_arg_from_python.hpp delete mode 100755 include/boost/python/converter/object_manager.hpp delete mode 100644 include/boost/python/converter/pointer_type_id.hpp delete mode 100644 include/boost/python/converter/pyobject_traits.hpp delete mode 100644 include/boost/python/converter/pyobject_type.hpp delete mode 100644 include/boost/python/converter/pytype_object_mgr_traits.hpp delete mode 100644 include/boost/python/converter/registered.hpp delete mode 100644 include/boost/python/converter/registered_pointee.hpp delete mode 100644 include/boost/python/converter/registrations.hpp delete mode 100644 include/boost/python/converter/registry.hpp delete mode 100755 include/boost/python/converter/return_from_python.hpp delete mode 100644 include/boost/python/converter/rvalue_from_python_data.hpp delete mode 100644 include/boost/python/converter/shared_ptr_deleter.hpp delete mode 100644 include/boost/python/converter/shared_ptr_from_python.hpp delete mode 100644 include/boost/python/converter/shared_ptr_to_python.hpp delete mode 100644 include/boost/python/converter/to_python_function_type.hpp delete mode 100644 include/boost/python/copy_const_reference.hpp delete mode 100644 include/boost/python/copy_non_const_reference.hpp delete mode 100644 include/boost/python/data_members.hpp delete mode 100644 include/boost/python/def.hpp delete mode 100755 include/boost/python/def_visitor.hpp delete mode 100644 include/boost/python/default_call_policies.hpp delete mode 100644 include/boost/python/detail/aix_init_module.hpp delete mode 100644 include/boost/python/detail/api_placeholder.hpp delete mode 100755 include/boost/python/detail/borrowed_ptr.hpp delete mode 100644 include/boost/python/detail/caller.hpp delete mode 100644 include/boost/python/detail/config.hpp delete mode 100644 include/boost/python/detail/construct.hpp delete mode 100755 include/boost/python/detail/convertible.hpp delete mode 100755 include/boost/python/detail/copy_ctor_mutates_rhs.hpp delete mode 100644 include/boost/python/detail/cv_category.hpp delete mode 100644 include/boost/python/detail/dealloc.hpp delete mode 100755 include/boost/python/detail/decorated_type_id.hpp delete mode 100644 include/boost/python/detail/decref_guard.hpp delete mode 100644 include/boost/python/detail/def_helper.hpp delete mode 100755 include/boost/python/detail/def_helper_fwd.hpp delete mode 100644 include/boost/python/detail/defaults_def.hpp delete mode 100644 include/boost/python/detail/defaults_gen.hpp delete mode 100644 include/boost/python/detail/dependent.hpp delete mode 100644 include/boost/python/detail/destroy.hpp delete mode 100755 include/boost/python/detail/enable_if.hpp delete mode 100644 include/boost/python/detail/exception_handler.hpp delete mode 100755 include/boost/python/detail/force_instantiate.hpp delete mode 100644 include/boost/python/detail/if_else.hpp delete mode 100644 include/boost/python/detail/indirect_traits.hpp delete mode 100644 include/boost/python/detail/invoke.hpp delete mode 100644 include/boost/python/detail/is_auto_ptr.hpp delete mode 100755 include/boost/python/detail/is_shared_ptr.hpp delete mode 100755 include/boost/python/detail/is_wrapper.hpp delete mode 100644 include/boost/python/detail/is_xxx.hpp delete mode 100644 include/boost/python/detail/make_keyword_range_fn.hpp delete mode 100644 include/boost/python/detail/make_tuple.hpp delete mode 100644 include/boost/python/detail/map_entry.hpp delete mode 100644 include/boost/python/detail/mpl_lambda.hpp delete mode 100644 include/boost/python/detail/msvc_typeinfo.hpp delete mode 100644 include/boost/python/detail/none.hpp delete mode 100644 include/boost/python/detail/not_specified.hpp delete mode 100755 include/boost/python/detail/nullary_function_adaptor.hpp delete mode 100755 include/boost/python/detail/operator_id.hpp delete mode 100644 include/boost/python/detail/overloads_fwd.hpp delete mode 100644 include/boost/python/detail/pointee.hpp delete mode 100755 include/boost/python/detail/prefix.hpp delete mode 100644 include/boost/python/detail/preprocessor.hpp delete mode 100644 include/boost/python/detail/python22_fixed.h delete mode 100644 include/boost/python/detail/raw_pyobject.hpp delete mode 100644 include/boost/python/detail/referent_storage.hpp delete mode 100755 include/boost/python/detail/result.hpp delete mode 100644 include/boost/python/detail/scope.hpp delete mode 100755 include/boost/python/detail/sfinae.hpp delete mode 100644 include/boost/python/detail/signature.hpp delete mode 100644 include/boost/python/detail/string_literal.hpp delete mode 100644 include/boost/python/detail/target.hpp delete mode 100644 include/boost/python/detail/translate_exception.hpp delete mode 100644 include/boost/python/detail/type_list.hpp delete mode 100644 include/boost/python/detail/type_list_impl.hpp delete mode 100644 include/boost/python/detail/type_list_impl_no_pts.hpp delete mode 100755 include/boost/python/detail/unwrap_type_id.hpp delete mode 100755 include/boost/python/detail/unwrap_wrapper.hpp delete mode 100755 include/boost/python/detail/value_arg.hpp delete mode 100644 include/boost/python/detail/value_is_shared_ptr.hpp delete mode 100644 include/boost/python/detail/value_is_xxx.hpp delete mode 100644 include/boost/python/detail/void_ptr.hpp delete mode 100644 include/boost/python/detail/void_return.hpp delete mode 100644 include/boost/python/detail/wrap_python.hpp delete mode 100755 include/boost/python/detail/wrapper_base.hpp delete mode 100644 include/boost/python/dict.hpp delete mode 100644 include/boost/python/enum.hpp delete mode 100644 include/boost/python/errors.hpp delete mode 100644 include/boost/python/exception_translator.hpp delete mode 100644 include/boost/python/extract.hpp delete mode 100755 include/boost/python/handle.hpp delete mode 100755 include/boost/python/handle_fwd.hpp delete mode 100644 include/boost/python/has_back_reference.hpp delete mode 100644 include/boost/python/implicit.hpp delete mode 100644 include/boost/python/init.hpp delete mode 100755 include/boost/python/instance_holder.hpp delete mode 100644 include/boost/python/iterator.hpp delete mode 100644 include/boost/python/list.hpp delete mode 100644 include/boost/python/long.hpp delete mode 100755 include/boost/python/lvalue_from_pytype.hpp delete mode 100755 include/boost/python/make_constructor.hpp delete mode 100644 include/boost/python/make_function.hpp delete mode 100644 include/boost/python/manage_new_object.hpp delete mode 100644 include/boost/python/module.hpp delete mode 100644 include/boost/python/module_init.hpp delete mode 100644 include/boost/python/numeric.hpp delete mode 100755 include/boost/python/object.hpp delete mode 100644 include/boost/python/object/add_to_namespace.hpp delete mode 100644 include/boost/python/object/class.hpp delete mode 100644 include/boost/python/object/class_detail.hpp delete mode 100755 include/boost/python/object/class_metadata.hpp delete mode 100644 include/boost/python/object/class_wrapper.hpp delete mode 100644 include/boost/python/object/enum_base.hpp delete mode 100644 include/boost/python/object/find_instance.hpp delete mode 100644 include/boost/python/object/forward.hpp delete mode 100644 include/boost/python/object/function.hpp delete mode 100644 include/boost/python/object/function_handle.hpp delete mode 100644 include/boost/python/object/function_object.hpp delete mode 100644 include/boost/python/object/inheritance.hpp delete mode 100755 include/boost/python/object/inheritance_query.hpp delete mode 100644 include/boost/python/object/instance.hpp delete mode 100644 include/boost/python/object/iterator.hpp delete mode 100644 include/boost/python/object/iterator_core.hpp delete mode 100644 include/boost/python/object/life_support.hpp delete mode 100644 include/boost/python/object/make_holder.hpp delete mode 100644 include/boost/python/object/make_instance.hpp delete mode 100644 include/boost/python/object/make_ptr_instance.hpp delete mode 100644 include/boost/python/object/pickle_support.hpp delete mode 100644 include/boost/python/object/pointer_holder.hpp delete mode 100644 include/boost/python/object/py_function.hpp delete mode 100644 include/boost/python/object/value_holder.hpp delete mode 100644 include/boost/python/object/value_holder_fwd.hpp delete mode 100755 include/boost/python/object_attributes.hpp delete mode 100644 include/boost/python/object_call.hpp delete mode 100755 include/boost/python/object_core.hpp delete mode 100644 include/boost/python/object_fwd.hpp delete mode 100755 include/boost/python/object_items.hpp delete mode 100644 include/boost/python/object_operators.hpp delete mode 100755 include/boost/python/object_protocol.hpp delete mode 100755 include/boost/python/object_protocol_core.hpp delete mode 100644 include/boost/python/object_slices.hpp delete mode 100644 include/boost/python/opaque_pointer_converter.hpp delete mode 100644 include/boost/python/operators.hpp delete mode 100755 include/boost/python/other.hpp delete mode 100644 include/boost/python/overloads.hpp delete mode 100755 include/boost/python/override.hpp delete mode 100644 include/boost/python/pointee.hpp delete mode 100755 include/boost/python/proxy.hpp delete mode 100644 include/boost/python/ptr.hpp delete mode 100755 include/boost/python/pure_virtual.hpp delete mode 100755 include/boost/python/raw_function.hpp delete mode 100755 include/boost/python/refcount.hpp delete mode 100644 include/boost/python/reference_existing_object.hpp delete mode 100644 include/boost/python/register_ptr_to_python.hpp delete mode 100755 include/boost/python/return_arg.hpp delete mode 100644 include/boost/python/return_by_value.hpp delete mode 100644 include/boost/python/return_internal_reference.hpp delete mode 100644 include/boost/python/return_opaque_pointer.hpp delete mode 100644 include/boost/python/return_value_policy.hpp delete mode 100644 include/boost/python/scope.hpp delete mode 100755 include/boost/python/self.hpp delete mode 100644 include/boost/python/signature.hpp delete mode 100644 include/boost/python/slice.hpp delete mode 100644 include/boost/python/slice_nil.hpp delete mode 100644 include/boost/python/str.hpp delete mode 100644 include/boost/python/suite/indexing/container_utils.hpp delete mode 100644 include/boost/python/suite/indexing/detail/indexing_suite_detail.hpp delete mode 100644 include/boost/python/suite/indexing/indexing_suite.hpp delete mode 100644 include/boost/python/suite/indexing/map_indexing_suite.hpp delete mode 100644 include/boost/python/suite/indexing/vector_indexing_suite.hpp delete mode 100644 include/boost/python/tag.hpp delete mode 100644 include/boost/python/to_python_converter.hpp delete mode 100644 include/boost/python/to_python_indirect.hpp delete mode 100644 include/boost/python/to_python_value.hpp delete mode 100644 include/boost/python/tuple.hpp delete mode 100755 include/boost/python/type_id.hpp delete mode 100644 include/boost/python/with_custodian_and_ward.hpp delete mode 100755 include/boost/python/wrapper.hpp diff --git a/include/boost/python/arg_from_python.hpp b/include/boost/python/arg_from_python.hpp deleted file mode 100755 index 05611edb..00000000 --- a/include/boost/python/arg_from_python.hpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 ARG_FROM_PYTHON_DWA2002128_HPP -# define ARG_FROM_PYTHON_DWA2002128_HPP - -# include -# include -# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \ - || BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(800)) -# include -#endif - -namespace boost { namespace python { - -template -struct arg_from_python - : converter::select_arg_from_python< -# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \ - || BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(800)) - typename boost::remove_cv::type -# else - T -# endif - >::type -{ - typedef typename converter::select_arg_from_python< -# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) \ - || BOOST_WORKAROUND(BOOST_INTEL_WIN, BOOST_TESTED_AT(800)) - typename boost::remove_cv::type -# else - T -# endif - >::type base; - - arg_from_python(PyObject*); -}; - -// specialization for PyObject* -template <> -struct arg_from_python -{ - typedef PyObject* result_type; - - arg_from_python(PyObject* p) : m_source(p) {} - bool convertible() const { return true; } - PyObject* operator()() const { return m_source; } - private: - PyObject* m_source; -}; - -template <> -struct arg_from_python -{ - typedef PyObject* const& result_type; - - arg_from_python(PyObject* p) : m_source(p) {} - bool convertible() const { return true; } - PyObject*const& operator()() const { return m_source; } - private: - PyObject* m_source; -}; - -// -// implementations -// -template -inline arg_from_python::arg_from_python(PyObject* source) - : base(source) -{ -} - -}} // namespace boost::python - -#endif // ARG_FROM_PYTHON_DWA2002128_HPP diff --git a/include/boost/python/args.hpp b/include/boost/python/args.hpp deleted file mode 100644 index 8f8791d7..00000000 --- a/include/boost/python/args.hpp +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 KEYWORDS_DWA2002323_HPP -# define KEYWORDS_DWA2002323_HPP - -# include - -# include -# include -# include -# include - -# include -# include -# include - -# include -# include -# include -# include - -# include -# include - -# include - -# include -# include - -namespace boost { namespace python { - -typedef detail::keywords<1> arg; -typedef arg arg_; // gcc 2.96 workaround - -namespace detail -{ - template - struct keywords_base - { - BOOST_STATIC_CONSTANT(std::size_t, size = nkeywords); - - keyword_range range() const - { - return keyword_range(elements, elements + nkeywords); - } - - keyword elements[nkeywords]; - - keywords - operator,(python::arg const &k) const; - - keywords - operator,(char const *name) const; - }; - - template - struct keywords : keywords_base - { - }; - - template <> - struct keywords<1> : keywords_base<1> - { - explicit keywords(char const *name) - { - elements[0].name = name; - } - - template - python::arg& operator=(T const& value) - { - object z(value); - elements[0].default_value = handle<>(python::borrowed(object(value).ptr())); - return *this; - } - - operator detail::keyword const&() const - { - return elements[0]; - } - }; - - template - inline - keywords - keywords_base::operator,(python::arg const &k) const - { - keywords const& l = *static_cast const*>(this); - python::detail::keywords res; - std::copy(l.elements, l.elements+nkeywords, res.elements); - res.elements[nkeywords] = k.elements[0]; - return res; - } - - template - inline - keywords - keywords_base::operator,(char const *name) const - { - return this->operator,(python::arg(name)); - } - -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template - struct is_keywords - { - BOOST_STATIC_CONSTANT(bool, value = false); - }; - - template - struct is_keywords > - { - BOOST_STATIC_CONSTANT(bool, value = true); - }; - template - struct is_reference_to_keywords - { - BOOST_STATIC_CONSTANT(bool, is_ref = is_reference::value); - typedef typename remove_reference::type deref; - typedef typename remove_cv::type key_t; - BOOST_STATIC_CONSTANT(bool, is_key = is_keywords::value); - BOOST_STATIC_CONSTANT(bool, value = (is_ref & is_key)); - - typedef mpl::bool_ type; - BOOST_PYTHON_MPL_LAMBDA_SUPPORT(1,is_reference_to_keywords,(T)) - }; -# else - typedef char (&yes_keywords_t)[1]; - typedef char (&no_keywords_t)[2]; - - no_keywords_t is_keywords_test(...); - - template - yes_keywords_t is_keywords_test(void (*)(keywords&)); - - template - yes_keywords_t is_keywords_test(void (*)(keywords const&)); - - template - class is_reference_to_keywords - { - public: - BOOST_STATIC_CONSTANT( - bool, value = ( - sizeof(detail::is_keywords_test( (void (*)(T))0 )) - == sizeof(detail::yes_keywords_t))); - - typedef mpl::bool_ type; - BOOST_PYTHON_MPL_LAMBDA_SUPPORT(1,is_reference_to_keywords,(T)) - }; -# endif -} - -inline detail::keywords<1> args(char const* name) -{ - return detail::keywords<1>(name); -} - -# define BOOST_PYTHON_ASSIGN_NAME(z, n, _) result.elements[n].name = name##n; -# define BOOST_PP_LOCAL_MACRO(n) \ -inline detail::keywords args(BOOST_PP_ENUM_PARAMS_Z(1, n, char const* name)) \ -{ \ - detail::keywords result; \ - BOOST_PP_REPEAT_1(n, BOOST_PYTHON_ASSIGN_NAME, _) \ - return result; \ -} -# define BOOST_PP_LOCAL_LIMITS (2, BOOST_PYTHON_MAX_ARITY) -# include BOOST_PP_LOCAL_ITERATE() - -}} // namespace boost::python - - -# endif // KEYWORDS_DWA2002323_HPP diff --git a/include/boost/python/args_fwd.hpp b/include/boost/python/args_fwd.hpp deleted file mode 100644 index 39239461..00000000 --- a/include/boost/python/args_fwd.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 ARGS_FWD_DWA2002927_HPP -# define ARGS_FWD_DWA2002927_HPP - -# include - -# include -# include -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - struct keyword - { - keyword(char const* name_=0) - : name(name_) - {} - - char const* name; - handle<> default_value; - }; - - template struct keywords; - - typedef std::pair keyword_range; - - template <> - struct keywords<0> - { - BOOST_STATIC_CONSTANT(std::size_t, size = 0); - static keyword_range range() { return keyword_range(); } - }; - - namespace error - { - template - struct more_keywords_than_function_arguments - { - typedef char too_many_keywords[keywords > function_args ? -1 : 1]; - }; - } -} - -}} // namespace boost::python - -#endif // ARGS_FWD_DWA2002927_HPP diff --git a/include/boost/python/back_reference.hpp b/include/boost/python/back_reference.hpp deleted file mode 100644 index c1daba60..00000000 --- a/include/boost/python/back_reference.hpp +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 BACK_REFERENCE_DWA2002510_HPP -# define BACK_REFERENCE_DWA2002510_HPP - -# include - -# include -# include -# include - -namespace boost { namespace python { - -template -struct back_reference -{ - private: // types - typedef typename detail::dependent::type source_t; - public: - typedef T type; - - back_reference(PyObject*, T); - source_t const& source() const; - T get() const; - private: - source_t m_source; - T m_value; -}; - -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template -class is_back_reference -{ - public: - BOOST_STATIC_CONSTANT(bool, value = false); -}; - -template -class is_back_reference > -{ - public: - BOOST_STATIC_CONSTANT(bool, value = true); -}; - -# else // no partial specialization - -}} // namespace boost::python - -#include - -namespace boost { namespace python { - -namespace detail -{ - typedef char (&yes_back_reference_t)[1]; - typedef char (&no_back_reference_t)[2]; - - no_back_reference_t is_back_reference_test(...); - - template - yes_back_reference_t is_back_reference_test(boost::type< back_reference >); -} - -template -class is_back_reference -{ - public: - BOOST_STATIC_CONSTANT( - bool, value = ( - sizeof(detail::is_back_reference_test(boost::type())) - == sizeof(detail::yes_back_reference_t))); -}; - -# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -// -// implementations -// -template -back_reference::back_reference(PyObject* p, T x) - : m_source(detail::borrowed_reference(p)) - , m_value(x) -{ -} - -template -typename back_reference::source_t const& back_reference::source() const -{ - return m_source; -} - -template -T back_reference::get() const -{ - return m_value; -} - -}} // namespace boost::python - -#endif // BACK_REFERENCE_DWA2002510_HPP diff --git a/include/boost/python/base_type_traits.hpp b/include/boost/python/base_type_traits.hpp deleted file mode 100755 index e1c6a484..00000000 --- a/include/boost/python/base_type_traits.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 BASE_TYPE_TRAITS_DWA2002614_HPP -# define BASE_TYPE_TRAITS_DWA2002614_HPP - -# include - -namespace boost { namespace python { - -namespace detail -{ - struct unspecialized {}; -} - -// Derive from unspecialized so we can detect whether traits are -// specialized -template struct base_type_traits - : detail::unspecialized -{}; - -template <> -struct base_type_traits -{ - typedef PyObject type; -}; - -template <> -struct base_type_traits -{ - typedef PyObject type; -}; - -template <> -struct base_type_traits -{ - typedef PyObject type; -}; - -}} // namespace boost::python - -#endif // BASE_TYPE_TRAITS_DWA2002614_HPP diff --git a/include/boost/python/bases.hpp b/include/boost/python/bases.hpp deleted file mode 100644 index 0bd7350e..00000000 --- a/include/boost/python/bases.hpp +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 BASES_DWA2002321_HPP -# define BASES_DWA2002321_HPP - -# include -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { - -# define BOOST_PYTHON_BASE_PARAMS BOOST_PP_ENUM_PARAMS_Z(1, BOOST_PYTHON_MAX_BASES, Base) - - // A type list for specifying bases - template < BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PYTHON_MAX_BASES, typename Base, mpl::void_) > - struct bases : detail::type_list< BOOST_PYTHON_BASE_PARAMS >::type - {}; - - namespace detail - { -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template struct specifies_bases - : mpl::false_ - { - }; - - template < BOOST_PP_ENUM_PARAMS_Z(1, BOOST_PYTHON_MAX_BASES, class Base) > - struct specifies_bases< bases< BOOST_PYTHON_BASE_PARAMS > > - : mpl::true_ - { - }; -# else - template < BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_MAX_BASES, class Base) > - static char is_bases_helper(bases< BOOST_PYTHON_BASE_PARAMS > const&); - - static char (& is_bases_helper(...) )[256]; - - template - struct specifies_bases - { - private: - static typename add_reference::type make(); - BOOST_STATIC_CONSTANT(bool, non_ref = !is_reference::value); - public: - BOOST_STATIC_CONSTANT(bool, value = non_ref & (sizeof(is_bases_helper(make())) == 1)); - typedef mpl::bool_ type; - }; -# endif - template > - struct select_bases - : mpl::if_< - specifies_bases - , T - , Prev - > - { - }; - } -# undef BOOST_PYTHON_BASE_PARAMS -}} // namespace boost::python - -#endif // BASES_DWA2002321_HPP diff --git a/include/boost/python/borrowed.hpp b/include/boost/python/borrowed.hpp deleted file mode 100755 index fd2716bf..00000000 --- a/include/boost/python/borrowed.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 BORROWED_DWA2002614_HPP -# define BORROWED_DWA2002614_HPP - -# include -# include - -namespace boost { namespace python { - -template -inline python::detail::borrowed* borrowed(T* p) -{ - return (detail::borrowed*)p; -} - -}} // namespace boost::python - -#endif // BORROWED_DWA2002614_HPP diff --git a/include/boost/python/call.hpp b/include/boost/python/call.hpp deleted file mode 100644 index 9a3d974b..00000000 --- a/include/boost/python/call.hpp +++ /dev/null @@ -1,79 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2002. -// 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 CALL_DWA2002411_HPP -# define CALL_DWA2002411_HPP - -# include - -# include - -# include -# include -# include -# include - -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { - -# define BOOST_PYTHON_FAST_ARG_TO_PYTHON_GET(z, n, _) \ - , converter::arg_to_python(a##n).get() - -# define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PYTHON_MAX_ARITY, )) -# include BOOST_PP_ITERATE() - -# undef BOOST_PYTHON_FAST_ARG_TO_PYTHON_GET - -}} // namespace boost::python - -# endif // CALL_DWA2002411_HPP - -#elif BOOST_PP_ITERATION_DEPTH() == 1 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, call.hpp) -# endif - -# define N BOOST_PP_ITERATION() - -template < - class R - BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class A) - > -typename detail::returnable::type -call(PyObject* callable - BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, const& a) - , boost::type* = 0 - ) -{ - PyObject* const result = - PyEval_CallFunction( - callable - , const_cast("(" BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FIXED, "O") ")") - BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FAST_ARG_TO_PYTHON_GET, nil) - ); - - // This conversion *must not* be done in the same expression as - // the call, because, in the special case where the result is a - // reference a Python object which was created by converting a C++ - // argument for passing to PyEval_CallFunction, its reference - // count will be 2 until the end of the full expression containing - // the conversion, and that interferes with dangling - // pointer/reference detection. - converter::return_from_python converter; - return converter(result); -} - -# undef N - -#endif diff --git a/include/boost/python/call_method.hpp b/include/boost/python/call_method.hpp deleted file mode 100644 index 0bca0610..00000000 --- a/include/boost/python/call_method.hpp +++ /dev/null @@ -1,79 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2002. -// 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 CALL_METHOD_DWA2002411_HPP -# define CALL_METHOD_DWA2002411_HPP - -# include - -# include - -# include -# include -# include -# include - -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { - -# define BOOST_PYTHON_FAST_ARG_TO_PYTHON_GET(z, n, _) \ - , converter::arg_to_python(a##n).get() - -# define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PYTHON_MAX_ARITY, )) -# include BOOST_PP_ITERATE() - -# undef BOOST_PYTHON_FAST_ARG_TO_PYTHON_GET - -}} // namespace boost::python - -# endif // CALL_METHOD_DWA2002411_HPP - -#elif BOOST_PP_ITERATION_DEPTH() == 1 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, call_method.hpp) -# endif - -# define N BOOST_PP_ITERATION() - -template < - class R - BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class A) - > -typename detail::returnable::type -call_method(PyObject* self, char const* name - BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, const& a) - , boost::type* = 0 - ) -{ - PyObject* const result = - PyEval_CallMethod( - self - , const_cast(name) - , const_cast("(" BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FIXED, "O") ")") - BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FAST_ARG_TO_PYTHON_GET, nil) - ); - - // This conversion *must not* be done in the same expression as - // the call, because, in the special case where the result is a - // reference a Python object which was created by converting a C++ - // argument for passing to PyEval_CallFunction, its reference - // count will be 2 until the end of the full expression containing - // the conversion, and that interferes with dangling - // pointer/reference detection. - converter::return_from_python converter; - return converter(result); -} - -# undef N - -#endif // BOOST_PP_IS_ITERATING diff --git a/include/boost/python/cast.hpp b/include/boost/python/cast.hpp deleted file mode 100755 index 31c61dbf..00000000 --- a/include/boost/python/cast.hpp +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 CAST_DWA200269_HPP -# define CAST_DWA200269_HPP - -# include - -# include -# include -# include -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - template inline Target* upcast_impl(Source*, Target*); - - template - inline Target* upcast(Source* p, yes_convertible, no_convertible, Target*) - { - return p; - } - - template - inline Target* upcast(Source* p, no_convertible, no_convertible, Target*) - { - typedef typename base_type_traits::type base; - - return detail::upcast_impl((base*)p, (Target*)0); - } - - template - struct upcaster - { - template - static inline T* execute(T* x, T*) { return x; } - }; - - template <> - struct upcaster - { - template - static inline Target* execute(Source* x, Target*) - { - return detail::upcast( - x, detail::convertible::check(x) - , detail::convertible::check((Target*)0) - , (Target*)0); - } - }; - - - template - inline Target* downcast(Source* p, yes_convertible) - { - return static_cast(p); - } - - template - inline Target* downcast(Source* p, no_convertible, boost::type* = 0) - { - typedef typename base_type_traits::type base; - return (Target*)detail::downcast(p, convertible::check((base*)0)); - } - - template - inline void assert_castable(boost::type* = 0) - { - typedef char must_be_a_complete_type[sizeof(T)]; - } - - template - inline Target* upcast_impl(Source* x, Target*) - { - typedef typename add_cv::type src_t; - typedef typename add_cv::type target_t; - bool const same = is_same::value; - - return detail::upcaster::execute(x, (Target*)0); - } -} - -template -inline Target* upcast(Source* x, Target* = 0) -{ - detail::assert_castable(); - detail::assert_castable(); - return detail::upcast_impl(x, (Target*)0); - -} - -template -inline Target* downcast(Source* x, Target* = 0) -{ - detail::assert_castable(); - detail::assert_castable(); - return detail::downcast(x, detail::convertible::check((Target*)0)); -} - -}} // namespace boost::python - -#endif // CAST_DWA200269_HPP diff --git a/include/boost/python/class.hpp b/include/boost/python/class.hpp deleted file mode 100644 index e00afcdc..00000000 --- a/include/boost/python/class.hpp +++ /dev/null @@ -1,611 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 CLASS_DWA200216_HPP -# define CLASS_DWA200216_HPP - -# include - -# include - -# include -# include - -# include -# include -# include -# include -# include -# include -# include - -# include -# include -# include - -# include -# include -# include -# include -# include -# include - -# include -# include -# include - -# include -# include -# include -# include - -# include - -# if BOOST_WORKAROUND(__MWERKS__, <= 0x3004) \ - /* pro9 reintroduced the bug */ \ - || (BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) \ - || BOOST_WORKAROUND(__GNUC__, < 3) - -# define BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING 1 - -# endif - -# ifdef BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING -# include -# include -# endif - -namespace boost { namespace python { - -template class def_visitor; - -enum no_init_t { no_init }; - -namespace detail -{ - // This function object is used with mpl::for_each to write the id - // of the type a pointer to which is passed as its 2nd compile-time - // argument. into the iterator pointed to by its runtime argument - struct write_type_id - { - write_type_id(type_info**p) : p(p) {} - - // Here's the runtime behavior - template - void operator()(T*) const - { - *(*p)++ = type_id(); - } - - type_info** p; - }; - - template - struct is_data_member_pointer - : mpl::and_< - is_member_pointer - , mpl::not_ > - > - {}; - -# ifdef BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING -# define BOOST_PYTHON_DATA_MEMBER_HELPER(D) , detail::is_data_member_pointer() -# define BOOST_PYTHON_YES_DATA_MEMBER , mpl::true_ -# define BOOST_PYTHON_NO_DATA_MEMBER , mpl::false_ -# elif defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) -# define BOOST_PYTHON_DATA_MEMBER_HELPER(D) , 0 -# define BOOST_PYTHON_YES_DATA_MEMBER , int -# define BOOST_PYTHON_NO_DATA_MEMBER , ... -# else -# define BOOST_PYTHON_DATA_MEMBER_HELPER(D) -# define BOOST_PYTHON_YES_DATA_MEMBER -# define BOOST_PYTHON_NO_DATA_MEMBER -# endif - - namespace error - { - // - // A meta-assertion mechanism which prints nice error messages and - // backtraces on lots of compilers. Usage: - // - // assertion::failed - // - // where C is an MPL metafunction class - // - - template struct assertion_failed { }; - template struct assertion_ok { typedef C failed; }; - - template - struct assertion - : mpl::if_, assertion_failed >::type - {}; - - // - // Checks for validity of arguments used to define virtual - // functions with default implementations. - // - - template - void not_a_derived_class_member(Default) {} - - template - struct virtual_function_default - { - template - static void - must_be_derived_class_member(Default const&) - { - typedef typename assertion > >::failed test0; -# if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407) - typedef typename assertion >::failed test1; -# endif - typedef typename assertion >::failed test2; - not_a_derived_class_member(Fn()); - } - }; - } -} - -// This is the primary mechanism through which users will expose -// C++ classes to Python. -template < - class W // class being wrapped - , class X1 // = detail::not_specified - , class X2 // = detail::not_specified - , class X3 // = detail::not_specified - > -class class_ : public objects::class_base -{ - public: // types - typedef objects::class_base base; - typedef class_ self; - typedef typename objects::class_metadata metadata; - typedef W wrapped_type; - - private: // types - - // A helper class which will contain an array of id objects to be - // passed to the base class constructor - struct id_vector - { - typedef typename metadata::bases bases; - - id_vector() - { - // Stick the derived class id into the first element of the array - ids[0] = detail::unwrap_type_id((W*)0, (W*)0); - - // Write the rest of the elements into succeeding positions. - type_info* p = ids + 1; - mpl::for_each(detail::write_type_id(&p), (bases*)0, (add_pointer*)0); - } - - BOOST_STATIC_CONSTANT( - std::size_t, size = mpl::size::value + 1); - type_info ids[size]; - }; - friend struct id_vector; - - public: // constructors - - // Construct with the class name, with or without docstring, and default __init__() function - class_(char const* name, char const* doc = 0); - - // Construct with class name, no docstring, and an uncallable __init__ function - class_(char const* name, no_init_t); - - // Construct with class name, docstring, and an uncallable __init__ function - class_(char const* name, char const* doc, no_init_t); - - // Construct with class name and init<> function - template - inline class_(char const* name, init_base const& i) - : base(name, id_vector::size, id_vector().ids) - { - this->initialize(i); - } - - // Construct with class name, docstring and init<> function - template - inline class_(char const* name, char const* doc, init_base const& i) - : base(name, id_vector::size, id_vector().ids, doc) - { - this->initialize(i); - } - - public: // member functions - - // Generic visitation - template - self& def(def_visitor const& visitor) - { - visitor.visit(*this); - return *this; - } - - // Wrap a member function or a non-member function which can take - // a T, T cv&, or T cv* as its first parameter, a callable - // python object, or a generic visitor. - template - self& def(char const* name, F f) - { - this->def_impl( - detail::unwrap_wrapper((W*)0) - , name, f, detail::def_helper(0), &f); - return *this; - } - - template - self& def(char const* name, A1 a1, A2 const& a2) - { - this->def_maybe_overloads(name, a1, a2, &a2); - return *this; - } - - template - self& def(char const* name, Fn fn, A1 const& a1, A2 const& a2) - { - // The arguments are definitely: - // def(name, function, policy, doc_string) - // def(name, function, doc_string, policy) - - this->def_impl( - detail::unwrap_wrapper((W*)0) - , name, fn - , detail::def_helper(a1,a2) - , &fn); - - return *this; - } - - template - self& def(char const* name, Fn fn, A1 const& a1, A2 const& a2, A3 const& a3) - { - this->def_impl( - detail::unwrap_wrapper((W*)0) - , name, fn - , detail::def_helper(a1,a2,a3) - , &fn); - - return *this; - } - - // - // Data member access - // - template - self& def_readonly(char const* name, D const& d) - { - return this->def_readonly_impl(name, d BOOST_PYTHON_DATA_MEMBER_HELPER(D)); - } - - template - self& def_readwrite(char const* name, D const& d) - { - return this->def_readwrite_impl(name, d BOOST_PYTHON_DATA_MEMBER_HELPER(D)); - } - - template - self& def_readonly(char const* name, D& d) - { - return this->def_readonly_impl(name, d BOOST_PYTHON_DATA_MEMBER_HELPER(D)); - } - - template - self& def_readwrite(char const* name, D& d) - { - return this->def_readwrite_impl(name, d BOOST_PYTHON_DATA_MEMBER_HELPER(D)); - } - - // Property creation - template - self& add_property(char const* name, Get fget) - { - base::add_property(name, this->make_getter(fget)); - return *this; - } - - template - self& add_property(char const* name, Get fget, Set fset) - { - base::add_property(name, this->make_getter(fget), this->make_setter(fset)); - return *this; - } - - template - self& add_static_property(char const* name, Get fget) - { - base::add_static_property(name, object(fget)); - return *this; - } - - template - self& add_static_property(char const* name, Get fget, Set fset) - { - base::add_static_property(name, object(fget), object(fset)); - return *this; - } - - template - self& setattr(char const* name, U const& x) - { - this->base::setattr(name, object(x)); - return *this; - } - - // Pickle support - template - self& def_pickle(PickleSuiteType const& x) - { - error_messages::must_be_derived_from_pickle_suite(x); - detail::pickle_suite_finalize::register_( - *this, - &PickleSuiteType::getinitargs, - &PickleSuiteType::getstate, - &PickleSuiteType::setstate, - PickleSuiteType::getstate_manages_dict()); - return *this; - } - - self& enable_pickling() - { - this->base::enable_pickling_(false); - return *this; - } - - self& staticmethod(char const* name) - { - this->make_method_static(name); - return *this; - } - private: // helper functions - - // Builds a method for this class around the given [member] - // function pointer or object, appropriately adjusting the type of - // the first signature argument so that if f is a member of a - // (possibly not wrapped) base class of T, an lvalue argument of - // type T will be required. - // - // @group PropertyHelpers { - template - object make_getter(F f) - { - typedef typename api::is_object_operators::type is_obj_or_proxy; - - return this->make_fn_impl( - detail::unwrap_wrapper((W*)0) - , f, is_obj_or_proxy(), (char*)0, detail::is_data_member_pointer() - ); - } - - template - object make_setter(F f) - { - typedef typename api::is_object_operators::type is_obj_or_proxy; - - return this->make_fn_impl( - detail::unwrap_wrapper((W*)0) - , f, is_obj_or_proxy(), (int*)0, detail::is_data_member_pointer() - ); - } - - template - object make_fn_impl(T*, F const& f, mpl::false_, void*, mpl::false_) - { - return python::make_function(f, default_call_policies(), detail::get_signature(f, (T*)0)); - } - - template - object make_fn_impl(T*, D B::*pm_, mpl::false_, char*, mpl::true_) - { - D T::*pm = pm_; - return python::make_getter(pm); - } - - template - object make_fn_impl(T*, D B::*pm_, mpl::false_, int*, mpl::true_) - { - D T::*pm = pm_; - return python::make_setter(pm); - } - - template - object make_fn_impl(T*, F const& x, mpl::true_, void*, mpl::false_) - { - return x; - } - // } - - template - self& def_readonly_impl( - char const* name, D B::*pm_ BOOST_PYTHON_YES_DATA_MEMBER) - { - return this->add_property(name, pm_); - } - - template - self& def_readwrite_impl( - char const* name, D B::*pm_ BOOST_PYTHON_YES_DATA_MEMBER) - { - return this->add_property(name, pm_, pm_); - } - - template - self& def_readonly_impl( - char const* name, D& d BOOST_PYTHON_NO_DATA_MEMBER) - { - return this->add_static_property(name, python::make_getter(d)); - } - - template - self& def_readwrite_impl( - char const* name, D& d BOOST_PYTHON_NO_DATA_MEMBER) - { - return this->add_static_property(name, python::make_getter(d), python::make_setter(d)); - } - - template - inline void initialize(DefVisitor const& i) - { - metadata::register_(); // set up runtime metadata/conversions - - typedef typename metadata::holder holder; - this->set_instance_size( objects::additional_instance_size::value ); - - this->def(i); - } - - inline void initialize(no_init_t) - { - metadata::register_(); // set up runtime metadata/conversions - this->def_no_init(); - } - - // - // These two overloads discriminate between def() as applied to a - // generic visitor and everything else. - // - // @group def_impl { - template - inline void def_impl( - T* - , char const* name - , LeafVisitor - , Helper const& helper - , def_visitor const* v - ) - { - v->visit(*this, name, helper); - } - - template - inline void def_impl( - T* - , char const* name - , Fn fn - , Helper const& helper - , ... - ) - { - objects::add_to_namespace( - *this - , name - , make_function( - fn - , helper.policies() - , helper.keywords() - , detail::get_signature(fn, (T*)0) - ) - , helper.doc() - ); - - this->def_default(name, fn, helper, mpl::bool_()); - } - // } - - // - // These two overloads handle the definition of default - // implementation overloads for virtual functions. The second one - // handles the case where no default implementation was specified. - // - // @group def_default { - template - inline void def_default( - char const* name - , Fn - , Helper const& helper - , mpl::bool_) - { - detail::error::virtual_function_default::must_be_derived_class_member( - helper.default_implementation()); - - objects::add_to_namespace( - *this, name, - make_function( - helper.default_implementation(), helper.policies(), helper.keywords()) - ); - } - - template - inline void def_default(char const*, Fn, Helper const&, mpl::bool_) - { } - // } - - // - // These two overloads discriminate between def() as applied to - // regular functions and def() as applied to the result of - // BOOST_PYTHON_FUNCTION_OVERLOADS(). The final argument is used to - // discriminate. - // - // @group def_maybe_overloads { - template - void def_maybe_overloads( - char const* name - , SigT sig - , OverloadsT const& overloads - , detail::overloads_base const*) - - { - // convert sig to a type_list (see detail::get_signature in signature.hpp) - // before calling detail::define_with_defaults. - detail::define_with_defaults( - name, overloads, *this, detail::get_signature(sig)); - } - - template - void def_maybe_overloads( - char const* name - , Fn fn - , A1 const& a1 - , ...) - { - this->def_impl( - detail::unwrap_wrapper((W*)0) - , name - , fn - , detail::def_helper(a1) - , &fn - ); - - } - // } -}; - - -// -// implementations -// - -template -inline class_::class_(char const* name, char const* doc) - : base(name, id_vector::size, id_vector().ids, doc) -{ - this->initialize(init<>()); -// select_holder::assert_default_constructible(); -} - -template -inline class_::class_(char const* name, no_init_t) - : base(name, id_vector::size, id_vector().ids) -{ - this->initialize(no_init); -} - -template -inline class_::class_(char const* name, char const* doc, no_init_t) - : base(name, id_vector::size, id_vector().ids, doc) -{ - this->initialize(no_init); -} - -}} // namespace boost::python - -# undef BOOST_PYTHON_DATA_MEMBER_HELPER -# undef BOOST_PYTHON_YES_DATA_MEMBER -# undef BOOST_PYTHON_NO_DATA_MEMBER -# undef BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING - -#endif // CLASS_DWA200216_HPP diff --git a/include/boost/python/class_fwd.hpp b/include/boost/python/class_fwd.hpp deleted file mode 100644 index 528e18a1..00000000 --- a/include/boost/python/class_fwd.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 CLASS_FWD_DWA200222_HPP -# define CLASS_FWD_DWA200222_HPP - -# include -# include - -namespace boost { namespace python { - -template < - class T // class being wrapped - // arbitrarily-ordered optional arguments. Full qualification needed for MSVC6 - , class X1 = ::boost::python::detail::not_specified - , class X2 = ::boost::python::detail::not_specified - , class X3 = ::boost::python::detail::not_specified - > -class class_; - -}} // namespace boost::python - -#endif // CLASS_FWD_DWA200222_HPP diff --git a/include/boost/python/converter/arg_from_python.hpp b/include/boost/python/converter/arg_from_python.hpp deleted file mode 100755 index 160659af..00000000 --- a/include/boost/python/converter/arg_from_python.hpp +++ /dev/null @@ -1,343 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 ARG_FROM_PYTHON_DWA2002127_HPP -# define ARG_FROM_PYTHON_DWA2002127_HPP - -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python -{ - template struct arg_from_python; -}} - -// This header defines Python->C++ function argument converters, -// parametrized on the argument type. - -namespace boost { namespace python { namespace converter { - -// -// lvalue converters -// -// These require that an lvalue of the type U is stored somewhere in -// the Python object being converted. - -// Used when T == U*const& -template -struct pointer_cref_arg_from_python -{ - typedef T result_type; - - pointer_cref_arg_from_python(PyObject*); - T operator()() const; - bool convertible() const; - - private: // storage for a U* - // needed because not all compilers will let us declare U* as the - // return type of operator() -- we return U*const& instead - typename python::detail::referent_storage::type m_result; -}; - -// Base class for pointer and reference converters -struct arg_lvalue_from_python_base -{ - public: // member functions - arg_lvalue_from_python_base(void* result); - bool convertible() const; - - protected: // member functions - void*const& result() const; - - private: // data members - void* m_result; -}; - -// Used when T == U* -template -struct pointer_arg_from_python : arg_lvalue_from_python_base -{ - typedef T result_type; - - pointer_arg_from_python(PyObject*); - T operator()() const; -}; - -// Used when T == U& and (T != V const& or T == W volatile&) -template -struct reference_arg_from_python : arg_lvalue_from_python_base -{ - typedef T result_type; - - reference_arg_from_python(PyObject*); - T operator()() const; -}; - -// =================== - -// -// rvalue converters -// -// These require only that an object of type T can be created from -// the given Python object, but not that the T object exist -// somewhere in storage. -// - -// Used when T is a plain value (non-pointer, non-reference) type or -// a (non-volatile) const reference to a plain value type. -template -struct arg_rvalue_from_python -{ - typedef typename boost::add_reference< - T - // We can't add_const here, or it would be impossible to pass - // auto_ptr args from Python to C++ - >::type result_type; - - arg_rvalue_from_python(PyObject*); - bool convertible() const; - -# if BOOST_MSVC < 1301 || _MSC_FULL_VER > 13102196 - typename arg_rvalue_from_python:: -# endif - result_type operator()(); - - private: - rvalue_from_python_data m_data; - PyObject* m_source; -}; - - -// ================== - -// Converts to a (PyObject*,T) bundle, for when you need a reference -// back to the Python object -template -struct back_reference_arg_from_python - : boost::python::arg_from_python -{ - typedef T result_type; - - back_reference_arg_from_python(PyObject*); - T operator()(); - private: - typedef boost::python::arg_from_python base; - PyObject* m_source; -}; - - -// ================== - -// This metafunction selects the appropriate arg_from_python converter -// type for an argument of type T. -template -struct select_arg_from_python -{ - BOOST_STATIC_CONSTANT( - bool, obj_mgr = is_object_manager::value); - - BOOST_STATIC_CONSTANT( - bool, obj_mgr_ref = is_reference_to_object_manager::value); - - BOOST_STATIC_CONSTANT( - bool, ptr = is_pointer::value); - - BOOST_STATIC_CONSTANT( - bool, ptr_cref - = indirect_traits::is_reference_to_pointer::value - && indirect_traits::is_reference_to_const::value - && !indirect_traits::is_reference_to_volatile::value); - - - BOOST_STATIC_CONSTANT( - bool, ref = - indirect_traits::is_reference_to_non_const::value - || indirect_traits::is_reference_to_volatile::value); - - BOOST_STATIC_CONSTANT( - bool, back_ref = - boost::python::is_back_reference::value); - - typedef typename mpl::if_c< - obj_mgr - , object_manager_value_arg_from_python - , typename mpl::if_c< - obj_mgr_ref - , object_manager_ref_arg_from_python - , typename mpl::if_c< - ptr - , pointer_arg_from_python - , typename mpl::if_c< - ptr_cref - , pointer_cref_arg_from_python - , typename mpl::if_c< - ref - , reference_arg_from_python - , typename mpl::if_c< - back_ref - , back_reference_arg_from_python - , arg_rvalue_from_python - >::type - >::type - >::type - >::type - >::type - >::type type; -}; - -// ================== - -// -// implementations -// - -// arg_lvalue_from_python_base -// -inline arg_lvalue_from_python_base::arg_lvalue_from_python_base(void* result) - : m_result(result) -{ -} - -inline bool arg_lvalue_from_python_base::convertible() const -{ - return m_result != 0; -} - -inline void*const& arg_lvalue_from_python_base::result() const -{ - return m_result; -} - -// pointer_cref_arg_from_python -// -namespace detail -{ - // null_ptr_reference -- a function returning a reference to a null - // pointer of type U. Needed so that extractors for T*const& can - // convert Python's None. - template - struct null_ptr_owner - { - static T value; - }; - template T null_ptr_owner::value = 0; - - template - inline U& null_ptr_reference(U&(*)()) - { - return null_ptr_owner::value; - } -} - -template -inline pointer_cref_arg_from_python::pointer_cref_arg_from_python(PyObject* p) -{ - // T == U*const&: store a U* in the m_result storage. Nonzero - // indicates success. If find returns nonzero, it's a pointer to - // a U object. - python::detail::write_void_ptr_reference( - m_result.bytes - , p == Py_None ? p : converter::get_lvalue_from_python(p, registered_pointee::converters) - , (T(*)())0); -} - -template -inline bool pointer_cref_arg_from_python::convertible() const -{ - return python::detail::void_ptr_to_reference(m_result.bytes, (T(*)())0) != 0; -} -template -inline T pointer_cref_arg_from_python::operator()() const -{ - return (*(void**)m_result.bytes == Py_None) // None ==> 0 - ? detail::null_ptr_reference((T(*)())0) - // Otherwise, return a U*const& to the m_result storage. - : python::detail::void_ptr_to_reference(m_result.bytes, (T(*)())0); -} - -// pointer_arg_from_python -// -template -inline pointer_arg_from_python::pointer_arg_from_python(PyObject* p) - : arg_lvalue_from_python_base( - p == Py_None ? p : converter::get_lvalue_from_python(p, registered_pointee::converters)) -{ -} - -template -inline T pointer_arg_from_python::operator()() const -{ - return (result() == Py_None) ? 0 : T(result()); -} - -// reference_arg_from_python -// -template -inline reference_arg_from_python::reference_arg_from_python(PyObject* p) - : arg_lvalue_from_python_base(converter::get_lvalue_from_python(p,registered::converters)) -{ -} - -template -inline T reference_arg_from_python::operator()() const -{ - return python::detail::void_ptr_to_reference(result(), (T(*)())0); -} - - -// arg_rvalue_from_python -// -template -inline arg_rvalue_from_python::arg_rvalue_from_python(PyObject* obj) - : m_data(converter::rvalue_from_python_stage1(obj, registered::converters)) - , m_source(obj) -{ -} - -template -inline bool arg_rvalue_from_python::convertible() const -{ - return m_data.stage1.convertible != 0; -} - -template -inline typename arg_rvalue_from_python::result_type -arg_rvalue_from_python::operator()() -{ - if (m_data.stage1.construct != 0) - m_data.stage1.construct(m_source, &m_data.stage1); - - return python::detail::void_ptr_to_reference(m_data.stage1.convertible, (result_type(*)())0); -} - -// back_reference_arg_from_python -// -template -back_reference_arg_from_python::back_reference_arg_from_python(PyObject* x) - : base(x), m_source(x) -{ -} - -template -inline T -back_reference_arg_from_python::operator()() -{ - return T(m_source, base::operator()()); -} - -}}} // namespace boost::python::converter - -#endif // ARG_FROM_PYTHON_DWA2002127_HPP diff --git a/include/boost/python/converter/arg_to_python.hpp b/include/boost/python/converter/arg_to_python.hpp deleted file mode 100755 index 3a19ec43..00000000 --- a/include/boost/python/converter/arg_to_python.hpp +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 ARG_TO_PYTHON_DWA200265_HPP -# define ARG_TO_PYTHON_DWA200265_HPP - -# include -# include -# include - -# include -# include -# include -# include -// Bring in specializations -# include - -# include - -# include - -# include -# include -# include -# include - -# include -# include -# include - - -# include - -namespace boost { namespace python { namespace converter { - -template struct is_object_manager; - -namespace detail -{ - template - struct function_arg_to_python : handle<> - { - function_arg_to_python(T const& x); - }; - - template - struct reference_arg_to_python : handle<> - { - reference_arg_to_python(T& x); - private: - static PyObject* get_object(T& x); - }; - - template - struct shared_ptr_arg_to_python : handle<> - { - shared_ptr_arg_to_python(T const& x); - private: - static PyObject* get_object(T& x); - }; - - template - struct value_arg_to_python : arg_to_python_base - { - // Throw an exception if the conversion can't succeed - value_arg_to_python(T const&); - }; - - template - struct pointer_deep_arg_to_python : arg_to_python_base - { - // Throw an exception if the conversion can't succeed - pointer_deep_arg_to_python(Ptr); - }; - - template - struct pointer_shallow_arg_to_python : handle<> - { - // Throw an exception if the conversion can't succeed - pointer_shallow_arg_to_python(Ptr); - private: - static PyObject* get_object(Ptr p); - }; - - // Convert types that manage a Python object to_python - template - struct object_manager_arg_to_python - { - object_manager_arg_to_python(T const& x) : m_src(x) {} - - PyObject* get() const - { - return python::upcast(get_managed_object(m_src, tag)); - } - - private: - T const& m_src; - }; - - template - struct select_arg_to_python - { - typedef typename unwrap_reference::type unwrapped_referent; - typedef typename unwrap_pointer::type unwrapped_ptr; - - typedef typename mpl::if_< - // Special handling for char const[N]; interpret them as char - // const* for the sake of conversion - python::detail::is_string_literal - , arg_to_python - - , typename mpl::if_< - python::detail::value_is_shared_ptr - , shared_ptr_arg_to_python - - , typename mpl::if_< - mpl::or_< - is_function - , indirect_traits::is_pointer_to_function - , is_member_function_pointer - > - , function_arg_to_python - - , typename mpl::if_< - is_object_manager - , object_manager_arg_to_python - - , typename mpl::if_< - is_pointer - , pointer_deep_arg_to_python - - , typename mpl::if_< - is_pointer_wrapper - , pointer_shallow_arg_to_python - - , typename mpl::if_< - is_reference_wrapper - , reference_arg_to_python - , value_arg_to_python - >::type - >::type - >::type - >::type - >::type - >::type - >::type - - type; - }; -} - -template -struct arg_to_python - : detail::select_arg_to_python::type -{ - typedef typename detail::select_arg_to_python::type base; - public: // member functions - // Throw an exception if the conversion can't succeed - arg_to_python(T const& x); -}; - -// -// implementations -// -namespace detail -{ - // reject_raw_object_ptr -- cause a compile-time error if the user - // should pass a raw Python object pointer - using python::detail::yes_convertible; - using python::detail::no_convertible; - using python::detail::unspecialized; - - template struct cannot_convert_raw_PyObject; - - template - struct reject_raw_object_helper - { - static void error(Convertibility) - { - cannot_convert_raw_PyObject::to_python_use_handle_instead(); - } - static void error(...) {} - }; - - template - inline void reject_raw_object_ptr(T*) - { - reject_raw_object_helper::error( - python::detail::convertible::check((T*)0)); - - typedef typename remove_cv::type value_type; - - reject_raw_object_helper::error( - python::detail::convertible::check( - (base_type_traits*)0 - )); - } - // --------- - - template - inline function_arg_to_python::function_arg_to_python(T const& x) - : handle<>(python::objects::make_function_handle(x)) - { - } - - template - inline value_arg_to_python::value_arg_to_python(T const& x) - : arg_to_python_base(&x, registered::converters) - { - } - - template - inline pointer_deep_arg_to_python::pointer_deep_arg_to_python(Ptr x) - : arg_to_python_base(x, registered_pointee::converters) - { - detail::reject_raw_object_ptr((Ptr)0); - } - - template - inline PyObject* reference_arg_to_python::get_object(T& x) - { - to_python_indirect convert; - return convert(x); - } - - template - inline reference_arg_to_python::reference_arg_to_python(T& x) - : handle<>(reference_arg_to_python::get_object(x)) - { - } - - template - inline shared_ptr_arg_to_python::shared_ptr_arg_to_python(T const& x) - : handle<>(shared_ptr_to_python(x)) - { - } - - template - inline pointer_shallow_arg_to_python::pointer_shallow_arg_to_python(Ptr x) - : handle<>(pointer_shallow_arg_to_python::get_object(x)) - { - detail::reject_raw_object_ptr((Ptr)0); - } - - template - inline PyObject* pointer_shallow_arg_to_python::get_object(Ptr x) - { - to_python_indirect convert; - return convert(x); - } -} - -template -inline arg_to_python::arg_to_python(T const& x) - : base(x) -{} - -}}} // namespace boost::python::converter - -#endif // ARG_TO_PYTHON_DWA200265_HPP diff --git a/include/boost/python/converter/arg_to_python_base.hpp b/include/boost/python/converter/arg_to_python_base.hpp deleted file mode 100755 index d85b302e..00000000 --- a/include/boost/python/converter/arg_to_python_base.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 ARG_TO_PYTHON_BASE_DWA200237_HPP -# define ARG_TO_PYTHON_BASE_DWA200237_HPP -# include - -namespace boost { namespace python { namespace converter { - -struct registration; - -namespace detail -{ - struct BOOST_PYTHON_DECL arg_to_python_base -# if !defined(BOOST_MSVC) || BOOST_MSVC <= 1300 || _MSC_FULL_VER > 13102179 - : handle<> -# endif - { - arg_to_python_base(void const volatile* source, registration const&); -# if defined(BOOST_MSVC) && BOOST_MSVC > 1300 && _MSC_FULL_VER <= 13102179 - PyObject* get() const { return m_ptr.get(); } - PyObject* release() { return m_ptr.release(); } - private: - handle<> m_ptr; -# endif - }; -} - -}}} // namespace boost::python::converter - -#endif // ARG_TO_PYTHON_BASE_DWA200237_HPP diff --git a/include/boost/python/converter/as_to_python_function.hpp b/include/boost/python/converter/as_to_python_function.hpp deleted file mode 100644 index b343b4db..00000000 --- a/include/boost/python/converter/as_to_python_function.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 AS_TO_PYTHON_FUNCTION_DWA2002121_HPP -# define AS_TO_PYTHON_FUNCTION_DWA2002121_HPP -# include - -namespace boost { namespace python { namespace converter { - -// Given a typesafe to_python conversion function, produces a -// to_python_function_t which can be registered in the usual way. -template -struct as_to_python_function -{ - // Assertion functions used to prevent wrapping of converters - // which take non-const reference parameters. The T* argument in - // the first overload ensures it isn't used in case T is a - // reference. - template - static void convert_function_must_take_value_or_const_reference(U(*)(T), int, T* = 0) {} - template - static void convert_function_must_take_value_or_const_reference(U(*)(T const&), long ...) {} - - static PyObject* convert(void const* x) - { - convert_function_must_take_value_or_const_reference(&ToPython::convert, 1L); - - // Yes, the const_cast below opens a hole in const-correctness, - // but it's needed to convert auto_ptr to python. - // - // How big a hole is it? It allows ToPython::convert() to be - // a function which modifies its argument. The upshot is that - // client converters applied to const objects may invoke - // undefined behavior. The damage, however, is limited by the - // use of the assertion function. Thus, the only way this can - // modify its argument is if T is an auto_ptr-like type. There - // is still a const-correctness hole w.r.t. auto_ptr const, - // but c'est la vie. - return ToPython::convert(*const_cast(static_cast(x))); - } -}; - -}}} // namespace boost::python::converter - -#endif // AS_TO_PYTHON_FUNCTION_DWA2002121_HPP diff --git a/include/boost/python/converter/builtin_converters.hpp b/include/boost/python/converter/builtin_converters.hpp deleted file mode 100644 index b4bf7b4b..00000000 --- a/include/boost/python/converter/builtin_converters.hpp +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 BUILTIN_CONVERTERS_DWA2002124_HPP -# define BUILTIN_CONVERTERS_DWA2002124_HPP -# include -# include -# include -# include -# include -# include -# include - -// Since all we can use to decide how to convert an object to_python -// is its C++ type, there can be only one such converter for each -// type. Therefore, for built-in conversions we can bypass registry -// lookups using explicit specializations of arg_to_python and -// result_to_python. - -namespace boost { namespace python { - -namespace converter -{ - template struct arg_to_python; - BOOST_PYTHON_DECL PyObject* do_return_to_python(char); - BOOST_PYTHON_DECL PyObject* do_return_to_python(char const*); - BOOST_PYTHON_DECL PyObject* do_return_to_python(PyObject*); - BOOST_PYTHON_DECL PyObject* do_arg_to_python(PyObject*); -} - -// Provide specializations of to_python_value -template struct to_python_value; - -namespace detail -{ - // Since there's no registry lookup, always report the existence of - // a converter. - struct builtin_to_python - { - // This information helps make_getter() decide whether to try to - // return an internal reference or not. I don't like it much, - // but it will have to serve for now. - BOOST_STATIC_CONSTANT(bool, uses_registry = false); - }; -} - -// Use expr to create the PyObject corresponding to x -# define BOOST_PYTHON_RETURN_TO_PYTHON_BY_VALUE(T, expr) \ - template <> struct to_python_value \ - : detail::builtin_to_python \ - { \ - inline PyObject* operator()(T const& x) const \ - { \ - return (expr); \ - } \ - }; \ - template <> struct to_python_value \ - : detail::builtin_to_python \ - { \ - inline PyObject* operator()(T const& x) const \ - { \ - return (expr); \ - } \ - }; - -# define BOOST_PYTHON_ARG_TO_PYTHON_BY_VALUE(T, expr) \ - namespace converter \ - { \ - template <> struct arg_to_python< T > \ - : handle<> \ - { \ - arg_to_python(T const& x) \ - : python::handle<>(expr) {} \ - }; \ - } - -// Specialize argument and return value converters for T using expr -# define BOOST_PYTHON_TO_PYTHON_BY_VALUE(T, expr) \ - BOOST_PYTHON_RETURN_TO_PYTHON_BY_VALUE(T,expr) \ - BOOST_PYTHON_ARG_TO_PYTHON_BY_VALUE(T,expr) - -// Specialize converters for signed and unsigned T to Python Int -# define BOOST_PYTHON_TO_INT(T) \ - BOOST_PYTHON_TO_PYTHON_BY_VALUE(signed T, ::PyInt_FromLong(x)) \ - BOOST_PYTHON_TO_PYTHON_BY_VALUE( \ - unsigned T \ - , static_cast(x) > static_cast( \ - (std::numeric_limits::max)()) \ - ? ::PyLong_FromUnsignedLong(x) \ - : ::PyInt_FromLong(x)) - -// Bool is not signed. -#if PY_VERSION_HEX >= 0x02030000 -BOOST_PYTHON_TO_PYTHON_BY_VALUE(bool, ::PyBool_FromLong(x)) -#else -BOOST_PYTHON_TO_PYTHON_BY_VALUE(bool, ::PyInt_FromLong(x)) -#endif - -// note: handles signed char and unsigned char, but not char (see below) -BOOST_PYTHON_TO_INT(char) - -BOOST_PYTHON_TO_INT(short) -BOOST_PYTHON_TO_INT(int) -BOOST_PYTHON_TO_INT(long) - -// using Python's macro instead of Boost's - we don't seem to get the -// config right all the time. -# ifdef HAVE_LONG_LONG -BOOST_PYTHON_TO_PYTHON_BY_VALUE(signed BOOST_PYTHON_LONG_LONG, ::PyLong_FromLongLong(x)) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(unsigned BOOST_PYTHON_LONG_LONG, ::PyLong_FromUnsignedLongLong(x)) -# endif - -# undef BOOST_TO_PYTHON_INT - -BOOST_PYTHON_TO_PYTHON_BY_VALUE(char, converter::do_return_to_python(x)) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(char const*, converter::do_return_to_python(x)) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::string, ::PyString_FromStringAndSize(x.data(),implicit_cast(x.size()))) -# ifndef BOOST_NO_STD_WSTRING -BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::wstring, ::PyUnicode_FromWideChar(x.data(),implicit_cast(x.size()))) -# endif -BOOST_PYTHON_TO_PYTHON_BY_VALUE(float, ::PyFloat_FromDouble(x)) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(double, ::PyFloat_FromDouble(x)) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(long double, ::PyFloat_FromDouble(x)) -BOOST_PYTHON_RETURN_TO_PYTHON_BY_VALUE(PyObject*, converter::do_return_to_python(x)) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::complex, ::PyComplex_FromDoubles(x.real(), x.imag())) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::complex, ::PyComplex_FromDoubles(x.real(), x.imag())) -BOOST_PYTHON_TO_PYTHON_BY_VALUE(std::complex, ::PyComplex_FromDoubles(x.real(), x.imag())) - -# undef BOOST_PYTHON_RETURN_TO_PYTHON_BY_VALUE -# undef BOOST_PYTHON_ARG_TO_PYTHON_BY_VALUE -# undef BOOST_PYTHON_TO_PYTHON_BY_VALUE -# undef BOOST_PYTHON_TO_INT - -namespace converter -{ - - void initialize_builtin_converters(); - -} - -}} // namespace boost::python::converter - -#endif // BUILTIN_CONVERTERS_DWA2002124_HPP diff --git a/include/boost/python/converter/constructor_function.hpp b/include/boost/python/converter/constructor_function.hpp deleted file mode 100644 index 814aa7d7..00000000 --- a/include/boost/python/converter/constructor_function.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 CONSTRUCTOR_FUNCTION_DWA200278_HPP -# define CONSTRUCTOR_FUNCTION_DWA200278_HPP - -namespace boost { namespace python { namespace converter { - -// Declares the type of functions used to construct C++ objects for -// rvalue from_python conversions. -struct rvalue_from_python_stage1_data; -typedef void (*constructor_function)(PyObject* source, rvalue_from_python_stage1_data*); - -}}} // namespace boost::python::converter - -#endif // CONSTRUCTOR_FUNCTION_DWA200278_HPP diff --git a/include/boost/python/converter/context_result_converter.hpp b/include/boost/python/converter/context_result_converter.hpp deleted file mode 100755 index beb7e9f0..00000000 --- a/include/boost/python/converter/context_result_converter.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef CONTEXT_RESULT_CONVERTER_DWA2003917_HPP -# define CONTEXT_RESULT_CONVERTER_DWA2003917_HPP - -namespace boost { namespace python { namespace converter { - -// A ResultConverter base class used to indicate that this result -// converter should be constructed with the original Python argument -// list. -struct context_result_converter {}; - -}}} // namespace boost::python::converter - -#endif // CONTEXT_RESULT_CONVERTER_DWA2003917_HPP diff --git a/include/boost/python/converter/convertible_function.hpp b/include/boost/python/converter/convertible_function.hpp deleted file mode 100644 index 4b29fbb0..00000000 --- a/include/boost/python/converter/convertible_function.hpp +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 CONVERTIBLE_FUNCTION_DWA200278_HPP -# define CONVERTIBLE_FUNCTION_DWA200278_HPP - -namespace boost { namespace python { namespace converter { - -typedef void* (*convertible_function)(PyObject*); - -}}} // namespace boost::python::converter - -#endif // CONVERTIBLE_FUNCTION_DWA200278_HPP diff --git a/include/boost/python/converter/from_python.hpp b/include/boost/python/converter/from_python.hpp deleted file mode 100644 index b2f24b35..00000000 --- a/include/boost/python/converter/from_python.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 FIND_FROM_PYTHON_DWA2002223_HPP -# define FIND_FROM_PYTHON_DWA2002223_HPP - -# include -# include - -namespace boost { namespace python { namespace converter { - -struct registration; - - -BOOST_PYTHON_DECL void* get_lvalue_from_python( - PyObject* source, registration const&); - -BOOST_PYTHON_DECL bool implicit_rvalue_convertible_from_python( - PyObject* source, registration const&); - -BOOST_PYTHON_DECL rvalue_from_python_stage1_data rvalue_from_python_stage1( - PyObject* source, registration const&); - -BOOST_PYTHON_DECL void* rvalue_from_python_stage2( - PyObject* source, rvalue_from_python_stage1_data&, registration const&); - -BOOST_PYTHON_DECL void* rvalue_result_from_python( - PyObject*, rvalue_from_python_stage1_data&); - -BOOST_PYTHON_DECL void* reference_result_from_python(PyObject*, registration const&); -BOOST_PYTHON_DECL void* pointer_result_from_python(PyObject*, registration const&); - -BOOST_PYTHON_DECL void void_result_from_python(PyObject*); - -BOOST_PYTHON_DECL void throw_no_pointer_from_python(PyObject*, registration const&); -BOOST_PYTHON_DECL void throw_no_reference_from_python(PyObject*, registration const&); - -}}} // namespace boost::python::converter - -#endif // FIND_FROM_PYTHON_DWA2002223_HPP diff --git a/include/boost/python/converter/implicit.hpp b/include/boost/python/converter/implicit.hpp deleted file mode 100644 index 190bab32..00000000 --- a/include/boost/python/converter/implicit.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef IMPLICIT_DWA2002326_HPP -# define IMPLICIT_DWA2002326_HPP - -# include -# include -# include - -# include - -namespace boost { namespace python { namespace converter { - -template -struct implicit -{ - static void* convertible(PyObject* obj) - { - // Find a converter which can produce a Source instance from - // obj. The user has told us that Source can be converted to - // Target, and instantiating construct() below, ensures that - // at compile-time. - return implicit_rvalue_convertible_from_python(obj, registered::converters) - ? obj : 0; - } - - static void construct(PyObject* obj, rvalue_from_python_stage1_data* data) - { - void* storage = ((rvalue_from_python_storage*)data)->storage.bytes; - - new (storage) Target(extract(obj)()); - - // record successful construction - data->convertible = storage; - } -}; - -}}} // namespace boost::python::converter - -#endif // IMPLICIT_DWA2002326_HPP diff --git a/include/boost/python/converter/obj_mgr_arg_from_python.hpp b/include/boost/python/converter/obj_mgr_arg_from_python.hpp deleted file mode 100644 index cd4e1e0e..00000000 --- a/include/boost/python/converter/obj_mgr_arg_from_python.hpp +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 OBJ_MGR_ARG_FROM_PYTHON_DWA2002628_HPP -# define OBJ_MGR_ARG_FROM_PYTHON_DWA2002628_HPP - -# include -# include -# include -# include -# include -# include -# include - -// -// arg_from_python converters for Python type wrappers, to be used as -// base classes for specializations. -// -namespace boost { namespace python { namespace converter { - -template -struct object_manager_value_arg_from_python -{ - typedef T result_type; - - object_manager_value_arg_from_python(PyObject*); - bool convertible() const; - T operator()() const; - private: - PyObject* m_source; -}; - -// Used for converting reference-to-object-manager arguments from -// python. The process used here is a little bit odd. Upon -// construction, we build the object manager object in the m_result -// object, *forcing* it to accept the source Python object by casting -// its pointer to detail::borrowed_reference. This is supposed to -// bypass any type checking of the source object. The convertible -// check then extracts the owned object and checks it. If the check -// fails, nothing else in the program ever gets to touch this strange -// "forced" object. -template -struct object_manager_ref_arg_from_python -{ - typedef Ref result_type; - - object_manager_ref_arg_from_python(PyObject*); - bool convertible() const; - Ref operator()() const; - ~object_manager_ref_arg_from_python(); - private: - typename python::detail::referent_storage::type m_result; -}; - -// -// implementations -// - -template -inline object_manager_value_arg_from_python::object_manager_value_arg_from_python(PyObject* x) - : m_source(x) -{ -} - -template -inline bool object_manager_value_arg_from_python::convertible() const -{ - return object_manager_traits::check(m_source); -} - -template -inline T object_manager_value_arg_from_python::operator()() const -{ - return T(python::detail::borrowed_reference(m_source)); -} - -template -inline object_manager_ref_arg_from_python::object_manager_ref_arg_from_python(PyObject* x) -{ -# if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 243 - // needed for warning suppression - python::detail::borrowed_reference x_ = python::detail::borrowed_reference(x); - python::detail::construct_referent(&m_result.bytes, x_); -# else - python::detail::construct_referent(&m_result.bytes, (python::detail::borrowed_reference)x); -# endif -} - -template -inline object_manager_ref_arg_from_python::~object_manager_ref_arg_from_python() -{ - python::detail::destroy_referent(this->m_result.bytes); -} - -namespace detail -{ - template - inline bool object_manager_ref_check(T const& x) - { - return object_manager_traits::check(get_managed_object(x, tag)); - } -} - -template -inline bool object_manager_ref_arg_from_python::convertible() const -{ - return detail::object_manager_ref_check( - python::detail::void_ptr_to_reference(this->m_result.bytes, (Ref(*)())0)); -} - -template -inline Ref object_manager_ref_arg_from_python::operator()() const -{ - return python::detail::void_ptr_to_reference( - this->m_result.bytes, (Ref(*)())0); -} - -}}} // namespace boost::python::converter - -#endif // OBJ_MGR_ARG_FROM_PYTHON_DWA2002628_HPP diff --git a/include/boost/python/converter/object_manager.hpp b/include/boost/python/converter/object_manager.hpp deleted file mode 100755 index 84e44d47..00000000 --- a/include/boost/python/converter/object_manager.hpp +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 OBJECT_MANAGER_DWA2002614_HPP -# define OBJECT_MANAGER_DWA2002614_HPP - -# include -# include -# include -# include -# include -# include -# include - -// Facilities for dealing with types which always manage Python -// objects. Some examples are object, list, str, et. al. Different -// to_python/from_python conversion rules apply here because in -// contrast to other types which are typically embedded inside a -// Python object, these are wrapped around a Python object. For most -// object managers T, a C++ non-const T reference argument does not -// imply the existence of a T lvalue embedded in the corresponding -// Python argument, since mutating member functions on T actually only -// modify the held Python object. -// -// handle is an object manager, though strictly speaking it should -// not be. In other words, even though mutating member functions of -// hanlde actually modify the handle and not the T object, -// handle& arguments of wrapped functions will bind to "rvalues" -// wrapping the actual Python argument, just as with other object -// manager classes. Making an exception for handle is simply not -// worth the trouble. -// -// borrowed cv* is an object manager so that we can use the general -// to_python mechanisms to convert raw Python object pointers to -// python, without the usual semantic problems of using raw pointers. - - -// Object Manager Concept requirements: -// -// T is an Object Manager -// p is a PyObject* -// x is a T -// -// * object_manager_traits::is_specialized == true -// -// * T(detail::borrowed_reference(p)) -// Manages p without checking its type -// -// * get_managed_object(x, boost::python::tag) -// Convertible to PyObject* -// -// Additional requirements if T can be converted from_python: -// -// * T(object_manager_traits::adopt(p)) -// steals a reference to p, or throws a TypeError exception if -// p doesn't have an appropriate type. May assume p is non-null -// -// * X::check(p) -// convertible to bool. True iff T(X::construct(p)) will not -// throw. - -// Forward declarations -// -namespace boost { namespace python -{ - namespace api - { - class object; - } -}} - -namespace boost { namespace python { namespace converter { - - -// Specializations for handle -template -struct handle_object_manager_traits - : pyobject_traits -{ - private: - typedef pyobject_traits base; - - public: - BOOST_STATIC_CONSTANT(bool, is_specialized = true); - - // Initialize with a null_ok pointer for efficiency, bypassing the - // null check since the source is always non-null. - static null_ok* adopt(PyObject* p) - { - return python::allow_null(base::checked_downcast(p)); - } -}; - -template -struct default_object_manager_traits -{ - BOOST_STATIC_CONSTANT( - bool, is_specialized = python::detail::is_borrowed_ptr::value - ); -}; - -template -struct object_manager_traits - : mpl::if_c< - is_handle::value - , handle_object_manager_traits - , default_object_manager_traits - >::type -{ -}; - -// -// Traits for detecting whether a type is an object manager or a -// (cv-qualified) reference to an object manager. -// - -template -struct is_object_manager - : mpl::bool_::is_specialized> -{ -}; - -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template -struct is_reference_to_object_manager - : mpl::false_ -{ -}; - -template -struct is_reference_to_object_manager - : is_object_manager -{ -}; - -template -struct is_reference_to_object_manager - : is_object_manager -{ -}; - -template -struct is_reference_to_object_manager - : is_object_manager -{ -}; - -template -struct is_reference_to_object_manager - : is_object_manager -{ -}; -# else - -namespace detail -{ - typedef char (&yes_reference_to_object_manager)[1]; - typedef char (&no_reference_to_object_manager)[2]; - - // A number of nastinesses go on here in order to work around MSVC6 - // bugs. - template - struct is_object_manager_help - { - typedef typename mpl::if_< - is_object_manager - , yes_reference_to_object_manager - , no_reference_to_object_manager - >::type type; - - // If we just use the type instead of the result of calling this - // function, VC6 will ICE. - static type call(); - }; - - // A set of overloads for each cv-qualification. The same argument - // is passed twice: the first one is used to unwind the cv*, and the - // second one is used to avoid relying on partial ordering for - // overload resolution. - template - typename is_object_manager_help - is_object_manager_helper(U*, void*); - - template - typename is_object_manager_help - is_object_manager_helper(U const*, void const*); - - template - typename is_object_manager_help - is_object_manager_helper(U volatile*, void volatile*); - - template - typename is_object_manager_help - is_object_manager_helper(U const volatile*, void const volatile*); - - template - struct is_reference_to_object_manager_nonref - : mpl::false_ - { - }; - - template - struct is_reference_to_object_manager_ref - { - static T sample_object; - BOOST_STATIC_CONSTANT( - bool, value - = (sizeof(is_object_manager_helper(&sample_object, &sample_object).call()) - == sizeof(detail::yes_reference_to_object_manager) - ) - ); - typedef mpl::bool_ type; - }; -} - -template -struct is_reference_to_object_manager - : mpl::if_< - is_reference - , detail::is_reference_to_object_manager_ref - , detail::is_reference_to_object_manager_nonref - >::type -{ -}; -# endif - -}}} // namespace boost::python::converter - -#endif // OBJECT_MANAGER_DWA2002614_HPP diff --git a/include/boost/python/converter/pointer_type_id.hpp b/include/boost/python/converter/pointer_type_id.hpp deleted file mode 100644 index 963f58f7..00000000 --- a/include/boost/python/converter/pointer_type_id.hpp +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 POINTER_TYPE_ID_DWA2002222_HPP -# define POINTER_TYPE_ID_DWA2002222_HPP - -# include -# include - -namespace boost { namespace python { namespace converter { - -namespace detail -{ - template - struct pointer_typeid_select - { - template - static inline type_info execute(T*(*)() = 0) - { - return type_id(); - } - }; - - template <> - struct pointer_typeid_select - { - template - static inline type_info execute(T* const volatile&(*)() = 0) - { - return type_id(); - } - - template - static inline type_info execute(T*volatile&(*)() = 0) - { - return type_id(); - } - - template - static inline type_info execute(T*const&(*)() = 0) - { - return type_id(); - } - - template - static inline type_info execute(T*&(*)() = 0) - { - return type_id(); - } - }; -} - -// Usage: pointer_type_id() -// -// Returns a type_info associated with the type pointed -// to by T, which may be a pointer or a reference to a pointer. -template -type_info pointer_type_id(T(*)() = 0) -{ - return detail::pointer_typeid_select< - is_reference::value - >::execute((T(*)())0); -} - -}}} // namespace boost::python::converter - -#endif // POINTER_TYPE_ID_DWA2002222_HPP diff --git a/include/boost/python/converter/pyobject_traits.hpp b/include/boost/python/converter/pyobject_traits.hpp deleted file mode 100644 index ce7d3fb4..00000000 --- a/include/boost/python/converter/pyobject_traits.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 PYOBJECT_TRAITS_DWA2002720_HPP -# define PYOBJECT_TRAITS_DWA2002720_HPP - -# include -# include - -namespace boost { namespace python { namespace converter { - -template struct pyobject_traits; - -template <> -struct pyobject_traits -{ - // All objects are convertible to PyObject - static bool check(PyObject*) { return true; } - static PyObject* checked_downcast(PyObject* x) { return x; } -}; - -// -// Specializations -// - -# define BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(T) \ - template <> struct pyobject_traits \ - : pyobject_type {} - -// This is not an exhaustive list; should be expanded. -BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(Type); -BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(List); -BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(Int); -BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(Long); -BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(Dict); -BOOST_PYTHON_BUILTIN_OBJECT_TRAITS(Tuple); - -}}} // namespace boost::python::converter - -#endif // PYOBJECT_TRAITS_DWA2002720_HPP diff --git a/include/boost/python/converter/pyobject_type.hpp b/include/boost/python/converter/pyobject_type.hpp deleted file mode 100644 index a02974cd..00000000 --- a/include/boost/python/converter/pyobject_type.hpp +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 PYOBJECT_TYPE_DWA2002720_HPP -# define PYOBJECT_TYPE_DWA2002720_HPP - -# include - -namespace boost { namespace python { namespace converter { - -BOOST_PYTHON_DECL PyObject* checked_downcast_impl(PyObject*, PyTypeObject*); - -// Used as a base class for specializations which need to provide -// Python type checking capability. -template -struct pyobject_type -{ - static bool check(PyObject* x) - { - return ::PyObject_IsInstance(x, (PyObject*)pytype); - } - - static Object* checked_downcast(PyObject* x) - { - return python::downcast( - (checked_downcast_impl)(x, pytype) - ); - } -}; - -}}} // namespace boost::python::converter - -#endif // PYOBJECT_TYPE_DWA2002720_HPP diff --git a/include/boost/python/converter/pytype_object_mgr_traits.hpp b/include/boost/python/converter/pytype_object_mgr_traits.hpp deleted file mode 100644 index 8f5b2b76..00000000 --- a/include/boost/python/converter/pytype_object_mgr_traits.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 PYTYPE_OBJECT_MANAGER_TRAITS_DWA2002716_HPP -# define PYTYPE_OBJECT_MANAGER_TRAITS_DWA2002716_HPP - -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace converter { - -// Provide a forward declaration as a convenience for clients, who all -// need it. -template struct object_manager_traits; - -// Derive specializations of object_manager_traits from this class -// when T is an object manager for a particular Python type hierarchy. -// -template -struct pytype_object_manager_traits - : pyobject_type // provides check() -{ - BOOST_STATIC_CONSTANT(bool, is_specialized = true); - static inline python::detail::new_reference adopt(PyObject*); -}; - -// -// implementations -// -template -inline python::detail::new_reference pytype_object_manager_traits::adopt(PyObject* x) -{ - return python::detail::new_reference(python::pytype_check(pytype, x)); -} - -}}} // namespace boost::python::converter - -#endif // PYTYPE_OBJECT_MANAGER_TRAITS_DWA2002716_HPP diff --git a/include/boost/python/converter/registered.hpp b/include/boost/python/converter/registered.hpp deleted file mode 100644 index 72982f48..00000000 --- a/include/boost/python/converter/registered.hpp +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 REGISTERED_DWA2002710_HPP -# define REGISTERED_DWA2002710_HPP -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace converter { - -struct registration; - -namespace detail -{ - template - struct registered_base - { - static registration const& converters; - }; -} - -template -struct registered - : detail::registered_base< - typename add_reference< - typename add_cv::type - >::type - > -{ -}; - -# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) -// collapses a few more types to the same static instance. MSVC7.1 -// fails to strip cv-qualification from array types in typeid. For -// some reason we can't use this collapse there or array converters -// will not be found. -template -struct registered - : registered {}; -# endif - -// -// implementations -// -namespace detail -{ - template - registration const& registered_base::converters - = registry::lookup(type_id()); -} -}}} // namespace boost::python::converter - -#endif // REGISTERED_DWA2002710_HPP diff --git a/include/boost/python/converter/registered_pointee.hpp b/include/boost/python/converter/registered_pointee.hpp deleted file mode 100644 index d9e7ac75..00000000 --- a/include/boost/python/converter/registered_pointee.hpp +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 REGISTERED_POINTEE_DWA2002710_HPP -# define REGISTERED_POINTEE_DWA2002710_HPP -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace converter { - -struct registration; - -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template -struct registered_pointee - : registered< - typename remove_pointer< - typename remove_cv< - typename remove_reference::type - >::type - >::type - > -{ -}; -# else -namespace detail -{ - template - struct registered_pointee_base - { - static registration const& converters; - }; -} - -template -struct registered_pointee - : detail::registered_pointee_base< - typename add_reference< - typename add_cv::type - >::type - > -{ -}; - -// -// implementations -// -namespace detail -{ - template - registration const& registered_pointee_base::converters - = registry::lookup(pointer_type_id()); -} - -# endif -}}} // namespace boost::python::converter - -#endif // REGISTERED_POINTEE_DWA2002710_HPP diff --git a/include/boost/python/converter/registrations.hpp b/include/boost/python/converter/registrations.hpp deleted file mode 100644 index a18bec29..00000000 --- a/include/boost/python/converter/registrations.hpp +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 REGISTRATIONS_DWA2002223_HPP -# define REGISTRATIONS_DWA2002223_HPP - -# include - -# include - -# include -# include -# include - -# include - -namespace boost { namespace python { namespace converter { - -struct lvalue_from_python_chain -{ - convertible_function convert; - lvalue_from_python_chain* next; -}; - -struct rvalue_from_python_chain -{ - convertible_function convertible; - constructor_function construct; - rvalue_from_python_chain* next; -}; - -struct BOOST_PYTHON_DECL registration -{ - public: // member functions - explicit registration(type_info); - - // Convert the appropriately-typed data to Python - PyObject* to_python(void const volatile*) const; - - // Return the class object, or raise an appropriate Python - // exception if no class has been registered. - PyTypeObject* get_class_object() const; - - public: // data members. So sue me. - const python::type_info target_type; - - // The chain of eligible from_python converters when an lvalue is required - lvalue_from_python_chain* lvalue_chain; - - // The chain of eligible from_python converters when an rvalue is acceptable - rvalue_from_python_chain* rvalue_chain; - - // The class object associated with this type - PyTypeObject* m_class_object; - - // The unique to_python converter for the associated C++ type. - to_python_function_t m_to_python; - -# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) - private: - void operator=(registration); // This is not defined, and just keeps MWCW happy. -# endif -}; - -// -// implementations -// -inline registration::registration(type_info target_type) - : target_type(target_type) - , lvalue_chain(0) - , rvalue_chain(0) - , m_class_object(0) - , m_to_python(0) -{} - -inline bool operator<(registration const& lhs, registration const& rhs) -{ - return lhs.target_type < rhs.target_type; -} - -}}} // namespace boost::python::converter - -#endif // REGISTRATIONS_DWA2002223_HPP diff --git a/include/boost/python/converter/registry.hpp b/include/boost/python/converter/registry.hpp deleted file mode 100644 index 8e7497d9..00000000 --- a/include/boost/python/converter/registry.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef REGISTRY_DWA20011127_HPP -# define REGISTRY_DWA20011127_HPP -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace converter { - -struct registration; - -// This namespace acts as a sort of singleton -namespace registry -{ - // Get the registration corresponding to the type, creating it if neccessary - BOOST_PYTHON_DECL registration const& lookup(type_info); - - // Return a pointer to the corresponding registration, if one exists - BOOST_PYTHON_DECL registration const* query(type_info); - - BOOST_PYTHON_DECL void insert(to_python_function_t, type_info); - - // Insert an lvalue from_python converter - BOOST_PYTHON_DECL void insert(void* (*convert)(PyObject*), type_info); - - // Insert an rvalue from_python converter - BOOST_PYTHON_DECL void insert( - convertible_function - , constructor_function - , type_info - ); - - // Insert an rvalue from_python converter at the tail of the - // chain. Used for implicit conversions - BOOST_PYTHON_DECL void push_back( - convertible_function - , constructor_function - , type_info - ); -} - -}}} // namespace boost::python::converter - -#endif // REGISTRY_DWA20011127_HPP diff --git a/include/boost/python/converter/return_from_python.hpp b/include/boost/python/converter/return_from_python.hpp deleted file mode 100755 index 5db97485..00000000 --- a/include/boost/python/converter/return_from_python.hpp +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 RETURN_FROM_PYTHON_DWA200265_HPP -# define RETURN_FROM_PYTHON_DWA200265_HPP - -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace converter { - -template struct is_object_manager; - -namespace detail -{ - template - struct return_pointer_from_python - { - typedef T result_type; - T operator()(PyObject*) const; - }; - - template - struct return_reference_from_python - { - typedef T result_type; - T operator()(PyObject*) const; - }; - - template - struct return_rvalue_from_python - { - typedef T result_type; - - return_rvalue_from_python(); - result_type operator()(PyObject*); - private: - rvalue_from_python_data m_data; - }; - - template - struct return_object_manager_from_python - { - typedef T result_type; - result_type operator()(PyObject*) const; - }; - - template - struct select_return_from_python - { - BOOST_STATIC_CONSTANT( - bool, obj_mgr = is_object_manager::value); - - BOOST_STATIC_CONSTANT( - bool, ptr = is_pointer::value); - - BOOST_STATIC_CONSTANT( - bool, ref = is_reference::value); - - typedef typename mpl::if_c< - obj_mgr - , return_object_manager_from_python - , typename mpl::if_c< - ptr - , return_pointer_from_python - , typename mpl::if_c< - ref - , return_reference_from_python - , return_rvalue_from_python - >::type - >::type - >::type type; - }; -} - -template -struct return_from_python - : detail::select_return_from_python::type -{ -}; - -// Specialization as a convenience for call and call_method -template <> -struct return_from_python -{ - typedef python::detail::returnable::type result_type; - - result_type operator()(PyObject* x) const - { - (void_result_from_python)(x); -# ifdef BOOST_NO_VOID_RETURNS - return result_type(); -# endif - } -}; - -// -// Implementations -// -namespace detail -{ - template - inline return_rvalue_from_python::return_rvalue_from_python() - : m_data( - const_cast(®istered::converters) - ) - { - } - - template - inline typename return_rvalue_from_python::result_type - return_rvalue_from_python::operator()(PyObject* obj) - { - // Take possession of the source object here. If the result is in - // fact going to be a copy of an lvalue embedded in the object, - // and we take possession inside rvalue_result_from_python, it - // will be destroyed too early. - handle<> holder(obj); - - return *(T*) - (rvalue_result_from_python)(obj, m_data.stage1); - } - - template - inline T return_reference_from_python::operator()(PyObject* obj) const - { - return python::detail::void_ptr_to_reference( - (reference_result_from_python)(obj, registered::converters) - , (T(*)())0); - } - - template - inline T return_pointer_from_python::operator()(PyObject* obj) const - { - return T( - (pointer_result_from_python)(obj, registered_pointee::converters) - ); - } - - template - inline T return_object_manager_from_python::operator()(PyObject* obj) const - { - return T( - object_manager_traits::adopt(expect_non_null(obj)) - ); - } -} - -}}} // namespace boost::python::converter - -#endif // RETURN_FROM_PYTHON_DWA200265_HPP diff --git a/include/boost/python/converter/rvalue_from_python_data.hpp b/include/boost/python/converter/rvalue_from_python_data.hpp deleted file mode 100644 index 7d2b3e07..00000000 --- a/include/boost/python/converter/rvalue_from_python_data.hpp +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 FROM_PYTHON_AUX_DATA_DWA2002128_HPP -# define FROM_PYTHON_AUX_DATA_DWA2002128_HPP - -# include -# include -# include -# include -# include -# include -# include - -// Data management for potential rvalue conversions from Python to C++ -// types. When a client requests a conversion to T* or T&, we -// generally require that an object of type T exists in the source -// Python object, and the code here does not apply**. This implements -// conversions which may create new temporaries of type T. The classic -// example is a conversion which converts a Python tuple to a -// std::vector. Since no std::vector lvalue exists in the Python -// object -- it must be created "on-the-fly" by the converter, and -// which must manage the lifetime of the created object. -// -// Note that the client is not precluded from using a registered -// lvalue conversion to T in this case. In other words, we will -// happily accept a Python object which /does/ contain a std::vector -// lvalue, provided an appropriate converter is registered. So, while -// this is an rvalue conversion from the client's point-of-view, the -// converter registry may serve up lvalue or rvalue conversions for -// the target type. -// -// ** C++ argument from_python conversions to T const& are an -// exception to the rule for references: since in C++, const -// references can bind to temporary rvalues, we allow rvalue -// converters to be chosen when the target type is T const& for some -// T. -namespace boost { namespace python { namespace converter { - -// Conversions begin by filling in and returning a copy of this -// structure. The process looks up a converter in the rvalue converter -// registry for the target type. It calls the convertible() function -// of each registered converter, passing the source PyObject* as an -// argument, until a non-null result is returned. This result goes in -// the convertible field, and the converter's construct() function is -// stored in the construct field. -// -// If no appropriate converter is found, conversion fails and the -// convertible field is null. When used in argument conversion for -// wrapped C++ functions, it causes overload resolution to reject the -// current function but not to fail completely. If an exception is -// thrown, overload resolution stops and the exception propagates back -// through the caller. -// -// If an lvalue converter is matched, its convertible() function is -// expected to return a pointer to the stored T object; its -// construct() function will be NULL. The convertible() function of -// rvalue converters may return any non-singular pointer; the actual -// target object will only be available once the converter's -// construct() function is called. -struct rvalue_from_python_stage1_data -{ - void* convertible; - constructor_function construct; -}; - -// Augments rvalue_from_python_stage1_data by adding storage for -// constructing an object of remove_reference::type. The -// construct() function of rvalue converters (stored in m_construct -// above) will cast the rvalue_from_python_stage1_data to an -// appropriate instantiation of this template in order to access that -// storage. -template -struct rvalue_from_python_storage -{ - rvalue_from_python_stage1_data stage1; - - // Storage for the result, in case an rvalue must be constructed - typename python::detail::referent_storage< - typename add_reference::type - >::type storage; -}; - -// Augments rvalue_from_python_storage with a destructor. If -// stage1.convertible == storage.bytes, it indicates that an object of -// remove_reference::type has been constructed in storage and -// should will be destroyed in ~rvalue_from_python_data(). It is -// crucial that successful rvalue conversions establish this equality -// and that unsuccessful ones do not. -template -struct rvalue_from_python_data : rvalue_from_python_storage -{ -# if (!defined(__MWERKS__) || __MWERKS__ >= 0x3000) \ - && (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 245) \ - && (!defined(__DECCXX_VER) || __DECCXX_VER > 60590014) \ - && !defined(BOOST_PYTHON_SYNOPSIS) /* Synopsis' OpenCXX has trouble parsing this */ - // This must always be a POD struct with m_data its first member. - BOOST_STATIC_ASSERT(BOOST_PYTHON_OFFSETOF(rvalue_from_python_storage,stage1) == 0); -# endif - - // The usual constructor - rvalue_from_python_data(rvalue_from_python_stage1_data const&); - - // This constructor just sets m_convertible -- used by - // implicitly_convertible<> to perform the final step of the - // conversion, where the construct() function is already known. - rvalue_from_python_data(void* convertible); - - // Destroys any object constructed in the storage. - ~rvalue_from_python_data(); - private: - typedef typename add_reference::type>::type ref_type; -}; - -// -// Implementataions -// -template -inline rvalue_from_python_data::rvalue_from_python_data(rvalue_from_python_stage1_data const& stage1) -{ - this->stage1 = stage1; -} - -template -inline rvalue_from_python_data::rvalue_from_python_data(void* convertible) -{ - this->stage1.convertible = convertible; -} - -template -inline rvalue_from_python_data::~rvalue_from_python_data() -{ - if (this->stage1.convertible == this->storage.bytes) - python::detail::destroy_referent(this->storage.bytes); -} - -}}} // namespace boost::python::converter - -#endif // FROM_PYTHON_AUX_DATA_DWA2002128_HPP diff --git a/include/boost/python/converter/shared_ptr_deleter.hpp b/include/boost/python/converter/shared_ptr_deleter.hpp deleted file mode 100644 index 926508d0..00000000 --- a/include/boost/python/converter/shared_ptr_deleter.hpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 SHARED_PTR_DELETER_DWA2002121_HPP -# define SHARED_PTR_DELETER_DWA2002121_HPP - -namespace boost { namespace python { namespace converter { - -struct BOOST_PYTHON_DECL shared_ptr_deleter -{ - shared_ptr_deleter(handle<> owner); - ~shared_ptr_deleter(); - - void operator()(void const*); - - handle<> owner; -}; - -}}} // namespace boost::python::converter - -#endif // SHARED_PTR_DELETER_DWA2002121_HPP diff --git a/include/boost/python/converter/shared_ptr_from_python.hpp b/include/boost/python/converter/shared_ptr_from_python.hpp deleted file mode 100644 index 577fb447..00000000 --- a/include/boost/python/converter/shared_ptr_from_python.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 SHARED_PTR_FROM_PYTHON_DWA20021130_HPP -# define SHARED_PTR_FROM_PYTHON_DWA20021130_HPP - -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace converter { - -template -struct shared_ptr_from_python -{ - shared_ptr_from_python() - { - converter::registry::insert(&convertible, &construct, type_id >()); - } - - private: - static void* convertible(PyObject* p) - { - if (p == Py_None) - return p; - - return converter::get_lvalue_from_python(p, registered::converters); - } - - static void construct(PyObject* source, rvalue_from_python_stage1_data* data) - { - void* const storage = ((converter::rvalue_from_python_storage >*)data)->storage.bytes; - // Deal with the "None" case. - if (data->convertible == source) - new (storage) shared_ptr(); - else - new (storage) shared_ptr( - static_cast(data->convertible), - shared_ptr_deleter(handle<>(borrowed(source))) - ); - - data->convertible = storage; - } -}; - -}}} // namespace boost::python::converter - -#endif // SHARED_PTR_FROM_PYTHON_DWA20021130_HPP diff --git a/include/boost/python/converter/shared_ptr_to_python.hpp b/include/boost/python/converter/shared_ptr_to_python.hpp deleted file mode 100644 index fe867ace..00000000 --- a/include/boost/python/converter/shared_ptr_to_python.hpp +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef SHARED_PTR_TO_PYTHON_DWA2003224_HPP -# define SHARED_PTR_TO_PYTHON_DWA2003224_HPP - -# include -# include -# include -# include - -namespace boost { namespace python { namespace converter { - -template -PyObject* shared_ptr_to_python(shared_ptr const& x) -{ - if (!x) - return python::detail::none(); - else if (shared_ptr_deleter* d = boost::get_deleter(x)) - return incref( get_pointer( d->owner ) ); - else - return converter::registered const&>::converters.to_python(&x); -} - -}}} // namespace boost::python::converter - -#endif // SHARED_PTR_TO_PYTHON_DWA2003224_HPP diff --git a/include/boost/python/converter/to_python_function_type.hpp b/include/boost/python/converter/to_python_function_type.hpp deleted file mode 100644 index cccd014d..00000000 --- a/include/boost/python/converter/to_python_function_type.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 TO_PYTHON_FUNCTION_TYPE_DWA200236_HPP -# define TO_PYTHON_FUNCTION_TYPE_DWA200236_HPP -# include -# include - -namespace boost { namespace python { namespace converter { - -// The type of stored function pointers which actually do conversion -// by-value. The void* points to the object to be converted, and -// type-safety is preserved through runtime registration. -typedef PyObject* (*to_python_function_t)(void const*); - -}}} // namespace boost::python::converter - -#endif // TO_PYTHON_FUNCTION_TYPE_DWA200236_HPP diff --git a/include/boost/python/copy_const_reference.hpp b/include/boost/python/copy_const_reference.hpp deleted file mode 100644 index 19e3b423..00000000 --- a/include/boost/python/copy_const_reference.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 COPY_CONST_REFERENCE_DWA2002131_HPP -# define COPY_CONST_REFERENCE_DWA2002131_HPP - -# include -# include -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - template - struct copy_const_reference_expects_a_const_reference_return_type -# if defined(__GNUC__) && __GNUC__ >= 3 || defined(__EDG__) - {} -# endif - ; -} - -template struct to_python_value; - -struct copy_const_reference -{ - template - struct apply - { - typedef typename mpl::if_c< - indirect_traits::is_reference_to_const::value - , to_python_value - , detail::copy_const_reference_expects_a_const_reference_return_type - >::type type; - }; -}; - - -}} // namespace boost::python - -#endif // COPY_CONST_REFERENCE_DWA2002131_HPP diff --git a/include/boost/python/copy_non_const_reference.hpp b/include/boost/python/copy_non_const_reference.hpp deleted file mode 100644 index 78b70f5d..00000000 --- a/include/boost/python/copy_non_const_reference.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 COPY_NON_CONST_REFERENCE_DWA2002131_HPP -# define COPY_NON_CONST_REFERENCE_DWA2002131_HPP - -# include -# include -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - template - struct copy_non_const_reference_expects_a_non_const_reference_return_type -# if defined(__GNUC__) && __GNUC__ >= 3 || defined(__EDG__) - {} -# endif - ; -} - -template struct to_python_value; - -struct copy_non_const_reference -{ - template - struct apply - { - typedef typename mpl::if_c< - indirect_traits::is_reference_to_non_const::value - , to_python_value - , detail::copy_non_const_reference_expects_a_non_const_reference_return_type - >::type type; - }; -}; - - -}} // namespace boost::python - -#endif // COPY_NON_CONST_REFERENCE_DWA2002131_HPP diff --git a/include/boost/python/data_members.hpp b/include/boost/python/data_members.hpp deleted file mode 100644 index 8cbc0ac3..00000000 --- a/include/boost/python/data_members.hpp +++ /dev/null @@ -1,316 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 DATA_MEMBERS_DWA2002328_HPP -# define DATA_MEMBERS_DWA2002328_HPP - -# include - -# include - -# include -# include -# include -# include - -# include - -# include -# include -# include - -# include -# include -# include - -# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) -# include -# endif - -# include -# include -# include - -# include - -namespace boost { namespace python { - -// -// This file defines the make_getter and make_setter function -// families, which are responsible for turning pointers, references, -// and pointers-to-data-members into callable Python objects which -// can be used for attribute access on wrapped classes. -// - -namespace detail -{ - - // A small function object which handles the getting and setting of - // data members. - template - struct member - { - public: - member(Data Class::*which) : m_which(which) {} - - Data& operator()(Class& c) const - { - return c.*m_which; - } - - void operator()(Class& c, typename value_arg::type d) const - { - c.*m_which = d; - } - private: - Data Class::*m_which; - }; - - // A small function object which handles the getting and setting of - // non-member objects. - template - struct datum - { - public: - datum(Data *which) : m_which(which) {} - - Data& operator()() const - { - return *m_which; - } - - void operator()(typename value_arg::type d) const - { - *m_which = d; - } - private: - Data *m_which; - }; - - // - // Helper metafunction for determining the default CallPolicy to use - // for attribute access. If T is a [reference to a] class type X - // whose conversion to python would normally produce a new copy of X - // in a wrapped X class instance (as opposed to types such as - // std::string, which are converted to native Python types, and - // smart pointer types which produce a wrapped class instance of the - // pointee type), to-python conversions will attempt to produce an - // object which refers to the original C++ object, rather than a - // copy. See default_member_getter_policy for rationale. - // - template - struct default_getter_by_ref - : mpl::and_< - mpl::bool_< - to_python_value< - typename value_arg::type - >::uses_registry - > - , indirect_traits::is_reference_to_class< - typename value_arg::type - > - > - { - }; - - // Metafunction computing the default CallPolicy to use for reading - // data members - // - // If it's a regular class type (not an object manager or other - // type for which we have to_python specializations, use - // return_internal_reference so that we can do things like - // x.y.z = 1 - // and get the right result. - template - struct default_member_getter_policy - : mpl::if_< - default_getter_by_ref - , return_internal_reference<> - , return_value_policy - > - {}; - - // Metafunction computing the default CallPolicy to use for reading - // non-member data. - template - struct default_datum_getter_policy - : mpl::if_< - default_getter_by_ref - , return_value_policy - , return_value_policy - > - {}; - - // - // make_getter helper function family -- These helpers to - // boost::python::make_getter are used to dispatch behavior. The - // third argument is a workaround for a CWPro8 partial ordering bug - // with pointers to data members. It should be convertible to - // mpl::true_ iff the first argument is a pointer-to-member, and - // mpl::false_ otherwise. The fourth argument is for compilers - // which don't support partial ordering at all and should always be - // passed 0L. - // - -#if BOOST_WORKAROUND(__EDG_VERSION__, <= 238) - template - inline object make_getter(D& d, P& p, mpl::false_, ...); -#endif - - // Handle non-member pointers with policies - template - inline object make_getter(D* d, Policies const& policies, mpl::false_, int) - { - return python::make_function( - detail::datum(d), policies, mpl::vector1() - ); - } - - // Handle non-member pointers without policies - template - inline object make_getter(D* d, not_specified, mpl::false_, long) - { - typedef typename default_datum_getter_policy::type policies; - return detail::make_getter(d, policies(), mpl::false_(), 0); - } - - // Handle pointers-to-members with policies - template - inline object make_getter(D C::*pm, Policies const& policies, mpl::true_, int) - { -#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) - typedef typename remove_cv::type Class; -#else - typedef C Class; -#endif - return python::make_function( - detail::member(pm) - , policies - , mpl::vector2() - ); - } - - // Handle pointers-to-members without policies - template - inline object make_getter(D C::*pm, not_specified, mpl::true_, long) - { - typedef typename default_member_getter_policy::type policies; - return detail::make_getter(pm, policies(), mpl::true_(), 0); - } - - // Handle references - template - inline object make_getter(D& d, P& p, mpl::false_, ...) - { - // Just dispatch to the handler for pointer types. - return detail::make_getter(&d, p, mpl::false_(), 0L); - } - - // - // make_setter helper function family -- These helpers to - // boost::python::make_setter are used to dispatch behavior. The - // third argument is for compilers which don't support partial - // ordering at all and should always be passed 0. - // - - - // Handle non-member pointers - template - inline object make_setter(D* p, Policies const& policies, mpl::false_, int) - { - return python::make_function( - detail::datum(p), policies, mpl::vector2() - ); - } - - // Handle pointers-to-members - template - inline object make_setter(D C::*pm, Policies const& policies, mpl::true_, int) - { - return python::make_function( - detail::member(pm) - , policies - , mpl::vector3() - ); - } - - // Handle references - template - inline object make_setter(D& x, Policies const& policies, mpl::false_, ...) - { - return detail::make_setter(&x, policies, mpl::false_(), 0L); - } -} - -// -// make_getter function family -- build a callable object which -// retrieves data through the first argument and is appropriate for -// use as the `get' function in Python properties . The second, -// policies argument, is optional. We need both D& and D const& -// overloads in order be able to handle rvalues. -// -template -inline object make_getter(D& d, Policies const& policies) -{ - return detail::make_getter(d, policies, is_member_pointer(), 0L); -} - -template -inline object make_getter(D const& d, Policies const& policies) -{ - return detail::make_getter(d, policies, is_member_pointer(), 0L); -} - -template -inline object make_getter(D& x) -{ - detail::not_specified policy; - return detail::make_getter(x, policy, is_member_pointer(), 0L); -} - -# if !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) && !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -template -inline object make_getter(D const& d) -{ - detail::not_specified policy; - return detail::make_getter(d, policy, is_member_pointer(), 0L); -} -# endif - -// -// make_setter function family -- build a callable object which -// writes data through the first argument and is appropriate for -// use as the `set' function in Python properties . The second, -// policies argument, is optional. We need both D& and D const& -// overloads in order be able to handle rvalues. -// -template -inline object make_setter(D& x, Policies const& policies) -{ - return detail::make_setter(x, policies, is_member_pointer(), 0); -} - -template -inline object make_setter(D const& x, Policies const& policies) -{ - return detail::make_setter(x, policies, is_member_pointer(), 0); -} - -template -inline object make_setter(D& x) -{ - return detail::make_setter(x, default_call_policies(), is_member_pointer(), 0); -} - -# if !(BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || BOOST_WORKAROUND(__EDG_VERSION__, <= 238)) -template -inline object make_setter(D const& x) -{ - return detail::make_setter(x, default_call_policies(), is_member_pointer(), 0); -} -# endif - -}} // namespace boost::python - -#endif // DATA_MEMBERS_DWA2002328_HPP diff --git a/include/boost/python/def.hpp b/include/boost/python/def.hpp deleted file mode 100644 index 76829b08..00000000 --- a/include/boost/python/def.hpp +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 DEF_DWA200292_HPP -# define DEF_DWA200292_HPP - -# include - -# include -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - namespace error - { - // Compile-time error messages - template struct multiple_functions_passed_to_def; - template <> struct multiple_functions_passed_to_def { typedef char type; }; - } - - // - // def_from_helper -- - // - // Use a def_helper to define a regular wrapped function in the current scope. - template - void def_from_helper( - char const* name, F const& fn, Helper const& helper) - { - // Must not try to use default implementations except with method definitions. - typedef typename error::multiple_functions_passed_to_def< - Helper::has_default_implementation - >::type assertion; - - detail::scope_setattr_doc( - name, boost::python::make_function( - fn - , helper.policies() - , helper.keywords()) - , helper.doc() - ); - } - - // - // These two overloads discriminate between def() as applied to - // regular functions and def() as applied to the result of - // BOOST_PYTHON_FUNCTION_OVERLOADS(). The final argument is used to - // discriminate. - // - template - void - def_maybe_overloads( - char const* name - , Fn fn - , A1 const& a1 - , ...) - { - detail::def_from_helper(name, fn, def_helper(a1)); - } - - template - void def_maybe_overloads( - char const* name - , SigT sig - , StubsT const& stubs - , detail::overloads_base const*) - { - scope current; - - detail::define_with_defaults( - name, stubs, current, detail::get_signature(sig)); - } - - template - object make_function1(T fn, ...) { return make_function(fn); } - - inline - object make_function1(object const& x, object const*) { return x; } -} - -template -void def(char const* name, Fn fn) -{ - detail::scope_setattr_doc(name, detail::make_function1(fn, &fn), 0); -} - -template -void def(char const* name, Arg1T arg1, Arg2T const& arg2) -{ - detail::def_maybe_overloads(name, arg1, arg2, &arg2); -} - -template -void def(char const* name, F f, A1 const& a1, A2 const& a2) -{ - detail::def_from_helper(name, f, detail::def_helper(a1,a2)); -} - -template -void def(char const* name, F f, A1 const& a1, A2 const& a2, A3 const& a3) -{ - detail::def_from_helper(name, f, detail::def_helper(a1,a2,a3)); -} - -}} // namespace boost::python - -#endif // DEF_DWA200292_HPP diff --git a/include/boost/python/def_visitor.hpp b/include/boost/python/def_visitor.hpp deleted file mode 100755 index 9c8907cd..00000000 --- a/include/boost/python/def_visitor.hpp +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef DEF_VISITOR_DWA2003810_HPP -# define DEF_VISITOR_DWA2003810_HPP - -# include -# include - -namespace boost { namespace python { - -template class def_visitor; -template class class_; - -class def_visitor_access -{ -# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) \ - || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) - // Tasteless as this may seem, making all members public allows member templates - // to work in the absence of member template friends. - public: -# else - template friend class def_visitor; -# endif - - // unnamed visit, c.f. init<...>, container suites - template - static void visit(V const& v, classT& c) - { - v.derived_visitor().visit(c); - } - - // named visit, c.f. object, pure_virtual - template - static void visit( - V const& v - , classT& c - , char const* name - , OptionalArgs const& options - ) - { - v.derived_visitor().visit(c, name, options); - } - -}; - - -template -class def_visitor -{ - friend class def_visitor_access; - -# if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) \ - || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) - // Tasteless as this may seem, making all members public allows member templates - // to work in the absence of member template friends. - public: -# else - template friend class class_; -# endif - - // unnamed visit, c.f. init<...>, container suites - template - void visit(classT& c) const - { - def_visitor_access::visit(*this, c); - } - - // named visit, c.f. object, pure_virtual - template - void visit(classT& c, char const* name, OptionalArgs const& options) const - { - def_visitor_access::visit(*this, c, name, options); - } - - protected: - DerivedVisitor const& derived_visitor() const - { - return static_cast(*this); - } -}; - -}} // namespace boost::python - -#endif // DEF_VISITOR_DWA2003810_HPP diff --git a/include/boost/python/default_call_policies.hpp b/include/boost/python/default_call_policies.hpp deleted file mode 100644 index 800cce79..00000000 --- a/include/boost/python/default_call_policies.hpp +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 DEFAULT_CALL_POLICIES_DWA2002131_HPP -# define DEFAULT_CALL_POLICIES_DWA2002131_HPP - -# include -# include -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { - -template struct to_python_value; - -namespace detail -{ -// for "readable" error messages - template struct specify_a_return_value_policy_to_wrap_functions_returning -# if defined(__GNUC__) && __GNUC__ >= 3 || defined(__EDG__) - {} -# endif - ; -} - -struct default_result_converter; - -struct default_call_policies -{ - // Ownership of this argument tuple will ultimately be adopted by - // the caller. - template - static bool precall(ArgumentPackage const&) - { - return true; - } - - // Pass the result through - template - static PyObject* postcall(ArgumentPackage const&, PyObject* result) - { - return result; - } - - typedef default_result_converter result_converter; - typedef PyObject* argument_package; -}; - -struct default_result_converter -{ - template - struct apply - { - typedef typename mpl::if_< - mpl::or_, is_reference > - , detail::specify_a_return_value_policy_to_wrap_functions_returning - , boost::python::to_python_value< - typename detail::value_arg::type - > - >::type type; - }; -}; - -// Exceptions for c strings an PyObject*s -template <> -struct default_result_converter::apply -{ - typedef boost::python::to_python_value type; -}; - -template <> -struct default_result_converter::apply -{ - typedef boost::python::to_python_value type; -}; - -}} // namespace boost::python - -#endif // DEFAULT_CALL_POLICIES_DWA2002131_HPP diff --git a/include/boost/python/detail/aix_init_module.hpp b/include/boost/python/detail/aix_init_module.hpp deleted file mode 100644 index 9214dbf0..00000000 --- a/include/boost/python/detail/aix_init_module.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 AIX_INIT_MODULE_DWA2002529_HPP -# define AIX_INIT_MODULE_DWA2002529_HPP -# ifdef _AIX -# include -# include -# ifdef __KCC -# include // this works around a problem in KCC 4.0f -# endif - -namespace boost { namespace python { namespace detail { - -extern "C" -{ - typedef PyObject* (*so_load_function)(char*,char*,FILE*); -} - -void aix_init_module(so_load_function, char const* name, void (*init_module)()); - -}}} // namespace boost::python::detail -# endif - -#endif // AIX_INIT_MODULE_DWA2002529_HPP diff --git a/include/boost/python/detail/api_placeholder.hpp b/include/boost/python/detail/api_placeholder.hpp deleted file mode 100644 index 61276a9f..00000000 --- a/include/boost/python/detail/api_placeholder.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PYTHON_API_PLACE_HOLDER_HPP -#define BOOST_PYTHON_API_PLACE_HOLDER_HPP - -namespace boost { namespace python { - - inline long len(object const& obj) - { - long result = PyObject_Length(obj.ptr()); - if (PyErr_Occurred()) throw_error_already_set(); - return result; - } -}} // namespace boost::python - -#endif // BOOST_PYTHON_API_PLACE_HOLDER_HPP diff --git a/include/boost/python/detail/borrowed_ptr.hpp b/include/boost/python/detail/borrowed_ptr.hpp deleted file mode 100755 index b88457b8..00000000 --- a/include/boost/python/detail/borrowed_ptr.hpp +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef BORROWED_PTR_DWA20020601_HPP -# define BORROWED_PTR_DWA20020601_HPP -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace detail { - -template class borrowed -{ - typedef T type; -}; - -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template -struct is_borrowed_ptr -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; - -# if !defined(__MWERKS__) || __MWERKS__ > 0x3000 -template -struct is_borrowed_ptr*> -{ - BOOST_STATIC_CONSTANT(bool, value = true); -}; - -template -struct is_borrowed_ptr const*> -{ - BOOST_STATIC_CONSTANT(bool, value = true); -}; - -template -struct is_borrowed_ptr volatile*> -{ - BOOST_STATIC_CONSTANT(bool, value = true); -}; - -template -struct is_borrowed_ptr const volatile*> -{ - BOOST_STATIC_CONSTANT(bool, value = true); -}; -# else -template -struct is_borrowed -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; -template -struct is_borrowed > -{ - BOOST_STATIC_CONSTANT(bool, value = true); -}; -template -struct is_borrowed_ptr - : is_borrowed::type> -{ -}; -# endif - -# else // no partial specialization - -typedef char (&yes_borrowed_ptr_t)[1]; -typedef char (&no_borrowed_ptr_t)[2]; - -no_borrowed_ptr_t is_borrowed_ptr_test(...); - -template -typename mpl::if_c< - is_pointer::value - , T - , int - >::type -is_borrowed_ptr_test1(boost::type); - -template -yes_borrowed_ptr_t is_borrowed_ptr_test(borrowed const volatile*); - -template -class is_borrowed_ptr -{ - public: - BOOST_STATIC_CONSTANT( - bool, value = ( - sizeof(detail::is_borrowed_ptr_test(is_borrowed_ptr_test1(boost::type()))) - == sizeof(detail::yes_borrowed_ptr_t))); -}; - -# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -} - -template -inline T* get_managed_object(detail::borrowed const volatile* p, tag_t) -{ - return (T*)p; -} - -}} // namespace boost::python::detail - -#endif // #ifndef BORROWED_PTR_DWA20020601_HPP diff --git a/include/boost/python/detail/caller.hpp b/include/boost/python/detail/caller.hpp deleted file mode 100644 index 1054b6e2..00000000 --- a/include/boost/python/detail/caller.hpp +++ /dev/null @@ -1,220 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2002. -// 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 CALLER_DWA20021121_HPP -# define CALLER_DWA20021121_HPP - -# include -# include - -# include -# include -# include - -# include -# include - -# include -# include -# include -# include -# include -# include -# include - -# include - -# include -# include - -# include -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace detail { - -template -inline PyObject* get(mpl::int_, PyObject* const& args_) -{ - return PyTuple_GET_ITEM(args_,N); -} - -inline unsigned arity(PyObject* const& args_) -{ - return PyTuple_GET_SIZE(args_); -} - -// This "result converter" is really just used as -// a dispatch tag to invoke(...), selecting the appropriate -// implementation -typedef int void_result_to_python; - -// Given a model of CallPolicies and a C++ result type, this -// metafunction selects the appropriate converter to use for -// converting the result to python. -template -struct select_result_converter - : mpl::eval_if< - is_same - , mpl::identity - , mpl::apply1 - > -{ -}; - -template -inline ResultConverter create_result_converter( - ArgPackage const& args_ - , ResultConverter* - , converter::context_result_converter* -) -{ - return ResultConverter(args_); -} - -template -inline ResultConverter create_result_converter( - ArgPackage const& - , ResultConverter* - , ... -) -{ - return ResultConverter(); -} - -template struct caller_arity; - -template -struct caller; - -# define BOOST_PYTHON_NEXT(init,name,n) \ - typedef BOOST_PP_IF(n,typename mpl::next< BOOST_PP_CAT(name,BOOST_PP_DEC(n)) >::type, init) name##n; - -# define BOOST_PYTHON_ARG_CONVERTER(n) \ - BOOST_PYTHON_NEXT(typename mpl::next::type, arg_iter,n) \ - typedef arg_from_python c_t##n; \ - c_t##n c##n(get(mpl::int_(), inner_args)); \ - if (!c##n.convertible()) \ - return 0; - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PYTHON_MAX_ARITY + 1, )) -# include BOOST_PP_ITERATE() - -# undef BOOST_PYTHON_ARG_CONVERTER -# undef BOOST_PYTHON_NEXT - -// A metafunction returning the base class used for caller. -template -struct caller_base_select -{ - enum { arity = mpl::size::value - 1 }; - typedef typename caller_arity::template impl type; -}; - -// A function object type which wraps C++ objects as Python callable -// objects. -// -// Template Arguments: -// -// F - -// the C++ `function object' that will be called. Might -// actually be any data for which an appropriate invoke_tag() can -// be generated. invoke(...) takes care of the actual invocation syntax. -// -// CallPolicies - -// The precall, postcall, and what kind of resultconverter to -// generate for mpl::front::type -// -// Sig - -// The `intended signature' of the function. An MPL sequence -// beginning with a result type and continuing with a list of -// argument types. -template -struct caller - : caller_base_select::type -{ - typedef typename caller_base_select< - F,CallPolicies,Sig - >::type base; - - typedef PyObject* result_type; - - caller(F f, CallPolicies p) : base(f,p) {} - -}; - -}}} // namespace boost::python::detail - -# endif // CALLER_DWA20021121_HPP - -#else - -# define N BOOST_PP_ITERATION() - -template <> -struct caller_arity -{ - template - struct impl - { - impl(F f, Policies p) : m_data(f,p) {} - - PyObject* operator()(PyObject* args_, PyObject*) // eliminate - // this - // trailing - // keyword dict - { - typedef typename mpl::begin::type first; - typedef typename first::type result_t; - typedef typename select_result_converter::type result_converter; - typedef typename Policies::argument_package argument_package; - - argument_package inner_args(args_); - -# if N -# define BOOST_PP_LOCAL_MACRO(i) BOOST_PYTHON_ARG_CONVERTER(i) -# define BOOST_PP_LOCAL_LIMITS (0, N-1) -# include BOOST_PP_LOCAL_ITERATE() -# endif - // all converters have been checked. Now we can do the - // precall part of the policy - if (!m_data.second().precall(inner_args)) - return 0; - - PyObject* result = detail::invoke( - detail::invoke_tag() - , create_result_converter(args_, (result_converter*)0, (result_converter*)0) - , m_data.first() - BOOST_PP_ENUM_TRAILING_PARAMS(N, c) - ); - - return m_data.second().postcall(inner_args, result); - } - - static unsigned min_arity() { return N; } - - static signature_element const* signature() - { - return detail::signature::elements(); - } - - private: - compressed_pair m_data; - }; -}; - - - -#endif // BOOST_PP_IS_ITERATING - - diff --git a/include/boost/python/detail/config.hpp b/include/boost/python/detail/config.hpp deleted file mode 100644 index e7d53fb5..00000000 --- a/include/boost/python/detail/config.hpp +++ /dev/null @@ -1,116 +0,0 @@ -// (C) Copyright David Abrahams 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) -// -// The author gratefully acknowleges the support of Dragon Systems, Inc., in -// producing this work. - -// Revision History: -// 04 Mar 01 Some fixes so it will compile with Intel C++ (Dave Abrahams) - -#ifndef CONFIG_DWA052200_H_ -# define CONFIG_DWA052200_H_ - -# include - -# ifdef BOOST_NO_OPERATORS_IN_NAMESPACE - // A gcc bug forces some symbols into the global namespace -# define BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE -# define BOOST_PYTHON_END_CONVERSION_NAMESPACE -# define BOOST_PYTHON_CONVERSION -# define BOOST_PYTHON_IMPORT_CONVERSION(x) using ::x -# else -# define BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE namespace boost { namespace python { -# define BOOST_PYTHON_END_CONVERSION_NAMESPACE }} // namespace boost::python -# define BOOST_PYTHON_CONVERSION boost::python -# define BOOST_PYTHON_IMPORT_CONVERSION(x) void never_defined() // so we can follow the macro with a ';' -# endif - -# if defined(BOOST_MSVC) -# if _MSC_VER <= 1200 -# define BOOST_MSVC6_OR_EARLIER 1 -# endif - -# pragma warning (disable : 4786) // disable truncated debug symbols -# pragma warning (disable : 4251) // disable exported dll function -# pragma warning (disable : 4800) //'int' : forcing value to bool 'true' or 'false' -# pragma warning (disable : 4275) // non dll-interface class - -# elif defined(__ICL) && __ICL < 600 // Intel C++ 5 - -# pragma warning(disable: 985) // identifier was truncated in debug information - -# endif - -// The STLport puts all of the standard 'C' library names in std (as far as the -// user is concerned), but without it you need a fix if you're using MSVC or -// Intel C++ -# if defined(BOOST_NO_STDC_NAMESPACE) -# define BOOST_CSTD_ -# else -# define BOOST_CSTD_ std -# endif - -/***************************************************************************** - * - * Set up dll import/export options: - * - ****************************************************************************/ - -// backwards compatibility: -#ifdef BOOST_PYTHON_STATIC_LIB -# define BOOST_PYTHON_STATIC_LINK -# elif !defined(BOOST_PYTHON_DYNAMIC_LIB) -# define BOOST_PYTHON_DYNAMIC_LIB -#endif - -#if defined(BOOST_PYTHON_DYNAMIC_LIB) - -# if !defined(_WIN32) && !defined(__CYGWIN__) \ - && defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >=5 \ - && !defined(BOOST_PYTHON_GCC_SYMBOL_VISIBILITY) -# define BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY -# endif - -# if defined(BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY) -# if defined(BOOST_PYTHON_SOURCE) -# define BOOST_PYTHON_DECL __attribute__ ((visibility("default"))) -# define BOOST_PYTHON_BUILD_DLL -# else -# define BOOST_PYTHON_DECL -# endif -# define BOOST_PYTHON_DECL_FORWARD -# define BOOST_PYTHON_DECL_EXCEPTION __attribute__ ((visibility("default"))) -# elif (defined(_WIN32) || defined(__CYGWIN__)) -# if defined(BOOST_PYTHON_SOURCE) -# define BOOST_PYTHON_DECL __declspec(dllexport) -# define BOOST_PYTHON_BUILD_DLL -# else -# define BOOST_PYTHON_DECL __declspec(dllimport) -# endif -# endif - -#endif - -#ifndef BOOST_PYTHON_DECL -# define BOOST_PYTHON_DECL -#endif - -#ifndef BOOST_PYTHON_DECL_FORWARD -# define BOOST_PYTHON_DECL_FORWARD BOOST_PYTHON_DECL -#endif - -#ifndef BOOST_PYTHON_DECL_EXCEPTION -# define BOOST_PYTHON_DECL_EXCEPTION BOOST_PYTHON_DECL -#endif - -#if (defined(__DECCXX_VER) && __DECCXX_VER <= 60590042) -// Replace broken Tru64/cxx offsetof macro -# define BOOST_PYTHON_OFFSETOF(s_name, s_member) \ - ((size_t)__INTADDR__(&(((s_name *)0)->s_member))) -#else -# define BOOST_PYTHON_OFFSETOF offsetof -#endif - -#endif // CONFIG_DWA052200_H_ diff --git a/include/boost/python/detail/construct.hpp b/include/boost/python/detail/construct.hpp deleted file mode 100644 index 5f15d22c..00000000 --- a/include/boost/python/detail/construct.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 CONSTRUCT_REFERENCE_DWA2002716_HPP -# define CONSTRUCT_REFERENCE_DWA2002716_HPP - -namespace boost { namespace python { namespace detail { - -template -void construct_pointee(void* storage, Arg& x -# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 - , T const volatile* -# else - , T const* -# endif - ) -{ - new (storage) T(x); -} - -template -void construct_referent_impl(void* storage, Arg& x, T&(*)()) -{ - construct_pointee(storage, x, (T*)0); -} - -template -void construct_referent(void* storage, Arg const& x, T(*tag)() = 0) -{ - construct_referent_impl(storage, x, tag); -} - -template -void construct_referent(void* storage, Arg& x, T(*tag)() = 0) -{ - construct_referent_impl(storage, x, tag); -} - -}}} // namespace boost::python::detail - -#endif // CONSTRUCT_REFERENCE_DWA2002716_HPP diff --git a/include/boost/python/detail/convertible.hpp b/include/boost/python/detail/convertible.hpp deleted file mode 100755 index 2ce552f5..00000000 --- a/include/boost/python/detail/convertible.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 CONVERTIBLE_DWA2002614_HPP -# define CONVERTIBLE_DWA2002614_HPP - -# if defined(__EDG_VERSION__) && __EDG_VERSION__ <= 241 -# include -# include -# endif - -// Supplies a runtime is_convertible check which can be used with tag -// dispatching to work around the Metrowerks Pro7 limitation with boost::is_convertible -namespace boost { namespace python { namespace detail { - -typedef char* yes_convertible; -typedef int* no_convertible; - -template -struct convertible -{ -# if !defined(__EDG_VERSION__) || __EDG_VERSION__ > 241 || __EDG_VERSION__ == 238 - static inline no_convertible check(...) { return 0; } - static inline yes_convertible check(Target) { return 0; } -# else - template - static inline typename mpl::if_c< - is_convertible::value - , yes_convertible - , no_convertible - >::type check(X const&) { return 0; } -# endif -}; - -}}} // namespace boost::python::detail - -#endif // CONVERTIBLE_DWA2002614_HPP diff --git a/include/boost/python/detail/copy_ctor_mutates_rhs.hpp b/include/boost/python/detail/copy_ctor_mutates_rhs.hpp deleted file mode 100755 index 4ca8d039..00000000 --- a/include/boost/python/detail/copy_ctor_mutates_rhs.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef COPY_CTOR_MUTATES_RHS_DWA2003219_HPP -# define COPY_CTOR_MUTATES_RHS_DWA2003219_HPP - -#include -#include - -namespace boost { namespace python { namespace detail { - -template -struct copy_ctor_mutates_rhs - : is_auto_ptr -{ -}; - -}}} // namespace boost::python::detail - -#endif // COPY_CTOR_MUTATES_RHS_DWA2003219_HPP diff --git a/include/boost/python/detail/cv_category.hpp b/include/boost/python/detail/cv_category.hpp deleted file mode 100644 index 1765b36f..00000000 --- a/include/boost/python/detail/cv_category.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 CV_CATEGORY_DWA200222_HPP -# define CV_CATEGORY_DWA200222_HPP -# include - -namespace boost { namespace python { namespace detail { - -template -struct cv_tag -{ - BOOST_STATIC_CONSTANT(bool, is_const = is_const_); - BOOST_STATIC_CONSTANT(bool, is_volatile = is_const_); -}; - -typedef cv_tag cv_unqualified; -typedef cv_tag const_; -typedef cv_tag volatile_; -typedef cv_tag const_volatile_; - -template -struct cv_category -{ -// BOOST_STATIC_CONSTANT(bool, c = is_const::value); -// BOOST_STATIC_CONSTANT(bool, v = is_volatile::value); - typedef cv_tag< - ::boost::is_const::value - , ::boost::is_volatile::value - > type; -}; - -}}} // namespace boost::python::detail - -#endif // CV_CATEGORY_DWA200222_HPP diff --git a/include/boost/python/detail/dealloc.hpp b/include/boost/python/detail/dealloc.hpp deleted file mode 100644 index f2d914b1..00000000 --- a/include/boost/python/detail/dealloc.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright Gottfried Ganßauge 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -# ifndef BOOST_PYTHON_DETAIL_DEALLOC_HPP_ -# define BOOST_PYTHON_DETAIL_DEALLOC_HPP_ -namespace boost { namespace python { namespace detail { - extern "C" - { - inline void dealloc(PyObject* self) - { - PyObject_Del(self); - } - } -}}} // namespace boost::python::detail -# endif // BOOST_PYTHON_DETAIL_DEALLOC_HPP_ diff --git a/include/boost/python/detail/decorated_type_id.hpp b/include/boost/python/detail/decorated_type_id.hpp deleted file mode 100755 index 2e44ac2c..00000000 --- a/include/boost/python/detail/decorated_type_id.hpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 DECORATED_TYPE_ID_DWA2002517_HPP -# define DECORATED_TYPE_ID_DWA2002517_HPP - -# include -# include -# include - -namespace boost { namespace python { namespace detail { - -struct decorated_type_info : totally_ordered -{ - enum decoration { const_ = 0x1, volatile_ = 0x2, reference = 0x4 }; - - decorated_type_info(type_info, decoration = decoration()); - - inline bool operator<(decorated_type_info const& rhs) const; - inline bool operator==(decorated_type_info const& rhs) const; - - friend BOOST_PYTHON_DECL std::ostream& operator<<(std::ostream&, decorated_type_info const&); - - operator type_info const&() const; - private: // type - typedef type_info base_id_t; - - private: // data members - decoration m_decoration; - base_id_t m_base_type; -}; - -template -inline decorated_type_info decorated_type_id(boost::type* = 0) -{ - return decorated_type_info( - type_id() - , decorated_type_info::decoration( - (is_const::value || indirect_traits::is_reference_to_const::value - ? decorated_type_info::const_ : 0) - | (is_volatile::value || indirect_traits::is_reference_to_volatile::value - ? decorated_type_info::volatile_ : 0) - | (is_reference::value ? decorated_type_info::reference : 0) - ) - ); -} - -inline decorated_type_info::decorated_type_info(type_info base_t, decoration decoration) - : m_decoration(decoration) - , m_base_type(base_t) -{ -} - -inline bool decorated_type_info::operator<(decorated_type_info const& rhs) const -{ - return m_decoration < rhs.m_decoration - || m_decoration == rhs.m_decoration - && m_base_type < rhs.m_base_type; -} - -inline bool decorated_type_info::operator==(decorated_type_info const& rhs) const -{ - return m_decoration == rhs.m_decoration && m_base_type == rhs.m_base_type; -} - -inline decorated_type_info::operator type_info const&() const -{ - return m_base_type; -} - -BOOST_PYTHON_DECL std::ostream& operator<<(std::ostream&, decorated_type_info const&); - -}}} // namespace boost::python::detail - -#endif // DECORATED_TYPE_ID_DWA2002517_HPP diff --git a/include/boost/python/detail/decref_guard.hpp b/include/boost/python/detail/decref_guard.hpp deleted file mode 100644 index d713e0a6..00000000 --- a/include/boost/python/detail/decref_guard.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 DECREF_GUARD_DWA20021220_HPP -# define DECREF_GUARD_DWA20021220_HPP - -namespace boost { namespace python { namespace detail { - -struct decref_guard -{ - decref_guard(PyObject* o) : obj(o) {} - ~decref_guard() { Py_XDECREF(obj); } - void cancel() { obj = 0; } - private: - PyObject* obj; -}; - -}}} // namespace boost::python::detail - -#endif // DECREF_GUARD_DWA20021220_HPP diff --git a/include/boost/python/detail/def_helper.hpp b/include/boost/python/detail/def_helper.hpp deleted file mode 100644 index 33abf19d..00000000 --- a/include/boost/python/detail/def_helper.hpp +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 DEF_HELPER_DWA200287_HPP -# define DEF_HELPER_DWA200287_HPP - -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { - -struct default_call_policies; - -namespace detail -{ - // tuple_extract::extract(t) returns the first - // element of a Tuple whose type E satisfies the given Predicate - // applied to add_reference. The Predicate must be an MPL - // metafunction class. - template - struct tuple_extract; - - // Implementation class for when the tuple's head type does not - // satisfy the Predicate - template - struct tuple_extract_impl - { - template - struct apply - { - typedef typename Tuple::head_type result_type; - - static typename Tuple::head_type extract(Tuple const& x) - { - return x.get_head(); - } - }; - }; - - // Implementation specialization for when the tuple's head type - // satisfies the predicate - template <> - struct tuple_extract_impl - { - template - struct apply - { - // recursive application of tuple_extract on the tail of the tuple - typedef tuple_extract next; - typedef typename next::result_type result_type; - - static result_type extract(Tuple const& x) - { - return next::extract(x.get_tail()); - } - }; - }; - - // A metafunction which selects a version of tuple_extract_impl to - // use for the implementation of tuple_extract - template - struct tuple_extract_base_select - { - typedef typename Tuple::head_type head_type; - typedef typename mpl::apply1::type>::type match_t; - BOOST_STATIC_CONSTANT(bool, match = match_t::value); - typedef typename tuple_extract_impl::template apply type; - }; - - template - struct tuple_extract - : tuple_extract_base_select< - Tuple - , typename mpl::lambda::type - >::type - { - }; - - - // - // Specialized extractors for the docstring, keywords, CallPolicies, - // and default implementation of virtual functions - // - - template - struct doc_extract - : tuple_extract< - Tuple - , mpl::not_< - mpl::or_< - indirect_traits::is_reference_to_class - , indirect_traits::is_reference_to_member_function_pointer - > - > - > - { - }; - - template - struct keyword_extract - : tuple_extract > - { - }; - - template - struct policy_extract - : tuple_extract< - Tuple - , mpl::and_< - mpl::not_ > - , indirect_traits::is_reference_to_class - , mpl::not_ > - > - > - { - }; - - template - struct default_implementation_extract - : tuple_extract< - Tuple - , indirect_traits::is_reference_to_member_function_pointer - > - { - }; - - // - // A helper class for decoding the optional arguments to def() - // invocations, which can be supplied in any order and are - // discriminated by their type properties. The template parameters - // are expected to be the types of the actual (optional) arguments - // passed to def(). - // - template - struct def_helper - { - // A tuple type which begins with references to the supplied - // arguments and ends with actual representatives of the default - // types. - typedef boost::tuples::tuple< - T1 const& - , T2 const& - , T3 const& - , T4 const& - , default_call_policies - , keywords<0> - , char const* - , void(not_specified::*)() // A function pointer type which is never an - // appropriate default implementation - > all_t; - - // Constructors; these initialize an member of the tuple type - // shown above. - def_helper(T1 const& a1) : m_all(a1,m_nil,m_nil,m_nil) {} - def_helper(T1 const& a1, T2 const& a2) : m_all(a1,a2,m_nil,m_nil) {} - def_helper(T1 const& a1, T2 const& a2, T3 const& a3) : m_all(a1,a2,a3,m_nil) {} - def_helper(T1 const& a1, T2 const& a2, T3 const& a3, T4 const& a4) : m_all(a1,a2,a3,a4) {} - - private: // types - typedef typename default_implementation_extract::result_type default_implementation_t; - - public: // Constants which can be used for static assertions. - - // Users must not supply a default implementation for non-class - // methods. - BOOST_STATIC_CONSTANT( - bool, has_default_implementation = ( - !is_same::value)); - - public: // Extractor functions which pull the appropriate value out - // of the tuple - char const* doc() const - { - return doc_extract::extract(m_all); - } - - typename keyword_extract::result_type keywords() const - { - return keyword_extract::extract(m_all); - } - - typename policy_extract::result_type policies() const - { - return policy_extract::extract(m_all); - } - - default_implementation_t default_implementation() const - { - return default_implementation_extract::extract(m_all); - } - - private: // data members - all_t m_all; - not_specified m_nil; // for filling in not_specified slots - }; -} - -}} // namespace boost::python::detail - -#endif // DEF_HELPER_DWA200287_HPP diff --git a/include/boost/python/detail/def_helper_fwd.hpp b/include/boost/python/detail/def_helper_fwd.hpp deleted file mode 100755 index 31c22e97..00000000 --- a/include/boost/python/detail/def_helper_fwd.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef DEF_HELPER_FWD_DWA2003810_HPP -# define DEF_HELPER_FWD_DWA2003810_HPP - -# include - -namespace boost { namespace python { namespace detail { - -template -struct def_helper; - -}}} // namespace boost::python::detail - -#endif // DEF_HELPER_FWD_DWA2003810_HPP diff --git a/include/boost/python/detail/defaults_def.hpp b/include/boost/python/detail/defaults_def.hpp deleted file mode 100644 index 68799f83..00000000 --- a/include/boost/python/detail/defaults_def.hpp +++ /dev/null @@ -1,291 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright David Abrahams 2002, Joel de Guzman, 2002. -// 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) - -#ifndef DEFAULTS_DEF_JDG20020811_HPP -#define DEFAULTS_DEF_JDG20020811_HPP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace python { - -struct module; - -namespace objects -{ - struct class_base; -} - -namespace detail -{ - // Called as:: - // - // name_space_def(ns, "func", func, kw, policies, docstring, &ns) - // - // Dispatch to properly add f to namespace ns. - // - // @group define_stub_function helpers { - template - static void name_space_def( - NameSpaceT& name_space - , char const* name - , Func f - , keyword_range const& kw - , CallPolicies const& policies - , char const* doc - , objects::class_base* - ) - { - typedef typename NameSpaceT::wrapped_type wrapped_type; - - objects::add_to_namespace( - name_space, name, - detail::make_keyword_range_function( - f, policies, kw, get_signature(f, (wrapped_type*)0)) - , doc - ); - } - - template - static void name_space_def( - object& name_space - , char const* name - , Func f - , keyword_range const& kw - , CallPolicies const& policies - , char const* doc - , ... - ) - { - scope within(name_space); - - detail::scope_setattr_doc( - name - , detail::make_keyword_range_function(f, policies, kw) - , doc); - } - - // For backward compatibility -- is this obsolete? - template - static void name_space_def( - NameSpaceT& name_space - , char const* name - , Func f - , keyword_range const& kw // ignored - , CallPolicies const& policies - , char const* doc - , module* - ) - { - name_space.def(name, f, policies, doc); - } - // } - - - // Expansions of :: - // - // template - // inline void - // define_stub_function( - // char const* name, OverloadsT s, NameSpaceT& name_space, mpl::int_) - // { - // name_space.def(name, &OverloadsT::func_N); - // } - // - // where N runs from 0 to BOOST_PYTHON_MAX_ARITY. - // - // The set of overloaded functions (define_stub_function) expects: - // - // 1. char const* name: function name that will be visible to python - // 2. OverloadsT: a function overloads struct (see defaults_gen.hpp) - // 3. NameSpaceT& name_space: a python::class_ or python::module instance - // 4. int_t: the Nth overloaded function (OverloadsT::func_N) - // (see defaults_gen.hpp) - // 5. char const* name: doc string - // - // @group define_stub_function { - template - struct define_stub_function {}; - -#define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PYTHON_MAX_ARITY, )) - -#include BOOST_PP_ITERATE() - - // } - - // This helper template struct does the actual recursive - // definition. There's a generic version - // define_with_defaults_helper and a terminal case - // define_with_defaults_helper<0>. The struct and its - // specialization has a sole static member function def that - // expects: - // - // 1. char const* name: function name that will be - // visible to python - // - // 2. OverloadsT: a function overloads struct - // (see defaults_gen.hpp) - // - // 3. NameSpaceT& name_space: a python::class_ or - // python::module instance - // - // 4. char const* name: doc string - // - // The def static member function calls a corresponding - // define_stub_function. The general case recursively calls - // define_with_defaults_helper::def until it reaches the - // terminal case case define_with_defaults_helper<0>. - template - struct define_with_defaults_helper { - - template - static void - def( - char const* name, - StubsT stubs, - keyword_range kw, - CallPolicies const& policies, - NameSpaceT& name_space, - char const* doc) - { - // define the NTH stub function of stubs - define_stub_function::define(name, stubs, kw, policies, name_space, doc); - - if (kw.second > kw.first) - --kw.second; - - // call the next define_with_defaults_helper - define_with_defaults_helper::def(name, stubs, kw, policies, name_space, doc); - } - }; - - template <> - struct define_with_defaults_helper<0> { - - template - static void - def( - char const* name, - StubsT stubs, - keyword_range const& kw, - CallPolicies const& policies, - NameSpaceT& name_space, - char const* doc) - { - // define the Oth stub function of stubs - define_stub_function<0>::define(name, stubs, kw, policies, name_space, doc); - // return - } - }; - - // define_with_defaults - // - // 1. char const* name: function name that will be - // visible to python - // - // 2. OverloadsT: a function overloads struct - // (see defaults_gen.hpp) - // - // 3. CallPolicies& policies: Call policies - // 4. NameSpaceT& name_space: a python::class_ or - // python::module instance - // - // 5. SigT sig: Function signature typelist - // (see defaults_gen.hpp) - // - // 6. char const* name: doc string - // - // This is the main entry point. This function recursively - // defines all stub functions of StubT (see defaults_gen.hpp) in - // NameSpaceT name_space which can be either a python::class_ or - // a python::module. The sig argument is a typelist that - // specifies the return type, the class (for member functions, - // and the arguments. Here are some SigT examples: - // - // int foo(int) mpl::vector - // void bar(int, int) mpl::vector - // void C::foo(int) mpl::vector - // - template - inline void - define_with_defaults( - char const* name, - OverloadsT const& overloads, - NameSpaceT& name_space, - SigT const&) - { - typedef typename mpl::front::type return_type; - typedef typename OverloadsT::void_return_type void_return_type; - typedef typename OverloadsT::non_void_return_type non_void_return_type; - - typedef typename mpl::if_c< - boost::is_same::value - , void_return_type - , non_void_return_type - >::type stubs_type; - - BOOST_STATIC_ASSERT( - (stubs_type::max_args) <= mpl::size::value); - - typedef typename stubs_type::template gen gen_type; - define_with_defaults_helper::def( - name - , gen_type() - , overloads.keywords() - , overloads.call_policies() - , name_space - , overloads.doc_string()); - } - -} // namespace detail - -}} // namespace boost::python - -#endif // DEFAULTS_DEF_JDG20020811_HPP - -#else // defined(BOOST_PP_IS_ITERATING) -// PP vertical iteration code - - -template <> -struct define_stub_function { - template - static void define( - char const* name - , StubsT const& - , keyword_range const& kw - , CallPolicies const& policies - , NameSpaceT& name_space - , char const* doc) - { - detail::name_space_def( - name_space - , name - , &StubsT::BOOST_PP_CAT(func_, BOOST_PP_ITERATION()) - , kw - , policies - , doc - , &name_space); - } -}; - -#endif // !defined(BOOST_PP_IS_ITERATING) diff --git a/include/boost/python/detail/defaults_gen.hpp b/include/boost/python/detail/defaults_gen.hpp deleted file mode 100644 index 45274957..00000000 --- a/include/boost/python/detail/defaults_gen.hpp +++ /dev/null @@ -1,388 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright David Abrahams 2002, Joel de Guzman, 2002. -// 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 DEFAULTS_GEN_JDG20020807_HPP -#define DEFAULTS_GEN_JDG20020807_HPP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost { namespace python { - -namespace detail -{ - // overloads_base is used as a base class for all function - // stubs. This class holds the doc_string of the stubs. - struct overloads_base - { - overloads_base(char const* doc_) - : m_doc(doc_) {} - - overloads_base(char const* doc_, detail::keyword_range const& kw) - : m_doc(doc_), m_keywords(kw) {} - - char const* doc_string() const - { - return m_doc; - } - - detail::keyword_range const& keywords() const - { - return m_keywords; - } - - private: - char const* m_doc; - detail::keyword_range m_keywords; - }; - - // overloads_proxy is generated by the overloads_common operator[] (see - // below). This class holds a user defined call policies of the stubs. - template - struct overloads_proxy - : public overloads_base - { - typedef typename OverloadsT::non_void_return_type non_void_return_type; - typedef typename OverloadsT::void_return_type void_return_type; - - overloads_proxy( - CallPoliciesT const& policies_ - , char const* doc - , keyword_range const& kw - ) - : overloads_base(doc, kw) - , policies(policies_) - {} - - CallPoliciesT - call_policies() const - { - return policies; - } - - CallPoliciesT policies; - }; - - // overloads_common is our default function stubs base class. This - // class returns the default_call_policies in its call_policies() - // member function. It can generate a overloads_proxy however through - // its operator[] - template - struct overloads_common - : public overloads_base - { - overloads_common(char const* doc) - : overloads_base(doc) {} - - overloads_common(char const* doc, keyword_range const& kw) - : overloads_base(doc, kw) {} - - default_call_policies - call_policies() const - { - return default_call_policies(); - } - - template - overloads_proxy - operator[](CallPoliciesT const& policies) const - { - return overloads_proxy( - policies, this->doc_string(), this->keywords()); - } - }; - -}}} // namespace boost::python::detail - - -#define BOOST_PYTHON_TYPEDEF_GEN(z, index, data) \ - typedef typename ::boost::mpl::next::type \ - BOOST_PP_CAT(iter, BOOST_PP_INC(index)); \ - typedef typename ::boost::mpl::deref::type \ - BOOST_PP_CAT(T, index); - -#define BOOST_PYTHON_FUNC_WRAPPER_GEN(z, index, data) \ - static RT BOOST_PP_CAT(func_, \ - BOOST_PP_SUB_D(1, index, BOOST_PP_TUPLE_ELEM(3, 1, data))) ( \ - BOOST_PP_ENUM_BINARY_PARAMS_Z( \ - 1, index, T, arg)) \ - { \ - BOOST_PP_TUPLE_ELEM(3, 2, data) \ - BOOST_PP_TUPLE_ELEM(3, 0, data)( \ - BOOST_PP_ENUM_PARAMS( \ - index, \ - arg)); \ - } - -#define BOOST_PYTHON_GEN_FUNCTION(fname, fstubs_name, n_args, n_dflts, ret) \ - struct fstubs_name \ - { \ - BOOST_STATIC_CONSTANT(int, n_funcs = BOOST_PP_INC(n_dflts)); \ - BOOST_STATIC_CONSTANT(int, max_args = n_funcs); \ - \ - template \ - struct gen \ - { \ - typedef typename ::boost::mpl::begin::type rt_iter; \ - typedef typename ::boost::mpl::deref::type RT; \ - typedef typename ::boost::mpl::next::type iter0; \ - \ - BOOST_PP_REPEAT_2ND( \ - n_args, \ - BOOST_PYTHON_TYPEDEF_GEN, \ - 0) \ - \ - BOOST_PP_REPEAT_FROM_TO_2( \ - BOOST_PP_SUB_D(1, n_args, n_dflts), \ - BOOST_PP_INC(n_args), \ - BOOST_PYTHON_FUNC_WRAPPER_GEN, \ - (fname, BOOST_PP_SUB_D(1, n_args, n_dflts), ret)) \ - }; \ - }; \ - -/////////////////////////////////////////////////////////////////////////////// -#define BOOST_PYTHON_MEM_FUNC_WRAPPER_GEN(z, index, data) \ - static RT BOOST_PP_CAT(func_, \ - BOOST_PP_SUB_D(1, index, BOOST_PP_TUPLE_ELEM(3, 1, data))) ( \ - ClassT obj BOOST_PP_COMMA_IF(index) \ - BOOST_PP_ENUM_BINARY_PARAMS_Z(1, index, T, arg) \ - ) \ - { \ - BOOST_PP_TUPLE_ELEM(3, 2, data) obj.BOOST_PP_TUPLE_ELEM(3, 0, data)( \ - BOOST_PP_ENUM_PARAMS(index, arg) \ - ); \ - } - -#define BOOST_PYTHON_GEN_MEM_FUNCTION(fname, fstubs_name, n_args, n_dflts, ret) \ - struct fstubs_name \ - { \ - BOOST_STATIC_CONSTANT(int, n_funcs = BOOST_PP_INC(n_dflts)); \ - BOOST_STATIC_CONSTANT(int, max_args = n_funcs + 1); \ - \ - template \ - struct gen \ - { \ - typedef typename ::boost::mpl::begin::type rt_iter; \ - typedef typename ::boost::mpl::deref::type RT; \ - \ - typedef typename ::boost::mpl::next::type class_iter; \ - typedef typename ::boost::mpl::deref::type ClassT; \ - typedef typename ::boost::mpl::next::type iter0; \ - \ - BOOST_PP_REPEAT_2ND( \ - n_args, \ - BOOST_PYTHON_TYPEDEF_GEN, \ - 0) \ - \ - BOOST_PP_REPEAT_FROM_TO_2( \ - BOOST_PP_SUB_D(1, n_args, n_dflts), \ - BOOST_PP_INC(n_args), \ - BOOST_PYTHON_MEM_FUNC_WRAPPER_GEN, \ - (fname, BOOST_PP_SUB_D(1, n_args, n_dflts), ret)) \ - }; \ - }; - -#define BOOST_PYTHON_OVERLOAD_CONSTRUCTORS(fstubs_name, n_args, n_dflts) \ - fstubs_name(char const* doc = 0) \ - : ::boost::python::detail::overloads_common(doc) {} \ - template \ - fstubs_name(char const* doc, ::boost::python::detail::keywords const& keywords) \ - : ::boost::python::detail::overloads_common( \ - doc, keywords.range()) \ - { \ - typedef typename ::boost::python::detail:: \ - error::more_keywords_than_function_arguments< \ - N,n_args>::too_many_keywords assertion; \ - } \ - template \ - fstubs_name(::boost::python::detail::keywords const& keywords, char const* doc = 0) \ - : ::boost::python::detail::overloads_common( \ - doc, keywords.range()) \ - { \ - typedef typename ::boost::python::detail:: \ - error::more_keywords_than_function_arguments< \ - N,n_args>::too_many_keywords assertion; \ - } - -# if defined(BOOST_NO_VOID_RETURNS) - -# define BOOST_PYTHON_GEN_FUNCTION_STUB(fname, fstubs_name, n_args, n_dflts) \ - struct fstubs_name \ - : public ::boost::python::detail::overloads_common \ - { \ - BOOST_PYTHON_GEN_FUNCTION( \ - fname, non_void_return_type, n_args, n_dflts, return) \ - BOOST_PYTHON_GEN_FUNCTION( \ - fname, void_return_type, n_args, n_dflts, ;) \ - \ - BOOST_PYTHON_OVERLOAD_CONSTRUCTORS(fstubs_name, n_args, n_dflts) \ - }; - -# define BOOST_PYTHON_GEN_MEM_FUNCTION_STUB(fname, fstubs_name, n_args, n_dflts) \ - struct fstubs_name \ - : public ::boost::python::detail::overloads_common \ - { \ - BOOST_PYTHON_GEN_MEM_FUNCTION( \ - fname, non_void_return_type, n_args, n_dflts, return) \ - BOOST_PYTHON_GEN_MEM_FUNCTION( \ - fname, void_return_type, n_args, n_dflts, ;) \ - \ - BOOST_PYTHON_OVERLOAD_CONSTRUCTORS(fstubs_name, n_args, n_dflts) \ - }; - -# else // !defined(BOOST_NO_VOID_RETURNS) - -# define BOOST_PYTHON_GEN_FUNCTION_STUB(fname, fstubs_name, n_args, n_dflts) \ - struct fstubs_name \ - : public ::boost::python::detail::overloads_common \ - { \ - BOOST_PYTHON_GEN_FUNCTION( \ - fname, non_void_return_type, n_args, n_dflts, return) \ - \ - typedef non_void_return_type void_return_type; \ - BOOST_PYTHON_OVERLOAD_CONSTRUCTORS(fstubs_name, n_args, n_dflts) \ - }; - - -# define BOOST_PYTHON_GEN_MEM_FUNCTION_STUB(fname, fstubs_name, n_args, n_dflts) \ - struct fstubs_name \ - : public ::boost::python::detail::overloads_common \ - { \ - BOOST_PYTHON_GEN_MEM_FUNCTION( \ - fname, non_void_return_type, n_args, n_dflts, return) \ - \ - typedef non_void_return_type void_return_type; \ - BOOST_PYTHON_OVERLOAD_CONSTRUCTORS(fstubs_name, n_args, n_dflts) \ - }; - -# endif // !defined(BOOST_NO_VOID_RETURNS) - -/////////////////////////////////////////////////////////////////////////////// -// -// MAIN MACROS -// -// Given generator_name, fname, min_args and max_args, These macros -// generate function stubs that forward to a function or member function -// named fname. max_args is the arity of the function or member function -// fname. fname can have default arguments. min_args is the minimum -// arity that fname can accept. -// -// There are two versions: -// -// 1. BOOST_PYTHON_FUNCTION_OVERLOADS for free functions -// 2. BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS for member functions. -// -// For instance, given a function: -// -// int -// foo(int a, char b = 1, unsigned c = 2, double d = 3) -// { -// return a + b + c + int(d); -// } -// -// The macro invocation: -// -// BOOST_PYTHON_FUNCTION_OVERLOADS(foo_stubs, foo, 1, 4) -// -// Generates this code: -// -// struct foo_stubsNonVoid -// { -// static const int n_funcs = 4; -// static const int max_args = n_funcs; -// -// template -// struct gen -// { -// typedef typename ::boost::mpl::begin::type rt_iter; -// typedef typename rt_iter::type RT; -// typedef typename rt_iter::next iter0; -// typedef typename iter0::type T0; -// typedef typename iter0::next iter1; -// typedef typename iter1::type T1; -// typedef typename iter1::next iter2; -// typedef typename iter2::type T2; -// typedef typename iter2::next iter3; -// typedef typename iter3::type T3; -// typedef typename iter3::next iter4; -// -// static RT func_0(T0 arg0) -// { return foo(arg0); } -// -// static RT func_1(T0 arg0, T1 arg1) -// { return foo(arg0, arg1); } -// -// static RT func_2(T0 arg0, T1 arg1, T2 arg2) -// { return foo(arg0, arg1, arg2); } -// -// static RT func_3(T0 arg0, T1 arg1, T2 arg2, T3 arg3) -// { return foo(arg0, arg1, arg2, arg3); } -// }; -// }; -// -// struct foo_overloads -// : public boost::python::detail::overloads_common -// { -// typedef foo_overloadsNonVoid non_void_return_type; -// typedef foo_overloadsNonVoid void_return_type; -// -// foo_overloads(char const* doc = 0) -// : boost::python::detail::overloads_common(doc) {} -// }; -// -// The typedefs non_void_return_type and void_return_type are -// used to handle compilers that do not support void returns. The -// example above typedefs non_void_return_type and -// void_return_type to foo_overloadsNonVoid. On compilers that do -// not support void returns, there are two versions: -// foo_overloadsNonVoid and foo_overloadsVoid. The "Void" -// version is almost identical to the "NonVoid" version except -// for the return type (void) and the lack of the return keyword. -// -// See the overloads_common above for a description of the -// foo_overloads' base class. -// -/////////////////////////////////////////////////////////////////////////////// -#define BOOST_PYTHON_FUNCTION_OVERLOADS(generator_name, fname, min_args, max_args) \ - BOOST_PYTHON_GEN_FUNCTION_STUB( \ - fname, \ - generator_name, \ - max_args, \ - BOOST_PP_SUB_D(1, max_args, min_args)) - -#define BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(generator_name, fname, min_args, max_args) \ - BOOST_PYTHON_GEN_MEM_FUNCTION_STUB( \ - fname, \ - generator_name, \ - max_args, \ - BOOST_PP_SUB_D(1, max_args, min_args)) - -// deprecated macro names (to be removed) -#define BOOST_PYTHON_FUNCTION_GENERATOR BOOST_PYTHON_FUNCTION_OVERLOADS -#define BOOST_PYTHON_MEM_FUN_GENERATOR BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS - -/////////////////////////////////////////////////////////////////////////////// -#endif // DEFAULTS_GEN_JDG20020807_HPP - - diff --git a/include/boost/python/detail/dependent.hpp b/include/boost/python/detail/dependent.hpp deleted file mode 100644 index 70392c4d..00000000 --- a/include/boost/python/detail/dependent.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 DEPENDENT_DWA200286_HPP -# define DEPENDENT_DWA200286_HPP - -namespace boost { namespace python { namespace detail { - -// A way to turn a concrete type T into a type dependent on U. This -// keeps conforming compilers (those implementing proper 2-phase -// name lookup for templates) from complaining about incomplete -// types in situations where it would otherwise be inconvenient or -// impossible to re-order code so that all types are defined in time. - -// One such use is when we must return an incomplete T from a member -// function template (which must be defined in the class body to -// keep MSVC happy). -template -struct dependent -{ - typedef T type; -}; - -}}} // namespace boost::python::detail - -#endif // DEPENDENT_DWA200286_HPP diff --git a/include/boost/python/detail/destroy.hpp b/include/boost/python/detail/destroy.hpp deleted file mode 100644 index 7df31d4c..00000000 --- a/include/boost/python/detail/destroy.hpp +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 DESTROY_DWA2002221_HPP -# define DESTROY_DWA2002221_HPP - -# include -# include -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) -# include -# endif -namespace boost { namespace python { namespace detail { - -template < - bool array -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) - , bool enum_ // vc7 has a problem destroying enums -# endif - > struct value_destroyer; - -template <> -struct value_destroyer< - false -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) - , false -# endif - > -{ - template - static void execute(T const volatile* p) - { - p->T::~T(); - } -}; - -template <> -struct value_destroyer< - true -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) - , false -# endif - > -{ - template - static void execute(A*, T const volatile* const first) - { - for (T const volatile* p = first; p != first + sizeof(A)/sizeof(T); ++p) - { - value_destroyer< - boost::is_array::value -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) - , boost::is_enum::value -# endif - >::execute(p); - } - } - - template - static void execute(T const volatile* p) - { - execute(p, *p); - } -}; - -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) -template <> -struct value_destroyer -{ - template - static void execute(T const volatile*) - { - } -}; - -template <> -struct value_destroyer -{ - template - static void execute(T const volatile*) - { - } -}; -# endif -template -inline void destroy_referent_impl(void* p, T& (*)()) -{ - // note: cv-qualification needed for MSVC6 - // must come *before* T for metrowerks - value_destroyer< - (boost::is_array::value) -# if BOOST_WORKAROUND(BOOST_MSVC, == 1300) - , (boost::is_enum::value) -# endif - >::execute((const volatile T*)p); -} - -template -inline void destroy_referent(void* p, T(*)() = 0) -{ - destroy_referent_impl(p, (T(*)())0); -} - -}}} // namespace boost::python::detail - -#endif // DESTROY_DWA2002221_HPP diff --git a/include/boost/python/detail/enable_if.hpp b/include/boost/python/detail/enable_if.hpp deleted file mode 100755 index 46a1d532..00000000 --- a/include/boost/python/detail/enable_if.hpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef ENABLE_IF_DWA2004722_HPP -# define ENABLE_IF_DWA2004722_HPP - -# include -# include - -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -# include - -namespace boost { namespace python { namespace detail { - -template struct always_void { typedef void type; }; - -template -struct enable_if_arg -{ - typedef typename mpl::if_::type type; -}; - -template -struct disable_if_arg -{ - typedef typename mpl::if_::type type; -}; - -template ::type> -struct enable_if_ret -{ - typedef typename mpl::if_::type type; -}; - -template ::type> -struct disable_if_ret -{ - typedef typename mpl::if_::type type; -}; - -}}} // namespace boost::python::detail - -# elif !defined(BOOST_NO_SFINAE) -# include - -namespace boost { namespace python { namespace detail { - -template -struct enable_if_arg - : enable_if -{}; - -template -struct disable_if_arg - : disable_if -{}; - -template -struct enable_if_ret - : enable_if -{}; - -template -struct disable_if_ret - : disable_if -{}; - -}}} // namespace boost::python::detail - -# endif - -#endif // ENABLE_IF_DWA2004722_HPP diff --git a/include/boost/python/detail/exception_handler.hpp b/include/boost/python/detail/exception_handler.hpp deleted file mode 100644 index c50be2ec..00000000 --- a/include/boost/python/detail/exception_handler.hpp +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 EXCEPTION_HANDLER_DWA2002810_HPP -# define EXCEPTION_HANDLER_DWA2002810_HPP - -# include -# include -# include - -namespace boost { namespace python { namespace detail { - -struct BOOST_PYTHON_DECL exception_handler; - -typedef function2 const&> handler_function; - -struct BOOST_PYTHON_DECL exception_handler -{ - private: // types - - public: - explicit exception_handler(handler_function const& impl); - - inline bool handle(function0 const& f) const; - - bool operator()(function0 const& f) const; - - static exception_handler* chain; - - private: - static exception_handler* tail; - - handler_function m_impl; - exception_handler* m_next; -}; - - -inline bool exception_handler::handle(function0 const& f) const -{ - return this->m_impl(*this, f); -} - -BOOST_PYTHON_DECL void register_exception_handler(handler_function const& f); - -}}} // namespace boost::python::detail - -#endif // EXCEPTION_HANDLER_DWA2002810_HPP diff --git a/include/boost/python/detail/force_instantiate.hpp b/include/boost/python/detail/force_instantiate.hpp deleted file mode 100755 index e9c05693..00000000 --- a/include/boost/python/detail/force_instantiate.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 FORCE_INSTANTIATE_DWA200265_HPP -# define FORCE_INSTANTIATE_DWA200265_HPP - -namespace boost { namespace python { namespace detail { - -// Allows us to force the argument to be instantiated without -// incurring unused variable warnings - -# if !defined(BOOST_MSVC) || BOOST_MSVC == 1200 || _MSC_FULL_VER > 13102196 - -template -inline void force_instantiate(T const&) {} - -# else - -# pragma optimize("g", off) -inline void force_instantiate_impl(...) {} -# pragma optimize("", on) -template -inline void force_instantiate(T const& x) -{ - detail::force_instantiate_impl(&x); -} -# endif - -}}} // namespace boost::python::detail - -#endif // FORCE_INSTANTIATE_DWA200265_HPP diff --git a/include/boost/python/detail/if_else.hpp b/include/boost/python/detail/if_else.hpp deleted file mode 100644 index 244e63a8..00000000 --- a/include/boost/python/detail/if_else.hpp +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 IF_ELSE_DWA2002322_HPP -# define IF_ELSE_DWA2002322_HPP -# include - -namespace boost { namespace python { namespace detail { - -template struct elif_selected; - -template -struct if_selected -{ - template - struct elif : elif_selected - { - }; - - template - struct else_ - { - typedef T type; - }; -}; - -# if defined(BOOST_MSVC) && (BOOST_MSVC == 1300) -namespace msvc70_aux { - -template< bool > struct inherit_from -{ - template< typename T > struct result - { - typedef T type; - }; -}; - -template<> struct inherit_from -{ - template< typename T > struct result - { - struct type {}; - }; -}; - -template< typename T > -struct never_true -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; - -} // namespace msvc70_aux - -#endif // # if defined(BOOST_MSVC) && (BOOST_MSVC == 1300) - -template -struct elif_selected -{ -# if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__MWERKS__) && __MWERKS__ <= 0x2407) - template class then; -# elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300) - template - struct then : msvc70_aux::inherit_from< msvc70_aux::never_true::value > - ::template result< if_selected >::type - { - }; -# else - template - struct then : if_selected - { - }; -# endif -}; - -# if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__MWERKS__) && __MWERKS__ <= 0x2407) -template -template -class elif_selected::then : public if_selected -{ -}; -# endif - -template struct if_ -{ - template - struct then : if_selected - { - }; -}; - -struct if_unselected -{ - template struct elif : if_ - { - }; - - template - struct else_ - { - typedef U type; - }; -}; - -template <> -struct if_ -{ - template - struct then : if_unselected - { - }; -}; - -}}} // namespace boost::python::detail - -#endif // IF_ELSE_DWA2002322_HPP diff --git a/include/boost/python/detail/indirect_traits.hpp b/include/boost/python/detail/indirect_traits.hpp deleted file mode 100644 index ce8ba310..00000000 --- a/include/boost/python/detail/indirect_traits.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef INDIRECT_TRAITS_DWA2004915_HPP -# define INDIRECT_TRAITS_DWA2004915_HPP - -# include - -namespace boost { namespace python { -namespace indirect_traits = boost::detail::indirect_traits; -}} // namespace boost::python::detail - -#endif // INDIRECT_TRAITS_DWA2004915_HPP diff --git a/include/boost/python/detail/invoke.hpp b/include/boost/python/detail/invoke.hpp deleted file mode 100644 index 939fa118..00000000 --- a/include/boost/python/detail/invoke.hpp +++ /dev/null @@ -1,100 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2002. -// 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 INVOKE_DWA20021122_HPP -# define INVOKE_DWA20021122_HPP - -# include -# include -# include - -# include - -# include -# include -# include -# include -# include -# include - -// This file declares a series of overloaded invoke(...) functions, -// used to invoke wrapped C++ function (object)s from Python. Each one -// accepts: -// -// - a tag which identifies the invocation syntax (e.g. member -// functions must be invoked with a different syntax from regular -// functions) -// -// - a pointer to a result converter type, used solely as a way of -// transmitting the type of the result converter to the function (or -// an int, if the return type is void). -// -// - the "function", which may be a function object, a function or -// member function pointer, or a defaulted_virtual_fn. -// -// - The arg_from_python converters for each of the arguments to be -// passed to the function being invoked. - -namespace boost { namespace python { namespace detail { - -// This "result converter" is really just used as a dispatch tag to -// invoke(...), selecting the appropriate implementation -typedef int void_result_to_python; - -template -struct invoke_tag_ {}; - -// A metafunction returning the appropriate tag type for invoking an -// object of type F with return type R. -template -struct invoke_tag - : invoke_tag_< - is_same::value - , is_member_function_pointer::value - > -{ -}; - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PYTHON_MAX_ARITY, )) -# include BOOST_PP_ITERATE() - -}}} // namespace boost::python::detail - -# endif // INVOKE_DWA20021122_HPP -#else - -# define N BOOST_PP_ITERATION() - -template -inline PyObject* invoke(invoke_tag_, RC const& rc, F& f BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, AC, & ac) ) -{ - return rc(f( BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT) )); -} - -template -inline PyObject* invoke(invoke_tag_, RC const&, F& f BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, AC, & ac) ) -{ - f( BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT) ); - return none(); -} - -template -inline PyObject* invoke(invoke_tag_, RC const& rc, F& f, TC& tc BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, AC, & ac) ) -{ - return rc( (tc().*f)(BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT)) ); -} - -template -inline PyObject* invoke(invoke_tag_, RC const&, F& f, TC& tc BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, AC, & ac) ) -{ - (tc().*f)(BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, ac, () BOOST_PP_INTERCEPT)); - return none(); -} - -# undef N - -#endif // BOOST_PP_IS_ITERATING diff --git a/include/boost/python/detail/is_auto_ptr.hpp b/include/boost/python/detail/is_auto_ptr.hpp deleted file mode 100644 index 3b8198b8..00000000 --- a/include/boost/python/detail/is_auto_ptr.hpp +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef IS_AUTO_PTR_DWA2003224_HPP -# define IS_AUTO_PTR_DWA2003224_HPP - -# ifndef BOOST_NO_AUTO_PTR -# include -# include -# endif - -namespace boost { namespace python { namespace detail { - -# if !defined(BOOST_NO_AUTO_PTR) - -BOOST_PYTHON_IS_XXX_DEF(auto_ptr, std::auto_ptr, 1) - -# else - -template -struct is_auto_ptr : mpl::false_ -{ -}; - -# endif - -}}} // namespace boost::python::detail - -#endif // IS_AUTO_PTR_DWA2003224_HPP diff --git a/include/boost/python/detail/is_shared_ptr.hpp b/include/boost/python/detail/is_shared_ptr.hpp deleted file mode 100755 index 547af3f1..00000000 --- a/include/boost/python/detail/is_shared_ptr.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef IS_SHARED_PTR_DWA2003224_HPP -# define IS_SHARED_PTR_DWA2003224_HPP - -# include -# include - -namespace boost { namespace python { namespace detail { - -BOOST_PYTHON_IS_XXX_DEF(shared_ptr, shared_ptr, 1) - -}}} // namespace boost::python::detail - -#endif // IS_SHARED_PTR_DWA2003224_HPP diff --git a/include/boost/python/detail/is_wrapper.hpp b/include/boost/python/detail/is_wrapper.hpp deleted file mode 100755 index d7bce7b6..00000000 --- a/include/boost/python/detail/is_wrapper.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef IS_WRAPPER_DWA2004723_HPP -# define IS_WRAPPER_DWA2004723_HPP - -# include -# include - -namespace boost { namespace python { - -template class wrapper; - -namespace detail -{ - typedef char (&is_not_wrapper)[2]; - is_not_wrapper is_wrapper_helper(...); - template - char is_wrapper_helper(wrapper const volatile*); - - // A metafunction returning true iff T is [derived from] wrapper - template - struct is_wrapper - : mpl::bool_<(sizeof(detail::is_wrapper_helper((T*)0)) == 1)> - {}; - -}}} // namespace boost::python::detail - -#endif // IS_WRAPPER_DWA2004723_HPP diff --git a/include/boost/python/detail/is_xxx.hpp b/include/boost/python/detail/is_xxx.hpp deleted file mode 100644 index 17f92a1c..00000000 --- a/include/boost/python/detail/is_xxx.hpp +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef IS_XXX_DWA2003224_HPP -# define IS_XXX_DWA2003224_HPP - -# include -# include -# include - -# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -# include -# include - -# define BOOST_PYTHON_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_PYTHON_IS_XXX_DEF(name, qualified_name, nargs) \ -template \ -struct is_##name : mpl::false_ \ -{ \ -}; \ - \ -template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class T) > \ -struct is_##name< \ - qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, T) > \ -> \ - : mpl::true_ \ -{ \ -}; - -# endif - -#endif // IS_XXX_DWA2003224_HPP diff --git a/include/boost/python/detail/make_keyword_range_fn.hpp b/include/boost/python/detail/make_keyword_range_fn.hpp deleted file mode 100644 index bc959997..00000000 --- a/include/boost/python/detail/make_keyword_range_fn.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 MAKE_KEYWORD_RANGE_FN_DWA2002927_HPP -# define MAKE_KEYWORD_RANGE_FN_DWA2002927_HPP - -# include -# include - -# include - -# include - - -namespace boost { namespace python { namespace detail { - -// Think of this as a version of make_function without a compile-time -// check that the size of kw is no greater than the expected arity of -// F. This version is needed when defining functions with default -// arguments, because compile-time information about the number of -// keywords is missing for all but the initial function definition. -// -// @group make_keyword_range_function { -template -object make_keyword_range_function( - F f - , Policies const& policies - , keyword_range const& kw) -{ - return detail::make_function_aux( - f, policies, detail::get_signature(f), kw, mpl::int_<0>()); -} - -template -object make_keyword_range_function( - F f - , Policies const& policies - , keyword_range const& kw - , Signature const& sig) -{ - return detail::make_function_aux( - f, policies, sig, kw, mpl::int_<0>()); -} -// } - -// Builds an '__init__' function which inserts the given Holder type -// in a wrapped C++ class instance. ArgList is an MPL type sequence -// describing the C++ argument types to be passed to Holder's -// constructor. -// -// Holder and ArgList are intended to be explicitly specified. -template -object make_keyword_range_constructor( - CallPolicies const& policies // The CallPolicies with which to invoke the Holder's constructor - , detail::keyword_range const& kw // The (possibly empty) set of associated argument keywords - , Holder* = 0 - , ArgList* = 0, Arity* = 0) -{ - return detail::make_keyword_range_function( - objects::make_holder - ::template apply::execute - , policies - , kw); -} - -}}} // namespace boost::python::detail - -#endif // MAKE_KEYWORD_RANGE_FN_DWA2002927_HPP diff --git a/include/boost/python/detail/make_tuple.hpp b/include/boost/python/detail/make_tuple.hpp deleted file mode 100644 index 57b285be..00000000 --- a/include/boost/python/detail/make_tuple.hpp +++ /dev/null @@ -1,32 +0,0 @@ -# ifndef BOOST_PYTHON_SYNOPSIS -# // Copyright David Abrahams 2002. -# // 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) -# error Boost.Python - do not include this file! -# endif - -# define N BOOST_PP_ITERATION() - -# define BOOST_PYTHON_MAKE_TUPLE_ARG(z, N, ignored) \ - PyTuple_SET_ITEM( \ - result.ptr() \ - , N \ - , python::incref(python::object(a##N).ptr()) \ - ); - - template - tuple - make_tuple(BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, const& a)) - { - tuple result((detail::new_reference)::PyTuple_New(N)); - BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_MAKE_TUPLE_ARG, _) - return result; - } - -# undef BOOST_PYTHON_MAKE_TUPLE_ARG - -# undef N -# endif // BOOST_PYTHON_SYNOPSIS diff --git a/include/boost/python/detail/map_entry.hpp b/include/boost/python/detail/map_entry.hpp deleted file mode 100644 index 8bf1759f..00000000 --- a/include/boost/python/detail/map_entry.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 MAP_ENTRY_DWA2002118_HPP -# define MAP_ENTRY_DWA2002118_HPP - -namespace boost { namespace python { namespace detail { - -// A trivial type that works well as the value_type of associative -// vector maps -template -struct map_entry -{ - map_entry() {} - map_entry(Key k) : key(k), value() {} - map_entry(Key k, Value v) : key(k), value(v) {} - - bool operator<(map_entry const& rhs) const - { - return this->key < rhs.key; - } - - Key key; - Value value; -}; - -template -bool operator<(map_entry const& e, Key const& k) -{ - return e.key < k; -} - -template -bool operator<(Key const& k, map_entry const& e) -{ - return k < e.key; -} - - -}}} // namespace boost::python::detail - -#endif // MAP_ENTRY_DWA2002118_HPP diff --git a/include/boost/python/detail/mpl_lambda.hpp b/include/boost/python/detail/mpl_lambda.hpp deleted file mode 100644 index a20608e7..00000000 --- a/include/boost/python/detail/mpl_lambda.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 MPL_LAMBDA_DWA2002122_HPP -# define MPL_LAMBDA_DWA2002122_HPP - -// this header should go away soon -# include -# define BOOST_PYTHON_MPL_LAMBDA_SUPPORT BOOST_MPL_AUX_LAMBDA_SUPPORT - -#endif // MPL_LAMBDA_DWA2002122_HPP diff --git a/include/boost/python/detail/msvc_typeinfo.hpp b/include/boost/python/detail/msvc_typeinfo.hpp deleted file mode 100644 index 10f84505..00000000 --- a/include/boost/python/detail/msvc_typeinfo.hpp +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 MSVC_TYPEINFO_DWA200222_HPP -# define MSVC_TYPEINFO_DWA200222_HPP - -#include -#include -#include - -// -// Fix for MSVC's broken typeid() implementation which doesn't strip -// decoration. This fix doesn't handle cv-qualified array types. It -// could probably be done, but I haven't figured it out yet. -// - -# if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(BOOST_INTEL_CXX_VERSION) && BOOST_INTEL_CXX_VERSION <= 700 - -namespace boost { namespace python { namespace detail { - -typedef std::type_info const& typeinfo; - -template -static typeinfo typeid_nonref(T const volatile*) { return typeid(T); } - -template -inline typeinfo typeid_ref_1(T&(*)()) -{ - return detail::typeid_nonref((T*)0); -} - -// A non-reference -template -inline typeinfo typeid_ref(type*, T&(*)(type)) -{ - return detail::typeid_nonref((T*)0); -} - -// A reference -template -inline typeinfo typeid_ref(type*, ...) -{ - return detail::typeid_ref_1((T(*)())0); -} - -template< typename T > T&(* is_ref_tester1(type) )(type) { return 0; } -inline char BOOST_TT_DECL is_ref_tester1(...) { return 0; } - -template -inline typeinfo msvc_typeid(boost::type*) -{ - return detail::typeid_ref( - (boost::type*)0, detail::is_ref_tester1(type()) - ); -} - -template <> -inline typeinfo msvc_typeid(boost::type*) -{ - return typeid(void); -} - -# ifndef NDEBUG -inline typeinfo assert_array_typeid_compiles() -{ - return msvc_typeid((boost::type*)0) - , msvc_typeid((boost::type*)0); -} -# endif - -}}} // namespace boost::python::detail - -# endif // BOOST_MSVC -#endif // MSVC_TYPEINFO_DWA200222_HPP diff --git a/include/boost/python/detail/none.hpp b/include/boost/python/detail/none.hpp deleted file mode 100644 index bc3337a2..00000000 --- a/include/boost/python/detail/none.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// (C) Copyright David Abrahams 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) -// -// The author gratefully acknowleges the support of Dragon Systems, Inc., in -// producing this work. - -#ifndef NONE_DWA_052000_H_ -# define NONE_DWA_052000_H_ - -# include - -namespace boost { namespace python { namespace detail { - -inline PyObject* none() { Py_INCREF(Py_None); return Py_None; } - -}}} // namespace boost::python::detail - -#endif // NONE_DWA_052000_H_ diff --git a/include/boost/python/detail/not_specified.hpp b/include/boost/python/detail/not_specified.hpp deleted file mode 100644 index 2f7c7ad9..00000000 --- a/include/boost/python/detail/not_specified.hpp +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 NOT_SPECIFIED_DWA2002321_HPP -# define NOT_SPECIFIED_DWA2002321_HPP - -namespace boost { namespace python { namespace detail { - - struct not_specified {}; - -}}} // namespace boost::python::detail - -#endif // NOT_SPECIFIED_DWA2002321_HPP diff --git a/include/boost/python/detail/nullary_function_adaptor.hpp b/include/boost/python/detail/nullary_function_adaptor.hpp deleted file mode 100755 index 9dcc434f..00000000 --- a/include/boost/python/detail/nullary_function_adaptor.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef NULLARY_FUNCTION_ADAPTOR_DWA2003824_HPP -# define NULLARY_FUNCTION_ADAPTOR_DWA2003824_HPP - -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace detail { - -// nullary_function_adaptor -- a class template which ignores its -// arguments and calls a nullary function instead. Used for building -// error-reporting functions, c.f. pure_virtual -template -struct nullary_function_adaptor -{ - nullary_function_adaptor(NullaryFunction fn) - : m_fn(fn) - {} - - void operator()() const { m_fn(); } - -# define BOOST_PP_LOCAL_MACRO(i) \ - template \ - void operator()( \ - BOOST_PP_ENUM_BINARY_PARAMS_Z(1, i, A, const& BOOST_PP_INTERCEPT) \ - ) const \ - { \ - m_fn(); \ - } - -# define BOOST_PP_LOCAL_LIMITS (1, BOOST_PYTHON_MAX_ARITY) -# include BOOST_PP_LOCAL_ITERATE() - - private: - NullaryFunction m_fn; -}; - -}}} // namespace boost::python::detail - -#endif // NULLARY_FUNCTION_ADAPTOR_DWA2003824_HPP diff --git a/include/boost/python/detail/operator_id.hpp b/include/boost/python/detail/operator_id.hpp deleted file mode 100755 index f2cd404e..00000000 --- a/include/boost/python/detail/operator_id.hpp +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 OPERATOR_ID_DWA2002531_HPP -# define OPERATOR_ID_DWA2002531_HPP - -namespace boost { namespace python { namespace detail { - -enum operator_id -{ - op_add, - op_sub, - op_mul, - op_div, - op_mod, - op_divmod, - op_pow, - op_lshift, - op_rshift, - op_and, - op_xor, - op_or, - op_neg, - op_pos, - op_abs, - op_invert, - op_int, - op_long, - op_float, - op_str, - op_cmp, - op_gt, - op_ge, - op_lt, - op_le, - op_eq, - op_ne, - op_iadd, - op_isub, - op_imul, - op_idiv, - op_imod, - op_ilshift, - op_irshift, - op_iand, - op_ixor, - op_ior, - op_complex, - op_nonzero -}; - -}}} // namespace boost::python::detail - -#endif // OPERATOR_ID_DWA2002531_HPP diff --git a/include/boost/python/detail/overloads_fwd.hpp b/include/boost/python/detail/overloads_fwd.hpp deleted file mode 100644 index 4c7fdf29..00000000 --- a/include/boost/python/detail/overloads_fwd.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 OVERLOADS_FWD_DWA2002101_HPP -# define OVERLOADS_FWD_DWA2002101_HPP - -namespace boost { namespace python { namespace detail { - -// forward declarations -struct overloads_base; - -template -inline void define_with_defaults(char const* name, OverloadsT const&, NameSpaceT&, SigT const&); - -}}} // namespace boost::python::detail - -#endif // OVERLOADS_FWD_DWA2002101_HPP diff --git a/include/boost/python/detail/pointee.hpp b/include/boost/python/detail/pointee.hpp deleted file mode 100644 index e18c1f49..00000000 --- a/include/boost/python/detail/pointee.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 POINTEE_DWA2002323_HPP -# define POINTEE_DWA2002323_HPP - -# include - -namespace boost { namespace python { namespace detail { - -template -struct pointee_impl -{ - template struct apply : remove_pointer {}; -}; - -template <> -struct pointee_impl -{ - template struct apply - { - typedef typename T::element_type type; - }; -}; - -template -struct pointee - : pointee_impl::value>::template apply -{ -}; - -}}} // namespace boost::python::detail - -#endif // POINTEE_DWA2002323_HPP diff --git a/include/boost/python/detail/prefix.hpp b/include/boost/python/detail/prefix.hpp deleted file mode 100755 index 8b34ed77..00000000 --- a/include/boost/python/detail/prefix.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef PREFIX_DWA2003531_HPP -# define PREFIX_DWA2003531_HPP - -// The rule is that must be included before any system -// headers (so it can get control over some awful macros). -// Unfortunately, Boost.Python needs to #include first, at -// least... but this gets us as close as possible. - -# include -# include - -#endif // PREFIX_DWA2003531_HPP diff --git a/include/boost/python/detail/preprocessor.hpp b/include/boost/python/detail/preprocessor.hpp deleted file mode 100644 index 2c1b2e84..00000000 --- a/include/boost/python/detail/preprocessor.hpp +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 PREPROCESSOR_DWA200247_HPP -# define PREPROCESSOR_DWA200247_HPP - -# include -# include -# include -# include - -// stuff that should be in the preprocessor library - -# define BOOST_PYTHON_APPLY(x) BOOST_PP_CAT(BOOST_PYTHON_APPLY_, x) - -# define BOOST_PYTHON_APPLY_BOOST_PYTHON_ITEM(v) v -# define BOOST_PYTHON_APPLY_BOOST_PYTHON_NIL - -// cv-qualifiers - -# if !defined(__MWERKS__) || __MWERKS__ > 0x2407 -# define BOOST_PYTHON_CV_COUNT 4 -# else -# define BOOST_PYTHON_CV_COUNT 1 -# endif - -# ifndef BOOST_PYTHON_MAX_ARITY -# define BOOST_PYTHON_MAX_ARITY 15 -# endif - -# ifndef BOOST_PYTHON_MAX_BASES -# define BOOST_PYTHON_MAX_BASES 10 -# endif - -# define BOOST_PYTHON_CV_QUALIFIER(i) \ - BOOST_PYTHON_APPLY( \ - BOOST_PP_TUPLE_ELEM(4, i, BOOST_PYTHON_CV_QUALIFIER_I) \ - ) - -# define BOOST_PYTHON_CV_QUALIFIER_I \ - ( \ - BOOST_PYTHON_NIL, \ - BOOST_PYTHON_ITEM(const), \ - BOOST_PYTHON_ITEM(volatile), \ - BOOST_PYTHON_ITEM(const volatile) \ - ) - -// enumerators -# define BOOST_PYTHON_UNARY_ENUM(c, text) BOOST_PP_REPEAT(c, BOOST_PYTHON_UNARY_ENUM_I, text) -# define BOOST_PYTHON_UNARY_ENUM_I(z, n, text) BOOST_PP_COMMA_IF(n) text ## n - -# define BOOST_PYTHON_BINARY_ENUM(c, a, b) BOOST_PP_REPEAT(c, BOOST_PYTHON_BINARY_ENUM_I, (a, b)) -# define BOOST_PYTHON_BINARY_ENUM_I(z, n, _) BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, _), n) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 1, _), n) - -# define BOOST_PYTHON_ENUM_WITH_DEFAULT(c, text, def) BOOST_PP_REPEAT(c, BOOST_PYTHON_ENUM_WITH_DEFAULT_I, (text, def)) -# define BOOST_PYTHON_ENUM_WITH_DEFAULT_I(z, n, _) BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, _), n) = BOOST_PP_TUPLE_ELEM(2, 1, _) - -// fixed text (no commas) -# define BOOST_PYTHON_FIXED(z, n, text) text - -// flags -# define BOOST_PYTHON_FUNCTION_POINTER 0x0001 -# define BOOST_PYTHON_POINTER_TO_MEMBER 0x0002 - -#endif // PREPROCESSOR_DWA200247_HPP diff --git a/include/boost/python/detail/python22_fixed.h b/include/boost/python/detail/python22_fixed.h deleted file mode 100644 index e236c2b0..00000000 --- a/include/boost/python/detail/python22_fixed.h +++ /dev/null @@ -1,150 +0,0 @@ -// This file is a modified version of Python 2.2/2.2.1 Python.h. As -// such it is: -// -// Copyright (c) 2001, 2002 Python Software Foundation; All Rights -// Reserved -// -// Changes from the original: -// 1. #includes for Python 2.2.1 -// 2. Provides missing extern "C" wrapper for "iterobject.h" and "descrobject.h". -// - -// Changes marked with "Boost.Python modification" -#ifndef Py_PYTHON_H -#define Py_PYTHON_H -/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ - - -/* Enable compiler features; switching on C lib defines doesn't work - here, because the symbols haven't necessarily been defined yet. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -/* Forcing SUSv2 compatibility still produces problems on some - platforms, True64 and SGI IRIX begin two of them, so for now the - define is switched off. */ -#if 0 -#ifndef _XOPEN_SOURCE -# define _XOPEN_SOURCE 500 -#endif -#endif - -/* Include nearly all Python header files */ - -#include "patchlevel.h" -#include "pyconfig.h" - -#ifdef HAVE_LIMITS_H -#include -#endif - -/* pyconfig.h may or may not define DL_IMPORT */ -#ifndef DL_IMPORT /* declarations for DLL import/export */ -#define DL_IMPORT(RTYPE) RTYPE -#endif -#ifndef DL_EXPORT /* declarations for DLL import/export */ -#define DL_EXPORT(RTYPE) RTYPE -#endif - -#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) -#define _SGI_MP_SOURCE -#endif - -#include -#ifndef NULL -# error "Python.h requires that stdio.h define NULL." -#endif - -#include -#include -#ifdef HAVE_STDLIB_H -#include -#endif -#if PY_MICRO_VERSION == 1 // Boost.Python modification: emulate Python 2.2 -#ifdef HAVE_UNISTD_H -#include -#endif -#endif // Boost.Python modification: emulate Python 2.2 - -/* CAUTION: Build setups should ensure that NDEBUG is defined on the - * compiler command line when building Python in release mode; else - * assert() calls won't be removed. - */ -#include - -#include "pyport.h" - -#include "pymem.h" - -#include "object.h" -#include "objimpl.h" - -#include "pydebug.h" - -#include "unicodeobject.h" -#include "intobject.h" -#include "longobject.h" -#include "floatobject.h" -#ifndef WITHOUT_COMPLEX -#include "complexobject.h" -#endif -#include "rangeobject.h" -#include "stringobject.h" -#include "bufferobject.h" -#include "tupleobject.h" -#include "listobject.h" -#include "dictobject.h" -#include "methodobject.h" -#include "moduleobject.h" -#include "funcobject.h" -#include "classobject.h" -#include "fileobject.h" -#include "cobject.h" -#include "traceback.h" -#include "sliceobject.h" -#include "cellobject.h" -extern "C" { // Boost.Python modification: provide missing extern "C" -#include "iterobject.h" -#include "descrobject.h" -} // Boost.Python modification: provide missing extern "C" -#include "weakrefobject.h" - -#include "codecs.h" -#include "pyerrors.h" - -#include "pystate.h" - -#include "modsupport.h" -#include "pythonrun.h" -#include "ceval.h" -#include "sysmodule.h" -#include "intrcheck.h" -#include "import.h" - -#include "abstract.h" - -#define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a)) -#define PyArg_NoArgs(v) PyArg_Parse(v, "") - -/* Convert a possibly signed character to a nonnegative int */ -/* XXX This assumes characters are 8 bits wide */ -#ifdef __CHAR_UNSIGNED__ -#define Py_CHARMASK(c) (c) -#else -#define Py_CHARMASK(c) ((c) & 0xff) -#endif - -#include "pyfpe.h" - -/* These definitions must match corresponding definitions in graminit.h. - There's code in compile.c that checks that they are the same. */ -#define Py_single_input 256 -#define Py_file_input 257 -#define Py_eval_input 258 - -#ifdef HAVE_PTH -/* GNU pth user-space thread support */ -#include -#endif -#endif /* !Py_PYTHON_H */ diff --git a/include/boost/python/detail/raw_pyobject.hpp b/include/boost/python/detail/raw_pyobject.hpp deleted file mode 100644 index 194409ed..00000000 --- a/include/boost/python/detail/raw_pyobject.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 RAW_PYOBJECT_DWA2002628_HPP -# define RAW_PYOBJECT_DWA2002628_HPP - -namespace boost { namespace python { namespace detail { - -// -// Define some types which we can use to get around the vagaries of -// PyObject*. We will use these to initialize object instances, and -// keep them in namespace detail to make sure they stay out of the -// hands of users. That is much simpler than trying to grant -// friendship to all the appropriate parties. -// - -// New references are normally checked for null -struct new_reference_t; -typedef new_reference_t* new_reference; - -// Borrowed references are assumed to be non-null -struct borrowed_reference_t; -typedef borrowed_reference_t* borrowed_reference; - -// New references which aren't checked for null -struct new_non_null_reference_t; -typedef new_non_null_reference_t* new_non_null_reference; - -}}} // namespace boost::python::detail - -#endif // RAW_PYOBJECT_DWA2002628_HPP diff --git a/include/boost/python/detail/referent_storage.hpp b/include/boost/python/detail/referent_storage.hpp deleted file mode 100644 index 0a1ef5a0..00000000 --- a/include/boost/python/detail/referent_storage.hpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 REFERENT_STORAGE_DWA200278_HPP -# define REFERENT_STORAGE_DWA200278_HPP -# include -# include - -namespace boost { namespace python { namespace detail { - -struct alignment_dummy; -typedef void (*function_ptr)(); -typedef int (alignment_dummy::*member_ptr); -typedef int (alignment_dummy::*member_function_ptr)(); - -# define BOOST_PYTHON_ALIGNER(T, n) \ - typename mpl::if_c< \ - sizeof(T) <= size, T, char>::type t##n - -// Storage for size bytes, aligned to all fundamental types no larger than size -template -union aligned_storage -{ - BOOST_PYTHON_ALIGNER(char, 0); - BOOST_PYTHON_ALIGNER(short, 1); - BOOST_PYTHON_ALIGNER(int, 2); - BOOST_PYTHON_ALIGNER(long, 3); - BOOST_PYTHON_ALIGNER(float, 4); - BOOST_PYTHON_ALIGNER(double, 5); - BOOST_PYTHON_ALIGNER(long double, 6); - BOOST_PYTHON_ALIGNER(void*, 7); - BOOST_PYTHON_ALIGNER(function_ptr, 8); - BOOST_PYTHON_ALIGNER(member_ptr, 9); - BOOST_PYTHON_ALIGNER(member_function_ptr, 10); - char bytes[size]; -}; - -# undef BOOST_PYTHON_ALIGNER - - // Compute the size of T's referent. We wouldn't need this at all, - // but sizeof() is broken in CodeWarriors <= 8.0 - template struct referent_size; - -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - - template - struct referent_size - { - BOOST_STATIC_CONSTANT( - std::size_t, value = sizeof(T)); - }; - -# else - - template struct referent_size - { - static T f(); - BOOST_STATIC_CONSTANT(std::size_t, value = sizeof(f())); - }; - -# endif - -// A metafunction returning a POD type which can store U, where T == -// U&. If T is not a reference type, returns a POD which can store T. -template -struct referent_storage -{ - typedef aligned_storage< - ::boost::python::detail::referent_size::value - > type; -}; - -}}} // namespace boost::python::detail - -#endif // REFERENT_STORAGE_DWA200278_HPP diff --git a/include/boost/python/detail/result.hpp b/include/boost/python/detail/result.hpp deleted file mode 100755 index 9e322dd7..00000000 --- a/include/boost/python/detail/result.hpp +++ /dev/null @@ -1,131 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2002. -// 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 RESULT_DWA2002521_HPP -# define RESULT_DWA2002521_HPP - -# include - -# include - -# include -# include - -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace detail { - -// Defines a family of overloaded function which, given x, a function -// pointer, member [function] pointer, or an AdaptableFunction object, -// returns a pointer to type*, where R is the result type of -// invoking the result of bind(x). -// -// In order to work around bugs in deficient compilers, if x might be -// an AdaptableFunction object, you must pass OL as a second argument -// to get this to work portably. - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (4, (0, BOOST_PYTHON_MAX_ARITY, , BOOST_PYTHON_FUNCTION_POINTER)) -# include BOOST_PP_ITERATE() - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (4, (0, BOOST_PYTHON_CV_COUNT - 1, , BOOST_PYTHON_POINTER_TO_MEMBER)) -# include BOOST_PP_ITERATE() - -template -boost::type* result(R (T::*), int = 0) { return 0; } - -# if (defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140) \ - || (defined(__GNUC__) && __GNUC__ < 3) \ - || (defined(__MWERKS__) && __MWERKS__ < 0x3000) -// This code actually works on all implementations, but why use it when we don't have to? -template -struct get_result_type -{ - typedef boost::type type; -}; - -struct void_type -{ - typedef void type; -}; - -template -struct result_result -{ - typedef typename mpl::if_c< - is_class::value - , get_result_type - , void_type - >::type t1; - - typedef typename t1::type* type; -}; - -template -typename result_result::type -result(X const&, short) { return 0; } - -# else // Simpler code for more-capable compilers -template -boost::type* -result(X const&, short = 0) { return 0; } - -# endif - -}}} // namespace boost::python::detail - -# endif // RESULT_DWA2002521_HPP - -/* --------------- function pointers --------------- */ -#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_FUNCTION_POINTER -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, result.hpp(function pointers)) -# endif - -# define N BOOST_PP_ITERATION() - -template -boost::type* result(R (*pf)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)), int = 0) -{ - return 0; -} - -# undef N - -/* --------------- pointers-to-members --------------- */ -#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_POINTER_TO_MEMBER -// Outer over cv-qualifiers - -# define BOOST_PP_ITERATION_PARAMS_2 (3, (0, BOOST_PYTHON_MAX_ARITY, )) -# include BOOST_PP_ITERATE() - -#elif BOOST_PP_ITERATION_DEPTH() == 2 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, result.hpp(pointers-to-members)) -# endif -// Inner over arities - -# define N BOOST_PP_ITERATION() -# define Q BOOST_PYTHON_CV_QUALIFIER(BOOST_PP_RELATIVE_ITERATION(1)) - -template -boost::type* result(R (T::*pmf)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)) Q, int = 0) -{ - return 0; -} - -# undef N -# undef Q - -#endif diff --git a/include/boost/python/detail/scope.hpp b/include/boost/python/detail/scope.hpp deleted file mode 100644 index 5367bbd3..00000000 --- a/include/boost/python/detail/scope.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 SCOPE_DWA2002927_HPP -# define SCOPE_DWA2002927_HPP - -# include - -namespace boost { namespace python { namespace detail { - -void BOOST_PYTHON_DECL scope_setattr_doc(char const* name, object const& obj, char const* doc); - -}}} // namespace boost::python::detail - -#endif // SCOPE_DWA2002927_HPP diff --git a/include/boost/python/detail/sfinae.hpp b/include/boost/python/detail/sfinae.hpp deleted file mode 100755 index 62818751..00000000 --- a/include/boost/python/detail/sfinae.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef SFINAE_DWA2004723_HPP -# define SFINAE_DWA2004723_HPP - -# include - -# if defined(BOOST_NO_SFINAE) && !defined(BOOST_MSVC) -# define BOOST_PYTHON_NO_SFINAE -# endif - -#endif // SFINAE_DWA2004723_HPP diff --git a/include/boost/python/detail/signature.hpp b/include/boost/python/detail/signature.hpp deleted file mode 100644 index 26e986cc..00000000 --- a/include/boost/python/detail/signature.hpp +++ /dev/null @@ -1,88 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2002. -// 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 SIGNATURE_DWA20021121_HPP -# define SIGNATURE_DWA20021121_HPP - -# include - -# include -# include - -# include -# include - -# include -# include - -namespace boost { namespace python { namespace detail { - -struct signature_element -{ - char const* basename; - bool lvalue; -}; - -template struct signature_arity; - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PYTHON_MAX_ARITY + 1, )) -# include BOOST_PP_ITERATE() - -// A metafunction returning the base class used for -// -// signature. -// -template -struct signature_base_select -{ - enum { arity = mpl::size::value - 1 }; - typedef typename signature_arity::template impl type; -}; - -template -struct signature - : signature_base_select::type -{ -}; - -}}} // namespace boost::python::detail - -# endif // SIGNATURE_DWA20021121_HPP - -#else - -# define N BOOST_PP_ITERATION() - -template <> -struct signature_arity -{ - template - struct impl - { - static signature_element const* elements() - { - static signature_element const result[N+2] = { - -# define BOOST_PP_LOCAL_MACRO(i) \ - { \ - type_id::type>().name() \ - , indirect_traits::is_reference_to_non_const::type>::value \ - }, - -# define BOOST_PP_LOCAL_LIMITS (0, N) -# include BOOST_PP_LOCAL_ITERATE() - {0,0} - }; - return result; - } - }; -}; - -#endif // BOOST_PP_IS_ITERATING - - diff --git a/include/boost/python/detail/string_literal.hpp b/include/boost/python/detail/string_literal.hpp deleted file mode 100644 index 50193b64..00000000 --- a/include/boost/python/detail/string_literal.hpp +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 STRING_LITERAL_DWA2002629_HPP -# define STRING_LITERAL_DWA2002629_HPP - -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace detail { - -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template -struct is_string_literal : mpl::false_ -{ -}; - -# if !defined(__MWERKS__) || __MWERKS__ > 0x2407 -template -struct is_string_literal : mpl::true_ -{ -}; - -# if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590040)) \ - || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730) -// This compiler mistakenly gets the type of string literals as char* -// instead of char[NN]. -template <> -struct is_string_literal : mpl::true_ -{ -}; -# endif - -# else - -// CWPro7 has trouble with the array type deduction above -template -struct is_string_literal - : is_same -{ -}; -# endif -# else -template -struct string_literal_helper -{ - typedef char (&yes_string_literal)[1]; - typedef char (&no_string_literal)[2]; - - template - struct apply - { - typedef apply self; - static T x; - static yes_string_literal check(char const*); - static no_string_literal check(char*); - static no_string_literal check(void const volatile*); - - BOOST_STATIC_CONSTANT( - bool, value = sizeof(self::check(x)) == sizeof(yes_string_literal)); - typedef mpl::bool_ type; - }; -}; - -template <> -struct string_literal_helper -{ - template - struct apply : mpl::false_ - { - }; -}; - -template -struct is_string_literal - : string_literal_helper::value>::apply -{ -}; -# endif - -}}} // namespace boost::python::detail - -#endif // STRING_LITERAL_DWA2002629_HPP diff --git a/include/boost/python/detail/target.hpp b/include/boost/python/detail/target.hpp deleted file mode 100644 index 5079699a..00000000 --- a/include/boost/python/detail/target.hpp +++ /dev/null @@ -1,82 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2002. -// 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 TARGET_DWA2002521_HPP -# define TARGET_DWA2002521_HPP - -# include - -# include - -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace detail { - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (4, (0, BOOST_PYTHON_MAX_ARITY, , BOOST_PYTHON_FUNCTION_POINTER)) -# include BOOST_PP_ITERATE() - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (4, (0, BOOST_PYTHON_CV_COUNT - 1, , BOOST_PYTHON_POINTER_TO_MEMBER)) -# include BOOST_PP_ITERATE() - -template -T& (* target(R (T::*)) )() { return 0; } - -}}} // namespace boost::python::detail - -# endif // TARGET_DWA2002521_HPP - -/* --------------- function pointers --------------- */ -#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_FUNCTION_POINTER -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, target.hpp(function_pointers)) -# endif - -# define N BOOST_PP_ITERATION() - -template -BOOST_PP_IF(N, A0, void)(* target(R (*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A))) )() -{ - return 0; -} - -# undef N - -/* --------------- pointers-to-members --------------- */ -#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == BOOST_PYTHON_POINTER_TO_MEMBER -// Outer over cv-qualifiers - -# define BOOST_PP_ITERATION_PARAMS_2 (3, (0, BOOST_PYTHON_MAX_ARITY, )) -# include BOOST_PP_ITERATE() - -#elif BOOST_PP_ITERATION_DEPTH() == 2 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, target.hpp(pointers-to-members)) -# endif -// Inner over arities - -# define N BOOST_PP_ITERATION() -# define Q BOOST_PYTHON_CV_QUALIFIER(BOOST_PP_RELATIVE_ITERATION(1)) - -template -T& (* target(R (T::*)(BOOST_PP_ENUM_PARAMS_Z(1, N, A)) Q) )() -{ - return 0; -} - -# undef N -# undef Q - -#endif diff --git a/include/boost/python/detail/translate_exception.hpp b/include/boost/python/detail/translate_exception.hpp deleted file mode 100644 index 466b8c89..00000000 --- a/include/boost/python/detail/translate_exception.hpp +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 TRANSLATE_EXCEPTION_DWA2002810_HPP -# define TRANSLATE_EXCEPTION_DWA2002810_HPP - -# include - -# include -# include - -# include - -namespace boost { namespace python { namespace detail { - -// A ternary function object used to translate C++ exceptions of type -// ExceptionType into Python exceptions by invoking an object of type -// Translate. Typically the translate function will be curried with -// boost::bind(). -template -struct translate_exception -{ -// workaround for broken gcc that ships with SuSE 9.0 and SuSE 9.1 -# if defined(__linux__) && defined(__GNUC__) \ - && BOOST_WORKAROUND(__GNUC__, == 3) \ - && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) \ - && (BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 1) \ - || BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 3)) - typedef typename remove_reference< - typename add_const::type - >::type exception_non_ref; -# else - typedef typename add_reference< - typename add_const::type - >::type exception_cref; -# endif - - inline bool operator()( - exception_handler const& handler - , function0 const& f - , typename call_traits::param_type translate) const - { - try - { - return handler(f); - } -// workaround for broken gcc that ships with SuSE 9.0 and SuSE 9.1 -# if defined(__linux__) && defined(__GNUC__) \ - && BOOST_WORKAROUND(__GNUC__, == 3) \ - && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) \ - && (BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 1) \ - || BOOST_WORKAROUND(__GNUC_PATCHLEVEL__, == 3)) - catch(exception_non_ref& e) -# else - catch(exception_cref e) -# endif - { - translate(e); - return true; - } - } -}; - -}}} // namespace boost::python::detail - -#endif // TRANSLATE_EXCEPTION_DWA2002810_HPP diff --git a/include/boost/python/detail/type_list.hpp b/include/boost/python/detail/type_list.hpp deleted file mode 100644 index 9483c194..00000000 --- a/include/boost/python/detail/type_list.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 TYPE_LIST_DWA2002913_HPP -# define TYPE_LIST_DWA2002913_HPP - -# include -# include -# include - -# if BOOST_PYTHON_MAX_ARITY + 2 > BOOST_PYTHON_MAX_BASES -# define BOOST_PYTHON_LIST_SIZE BOOST_PP_INC(BOOST_PP_INC(BOOST_PYTHON_MAX_ARITY)) -# else -# define BOOST_PYTHON_LIST_SIZE BOOST_PYTHON_MAX_BASES -# endif - -// Compute the MPL vector header to use for lists up to BOOST_PYTHON_LIST_SIZE in length -# if BOOST_PYTHON_LIST_SIZE > 48 -# error Arities above 48 not supported by Boost.Python due to MPL internal limit -# elif BOOST_PYTHON_LIST_SIZE > 38 -# include -# elif BOOST_PYTHON_LIST_SIZE > 28 -# include -# elif BOOST_PYTHON_LIST_SIZE > 18 -# include -# elif BOOST_PYTHON_LIST_SIZE > 8 -# include -# else -# include -# endif - -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include -# else -# include -# endif - -#endif // TYPE_LIST_DWA2002913_HPP diff --git a/include/boost/python/detail/type_list_impl.hpp b/include/boost/python/detail/type_list_impl.hpp deleted file mode 100644 index fdcfa850..00000000 --- a/include/boost/python/detail/type_list_impl.hpp +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef BOOST_PP_IS_ITERATING -// Copyright David Abrahams 2002. -// 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 TYPE_LIST_IMPL_DWA2002913_HPP -# define TYPE_LIST_IMPL_DWA2002913_HPP - -# include - -# include -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace detail { - -template -struct type_list - : BOOST_PP_CAT(mpl::vector,BOOST_PYTHON_LIST_SIZE) -{ -}; - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PP_DEC(BOOST_PYTHON_LIST_SIZE), )) -# include BOOST_PP_ITERATE() - - -}}} // namespace boost::python::detail - -# endif // TYPE_LIST_IMPL_DWA2002913_HPP - -#else // BOOST_PP_IS_ITERATING - -# define N BOOST_PP_ITERATION() -# define BOOST_PYTHON_VOID_ARGS BOOST_PP_SUB_D(1,BOOST_PYTHON_LIST_SIZE,N) - -template < - BOOST_PP_ENUM_PARAMS_Z(1, N, class T) - > -struct type_list< - BOOST_PP_ENUM_PARAMS_Z(1, N, T) - BOOST_PP_COMMA_IF(N) - BOOST_PP_ENUM( - BOOST_PYTHON_VOID_ARGS, BOOST_PYTHON_FIXED, mpl::void_) - > - : BOOST_PP_CAT(mpl::vector,N) -{ -}; - -# undef BOOST_PYTHON_VOID_ARGS -# undef N - -#endif // BOOST_PP_IS_ITERATING diff --git a/include/boost/python/detail/type_list_impl_no_pts.hpp b/include/boost/python/detail/type_list_impl_no_pts.hpp deleted file mode 100644 index 15d92523..00000000 --- a/include/boost/python/detail/type_list_impl_no_pts.hpp +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef BOOST_PP_IS_ITERATING -// Copyright David Abrahams 2002. -// 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 TYPE_LIST_IMPL_NO_PTS_DWA2002913_HPP -# define TYPE_LIST_IMPL_NO_PTS_DWA2002913_HPP - -# include - -# include -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace detail { - -template< typename T > -struct is_list_arg -{ - enum { value = true }; -}; - -template<> -struct is_list_arg -{ - enum { value = false }; -}; - -template struct type_list_impl_chooser; - -# define BOOST_PYTHON_LIST_ACTUAL_PARAMS BOOST_PP_ENUM_PARAMS_Z(1,BOOST_PYTHON_LIST_SIZE,T) -# define BOOST_PYTHON_LIST_FORMAL_PARAMS BOOST_PP_ENUM_PARAMS_Z(1,BOOST_PYTHON_LIST_SIZE,class T) - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PYTHON_LIST_SIZE, )) -# include BOOST_PP_ITERATE() - -# define BOOST_PYTHON_PLUS() + -# define BOOST_PYTHON_IS_LIST_ARG(z, n, data) \ - BOOST_PP_IF(n, BOOST_PYTHON_PLUS, BOOST_PP_EMPTY)() \ - is_list_arg< BOOST_PP_CAT(T,n) >::value - -template< - BOOST_PYTHON_LIST_FORMAL_PARAMS - > -struct type_list_count_args -{ - enum { value = - BOOST_PP_REPEAT_1(BOOST_PYTHON_LIST_SIZE, BOOST_PYTHON_IS_LIST_ARG, _) - }; -}; - -template< - BOOST_PYTHON_LIST_FORMAL_PARAMS - > -struct type_list_impl -{ - typedef type_list_count_args< BOOST_PYTHON_LIST_ACTUAL_PARAMS > arg_num_; - typedef typename detail::type_list_impl_chooser< arg_num_::value > - ::template result_< BOOST_PYTHON_LIST_ACTUAL_PARAMS >::type type; -}; - -template< - BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PYTHON_LIST_SIZE, class T, mpl::void_) - > -struct type_list - : detail::type_list_impl< BOOST_PYTHON_LIST_ACTUAL_PARAMS >::type -{ - typedef typename detail::type_list_impl< - BOOST_PYTHON_LIST_ACTUAL_PARAMS - >::type type; -}; - -# undef BOOST_PYTHON_IS_LIST_ARG -# undef BOOST_PYTHON_PLUS -# undef BOOST_PYTHON_LIST_FORMAL_PARAMS -# undef BOOST_PYTHON_LIST_ACTUAL_PARAMS - -}}} // namespace boost::python::detail - -# endif // TYPE_LIST_IMPL_NO_PTS_DWA2002913_HPP - -#else // BOOST_PP_IS_ITERATING - -# define N BOOST_PP_ITERATION() - -template<> -struct type_list_impl_chooser -{ - template< - BOOST_PYTHON_LIST_FORMAL_PARAMS - > - struct result_ - { - typedef typename BOOST_PP_CAT(mpl::vector,N)< - BOOST_PP_ENUM_PARAMS(N, T) - >::type type; - }; -}; - -# undef N - -#endif // BOOST_PP_IS_ITERATING diff --git a/include/boost/python/detail/unwrap_type_id.hpp b/include/boost/python/detail/unwrap_type_id.hpp deleted file mode 100755 index 96c1f530..00000000 --- a/include/boost/python/detail/unwrap_type_id.hpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef UNWRAP_TYPE_ID_DWA2004722_HPP -# define UNWRAP_TYPE_ID_DWA2004722_HPP - -# include - -# include - -namespace boost { namespace python { - -template class wrapper; - -namespace detail { - -template -inline type_info unwrap_type_id(T*, ...) -{ - return type_id(); -} - -template -inline type_info unwrap_type_id(U*, wrapper*) -{ - return type_id(); -} - -}}} // namespace boost::python::detail - -#endif // UNWRAP_TYPE_ID_DWA2004722_HPP diff --git a/include/boost/python/detail/unwrap_wrapper.hpp b/include/boost/python/detail/unwrap_wrapper.hpp deleted file mode 100755 index a0f6a65a..00000000 --- a/include/boost/python/detail/unwrap_wrapper.hpp +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef UNWRAP_WRAPPER_DWA2004723_HPP -# define UNWRAP_WRAPPER_DWA2004723_HPP - -# include -# include -# if defined(BOOST_PYTHON_NO_SFINAE) -# include -# include -# else -# include -# endif - -namespace boost { namespace python { namespace detail { - -# if defined(BOOST_PYTHON_NO_SFINAE) -template -struct unwrap_wrapper_helper -{ - typedef typename T::_wrapper_wrapped_type_ type; -}; - -template -typename mpl::eval_if,unwrap_wrapper_helper,mpl::identity >::type* -unwrap_wrapper(T*) -{ - return 0; -} -# else -template -typename disable_if_ret,T*>::type -unwrap_wrapper(T*) -{ - return 0; -} - -template -T* unwrap_wrapper(wrapper*) -{ - return 0; -} -# endif - -}}} // namespace boost::python::detail - -#endif // UNWRAP_WRAPPER_DWA2004723_HPP diff --git a/include/boost/python/detail/value_arg.hpp b/include/boost/python/detail/value_arg.hpp deleted file mode 100755 index 747588d6..00000000 --- a/include/boost/python/detail/value_arg.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef VALUE_ARG_DWA2004312_HPP -# define VALUE_ARG_DWA2004312_HPP - -# include -# include -# include -# include - -namespace boost { namespace python { namespace detail { - -template -struct value_arg - : mpl::if_< - copy_ctor_mutates_rhs - , T - , typename add_reference< - typename add_const::type - >::type - > -{}; - -}}} // namespace boost::python::detail - -#endif // VALUE_ARG_DWA2004312_HPP diff --git a/include/boost/python/detail/value_is_shared_ptr.hpp b/include/boost/python/detail/value_is_shared_ptr.hpp deleted file mode 100644 index 361c369b..00000000 --- a/include/boost/python/detail/value_is_shared_ptr.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef VALUE_IS_SHARED_PTR_DWA2003224_HPP -# define VALUE_IS_SHARED_PTR_DWA2003224_HPP - -# include -# include - -namespace boost { namespace python { namespace detail { - -BOOST_PYTHON_VALUE_IS_XXX_DEF(shared_ptr, shared_ptr, 1) - -}}} // namespace boost::python::detail - -#endif // VALUE_IS_SHARED_PTR_DWA2003224_HPP diff --git a/include/boost/python/detail/value_is_xxx.hpp b/include/boost/python/detail/value_is_xxx.hpp deleted file mode 100644 index 2b125649..00000000 --- a/include/boost/python/detail/value_is_xxx.hpp +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef VALUE_IS_XXX_DWA2003224_HPP -# define VALUE_IS_XXX_DWA2003224_HPP - -# include -# include -# include - -# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -# include -# include - -# define BOOST_PYTHON_VALUE_IS_XXX_DEF(name, qualified_name, nargs) \ -template \ -struct value_is_##name \ -{ \ - typedef char yes; \ - typedef char (&no)[2]; \ - \ - static typename add_reference::type dummy; \ - \ - template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class U) > \ - static yes test( \ - qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, U) > const&, int \ - ); \ - \ - template \ - static no test(U&, ...); \ - \ - BOOST_STATIC_CONSTANT( \ - bool, value \ - = (sizeof(test(dummy, 0)) == sizeof(yes))); \ - \ - typedef mpl::bool_ type; \ -}; - -# else - -# include -# include -# include - -# define BOOST_PYTHON_VALUE_IS_XXX_DEF(name, qualified_name, nargs) \ -template \ -struct value_is_##name \ -{ \ - BOOST_PYTHON_IS_XXX_DEF(name,qualified_name,nargs) \ - BOOST_STATIC_CONSTANT(bool, value = is_##name< \ - typename remove_cv< \ - typename remove_reference::type \ - >::type \ - >::value); \ - typedef mpl::bool_ type; \ - \ -}; - -# endif - -#endif // VALUE_IS_XXX_DWA2003224_HPP diff --git a/include/boost/python/detail/void_ptr.hpp b/include/boost/python/detail/void_ptr.hpp deleted file mode 100644 index 06f68010..00000000 --- a/include/boost/python/detail/void_ptr.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 VOID_PTR_DWA200239_HPP -# define VOID_PTR_DWA200239_HPP - -# include - -namespace boost { namespace python { namespace detail { - -template -inline U& void_ptr_to_reference(void const volatile* p, U&(*)()) -{ - return *(U*)p; -} - -template -inline void write_void_ptr(void const volatile* storage, void* ptr, T*) -{ - *(T**)storage = (T*)ptr; -} - -// writes U(ptr) into the storage -template -inline void write_void_ptr_reference(void const volatile* storage, void* ptr, U&(*)()) -{ - // stripping CV qualification suppresses warnings on older EDGs - typedef typename remove_cv::type u_stripped; - write_void_ptr(storage, ptr, u_stripped(0)); -} - -}}} // namespace boost::python::detail - -#endif // VOID_PTR_DWA200239_HPP diff --git a/include/boost/python/detail/void_return.hpp b/include/boost/python/detail/void_return.hpp deleted file mode 100644 index 30db8251..00000000 --- a/include/boost/python/detail/void_return.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 VOID_RETURN_DWA200274_HPP -# define VOID_RETURN_DWA200274_HPP - -# include - -namespace boost { namespace python { namespace detail { - -struct void_return -{ - void_return() {} - private: - void operator=(void_return const&); -}; - -template -struct returnable -{ - typedef T type; -}; - -# ifdef BOOST_NO_VOID_RETURNS -template <> -struct returnable -{ - typedef void_return type; -}; - -# ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -template <> struct returnable : returnable {}; -template <> struct returnable : returnable {}; -template <> struct returnable : returnable {}; -# endif - -# endif // BOOST_NO_VOID_RETURNS - -}}} // namespace boost::python::detail - -#endif // VOID_RETURN_DWA200274_HPP diff --git a/include/boost/python/detail/wrap_python.hpp b/include/boost/python/detail/wrap_python.hpp deleted file mode 100644 index 4921578f..00000000 --- a/include/boost/python/detail/wrap_python.hpp +++ /dev/null @@ -1,167 +0,0 @@ -// (C) Copyright David Abrahams 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) -// -// The author gratefully acknowleges the support of Dragon Systems, Inc., in -// producing this work. - -// This file serves as a wrapper around which allows it to be -// compiled with GCC 2.95.2 under Win32 and which disables the default MSVC -// behavior so that a program may be compiled in debug mode without requiring a -// special debugging build of the Python library. - - -// To use the Python debugging library, #define BOOST_DEBUG_PYTHON on the -// compiler command-line. - -// Revision History: -// 05 Mar 01 Suppress warnings under Cygwin with Python 2.0 (Dave Abrahams) -// 04 Mar 01 Rolled in some changes from the Dragon fork (Dave Abrahams) -// 01 Mar 01 define PyObject_INIT() for Python 1.x (Dave Abrahams) - -#ifdef _DEBUG -# ifndef BOOST_DEBUG_PYTHON -# undef _DEBUG // Don't let Python force the debug library just because we're debugging. -# define DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H -# endif -#endif - -# include -# if defined(_SGI_COMPILER_VERSION) && _SGI_COMPILER_VERSION == 741 -# undef _POSIX_C_SOURCE -# undef _XOPEN_SOURCE -# endif - -// -// Python's LongObject.h helpfully #defines ULONGLONG_MAX for us, -// which confuses Boost's config -// -#include -#ifndef ULONG_MAX -# define BOOST_PYTHON_ULONG_MAX_UNDEFINED -#endif -#ifndef LONGLONG_MAX -# define BOOST_PYTHON_LONGLONG_MAX_UNDEFINED -#endif -#ifndef ULONGLONG_MAX -# define BOOST_PYTHON_ULONGLONG_MAX_UNDEFINED -#endif - -// -// Get ahold of Python's version number -// -#include - -#if PY_MAJOR_VERSION<2 || PY_MAJOR_VERSION==2 && PY_MINOR_VERSION<2 -#error Python 2.2 or higher is required for this version of Boost.Python. -#endif - -// -// Some things we need in order to get Python.h to work with compilers other -// than MSVC on Win32 -// -#if defined(_WIN32) || defined(__CYGWIN__) -# if defined(__GNUC__) && defined(__CYGWIN__) - -# define SIZEOF_LONG 4 - -# if PY_MAJOR_VERSION < 2 || PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION <= 2 - -typedef int pid_t; - -# define WORD_BIT 32 -# define hypot _hypot -# include - -# if PY_MAJOR_VERSION < 2 -# define HAVE_CLOCK -# define HAVE_STRFTIME -# define HAVE_STRERROR -# endif - -# define NT_THREADS - -# ifndef NETSCAPE_PI -# define USE_SOCKET -# endif - -# ifdef USE_DL_IMPORT -# define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE -# endif - -# ifdef USE_DL_EXPORT -# define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE -# define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE -# endif - -# define HAVE_LONG_LONG 1 -# define LONG_LONG long long -# endif - -# elif defined(__MWERKS__) - -# ifndef _MSC_VER -# define PY_MSC_VER_DEFINED_FROM_WRAP_PYTHON_H 1 -# define _MSC_VER 900 -# endif - -# undef hypot // undo the evil #define left by Python. - -# elif defined(__BORLANDC__) -# undef HAVE_HYPOT -# define HAVE_HYPOT 1 -# endif - -#endif // _WIN32 - -#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 2 && PY_MICRO_VERSION < 2 -# include -#else -# include -#endif - -#ifdef BOOST_PYTHON_ULONG_MAX_UNDEFINED -# undef ULONG_MAX -# undef BOOST_PYTHON_ULONG_MAX_UNDEFINED -#endif - -#ifdef BOOST_PYTHON_LONGLONG_MAX_UNDEFINED -# undef LONGLONG_MAX -# undef BOOST_PYTHON_LONGLONG_MAX_UNDEFINED -#endif - -#ifdef BOOST_PYTHON_ULONGLONG_MAX_UNDEFINED -# undef ULONGLONG_MAX -# undef BOOST_PYTHON_ULONGLONG_MAX_UNDEFINED -#endif - -#ifdef PY_MSC_VER_DEFINED_FROM_WRAP_PYTHON_H -# undef _MSC_VER -#endif - -#ifdef DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H -# undef DEBUG_UNDEFINED_FROM_WRAP_PYTHON_H -# define _DEBUG -#endif - -#if !defined(PY_MAJOR_VERSION) || PY_MAJOR_VERSION < 2 -# define PyObject_INIT(op, typeobj) \ - ( (op)->ob_type = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) -#endif - -#ifdef __MWERKS__ -# pragma warn_possunwant off -#elif _MSC_VER -# pragma warning(disable:4786) -#endif - -#if defined(HAVE_LONG_LONG) -# if defined(PY_LONG_LONG) -# define BOOST_PYTHON_LONG_LONG PY_LONG_LONG -# elif defined(LONG_LONG) -# define BOOST_PYTHON_LONG_LONG LONG_LONG -# else -# error "HAVE_LONG_LONG defined but not PY_LONG_LONG or LONG_LONG" -# endif -#endif diff --git a/include/boost/python/detail/wrapper_base.hpp b/include/boost/python/detail/wrapper_base.hpp deleted file mode 100755 index 658db5d9..00000000 --- a/include/boost/python/detail/wrapper_base.hpp +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef WRAPPER_BASE_DWA2004722_HPP -# define WRAPPER_BASE_DWA2004722_HPP - -# include -# include -# include - -namespace boost { namespace python { - -class override; - -namespace detail -{ - class BOOST_PYTHON_DECL wrapper_base; - - namespace wrapper_base_ // ADL disabler - { - inline PyObject* get_owner(wrapper_base const volatile& w); - - inline PyObject* - owner_impl(void const volatile* x, mpl::false_) - { - return 0; - } - - template - inline PyObject* - owner_impl(T const volatile* x, mpl::true_); - - template - inline PyObject* - owner(T const volatile* x) - { - return wrapper_base_::owner_impl(x,is_polymorphic()); - } - } - - class BOOST_PYTHON_DECL wrapper_base - { - friend void initialize_wrapper(PyObject* self, wrapper_base* w); - friend PyObject* wrapper_base_::get_owner(wrapper_base const volatile& w); - protected: - wrapper_base() : m_self(0) {} - - override get_override( - char const* name, PyTypeObject* class_object) const; - - private: - void detach(); - - private: - PyObject* m_self; - }; - - namespace wrapper_base_ // ADL disabler - { - template - inline PyObject* - owner_impl(T const volatile* x, mpl::true_) - { - if (wrapper_base const volatile* w = dynamic_cast(x)) - { - return wrapper_base_::get_owner(*w); - } - return 0; - } - - inline PyObject* get_owner(wrapper_base const volatile& w) - { - return w.m_self; - } - } - - inline void initialize_wrapper(PyObject* self, wrapper_base* w) - { - w->m_self = self; - } - - inline void initialize_wrapper(PyObject* self, ...) {} - - - -} // namespace detail - -}} // namespace boost::python - -#endif // WRAPPER_BASE_DWA2004722_HPP diff --git a/include/boost/python/dict.hpp b/include/boost/python/dict.hpp deleted file mode 100644 index 6fcaf143..00000000 --- a/include/boost/python/dict.hpp +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 DICT_20020706_HPP -#define DICT_20020706_HPP - -# include - -#include -#include -#include -#include - -namespace boost { namespace python { - -class dict; - -namespace detail -{ - struct BOOST_PYTHON_DECL dict_base : object - { - // D.clear() -> None. Remove all items from D. - void clear(); - - // D.copy() -> a shallow copy of D - dict copy(); - - // D.get(k[,d]) -> D[k] if D.has_key(k), else d. d defaults to None. - object get(object_cref k) const; - - object get(object_cref k, object_cref d) const; - - // D.has_key(k) -> 1 if D has a key k, else 0 - bool has_key(object_cref k) const; - - // D.items() -> list of D's (key, value) pairs, as 2-tuples - list items() const; - - // D.iteritems() -> an iterator over the (key, value) items of D - object iteritems() const; - - // D.iterkeys() -> an iterator over the keys of D - object iterkeys() const; - - // D.itervalues() -> an iterator over the values of D - object itervalues() const; - - // D.keys() -> list of D's keys - list keys() const; - - // D.popitem() -> (k, v), remove and return some (key, value) pair as a - // 2-tuple; but raise KeyError if D is empty - tuple popitem(); - - // D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if not D.has_key(k) - object setdefault(object_cref k); - - object setdefault(object_cref k, object_cref d); - - // D.update(E) -> None. Update D from E: for k in E.keys(): D[k] = E[k] - void update(object_cref E); - - // D.values() -> list of D's values - list values() const; - - protected: - // dict() -> new empty dictionary. - // dict(mapping) -> new dictionary initialized from a mapping object's - // (key, value) pairs. - // dict(seq) -> new dictionary initialized as if via: - dict_base(); // new dict - explicit dict_base(object_cref data); - - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(dict_base, object) - private: - static detail::new_reference call(object const&); - }; -} - -class dict : public detail::dict_base -{ - typedef detail::dict_base base; - public: - // dict() -> new empty dictionary. - // dict(mapping) -> new dictionary initialized from a mapping object's - // (key, value) pairs. - // dict(seq) -> new dictionary initialized as if via: - dict() {} // new dict - - template - explicit dict(T const& data) - : base(object(data)) - { - } - - template - object get(T const& k) const - { - return base::get(object(k)); - } - - template - object get(T1 const& k, T2 const& d) const - { - return base::get(object(k),object(d)); - } - - template - bool has_key(T const& k) const - { - return base::has_key(object(k)); - } - - template - object setdefault(T const& k) - { - return base::setdefault(object(k)); - } - - template - object setdefault(T1 const& k, T2 const& d) - { - return base::setdefault(object(k),object(d)); - } - - template - void update(T const& E) - { - base::update(object(E)); - } - - public: // implementation detail -- for internal use only - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(dict, base) -}; - -// -// Converter Specializations -// -namespace converter -{ - template <> - struct object_manager_traits - : pytype_object_manager_traits<&PyDict_Type,dict> - { - }; -} - -}} // namespace boost::python - -#endif - diff --git a/include/boost/python/enum.hpp b/include/boost/python/enum.hpp deleted file mode 100644 index 24b616a4..00000000 --- a/include/boost/python/enum.hpp +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 ENUM_DWA200298_HPP -# define ENUM_DWA200298_HPP - -# include - -# include -# include -# include - -namespace boost { namespace python { - -template -struct enum_ : public objects::enum_base -{ - typedef objects::enum_base base; - - // Declare a new enumeration type in the current scope() - enum_(char const* name); - - // Add a new enumeration value with the given name and value. - inline enum_& value(char const* name, T); - - // Add all of the defined enumeration values to the current scope with the - // same names used here. - inline enum_& export_values(); - private: - static PyObject* to_python(void const* x); - static void* convertible_from_python(PyObject* obj); - static void construct(PyObject* obj, converter::rvalue_from_python_stage1_data* data); -}; - -template -inline enum_::enum_(char const* name) - : base( - name - , &enum_::to_python - , &enum_::convertible_from_python - , &enum_::construct - , type_id()) -{ -} - -// This is the conversion function that gets registered for converting -// these enums to Python. -template -PyObject* enum_::to_python(void const* x) -{ - return base::to_python( - converter::registered::converters.m_class_object - , static_cast(*(T const*)x)); -} - -// -// The following two static functions serve as the elements of an -// rvalue from_python converter for the enumeration type. -// - -// This checks that a given Python object can be converted to the -// enumeration type. -template -void* enum_::convertible_from_python(PyObject* obj) -{ - return PyObject_IsInstance( - obj - , upcast( - converter::registered::converters.m_class_object)) - - ? obj : 0; -} - -// Constructs an instance of the enumeration type in the from_python -// data. -template -void enum_::construct(PyObject* obj, converter::rvalue_from_python_stage1_data* data) -{ - T x = static_cast(PyInt_AS_LONG(obj)); - void* const storage = ((converter::rvalue_from_python_storage*)data)->storage.bytes; - new (storage) T(x); - data->convertible = storage; -} - -template -inline enum_& enum_::value(char const* name, T x) -{ - this->add_value(name, static_cast(x)); - return *this; -} - -template -inline enum_& enum_::export_values() -{ - this->base::export_values(); - return *this; -} - -}} // namespace boost::python - -#endif // ENUM_DWA200298_HPP diff --git a/include/boost/python/errors.hpp b/include/boost/python/errors.hpp deleted file mode 100644 index 72960d9e..00000000 --- a/include/boost/python/errors.hpp +++ /dev/null @@ -1,55 +0,0 @@ -// (C) Copyright David Abrahams 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) -// -// The author gratefully acknowleges the support of Dragon Systems, Inc., in -// producing this work. - -#ifndef ERRORS_DWA052500_H_ -# define ERRORS_DWA052500_H_ - -# include -# include - -namespace boost { namespace python { - -struct BOOST_PYTHON_DECL_EXCEPTION error_already_set -{ - virtual ~error_already_set(); -}; - -// Handles exceptions caught just before returning to Python code. -// Returns true iff an exception was caught. -BOOST_PYTHON_DECL bool handle_exception_impl(function0); - -template -bool handle_exception(T f) -{ - return handle_exception_impl(function0(boost::ref(f))); -} - -namespace detail { inline void rethrow() { throw; } } - -inline void handle_exception() -{ - handle_exception(detail::rethrow); -} - -BOOST_PYTHON_DECL void throw_error_already_set(); - -template -inline T* expect_non_null(T* x) -{ - if (x == 0) - throw_error_already_set(); - return x; -} - -// Return source if it is an instance of pytype; throw an appropriate -// exception otherwise. -BOOST_PYTHON_DECL PyObject* pytype_check(PyTypeObject* pytype, PyObject* source); - -}} // namespace boost::python - -#endif // ERRORS_DWA052500_H_ diff --git a/include/boost/python/exception_translator.hpp b/include/boost/python/exception_translator.hpp deleted file mode 100644 index 60760dce..00000000 --- a/include/boost/python/exception_translator.hpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 EXCEPTION_TRANSLATOR_DWA2002810_HPP -# define EXCEPTION_TRANSLATOR_DWA2002810_HPP - -# include - -# include -# include -# include -# include - -namespace boost { namespace python { - -template -void register_exception_translator(Translate translate, boost::type* = 0) -{ - detail::register_exception_handler( - bind(detail::translate_exception(), _1, _2, translate) - ); -} - -}} // namespace boost::python - -#endif // EXCEPTION_TRANSLATOR_DWA2002810_HPP diff --git a/include/boost/python/extract.hpp b/include/boost/python/extract.hpp deleted file mode 100644 index f2269b1d..00000000 --- a/include/boost/python/extract.hpp +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 EXTRACT_DWA200265_HPP -# define EXTRACT_DWA200265_HPP - -# include - -# include -# include -# include -# include -# include - -# include -# include - -# include -# include -# include -# include -# include - -namespace boost { namespace python { - -namespace api -{ - class object; -} - -namespace converter -{ - template - struct extract_pointer - { - typedef Ptr result_type; - extract_pointer(PyObject*); - - bool check() const; - Ptr operator()() const; - - private: - PyObject* m_source; - void* m_result; - }; - - template - struct extract_reference - { - typedef Ref result_type; - extract_reference(PyObject*); - - bool check() const; - Ref operator()() const; - - private: - PyObject* m_source; - void* m_result; - }; - - template - struct extract_rvalue : private noncopyable - { - typedef typename mpl::if_< - python::detail::copy_ctor_mutates_rhs - , T& - , typename call_traits::param_type - >::type result_type; - - extract_rvalue(PyObject*); - - bool check() const; - result_type operator()() const; - private: - PyObject* m_source; - mutable rvalue_from_python_data m_data; - }; - - template - struct extract_object_manager - { - typedef T result_type; - extract_object_manager(PyObject*); - - bool check() const; - result_type operator()() const; - private: - PyObject* m_source; - }; - - template - struct select_extract - { - BOOST_STATIC_CONSTANT( - bool, obj_mgr = is_object_manager::value); - - BOOST_STATIC_CONSTANT( - bool, ptr = is_pointer::value); - - BOOST_STATIC_CONSTANT( - bool, ref = is_reference::value); - - typedef typename mpl::if_c< - obj_mgr - , extract_object_manager - , typename mpl::if_c< - ptr - , extract_pointer - , typename mpl::if_c< - ref - , extract_reference - , extract_rvalue - >::type - >::type - >::type type; - }; -} - -template -struct extract - : converter::select_extract::type -{ - private: - typedef typename converter::select_extract::type base; - public: - typedef typename base::result_type result_type; - - operator result_type() const - { - return (*this)(); - } - - extract(PyObject*); - extract(api::object const&); -}; - -// -// Implementations -// -template -inline extract::extract(PyObject* o) - : base(o) -{ -} - -template -inline extract::extract(api::object const& o) - : base(o.ptr()) -{ -} - -namespace converter -{ - template - inline extract_rvalue::extract_rvalue(PyObject* x) - : m_source(x) - , m_data( - (rvalue_from_python_stage1)(x, registered::converters) - ) - { - } - - template - inline bool - extract_rvalue::check() const - { - return m_data.stage1.convertible; - } - - template - inline typename extract_rvalue::result_type - extract_rvalue::operator()() const - { - return *(T*)( - // Only do the stage2 conversion once - m_data.stage1.convertible == m_data.storage.bytes - ? m_data.storage.bytes - : (rvalue_from_python_stage2)(m_source, m_data.stage1, registered::converters) - ); - } - - template - inline extract_reference::extract_reference(PyObject* obj) - : m_source(obj) - , m_result( - (get_lvalue_from_python)(obj, registered::converters) - ) - { - } - - template - inline bool extract_reference::check() const - { - return m_result != 0; - } - - template - inline Ref extract_reference::operator()() const - { - if (m_result == 0) - (throw_no_reference_from_python)(m_source, registered::converters); - - return python::detail::void_ptr_to_reference(m_result, (Ref(*)())0); - } - - template - inline extract_pointer::extract_pointer(PyObject* obj) - : m_source(obj) - , m_result( - obj == Py_None ? 0 : (get_lvalue_from_python)(obj, registered_pointee::converters) - ) - { - } - - template - inline bool extract_pointer::check() const - { - return m_source == Py_None || m_result != 0; - } - - template - inline Ptr extract_pointer::operator()() const - { - if (m_result == 0 && m_source != Py_None) - (throw_no_pointer_from_python)(m_source, registered_pointee::converters); - - return Ptr(m_result); - } - - template - inline extract_object_manager::extract_object_manager(PyObject* obj) - : m_source(obj) - { - } - - template - inline bool extract_object_manager::check() const - { - return object_manager_traits::check(m_source); - } - - template - inline T extract_object_manager::operator()() const - { - return T( - object_manager_traits::adopt(python::incref(m_source)) - ); - } -} - -}} // namespace boost::python::converter - -#endif // EXTRACT_DWA200265_HPP diff --git a/include/boost/python/handle.hpp b/include/boost/python/handle.hpp deleted file mode 100755 index b61b9ddd..00000000 --- a/include/boost/python/handle.hpp +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 HANDLE_DWA200269_HPP -# define HANDLE_DWA200269_HPP - -# include - -# include -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { - -template struct null_ok; - -template -inline null_ok* allow_null(T* p) -{ - return (null_ok*)p; -} - -namespace detail -{ - template - inline T* manage_ptr(detail::borrowed >* p, int) - { - return python::xincref((T*)p); - } - - template - inline T* manage_ptr(null_ok >* p, int) - { - return python::xincref((T*)p); - } - - template - inline T* manage_ptr(detail::borrowed* p, long) - { - return python::incref(expect_non_null((T*)p)); - } - - template - inline T* manage_ptr(null_ok* p, long) - { - return (T*)p; - } - - template - inline T* manage_ptr(T* p, ...) - { - return expect_non_null(p); - } -} - -template -class handle -{ - typedef T* (handle::* bool_type )() const; - - public: // types - typedef T element_type; - - public: // member functions - handle(); - ~handle(); - - template - explicit handle(Y* p) - : m_p( - python::upcast( - detail::manage_ptr(p, 0) - ) - ) - { - } - - handle& operator=(handle const& r) - { - python::xdecref(m_p); - m_p = python::xincref(r.m_p); - return *this; - } - -#if !defined(BOOST_MSVC) || (BOOST_MSVC > 1200) - - template - handle& operator=(handle const & r) // never throws - { - python::xdecref(m_p); - m_p = python::xincref(python::upcast(r.get())); - return *this; - } - -#endif - - template - handle(handle const& r) - : m_p(python::xincref(python::upcast(r.get()))) - { - } - - handle(handle const& r) - : m_p(python::xincref(r.m_p)) - { - } - - T* operator-> () const; - T& operator* () const; - T* get() const; - T* release(); - void reset(); - - operator bool_type() const // never throws - { - return m_p ? &handle::get : 0; - } - bool operator! () const; // never throws - - public: // implementation details -- do not touch - // Defining this in the class body suppresses a VC7 link failure - inline handle(detail::borrowed_reference x) - : m_p( - python::incref( - downcast((PyObject*)x) - )) - { - } - - private: // data members - T* m_p; -}; - -#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP -} // namespace python -#endif - -template inline T * get_pointer(python::handle const & p) -{ - return p.get(); -} - -#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP -namespace python { -#else - -// We don't want get_pointer above to hide the others -using boost::get_pointer; - -#endif - -typedef handle type_handle; - -// -// Compile-time introspection -// -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template -class is_handle -{ - public: - BOOST_STATIC_CONSTANT(bool, value = false); -}; - -template -class is_handle > -{ - public: - BOOST_STATIC_CONSTANT(bool, value = true); -}; -# else -namespace detail -{ - typedef char (&yes_handle_t)[1]; - typedef char (&no_handle_t)[2]; - - no_handle_t is_handle_test(...); - - template - yes_handle_t is_handle_test(boost::type< handle >); -} - -template -class is_handle -{ - public: - BOOST_STATIC_CONSTANT( - bool, value = ( - sizeof(detail::is_handle_test(boost::type())) - == sizeof(detail::yes_handle_t))); -}; -# endif - -// -// implementations -// -template -inline handle::handle() - : m_p(0) -{ -} - -template -inline handle::~handle() -{ - python::xdecref(m_p); -} - -template -inline T* handle::operator->() const -{ - return m_p; -} - -template -inline T& handle::operator*() const -{ - return *m_p; -} - -template -inline T* handle::get() const -{ - return m_p; -} - -template -inline bool handle::operator!() const -{ - return m_p == 0; -} - -template -inline T* handle::release() -{ - T* result = m_p; - m_p = 0; - return result; -} - -template -inline void handle::reset() -{ - python::xdecref(m_p); - m_p = 0; -} - -// Because get_managed_object must return a non-null PyObject*, we -// return Py_None if the handle is null. -template -inline PyObject* get_managed_object(handle const& h, tag_t) -{ - return h.get() ? python::upcast(h.get()) : Py_None; -} - -}} // namespace boost::python - - -#endif // HANDLE_DWA200269_HPP diff --git a/include/boost/python/handle_fwd.hpp b/include/boost/python/handle_fwd.hpp deleted file mode 100755 index 5987ec4f..00000000 --- a/include/boost/python/handle_fwd.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 HANDLE_FWD_DWA2002615_HPP -# define HANDLE_FWD_DWA2002615_HPP - -# include - -namespace boost { namespace python { - -template class handle; - -}} // namespace boost::python - -#endif // HANDLE_FWD_DWA2002615_HPP diff --git a/include/boost/python/has_back_reference.hpp b/include/boost/python/has_back_reference.hpp deleted file mode 100644 index 67fe24c5..00000000 --- a/include/boost/python/has_back_reference.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 HAS_BACK_REFERENCE_DWA2002323_HPP -# define HAS_BACK_REFERENCE_DWA2002323_HPP - -# include -# include - -namespace boost { namespace python { - -// traits class which users can specialize to indicate that a class -// contains a back-reference to its owning PyObject* -template -struct has_back_reference - : mpl::false_ -{ -}; - - -}} // namespace boost::python - -#endif // HAS_BACK_REFERENCE_DWA2002323_HPP diff --git a/include/boost/python/implicit.hpp b/include/boost/python/implicit.hpp deleted file mode 100644 index 14a69700..00000000 --- a/include/boost/python/implicit.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef IMPLICIT_DWA2002325_HPP -# define IMPLICIT_DWA2002325_HPP - -# include -# include -# include -# include -# include - -namespace boost { namespace python { - -template -void implicitly_convertible(boost::type* = 0, boost::type* = 0) -{ - typedef converter::implicit functions; - - converter::registry::push_back( - &functions::convertible - , &functions::construct - , type_id()); -} - -}} // namespace boost::python - -#endif // IMPLICIT_DWA2002325_HPP diff --git a/include/boost/python/init.hpp b/include/boost/python/init.hpp deleted file mode 100644 index ce52531c..00000000 --- a/include/boost/python/init.hpp +++ /dev/null @@ -1,421 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright David Abrahams 2002, Joel de Guzman, 2002. -// 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 INIT_JDG20020820_HPP -#define INIT_JDG20020820_HPP - -# include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include - -/////////////////////////////////////////////////////////////////////////////// -#define BOOST_PYTHON_OVERLOAD_TYPES_WITH_DEFAULT \ - BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( \ - BOOST_PYTHON_MAX_ARITY, \ - class T, \ - mpl::void_) \ - -#define BOOST_PYTHON_OVERLOAD_TYPES \ - BOOST_PP_ENUM_PARAMS_Z(1, \ - BOOST_PYTHON_MAX_ARITY, \ - class T) \ - -#define BOOST_PYTHON_OVERLOAD_ARGS \ - BOOST_PP_ENUM_PARAMS_Z(1, \ - BOOST_PYTHON_MAX_ARITY, \ - T) \ - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace python { - -template -class init; // forward declaration - - -template -struct optional; // forward declaration - -namespace detail -{ - namespace error - { - template - struct more_keywords_than_init_arguments - { - typedef char too_many_keywords[init_args - keywords >= 0 ? 1 : -1]; - }; - } - - // is_optional::value - // - // This metaprogram checks if T is an optional - // -#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - - template - struct is_optional { - - private: - - template - static boost::type_traits::yes_type f(optional); - static boost::type_traits::no_type f(...); - static T t(); - - public: - - BOOST_STATIC_CONSTANT( - bool, value = - sizeof(f(t())) == sizeof(::boost::type_traits::yes_type)); - typedef mpl::bool_ type; - }; - -#else - - template - struct is_optional - : mpl::false_ - {}; - - template - struct is_optional > - : mpl::true_ - {}; - -#endif - - template - struct define_class_init_helper; - -} // namespace detail - -template -struct init_base : def_visitor -{ - init_base(char const* doc_, detail::keyword_range const& keywords_) - : m_doc(doc_), m_keywords(keywords_) - {} - - init_base(char const* doc_) - : m_doc(doc_) - {} - - DerivedT const& derived() const - { - return *static_cast(this); - } - - char const* doc_string() const - { - return m_doc; - } - - detail::keyword_range const& keywords() const - { - return m_keywords; - } - - static default_call_policies call_policies() - { - return default_call_policies(); - } - - private: - // visit - // - // Defines a set of n_defaults + 1 constructors for its - // class_<...> argument. Each constructor after the first has - // one less argument to its right. Example: - // - // init > - // - // Defines: - // - // __init__(int, char, long, double) - // __init__(int, char, long) - // __init__(int, char) - // __init__(int) - template - void visit(classT& cl) const - { - typedef typename DerivedT::signature signature; - typedef typename DerivedT::n_arguments n_arguments; - typedef typename DerivedT::n_defaults n_defaults; - - detail::define_class_init_helper::apply( - cl - , derived().call_policies() - , signature() - , n_arguments() - , derived().doc_string() - , derived().keywords()); - } - - friend class python::def_visitor_access; - - private: // data members - char const* m_doc; - detail::keyword_range m_keywords; -}; - -template -class init_with_call_policies - : public init_base > -{ - typedef init_base > base; - public: - typedef typename InitT::n_arguments n_arguments; - typedef typename InitT::n_defaults n_defaults; - typedef typename InitT::signature signature; - - init_with_call_policies( - CallPoliciesT const& policies_ - , char const* doc_ - , detail::keyword_range const& keywords - ) - : base(doc_, keywords) - , m_policies(policies_) - {} - - CallPoliciesT const& call_policies() const - { - return this->m_policies; - } - - private: // data members - CallPoliciesT m_policies; -}; - -// -// drop1 is the initial length(S) elements of S -// -namespace detail -{ - template - struct drop1 - : mpl::iterator_range< - typename mpl::begin::type - , typename mpl::prior< - typename mpl::end::type - >::type - > - {}; -} - -template -class init : public init_base > -{ - typedef init_base > base; - public: - typedef init self_t; - - init(char const* doc_ = 0) - : base(doc_) - { - } - - template - init(char const* doc_, detail::keywords const& kw) - : base(doc_, kw.range()) - { - typedef typename detail::error::more_keywords_than_init_arguments< - N, n_arguments::value - >::too_many_keywords assertion; - } - - template - init(detail::keywords const& kw, char const* doc_ = 0) - : base(doc_, kw.range()) - { - typedef typename detail::error::more_keywords_than_init_arguments< - N, n_arguments::value - >::too_many_keywords assertion; - } - - template - init_with_call_policies - operator[](CallPoliciesT const& policies) const - { - return init_with_call_policies( - policies, this->doc_string(), this->keywords()); - } - - typedef detail::type_list signature_; - - typedef detail::is_optional< - typename mpl::eval_if< - mpl::empty - , mpl::false_ - , mpl::back - >::type - > back_is_optional; - - typedef typename mpl::eval_if< - back_is_optional - , mpl::back - , mpl::vector0<> - >::type optional_args; - - typedef typename mpl::eval_if< - back_is_optional - , mpl::if_< - mpl::empty - , detail::drop1 - , mpl::joint_view< - detail::drop1 - , optional_args - > - > - , signature_ - >::type signature; - - // TODO: static assert to make sure there are no other optional elements - - // Count the number of default args - typedef mpl::size n_defaults; - typedef mpl::size n_arguments; -}; - -/////////////////////////////////////////////////////////////////////////////// -// -// optional -// -// optional::type returns a typelist. -// -/////////////////////////////////////////////////////////////////////////////// -template -struct optional - : detail::type_list -{ -}; - -namespace detail -{ - template - inline void def_init_aux( - ClassT& cl - , Signature const& - , NArgs - , CallPoliciesT const& policies - , char const* doc - , detail::keyword_range const& keywords_ - ) - { - cl.def( - "__init__" - , detail::make_keyword_range_constructor( - policies - , keywords_ - , (typename ClassT::metadata::holder*)0 - ) - , doc - ); - } - - /////////////////////////////////////////////////////////////////////////////// - // - // define_class_init_helper::apply - // - // General case - // - // Accepts a class_ and an arguments list. Defines a constructor - // for the class given the arguments and recursively calls - // define_class_init_helper::apply with one fewer argument (the - // rightmost argument is shaved off) - // - /////////////////////////////////////////////////////////////////////////////// - template - struct define_class_init_helper - { - - template - static void apply( - ClassT& cl - , CallPoliciesT const& policies - , Signature const& args - , NArgs - , char const* doc - , detail::keyword_range keywords) - { - detail::def_init_aux(cl, args, NArgs(), policies, doc, keywords); - - if (keywords.second > keywords.first) - --keywords.second; - - typedef typename mpl::prior::type next_nargs; - define_class_init_helper::apply( - cl, policies, Signature(), next_nargs(), doc, keywords); - } - }; - - /////////////////////////////////////////////////////////////////////////////// - // - // define_class_init_helper<0>::apply - // - // Terminal case - // - // Accepts a class_ and an arguments list. Defines a constructor - // for the class given the arguments. - // - /////////////////////////////////////////////////////////////////////////////// - template <> - struct define_class_init_helper<0> { - - template - static void apply( - ClassT& cl - , CallPoliciesT const& policies - , Signature const& args - , NArgs - , char const* doc - , detail::keyword_range const& keywords) - { - detail::def_init_aux(cl, args, NArgs(), policies, doc, keywords); - } - }; -} - -}} // namespace boost::python - -#undef BOOST_PYTHON_OVERLOAD_TYPES_WITH_DEFAULT -#undef BOOST_PYTHON_OVERLOAD_TYPES -#undef BOOST_PYTHON_OVERLOAD_ARGS -#undef BOOST_PYTHON_IS_OPTIONAL_VALUE -#undef BOOST_PYTHON_APPEND_TO_INIT - -/////////////////////////////////////////////////////////////////////////////// -#endif // INIT_JDG20020820_HPP - - - - - - - - diff --git a/include/boost/python/instance_holder.hpp b/include/boost/python/instance_holder.hpp deleted file mode 100755 index b8cabb92..00000000 --- a/include/boost/python/instance_holder.hpp +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 INSTANCE_HOLDER_DWA2002517_HPP -# define INSTANCE_HOLDER_DWA2002517_HPP - -# include - -# include -# include -# include - -namespace boost { namespace python { - -// Base class for all holders -struct BOOST_PYTHON_DECL instance_holder : private noncopyable -{ - public: - instance_holder(); - virtual ~instance_holder(); - - // return the next holder in a chain - instance_holder* next() const; - - virtual void* holds(type_info) = 0; - - void install(PyObject* inst) throw(); - - // These functions should probably be located elsewhere. - - // Allocate storage for an object of the given size at the given - // offset in the Python instance<> object if bytes are available - // there. Otherwise allocate size bytes of heap memory. - static void* allocate(PyObject*, std::size_t offset, std::size_t size); - - // Deallocate storage from the heap if it was not carved out of - // the given Python object by allocate(), above. - static void deallocate(PyObject*, void* storage) throw(); - private: - instance_holder* m_next; -}; - -// This macro is needed for implementation of derived holders -# define BOOST_PYTHON_UNFORWARD(N,ignored) (typename unforward::type)(a##N) - -// -// implementation -// -inline instance_holder* instance_holder::next() const -{ - return m_next; -} - -}} // namespace boost::python - -#endif // INSTANCE_HOLDER_DWA2002517_HPP diff --git a/include/boost/python/iterator.hpp b/include/boost/python/iterator.hpp deleted file mode 100644 index 146dcbfe..00000000 --- a/include/boost/python/iterator.hpp +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 ITERATOR_DWA2002512_HPP -# define ITERATOR_DWA2002512_HPP - -# include - -# include -# include -# include - -# include -# include - -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - // Adds an additional layer of binding to - // objects::make_iterator(...), which allows us to pass member - // function and member data pointers. - template - inline object make_iterator( - Accessor1 get_start - , Accessor2 get_finish - , NextPolicies next_policies - , Target&(*)() - ) - { - return objects::make_iterator_function( - boost::protect(boost::bind(get_start, _1)) - , boost::protect(boost::bind(get_finish, _1)) - , next_policies - ); - } - - // Guts of template class iterators<>, below. - template - struct iterators_impl - { - template - struct apply - { - typedef typename T::iterator iterator; - static iterator begin(T& x) { return x.begin(); } - static iterator end(T& x) { return x.end(); } - }; - }; - - template <> - struct iterators_impl - { - template - struct apply - { - typedef typename T::const_iterator iterator; - static iterator begin(T& x) { return x.begin(); } - static iterator end(T& x) { return x.end(); } - }; - }; -} - -// An "ordinary function generator" which contains static begin(x) and -// end(x) functions that invoke T::begin() and T::end(), respectively. -template -struct iterators - : detail::iterators_impl< - boost::is_const::value - >::template apply -{ -}; - -// Create an iterator-building function which uses the given -// accessors. Deduce the Target type from the accessors. The iterator -// returns copies of the inderlying elements. -template -object range(Accessor1 start, Accessor2 finish) -{ - return detail::make_iterator( - start, finish - , objects::default_iterator_call_policies() - , detail::target(start) - ); -} - -// Create an iterator-building function which uses the given accessors -// and next() policies. Deduce the Target type. -template -object range(Accessor1 start, Accessor2 finish, NextPolicies* = 0) -{ - return detail::make_iterator(start, finish, NextPolicies(), detail::target(start)); -} - -// Create an iterator-building function which uses the given accessors -// and next() policies, operating on the given Target type -template -object range(Accessor1 start, Accessor2 finish, NextPolicies* = 0, boost::type* = 0) -{ - // typedef typename add_reference::type target; - return detail::make_iterator(start, finish, NextPolicies(), (Target&(*)())0); -} - -// A Python callable object which produces an iterator traversing -// [x.begin(), x.end()), where x is an instance of the Container -// type. NextPolicies are used as the CallPolicies for the iterator's -// next() function. -template -struct iterator : object -{ - iterator() - : object( - python::range( - &iterators::begin, &iterators::end - )) - { - } -}; - -}} // namespace boost::python - -#endif // ITERATOR_DWA2002512_HPP diff --git a/include/boost/python/list.hpp b/include/boost/python/list.hpp deleted file mode 100644 index 793cd08a..00000000 --- a/include/boost/python/list.hpp +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 LIST_DWA2002627_HPP -# define LIST_DWA2002627_HPP - -# include - -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - struct BOOST_PYTHON_DECL list_base : object - { - void append(object_cref); // append object to end - - long count(object_cref value) const; // return number of occurrences of value - - void extend(object_cref sequence); // extend list by appending sequence elements - - long index(object_cref value) const; // return index of first occurrence of value - - void insert(int index, object_cref); // insert object before index - void insert(object const& index, object_cref); - - object pop(); // remove and return item at index (default last) - object pop(long index); - object pop(object const& index); - - void remove(object_cref value); // remove first occurrence of value - - void reverse(); // reverse *IN PLACE* - - void sort(); // sort *IN PLACE*; if given, cmpfunc(x, y) -> -1, 0, 1 - void sort(object_cref cmpfunc); - - - protected: - list_base(); // new list - explicit list_base(object_cref sequence); // new list initialized from sequence's items - - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(list_base, object) - private: - static detail::new_non_null_reference call(object const&); - }; -} - -class list : public detail::list_base -{ - typedef detail::list_base base; - public: - list() {} // new list - - template - explicit list(T const& sequence) - : base(object(sequence)) - { - } - - template - void append(T const& x) - { - base::append(object(x)); - } - - template - long count(T const& value) const - { - return base::count(object(value)); - } - - template - void extend(T const& x) - { - base::extend(object(x)); - } - - template - long index(T const& x) const - { - return base::index(object(x)); - } - - template - void insert(int index, T const& x) // insert object before index - { - base::insert(index, object(x)); - } - - template - void insert(object const& index, T const& x) // insert object before index - { - base::insert(index, object(x)); - } - - object pop() { return base::pop(); } - object pop(long index) { return base::pop(index); } - - template - object pop(T const& index) - { - return base::pop(object(index)); - } - - template - void remove(T const& value) - { - base::remove(object(value)); - } - - void sort() { base::sort(); } - - template - void sort(T const& value) - { - base::sort(object(value)); - } - - public: // implementation detail -- for internal use only - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(list, base) -}; - -// -// Converter Specializations -// -namespace converter -{ - template <> - struct object_manager_traits - : pytype_object_manager_traits<&PyList_Type,list> - { - }; -} - -}} // namespace boost::python - -#endif // LIST_DWA2002627_HPP diff --git a/include/boost/python/long.hpp b/include/boost/python/long.hpp deleted file mode 100644 index 129c61f9..00000000 --- a/include/boost/python/long.hpp +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 LONG_DWA2002627_HPP -# define LONG_DWA2002627_HPP - -# include - -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - struct BOOST_PYTHON_DECL long_base : object - { - protected: - long_base(); // new long_ - explicit long_base(object_cref rhs); - explicit long_base(object_cref rhs, object_cref base); - - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(long_base, object) - - private: - static detail::new_non_null_reference call(object const&); - static detail::new_non_null_reference call(object const&, object const&); - }; -} - -class long_ : public detail::long_base -{ - typedef detail::long_base base; - public: - long_() {} // new long_ - - template - explicit long_(T const& rhs) - : detail::long_base(object(rhs)) - { - } - - template - explicit long_(T const& rhs, U const& base) - : detail::long_base(object(rhs), object(base)) - { - } - - public: // implementation detail -- for internal use only - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(long_, base) -}; - -// -// Converter Specializations -// -namespace converter -{ - template <> - struct object_manager_traits - : pytype_object_manager_traits<&PyLong_Type,long_> - { - }; -} - -}} // namespace boost::python - -#endif // LONG_DWA2002627_HPP diff --git a/include/boost/python/lvalue_from_pytype.hpp b/include/boost/python/lvalue_from_pytype.hpp deleted file mode 100755 index 51660050..00000000 --- a/include/boost/python/lvalue_from_pytype.hpp +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 LVALUE_FROM_PYTYPE_DWA2002130_HPP -# define LVALUE_FROM_PYTYPE_DWA2002130_HPP - -# include - -# include -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - // Given a pointer-to-function of 1 parameter returning a reference - // type, return the type_id of the function's return type. - template - inline type_info extractor_type_id(T&(*)(U)) - { - return type_id(); - } - - // A function generator whose static execute() function is an lvalue - // from_python converter using the given Extractor. U is expected to - // be the actual type of the PyObject instance from which the result - // is being extracted. - template - struct normalized_extractor - { - static inline void* execute(PyObject* op) - { - typedef typename boost::add_reference::type param; - return &Extractor::execute( - boost::python::detail::void_ptr_to_reference( - op, (param(*)())0 ) - ); - } - }; - - // Given an Extractor type and a pointer to its execute function, - // return a new object whose static execute function does the same - // job but is a conforming lvalue from_python conversion function. - // - // usage: normalize(&Extractor::execute) - template - inline normalized_extractor - normalize(T(*)(U), Extractor* = 0) - { - return normalized_extractor(); - } -} - -// An Extractor which extracts the given member from a Python object -// whose instances are stored as InstanceType. -template -struct extract_member -{ - static MemberType& execute(InstanceType& c) - { - (void)c.ob_type; // static assertion - return c.*member; - } -}; - -// An Extractor which simply extracts the entire python object -// instance of InstanceType. -template -struct extract_identity -{ - static InstanceType& execute(InstanceType& c) - { - (void)c.ob_type; // static assertion - return c; - } -}; - -// Registers a from_python conversion which extracts lvalues using -// Extractor's static execute function from Python objects whose type -// object is python_type. -template -struct lvalue_from_pytype -{ - lvalue_from_pytype() - { - converter::registry::insert( - &extract, detail::extractor_type_id(&Extractor::execute)); - } - private: - static void* extract(PyObject* op) - { - return PyObject_TypeCheck(op, const_cast(python_type)) - ? const_cast( - static_cast( - detail::normalize(&Extractor::execute).execute(op))) - : 0 - ; - } -}; - -}} // namespace boost::python - -#endif // LVALUE_FROM_PYTYPE_DWA2002130_HPP diff --git a/include/boost/python/make_constructor.hpp b/include/boost/python/make_constructor.hpp deleted file mode 100755 index 598bf4f6..00000000 --- a/include/boost/python/make_constructor.hpp +++ /dev/null @@ -1,279 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef MAKE_CONSTRUCTOR_DWA20011221_HPP -# define MAKE_CONSTRUCTOR_DWA20011221_HPP - -# include - -# include -# include -# include - -# include -# include -# include -# include - -# include -# include - -# include -# include -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - template - struct install_holder : converter::context_result_converter - { - install_holder(PyObject* args_) - : m_self(PyTuple_GetItem(args_, 0)) {} - - PyObject* operator()(T x) const - { - dispatch(x, is_pointer()); - return none(); - } - - private: - template - void dispatch(U* x, mpl::true_) const - { - std::auto_ptr owner(x); - dispatch(owner, mpl::false_()); - } - - template - void dispatch(Ptr x, mpl::false_) const - { - typedef typename pointee::type value_type; - typedef objects::pointer_holder holder; - typedef objects::instance instance_t; - - void* memory = holder::allocate(this->m_self, offsetof(instance_t, storage), sizeof(holder)); - try { - (new (memory) holder(x))->install(this->m_self); - } - catch(...) { - holder::deallocate(this->m_self, memory); - throw; - } - } - - PyObject* m_self; - }; - - struct constructor_result_converter - { - template - struct apply - { - typedef install_holder type; - }; - }; - - template - struct offset_args - { - offset_args(BaseArgs base_) : base(base_) {} - BaseArgs base; - }; - - template - inline PyObject* get(mpl::int_, offset_args const& args_) - { - return get(mpl::int_<(N+Offset::value)>(), args_.base); - } - - template - inline unsigned arity(offset_args const& args_) - { - return arity(args_.base) - Offset::value; - } - - template - struct constructor_policy : BasePolicy_ - { - constructor_policy(BasePolicy_ base) : BasePolicy_(base) {} - - // If the BasePolicy_ supplied a result converter it would be - // ignored; issue an error if it's not the default. - BOOST_STATIC_ASSERT(( - is_same< - typename BasePolicy_::result_converter - , default_result_converter - >::value - )); - - typedef constructor_result_converter result_converter; - typedef offset_args > argument_package; - }; - - template - struct outer_constructor_signature - { - typedef typename mpl::pop_front::type inner_args; - typedef typename mpl::push_front::type outer_args; - typedef typename mpl::push_front::type type; - }; - - // ETI workaround - template <> - struct outer_constructor_signature - { - typedef int type; - }; - - // - // These helper functions for make_constructor (below) do the raw work - // of constructing a Python object from some invokable entity. See - // for more information about how - // the Sig arguments is used. - // - // @group make_constructor_aux { - template - object make_constructor_aux( - F f // An object that can be invoked by detail::invoke() - , CallPolicies const& p // CallPolicies to use in the invocation - , Sig const& // An MPL sequence of argument types expected by F - ) - { - typedef typename outer_constructor_signature::type outer_signature; - - typedef constructor_policy inner_policy; - - return objects::function_object( - objects::py_function( - detail::caller(f, inner_policy(p)) - , outer_signature() - ) - ); - } - - // As above, except that it accepts argument keywords. NumKeywords - // is used only for a compile-time assertion to make sure the user - // doesn't pass more keywords than the function can accept. To - // disable all checking, pass mpl::int_<0> for NumKeywords. - template - object make_constructor_aux( - F f - , CallPolicies const& p - , Sig const& - , detail::keyword_range const& kw // a [begin,end) pair of iterators over keyword names - , NumKeywords // An MPL integral type wrapper: the size of kw - ) - { - enum { arity = mpl::size::value - 1 }; - - typedef typename detail::error::more_keywords_than_function_arguments< - NumKeywords::value, arity - >::too_many_keywords assertion; - - typedef typename outer_constructor_signature::type outer_signature; - - typedef constructor_policy inner_policy; - - return objects::function_object( - objects::py_function( - detail::caller(f, inner_policy(p)) - , outer_signature() - ) - , kw - ); - } - // } - - // - // These dispatch functions are used to discriminate between the - // cases when the 3rd argument is keywords or when it is a - // signature. - // - // @group Helpers for make_constructor when called with 3 arguments. { - // - template - object make_constructor_dispatch(F f, CallPolicies const& policies, Keywords const& kw, mpl::true_) - { - return detail::make_constructor_aux( - f - , policies - , detail::get_signature(f) - , kw.range() - , mpl::int_() - ); - } - - template - object make_constructor_dispatch(F f, CallPolicies const& policies, Signature const& sig, mpl::false_) - { - return detail::make_constructor_aux( - f - , policies - , sig - ); - } - // } -} - -// These overloaded functions wrap a function or member function -// pointer as a Python object, using optional CallPolicies, -// Keywords, and/or Signature. @group { -// -template -object make_constructor(F f) -{ - return detail::make_constructor_aux( - f,default_call_policies(), detail::get_signature(f)); -} - -template -object make_constructor(F f, CallPolicies const& policies) -{ - return detail::make_constructor_aux( - f, policies, detail::get_signature(f)); -} - -template -object make_constructor( - F f - , CallPolicies const& policies - , KeywordsOrSignature const& keywords_or_signature) -{ - typedef typename - detail::is_reference_to_keywords::type - is_kw; - - return detail::make_constructor_dispatch( - f - , policies - , keywords_or_signature - , is_kw() - ); -} - -template -object make_constructor( - F f - , CallPolicies const& policies - , Keywords const& kw - , Signature const& sig - ) -{ - return detail::make_constructor_aux( - f - , policies - , sig - , kw.range() - , mpl::int_() - ); -} -// } - -}} - - -#endif // MAKE_CONSTRUCTOR_DWA20011221_HPP diff --git a/include/boost/python/make_function.hpp b/include/boost/python/make_function.hpp deleted file mode 100644 index f2f2a9e5..00000000 --- a/include/boost/python/make_function.hpp +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef MAKE_FUNCTION_DWA20011221_HPP -# define MAKE_FUNCTION_DWA20011221_HPP - -# include - -# include -# include -# include - -# include - -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - // make_function_aux -- - // - // These helper functions for make_function (below) do the raw work - // of constructing a Python object from some invokable entity. See - // for more information about how - // the Sig arguments is used. - template - object make_function_aux( - F f // An object that can be invoked by detail::invoke() - , CallPolicies const& p // CallPolicies to use in the invocation - , Sig const& // An MPL sequence of argument types expected by F - ) - { - return objects::function_object( - detail::caller(f, p) - ); - } - - // As above, except that it accepts argument keywords. NumKeywords - // is used only for a compile-time assertion to make sure the user - // doesn't pass more keywords than the function can accept. To - // disable all checking, pass mpl::int_<0> for NumKeywords. - template - object make_function_aux( - F f - , CallPolicies const& p - , Sig const& - , detail::keyword_range const& kw // a [begin,end) pair of iterators over keyword names - , NumKeywords // An MPL integral type wrapper: the size of kw - ) - { - enum { arity = mpl::size::value - 1 }; - - typedef typename detail::error::more_keywords_than_function_arguments< - NumKeywords::value, arity - >::too_many_keywords assertion; - - return objects::function_object( - detail::caller(f, p) - , kw); - } - - // Helpers for make_function when called with 3 arguments. These - // dispatch functions are used to discriminate between the cases - // when the 3rd argument is keywords or when it is a signature. - // - // @group { - template - object make_function_dispatch(F f, CallPolicies const& policies, Keywords const& kw, mpl::true_) - { - return detail::make_function_aux( - f - , policies - , detail::get_signature(f) - , kw.range() - , mpl::int_() - ); - } - - template - object make_function_dispatch(F f, CallPolicies const& policies, Signature const& sig, mpl::false_) - { - return detail::make_function_aux( - f - , policies - , sig - ); - } - // } - - } - -// These overloaded functions wrap a function or member function -// pointer as a Python object, using optional CallPolicies, -// Keywords, and/or Signature. -// -// @group { -template -object make_function(F f) -{ - return detail::make_function_aux( - f,default_call_policies(), detail::get_signature(f)); -} - -template -object make_function(F f, CallPolicies const& policies) -{ - return detail::make_function_aux( - f, policies, detail::get_signature(f)); -} - -template -object make_function( - F f - , CallPolicies const& policies - , KeywordsOrSignature const& keywords_or_signature) -{ - typedef typename - detail::is_reference_to_keywords::type - is_kw; - - return detail::make_function_dispatch( - f - , policies - , keywords_or_signature - , is_kw() - ); -} - -template -object make_function( - F f - , CallPolicies const& policies - , Keywords const& kw - , Signature const& sig - ) -{ - return detail::make_function_aux( - f - , policies - , sig - , kw.range() - , mpl::int_() - ); -} -// } - -}} - - -#endif // MAKE_FUNCTION_DWA20011221_HPP diff --git a/include/boost/python/manage_new_object.hpp b/include/boost/python/manage_new_object.hpp deleted file mode 100644 index d81421da..00000000 --- a/include/boost/python/manage_new_object.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 MANAGE_NEW_OBJECT_DWA200222_HPP -# define MANAGE_NEW_OBJECT_DWA200222_HPP - -# include -# include -# include -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - template - struct manage_new_object_requires_a_pointer_return_type -# if defined(__GNUC__) && __GNUC__ >= 3 || defined(__EDG__) - {} -# endif - ; -} - -struct manage_new_object -{ - template - struct apply - { - typedef typename mpl::if_c< - boost::is_pointer::value - , to_python_indirect - , detail::manage_new_object_requires_a_pointer_return_type - >::type type; - }; -}; - -}} // namespace boost::python - -#endif // MANAGE_NEW_OBJECT_DWA200222_HPP diff --git a/include/boost/python/module.hpp b/include/boost/python/module.hpp deleted file mode 100644 index 8ad69f5a..00000000 --- a/include/boost/python/module.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef MODULE_DWA2001128_HPP -# define MODULE_DWA2001128_HPP - -# include - -# include -# define BOOST_PYTHON_MODULE BOOST_PYTHON_MODULE_INIT - -#endif // MODULE_DWA20011221_HPP diff --git a/include/boost/python/module_init.hpp b/include/boost/python/module_init.hpp deleted file mode 100644 index 64599a38..00000000 --- a/include/boost/python/module_init.hpp +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 MODULE_INIT_DWA20020722_HPP -# define MODULE_INIT_DWA20020722_HPP - -# include - -# ifndef BOOST_PYTHON_MODULE_INIT - -namespace boost { namespace python { namespace detail { - -BOOST_PYTHON_DECL void init_module(char const* name, void(*)()); - -}}} - -# if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(BOOST_PYTHON_STATIC_MODULE) - -# define BOOST_PYTHON_MODULE_INIT(name) \ -void init_module_##name(); \ -extern "C" __declspec(dllexport) void init##name() \ -{ \ - boost::python::detail::init_module( \ - #name,&init_module_##name); \ -} \ -void init_module_##name() - -# elif defined(_AIX) && !defined(BOOST_PYTHON_STATIC_MODULE) - -# include -# define BOOST_PYTHON_MODULE_INIT(name) \ -void init_module_##name(); \ -extern "C" \ -{ \ - extern PyObject* _PyImport_LoadDynamicModule(char*, char*, FILE *); \ - void init##name() \ - { \ - boost::python::detail::aix_init_module( \ - _PyImport_LoadDynamicModule, #name, &init_module_##name); \ - } \ -} \ -void init_module_##name() - -# elif (defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >=5) - -# define BOOST_PYTHON_MODULE_INIT(name) \ -void init_module_##name(); \ -extern "C" __attribute__ ((visibility("default"))) void init##name() \ -{ \ - boost::python::detail::init_module(#name, &init_module_##name); \ -} \ -void init_module_##name() - -# else - -# define BOOST_PYTHON_MODULE_INIT(name) \ -void init_module_##name(); \ -extern "C" void init##name() \ -{ \ - boost::python::detail::init_module(#name, &init_module_##name); \ -} \ -void init_module_##name() - -# endif - -# endif - -#endif // MODULE_INIT_DWA20020722_HPP diff --git a/include/boost/python/numeric.hpp b/include/boost/python/numeric.hpp deleted file mode 100644 index 14aa7d6d..00000000 --- a/include/boost/python/numeric.hpp +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 NUMARRAY_DWA2002922_HPP -# define NUMARRAY_DWA2002922_HPP - -# include - -# include -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace numeric { - -namespace aux -{ - struct BOOST_PYTHON_DECL array_base : object - { -# define BOOST_PP_LOCAL_MACRO(n) \ - array_base(BOOST_PP_ENUM_PARAMS_Z(1, n, object const& x)); -# define BOOST_PP_LOCAL_LIMITS (1, 7) -# include BOOST_PP_LOCAL_ITERATE() - - object argmax(long axis=-1); - object argmin(long axis=-1); - object argsort(long axis=-1); - object astype(object const& type = object()); - void byteswap(); - object copy() const; - object diagonal(long offset = 0, long axis1 = 0, long axis2 = 1) const; - void info() const; - bool is_c_array() const; - bool isbyteswapped() const; - object new_(object type) const; - void sort(); - object trace(long offset = 0, long axis1 = 0, long axis2 = 1) const; - object type() const; - char typecode() const; - - object factory(object const& buffer=object() - , object const& type=object() - , object const& shape=object() - , bool copy = true - , bool savespace = false - , object typecode = object()); - - object getflat() const; - long getrank() const; - object getshape() const; - bool isaligned() const; - bool iscontiguous() const; - long itemsize() const; - long nelements() const; - object nonzero() const; - - void put(object const& indices, object const& values); - - void ravel(); - - object repeat(object const& repeats, long axis=0); - - void resize(object const& shape); - - void setflat(object const& flat); - void setshape(object const& shape); - - void swapaxes(long axis1, long axis2); - - object take(object const& sequence, long axis = 0) const; - - void tofile(object const& file) const; - - str tostring() const; - - void transpose(object const& axes = object()); - - object view() const; - - public: // implementation detail - do not touch. - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(array_base, object); - }; - - struct BOOST_PYTHON_DECL array_object_manager_traits - { - static bool check(PyObject* obj); - static detail::new_non_null_reference adopt(PyObject* obj); - }; -} // namespace aux - -class array : public aux::array_base -{ - typedef aux::array_base base; - public: - - object astype() { return base::astype(); } - - template - object astype(Type const& type_) - { - return base::astype(object(type_)); - } - - template - object new_(Type const& type_) const - { - return base::new_(object(type_)); - } - - template - void resize(Sequence const& x) - { - base::resize(object(x)); - } - -# define BOOST_PP_LOCAL_MACRO(n) \ - void resize(BOOST_PP_ENUM_PARAMS_Z(1, n, long x)) \ - { \ - resize(make_tuple(BOOST_PP_ENUM_PARAMS_Z(1, n, x))); \ - } -# define BOOST_PP_LOCAL_LIMITS (1, BOOST_PYTHON_MAX_ARITY) -# include BOOST_PP_LOCAL_ITERATE() - - template - void setshape(Sequence const& x) - { - base::setshape(object(x)); - } - -# define BOOST_PP_LOCAL_MACRO(n) \ - void setshape(BOOST_PP_ENUM_PARAMS_Z(1, n, long x)) \ - { \ - setshape(make_tuple(BOOST_PP_ENUM_PARAMS_Z(1, n, x))); \ - } -# define BOOST_PP_LOCAL_LIMITS (1, BOOST_PYTHON_MAX_ARITY) -# include BOOST_PP_LOCAL_ITERATE() - - template - void put(Indices const& indices, Values const& values) - { - base::put(object(indices), object(values)); - } - - template - object take(Sequence const& sequence, long axis = 0) - { - return base::take(object(sequence), axis); - } - - template - void tofile(File const& f) const - { - base::tofile(object(f)); - } - - object factory() - { - return base::factory(); - } - - template - object factory(Buffer const& buffer) - { - return base::factory(object(buffer)); - } - - template - object factory( - Buffer const& buffer - , Type const& type_) - { - return base::factory(object(buffer), object(type_)); - } - - template - object factory( - Buffer const& buffer - , Type const& type_ - , Shape const& shape - , bool copy = true - , bool savespace = false) - { - return base::factory(object(buffer), object(type_), object(shape), copy, savespace); - } - - template - object factory( - Buffer const& buffer - , Type const& type_ - , Shape const& shape - , bool copy - , bool savespace - , char typecode) - { - return base::factory(object(buffer), object(type_), object(shape), copy, savespace, object(typecode)); - } - -# define BOOST_PYTHON_ENUM_AS_OBJECT(z, n, x) object(BOOST_PP_CAT(x,n)) -# define BOOST_PP_LOCAL_MACRO(n) \ - template \ - explicit array(BOOST_PP_ENUM_BINARY_PARAMS_Z(1, n, T, const& x)) \ - : base(BOOST_PP_ENUM_1(n, BOOST_PYTHON_ENUM_AS_OBJECT, x)) \ - {} -# define BOOST_PP_LOCAL_LIMITS (1, 7) -# include BOOST_PP_LOCAL_ITERATE() -# undef BOOST_PYTHON_AS_OBJECT - - static BOOST_PYTHON_DECL void set_module_and_type(char const* package_name = 0, char const* type_attribute_name = 0); - - public: // implementation detail -- for internal use only - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(array, base); -}; - -} // namespace boost::python::numeric - -namespace converter -{ - template <> - struct object_manager_traits< numeric::array > - : numeric::aux::array_object_manager_traits - { - BOOST_STATIC_CONSTANT(bool, is_specialized = true); - }; -} - -}} // namespace boost::python - -#endif // NUMARRAY_DWA2002922_HPP diff --git a/include/boost/python/object.hpp b/include/boost/python/object.hpp deleted file mode 100755 index f6ee4661..00000000 --- a/include/boost/python/object.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 OBJECT_DWA2002612_HPP -# define OBJECT_DWA2002612_HPP - -# include -# include -# include -# include -# include -# include -# include - -#endif // OBJECT_DWA2002612_HPP diff --git a/include/boost/python/object/add_to_namespace.hpp b/include/boost/python/object/add_to_namespace.hpp deleted file mode 100644 index 9f4167d6..00000000 --- a/include/boost/python/object/add_to_namespace.hpp +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 ADD_TO_NAMESPACE_DWA200286_HPP -# define ADD_TO_NAMESPACE_DWA200286_HPP - -# include - -namespace boost { namespace python { namespace objects { - -// -// A setattr that's "smart" about function overloading (and docstrings). -// -BOOST_PYTHON_DECL void add_to_namespace( - object const& name_space, char const* name, object const& attribute); - -BOOST_PYTHON_DECL void add_to_namespace( - object const& name_space, char const* name, object const& attribute, char const* doc); - -}}} // namespace boost::python::objects - -#endif // ADD_TO_NAMESPACE_DWA200286_HPP diff --git a/include/boost/python/object/class.hpp b/include/boost/python/object/class.hpp deleted file mode 100644 index 1357e6fe..00000000 --- a/include/boost/python/object/class.hpp +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef CLASS_DWA20011214_HPP -# define CLASS_DWA20011214_HPP - -# include -# include -# include -# include -# include - -namespace boost { namespace python { - -namespace objects { - -struct BOOST_PYTHON_DECL class_base : python::api::object -{ - // constructor - class_base( - char const* name // The name of the class - - , std::size_t num_types // A list of class_ids. The first is the type - , type_info const*const types // this is wrapping. The rest are the types of - // any bases. - - , char const* doc = 0 // Docstring, if any. - ); - - - // Implementation detail. Hiding this in the private section would - // require use of template friend declarations. - void enable_pickling_(bool getstate_manages_dict); - - protected: - void add_property(char const* name, object const& fget); - void add_property(char const* name, object const& fget, object const& fset); - - void add_static_property(char const* name, object const& fget); - void add_static_property(char const* name, object const& fget, object const& fset); - - // Retrieve the underlying object - void setattr(char const* name, object const&); - - // Set a special attribute in the class which tells Boost.Python - // to allocate extra bytes for embedded C++ objects in Python - // instances. - void set_instance_size(std::size_t bytes); - - // Set an __init__ function which throws an appropriate exception - // for abstract classes. - void def_no_init(); - - // Effects: - // setattr(self, staticmethod(getattr(self, method_name))) - void make_method_static(const char *method_name); -}; - -}}} // namespace boost::python::objects - -#endif // CLASS_DWA20011214_HPP diff --git a/include/boost/python/object/class_detail.hpp b/include/boost/python/object/class_detail.hpp deleted file mode 100644 index a17a4f43..00000000 --- a/include/boost/python/object/class_detail.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 CLASS_DETAIL_DWA200295_HPP -# define CLASS_DETAIL_DWA200295_HPP - -# include -# include - -namespace boost { namespace python { namespace objects { - -BOOST_PYTHON_DECL type_handle registered_class_object(type_info id); -BOOST_PYTHON_DECL type_handle class_metatype(); -BOOST_PYTHON_DECL type_handle class_type(); - -}}} // namespace boost::python::object - -#endif // CLASS_DETAIL_DWA200295_HPP diff --git a/include/boost/python/object/class_metadata.hpp b/include/boost/python/object/class_metadata.hpp deleted file mode 100755 index c29787fb..00000000 --- a/include/boost/python/object/class_metadata.hpp +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef CLASS_METADATA_DWA2004719_HPP -# define CLASS_METADATA_DWA2004719_HPP -# include - -# include -# include -# include -# include -# include -# include - -# include -# include - -# include -# include - -# include -# include -# include - -# include -# include -# include -# include -# include -# include -# include -# include -# include - -# include -# include - -namespace boost { namespace python { namespace objects { - -BOOST_PYTHON_DECL -void copy_class_object(type_info const& src, type_info const& dst); - -// -// Support for registering base/derived relationships -// -template -struct register_base_of -{ - template - inline void operator()(Base*) const - { - // Register the Base class - register_dynamic_id(); - - // Register the up-cast - register_conversion(false); - - // Register the down-cast, if appropriate. - this->register_downcast((Base*)0, is_polymorphic()); - } - - private: - static inline void register_downcast(void*, mpl::false_) {} - - template - static inline void register_downcast(Base*, mpl::true_) - { - register_conversion(true); - } - -}; - -// -// Preamble of register_class. Also used for callback classes, which -// need some registration of their own. -// -template -inline void register_shared_ptr_from_python_and_casts(T*, Bases) -{ - // Constructor performs registration - python::detail::force_instantiate(converter::shared_ptr_from_python()); - - // - // register all up/downcasts here. We're using the alternate - // interface to mpl::for_each to avoid an MSVC 6 bug. - // - register_dynamic_id(); - mpl::for_each(register_base_of(), (Bases*)0, (add_pointer*)0); -} - -// -// Helper for choosing the unnamed held_type argument -// -template -struct select_held_type - : mpl::if_< - mpl::or_< - python::detail::specifies_bases - , is_same - > - , Prev - , T - > -{ -}; - -template < - class T // class being wrapped - , class X1 // = detail::not_specified - , class X2 // = detail::not_specified - , class X3 // = detail::not_specified -> -struct class_metadata -{ - // - // Calculate the unnamed template arguments - // - - // held_type_arg -- not_specified, [a class derived from] T or a - // smart pointer to [a class derived from] T. Preserving - // not_specified allows us to give class_ a back-reference. - typedef typename select_held_type< - X1 - , typename select_held_type< - X2 - , typename select_held_type< - X3 - , python::detail::not_specified - >::type - >::type - >::type held_type_arg; - - // bases - typedef typename python::detail::select_bases< - X1 - , typename python::detail::select_bases< - X2 - , typename python::detail::select_bases< - X3 - , python::bases<> - >::type - >::type - >::type bases; - - typedef mpl::or_< - is_same - , is_same - , is_same - > is_noncopyable; - - // - // Holder computation. - // - - // Compute the actual type that will be held in the Holder. - typedef typename mpl::if_< - is_same, T, held_type_arg - >::type held_type; - - // Determine if the object will be held by value - typedef is_convertible use_value_holder; - - // Compute the "wrapped type", that is, if held_type is a smart - // pointer, we're talking about the pointee. - typedef typename mpl::eval_if< - use_value_holder - , mpl::identity - , pointee - >::type wrapped; - - // Determine whether to use a "back-reference holder" - typedef mpl::or_< - has_back_reference - , is_same - , is_base_and_derived - > use_back_reference; - - // Select the holder. - typedef typename mpl::eval_if< - use_back_reference - , mpl::if_< - use_value_holder - , value_holder_back_reference - , pointer_holder_back_reference - > - , mpl::if_< - use_value_holder - , value_holder - , pointer_holder - > - >::type holder; - - inline static void register_() // Register the runtime metadata. - { - class_metadata::register_aux((T*)0); - } - - private: - template - inline static void register_aux(python::wrapper*) - { - class_metadata::register_aux2((T2*)0, mpl::true_()); - } - - inline static void register_aux(void*) - { - typedef typename is_base_and_derived::type use_callback; - class_metadata::register_aux2((T*)0, use_callback()); - } - - template - inline static void register_aux2(T2*, Callback) - { - objects::register_shared_ptr_from_python_and_casts((T2*)0, bases()); - - class_metadata::maybe_register_callback_class((T2*)0, Callback()); - - class_metadata::maybe_register_class_to_python((T2*)0, is_noncopyable()); - - class_metadata::maybe_register_pointer_to_python( - (T2*)0, (use_value_holder*)0, (use_back_reference*)0); - } - - - // - // Support for converting smart pointers to python - // - inline static void maybe_register_pointer_to_python(void*,void*,void*) {} - - template - inline static void maybe_register_pointer_to_python(T2*, mpl::false_*, mpl::false_*) - { - python::detail::force_instantiate( - objects::class_value_wrapper< - held_type - , make_ptr_instance > - >() - ); - } - // - // Support for registering to-python converters - // - inline static void maybe_register_class_to_python(void*, mpl::true_) {} - - template - inline static void maybe_register_class_to_python(T2*, mpl::false_) - { - python::detail::force_instantiate(class_cref_wrapper >()); - } - - // - // Support for registering callback classes - // - inline static void maybe_register_callback_class(void*, mpl::false_) {} - - template - inline static void maybe_register_callback_class(T2*, mpl::true_) - { - objects::register_shared_ptr_from_python_and_casts( - (wrapped*)0, mpl::single_view()); - - // explicit qualification of type_id makes msvc6 happy - objects::copy_class_object(python::type_id(), python::type_id()); - } -}; - -}}} // namespace boost::python::object - -#endif // CLASS_METADATA_DWA2004719_HPP diff --git a/include/boost/python/object/class_wrapper.hpp b/include/boost/python/object/class_wrapper.hpp deleted file mode 100644 index 5097ee5a..00000000 --- a/include/boost/python/object/class_wrapper.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef CLASS_WRAPPER_DWA20011221_HPP -# define CLASS_WRAPPER_DWA20011221_HPP - -# include -# include - -namespace boost { namespace python { namespace objects { - -// -// These two classes adapt the static execute function of a class -// MakeInstance execute() function returning a new PyObject* -// reference. The first one is used for class copy constructors, and -// the second one is used to handle smart pointers. -// - -template -struct class_cref_wrapper - : to_python_converter > -{ - static PyObject* convert(Src const& x) - { - return MakeInstance::execute(boost::ref(x)); - } -}; - -template -struct class_value_wrapper - : to_python_converter > -{ - static PyObject* convert(Src x) - { - return MakeInstance::execute(x); - } -}; - -}}} // namespace boost::python::objects - -#endif // CLASS_WRAPPER_DWA20011221_HPP diff --git a/include/boost/python/object/enum_base.hpp b/include/boost/python/object/enum_base.hpp deleted file mode 100644 index 7062ed90..00000000 --- a/include/boost/python/object/enum_base.hpp +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 ENUM_BASE_DWA200298_HPP -# define ENUM_BASE_DWA200298_HPP - -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace objects { - -struct BOOST_PYTHON_DECL enum_base : python::api::object -{ - protected: - enum_base( - char const* name - , converter::to_python_function_t - , converter::convertible_function - , converter::constructor_function - , type_info); - - void add_value(char const* name, long value); - void export_values(); - - static PyObject* to_python(PyTypeObject* type, long x); -}; - -}}} // namespace boost::python::object - -#endif // ENUM_BASE_DWA200298_HPP diff --git a/include/boost/python/object/find_instance.hpp b/include/boost/python/object/find_instance.hpp deleted file mode 100644 index 93a8e337..00000000 --- a/include/boost/python/object/find_instance.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 FIND_INSTANCE_DWA2002312_HPP -# define FIND_INSTANCE_DWA2002312_HPP - -# include - -namespace boost { namespace python { namespace objects { - -// Given a type_id, find the instance data which corresponds to it, or -// return 0 in case no such type is held. -BOOST_PYTHON_DECL void* find_instance_impl(PyObject*, type_info); - -}}} // namespace boost::python::objects - -#endif // FIND_INSTANCE_DWA2002312_HPP diff --git a/include/boost/python/object/forward.hpp b/include/boost/python/object/forward.hpp deleted file mode 100644 index c62cac9f..00000000 --- a/include/boost/python/object/forward.hpp +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef FORWARD_DWA20011215_HPP -# define FORWARD_DWA20011215_HPP - -# include -# include -# include -# include -# include -# include -# include -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) -# include -# include -# include -# else -# include -# endif - -namespace boost { namespace python { namespace objects { - -// Very much like boost::reference_wrapper, except that in this -// case T can be a reference already without causing a -// reference-to-reference error. -template -struct reference_to_value -{ - typedef typename add_reference::type>::type reference; - - reference_to_value(reference x) : m_value(x) {} - reference get() const { return m_value; } - private: - reference m_value; -}; - -// A little metaprogram which selects the type to pass through an -// intermediate forwarding function when the destination argument type -// is T. -template -struct forward - : mpl::if_< -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) - // vc6 chokes on unforwarding enums nested in classes - mpl::and_< - is_scalar - , mpl::not_< - is_enum - > - > -# else - mpl::or_, is_scalar > -# endif - , T - , reference_to_value - > -{ -}; - -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template -struct unforward -{ - typedef typename unwrap_reference::type& type; -}; - -template -struct unforward > -{ - typedef T type; -}; - -template -struct unforward_cref - : python::detail::value_arg< - typename unwrap_reference::type - > -{ -}; - -template -struct unforward_cref > - : add_reference::type> -{ -}; - -# else // no partial specialization - -namespace detail -{ - typedef char (&yes_reference_to_value_t)[1]; - typedef char (&no_reference_to_value_t)[2]; - - no_reference_to_value_t is_reference_to_value_test(...); - - template - yes_reference_to_value_t is_reference_to_value_test(boost::type< reference_to_value >); - - template - struct unforwarder - { - template - struct apply - { - typedef typename unwrap_reference::type& type; - }; - }; - - template<> - struct unforwarder - { - template - struct apply - { - typedef typename T::reference type; - }; - }; - - template - struct cref_unforwarder - { - template - struct apply - : python::detail::value_arg< - typename unwrap_reference::type - > - { - }; - }; - - template<> - struct cref_unforwarder - { - template - struct apply - : python::detail::value_arg< - typename T::reference - > - { - }; - }; - - template - struct is_reference_to_value - { - BOOST_STATIC_CONSTANT( - bool, value = ( - sizeof(is_reference_to_value_test(boost::type())) - == sizeof(yes_reference_to_value_t))); - typedef mpl::bool_ type; - }; -} - -template -struct unforward - : public detail::unforwarder< - detail::is_reference_to_value::value - >::template apply -{}; - -template -struct unforward_cref - : public detail::cref_unforwarder< - detail::is_reference_to_value::value - >::template apply -{}; - -# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -template -typename reference_to_value::reference -do_unforward(reference_to_value const& x, int) -{ - return x.get(); -} - -template -typename reference_wrapper::type& -do_unforward(reference_wrapper const& x, int) -{ - return x.get(); -} - -template -T const& do_unforward(T const& x, ...) -{ - return x; -} - -}}} // namespace boost::python::objects - -#endif // FORWARD_DWA20011215_HPP diff --git a/include/boost/python/object/function.hpp b/include/boost/python/object/function.hpp deleted file mode 100644 index f5ed51c0..00000000 --- a/include/boost/python/object/function.hpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef FUNCTION_DWA20011214_HPP -# define FUNCTION_DWA20011214_HPP - -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace objects { - -struct BOOST_PYTHON_DECL function : PyObject -{ - function( - py_function const& - , python::detail::keyword const* names_and_defaults - , unsigned num_keywords); - - ~function(); - - PyObject* call(PyObject*, PyObject*) const; - - // Add an attribute to the name_space with the given name. If it is - // a function object (this class), and an existing function is - // already there, add it as an overload. - static void add_to_namespace( - object const& name_space, char const* name, object const& attribute); - - static void add_to_namespace( - object const& name_space, char const* name, object const& attribute, char const* doc); - - object const& doc() const; - void doc(object const& x); - - object const& name() const; - - private: // helper functions - void argument_error(PyObject* args, PyObject* keywords) const; - void add_overload(handle const&); - - private: // data members - py_function m_fn; - handle m_overloads; - object m_name; - object m_namespace; - object m_doc; - object m_arg_names; - unsigned m_nkeyword_values; -}; - -// -// implementations -// -inline object const& function::doc() const -{ - return this->m_doc; -} - -inline void function::doc(object const& x) -{ - this->m_doc = x; -} - -inline object const& function::name() const -{ - return this->m_name; -} - -}}} // namespace boost::python::objects - -#endif // FUNCTION_DWA20011214_HPP diff --git a/include/boost/python/object/function_handle.hpp b/include/boost/python/object/function_handle.hpp deleted file mode 100644 index 7edaf2ce..00000000 --- a/include/boost/python/object/function_handle.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 FUNCTION_HANDLE_DWA2002725_HPP -# define FUNCTION_HANDLE_DWA2002725_HPP -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace objects { - -BOOST_PYTHON_DECL handle<> function_handle_impl(py_function const& f); - -// Just like function_object, but returns a handle<> instead. Using -// this for arg_to_python<> allows us to break a circular dependency -// between object and arg_to_python. -template -inline handle<> function_handle(F const& f, Signature) -{ - enum { n_arguments = mpl::size::value - 1 }; - - return objects::function_handle_impl( - python::detail::caller< - F,default_call_policies,Signature - >( - f, default_call_policies() - ) - ); -} - -// Just like make_function, but returns a handle<> intead. Same -// reasoning as above. -template -handle<> make_function_handle(F f) -{ - return objects::function_handle(f, python::detail::get_signature(f)); -} - -}}} // namespace boost::python::objects - -#endif // FUNCTION_HANDLE_DWA2002725_HPP diff --git a/include/boost/python/object/function_object.hpp b/include/boost/python/object/function_object.hpp deleted file mode 100644 index eaa079fb..00000000 --- a/include/boost/python/object/function_object.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 FUNCTION_OBJECT_DWA2002725_HPP -# define FUNCTION_OBJECT_DWA2002725_HPP -# include -# include -# include -# include -# include - -namespace boost { namespace python { - -namespace objects -{ - BOOST_PYTHON_DECL api::object function_object( - py_function const& f - , python::detail::keyword_range const&); - - BOOST_PYTHON_DECL api::object function_object( - py_function const& f - , python::detail::keyword_range const&); - - BOOST_PYTHON_DECL api::object function_object(py_function const& f); - - // Add an attribute to the name_space with the given name. If it is - // a Boost.Python function object - // (boost/python/object/function.hpp), and an existing function is - // already there, add it as an overload. - BOOST_PYTHON_DECL void add_to_namespace( - object const& name_space, char const* name, object const& attribute); - - BOOST_PYTHON_DECL void add_to_namespace( - object const& name_space, char const* name, object const& attribute, char const* doc); -} - -}} // namespace boost::python::objects - -#endif // FUNCTION_OBJECT_DWA2002725_HPP diff --git a/include/boost/python/object/inheritance.hpp b/include/boost/python/object/inheritance.hpp deleted file mode 100644 index b49a0442..00000000 --- a/include/boost/python/object/inheritance.hpp +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 INHERITANCE_DWA200216_HPP -# define INHERITANCE_DWA200216_HPP - -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace objects { - -typedef type_info class_id; -using python::type_id; - -// Types used to get address and id of most derived type -typedef std::pair dynamic_id_t; -typedef dynamic_id_t (*dynamic_id_function)(void*); - -BOOST_PYTHON_DECL void register_dynamic_id_aux( - class_id static_id, dynamic_id_function get_dynamic_id); - -BOOST_PYTHON_DECL void add_cast( - class_id src_t, class_id dst_t, void* (*cast)(void*), bool is_downcast); - -// -// a generator with an execute() function which, given a source type -// and a pointer to an object of that type, returns its most-derived -// /reachable/ type identifier and object pointer. -// - -// first, the case where T has virtual functions -template -struct polymorphic_id_generator -{ - static dynamic_id_t execute(void* p_) - { - T* p = static_cast(p_); - return std::make_pair(dynamic_cast(p), class_id(typeid(*p))); - } -}; - -// now, the non-polymorphic case. -template -struct non_polymorphic_id_generator -{ - static dynamic_id_t execute(void* p_) - { - return std::make_pair(p_, python::type_id()); - } -}; - -// Now the generalized selector -template -struct dynamic_id_generator - : mpl::if_< - boost::is_polymorphic - , boost::python::objects::polymorphic_id_generator - , boost::python::objects::non_polymorphic_id_generator - > -{}; - -// Register the dynamic id function for T with the type-conversion -// system. -template -void register_dynamic_id(T* = 0) -{ - typedef typename dynamic_id_generator::type generator; - register_dynamic_id_aux( - python::type_id(), &generator::execute); -} - -// -// a generator with an execute() function which, given a void* -// pointing to an object of type Source will attempt to convert it to -// an object of type Target. -// - -template -struct dynamic_cast_generator -{ - static void* execute(void* source) - { - return dynamic_cast( - static_cast(source)); - } - -}; - -template -struct implicit_cast_generator -{ - static void* execute(void* source) - { - Target* result = static_cast(source); - return result; - } -}; - -template -struct cast_generator - : mpl::if_< - is_base_and_derived - , implicit_cast_generator - , dynamic_cast_generator - > -{ -}; - -template -inline void register_conversion( - bool is_downcast = ::boost::is_base_and_derived::value - // These parameters shouldn't be used; they're an MSVC bug workaround - , Source* = 0, Target* = 0) -{ - typedef typename cast_generator::type generator; - - add_cast( - python::type_id() - , python::type_id() - , &generator::execute - , is_downcast - ); -} - -}}} // namespace boost::python::object - -#endif // INHERITANCE_DWA200216_HPP diff --git a/include/boost/python/object/inheritance_query.hpp b/include/boost/python/object/inheritance_query.hpp deleted file mode 100755 index 916e161f..00000000 --- a/include/boost/python/object/inheritance_query.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef INHERITANCE_QUERY_DWA2003520_HPP -# define INHERITANCE_QUERY_DWA2003520_HPP - -# include - -namespace boost { namespace python { namespace objects { - -BOOST_PYTHON_DECL void* find_static_type(void* p, type_info src, type_info dst); -BOOST_PYTHON_DECL void* find_dynamic_type(void* p, type_info src, type_info dst); - -}}} // namespace boost::python::object - -#endif // INHERITANCE_QUERY_DWA2003520_HPP diff --git a/include/boost/python/object/instance.hpp b/include/boost/python/object/instance.hpp deleted file mode 100644 index 177576ef..00000000 --- a/include/boost/python/object/instance.hpp +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 INSTANCE_DWA200295_HPP -# define INSTANCE_DWA200295_HPP - -# include -# include -# include - -namespace boost { namespace python -{ - struct BOOST_PYTHON_DECL_FORWARD instance_holder; -}} // namespace boost::python - -namespace boost { namespace python { namespace objects { - -// Each extension instance will be one of these -template -struct instance -{ - PyObject_VAR_HEAD - PyObject* dict; - PyObject* weakrefs; - instance_holder* objects; - - typedef typename type_with_alignment< - ::boost::alignment_of::value - >::type align_t; - - union - { - align_t align; - char bytes[sizeof(Data)]; - } storage; -}; - -template -struct additional_instance_size -{ - typedef instance instance_data; - typedef instance instance_char; - BOOST_STATIC_CONSTANT( - std::size_t, value = sizeof(instance_data) - - BOOST_PYTHON_OFFSETOF(instance_char,storage)); -}; - -}}} // namespace boost::python::object - -#endif // INSTANCE_DWA200295_HPP diff --git a/include/boost/python/object/iterator.hpp b/include/boost/python/object/iterator.hpp deleted file mode 100644 index e8a4da00..00000000 --- a/include/boost/python/object/iterator.hpp +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 ITERATOR_DWA2002510_HPP -# define ITERATOR_DWA2002510_HPP - -# include - -# include -# include -# include -# include -# include - -# include -# include -# include - -# include -# include - -# include - -# include - -# include -# include -# include - -# include - -namespace boost { namespace python { namespace objects { - -// CallPolicies for the next() method of iterators. We don't want -// users to have to explicitly specify that the references returned by -// iterators are copied, so we just replace the result_converter from -// the default_iterator_call_policies with a permissive one which -// always copies the result. -typedef return_value_policy default_iterator_call_policies; - -// Instantiations of these are wrapped to produce Python iterators. -template -struct iterator_range -{ - iterator_range(object sequence, Iterator start, Iterator finish); - - typedef boost::detail::iterator_traits traits_t; - - struct next - { - typedef typename mpl::if_< - is_reference< - typename traits_t::reference - > - , typename traits_t::reference - , typename traits_t::value_type - >::type result_type; - - result_type - operator()(iterator_range& self) - { - if (self.m_start == self.m_finish) - stop_iteration_error(); - return *self.m_start++; - } - -# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) - // CWPro8 has a codegen problem when this is an empty class - int garbage; -# endif - }; - -# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - // for compilers which can't deduce the value_type of pointers, we - // have a special implementation of next. This takes advantage of - // the fact that T* results are treated like T& results by - // Boost.Python's function wrappers. - struct next_ptr - { - typedef Iterator result_type; - - result_type - operator()(iterator_range& self) - { - if (self.m_start == self.m_finish) - stop_iteration_error(); - return self.m_start++; - } - }; - - typedef mpl::if_< - is_same< - boost::detail::please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee - , typename traits_t::value_type - > - , next_ptr - , next - >::type next_fn; -# else - typedef next next_fn; -# endif - - object m_sequence; // Keeps the sequence alive while iterating. - Iterator m_start; - Iterator m_finish; -}; - -namespace detail -{ - // Get a Python class which contains the given iterator and - // policies, creating it if neccessary. Requires: NextPolicies is - // default-constructible. - template - object demand_iterator_class(char const* name, Iterator* = 0, NextPolicies const& policies = NextPolicies()) - { - typedef iterator_range range_; - - // Check the registry. If one is already registered, return it. - handle<> class_obj( - objects::registered_class_object(python::type_id())); - - if (class_obj.get() != 0) - return object(class_obj); - - typedef typename range_::next_fn next_fn; - typedef typename next_fn::result_type result_type; - - return class_(name, no_init) - .def("__iter__", identity_function()) - .def( - "next" - , make_function( - next_fn() - , policies - , mpl::vector2() - )); - } - - // A function object which builds an iterator_range. - template < - class Target - , class Iterator - , class Accessor1 - , class Accessor2 - , class NextPolicies - > - struct py_iter_ - { - py_iter_(Accessor1 const& get_start, Accessor2 const& get_finish) - : m_get_start(get_start) - , m_get_finish(get_finish) - {} - - // Extract an object x of the Target type from the first Python - // argument, and invoke get_start(x)/get_finish(x) to produce - // iterators, which are used to construct a new iterator_range<> - // object that gets wrapped into a Python iterator. - iterator_range - operator()(back_reference x) const - { - // Make sure the Python class is instantiated. - detail::demand_iterator_class("iterator", (Iterator*)0, NextPolicies()); - - return iterator_range( - x.source() - , m_get_start(x.get()) - , m_get_finish(x.get()) - ); - } - private: - Accessor1 m_get_start; - Accessor2 m_get_finish; - }; - - template - inline object make_iterator_function( - Accessor1 const& get_start - , Accessor2 const& get_finish - , NextPolicies const& next_policies - , Iterator const& (*)() - , boost::type* - , int - ) - { - return make_function( - py_iter_(get_start, get_finish) - , default_call_policies() - , mpl::vector2, back_reference >() - ); - } - - template - inline object make_iterator_function( - Accessor1 const& get_start - , Accessor2 const& get_finish - , NextPolicies const& next_policies - , Iterator& (*)() - , boost::type* - , ...) - { - return make_iterator_function( - get_start - , get_finish - , next_policies - , (Iterator const&(*)())0 - , (boost::type*)0 - , 0 - ); - } - -} - -// Create a Python callable object which accepts a single argument -// convertible to the C++ Target type and returns a Python -// iterator. The Python iterator uses get_start(x) and get_finish(x) -// (where x is an instance of Target) to produce begin and end -// iterators for the range, and an instance of NextPolicies is used as -// CallPolicies for the Python iterator's next() function. -template -inline object make_iterator_function( - Accessor1 const& get_start - , Accessor2 const& get_finish - , NextPolicies const& next_policies - , boost::type* = 0 -) -{ - typedef typename Accessor1::result_type iterator; - typedef typename add_const::type iterator_const; - typedef typename add_reference::type iterator_cref; - - return detail::make_iterator_function( - get_start - , get_finish - , next_policies - , (iterator_cref(*)())0 - , (boost::type*)0 - , 0 - ); -} - -// -// implementation -// -template -inline iterator_range::iterator_range( - object sequence, Iterator start, Iterator finish) - : m_sequence(sequence), m_start(start), m_finish(finish) -{ -} - -}}} // namespace boost::python::objects - -#endif // ITERATOR_DWA2002510_HPP diff --git a/include/boost/python/object/iterator_core.hpp b/include/boost/python/object/iterator_core.hpp deleted file mode 100644 index 064accc5..00000000 --- a/include/boost/python/object/iterator_core.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 ITERATOR_CORE_DWA2002512_HPP -# define ITERATOR_CORE_DWA2002512_HPP - -# include - -namespace boost { namespace python { namespace objects { - -BOOST_PYTHON_DECL object const& identity_function(); -BOOST_PYTHON_DECL void stop_iteration_error(); - -}}} // namespace boost::python::object - -#endif // ITERATOR_CORE_DWA2002512_HPP diff --git a/include/boost/python/object/life_support.hpp b/include/boost/python/object/life_support.hpp deleted file mode 100644 index 9a1b16b6..00000000 --- a/include/boost/python/object/life_support.hpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 LIFE_SUPPORT_DWA200222_HPP -# define LIFE_SUPPORT_DWA200222_HPP -# include - -namespace boost { namespace python { namespace objects { - -BOOST_PYTHON_DECL PyObject* make_nurse_and_patient(PyObject* nurse, PyObject* patient); - -}}} // namespace boost::python::object - -#endif // LIFE_SUPPORT_DWA200222_HPP diff --git a/include/boost/python/object/make_holder.hpp b/include/boost/python/object/make_holder.hpp deleted file mode 100644 index 83c18582..00000000 --- a/include/boost/python/object/make_holder.hpp +++ /dev/null @@ -1,97 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -# ifndef MAKE_HOLDER_DWA20011215_HPP -# define MAKE_HOLDER_DWA20011215_HPP - -# include - -# include - -# include -# include - -# include -# include -# include - -# include -# include -# include -# include -# include - -# include - -namespace boost { namespace python { namespace objects { - -template struct make_holder; - -# define BOOST_PYTHON_DO_FORWARD_ARG(z, index, _) , f##index(a##index) - -// specializations... -# define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PYTHON_MAX_ARITY, )) -# include BOOST_PP_ITERATE() - -# undef BOOST_PYTHON_DO_FORWARD_ARG - -}}} // namespace boost::python::objects - -# endif // MAKE_HOLDER_DWA20011215_HPP - -#elif BOOST_PP_ITERATION_DEPTH() == 1 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, make_holder.hpp) -# endif - -# define N BOOST_PP_ITERATION() - -template <> -struct make_holder -{ - template - struct apply - { -# if N - // Unrolled iteration through each argument type in ArgList, - // choosing the type that will be forwarded on to the holder's - // templated constructor. - typedef typename mpl::begin::type iter0; - -# define BOOST_PP_LOCAL_MACRO(n) \ - typedef typename mpl::deref::type t##n; \ - typedef typename forward::type f##n; \ - typedef typename mpl::next::type \ - BOOST_PP_CAT(iter,BOOST_PP_INC(n)); // Next iterator type - -# define BOOST_PP_LOCAL_LIMITS (0, N-1) -# include BOOST_PP_LOCAL_ITERATE() -# endif - - static void execute( - PyObject* p - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(1, N, t, a)) - { - typedef instance instance_t; - - void* memory = Holder::allocate(p, offsetof(instance_t, storage), sizeof(Holder)); - try { - (new (memory) Holder( - p BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_DO_FORWARD_ARG, nil)))->install(p); - } - catch(...) { - Holder::deallocate(p, memory); - throw; - } - } - }; -}; - -# undef N - -#endif diff --git a/include/boost/python/object/make_instance.hpp b/include/boost/python/object/make_instance.hpp deleted file mode 100644 index 55771eca..00000000 --- a/include/boost/python/object/make_instance.hpp +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 MAKE_INSTANCE_DWA200296_HPP -# define MAKE_INSTANCE_DWA200296_HPP - -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace objects { - -template -struct make_instance_impl -{ - typedef objects::instance instance_t; - - template - static inline PyObject* execute(Arg& x) - { - BOOST_STATIC_ASSERT(is_class::value); - - PyTypeObject* type = Derived::get_class_object(x); - - if (type == 0) - return python::detail::none(); - - PyObject* raw_result = type->tp_alloc( - type, objects::additional_instance_size::value); - - if (raw_result != 0) - { - python::detail::decref_guard protect(raw_result); - - instance_t* instance = (instance_t*)raw_result; - - // construct the new C++ object and install the pointer - // in the Python object. - Derived::construct(&instance->storage, (PyObject*)instance, x)->install(raw_result); - - // Note the position of the internally-stored Holder, - // for the sake of destruction - instance->ob_size = offsetof(instance_t, storage); - - // Release ownership of the python object - protect.cancel(); - } - return raw_result; - } -}; - - -template -struct make_instance - : make_instance_impl > -{ - template - static inline PyTypeObject* get_class_object(U&) - { - return converter::registered::converters.get_class_object(); - } - - static inline Holder* construct(void* storage, PyObject* instance, reference_wrapper x) - { - return new (storage) Holder(instance, x); - } -}; - - -}}} // namespace boost::python::object - -#endif // MAKE_INSTANCE_DWA200296_HPP diff --git a/include/boost/python/object/make_ptr_instance.hpp b/include/boost/python/object/make_ptr_instance.hpp deleted file mode 100644 index d045243b..00000000 --- a/include/boost/python/object/make_ptr_instance.hpp +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 MAKE_PTR_INSTANCE_DWA200296_HPP -# define MAKE_PTR_INSTANCE_DWA200296_HPP - -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace objects { - -template -struct make_ptr_instance - : make_instance_impl > -{ - template - static inline Holder* construct(void* storage, PyObject*, Arg& x) - { - return new (storage) Holder(x); - } - - template - static inline PyTypeObject* get_class_object(Ptr const& x) - { - return get_class_object_impl(get_pointer(x)); - } - - private: - template - static inline PyTypeObject* get_class_object_impl(U const volatile* p) - { - if (p == 0) - return 0; // means "return None". - - PyTypeObject* derived = get_derived_class_object( - BOOST_DEDUCED_TYPENAME is_polymorphic::type(), p); - - if (derived) - return derived; - return converter::registered::converters.get_class_object(); - } - - template - static inline PyTypeObject* get_derived_class_object(mpl::true_, U const volatile* x) - { - converter::registration const* r = converter::registry::query( - type_info(typeid(*get_pointer(x))) - ); - return r ? r->m_class_object : 0; - } - - template - static inline PyTypeObject* get_derived_class_object(mpl::false_, U*) - { - return 0; - } -}; - - -}}} // namespace boost::python::object - -#endif // MAKE_PTR_INSTANCE_DWA200296_HPP diff --git a/include/boost/python/object/pickle_support.hpp b/include/boost/python/object/pickle_support.hpp deleted file mode 100644 index 555544fe..00000000 --- a/include/boost/python/object/pickle_support.hpp +++ /dev/null @@ -1,124 +0,0 @@ -// (C) Copyright R.W. Grosse-Kunstleve 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PYTHON_OBJECT_PICKLE_SUPPORT_RWGK20020603_HPP -# define BOOST_PYTHON_OBJECT_PICKLE_SUPPORT_RWGK20020603_HPP - -# include - -namespace boost { namespace python { - -namespace api -{ - class object; -} -using api::object; -class tuple; - -BOOST_PYTHON_DECL object const& make_instance_reduce_function(); - -struct pickle_suite; - -namespace error_messages { - - template - struct missing_pickle_suite_function_or_incorrect_signature {}; - - inline void must_be_derived_from_pickle_suite(pickle_suite const&) {} -} - -namespace detail { struct pickle_suite_registration; } - -struct pickle_suite -{ - private: - struct inaccessible {}; - friend struct detail::pickle_suite_registration; - public: - static inaccessible* getinitargs() { return 0; } - static inaccessible* getstate() { return 0; } - static inaccessible* setstate() { return 0; } - static bool getstate_manages_dict() { return false; } -}; - -namespace detail { - - struct pickle_suite_registration - { - typedef pickle_suite::inaccessible inaccessible; - - template - static - void - register_( - Class_& cl, - tuple (*getinitargs_fn)(Tgetinitargs), - inaccessible* (*getstate_fn)(), - inaccessible* (*setstate_fn)(), - bool) - { - cl.enable_pickling_(false); - cl.def("__getinitargs__", getinitargs_fn); - } - - template - static - void - register_( - Class_& cl, - inaccessible* (*getinitargs_fn)(), - Rgetstate (*getstate_fn)(Tgetstate), - void (*setstate_fn)(Tsetstate, Ttuple), - bool getstate_manages_dict) - { - cl.enable_pickling_(getstate_manages_dict); - cl.def("__getstate__", getstate_fn); - cl.def("__setstate__", setstate_fn); - } - - template - static - void - register_( - Class_& cl, - tuple (*getinitargs_fn)(Tgetinitargs), - Rgetstate (*getstate_fn)(Tgetstate), - void (*setstate_fn)(Tsetstate, Ttuple), - bool getstate_manages_dict) - { - cl.enable_pickling_(getstate_manages_dict); - cl.def("__getinitargs__", getinitargs_fn); - cl.def("__getstate__", getstate_fn); - cl.def("__setstate__", setstate_fn); - } - - template - static - void - register_( - Class_&, - ...) - { - typedef typename - error_messages::missing_pickle_suite_function_or_incorrect_signature< - Class_>::error_type error_type; - } - }; - - template - struct pickle_suite_finalize - : PickleSuiteType, - pickle_suite_registration - {}; - -} // namespace detail - -}} // namespace boost::python - -#endif // BOOST_PYTHON_OBJECT_PICKLE_SUPPORT_RWGK20020603_HPP diff --git a/include/boost/python/object/pointer_holder.hpp b/include/boost/python/object/pointer_holder.hpp deleted file mode 100644 index d50c689d..00000000 --- a/include/boost/python/object/pointer_holder.hpp +++ /dev/null @@ -1,204 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -# ifndef POINTER_HOLDER_DWA20011215_HPP -# define POINTER_HOLDER_DWA20011215_HPP - -# include -# include - -# include -# include -# include - -# include -# include - -# include -# include -# include - - -# include -# include - -# include -# include -# include -# include -# include -# include - -# include - -namespace boost { namespace python { - -template class wrapper; - -}} - - -namespace boost { namespace python { namespace objects { - -# if BOOST_WORKAROUND(__GNUC__, == 2) -# define BOOST_PYTHON_UNFORWARD_LOCAL(z, n, _) BOOST_PP_COMMA_IF(n) (typename unforward::type)objects::do_unforward(a##n,0) -# else -# define BOOST_PYTHON_UNFORWARD_LOCAL(z, n, _) BOOST_PP_COMMA_IF(n) objects::do_unforward(a##n,0) -# endif - -template -struct pointer_holder : instance_holder -{ - typedef Value value_type; - - pointer_holder(Pointer); - - // Forward construction to the held object - -# define BOOST_PP_ITERATION_PARAMS_1 (4, (0, BOOST_PYTHON_MAX_ARITY, , 1)) -# include BOOST_PP_ITERATE() - - private: // types - - private: // required holder implementation - void* holds(type_info); - - template - inline void* holds_wrapped(type_info dst_t, wrapper*,T* p) - { - return python::type_id() == dst_t ? p : 0; - } - - inline void* holds_wrapped(type_info, ...) - { - return 0; - } - - private: // data members - Pointer m_p; -}; - -template -struct pointer_holder_back_reference : instance_holder -{ - private: - typedef typename python::pointee::type held_type; - public: - typedef Value value_type; - - // Not sure about this one -- can it work? The source object - // undoubtedly does not carry the correct back reference pointer. - pointer_holder_back_reference(Pointer); - - // Forward construction to the held object -# define BOOST_PP_ITERATION_PARAMS_1 (4, (0, BOOST_PYTHON_MAX_ARITY, , 2)) -# include BOOST_PP_ITERATE() - - private: // required holder implementation - void* holds(type_info); - - private: // data members - Pointer m_p; -}; - -# undef BOOST_PYTHON_UNFORWARD_LOCAL - -template -inline pointer_holder::pointer_holder(Pointer p) - : m_p(p) -{ -} - -template -inline pointer_holder_back_reference::pointer_holder_back_reference(Pointer p) - : m_p(p) -{ -} - -template -void* pointer_holder::holds(type_info dst_t) -{ - if (dst_t == python::type_id()) - return &this->m_p; - - Value* p = get_pointer(this->m_p); - if (p == 0) - return 0; - - if (void* wrapped = holds_wrapped(dst_t, p, p)) - return wrapped; - - type_info src_t = python::type_id(); - return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t); -} - -template -void* pointer_holder_back_reference::holds(type_info dst_t) -{ - if (dst_t == python::type_id()) - return &this->m_p; - - if (!get_pointer(this->m_p)) - return 0; - - Value* p = get_pointer(m_p); - - if (dst_t == python::type_id()) - return p; - - type_info src_t = python::type_id(); - return src_t == dst_t ? p : find_dynamic_type(p, src_t, dst_t); -} - -}}} // namespace boost::python::objects - -# endif // POINTER_HOLDER_DWA20011215_HPP - -/* --------------- pointer_holder --------------- */ -#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 1 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, pointer_holder.hpp) -# endif - -# define N BOOST_PP_ITERATION() - -# if (N != 0) - template< BOOST_PP_ENUM_PARAMS_Z(1, N, class A) > -# endif - pointer_holder(PyObject* self BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, a)) - : m_p(new Value( - BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil) - )) - { - python::detail::initialize_wrapper(self, &*this->m_p); - } - -# undef N - -/* --------------- pointer_holder_back_reference --------------- */ -#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 2 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, pointer_holder.hpp(pointer_holder_back_reference)) -# endif - -# define N BOOST_PP_ITERATION() - -# if (N != 0) - template < BOOST_PP_ENUM_PARAMS_Z(1, N, class A) > -# endif - pointer_holder_back_reference( - PyObject* p BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, a)) - : m_p(new held_type( - p BOOST_PP_COMMA_IF(N) BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil) - )) - {} - -# undef N - -#endif diff --git a/include/boost/python/object/py_function.hpp b/include/boost/python/object/py_function.hpp deleted file mode 100644 index b8ef5ab4..00000000 --- a/include/boost/python/object/py_function.hpp +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 PY_FUNCTION_DWA200286_HPP -# define PY_FUNCTION_DWA200286_HPP - -# include -# include -# include -# include - -namespace boost { namespace python { namespace objects { - -// This type is used as a "generalized Python callback", wrapping the -// function signature: -// -// PyObject* (PyObject* args, PyObject* keywords) - -struct BOOST_PYTHON_DECL py_function_impl_base -{ - virtual ~py_function_impl_base(); - virtual PyObject* operator()(PyObject*, PyObject*) = 0; - virtual unsigned min_arity() const = 0; - virtual unsigned max_arity() const; - virtual python::detail::signature_element const* signature() const = 0; -}; - -template -struct caller_py_function_impl : py_function_impl_base -{ - caller_py_function_impl(Caller const& caller) - : m_caller(caller) - {} - - PyObject* operator()(PyObject* args, PyObject* kw) - { - return m_caller(args, kw); - } - - virtual unsigned min_arity() const - { - return m_caller.min_arity(); - } - - virtual python::detail::signature_element const* signature() const - { - return m_caller.signature(); - } - - private: - Caller m_caller; -}; - -template -struct signature_py_function_impl : py_function_impl_base -{ - signature_py_function_impl(Caller const& caller) - : m_caller(caller) - {} - - PyObject* operator()(PyObject* args, PyObject* kw) - { - return m_caller(args, kw); - } - - virtual unsigned min_arity() const - { - return mpl::size::value - 1; - } - - virtual python::detail::signature_element const* signature() const - { - return python::detail::signature::elements(); - } - - private: - Caller m_caller; -}; - -template -struct full_py_function_impl : py_function_impl_base -{ - full_py_function_impl(Caller const& caller, unsigned min_arity, unsigned max_arity) - : m_caller(caller) - , m_min_arity(min_arity) - , m_max_arity(max_arity > min_arity ? max_arity : min_arity) - {} - - PyObject* operator()(PyObject* args, PyObject* kw) - { - return m_caller(args, kw); - } - - virtual unsigned min_arity() const - { - return m_min_arity; - } - - virtual unsigned max_arity() const - { - return m_max_arity; - } - - virtual python::detail::signature_element const* signature() const - { - return python::detail::signature::elements(); - } - - private: - Caller m_caller; - unsigned m_min_arity; - unsigned m_max_arity; -}; - -struct py_function -{ - template - py_function(Caller const& caller) - : m_impl(new caller_py_function_impl(caller)) - {} - - template - py_function(Caller const& caller, Sig) - : m_impl(new signature_py_function_impl(caller)) - {} - - template - py_function(Caller const& caller, Sig, int min_arity, int max_arity = 0) - : m_impl(new full_py_function_impl(caller, min_arity, max_arity)) - {} - - py_function(py_function const& rhs) - : m_impl(rhs.m_impl) - {} - - PyObject* operator()(PyObject* args, PyObject* kw) const - { - return (*m_impl)(args, kw); - } - - unsigned min_arity() const - { - return m_impl->min_arity(); - } - - unsigned max_arity() const - { - return m_impl->max_arity(); - } - - python::detail::signature_element const* signature() const - { - return m_impl->signature(); - } - - private: - mutable std::auto_ptr m_impl; -}; - -}}} // namespace boost::python::objects - -#endif // PY_FUNCTION_DWA200286_HPP diff --git a/include/boost/python/object/value_holder.hpp b/include/boost/python/object/value_holder.hpp deleted file mode 100644 index 9453bd9e..00000000 --- a/include/boost/python/object/value_holder.hpp +++ /dev/null @@ -1,164 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2001. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -# ifndef VALUE_HOLDER_DWA20011215_HPP -# define VALUE_HOLDER_DWA20011215_HPP - -# include - -# include -# include -# include - -# include -# include - -# include -# include - -# include -# include -# include -# include -# include - -# include -# include - -namespace boost { namespace python { namespace objects { - -# if BOOST_WORKAROUND(__GNUC__, == 2) -# define BOOST_PYTHON_UNFORWARD_LOCAL(z, n, _) BOOST_PP_COMMA_IF(n) (typename unforward::type)objects::do_unforward(a##n,0) -# else -# define BOOST_PYTHON_UNFORWARD_LOCAL(z, n, _) BOOST_PP_COMMA_IF(n) objects::do_unforward(a##n,0) -# endif - -template -struct value_holder : instance_holder -{ - typedef Value held_type; - typedef Value value_type; - - // Forward construction to the held object -# define BOOST_PP_ITERATION_PARAMS_1 (4, (0, BOOST_PYTHON_MAX_ARITY, , 1)) -# include BOOST_PP_ITERATE() - - private: // required holder implementation - void* holds(type_info); - - template - inline void* holds_wrapped(type_info dst_t, wrapper*,T* p) - { - return python::type_id() == dst_t ? p : 0; - } - - inline void* holds_wrapped(type_info, ...) - { - return 0; - } - private: // data members - Value m_held; -}; - -template -struct value_holder_back_reference : instance_holder -{ - typedef Held held_type; - typedef Value value_type; - - // Forward construction to the held object -# define BOOST_PP_ITERATION_PARAMS_1 (4, (0, BOOST_PYTHON_MAX_ARITY, , 2)) -# include BOOST_PP_ITERATE() - -private: // required holder implementation - void* holds(type_info); - - private: // data members - Held m_held; -}; - -# undef BOOST_PYTHON_UNFORWARD_LOCAL - -template -void* value_holder::holds(type_info dst_t) -{ - if (void* wrapped = holds_wrapped(dst_t, &m_held, &m_held)) - return wrapped; - - type_info src_t = python::type_id(); - return src_t == dst_t ? &m_held - : find_static_type(&m_held, src_t, dst_t); -} - -template -void* value_holder_back_reference::holds( - type_info dst_t) -{ - type_info src_t = python::type_id(); - Value* x = &m_held; - - if (dst_t == src_t) - return x; - else if (dst_t == python::type_id()) - return &m_held; - else - return find_static_type(x, src_t, dst_t); -} - -}}} // namespace boost::python::objects - -# endif // VALUE_HOLDER_DWA20011215_HPP - -// --------------- value_holder --------------- - -#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 1 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, value_holder.hpp(value_holder)) -# endif - -# define N BOOST_PP_ITERATION() - -# if (N != 0) - template -# endif - value_holder( - PyObject* self BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, a)) - : m_held( - BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil) - ) - { - python::detail::initialize_wrapper(self, &this->m_held); - } - -# undef N - -// --------------- value_holder_back_reference --------------- - -#elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 2 -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, value_holder.hpp(value_holder_back_reference)) -# endif - -# define N BOOST_PP_ITERATION() - -# if (N != 0) - template -# endif - value_holder_back_reference( - PyObject* p BOOST_PP_COMMA_IF(N) BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, a)) - : m_held( - p BOOST_PP_COMMA_IF(N) - BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil) - ) - { - } - -# undef N - -#endif diff --git a/include/boost/python/object/value_holder_fwd.hpp b/include/boost/python/object/value_holder_fwd.hpp deleted file mode 100644 index 3454bac4..00000000 --- a/include/boost/python/object/value_holder_fwd.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 VALUE_HOLDER_FWD_DWA2002311_HPP -# define VALUE_HOLDER_FWD_DWA2002311_HPP - -namespace boost { namespace python { namespace objects { - -struct no_back_reference; - -template struct value_holder_generator; - -}}} // namespace boost::python::object - -#endif // VALUE_HOLDER_FWD_DWA2002311_HPP diff --git a/include/boost/python/object_attributes.hpp b/include/boost/python/object_attributes.hpp deleted file mode 100755 index 012240b2..00000000 --- a/include/boost/python/object_attributes.hpp +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 OBJECT_ATTRIBUTES_DWA2002615_HPP -# define OBJECT_ATTRIBUTES_DWA2002615_HPP - -# include - -# include -# include -# include - -namespace boost { namespace python { namespace api { - -struct const_attribute_policies -{ - typedef char const* key_type; - static object get(object const& target, char const* key); -}; - -struct attribute_policies : const_attribute_policies -{ - static object const& set(object const& target, char const* key, object const& value); - static void del(object const&target, char const* key); -}; - -// -// implementation -// -template -inline object_attribute object_operators::attr(char const* name) -{ - object_cref2 x = *static_cast(this); - return object_attribute(x, name); -} - -template -inline const_object_attribute object_operators::attr(char const* name) const -{ - object_cref2 x = *static_cast(this); - return const_object_attribute(x, name); -} - -inline object const_attribute_policies::get(object const& target, char const* key) -{ - return python::getattr(target, key); -} - -inline object const& attribute_policies::set( - object const& target - , char const* key - , object const& value) -{ - python::setattr(target, key, value); - return value; -} - -inline void attribute_policies::del( - object const& target - , char const* key) -{ - python::delattr(target, key); -} - -}}} // namespace boost::python::api - -#endif // OBJECT_ATTRIBUTES_DWA2002615_HPP diff --git a/include/boost/python/object_call.hpp b/include/boost/python/object_call.hpp deleted file mode 100644 index 5c4d0f2f..00000000 --- a/include/boost/python/object_call.hpp +++ /dev/null @@ -1,23 +0,0 @@ -# if !defined(BOOST_PYTHON_SYNOPSIS) -# // Copyright David Abrahams 2002. -# // 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) -# error Boost.Python - do not include this file! -# endif - -# define N BOOST_PP_ITERATION() - - template - typename detail::dependent::type - operator()(BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, const& a)) const - { - typedef typename detail::dependent::type obj; - U const& self = *static_cast(this); - return call(get_managed_object(self, tag), BOOST_PP_ENUM_PARAMS_Z(1, N, a)); - } - -# undef N -# endif // BOOST_PYTHON_SYNOPSIS diff --git a/include/boost/python/object_core.hpp b/include/boost/python/object_core.hpp deleted file mode 100755 index 3af36436..00000000 --- a/include/boost/python/object_core.hpp +++ /dev/null @@ -1,485 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 OBJECT_CORE_DWA2002615_HPP -# define OBJECT_CORE_DWA2002615_HPP - -# include - -# include - -# include -# include -# include -# include -# include -# include -# include - -# include -# include - -# include -# include - -# include -# include - -# include -# include -# include - -# include -# include -# include - -# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -# include -# endif - -# include - -namespace boost { namespace python { - -namespace converter -{ - template struct arg_to_python; -} - -// Put this in an inner namespace so that the generalized operators won't take over -namespace api -{ - -// This file contains the definition of the object class and enough to -// construct/copy it, but not enough to do operations like -// attribute/item access or addition. - - template class proxy; - - struct const_attribute_policies; - struct attribute_policies; - struct const_item_policies; - struct item_policies; - struct const_slice_policies; - struct slice_policies; - class slice_nil; - - typedef proxy const_object_attribute; - typedef proxy object_attribute; - typedef proxy const_object_item; - typedef proxy object_item; - typedef proxy const_object_slice; - typedef proxy object_slice; - - // - // is_proxy -- proxy type detection - // - BOOST_PYTHON_IS_XXX_DEF(proxy, boost::python::api::proxy, 1) - - template struct object_initializer; - - class object; - typedef PyObject* (object::*bool_type)() const; - - template - class object_operators : public def_visitor - { - protected: -# if !defined(BOOST_MSVC) || BOOST_MSVC > 1200 - typedef object const& object_cref; -# else - typedef object object_cref; -# endif - public: - // function call - // - object operator()() const; - -# define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PYTHON_MAX_ARITY, )) -# include BOOST_PP_ITERATE() - - // truth value testing - // - operator bool_type() const; - bool operator!() const; // needed for vc6 - - // Attribute access - // - const_object_attribute attr(char const*) const; - object_attribute attr(char const*); - - // item access - // - const_object_item operator[](object_cref) const; - object_item operator[](object_cref); - - template - const_object_item - operator[](T const& key) const -# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 - ; -# else - { - return (*this)[object(key)]; - } -# endif - - template - object_item - operator[](T const& key) -# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 - ; -# else - { - return (*this)[object(key)]; - } -# endif - - // slicing - // - const_object_slice slice(object_cref, object_cref) const; - object_slice slice(object_cref, object_cref); - - const_object_slice slice(slice_nil, object_cref) const; - object_slice slice(slice_nil, object_cref); - - const_object_slice slice(object_cref, slice_nil) const; - object_slice slice(object_cref, slice_nil); - - const_object_slice slice(slice_nil, slice_nil) const; - object_slice slice(slice_nil, slice_nil); - - template - const_object_slice - slice(T const& start, V const& end) const -# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 - ; -# else - { - return this->slice( - slice_bound::type(start) - , slice_bound::type(end)); - } -# endif - - template - object_slice - slice(T const& start, V const& end) -# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 - ; -# else - { - return this->slice( - slice_bound::type(start) - , slice_bound::type(end)); - } -# endif - - private: // def visitation for adding callable objects as class methods - - template - void visit(ClassT& cl, char const* name, python::detail::def_helper const& helper) const - { - // It's too late to specify anything other than docstrings if - // the callable object is already wrapped. - BOOST_STATIC_ASSERT( - (is_same::value - || detail::is_string_literal::value)); - - objects::add_to_namespace(cl, name, this->derived_visitor(), helper.doc()); - } - - friend class python::def_visitor_access; - - private: - // there is a confirmed CWPro8 codegen bug here. We prevent the - // early destruction of a temporary by binding a named object - // instead. -# if __MWERKS__ < 0x3000 || __MWERKS__ > 0x3003 - typedef object const& object_cref2; -# else - typedef object const object_cref2; -# endif - }; - - - // VC6 and VC7 require this base class in order to generate the - // correct copy constructor for object. We can't define it there - // explicitly or it will complain of ambiguity. - struct object_base : object_operators - { - // copy constructor without NULL checking, for efficiency. - inline object_base(object_base const&); - inline object_base(PyObject* ptr); - - object_base& operator=(object_base const& rhs); - ~object_base(); - - // Underlying object access -- returns a borrowed reference - PyObject* ptr() const; - - private: - PyObject* m_ptr; - }; - -# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template - struct is_derived_impl - { - static T x; - template - static X* to_pointer(X const&); - - static char test(U const*); - typedef char (&no)[2]; - static no test(...); - - BOOST_STATIC_CONSTANT(bool, value = sizeof(test(to_pointer(x))) == 1); - }; - - template - struct is_derived - : mpl::bool_::value> - {}; -# else - template - struct is_derived - : is_convertible< - typename remove_reference::type* - , U const* - > - {}; -# endif - - template - typename objects::unforward_cref::type do_unforward_cref(T const& x) - { -# if BOOST_WORKAROUND(__GNUC__, == 2) - typedef typename objects::unforward_cref::type ret; - return ret(x); -# else - return x; -# endif - } - -# if BOOST_WORKAROUND(__GNUC__, == 2) - // GCC 2.x has non-const string literals; this hacks around that problem. - template - char const (& do_unforward_cref(char const(&x)[N]) )[N] - { - return x; - } -# endif - - class object; - - template - PyObject* object_base_initializer(T const& x) - { - typedef typename is_derived< - BOOST_DEDUCED_TYPENAME objects::unforward_cref::type - , object - >::type is_obj; - - return object_initializer< - BOOST_DEDUCED_TYPENAME unwrap_reference::type - >::get( - x - , is_obj() - ); - } - - class object : public object_base - { - public: - // default constructor creates a None object - object(); - - // explicit conversion from any C++ object to Python - template - explicit object( - T const& x -# if BOOST_WORKAROUND(BOOST_MSVC, == 1200) - // use some SFINAE to un-confuse MSVC about its - // copy-initialization ambiguity claim. - , typename mpl::if_,int&,int>::type* = 0 -# endif - ) - : object_base(object_base_initializer(x)) - { - } - - // Throw error_already_set() if the handle is null. - BOOST_PYTHON_DECL explicit object(handle<> const&); - private: - - public: // implementation detail -- for internal use only - explicit object(detail::borrowed_reference); - explicit object(detail::new_reference); - explicit object(detail::new_non_null_reference); - }; - - // Macros for forwarding constructors in classes derived from - // object. Derived classes will usually want these as an - // implementation detail -# define BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS_(derived, base) \ - inline explicit derived(python::detail::borrowed_reference p) \ - : base(p) {} \ - inline explicit derived(python::detail::new_reference p) \ - : base(p) {} \ - inline explicit derived(python::detail::new_non_null_reference p) \ - : base(p) {} - -# if !defined(BOOST_MSVC) || BOOST_MSVC > 1200 -# define BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS_ -# else - // MSVC6 has a bug which causes an explicit template constructor to - // be preferred over an appropriate implicit conversion operator - // declared on the argument type. Normally, that would cause a - // runtime failure when using extract to extract a type with a - // templated constructor. This additional constructor will turn that - // runtime failure into an ambiguity error at compile-time due to - // the lack of partial ordering, or at least a link-time error if no - // generalized template constructor is declared. -# define BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(derived, base) \ - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS_(derived, base) \ - template \ - explicit derived(extract const&); -# endif - - // - // object_initializer -- get the handle to construct the object with, - // based on whether T is a proxy or derived from object - // - template - struct object_initializer_impl - { - static PyObject* - get(object const& x, mpl::true_) - { - return python::incref(x.ptr()); - } - - template - static PyObject* - get(T const& x, mpl::false_) - { - return python::incref(converter::arg_to_python(x).get()); - } - }; - - template <> - struct object_initializer_impl - { - template - static PyObject* - get(proxy const& x, mpl::false_) - { - return python::incref(x.operator object().ptr()); - } - }; - - template <> - struct object_initializer_impl - { - template - static PyObject* - get(T const& x, ...) - { - return python::incref(get_managed_object(x, tag)); - } - }; - - template <> - struct object_initializer_impl - {}; // empty implementation should cause an error - - template - struct object_initializer : object_initializer_impl< - is_proxy::value - , converter::is_object_manager::value - > - {}; - -} -using api::object; -template struct extract; - -// -// implementation -// - -inline object::object() - : object_base(python::incref(Py_None)) -{} - -// copy constructor without NULL checking, for efficiency -inline api::object_base::object_base(object_base const& rhs) - : m_ptr(python::incref(rhs.m_ptr)) -{} - -inline api::object_base::object_base(PyObject* p) - : m_ptr(p) -{} - -inline api::object_base& api::object_base::operator=(api::object_base const& rhs) -{ - Py_INCREF(rhs.m_ptr); - Py_DECREF(this->m_ptr); - this->m_ptr = rhs.m_ptr; - return *this; -} - -inline api::object_base::~object_base() -{ - Py_DECREF(m_ptr); -} - -inline object::object(detail::borrowed_reference p) - : object_base(python::incref((PyObject*)p)) -{} - -inline object::object(detail::new_reference p) - : object_base(expect_non_null((PyObject*)p)) -{} - -inline object::object(detail::new_non_null_reference p) - : object_base((PyObject*)p) -{} - -inline PyObject* api::object_base::ptr() const -{ - return m_ptr; -} - -// -// Converter specialization implementations -// -namespace converter -{ - template struct object_manager_traits; - - template <> - struct object_manager_traits - { - BOOST_STATIC_CONSTANT(bool, is_specialized = true); - static bool check(PyObject*) { return true; } - - static python::detail::new_non_null_reference adopt(PyObject* x) - { - return python::detail::new_non_null_reference(x); - } - }; -} - -inline PyObject* get_managed_object(object const& x, tag_t) -{ - return x.ptr(); -} - -}} // namespace boost::python - -# include - -#endif // OBJECT_CORE_DWA2002615_HPP diff --git a/include/boost/python/object_fwd.hpp b/include/boost/python/object_fwd.hpp deleted file mode 100644 index 11efcc70..00000000 --- a/include/boost/python/object_fwd.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 OBJECT_FWD_DWA2002724_HPP -# define OBJECT_FWD_DWA2002724_HPP - -# include - -namespace boost { namespace python { -namespace api -{ - class object; -} -using api::object; -}} // namespace boost::python - -#endif // OBJECT_FWD_DWA2002724_HPP diff --git a/include/boost/python/object_items.hpp b/include/boost/python/object_items.hpp deleted file mode 100755 index f0761dad..00000000 --- a/include/boost/python/object_items.hpp +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 OBJECT_ITEMS_DWA2002615_HPP -# define OBJECT_ITEMS_DWA2002615_HPP - -# include - -# include -# include -# include - -namespace boost { namespace python { namespace api { - -struct const_item_policies -{ - typedef object key_type; - static object get(object const& target, object const& key); -}; - -struct item_policies : const_item_policies -{ - static object const& set(object const& target, object const& key, object const& value); - static void del(object const& target, object const& key); -}; - -// -// implementation -// -template -inline object_item -object_operators::operator[](object_cref key) -{ - object_cref2 x = *static_cast(this); - return object_item(x, key); -} - -template -inline const_object_item -object_operators::operator[](object_cref key) const -{ - object_cref2 x = *static_cast(this); - return const_object_item(x, key); -} - -# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 -template -template -inline const_object_item -object_operators::operator[](T const& key) const -{ - return (*this)[object(key)]; -} - -template -template -inline object_item -object_operators::operator[](T const& key) -{ - return (*this)[object(key)]; -} -# endif - - -inline object const_item_policies::get(object const& target, object const& key) -{ - return getitem(target, key); -} - -inline object const& item_policies::set( - object const& target - , object const& key - , object const& value) -{ - setitem(target, key, value); - return value; -} - -inline void item_policies::del( - object const& target - , object const& key) -{ - delitem(target, key); -} - -}}} // namespace boost::python::api - -#endif // OBJECT_ITEMS_DWA2002615_HPP diff --git a/include/boost/python/object_operators.hpp b/include/boost/python/object_operators.hpp deleted file mode 100644 index 0515309b..00000000 --- a/include/boost/python/object_operators.hpp +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 OBJECT_OPERATORS_DWA2002617_HPP -# define OBJECT_OPERATORS_DWA2002617_HPP - -# include - -# include -# include -# include -# include - -# include - -namespace boost { namespace python { namespace api { - -template -char is_object_operators_helper(object_operators const*); - -typedef char (&no_type)[2]; -no_type is_object_operators_helper(...); - -template X* make_ptr(); - -template -struct is_object_operators -{ - enum { - value - = (sizeof(api::is_object_operators_helper(api::make_ptr())) - + sizeof(api::is_object_operators_helper(api::make_ptr())) - < 4 - ) - }; - typedef mpl::bool_ type; -}; - -# if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE) -template -struct enable_binary - : boost::iterators::enable_if, T> -{}; -# define BOOST_PYTHON_BINARY_RETURN(T) typename enable_binary::type -# else -# define BOOST_PYTHON_BINARY_RETURN(T) T -# endif - -template -object object_operators::operator()() const -{ - object_cref2 f = *static_cast(this); - return call(f.ptr()); -} - - -template -inline -object_operators::operator bool_type() const -{ - object_cref2 x = *static_cast(this); - return PyObject_IsTrue(x.ptr()) ? &object::ptr : 0; -} - -template -inline bool -object_operators::operator!() const -{ - object_cref2 x = *static_cast(this); - return !PyObject_IsTrue(x.ptr()); -} - -# define BOOST_PYTHON_COMPARE_OP(op, opid) \ -template \ -BOOST_PYTHON_BINARY_RETURN(bool) operator op(L const& l, R const& r) \ -{ \ - return PyObject_RichCompareBool( \ - object(l).ptr(), object(r).ptr(), opid); \ -} -BOOST_PYTHON_COMPARE_OP(>, Py_GT) -BOOST_PYTHON_COMPARE_OP(>=, Py_GE) -BOOST_PYTHON_COMPARE_OP(<, Py_LT) -BOOST_PYTHON_COMPARE_OP(<=, Py_LE) -BOOST_PYTHON_COMPARE_OP(==, Py_EQ) -BOOST_PYTHON_COMPARE_OP(!=, Py_NE) -# undef BOOST_PYTHON_COMPARE_OP - -# define BOOST_PYTHON_BINARY_OPERATOR(op) \ -BOOST_PYTHON_DECL object operator op(object const& l, object const& r); \ -template \ -BOOST_PYTHON_BINARY_RETURN(object) operator op(L const& l, R const& r) \ -{ \ - return object(l) op object(r); \ -} -BOOST_PYTHON_BINARY_OPERATOR(+) -BOOST_PYTHON_BINARY_OPERATOR(-) -BOOST_PYTHON_BINARY_OPERATOR(*) -BOOST_PYTHON_BINARY_OPERATOR(/) -BOOST_PYTHON_BINARY_OPERATOR(%) -BOOST_PYTHON_BINARY_OPERATOR(<<) -BOOST_PYTHON_BINARY_OPERATOR(>>) -BOOST_PYTHON_BINARY_OPERATOR(&) -BOOST_PYTHON_BINARY_OPERATOR(^) -BOOST_PYTHON_BINARY_OPERATOR(|) -# undef BOOST_PYTHON_BINARY_OPERATOR - - -# define BOOST_PYTHON_INPLACE_OPERATOR(op) \ -BOOST_PYTHON_DECL object& operator op(object& l, object const& r); \ -template \ -object& operator op(object& l, R const& r) \ -{ \ - return l op object(r); \ -} -BOOST_PYTHON_INPLACE_OPERATOR(+=) -BOOST_PYTHON_INPLACE_OPERATOR(-=) -BOOST_PYTHON_INPLACE_OPERATOR(*=) -BOOST_PYTHON_INPLACE_OPERATOR(/=) -BOOST_PYTHON_INPLACE_OPERATOR(%=) -BOOST_PYTHON_INPLACE_OPERATOR(<<=) -BOOST_PYTHON_INPLACE_OPERATOR(>>=) -BOOST_PYTHON_INPLACE_OPERATOR(&=) -BOOST_PYTHON_INPLACE_OPERATOR(^=) -BOOST_PYTHON_INPLACE_OPERATOR(|=) -# undef BOOST_PYTHON_INPLACE_OPERATOR - -}}} // namespace boost::python - -#include - -#endif // OBJECT_OPERATORS_DWA2002617_HPP diff --git a/include/boost/python/object_protocol.hpp b/include/boost/python/object_protocol.hpp deleted file mode 100755 index 2011b04a..00000000 --- a/include/boost/python/object_protocol.hpp +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 OBJECT_PROTOCOL_DWA2002615_HPP -# define OBJECT_PROTOCOL_DWA2002615_HPP - -# include - -# include -# include - -namespace boost { namespace python { namespace api { - -template -object getattr(Target const& target, Key const& key) -{ - return getattr(object(target), object(key)); -} - -template -object getattr(Target const& target, Key const& key, Default const& default_) -{ - return getattr(object(target), object(key), object(default_)); -} - - -template -void setattr(object const& target, Key const& key, Value const& value) -{ - setattr(target, object(key), object(value)); -} - -template -void delattr(object const& target, Key const& key) -{ - delattr(target, object(key)); -} - -template -object getitem(Target const& target, Key const& key) -{ - return getitem(object(target), object(key)); -} - - -template -void setitem(object const& target, Key const& key, Value const& value) -{ - setitem(target, object(key), object(value)); -} - -template -void delitem(object const& target, Key const& key) -{ - delitem(target, object(key)); -} - -template -object getslice(Target const& target, Begin const& begin, End const& end) -{ - return getslice(object(target), object(begin), object(end)); -} - -template -void setslice(object const& target, Begin const& begin, End const& end, Value const& value) -{ - setslice(target, object(begin), object(end), object(value)); -} - -template -void delslice(object const& target, Begin const& begin, End const& end) -{ - delslice(target, object(begin), object(end)); -} - -}}} // namespace boost::python::api - -#endif // OBJECT_PROTOCOL_DWA2002615_HPP diff --git a/include/boost/python/object_protocol_core.hpp b/include/boost/python/object_protocol_core.hpp deleted file mode 100755 index a5bd9afc..00000000 --- a/include/boost/python/object_protocol_core.hpp +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 OBJECT_PROTOCOL_CORE_DWA2002615_HPP -# define OBJECT_PROTOCOL_CORE_DWA2002615_HPP - -# include - -# include - -namespace boost { namespace python { - -namespace api -{ - class object; - - BOOST_PYTHON_DECL object getattr(object const& target, object const& key); - BOOST_PYTHON_DECL object getattr(object const& target, object const& key, object const& default_); - BOOST_PYTHON_DECL void setattr(object const& target, object const& key, object const& value); - BOOST_PYTHON_DECL void delattr(object const& target, object const& key); - - // These are defined for efficiency, since attributes are commonly - // accessed through literal strings. - BOOST_PYTHON_DECL object getattr(object const& target, char const* key); - BOOST_PYTHON_DECL object getattr(object const& target, char const* key, object const& default_); - BOOST_PYTHON_DECL void setattr(object const& target, char const* key, object const& value); - BOOST_PYTHON_DECL void delattr(object const& target, char const* key); - - BOOST_PYTHON_DECL object getitem(object const& target, object const& key); - BOOST_PYTHON_DECL void setitem(object const& target, object const& key, object const& value); - BOOST_PYTHON_DECL void delitem(object const& target, object const& key); - - BOOST_PYTHON_DECL object getslice(object const& target, handle<> const& begin, handle<> const& end); - BOOST_PYTHON_DECL void setslice(object const& target, handle<> const& begin, handle<> const& end, object const& value); - BOOST_PYTHON_DECL void delslice(object const& target, handle<> const& begin, handle<> const& end); -} - -using api::getattr; -using api::setattr; -using api::delattr; - -using api::getitem; -using api::setitem; -using api::delitem; - -using api::getslice; -using api::setslice; -using api::delslice; - -}} // namespace boost::python - -#endif // OBJECT_PROTOCOL_CORE_DWA2002615_HPP diff --git a/include/boost/python/object_slices.hpp b/include/boost/python/object_slices.hpp deleted file mode 100644 index e70faff7..00000000 --- a/include/boost/python/object_slices.hpp +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 OBJECT_SLICES_DWA2002615_HPP -# define OBJECT_SLICES_DWA2002615_HPP - -# include - -# include -# include -# include -# include -# include - -namespace boost { namespace python { namespace api { - -struct const_slice_policies -{ - typedef std::pair, handle<> > key_type; - static object get(object const& target, key_type const& key); -}; - -struct slice_policies : const_slice_policies -{ - static object const& set(object const& target, key_type const& key, object const& value); - static void del(object const& target, key_type const& key); -}; - -// -// implementation -// -template -object_slice -object_operators::slice(object_cref start, object_cref finish) -{ - object_cref2 x = *static_cast(this); - return object_slice(x, std::make_pair(borrowed(start.ptr()), borrowed(finish.ptr()))); -} - -template -const_object_slice -object_operators::slice(object_cref start, object_cref finish) const -{ - object_cref2 x = *static_cast(this); - return const_object_slice(x, std::make_pair(borrowed(start.ptr()), borrowed(finish.ptr()))); -} - -template -object_slice -object_operators::slice(slice_nil, object_cref finish) -{ - object_cref2 x = *static_cast(this); - return object_slice(x, std::make_pair(allow_null((PyObject*)0), borrowed(finish.ptr()))); -} - -template -const_object_slice -object_operators::slice(slice_nil, object_cref finish) const -{ - object_cref2 x = *static_cast(this); - return const_object_slice(x, std::make_pair(allow_null((PyObject*)0), borrowed(finish.ptr()))); -} - -template -object_slice -object_operators::slice(slice_nil, slice_nil) -{ - object_cref2 x = *static_cast(this); - return object_slice(x, std::make_pair(allow_null((PyObject*)0), allow_null((PyObject*)0))); -} - -template -const_object_slice -object_operators::slice(slice_nil, slice_nil) const -{ - object_cref2 x = *static_cast(this); - return const_object_slice(x, std::make_pair(allow_null((PyObject*)0), allow_null((PyObject*)0))); -} - -template -object_slice -object_operators::slice(object_cref start, slice_nil) -{ - object_cref2 x = *static_cast(this); - return object_slice(x, std::make_pair(borrowed(start.ptr()), allow_null((PyObject*)0))); -} - -template -const_object_slice -object_operators::slice(object_cref start, slice_nil) const -{ - object_cref2 x = *static_cast(this); - return const_object_slice(x, std::make_pair(borrowed(start.ptr()), allow_null((PyObject*)0))); -} -# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 -template -template -inline const_object_slice -object_operators::slice(T const& start, V const& end) const -{ - return this->slice( - typename slice_bound::type(start) - , typename slice_bound::type(end)); -} - -template -template -inline object_slice -object_operators::slice(T const& start, V const& end) -{ - return this->slice( - typename slice_bound::type(start) - , typename slice_bound::type(end)); -} -# endif - - -inline object const_slice_policies::get(object const& target, key_type const& key) -{ - return getslice(target, key.first, key.second); -} - -inline object const& slice_policies::set( - object const& target - , key_type const& key - , object const& value) -{ - setslice(target, key.first, key.second, value); - return value; -} - -inline void slice_policies::del( - object const& target - , key_type const& key) -{ - delslice(target, key.first, key.second); -} - -}}} // namespace boost::python::api - -#endif // OBJECT_SLICES_DWA2002615_HPP diff --git a/include/boost/python/opaque_pointer_converter.hpp b/include/boost/python/opaque_pointer_converter.hpp deleted file mode 100644 index b0fe8c43..00000000 --- a/include/boost/python/opaque_pointer_converter.hpp +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright Gottfried Ganßauge 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -/* - * Generic Conversion of opaque C++-pointers to a Python-Wrapper. - */ -# ifndef OPAQUE_POINTER_CONVERTER_HPP_ -# define OPAQUE_POINTER_CONVERTER_HPP_ - -# include -# include -# include -# include -# include -# include -# include - -// opaque_pointer_converter -- -// -// usage: opaque_pointer_converter("name") -// -// registers to- and from- python conversions for a type Pointer, -// and a corresponding Python type called "name". -// -// Note: -// In addition you need to define specializations for type_id -// on the type pointed to by Pointer using -// BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(Pointee) -// -// For an example see libs/python/test/opaque.cpp -// -namespace boost { namespace python { - namespace detail { - template - struct opaque_pointer_converter_requires_a_pointer_type -# if defined(__GNUC__) && __GNUC__ >= 3 || defined(__EDG__) - {} -# endif - ; - } - -template -struct opaque_pointer_converter - : to_python_converter< - Pointer, opaque_pointer_converter > -{ - BOOST_STATIC_CONSTANT( - bool, ok = is_pointer::value); - - typedef typename mpl::if_c< - ok - , Pointer - , detail::opaque_pointer_converter_requires_a_pointer_type - >::type ptr_type; - -private: - struct instance; - -public: - explicit opaque_pointer_converter(char const* name) - { - type_object.tp_name = const_cast (name); - - lvalue_from_pytype< - opaque_pointer_converter, - &opaque_pointer_converter::type_object - >(); - } - - static PyObject* convert(ptr_type x) - { - PyObject *result = 0; - - if (x != 0) { - instance *o = PyObject_New (instance, &type_object); - - o->x = x; - result = &o->base_; - } else { - result = detail::none(); - } - - return (result); - } - - static typename ::boost::remove_pointer::type& - execute(instance &p_) - { - return *p_.x; - } - -private: - static PyTypeObject type_object; - - // This is a POD so we can use PyObject_Del on it, for example. - struct instance - { - PyObject base_; - ptr_type x; - }; -}; - -template -PyTypeObject opaque_pointer_converter::type_object = -{ - PyObject_HEAD_INIT(NULL) - 0, - 0, - sizeof(typename opaque_pointer_converter::instance), - 0, - ::boost::python::detail::dealloc -}; -}} // namespace boost::python -# ifdef BOOST_MSVC -// MSC works without this workaround, but needs another one ... -# define BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(Pointee) \ - BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(Pointee) -# else -# define BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(Pointee) \ - namespace boost { namespace python { \ - template<> \ - inline type_info type_id(BOOST_PYTHON_EXPLICIT_TT_DEF(Pointee)) \ - { \ - return type_info (typeid (Pointee *)); \ - } \ - template<> \ - inline type_info type_id( \ - BOOST_PYTHON_EXPLICIT_TT_DEF(const volatile Pointee&)) \ - { \ - return type_info (typeid (Pointee *)); \ - } \ -}} -# endif -# endif // OPAQUE_POINTER_CONVERTER_HPP_ diff --git a/include/boost/python/operators.hpp b/include/boost/python/operators.hpp deleted file mode 100644 index d10a0094..00000000 --- a/include/boost/python/operators.hpp +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 OPERATORS_DWA2002530_HPP -# define OPERATORS_DWA2002530_HPP - -# include - -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - // This is essentially the old v1 to_python(). It will be eliminated - // once the public interface for to_python is settled on. - template - PyObject* convert_result(T const& x) - { - return converter::arg_to_python(x).release(); - } - - // Operator implementation template declarations. The nested apply - // declaration here keeps MSVC6 happy. - template struct operator_l - { - template struct apply; - }; - - template struct operator_r - { - template struct apply; - }; - - template struct operator_1 - { - template struct apply; - }; - - // MSVC6 doesn't want us to do this sort of inheritance on a nested - // class template, so we use this layer of indirection to avoid - // ::template<...> on the nested apply functions below - template - struct operator_l_inner - : operator_l::template apply - {}; - - template - struct operator_r_inner - : operator_r::template apply - {}; - - template - struct operator_1_inner - : operator_1::template apply - {}; - - // Define three different binary_op templates which take care of - // these cases: - // self op self - // self op R - // L op self - // - // The inner apply metafunction is used to adjust the operator to - // the class type being defined. Inheritance of the outer class is - // simply used to provide convenient access to the operation's - // name(). - - // self op self - template - struct binary_op : operator_l - { - template - struct apply : operator_l_inner - { - }; - }; - - // self op R - template - struct binary_op_l : operator_l - { - template - struct apply : operator_l_inner - { - }; - }; - - // L op self - template - struct binary_op_r : operator_r - { - template - struct apply : operator_r_inner - { - }; - }; - - template - struct unary_op : operator_1 - { - template - struct apply : operator_1_inner - { - }; - }; - - // This type is what actually gets returned from operators used on - // self_t - template - struct operator_ - : def_visitor > - { - private: - template - void visit(ClassT& cl) const - { - typedef typename mpl::eval_if< - is_same - , mpl::if_< - is_same - , binary_op - , binary_op_l< - id - , BOOST_DEDUCED_TYPENAME unwrap_other::type - > - > - , mpl::if_< - is_same - , unary_op - , binary_op_r< - id - , BOOST_DEDUCED_TYPENAME unwrap_other::type - > - > - >::type generator; - - cl.def( - generator::name() - , &generator::template apply< - BOOST_DEDUCED_TYPENAME ClassT::wrapped_type - >::execute - ); - } - - friend class python::def_visitor_access; - }; -} - -# define BOOST_PYTHON_BINARY_OPERATION(id, rid, expr) \ -namespace detail \ -{ \ - template <> \ - struct operator_l \ - { \ - template \ - struct apply \ - { \ - static inline PyObject* execute(L& l, R const& r) \ - { \ - return detail::convert_result(expr); \ - } \ - }; \ - static char const* name() { return "__" #id "__"; } \ - }; \ - \ - template <> \ - struct operator_r \ - { \ - template \ - struct apply \ - { \ - static inline PyObject* execute(R& r, L const& l) \ - { \ - return detail::convert_result(expr); \ - } \ - }; \ - static char const* name() { return "__" #rid "__"; } \ - }; \ -} - -# define BOOST_PYTHON_BINARY_OPERATOR(id, rid, op) \ -BOOST_PYTHON_BINARY_OPERATION(id, rid, l op r) \ -namespace self_ns \ -{ \ - template \ - inline detail::operator_ \ - operator op(L const&, R const&) \ - { \ - return detail::operator_(); \ - } \ -} - -BOOST_PYTHON_BINARY_OPERATOR(add, radd, +) -BOOST_PYTHON_BINARY_OPERATOR(sub, rsub, -) -BOOST_PYTHON_BINARY_OPERATOR(mul, rmul, *) -BOOST_PYTHON_BINARY_OPERATOR(div, rdiv, /) -BOOST_PYTHON_BINARY_OPERATOR(mod, rmod, %) -BOOST_PYTHON_BINARY_OPERATOR(lshift, rlshift, <<) -BOOST_PYTHON_BINARY_OPERATOR(rshift, rrshift, >>) -BOOST_PYTHON_BINARY_OPERATOR(and, rand, &) -BOOST_PYTHON_BINARY_OPERATOR(xor, rxor, ^) -BOOST_PYTHON_BINARY_OPERATOR(or, ror, |) -BOOST_PYTHON_BINARY_OPERATOR(gt, lt, >) -BOOST_PYTHON_BINARY_OPERATOR(ge, le, >=) -BOOST_PYTHON_BINARY_OPERATOR(lt, gt, <) -BOOST_PYTHON_BINARY_OPERATOR(le, ge, <=) -BOOST_PYTHON_BINARY_OPERATOR(eq, eq, ==) -BOOST_PYTHON_BINARY_OPERATOR(ne, ne, !=) -# undef BOOST_PYTHON_BINARY_OPERATOR - -// pow isn't an operator in C++; handle it specially. -BOOST_PYTHON_BINARY_OPERATION(pow, rpow, pow(l,r)) -# undef BOOST_PYTHON_BINARY_OPERATION - -namespace self_ns -{ -# ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP - template - inline detail::operator_ - pow(L const&, R const&) - { - return detail::operator_(); - } -# else - // When there's no argument-dependent lookup, we need these - // overloads to handle the case when everything is imported into the - // global namespace. Note that the plain overload below does /not/ - // take const& arguments. This is needed by MSVC6 at least, or it - // complains of ambiguities, since there's no partial ordering. - inline detail::operator_ - pow(self_t, self_t) - { - return detail::operator_(); - } - template - inline detail::operator_ - pow(self_t const&, R const&) - { - return detail::operator_(); - } - template - inline detail::operator_ - pow(L const&, self_t const&) - { - return detail::operator_(); - } -# endif -} - - -# define BOOST_PYTHON_INPLACE_OPERATOR(id, op) \ -namespace detail \ -{ \ - template <> \ - struct operator_l \ - { \ - template \ - struct apply \ - { \ - static inline PyObject* \ - execute(back_reference l, R const& r) \ - { \ - l.get() op r; \ - return python::incref(l.source().ptr()); \ - } \ - }; \ - static char const* name() { return "__" #id "__"; } \ - }; \ -} \ -namespace self_ns \ -{ \ - template \ - inline detail::operator_ \ - operator op(self_t const&, R const&) \ - { \ - return detail::operator_(); \ - } \ -} - -BOOST_PYTHON_INPLACE_OPERATOR(iadd,+=) -BOOST_PYTHON_INPLACE_OPERATOR(isub,-=) -BOOST_PYTHON_INPLACE_OPERATOR(imul,*=) -BOOST_PYTHON_INPLACE_OPERATOR(idiv,/=) -BOOST_PYTHON_INPLACE_OPERATOR(imod,%=) -BOOST_PYTHON_INPLACE_OPERATOR(ilshift,<<=) -BOOST_PYTHON_INPLACE_OPERATOR(irshift,>>=) -BOOST_PYTHON_INPLACE_OPERATOR(iand,&=) -BOOST_PYTHON_INPLACE_OPERATOR(ixor,^=) -BOOST_PYTHON_INPLACE_OPERATOR(ior,|=) - -# define BOOST_PYTHON_UNARY_OPERATOR(id, op, func_name) \ -namespace detail \ -{ \ - template <> \ - struct operator_1 \ - { \ - template \ - struct apply \ - { \ - static PyObject* execute(T& x) \ - { \ - return detail::convert_result(op(x)); \ - } \ - }; \ - static char const* name() { return "__" #id "__"; } \ - }; \ -} \ -namespace self_ns \ -{ \ - inline detail::operator_ \ - func_name(self_t const&) \ - { \ - return detail::operator_(); \ - } \ -} -# undef BOOST_PYTHON_INPLACE_OPERATOR - -BOOST_PYTHON_UNARY_OPERATOR(neg, -, operator-) -BOOST_PYTHON_UNARY_OPERATOR(pos, +, operator+) -BOOST_PYTHON_UNARY_OPERATOR(abs, abs, abs) -BOOST_PYTHON_UNARY_OPERATOR(invert, ~, operator~) -BOOST_PYTHON_UNARY_OPERATOR(nonzero, !!, operator!) -BOOST_PYTHON_UNARY_OPERATOR(int, long, int_) -BOOST_PYTHON_UNARY_OPERATOR(long, PyLong_FromLong, long_) -BOOST_PYTHON_UNARY_OPERATOR(float, double, float_) -BOOST_PYTHON_UNARY_OPERATOR(complex, std::complex, complex_) -BOOST_PYTHON_UNARY_OPERATOR(str, lexical_cast, str) -# undef BOOST_PYTHON_UNARY_OPERATOR - -}} // namespace boost::python - -# ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP -using boost::python::self_ns::abs; -using boost::python::self_ns::int_; -using boost::python::self_ns::long_; -using boost::python::self_ns::float_; -using boost::python::self_ns::complex_; -using boost::python::self_ns::str; -using boost::python::self_ns::pow; -# endif - -#endif // OPERATORS_DWA2002530_HPP diff --git a/include/boost/python/other.hpp b/include/boost/python/other.hpp deleted file mode 100755 index eeece99b..00000000 --- a/include/boost/python/other.hpp +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef OTHER_DWA20020601_HPP -# define OTHER_DWA20020601_HPP - -# include -// Copyright David Abrahams 2002. -// 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 _MSC_VER+0 >= 1020 -# pragma once -# endif - -# include - -namespace boost { namespace python { - -template struct other -{ - typedef T type; -}; - -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -namespace detail -{ - template - class is_other - { - public: - BOOST_STATIC_CONSTANT(bool, value = false); - }; - - template - class is_other > - { - public: - BOOST_STATIC_CONSTANT(bool, value = true); - }; - - template - class unwrap_other - { - public: - typedef T type; - }; - - template - class unwrap_other > - { - public: - typedef T type; - }; -} -# else // no partial specialization - -}} // namespace boost::python - -#include - -namespace boost { namespace python { - -namespace detail -{ - typedef char (&yes_other_t)[1]; - typedef char (&no_other_t)[2]; - - no_other_t is_other_test(...); - - template - yes_other_t is_other_test(type< other >); - - template - struct other_unwrapper - { - template - struct apply - { - typedef T type; - }; - }; - - template<> - struct other_unwrapper - { - template - struct apply - { - typedef typename T::type type; - }; - }; - - template - class is_other - { - public: - BOOST_STATIC_CONSTANT( - bool, value = ( - sizeof(detail::is_other_test(type())) - == sizeof(detail::yes_other_t))); - }; - - template - class unwrap_other - : public detail::other_unwrapper< - is_other::value - >::template apply - {}; -} - -# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -}} // namespace boost::python - -#endif // #ifndef OTHER_DWA20020601_HPP diff --git a/include/boost/python/overloads.hpp b/include/boost/python/overloads.hpp deleted file mode 100644 index e60dc179..00000000 --- a/include/boost/python/overloads.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 OVERLOADS_DWA2002101_HPP -# define OVERLOADS_DWA2002101_HPP - -# include - -# include -# include - -#endif // OVERLOADS_DWA2002101_HPP diff --git a/include/boost/python/override.hpp b/include/boost/python/override.hpp deleted file mode 100755 index 29affd59..00000000 --- a/include/boost/python/override.hpp +++ /dev/null @@ -1,132 +0,0 @@ -#if !defined(BOOST_PP_IS_ITERATING) - -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef OVERRIDE_DWA2004721_HPP -# define OVERRIDE_DWA2004721_HPP - -# include - -# include - -# include -# include - -# include -# include -# include -# include -# include - -# include - -namespace boost { namespace python { - -class override; - -namespace detail -{ - class wrapper_base; - - // The result of calling a method. - class method_result - { - private: - friend class boost::python::override; - explicit method_result(PyObject* x) - : m_obj(x) - {} - - public: - template - operator T() - { - converter::return_from_python converter; - return converter(m_obj.release()); - } - -# if !defined(BOOST_MSVC) || BOOST_WORKAROUND(_MSC_FULL_VER, > 140040607) - template - operator T&() const - { - converter::return_from_python converter; - return converter(m_obj.release()); - } -# endif - - template - T as(type* = 0) - { - converter::return_from_python converter; - return converter(m_obj.release()); - } - - template - T unchecked(type* = 0) - { - return extract(m_obj)(); - } - private: - mutable handle<> m_obj; - }; -} - -class override : public object -{ - private: - friend class detail::wrapper_base; - override(handle<> x) - : object(x) - {} - - public: - detail::method_result - operator()() const - { - detail::method_result x( - PyEval_CallFunction( - this->ptr() - , const_cast("()") - )); - return x; - } - -# define BOOST_PYTHON_fast_arg_to_python_get(z, n, _) \ - , converter::arg_to_python(a##n).get() - -# define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PYTHON_MAX_ARITY, )) -# include BOOST_PP_ITERATE() - -# undef BOOST_PYTHON_fast_arg_to_python_get -}; - -}} // namespace boost::python - -#endif // OVERRIDE_DWA2004721_HPP - -#else -# if !(BOOST_WORKAROUND(__MWERKS__, > 0x3100) \ - && BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3201))) -# line BOOST_PP_LINE(__LINE__, override.hpp) -# endif - -# define N BOOST_PP_ITERATION() - -template < - BOOST_PP_ENUM_PARAMS_Z(1, N, class A) - > -detail::method_result -operator()( BOOST_PP_ENUM_BINARY_PARAMS_Z(1, N, A, const& a) ) const -{ - detail::method_result x( - PyEval_CallFunction( - this->ptr() - , const_cast("(" BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_FIXED, "O") ")") - BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_fast_arg_to_python_get, nil) - )); - return x; -} - -# undef N -#endif diff --git a/include/boost/python/pointee.hpp b/include/boost/python/pointee.hpp deleted file mode 100644 index ab8bb874..00000000 --- a/include/boost/python/pointee.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 POINTEE_DWA2002323_HPP -# define POINTEE_DWA2002323_HPP - -# include - -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - template - struct pointee_impl - { - template struct apply : remove_pointer {}; - }; - - template <> - struct pointee_impl - { - template struct apply - { - typedef typename T::element_type type; - }; - }; -} - -template -struct pointee - : detail::pointee_impl< - ::boost::is_pointer::value - >::template apply -{ -}; - -}} // namespace boost::python::detail - -#endif // POINTEE_DWA2002323_HPP diff --git a/include/boost/python/proxy.hpp b/include/boost/python/proxy.hpp deleted file mode 100755 index a01a08fe..00000000 --- a/include/boost/python/proxy.hpp +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 PROXY_DWA2002615_HPP -# define PROXY_DWA2002615_HPP -# include -# include -# include - -namespace boost { namespace python { namespace api { - -template -class proxy : public object_operators > -{ - typedef typename Policies::key_type key_type; - -# if !defined(BOOST_MSVC) || BOOST_MSVC > 1200 - typedef proxy const& assignment_self; -# else - typedef proxy assignment_self; -# endif - public: - proxy(object const& target, key_type const& key); - operator object() const; - - // to support a[b] = c[d] - proxy const& operator=(assignment_self) const; - - template - inline proxy const& operator=(T const& rhs) const - { - Policies::set(m_target, m_key, object(rhs)); - return *this; - } - - public: // implementation detail - void del() const; - - private: - object m_target; - key_type m_key; -}; - - -template -inline void del(proxy const& x) -{ - x.del(); -} - -// -// implementation -// - -template -inline proxy::proxy(object const& target, key_type const& key) - : m_target(target), m_key(key) -{} - -template -inline proxy::operator object() const -{ - return Policies::get(m_target, m_key); -} - -// to support a[b] = c[d] -template -inline proxy const& proxy::operator=(typename proxy::assignment_self rhs) const -{ - return *this = python::object(rhs); -} - -# define BOOST_PYTHON_PROXY_INPLACE(op) \ -template \ -proxy const& operator op(proxy const& lhs, R const& rhs) \ -{ \ - object old(lhs); \ - return lhs = (old op rhs); \ -} -BOOST_PYTHON_PROXY_INPLACE(+=) -BOOST_PYTHON_PROXY_INPLACE(-=) -BOOST_PYTHON_PROXY_INPLACE(*=) -BOOST_PYTHON_PROXY_INPLACE(/=) -BOOST_PYTHON_PROXY_INPLACE(%=) -BOOST_PYTHON_PROXY_INPLACE(<<=) -BOOST_PYTHON_PROXY_INPLACE(>>=) -BOOST_PYTHON_PROXY_INPLACE(&=) -BOOST_PYTHON_PROXY_INPLACE(^=) -BOOST_PYTHON_PROXY_INPLACE(|=) -# undef BOOST_PYTHON_PROXY_INPLACE - -template -inline void proxy::del() const -{ - Policies::del(m_target, m_key); -} - -}}} // namespace boost::python::api - -#endif // PROXY_DWA2002615_HPP diff --git a/include/boost/python/ptr.hpp b/include/boost/python/ptr.hpp deleted file mode 100644 index 94e3cfe2..00000000 --- a/include/boost/python/ptr.hpp +++ /dev/null @@ -1,128 +0,0 @@ -#ifndef PTR_DWA20020601_HPP -# define PTR_DWA20020601_HPP - -# include -// Copyright David Abrahams 2002. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// Based on boost/ref.hpp, thus: -// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi) -// Copyright (C) 2001 Peter Dimov - -# if _MSC_VER+0 >= 1020 -# pragma once -# endif - -# include -# include - -namespace boost { namespace python { - -template class pointer_wrapper -{ - public: - typedef Ptr type; - - explicit pointer_wrapper(Ptr x): p_(x) {} - operator Ptr() const { return p_; } - Ptr get() const { return p_; } - private: - Ptr p_; -}; - -template -inline pointer_wrapper ptr(T t) -{ - return pointer_wrapper(t); -} - -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template -class is_pointer_wrapper - : public mpl::false_ -{ -}; - -template -class is_pointer_wrapper > - : public mpl::true_ -{ -}; - -template -class unwrap_pointer -{ - public: - typedef T type; -}; - -template -class unwrap_pointer > -{ - public: - typedef T type; -}; -# else // no partial specialization - -}} // namespace boost::python - -#include - -namespace boost { namespace python { - -namespace detail -{ - typedef char (&yes_pointer_wrapper_t)[1]; - typedef char (&no_pointer_wrapper_t)[2]; - - no_pointer_wrapper_t is_pointer_wrapper_test(...); - - template - yes_pointer_wrapper_t is_pointer_wrapper_test(boost::type< pointer_wrapper >); - - template - struct pointer_unwrapper - { - template - struct apply - { - typedef T type; - }; - }; - - template<> - struct pointer_unwrapper - { - template - struct apply - { - typedef typename T::type type; - }; - }; -} - -template -class is_pointer_wrapper -{ - public: - BOOST_STATIC_CONSTANT( - bool, value = ( - sizeof(detail::is_pointer_wrapper_test(boost::type())) - == sizeof(detail::yes_pointer_wrapper_t))); - typedef mpl::bool_ type; -}; - -template -class unwrap_pointer - : public detail::pointer_unwrapper< - is_pointer_wrapper::value - >::template apply -{}; - -# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -}} // namespace boost::python - -#endif // #ifndef PTR_DWA20020601_HPP diff --git a/include/boost/python/pure_virtual.hpp b/include/boost/python/pure_virtual.hpp deleted file mode 100755 index 604cea50..00000000 --- a/include/boost/python/pure_virtual.hpp +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef PURE_VIRTUAL_DWA2003810_HPP -# define PURE_VIRTUAL_DWA2003810_HPP - -# include -# include -# include -# include - -# include - -namespace boost { namespace python { - -namespace detail -{ - // - // @group Helpers for pure_virtual_visitor. { - // - - // Raises a Python RuntimeError reporting that a pure virtual - // function was called. - void BOOST_PYTHON_DECL pure_virtual_called(); - - // Replace the two front elements of S with T1 and T2 - template - struct replace_front2 - { - // Metafunction forwarding seemed to confound vc6 - typedef typename mpl::push_front< - typename mpl::push_front< - typename mpl::pop_front< - typename mpl::pop_front< - S - >::type - >::type - , T2 - >::type - , T1 - >::type type; - }; - - // Given an MPL sequence representing a member function [object] - // signature, returns a new MPL sequence whose return type is - // replaced by void, and whose first argument is replaced by C&. - template - typename replace_front2::type - error_signature(S BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(C)) - { - typedef typename replace_front2::type r; - return r(); - } - - // - // } - // - - // - // A def_visitor which defines a method as usual, then adds a - // corresponding function which raises a "pure virtual called" - // exception unless it's been overridden. - // - template - struct pure_virtual_visitor - : def_visitor > - { - pure_virtual_visitor(PointerToMemberFunction pmf) - : m_pmf(pmf) - {} - -#if !BOOST_WORKAROUND(__EDG_VERSION__, <= 245) - private: -#endif - friend class def_visitor_access; - - template - void visit(C_& c, char const* name, Options& options) const - { - // This should probably be a nicer error message - BOOST_STATIC_ASSERT(!Options::has_default_implementation); - - // Add the virtual function dispatcher - c.def( - name - , m_pmf - , options.doc() - , options.keywords() - , options.policies() - ); - - typedef BOOST_DEDUCED_TYPENAME C_::metadata::held_type held_type; - - // Add the default implementation which raises the exception - c.def( - name - , make_function( - detail::nullary_function_adaptor(pure_virtual_called) - , default_call_policies() - , detail::error_signature(detail::get_signature(m_pmf)) - ) - ); - } - - private: // data members - PointerToMemberFunction m_pmf; - }; -} - -// -// Passed a pointer to member function, generates a def_visitor which -// creates a method that only dispatches to Python if the function has -// been overridden, either in C++ or in Python, raising a "pure -// virtual called" exception otherwise. -// -template -detail::pure_virtual_visitor -pure_virtual(PointerToMemberFunction pmf) -{ - return detail::pure_virtual_visitor(pmf); -} - -}} // namespace boost::python - -#endif // PURE_VIRTUAL_DWA2003810_HPP diff --git a/include/boost/python/raw_function.hpp b/include/boost/python/raw_function.hpp deleted file mode 100755 index 9d9f6b8b..00000000 --- a/include/boost/python/raw_function.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright David Abrahams 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef RAW_FUNCTION_DWA200336_HPP -# define RAW_FUNCTION_DWA200336_HPP - -# include - -# include -# include -# include -# include - -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - template - struct raw_dispatcher - { - raw_dispatcher(F f) : f(f) {} - - PyObject* operator()(PyObject* args, PyObject* keywords) - { - return incref( - object( - f( - tuple(borrowed_reference(args)) - , keywords ? dict(borrowed_reference(keywords)) : dict() - ) - ).ptr() - ); - } - - private: - F f; - }; - - object BOOST_PYTHON_DECL make_raw_function(objects::py_function); -} - -template -object raw_function(F f, std::size_t min_args = 0) -{ - return detail::make_raw_function( - objects::py_function( - detail::raw_dispatcher(f) - , mpl::vector1() - , min_args - , (std::numeric_limits::max)() - ) - ); -} - -}} // namespace boost::python - -#endif // RAW_FUNCTION_DWA200336_HPP diff --git a/include/boost/python/refcount.hpp b/include/boost/python/refcount.hpp deleted file mode 100755 index 5ba5433c..00000000 --- a/include/boost/python/refcount.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 REFCOUNT_DWA2002615_HPP -# define REFCOUNT_DWA2002615_HPP - -# include -# include - -namespace boost { namespace python { - -template -inline T* incref(T* p) -{ - Py_INCREF(python::upcast(p)); - return p; -} - -template -inline T* xincref(T* p) -{ - Py_XINCREF(python::upcast(p)); - return p; -} - -template -inline void decref(T* p) -{ - Py_DECREF(python::upcast(p)); -} - -template -inline void xdecref(T* p) -{ - Py_XDECREF(python::upcast(p)); -} - -}} // namespace boost::python - -#endif // REFCOUNT_DWA2002615_HPP diff --git a/include/boost/python/reference_existing_object.hpp b/include/boost/python/reference_existing_object.hpp deleted file mode 100644 index bb8ddf73..00000000 --- a/include/boost/python/reference_existing_object.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 REFERENCE_EXISTING_OBJECT_DWA200222_HPP -# define REFERENCE_EXISTING_OBJECT_DWA200222_HPP - -# include -# include -# include -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - template - struct reference_existing_object_requires_a_pointer_or_reference_return_type -# if defined(__GNUC__) && __GNUC__ >= 3 || defined(__EDG__) - {} -# endif - ; -} - -template struct to_python_value; - -struct reference_existing_object -{ - template - struct apply - { - BOOST_STATIC_CONSTANT( - bool, ok = is_pointer::value || is_reference::value); - - typedef typename mpl::if_c< - ok - , to_python_indirect - , detail::reference_existing_object_requires_a_pointer_or_reference_return_type - >::type type; - }; -}; - -}} // namespace boost::python - -#endif // REFERENCE_EXISTING_OBJECT_DWA200222_HPP diff --git a/include/boost/python/register_ptr_to_python.hpp b/include/boost/python/register_ptr_to_python.hpp deleted file mode 100644 index 7a22fe50..00000000 --- a/include/boost/python/register_ptr_to_python.hpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 REGISTER_PTR_TO_PYTHON_HPP -#define REGISTER_PTR_TO_PYTHON_HPP - -#include -#include -#include - -namespace boost { namespace python { - -template -void register_ptr_to_python(BOOST_EXPLICIT_TEMPLATE_TYPE(P)) -{ - typedef typename boost::python::pointee

::type X; - objects::class_value_wrapper< - P - , objects::make_ptr_instance< - X - , objects::pointer_holder - > - >(); -} - -}} // namespace boost::python - -#endif // REGISTER_PTR_TO_PYTHON_HPP - - diff --git a/include/boost/python/return_arg.hpp b/include/boost/python/return_arg.hpp deleted file mode 100755 index a6f651b6..00000000 --- a/include/boost/python/return_arg.hpp +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright David Abrahams and Nikolay Mladenov 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -#ifndef RETURN_ARG_DWA2003719_HPP -# define RETURN_ARG_DWA2003719_HPP -# include -# include -# include - -# include -# include - -# include - -# include -# include - -# include - -namespace boost { namespace python { - -namespace detail -{ - template - struct return_arg_pos_argument_must_be_positive -# if defined(__GNUC__) && __GNUC__ >= 3 || defined(__EDG__) - {} -# endif - ; - - struct return_none - { - template struct apply - { - struct type - { - static bool convertible() - { - return true; - } - - PyObject *operator()( typename value_arg::type ) const - { - return none(); - } - }; - }; - }; -} - -template < - std::size_t arg_pos=1 - , class Base = default_call_policies -> -struct return_arg : Base -{ - private: - BOOST_STATIC_CONSTANT(bool, legal = arg_pos > 0); - - public: - typedef typename mpl::if_c< - legal - , detail::return_none - , detail::return_arg_pos_argument_must_be_positive - // we could default to the base result_converter in case or - // arg_pos==0 since return arg 0 means return result, but I - // think it is better to issue an error instead, cause it can - // lead to confusions - >::type result_converter; - - template - static PyObject* postcall(ArgumentPackage const& args, PyObject* result) - { - // In case of arg_pos == 0 we could simply return Base::postcall, - // but this is redundant - BOOST_STATIC_ASSERT(arg_pos > 0); - - result = Base::postcall(args,result); - if (!result) - return 0; - Py_DECREF(result); - return incref( detail::get(mpl::int_(),args) ); - } -}; - -template < - class Base = default_call_policies - > -struct return_self - : return_arg<1,Base> -{}; - -}} // namespace boost::python - -#endif // RETURN_ARG_DWA2003719_HPP diff --git a/include/boost/python/return_by_value.hpp b/include/boost/python/return_by_value.hpp deleted file mode 100644 index 593fc59c..00000000 --- a/include/boost/python/return_by_value.hpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 BY_VALUE_DWA20021015_HPP -# define BY_VALUE_DWA20021015_HPP - -# include - -# include -# include -# include - -# include - -namespace boost { namespace python { - -struct return_by_value -{ - template - struct apply - { - typedef to_python_value< - typename detail::value_arg::type - > type; - }; -}; - -}} // namespace boost::python - -#endif // BY_VALUE_DWA20021015_HPP diff --git a/include/boost/python/return_internal_reference.hpp b/include/boost/python/return_internal_reference.hpp deleted file mode 100644 index acb89e6d..00000000 --- a/include/boost/python/return_internal_reference.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 RETURN_INTERNAL_REFERENCE_DWA2002131_HPP -# define RETURN_INTERNAL_REFERENCE_DWA2002131_HPP - -# include - -# include -# include -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - template - struct return_internal_reference_owner_arg_must_be_greater_than_zero -# if defined(__GNUC__) && __GNUC__ >= 3 || defined(__EDG__) - {} -# endif - ; -} - -template -struct return_internal_reference - : with_custodian_and_ward_postcall<0, owner_arg, BasePolicy_> -{ - private: - BOOST_STATIC_CONSTANT(bool, legal = owner_arg > 0); - public: - typedef typename mpl::if_c< - legal - , reference_existing_object - , detail::return_internal_reference_owner_arg_must_be_greater_than_zero - >::type result_converter; -}; - -}} // namespace boost::python - -#endif // RETURN_INTERNAL_REFERENCE_DWA2002131_HPP diff --git a/include/boost/python/return_opaque_pointer.hpp b/include/boost/python/return_opaque_pointer.hpp deleted file mode 100644 index daf9675b..00000000 --- a/include/boost/python/return_opaque_pointer.hpp +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright Gottfried Ganßauge 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -/* - * Generic Return value converter generator for opaque C++-pointers - */ -# ifndef RETURN_OPAQUE_POINTER_HPP_ -# define RETURN_OPAQUE_POINTER_HPP_ - -# include -# include -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - template - struct opaque_conversion_holder - { - inline PyObject *operator()(Pointer p) const - { - static opaque_pointer_converter converter ( - typeid (Pointer).name()); - - return converter.convert(p); - } - }; - - template - struct return_opaque_pointer_requires_a_pointer_type -# if defined(__GNUC__) && __GNUC__ >= 3 || defined(__EDG__) - {} -# endif - ; -} - -struct return_opaque_pointer -{ - template - struct apply - { - BOOST_STATIC_CONSTANT( - bool, ok = is_pointer::value); - - typedef typename mpl::if_c< - ok - , detail::opaque_conversion_holder - , detail::return_opaque_pointer_requires_a_pointer_type - >::type type; - }; -}; -}} // namespace boost::python -# endif // RETURN_OPAQUE_POINTER_HPP_ diff --git a/include/boost/python/return_value_policy.hpp b/include/boost/python/return_value_policy.hpp deleted file mode 100644 index 9a5fba38..00000000 --- a/include/boost/python/return_value_policy.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 RETURN_VALUE_POLICY_DWA2002131_HPP -# define RETURN_VALUE_POLICY_DWA2002131_HPP - -# include -# include - -namespace boost { namespace python { - -template -struct return_value_policy : BasePolicy_ -{ - typedef ResultConverterGenerator result_converter; -}; - -}} // namespace boost::python - -#endif // RETURN_VALUE_POLICY_DWA2002131_HPP diff --git a/include/boost/python/scope.hpp b/include/boost/python/scope.hpp deleted file mode 100644 index ae9a40a3..00000000 --- a/include/boost/python/scope.hpp +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 SCOPE_DWA2002724_HPP -# define SCOPE_DWA2002724_HPP - -# include -# include -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - // Making this a namespace-scope variable to avoid Cygwin issues. - // Use a PyObject* to avoid problems with static destruction after Py_Finalize - extern BOOST_PYTHON_DECL PyObject* current_scope; -} - -class scope - : public object -{ - public: - inline scope(scope const&); - inline scope(object const&); - inline scope(); - inline ~scope(); - - private: // data members - PyObject* m_previous_scope; - - private: // unimplemented functions - void operator=(scope const&); -}; - -inline scope::scope(object const& new_scope) - : object(new_scope) - , m_previous_scope(detail::current_scope) -{ - detail::current_scope = python::incref(new_scope.ptr()); -} - -inline scope::scope() - : object(detail::borrowed_reference( - detail::current_scope ? detail::current_scope : Py_None - )) - , m_previous_scope(python::xincref(detail::current_scope)) -{ -} - -inline scope::~scope() -{ - python::xdecref(detail::current_scope); - detail::current_scope = m_previous_scope; -} - -namespace converter -{ - template <> - struct object_manager_traits - : object_manager_traits - { - }; -} - -// Placing this after the specialization above suppresses a CWPro8.3 bug -inline scope::scope(scope const& new_scope) - : object(new_scope) - , m_previous_scope(detail::current_scope) -{ - detail::current_scope = python::incref(new_scope.ptr()); -} - -}} // namespace boost::python - -#endif // SCOPE_DWA2002724_HPP diff --git a/include/boost/python/self.hpp b/include/boost/python/self.hpp deleted file mode 100755 index 99ec5b8f..00000000 --- a/include/boost/python/self.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 SELF_DWA2002531_HPP -# define SELF_DWA2002531_HPP - -# include - -namespace boost { namespace python { - -#define BOOST_PYTHON_SELF_IS_CLASS - -// Sink self_t into its own namespace so that we have a safe place to -// put the completely general operator templates which operate on -// it. It is possible to avoid this, but it turns out to be much more -// complicated and finally GCC 2.95.2 chokes on it. -namespace self_ns -{ -# ifndef BOOST_PYTHON_SELF_IS_CLASS - enum self_t { self }; -# else - struct self_t {}; - extern BOOST_PYTHON_DECL self_t self; -# endif -} - -using self_ns::self_t; -using self_ns::self; - -}} // namespace boost::python - -#endif // SELF_DWA2002531_HPP diff --git a/include/boost/python/signature.hpp b/include/boost/python/signature.hpp deleted file mode 100644 index c4151814..00000000 --- a/include/boost/python/signature.hpp +++ /dev/null @@ -1,179 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright David Abrahams 2002, Joel de Guzman, 2002. -// 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) - -# ifndef SIGNATURE_JDG20020813_HPP -# define SIGNATURE_JDG20020813_HPP - -# include - -# include -# include - -# include -# include -# include -# include -# include -# include -# include -# include - -# include -# include -# include -# include - -# define BOOST_PYTHON_LIST_INC(n) \ - BOOST_PP_CAT(mpl::vector, BOOST_PP_INC(n)) - -/////////////////////////////////////////////////////////////////////////////// -namespace boost { namespace python { namespace detail { - -// A metafunction returning C1 if C1 is derived from C2, and C2 -// otherwise -template -struct most_derived -{ - typedef typename mpl::if_< - is_convertible - , C1 - , C2 - >::type type; -}; - -// The following macros generate expansions for:: -// -// template -// inline mpl::vector -// get_signature(RT(*)(T0...TN), void* = 0) -// { -// return mpl::list(); -// } -// -// And, for an appropriate assortment of cv-qualifications:: -// -// template -// inline mpl::vector -// get_signature(RT(ClassT::*)(T0...TN) cv)) -// { -// return mpl::list(); -// } -// -// template -// inline mpl::vector< -// RT -// , typename most_derived::type& -// , T0...TN -// > -// get_signature(RT(ClassT::*)(T0...TN) cv), Target*) -// { -// return mpl::list(); -// } -// -// There are two forms for invoking get_signature:: -// -// get_signature(f) -// -// and :: -// -// get_signature(f,(Target*)0) -// -// These functions extract the return type, class (for member -// functions) and arguments of the input signature and stuff them in -// an mpl type sequence. Note that cv-qualification is dropped from -// the "hidden this" argument of member functions; that is a -// necessary sacrifice to ensure that an lvalue from_python converter -// is used. A pointer is not used so that None will be rejected for -// overload resolution. -// -// The second form of get_signature essentially downcasts the "hidden -// this" argument of member functions to Target, because the function -// may actually be a member of a base class which is not wrapped, and -// in that case conversion from python would fail. -// -// @group { - -# define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, BOOST_PYTHON_MAX_ARITY, )) - -# include BOOST_PP_ITERATE() -# undef BOOST_PYTHON_LIST_INC - -// } - -}}} // namespace boost::python::detail - - -# endif // SIGNATURE_JDG20020813_HPP - -#elif BOOST_PP_ITERATION_DEPTH() == 1 // defined(BOOST_PP_IS_ITERATING) - -# define N BOOST_PP_ITERATION() - -template < - class RT BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class T)> -inline BOOST_PYTHON_LIST_INC(N)< - RT BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T)> -get_signature(RT(*)(BOOST_PP_ENUM_PARAMS_Z(1, N, T)), void* = 0) -{ - return BOOST_PYTHON_LIST_INC(N)< - RT BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T) - >(); -} - -# undef N - -# define BOOST_PP_ITERATION_PARAMS_2 \ - (3, (0, 3, )) -# include BOOST_PP_ITERATE() - -#else - -# define N BOOST_PP_RELATIVE_ITERATION(1) -# define Q BOOST_PYTHON_CV_QUALIFIER(BOOST_PP_ITERATION()) - -template < - class RT, class ClassT BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class T)> -inline BOOST_PYTHON_LIST_INC(BOOST_PP_INC(N))< - RT, ClassT& BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T)> -get_signature(RT(ClassT::*)(BOOST_PP_ENUM_PARAMS_Z(1, N, T)) Q) -{ - return BOOST_PYTHON_LIST_INC(BOOST_PP_INC(N))< - RT, ClassT& BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T) - >(); -} - -template < - class Target - , class RT - , class ClassT - BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, class T) -> -inline BOOST_PYTHON_LIST_INC(BOOST_PP_INC(N))< - RT - , typename most_derived::type& - BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T) -> -get_signature( - RT(ClassT::*)(BOOST_PP_ENUM_PARAMS_Z(1, N, T)) Q - , Target* -) -{ - return BOOST_PYTHON_LIST_INC(BOOST_PP_INC(N))< - RT - , BOOST_DEDUCED_TYPENAME most_derived::type& - BOOST_PP_ENUM_TRAILING_PARAMS_Z(1, N, T) - >(); -} - -# undef Q -# undef N - -#endif // !defined(BOOST_PP_IS_ITERATING) diff --git a/include/boost/python/slice.hpp b/include/boost/python/slice.hpp deleted file mode 100644 index 382ceb81..00000000 --- a/include/boost/python/slice.hpp +++ /dev/null @@ -1,266 +0,0 @@ -#ifndef BOOST_PYTHON_SLICE_JDB20040105_HPP -#define BOOST_PYTHON_SLICE_JDB20040105_HPP - -// Copyright (c) 2004 Jonathan Brandmeyer -// 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) - -#include -#include -#include -#include -#include - -#include - -#include -#include - -namespace boost { namespace python { - -namespace detail -{ - class BOOST_PYTHON_DECL slice_base : public object - { - public: - // Get the Python objects associated with the slice. In principle, these - // may be any arbitrary Python type, but in practice they are usually - // integers. If one or more parameter is ommited in the Python expression - // that created this slice, than that parameter is None here, and compares - // equal to a default-constructed boost::python::object. - // If a user-defined type wishes to support slicing, then support for the - // special meaning associated with negative indicies is up to the user. - object start() const; - object stop() const; - object step() const; - - protected: - explicit slice_base(PyObject*, PyObject*, PyObject*); - - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(slice_base, object) - }; -} - -class slice : public detail::slice_base -{ - typedef detail::slice_base base; - public: - // Equivalent to slice(::) - slice() : base(0,0,0) {} - - // Each argument must be slice_nil, or implicitly convertable to object. - // They should normally be integers. - template - slice( Integer1 start, Integer2 stop) - : base( object(start).ptr(), object(stop).ptr(), 0 ) - {} - - template - slice( Integer1 start, Integer2 stop, Integer3 stride) - : base( object(start).ptr(), object(stop).ptr(), object(stride).ptr() ) - {} - - // The following algorithm is intended to automate the process of - // determining a slice range when you want to fully support negative - // indicies and non-singular step sizes. Its functionallity is simmilar to - // PySlice_GetIndicesEx() in the Python/C API, but tailored for C++ users. - // This template returns a slice::range struct that, when used in the - // following iterative loop, will traverse a slice of the function's - // arguments. - // while (start != end) { - // do_foo(...); - // std::advance( start, step); - // } - // do_foo(...); // repeat exactly once more. - - // Arguments: a [begin, end) pair of STL-conforming random-access iterators. - - // Return: slice::range, where start and stop define a _closed_ interval - // that covers at most [begin, end-1] of the provided arguments, and a step - // that is non-zero. - - // Throws: error_already_set() if any of the indices are neither None nor - // integers, or the slice has a step value of zero. - // std::invalid_argument if the resulting range would be empty. Normally, - // you should catch this exception and return an empty sequence of the - // appropriate type. - - // Performance: constant time for random-access iterators. - - // Rationale: - // closed-interval: If an open interval were used, then for a non-singular - // value for step, the required state for the end iterator could be - // beyond the one-past-the-end postion of the specified range. While - // probably harmless, the behavior of STL-conforming iterators is - // undefined in this case. - // exceptions on zero-length range: It is impossible to define a closed - // interval over an empty range, so some other form of error checking - // would have to be used by the user to prevent undefined behavior. In - // the case where the user fails to catch the exception, it will simply - // be translated to Python by the default exception handling mechanisms. - - template - struct range - { - RandomAccessIterator start; - RandomAccessIterator stop; - typename iterator_difference::type step; - }; - - template - slice::range - get_indicies( const RandomAccessIterator& begin, - const RandomAccessIterator& end) const - { - // This is based loosely on PySlice_GetIndicesEx(), but it has been - // carefully crafted to ensure that these iterators never fall out of - // the range of the container. - slice::range ret; - - typedef typename iterator_difference::type difference_type; - difference_type max_dist = boost::detail::distance(begin, end); - - object slice_start = this->start(); - object slice_stop = this->stop(); - object slice_step = this->step(); - - // Extract the step. - if (slice_step == object()) { - ret.step = 1; - } - else { - ret.step = extract( slice_step); - if (ret.step == 0) { - PyErr_SetString( PyExc_IndexError, "step size cannot be zero."); - throw_error_already_set(); - } - } - - // Setup the start iterator. - if (slice_start == object()) { - if (ret.step < 0) { - ret.start = end; - --ret.start; - } - else - ret.start = begin; - } - else { - difference_type i = extract( slice_start); - if (i >= max_dist && ret.step > 0) - throw std::invalid_argument( "Zero-length slice"); - if (i >= 0) { - ret.start = begin; - BOOST_USING_STD_MIN(); - std::advance( ret.start, min BOOST_PREVENT_MACRO_SUBSTITUTION(i, max_dist-1)); - } - else { - if (i < -max_dist && ret.step < 0) - throw std::invalid_argument( "Zero-length slice"); - ret.start = end; - // Advance start (towards begin) not farther than begin. - std::advance( ret.start, (-i < max_dist) ? i : -max_dist ); - } - } - - // Set up the stop iterator. This one is a little trickier since slices - // define a [) range, and we are returning a [] range. - if (slice_stop == object()) { - if (ret.step < 0) { - ret.stop = begin; - } - else { - ret.stop = end; - std::advance( ret.stop, -1); - } - } - else { - difference_type i = extract(slice_stop); - // First, branch on which direction we are going with this. - if (ret.step < 0) { - if (i+1 >= max_dist || i == -1) - throw std::invalid_argument( "Zero-length slice"); - - if (i >= 0) { - ret.stop = begin; - std::advance( ret.stop, i+1); - } - else { // i is negative, but more negative than -1. - ret.stop = end; - std::advance( ret.stop, (-i < max_dist) ? i : -max_dist); - } - } - else { // stepping forward - if (i == 0 || -i >= max_dist) - throw std::invalid_argument( "Zero-length slice"); - - if (i > 0) { - ret.stop = begin; - std::advance( ret.stop, (std::min)( i-1, max_dist-1)); - } - else { // i is negative, but not more negative than -max_dist - ret.stop = end; - std::advance( ret.stop, i-1); - } - } - } - - // Now the fun part, handling the possibilites surrounding step. - // At this point, step has been initialized, ret.stop, and ret.step - // represent the widest possible range that could be traveled - // (inclusive), and final_dist is the maximum distance covered by the - // slice. - typename iterator_difference::type final_dist = - boost::detail::distance( ret.start, ret.stop); - - // First case, if both ret.start and ret.stop are equal, then step - // is irrelevant and we can return here. - if (final_dist == 0) - return ret; - - // Second, if there is a sign mismatch, than the resulting range and - // step size conflict: std::advance( ret.start, ret.step) goes away from - // ret.stop. - if ((final_dist > 0) != (ret.step > 0)) - throw std::invalid_argument( "Zero-length slice."); - - // Finally, if the last step puts us past the end, we move ret.stop - // towards ret.start in the amount of the remainder. - // I don't remember all of the oolies surrounding negative modulii, - // so I am handling each of these cases separately. - if (final_dist < 0) { - difference_type remainder = -final_dist % -ret.step; - std::advance( ret.stop, remainder); - } - else { - difference_type remainder = final_dist % ret.step; - std::advance( ret.stop, -remainder); - } - - return ret; - } - - public: - // This declaration, in conjunction with the specialization of - // object_manager_traits<> below, allows C++ functions accepting slice - // arguments to be called from from Python. These constructors should never - // be used in client code. - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(slice, detail::slice_base) -}; - - -namespace converter { - -template<> -struct object_manager_traits - : pytype_object_manager_traits<&PySlice_Type, slice> -{ -}; - -} // !namesapce converter - -} } // !namespace ::boost::python - - -#endif // !defined BOOST_PYTHON_SLICE_JDB20040105_HPP diff --git a/include/boost/python/slice_nil.hpp b/include/boost/python/slice_nil.hpp deleted file mode 100644 index e911f068..00000000 --- a/include/boost/python/slice_nil.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 SLICE_NIL_DWA2002620_HPP -# define SLICE_NIL_DWA2002620_HPP - -# include -# include - -namespace boost { namespace python { namespace api { - -class slice_nil : public object -{ - public: - slice_nil() : object() {} -}; - -# ifndef _ // Watch out for GNU gettext users, who #define _(x) -static const slice_nil _ = slice_nil(); -# endif - -template -struct slice_bound -{ - typedef object type; -}; - -template <> -struct slice_bound -{ - typedef slice_nil type; -}; - -} - -using api::slice_nil; -# ifndef _ // Watch out for GNU gettext users, who #define _(x) -using api::_; -# endif - -}} // namespace boost::python - -#endif // SLICE_NIL_DWA2002620_HPP diff --git a/include/boost/python/str.hpp b/include/boost/python/str.hpp deleted file mode 100644 index 86bc3ba6..00000000 --- a/include/boost/python/str.hpp +++ /dev/null @@ -1,414 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 STR_20020703_HPP -#define STR_20020703_HPP - -# include - -#include -#include -#include - -// disable defines in provided by some system libraries -#undef isspace -#undef islower -#undef isalpha -#undef isdigit -#undef isalnum -#undef isupper - -namespace boost { namespace python { - -class str; - -namespace detail -{ - struct BOOST_PYTHON_DECL str_base : object - { - str capitalize() const; - - str center(object_cref width) const; - - long count(object_cref sub) const; - - long count(object_cref sub, object_cref start) const; - - long count(object_cref sub, object_cref start, object_cref end) const; - - object decode() const; - object decode(object_cref encoding) const; - - object decode(object_cref encoding, object_cref errors) const; - - object encode() const; - object encode(object_cref encoding) const; - object encode(object_cref encoding, object_cref errors) const; - - bool endswith(object_cref suffix) const; - - bool endswith(object_cref suffix, object_cref start) const; - bool endswith(object_cref suffix, object_cref start, object_cref end) const; - - str expandtabs() const; - str expandtabs(object_cref tabsize) const; - - long find(object_cref sub) const; - long find(object_cref sub, object_cref start) const; - - long find(object_cref sub, object_cref start, object_cref end) const; - - long index(object_cref sub) const; - - long index(object_cref sub, object_cref start) const; - long index(object_cref sub, object_cref start, object_cref end) const; - - bool isalnum() const; - bool isalpha() const; - bool isdigit() const; - bool islower() const; - bool isspace() const; - bool istitle() const; - bool isupper() const; - - str join(object_cref sequence) const; - - str ljust(object_cref width) const; - str lower() const; - str lstrip() const; - - str replace(object_cref old, object_cref new_) const; - str replace(object_cref old, object_cref new_, object_cref maxsplit) const; - long rfind(object_cref sub) const; - - long rfind(object_cref sub, object_cref start) const; - - long rfind(object_cref sub, object_cref start, object_cref end) const; - long rindex(object_cref sub) const; - long rindex(object_cref sub, object_cref start) const; - - - long rindex(object_cref sub, object_cref start, object_cref end) const; - - str rjust(object_cref width) const; - - str rstrip() const; - - list split() const; - list split(object_cref sep) const; - - list split(object_cref sep, object_cref maxsplit) const; - - - list splitlines() const; - list splitlines(object_cref keepends) const; - - bool startswith(object_cref prefix) const; - - - bool startswith(object_cref prefix, object_cref start) const; - bool startswith(object_cref prefix, object_cref start, object_cref end) const; - - str strip() const; - str swapcase() const; - str title() const; - - str translate(object_cref table) const; - - str translate(object_cref table, object_cref deletechars) const; - - - str upper() const; - - protected: - str_base(); // new str - - str_base(const char* s); // new str - - str_base(char const* start, char const* finish); - - str_base(char const* start, std::size_t length); - - explicit str_base(object_cref other); - - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(str_base, object) - private: - static new_reference call(object const&); - }; -} - - -class str : public detail::str_base -{ - typedef detail::str_base base; - public: - str() {} // new str - - str(const char* s) : base(s) {} // new str - - str(char const* start, char const* finish) // new str - : base(start, finish) - {} - - str(char const* start, std::size_t length) // new str - : base(start, length) - {} - - template - explicit str(T const& other) - : base(object(other)) - { - } - - template - str center(T const& width) const - { - return base::center(object(width)); - } - - template - long count(T const& sub) const - { - return base::count(object(sub)); - } - - template - long count(T1 const& sub,T2 const& start) const - { - return base::count(object(sub), object(start)); - } - - template - long count(T1 const& sub,T2 const& start, T3 const& end) const - { - return base::count(object(sub), object(start)); - } - - object decode() const { return base::decode(); } - - template - object decode(T const& encoding) const - { - return base::decode(object(encoding)); - } - - template - object decode(T1 const& encoding, T2 const& errors) const - { - return base::decode(object(encoding),object(errors)); - } - - object encode() const { return base::encode(); } - - template - object encode(T const& encoding) const - { - return base::encode(object(encoding)); - } - - template - object encode(T1 const& encoding, T2 const& errors) const - { - return base::encode(object(encoding),object(errors)); - } - - template - bool endswith(T const& suffix) const - { - return base::endswith(object(suffix)); - } - - template - bool endswith(T1 const& suffix, T2 const& start) const - { - return base::endswith(object(suffix), object(start)); - } - - template - bool endswith(T1 const& suffix, T2 const& start, T3 const& end) const - { - return base::endswith(object(suffix), object(start), object(end)); - } - - str expandtabs() const { return base::expandtabs(); } - - template - str expandtabs(T const& tabsize) const - { - return base::expandtabs(object(tabsize)); - } - - template - long find(T const& sub) const - { - return base::find(object(sub)); - } - - template - long find(T1 const& sub, T2 const& start) const - { - return base::find(object(sub), object(start)); - } - - template - long find(T1 const& sub, T2 const& start, T3 const& end) const - { - return base::find(object(sub), object(start), object(end)); - } - - template - long index(T const& sub) const - { - return base::index(object(sub)); - } - - template - long index(T1 const& sub, T2 const& start) const - { - return base::index(object(sub), object(start)); - } - - template - long index(T1 const& sub, T2 const& start, T3 const& end) const - { - return base::index(object(sub), object(start), object(end)); - } - - template - str join(T const& sequence) const - { - return base::join(object(sequence)); - } - - template - str ljust(T const& width) const - { - return base::ljust(object(width)); - } - - template - str replace(T1 const& old, T2 const& new_) const - { - return base::replace(object(old),object(new_)); - } - - template - str replace(T1 const& old, T2 const& new_, T3 const& maxsplit) const - { - return base::replace(object(old),object(new_), object(maxsplit)); - } - - template - long rfind(T const& sub) const - { - return base::rfind(object(sub)); - } - - template - long rfind(T1 const& sub, T2 const& start) const - { - return base::rfind(object(sub), object(start)); - } - - template - long rfind(T1 const& sub, T2 const& start, T3 const& end) const - { - return base::rfind(object(sub), object(start), object(end)); - } - - template - long rindex(T const& sub) const - { - return base::rindex(object(sub)); - } - - template - long rindex(T1 const& sub, T2 const& start) const - { - return base::rindex(object(sub), object(start)); - } - - template - long rindex(T1 const& sub, T2 const& start, T3 const& end) const - { - return base::rindex(object(sub), object(start), object(end)); - } - - template - str rjust(T const& width) const - { - return base::rjust(object(width)); - } - - list split() const { return base::split(); } - - template - list split(T const& sep) const - { - return base::split(object(sep)); - } - - template - list split(T1 const& sep, T2 const& maxsplit) const - { - return base::split(object(sep), object(maxsplit)); - } - - list splitlines() const { return base::splitlines(); } - - template - list splitlines(T const& keepends) const - { - return base::splitlines(object(keepends)); - } - - template - bool startswith(T const& prefix) const - { - return base::startswith(object(prefix)); - } - - template - bool startswith(T1 const& prefix, T2 const& start) const - { - return base::startswith(object(prefix), object(start)); - } - - template - bool startswith(T1 const& prefix, T2 const& start, T3 const& end) const - { - return base::startswith(object(prefix), object(start), object(end)); - } - - template - str translate(T const& table) const - { - return base::translate(object(table)); - } - - template - str translate(T1 const& table, T2 const& deletechars) const - { - return base::translate(object(table), object(deletechars)); - } - - public: // implementation detail -- for internal use only - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(str, base) -}; - -// -// Converter Specializations -// -namespace converter -{ - template <> - struct object_manager_traits - : pytype_object_manager_traits<&PyString_Type,str> - { - }; -} - -}} // namespace boost::python - -#endif // STR_20020703_HPP diff --git a/include/boost/python/suite/indexing/container_utils.hpp b/include/boost/python/suite/indexing/container_utils.hpp deleted file mode 100644 index a25185d0..00000000 --- a/include/boost/python/suite/indexing/container_utils.hpp +++ /dev/null @@ -1,52 +0,0 @@ - -// (C) Copyright Joel de Guzman 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef PY_CONTAINER_UTILS_JDG20038_HPP -# define PY_CONTAINER_UTILS_JDG20038_HPP - -# include -# include -# include - -namespace boost { namespace python { namespace container_utils { - - template - void - extend_container(Container& container, object l) - { - typedef typename Container::value_type data_type; - - // l must be a list or some container - - for (int i = 0; i < l.attr("__len__")(); i++) - { - object elem(l[i]); - extract x(elem); - // try if elem is an exact data_type type - if (x.check()) - { - container.push_back(x()); - } - else - { - // try to convert elem to data_type type - extract x(elem); - if (x.check()) - { - container.push_back(x()); - } - else - { - PyErr_SetString(PyExc_TypeError, "Incompatible Data Type"); - throw_error_already_set(); - } - } - } - } - -}}} // namespace boost::python::container_utils - -#endif diff --git a/include/boost/python/suite/indexing/detail/indexing_suite_detail.hpp b/include/boost/python/suite/indexing/detail/indexing_suite_detail.hpp deleted file mode 100644 index 34a4096a..00000000 --- a/include/boost/python/suite/indexing/detail/indexing_suite_detail.hpp +++ /dev/null @@ -1,742 +0,0 @@ -// (C) Copyright Joel de Guzman 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef INDEXING_SUITE_DETAIL_JDG20036_HPP -# define INDEXING_SUITE_DETAIL_JDG20036_HPP - -# include -# include -# include -# include -# include -# include -# include -#include - -namespace boost { namespace python { namespace detail { - -#if defined(NDEBUG) -#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT -#else -#define BOOST_PYTHON_INDEXING_CHECK_INVARIANT check_invariant() -#endif - - template - struct compare_proxy_index - { - // This functor compares a proxy and an index. - // This is used by proxy_group::first_proxy to - // get first proxy with index i. - - template - bool operator()(PyObject* prox, Index i) const - { - typedef typename Proxy::policies_type policies_type; - Proxy& proxy = extract(prox)(); - return policies_type:: - compare_index(proxy.get_container(), proxy.get_index(), i); - } - }; - - // The proxy_group class holds a vector of container element - // proxies. First, what is a container element proxy? A container - // element proxy acts like a smart pointer holding a reference to - // a container and an index (see container_element, for details). - // - // The proxies are held in a vector always sorted by its index. - // Various functions manage the addition, removal and searching - // of proxies from the vector. - // - template - class proxy_group - { - public: - - typedef typename std::vector::const_iterator const_iterator; - typedef typename std::vector::iterator iterator; - typedef typename Proxy::index_type index_type; - typedef typename Proxy::policies_type policies_type; - - iterator - first_proxy(index_type i) - { - // Return the first proxy with index <= i - return boost::detail::lower_bound( - proxies.begin(), proxies.end(), - i, compare_proxy_index()); - } - - void - remove(Proxy& proxy) - { - // Remove a proxy - for (iterator iter = first_proxy(proxy.get_index()); - iter != proxies.end(); ++iter) - { - if (&extract(*iter)() == &proxy) - { - proxies.erase(iter); - break; - } - } - BOOST_PYTHON_INDEXING_CHECK_INVARIANT; - } - - void - add(PyObject* prox) - { - BOOST_PYTHON_INDEXING_CHECK_INVARIANT; - // Add a proxy - proxies.insert( - first_proxy(extract(prox)().get_index()), prox); - BOOST_PYTHON_INDEXING_CHECK_INVARIANT; - } - - void - erase(index_type i, mpl::false_) - { - BOOST_PYTHON_INDEXING_CHECK_INVARIANT; - // Erase the proxy with index i - replace(i, i+1, 0); - BOOST_PYTHON_INDEXING_CHECK_INVARIANT; - } - - void - erase(index_type i, mpl::true_) - { - BOOST_PYTHON_INDEXING_CHECK_INVARIANT; - // Erase the proxy with index i - - iterator iter = first_proxy(i); - extract p(*iter); - - if (iter != proxies.end() && p().get_index() == i) - { - extract p(*iter); - p().detach(); - proxies.erase(iter); - } - BOOST_PYTHON_INDEXING_CHECK_INVARIANT; - } - - void - erase(index_type from, index_type to) - { - // note: this cannot be called when container is not sliceable - - BOOST_PYTHON_INDEXING_CHECK_INVARIANT; - // Erase all proxies with indexes from..to - replace(from, to, 0); - BOOST_PYTHON_INDEXING_CHECK_INVARIANT; - } - - void - replace( - index_type from, - index_type to, - typename std::vector::size_type len) - { - // note: this cannot be called when container is not sliceable - - BOOST_PYTHON_INDEXING_CHECK_INVARIANT; - // Erase all proxies with indexes from..to. - // Adjust the displaced indexes such that the - // final effect is that we have inserted *len* - // number of proxies in the vacated region. This - // procedure involves adjusting the indexes of - // the proxies. - - iterator left = first_proxy(from); - iterator right = proxies.end(); // we'll adjust this later - - for (iterator iter = left; iter != right; ++iter) - { - if (extract(*iter)().get_index() > to) - { - right = iter; // adjust right - break; - } - extract p(*iter); - p().detach(); - } - - typename std::vector::size_type - offset = left-proxies.begin(); - proxies.erase(left, right); - right = proxies.begin()+offset; - - while (right != proxies.end()) - { - typedef typename Proxy::container_type::difference_type difference_type; - extract p(*right); - p().set_index( - extract(*right)().get_index() - - (difference_type(to) - from - len) - ); - - ++right; - } - BOOST_PYTHON_INDEXING_CHECK_INVARIANT; - } - - PyObject* - find(index_type i) - { - BOOST_PYTHON_INDEXING_CHECK_INVARIANT; - // Find the proxy with *exact* index i. - // Return 0 (null) if no proxy with the - // given index is found. - iterator iter = first_proxy(i); - if (iter != proxies.end() - && extract(*iter)().get_index() == i) - { - BOOST_PYTHON_INDEXING_CHECK_INVARIANT; - return *iter; - } - BOOST_PYTHON_INDEXING_CHECK_INVARIANT; - return 0; - } - - typename std::vector::size_type - size() const - { - BOOST_PYTHON_INDEXING_CHECK_INVARIANT; - // How many proxies are there so far? - return proxies.size(); - } - - private: - -#if !defined(NDEBUG) - void - check_invariant() const - { - for (const_iterator i = proxies.begin(); i != proxies.end(); ++i) - { - if ((*i)->ob_refcnt <= 0) - { - PyErr_SetString(PyExc_RuntimeError, - "Invariant: Proxy vector in an inconsistent state"); - throw_error_already_set(); - } - - if (i+1 != proxies.end()) - { - if (extract(*(i+1))().get_index() == - extract(*(i))().get_index()) - { - PyErr_SetString(PyExc_RuntimeError, - "Invariant: Proxy vector in an inconsistent state (duplicate proxy)"); - throw_error_already_set(); - } - } - } - } -#endif - - std::vector proxies; - }; - - // proxy_links holds a map of Container pointers (keys) - // with proxy_group(s) (data). Various functions manage - // the addition, removal and searching of proxies from - // the map. - // - template - class proxy_links - { - public: - - typedef std::map > links_t; - typedef typename Proxy::index_type index_type; - - void - remove(Proxy& proxy) - { - // Remove a proxy. - typename links_t::iterator r = links.find(&proxy.get_container()); - if (r != links.end()) - { - r->second.remove(proxy); - if (r->second.size() == 0) - links.erase(r); - } - } - - void - add(PyObject* prox, Container& container) - { - // Add a proxy - links[&container].add(prox); - } - - template - void erase(Container& container, index_type i, NoSlice no_slice) - { - // Erase the proxy with index i - typename links_t::iterator r = links.find(&container); - if (r != links.end()) - { - r->second.erase(i, no_slice); - if (r->second.size() == 0) - links.erase(r); - } - } - - void - erase(Container& container, index_type from, index_type to) - { - // Erase all proxies with indexes from..to - typename links_t::iterator r = links.find(&container); - if (r != links.end()) - { - r->second.erase(from, to); - if (r->second.size() == 0) - links.erase(r); - } - } - - void - replace( - Container& container, - index_type from, index_type to, index_type len) - { - // Erase all proxies with indexes from..to. - // Adjust the displaced indexes such that the - // final effect is that we have inserted *len* - // number of proxies in the vacated region. This - // procedure involves adjusting the indexes of - // the proxies. - - typename links_t::iterator r = links.find(&container); - if (r != links.end()) - { - r->second.replace(from, to, len); - if (r->second.size() == 0) - links.erase(r); - } - } - - PyObject* - find(Container& container, index_type i) - { - // Find the proxy with *exact* index i. - // Return 0 (null) if no proxy with the given - // index is found. - typename links_t::iterator r = links.find(&container); - if (r != links.end()) - return r->second.find(i); - return 0; - } - - private: - - links_t links; - }; - - // container_element is our container proxy class. - // This class acts like a smart pointer to a container - // element. The class holds an index and a reference to - // a container. Dereferencing the smart pointer will - // retrieve the nth (index) element from the container. - // - // A container_element can also be detached from the - // container. In such a detached state, the container_element - // holds a copy of the nth (index) element, which it - // returns when dereferenced. - // - template - class container_element - { - public: - - typedef Index index_type; - typedef Container container_type; - typedef typename Policies::data_type element_type; - typedef Policies policies_type; - typedef container_element self_t; - typedef proxy_group links_type; - - container_element(object container, Index index) - : ptr() - , container(container) - , index(index) - { - } - - container_element(container_element const& ce) - : ptr(ce.ptr.get() == 0 ? 0 : new element_type(*ce.ptr.get())) - , container(ce.container) - , index(ce.index) - { - } - - ~container_element() - { - if (!is_detached()) - get_links().remove(*this); - } - - element_type& operator*() const - { - if (is_detached()) - return *get_pointer(ptr); - return Policies::get_item(get_container(), index); - } - - element_type* get() const - { - if (is_detached()) - return get_pointer(ptr); - return &Policies::get_item(get_container(), index); - } - - void - detach() - { - if (!is_detached()) - { - ptr.reset( - new element_type( - Policies::get_item(get_container(), index))); - container = object(); // free container. reset it to None - } - } - - bool - is_detached() const - { - return get_pointer(ptr) != 0; - } - - Container& - get_container() const - { - return extract(container)(); - } - - Index - get_index() const - { - return index; - } - - void - set_index(Index i) - { - index = i; - } - - static proxy_links& - get_links() - { - // All container_element(s) maintain links to - // its container in a global map (see proxy_links). - // This global "links" map is a singleton. - - static proxy_links links; - return links; // singleton - } - - private: - - container_element& operator=(container_element const& ce); - - scoped_ptr ptr; - object container; - Index index; - }; - - template < - class Container - , class DerivedPolicies - , class ContainerElement - , class Index - > - struct no_proxy_helper - { - static void - register_container_element() - { - } - - static object - base_get_item_(back_reference const& container, PyObject* i) - { - return object( - DerivedPolicies::get_item( - container.get(), DerivedPolicies:: - convert_index(container.get(), i))); - } - - static void - base_replace_indexes( - Container& container, Index from, - Index to, Index n) - { - } - - template - static void - base_erase_index( - Container& container, Index i, NoSlice no_slice) - { - } - - static void - base_erase_indexes(Container& container, Index from, Index to) - { - } - }; - - template < - class Container - , class DerivedPolicies - , class ContainerElement - , class Index - > - struct proxy_helper - { - static void - register_container_element() - { - register_ptr_to_python(); - } - - static object - base_get_item_(back_reference const& container, PyObject* i) - { - // Proxy - Index idx = DerivedPolicies::convert_index(container.get(), i); - - if (PyObject* shared = - ContainerElement::get_links().find(container.get(), idx)) - { - handle<> h(python::borrowed(shared)); - return object(h); - } - else - { - object prox(ContainerElement(container.source(), idx)); - ContainerElement:: - get_links().add(prox.ptr(), container.get()); - return prox; - } - } - - static void - base_replace_indexes( - Container& container, Index from, - Index to, Index n) - { - ContainerElement::get_links().replace(container, from, to, n); - } - - template - static void - base_erase_index( - Container& container, Index i, NoSlice no_slice) - { - ContainerElement::get_links().erase(container, i, no_slice); - } - - static void - base_erase_indexes( - Container& container, Index from, Index to) - { - ContainerElement::get_links().erase(container, from, to); - } - }; - - template < - class Container - , class DerivedPolicies - , class ProxyHandler - , class Data - , class Index - > - struct slice_helper - { - static object - base_get_slice(Container& container, PySliceObject* slice) - { - Index from, to; - base_get_slice_data(container, slice, from, to); - return DerivedPolicies::get_slice(container, from, to); - } - - static void - base_get_slice_data( - Container& container, PySliceObject* slice, Index& from_, Index& to_) - { - if (Py_None != slice->step) { - PyErr_SetString( PyExc_IndexError, "slice step size not supported."); - throw_error_already_set(); - } - - Index min_index = DerivedPolicies::get_min_index(container); - Index max_index = DerivedPolicies::get_max_index(container); - - if (Py_None == slice->start) { - from_ = min_index; - } - else { - long from = extract( slice->start); - if (from < 0) // Negative slice index - from += max_index; - if (from < 0) // Clip lower bounds to zero - from = 0; - from_ = boost::numeric_cast(from); - if (from_ > max_index) // Clip upper bounds to max_index. - from_ = max_index; - } - - if (Py_None == slice->stop) { - to_ = max_index; - } - else { - long to = extract( slice->stop); - if (to < 0) - to += max_index; - if (to < 0) - to = 0; - to_ = boost::numeric_cast(to); - if (to_ > max_index) - to_ = max_index; - } - } - - static void - base_set_slice(Container& container, PySliceObject* slice, PyObject* v) - { - Index from, to; - base_get_slice_data(container, slice, from, to); - - extract elem(v); - // try if elem is an exact Data - if (elem.check()) - { - ProxyHandler::base_replace_indexes(container, from, to, 1); - DerivedPolicies::set_slice(container, from, to, elem()); - } - else - { - // try to convert elem to Data - extract elem(v); - if (elem.check()) - { - ProxyHandler::base_replace_indexes(container, from, to, 1); - DerivedPolicies::set_slice(container, from, to, elem()); - } - else - { - // Otherwise, it must be a list or some container - handle<> l_(python::borrowed(v)); - object l(l_); - - std::vector temp; - for (int i = 0; i < l.attr("__len__")(); i++) - { - object elem(l[i]); - extract x(elem); - // try if elem is an exact Data type - if (x.check()) - { - temp.push_back(x()); - } - else - { - // try to convert elem to Data type - extract x(elem); - if (x.check()) - { - temp.push_back(x()); - } - else - { - PyErr_SetString(PyExc_TypeError, - "Invalid sequence element"); - throw_error_already_set(); - } - } - } - - ProxyHandler::base_replace_indexes(container, from, to, - temp.end()-temp.begin()); - DerivedPolicies::set_slice(container, from, to, - temp.begin(), temp.end()); - } - } - } - - static void - base_delete_slice(Container& container, PySliceObject* slice) - { - Index from, to; - base_get_slice_data(container, slice, from, to); - ProxyHandler::base_erase_indexes(container, from, to); - DerivedPolicies::delete_slice(container, from, to); - } - }; - - template < - class Container - , class DerivedPolicies - , class ProxyHandler - , class Data - , class Index - > - struct no_slice_helper - { - static void - slicing_not_suported() - { - PyErr_SetString(PyExc_RuntimeError, "Slicing not supported"); - throw_error_already_set(); - } - - static object - base_get_slice(Container& container, PySliceObject* slice) - { - slicing_not_suported(); - return object(); - } - - static void - base_set_slice(Container& container, PySliceObject* slice, PyObject* v) - { - slicing_not_suported(); - } - - static void - base_delete_slice(Container& container, PySliceObject* slice) - { - slicing_not_suported(); - } - }; - -#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP -}} // namespace python::detail -#endif - - template - inline typename Policies::data_type* - get_pointer( - python::detail::container_element const& p) - { - // Get the pointer of a container_element smart pointer - return p.get(); - } - -#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP - // Don't hide these other get_pointer overloads - using boost::python::get_pointer; - using boost::get_pointer; -}} // namespace python::detail -#endif - -} // namespace boost - -#endif // INDEXING_SUITE_DETAIL_JDG20036_HPP diff --git a/include/boost/python/suite/indexing/indexing_suite.hpp b/include/boost/python/suite/indexing/indexing_suite.hpp deleted file mode 100644 index 078a317b..00000000 --- a/include/boost/python/suite/indexing/indexing_suite.hpp +++ /dev/null @@ -1,293 +0,0 @@ -// (C) Copyright Joel de Guzman 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef INDEXING_SUITE_JDG20036_HPP -# define INDEXING_SUITE_JDG20036_HPP - -# include -# include -# include -# include -# include -# include -# include -# include - -namespace boost { namespace python { - - // indexing_suite class. This class is the protocol class for - // the management of C++ containers intended to be integrated - // to Python. The objective is make a C++ container look and - // feel and behave exactly as we'd expect a Python container. - // By default indexed elements are returned by proxy. This can be - // disabled by supplying *true* in the NoProxy template parameter. - // - // Derived classes provide the hooks needed by the indexing_suite - // to do its job: - // - // static data_type& - // get_item(Container& container, index_type i); - // - // static object - // get_slice(Container& container, index_type from, index_type to); - // - // static void - // set_item(Container& container, index_type i, data_type const& v); - // - // static void - // set_slice( - // Container& container, index_type from, - // index_type to, data_type const& v - // ); - // - // template - // static void - // set_slice(Container& container, index_type from, - // index_type to, Iter first, Iter last - // ); - // - // static void - // delete_item(Container& container, index_type i); - // - // static void - // delete_slice(Container& container, index_type from, index_type to); - // - // static size_t - // size(Container& container); - // - // template - // static bool - // contains(Container& container, T const& val); - // - // static index_type - // convert_index(Container& container, PyObject* i); - // - // static index_type - // adjust_index(index_type current, index_type from, - // index_type to, size_type len - // ); - // - // Most of these policies are self explanatory. convert_index and - // adjust_index, however, deserves some explanation. - // - // convert_index converts an Python index into a C++ index that the - // container can handle. For instance, negative indexes in Python, by - // convention, indexes from the right (e.g. C[-1] indexes the rightmost - // element in C). convert_index should handle the necessary conversion - // for the C++ container (e.g. convert -1 to C.size()-1). convert_index - // should also be able to convert the type of the index (A dynamic Python - // type) to the actual type that the C++ container expects. - // - // When a container expands or contracts, held indexes to its elements - // must be adjusted to follow the movement of data. For instance, if - // we erase 3 elements, starting from index 0 from a 5 element vector, - // what used to be at index 4 will now be at index 1: - // - // [a][b][c][d][e] ---> [d][e] - // ^ ^ - // 4 1 - // - // adjust_index takes care of the adjustment. Given a current index, - // the function should return the adjusted index when data in the - // container at index from..to is replaced by *len* elements. - // - - template < - class Container - , class DerivedPolicies - , bool NoProxy = false - , bool NoSlice = false - , class Data = typename Container::value_type - , class Index = typename Container::size_type - , class Key = typename Container::value_type - > - class indexing_suite - : public def_visitor< - indexing_suite< - Container - , DerivedPolicies - , NoProxy - , NoSlice - , Data - , Index - , Key - > > - { - private: - - typedef mpl::or_< - mpl::bool_ - , mpl::not_ > > - no_proxy; - - typedef detail::container_element - container_element_t; - -#if BOOST_WORKAROUND(BOOST_MSVC, == 1200) - struct return_policy : return_internal_reference<> {}; -#else - typedef return_internal_reference<> return_policy; -#endif - - typedef typename mpl::if_< - no_proxy - , iterator - , iterator >::type - def_iterator; - - typedef typename mpl::if_< - no_proxy - , detail::no_proxy_helper< - Container - , DerivedPolicies - , container_element_t - , Index> - , detail::proxy_helper< - Container - , DerivedPolicies - , container_element_t - , Index> >::type - proxy_handler; - - typedef typename mpl::if_< - mpl::bool_ - , detail::no_slice_helper< - Container - , DerivedPolicies - , proxy_handler - , Data - , Index> - , detail::slice_helper< - Container - , DerivedPolicies - , proxy_handler - , Data - , Index> >::type - slice_handler; - - public: - - template - void visit(Class& cl) const - { - // Hook into the class_ generic visitation .def function - proxy_handler::register_container_element(); - - cl - .def("__len__", base_size) - .def("__setitem__", &base_set_item) - .def("__delitem__", &base_delete_item) - .def("__getitem__", &base_get_item) - .def("__contains__", &base_contains) - .def("__iter__", def_iterator()) - ; - - DerivedPolicies::extension_def(cl); - } - - template - static void - extension_def(Class& cl) - { - // default. - // no more extensions - } - - private: - - static object - base_get_item(back_reference container, PyObject* i) - { - if (PySlice_Check(i)) - return slice_handler::base_get_slice( - container.get(), reinterpret_cast(i)); - - return proxy_handler::base_get_item_(container, i); - } - - static void - base_set_item(Container& container, PyObject* i, PyObject* v) - { - if (PySlice_Check(i)) - { - slice_handler::base_set_slice(container, - reinterpret_cast(i), v); - } - else - { - extract elem(v); - // try if elem is an exact Data - if (elem.check()) - { - DerivedPolicies:: - set_item(container, - DerivedPolicies:: - convert_index(container, i), elem()); - } - else - { - // try to convert elem to Data - extract elem(v); - if (elem.check()) - { - DerivedPolicies:: - set_item(container, - DerivedPolicies:: - convert_index(container, i), elem()); - } - else - { - PyErr_SetString(PyExc_TypeError, "Invalid assignment"); - throw_error_already_set(); - } - } - } - } - - static void - base_delete_item(Container& container, PyObject* i) - { - if (PySlice_Check(i)) - { - slice_handler::base_delete_slice( - container, reinterpret_cast(i)); - return; - } - - Index index = DerivedPolicies::convert_index(container, i); - proxy_handler::base_erase_index(container, index, mpl::bool_()); - DerivedPolicies::delete_item(container, index); - } - - static size_t - base_size(Container& container) - { - return DerivedPolicies::size(container); - } - - static bool - base_contains(Container& container, PyObject* key) - { - extract x(key); - // try if key is an exact Key type - if (x.check()) - { - return DerivedPolicies::contains(container, x()); - } - else - { - // try to convert key to Key type - extract x(key); - if (x.check()) - return DerivedPolicies::contains(container, x()); - else - return false; - } - } - }; - -}} // namespace boost::python - -#endif // INDEXING_SUITE_JDG20036_HPP diff --git a/include/boost/python/suite/indexing/map_indexing_suite.hpp b/include/boost/python/suite/indexing/map_indexing_suite.hpp deleted file mode 100644 index 0f5f7f3d..00000000 --- a/include/boost/python/suite/indexing/map_indexing_suite.hpp +++ /dev/null @@ -1,181 +0,0 @@ -// (C) Copyright Joel de Guzman 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef MAP_INDEXING_SUITE_JDG20038_HPP -# define MAP_INDEXING_SUITE_JDG20038_HPP - -# include -# include -# include -# include - -namespace boost { namespace python { - - // Forward declaration - template - class map_indexing_suite; - - namespace detail - { - template - class final_map_derived_policies - : public map_indexing_suite > {}; - } - - // The map_indexing_suite class is a predefined indexing_suite derived - // class for wrapping std::vector (and std::vector like) classes. It provides - // all the policies required by the indexing_suite (see indexing_suite). - // Example usage: - // - // class X {...}; - // - // ... - // - // class_ >("XMap") - // .def(map_indexing_suite >()) - // ; - // - // By default indexed elements are returned by proxy. This can be - // disabled by supplying *true* in the NoProxy template parameter. - // - template < - class Container, - bool NoProxy = false, - class DerivedPolicies - = detail::final_map_derived_policies > - class map_indexing_suite - : public indexing_suite< - Container - , DerivedPolicies - , NoProxy - , true - , typename Container::value_type::second_type - , typename Container::key_type - , typename Container::key_type - > - { - public: - - typedef typename Container::value_type value_type; - typedef typename Container::value_type::second_type data_type; - typedef typename Container::key_type key_type; - typedef typename Container::key_type index_type; - typedef typename Container::size_type size_type; - typedef typename Container::difference_type difference_type; - - template - static void - extension_def(Class& cl) - { - // Wrap the map's element (value_type) - std::string elem_name = "map_indexing_suite_"; - object class_name(cl.attr("__name__")); - extract class_name_extractor(class_name); - elem_name += class_name_extractor(); - elem_name += "_entry"; - - typedef typename mpl::if_< - is_class - , return_internal_reference<> - , default_call_policies - >::type get_data_return_policy; - - class_(elem_name.c_str()) - .def("__repr__", &DerivedPolicies::print_elem) - .def("data", &DerivedPolicies::get_data, get_data_return_policy()) - .def("key", &DerivedPolicies::get_key) - ; - } - - static object - print_elem(typename Container::value_type const& e) - { - return "(%s, %s)" % python::make_tuple(e.first, e.second); - } - - static - typename mpl::if_< - is_class - , data_type& - , data_type - >::type - get_data(typename Container::value_type& e) - { - return e.second; - } - - static typename Container::key_type - get_key(typename Container::value_type& e) - { - return e.first; - } - - static data_type& - get_item(Container& container, index_type i_) - { - typename Container::iterator i = container.find(i_); - if (i == container.end()) - { - PyErr_SetString(PyExc_KeyError, "Invalid key"); - throw_error_already_set(); - } - return i->second; - } - - static void - set_item(Container& container, index_type i, data_type const& v) - { - container[i] = v; - } - - static void - delete_item(Container& container, index_type i) - { - container.erase(i); - } - - static size_t - size(Container& container) - { - return container.size(); - } - - static bool - contains(Container& container, key_type const& key) - { - return container.find(key) != container.end(); - } - - static bool - compare_index(Container& container, index_type a, index_type b) - { - return container.key_comp()(a, b); - } - - static index_type - convert_index(Container& container, PyObject* i_) - { - extract i(i_); - if (i.check()) - { - return i(); - } - else - { - extract i(i_); - if (i.check()) - return i(); - } - - PyErr_SetString(PyExc_TypeError, "Invalid index type"); - throw_error_already_set(); - return index_type(); - } - }; - -}} // namespace boost::python - -#endif // MAP_INDEXING_SUITE_JDG20038_HPP diff --git a/include/boost/python/suite/indexing/vector_indexing_suite.hpp b/include/boost/python/suite/indexing/vector_indexing_suite.hpp deleted file mode 100644 index 3cce5fdc..00000000 --- a/include/boost/python/suite/indexing/vector_indexing_suite.hpp +++ /dev/null @@ -1,242 +0,0 @@ -// (C) Copyright Joel de Guzman 2003. -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef VECTOR_INDEXING_SUITE_JDG20036_HPP -# define VECTOR_INDEXING_SUITE_JDG20036_HPP - -# include -# include -# include - -namespace boost { namespace python { - - // Forward declaration - template - class vector_indexing_suite; - - namespace detail - { - template - class final_vector_derived_policies - : public vector_indexing_suite > {}; - } - - // The vector_indexing_suite class is a predefined indexing_suite derived - // class for wrapping std::vector (and std::vector like) classes. It provides - // all the policies required by the indexing_suite (see indexing_suite). - // Example usage: - // - // class X {...}; - // - // ... - // - // class_ >("XVec") - // .def(vector_indexing_suite >()) - // ; - // - // By default indexed elements are returned by proxy. This can be - // disabled by supplying *true* in the NoProxy template parameter. - // - template < - class Container, - bool NoProxy = false, - class DerivedPolicies - = detail::final_vector_derived_policies > - class vector_indexing_suite - : public indexing_suite - { - public: - - typedef typename Container::value_type data_type; - typedef typename Container::value_type key_type; - typedef typename Container::size_type index_type; - typedef typename Container::size_type size_type; - typedef typename Container::difference_type difference_type; - - template - static void - extension_def(Class& cl) - { - cl - .def("append", &base_append) - .def("extend", &base_extend) - ; - } - - static - typename mpl::if_< - is_class - , data_type& - , data_type - >::type - get_item(Container& container, index_type i) - { - return container[i]; - } - - static object - get_slice(Container& container, index_type from, index_type to) - { - if (from > to) - return object(Container()); - return object(Container(container.begin()+from, container.begin()+to)); - } - - static void - set_item(Container& container, index_type i, data_type const& v) - { - container[i] = v; - } - - static void - set_slice(Container& container, index_type from, - index_type to, data_type const& v) - { - if (from > to) { - return; - } - else { - container.erase(container.begin()+from, container.begin()+to); - container.insert(container.begin()+from, v); - } - } - - template - static void - set_slice(Container& container, index_type from, - index_type to, Iter first, Iter last) - { - if (from > to) { - container.insert(container.begin()+from, first, last); - } - else { - container.erase(container.begin()+from, container.begin()+to); - container.insert(container.begin()+from, first, last); - } - } - - static void - delete_item(Container& container, index_type i) - { - container.erase(container.begin()+i); - } - - static void - delete_slice(Container& container, index_type from, index_type to) - { - if (from > to) { - // A null-op. - return; - } - container.erase(container.begin()+from, container.begin()+to); - } - - static size_t - size(Container& container) - { - return container.size(); - } - - static bool - contains(Container& container, key_type const& key) - { - return std::find(container.begin(), container.end(), key) - != container.end(); - } - - static index_type - get_min_index(Container& container) - { - return 0; - } - - static index_type - get_max_index(Container& container) - { - return container.size(); - } - - static bool - compare_index(Container& container, index_type a, index_type b) - { - return a < b; - } - - static index_type - convert_index(Container& container, PyObject* i_) - { - extract i(i_); - if (i.check()) - { - long index = i(); - if (index < 0) - index += DerivedPolicies::size(container); - if (index >= long(container.size()) || index < 0) - { - PyErr_SetString(PyExc_IndexError, "Index out of range"); - throw_error_already_set(); - } - return index; - } - - PyErr_SetString(PyExc_TypeError, "Invalid index type"); - throw_error_already_set(); - return index_type(); - } - - static void - append(Container& container, data_type const& v) - { - container.push_back(v); - } - - template - static void - extend(Container& container, Iter first, Iter last) - { - container.insert(container.end(), first, last); - } - - private: - - static void - base_append(Container& container, object v) - { - extract elem(v); - // try if elem is an exact Data - if (elem.check()) - { - DerivedPolicies::append(container, elem()); - } - else - { - // try to convert elem to data_type - extract elem(v); - if (elem.check()) - { - DerivedPolicies::append(container, elem()); - } - else - { - PyErr_SetString(PyExc_TypeError, - "Attempting to append an invalid type"); - throw_error_already_set(); - } - } - } - - static void - base_extend(Container& container, object v) - { - std::vector temp; - container_utils::extend_container(temp, v); - DerivedPolicies::extend(container, temp.begin(), temp.end()); - } - }; - -}} // namespace boost::python - -#endif // VECTOR_INDEXING_SUITE_JDG20036_HPP diff --git a/include/boost/python/tag.hpp b/include/boost/python/tag.hpp deleted file mode 100644 index ccff9f1a..00000000 --- a/include/boost/python/tag.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 TAG_DWA2002720_HPP -# define TAG_DWA2002720_HPP - -# include - -namespace boost { namespace python { - -// used only to prevent argument-dependent lookup from finding the -// wrong function in some cases. Cheaper than qualification. -enum tag_t { tag }; - -}} // namespace boost::python - -#endif // TAG_DWA2002720_HPP diff --git a/include/boost/python/to_python_converter.hpp b/include/boost/python/to_python_converter.hpp deleted file mode 100644 index b7dd3c3d..00000000 --- a/include/boost/python/to_python_converter.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 TO_PYTHON_CONVERTER_DWA200221_HPP -# define TO_PYTHON_CONVERTER_DWA200221_HPP - -# include - -# include -# include -# include - -namespace boost { namespace python { - -template -struct to_python_converter -{ - to_python_converter(); -}; - -// -// implementation -// - -template -to_python_converter::to_python_converter() -{ - typedef converter::as_to_python_function< - T, Conversion - > normalized; - - converter::registry::insert( - &normalized::convert - , type_id()); -} - -}} // namespace boost::python - -#endif // TO_PYTHON_CONVERTER_DWA200221_HPP diff --git a/include/boost/python/to_python_indirect.hpp b/include/boost/python/to_python_indirect.hpp deleted file mode 100644 index a39b723d..00000000 --- a/include/boost/python/to_python_indirect.hpp +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 TO_PYTHON_INDIRECT_DWA200221_HPP -# define TO_PYTHON_INDIRECT_DWA200221_HPP - -# include - -# include -# include - -# include - -# include - -# include -# include - -# include - -# if defined(__ICL) && __ICL < 600 -# include -# else -# include -# endif - -namespace boost { namespace python { - -template -struct to_python_indirect -{ - template - inline PyObject* - operator()(U const& ref) const - { - return this->execute(const_cast(ref), is_pointer()); - } - - private: - template - inline PyObject* execute(U* ptr, mpl::true_) const - { - // No special NULL treatment for references - if (ptr == 0) - return python::detail::none(); - else - return this->execute(*ptr, mpl::false_()); - } - - template - inline PyObject* execute(U const& x, mpl::false_) const - { - U* const p = &const_cast(x); - if (is_polymorphic::value) - { - if (PyObject* o = detail::wrapper_base_::owner(p)) - return incref(o); - } - return MakeHolder::execute(p); - } -}; - -// -// implementations -// -namespace detail -{ - struct make_owning_holder - { - template - static PyObject* execute(T* p) - { - // can't use auto_ptr with Intel 5 and VC6 Dinkum library - // for some reason. We get link errors against the auto_ptr - // copy constructor. -# if defined(__ICL) && __ICL < 600 - typedef boost::shared_ptr smart_pointer; -# else - typedef std::auto_ptr smart_pointer; -# endif - typedef objects::pointer_holder holder_t; - - smart_pointer ptr(const_cast(p)); - return objects::make_ptr_instance::execute(ptr); - } - }; - - struct make_reference_holder - { - template - static PyObject* execute(T* p) - { - typedef objects::pointer_holder holder_t; - T* q = const_cast(p); - return objects::make_ptr_instance::execute(q); - } - }; -} - -}} // namespace boost::python - -#endif // TO_PYTHON_INDIRECT_DWA200221_HPP diff --git a/include/boost/python/to_python_value.hpp b/include/boost/python/to_python_value.hpp deleted file mode 100644 index 7c350bb4..00000000 --- a/include/boost/python/to_python_value.hpp +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 TO_PYTHON_VALUE_DWA200221_HPP -# define TO_PYTHON_VALUE_DWA200221_HPP - -# include - -# include -# include - -# include -# include -# include -# include -# include -# include - -# include -# include - -# include - -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - template - struct object_manager_to_python_value - { - typedef typename value_arg::type argument_type; - - PyObject* operator()(argument_type) const; - - // This information helps make_getter() decide whether to try to - // return an internal reference or not. I don't like it much, - // but it will have to serve for now. - BOOST_STATIC_CONSTANT(bool, uses_registry = false); - }; - - - template - struct registry_to_python_value - { - typedef typename value_arg::type argument_type; - - PyObject* operator()(argument_type) const; - - // This information helps make_getter() decide whether to try to - // return an internal reference or not. I don't like it much, - // but it will have to serve for now. - BOOST_STATIC_CONSTANT(bool, uses_registry = true); - }; - - template - struct shared_ptr_to_python_value - { - typedef typename value_arg::type argument_type; - - PyObject* operator()(argument_type) const; - - // This information helps make_getter() decide whether to try to - // return an internal reference or not. I don't like it much, - // but it will have to serve for now. - BOOST_STATIC_CONSTANT(bool, uses_registry = false); - }; -} - -template -struct to_python_value - : mpl::if_< - detail::value_is_shared_ptr - , detail::shared_ptr_to_python_value - , typename mpl::if_< - mpl::or_< - converter::is_object_manager - , converter::is_reference_to_object_manager - > - , detail::object_manager_to_python_value - , detail::registry_to_python_value - >::type - >::type -{ -}; - -// -// implementation -// -namespace detail -{ - template - inline PyObject* registry_to_python_value::operator()(argument_type x) const - { - typedef converter::registered r; -# if BOOST_WORKAROUND(__GNUC__, < 3) - // suppresses an ICE, somehow - (void)r::converters; -# endif - return converter::registered::converters.to_python(&x); - } - - template - inline PyObject* object_manager_to_python_value::operator()(argument_type x) const - { - return python::upcast( - python::xincref( - get_managed_object(x, tag)) - ); - } - - template - inline PyObject* shared_ptr_to_python_value::operator()(argument_type x) const - { - return converter::shared_ptr_to_python(x); - } -} - -}} // namespace boost::python - -#endif // TO_PYTHON_VALUE_DWA200221_HPP diff --git a/include/boost/python/tuple.hpp b/include/boost/python/tuple.hpp deleted file mode 100644 index babfb63f..00000000 --- a/include/boost/python/tuple.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 TUPLE_20020706_HPP -#define TUPLE_20020706_HPP - -# include - -#include -#include -#include -#include - -namespace boost { namespace python { - -namespace detail -{ - struct BOOST_PYTHON_DECL tuple_base : object - { - protected: - tuple_base(); - tuple_base(object_cref sequence); - - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(tuple_base, object) - - private: - static detail::new_reference call(object const&); - }; -} - -class tuple : public detail::tuple_base -{ - typedef detail::tuple_base base; - public: - tuple() {} - - template - explicit tuple(T const& sequence) - : base(object(sequence)) - { - } - - public: // implementation detail -- for internal use only - BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(tuple, base) -}; - -// -// Converter Specializations // $$$ JDG $$$ moved here to prevent -// // G++ bug complaining specialization - // provided after instantiation -namespace converter -{ - template <> - struct object_manager_traits - : pytype_object_manager_traits<&PyTuple_Type,tuple> - { - }; -} - -// for completeness -inline tuple make_tuple() { return tuple(); } - -# define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PYTHON_MAX_ARITY, )) -# include BOOST_PP_ITERATE() - -}} // namespace boost::python - -#endif - diff --git a/include/boost/python/type_id.hpp b/include/boost/python/type_id.hpp deleted file mode 100755 index 10b8fba6..00000000 --- a/include/boost/python/type_id.hpp +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 TYPE_ID_DWA2002517_HPP -# define TYPE_ID_DWA2002517_HPP - -# include - -# include -# include -# include -# include -# include -# include -# include - -# ifndef BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE -# if defined(__GNUC__) \ - && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) \ - && !defined(__EDG_VERSION__) -# define BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE -# endif -# endif - -namespace boost { namespace python { - -// for this compiler at least, cross-shared-library type_info -// comparisons don't work, so use typeid(x).name() instead. It's not -// yet clear what the best default strategy is. -# if (defined(__GNUC__) && __GNUC__ >= 3) \ - || defined(_AIX) \ - || ( defined(__sgi) && defined(__host_mips)) \ - || (defined(linux) && defined(__INTEL_COMPILER) && defined(__ICC)) -# define BOOST_PYTHON_TYPE_ID_NAME -# endif - -// type ids which represent the same information as std::type_info -// (i.e. the top-level reference and cv-qualifiers are stripped), but -// which works across shared libraries. -struct type_info : private totally_ordered -{ - inline type_info(std::type_info const& = typeid(void)); - - inline bool operator<(type_info const& rhs) const; - inline bool operator==(type_info const& rhs) const; - - char const* name() const; - friend BOOST_PYTHON_DECL std::ostream& operator<<( - std::ostream&, type_info const&); - - private: // data members -# ifdef BOOST_PYTHON_TYPE_ID_NAME - typedef char const* base_id_t; -# else - typedef std::type_info const* base_id_t; -# endif - - base_id_t m_base_type; -}; - -# ifdef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS -# define BOOST_PYTHON_EXPLICIT_TT_DEF(T) ::boost::type* -# else -# define BOOST_PYTHON_EXPLICIT_TT_DEF(T) -# endif - -template -inline type_info type_id(BOOST_EXPLICIT_TEMPLATE_TYPE(T)) -{ - return type_info( -# if !defined(_MSC_VER) \ - || (!BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \ - && !BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700)) - typeid(T) -# else // strip the decoration which msvc and Intel mistakenly leave in - python::detail::msvc_typeid((boost::type*)0) -# endif - ); -} - -# if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \ - || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 741) -// Older EDG-based compilers seems to mistakenly distinguish "int" from -// "signed int", etc., but only in typeid() expressions. However -// though int == signed int, the "signed" decoration is propagated -// down into template instantiations. Explicit specialization stops -// that from taking hold. - -# define BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID(T) \ -template <> \ -inline type_info type_id(BOOST_PYTHON_EXPLICIT_TT_DEF(T)) \ -{ \ - return type_info(typeid(T)); \ -} - -BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID(short) -BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID(int) -BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID(long) -// using Python's macro instead of Boost's - we don't seem to get the -// config right all the time. -# ifdef HAVE_LONG_LONG -BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID(long long) -# endif -# undef BOOST_PYTHON_SIGNED_INTEGRAL_TYPE_ID -# endif - -// -inline type_info::type_info(std::type_info const& id) - : m_base_type( -# ifdef BOOST_PYTHON_TYPE_ID_NAME - id.name() -# else - &id -# endif - ) -{ -} - -inline bool type_info::operator<(type_info const& rhs) const -{ -# ifdef BOOST_PYTHON_TYPE_ID_NAME - return std::strcmp(m_base_type, rhs.m_base_type) < 0; -# else - return m_base_type->before(*rhs.m_base_type); -# endif -} - -inline bool type_info::operator==(type_info const& rhs) const -{ -# ifdef BOOST_PYTHON_TYPE_ID_NAME - return !std::strcmp(m_base_type, rhs.m_base_type); -# else - return *m_base_type == *rhs.m_base_type; -# endif -} - -# ifdef BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE -namespace detail -{ - BOOST_PYTHON_DECL char const* gcc_demangle(char const*); -} -# endif - -inline char const* type_info::name() const -{ - char const* raw_name - = m_base_type -# ifndef BOOST_PYTHON_TYPE_ID_NAME - ->name() -# endif - ; - -# ifdef BOOST_PYTHON_HAVE_GCC_CP_DEMANGLE - return detail::gcc_demangle(raw_name); -# else - return raw_name; -# endif -} - - -BOOST_PYTHON_DECL std::ostream& operator<<(std::ostream&, type_info const&); - -}} // namespace boost::python - -#endif // TYPE_ID_DWA2002517_HPP diff --git a/include/boost/python/with_custodian_and_ward.hpp b/include/boost/python/with_custodian_and_ward.hpp deleted file mode 100644 index 4117b215..00000000 --- a/include/boost/python/with_custodian_and_ward.hpp +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright David Abrahams 2002. -// 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 WITH_CUSTODIAN_AND_WARD_DWA2002131_HPP -# define WITH_CUSTODIAN_AND_WARD_DWA2002131_HPP - -# include - -# include -# include -# include - -namespace boost { namespace python { - -namespace detail -{ - template - struct get_prev - { - template - static PyObject* execute(ArgumentPackage const& args, PyObject* = 0) - { - int const pre_n = static_cast(N) - 1; // separate line is gcc-2.96 workaround - return detail::get(mpl::int_(), args); - } - }; - template <> - struct get_prev<0> - { - template - static PyObject* execute(ArgumentPackage const&, PyObject* zeroth) - { - return zeroth; - } - }; -} -template < - std::size_t custodian - , std::size_t ward - , class BasePolicy_ = default_call_policies -> -struct with_custodian_and_ward : BasePolicy_ -{ - BOOST_STATIC_ASSERT(custodian != ward); - BOOST_STATIC_ASSERT(custodian > 0); - BOOST_STATIC_ASSERT(ward > 0); - - template - static bool precall(ArgumentPackage const& args_) - { - unsigned arity_ = detail::arity(args_); - if (custodian > arity_ || ward > arity_) - { - PyErr_SetString( - PyExc_IndexError - , "boost::python::with_custodian_and_ward: argument index out of range" - ); - return false; - } - - PyObject* patient = detail::get_prev::execute(args_); - PyObject* nurse = detail::get_prev::execute(args_); - - PyObject* life_support = python::objects::make_nurse_and_patient(nurse, patient); - if (life_support == 0) - return false; - - bool result = BasePolicy_::precall(args_); - - if (!result) - Py_DECREF(life_support); - - return result; - } -}; - -template -struct with_custodian_and_ward_postcall : BasePolicy_ -{ - BOOST_STATIC_ASSERT(custodian != ward); - - template - static PyObject* postcall(ArgumentPackage const& args_, PyObject* result) - { - std::size_t arity_ = detail::arity(args_); - if ( custodian > arity_ || ward > arity_ ) - { - PyErr_SetString( - PyExc_IndexError - , "boost::python::with_custodian_and_ward_postcall: argument index out of range" - ); - return 0; - } - - PyObject* patient = detail::get_prev::execute(args_, result); - PyObject* nurse = detail::get_prev::execute(args_, result); - - if (nurse == 0) return 0; - - result = BasePolicy_::postcall(args_, result); - if (result == 0) - return 0; - - if (python::objects::make_nurse_and_patient(nurse, patient) == 0) - { - Py_XDECREF(result); - return 0; - } - return result; - } -}; - - -}} // namespace boost::python - -#endif // WITH_CUSTODIAN_AND_WARD_DWA2002131_HPP diff --git a/include/boost/python/wrapper.hpp b/include/boost/python/wrapper.hpp deleted file mode 100755 index 28871a5e..00000000 --- a/include/boost/python/wrapper.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright David Abrahams 2004. Distributed under the Boost -// Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef WRAPPER_DWA2004720_HPP -# define WRAPPER_DWA2004720_HPP - -# include -# include -# include -# include - -namespace boost { namespace python { - -template -class wrapper : public detail::wrapper_base -{ -# if defined(BOOST_PYTHON_NO_SFINAE) - public: - typedef T _wrapper_wrapped_type_; -# endif - protected: - override get_override(char const* name) const - { - typedef detail::wrapper_base base; - converter::registration const& r - = converter::registered::converters; - PyTypeObject* type = r.get_class_object(); - - return this->base::get_override(name, type); - } -}; - -}} // namespace boost::python - -#endif // WRAPPER_DWA2004720_HPP