mirror of
https://github.com/boostorg/python.git
synced 2026-01-22 05:22:45 +00:00
Patches to support Synopsis
[SVN r15906]
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#ifndef PYOBJECT_TYPE_DWA2002720_HPP
|
||||
# define PYOBJECT_TYPE_DWA2002720_HPP
|
||||
|
||||
# include <boost/python/detail/config.hpp>
|
||||
# include <boost/python/detail/wrap_python.hpp>
|
||||
# include <boost/python/cast.hpp>
|
||||
|
||||
|
||||
@@ -94,7 +94,8 @@ struct rvalue_from_python_data : rvalue_from_python_storage<T>
|
||||
{
|
||||
# if (!defined(__MWERKS__) || __MWERKS__ >= 0x3000) \
|
||||
&& (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 245) \
|
||||
&& (!defined(__DECCXX_VER) || __DECCXX_VER > 60590014)
|
||||
&& (!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<T>,stage1) == 0);
|
||||
# endif
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
// Copyright David Abrahams 2001. Permission to copy, use,
|
||||
// modify, sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
#ifndef CALL_OBJECT_DWA20011222_HPP
|
||||
# define CALL_OBJECT_DWA20011222_HPP
|
||||
# include <boost/python/errors.hpp>
|
||||
# include <boost/python/detail/types.hpp>
|
||||
# include <boost/bind.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// A function object adaptor which turns a function returning R into
|
||||
// an "equivalent" function returning void, but taking an R& in
|
||||
// which the adapted function's result is stored.
|
||||
template <class R, class F>
|
||||
struct return_by_reference
|
||||
{
|
||||
typedef void return_type;
|
||||
|
||||
return_by_reference(R& result, F f)
|
||||
: m_result(result)
|
||||
, m_f(f)
|
||||
{
|
||||
}
|
||||
|
||||
void operator()() const
|
||||
{
|
||||
m_result = m_f();
|
||||
}
|
||||
|
||||
R& m_result;
|
||||
F m_f;
|
||||
};
|
||||
|
||||
// An object generator for the above adaptors
|
||||
template <class R, class F>
|
||||
return_by_reference<R,F> bind_return(R& result, F f)
|
||||
{
|
||||
return return_by_reference<R,F>(result, f);
|
||||
}
|
||||
|
||||
// Given a function object f with signature
|
||||
//
|
||||
// R f(PyTypeObject*,PyObject*)
|
||||
//
|
||||
// calls f inside of handle_exception_impl, placing f's result in
|
||||
// ret. Returns true iff an exception is thrown by f, leaving ret
|
||||
// unmodified.
|
||||
template <class R, class F>
|
||||
bool call_object(R& ret, PyObject* obj, F f)
|
||||
{
|
||||
return handle_exception(
|
||||
detail::bind_return(
|
||||
ret
|
||||
, boost::bind<R>(
|
||||
f, static_cast<type_object_base*>(obj->ob_type), obj)));
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
}} // namespace boost::python
|
||||
|
||||
#endif // CALL_OBJECT_DWA20011222_HPP
|
||||
@@ -6,6 +6,7 @@
|
||||
#ifndef EXCEPTION_HANDLER_DWA2002810_HPP
|
||||
# define EXCEPTION_HANDLER_DWA2002810_HPP
|
||||
|
||||
# include <boost/python/detail/config.hpp>
|
||||
# include <boost/function/function0.hpp>
|
||||
# include <boost/function/function2.hpp>
|
||||
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
# ifndef BOOST_PYTHON_SYNOPSIS
|
||||
# // Copyright David Abrahams 2002. Permission to copy, use,
|
||||
# // modify, sell and distribute this software is granted provided this
|
||||
# // copyright notice appears in all copies. This software is provided
|
||||
# // "as is" without express or implied warranty, and with no claim as
|
||||
# // to its suitability for any purpose.
|
||||
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
# error Boost.Python - do not include this file!
|
||||
#endif
|
||||
# if !defined(BOOST_PP_IS_ITERATING)
|
||||
# error Boost.Python - do not include this file!
|
||||
# endif
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
# define N BOOST_PP_ITERATION()
|
||||
|
||||
#define BOOST_PYTHON_MAKE_TUPLE_ARG(z, N, ignored) \
|
||||
# define BOOST_PYTHON_MAKE_TUPLE_ARG(z, N, ignored) \
|
||||
PyTuple_SET_ITEM( \
|
||||
result.ptr() \
|
||||
, N \
|
||||
@@ -26,6 +27,7 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
#undef BOOST_PYTHON_MAKE_TUPLE_ARG
|
||||
# undef BOOST_PYTHON_MAKE_TUPLE_ARG
|
||||
|
||||
#undef N
|
||||
# undef N
|
||||
# endif // BOOST_PYTHON_SYNOPSIS
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#error obsolete
|
||||
// Copyright David Abrahams 2002. Permission to copy, use,
|
||||
// modify, sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
#ifndef MODULE_BASE_DWA2002227_HPP
|
||||
# define MODULE_BASE_DWA2002227_HPP
|
||||
# include <boost/python/detail/wrap_python.hpp>
|
||||
# include <boost/python/handle.hpp>
|
||||
# include <boost/python/object_fwd.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
class BOOST_PYTHON_DECL module_base
|
||||
{
|
||||
public:
|
||||
// Create a module. REQUIRES: only one module is created per module.
|
||||
module_base(char const* name, char const* doc = 0);
|
||||
~module_base();
|
||||
|
||||
// Add elements to the module
|
||||
void add(type_handle const&); // just use the type's name
|
||||
|
||||
// Return a reference to the Python module object being built
|
||||
inline handle<> object() const;
|
||||
|
||||
protected:
|
||||
void setattr_doc(const char* name, python::object const&, char const* doc);
|
||||
|
||||
private:
|
||||
handle<> m_module;
|
||||
static PyMethodDef initial_methods[1];
|
||||
};
|
||||
|
||||
//
|
||||
// inline implementations
|
||||
//
|
||||
inline handle<> module_base::object() const
|
||||
{
|
||||
return m_module;
|
||||
}
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
#endif // MODULE_BASE_DWA2002227_HPP
|
||||
@@ -6,6 +6,8 @@
|
||||
#ifndef SCOPE_DWA2002927_HPP
|
||||
# define SCOPE_DWA2002927_HPP
|
||||
|
||||
# include <boost/python/detail/config.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
void BOOST_PYTHON_DECL scope_setattr_doc(char const* name, object const& obj, char const* doc);
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
# ifndef TYPE_LIST_IMPL_DWA2002913_HPP
|
||||
# define TYPE_LIST_IMPL_DWA2002913_HPP
|
||||
|
||||
# include <boost/python/detail/type_list.hpp>
|
||||
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
# include <boost/preprocessor/enum_params_with_a_default.hpp>
|
||||
# include <boost/preprocessor/repetition/enum.hpp>
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
# ifndef TYPE_LIST_IMPL_NO_PTS_DWA2002913_HPP
|
||||
# define TYPE_LIST_IMPL_NO_PTS_DWA2002913_HPP
|
||||
|
||||
# include <boost/python/detail/type_list.hpp>
|
||||
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
# include <boost/preprocessor/enum_params_with_a_default.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#error obsolete
|
||||
// Copyright David Abrahams 2002. Permission to copy, use,
|
||||
// modify, sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
#ifndef TYPE_LIST_UTILS_JDG20020826_HPP
|
||||
# define TYPE_LIST_UTILS_JDG20020826_HPP
|
||||
|
||||
|
||||
# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
template< typename T >
|
||||
struct is_list_arg
|
||||
{
|
||||
enum { value = true };
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_list_arg<mpl::void_>
|
||||
{
|
||||
enum { value = false };
|
||||
};
|
||||
|
||||
}}}
|
||||
# endif
|
||||
#endif // TYPE_LIST_UTILS_JDG20020826_HPP
|
||||
@@ -6,6 +6,7 @@
|
||||
#ifndef ADD_TO_NAMESPACE_DWA200286_HPP
|
||||
# define ADD_TO_NAMESPACE_DWA200286_HPP
|
||||
|
||||
# include <boost/python/detail/config.hpp>
|
||||
# include <boost/python/object_fwd.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
// Copyright David Abrahams 2001. Permission to copy, use,
|
||||
// modify, sell and distribute this software is granted provided this
|
||||
// copyright notice appears in all copies. This software is provided
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
#ifndef CONSTRUCT_DWA20011215_HPP
|
||||
# define CONSTRUCT_DWA20011215_HPP
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
|
||||
template <class T, class ArgList>
|
||||
struct construct
|
||||
{
|
||||
static
|
||||
template <class
|
||||
void operator()(PyObject* args, PyObject* keywords)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}}} // namespace boost::python::objects
|
||||
|
||||
#endif // CONSTRUCT_DWA20011215_HPP
|
||||
@@ -4,7 +4,9 @@
|
||||
// software is provided "as is" without express or implied warranty, and
|
||||
// with no claim as to its suitability for any purpose.
|
||||
#ifndef BOOST_PYTHON_OBJECT_PICKLE_SUPPORT_RWGK20020603_HPP
|
||||
#define BOOST_PYTHON_OBJECT_PICKLE_SUPPORT_RWGK20020603_HPP
|
||||
# define BOOST_PYTHON_OBJECT_PICKLE_SUPPORT_RWGK20020603_HPP
|
||||
|
||||
# include <boost/python/detail/config.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
# if !defined(BOOST_PYTHON_SYNOPSIS)
|
||||
# // Copyright David Abrahams 2002. Permission to copy, use,
|
||||
# // modify, sell and distribute this software is granted provided this
|
||||
# // copyright notice appears in all copies. This software is provided
|
||||
# // "as is" without express or implied warranty, and with no claim as
|
||||
# // to its suitability for any purpose.
|
||||
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
# error Boost.Python - do not include this file!
|
||||
#endif
|
||||
# if !defined(BOOST_PP_IS_ITERATING)
|
||||
# error Boost.Python - do not include this file!
|
||||
# endif
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
# define N BOOST_PP_ITERATION()
|
||||
|
||||
template <BOOST_PP_ENUM_PARAMS_Z(1, N, class A)>
|
||||
typename detail::dependent<object, A0>::type
|
||||
@@ -19,4 +20,5 @@
|
||||
return call<obj>(get_managed_object(self, tag), BOOST_PP_ENUM_PARAMS_Z(1, N, a));
|
||||
}
|
||||
|
||||
#undef N
|
||||
# undef N
|
||||
# endif // BOOST_PYTHON_SYNOPSIS
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#ifndef OBJECT_PROTOCOL_CORE_DWA2002615_HPP
|
||||
# define OBJECT_PROTOCOL_CORE_DWA2002615_HPP
|
||||
|
||||
# include <boost/python/detail/config.hpp>
|
||||
# include <boost/python/handle_fwd.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
@@ -169,16 +169,16 @@ namespace detail \
|
||||
}; \
|
||||
}
|
||||
|
||||
# define BOOST_PYTHON_BINARY_OPERATOR(id, rid, op) \
|
||||
BOOST_PYTHON_BINARY_OPERATION(id, rid, l op r) \
|
||||
namespace self_ns \
|
||||
{ \
|
||||
template <class L, class R> \
|
||||
inline detail::operator_<detail::op_##id,L,R> \
|
||||
operator##op(L const&, R const&) \
|
||||
{ \
|
||||
return detail::operator_<detail::op_##id,L,R>(); \
|
||||
} \
|
||||
# define BOOST_PYTHON_BINARY_OPERATOR(id, rid, op) \
|
||||
BOOST_PYTHON_BINARY_OPERATION(id, rid, l op r) \
|
||||
namespace self_ns \
|
||||
{ \
|
||||
template <class L, class R> \
|
||||
inline detail::operator_<detail::op_##id,L,R> \
|
||||
operator op(L const&, R const&) \
|
||||
{ \
|
||||
return detail::operator_<detail::op_##id,L,R>(); \
|
||||
} \
|
||||
}
|
||||
|
||||
BOOST_PYTHON_BINARY_OPERATOR(add, radd, +)
|
||||
@@ -262,7 +262,7 @@ namespace self_ns \
|
||||
{ \
|
||||
template <class R> \
|
||||
inline detail::operator_<detail::op_##id,self_t,R> \
|
||||
operator##op(self_t const&, R const&) \
|
||||
operator op(self_t const&, R const&) \
|
||||
{ \
|
||||
return detail::operator_<detail::op_##id,self_t,R>(); \
|
||||
} \
|
||||
|
||||
Reference in New Issue
Block a user