mirror of
https://github.com/boostorg/python.git
synced 2026-01-29 07:42:36 +00:00
separate overloads.hpp
BOOST_PYTHON_MODULE_INIT -> BOOST_PYTHON_MODULE [SVN r15609]
This commit is contained in:
@@ -87,7 +87,7 @@ using namespace boost::python;
|
||||
|
||||
int f(int x, int y, int z);
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(xxx)
|
||||
BOOST_PYTHON_MODULE(xxx)
|
||||
{
|
||||
def("f", f, args("x", "y", "z"));
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ R call_method(PyObject* self, char const* method, A1 const&, A2 const&,
|
||||
|
||||
<h3>C++ Module Definition</h3>
|
||||
<pre>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
#include <cstring>
|
||||
@@ -119,7 +119,7 @@ class Base_callback : public Base
|
||||
};
|
||||
|
||||
using namespace boost::python;
|
||||
BOOST_PYTHON_MODULE_INIT(my_module)
|
||||
BOOST_PYTHON_MODULE(my_module)
|
||||
{
|
||||
def("is_base", is_base);
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ template <class T> struct apply
|
||||
|
||||
<h3>C++ Module Definition</h3>
|
||||
<pre>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/copy_const_reference.hpp>
|
||||
#include <boost/python/return_value_policy.hpp>
|
||||
@@ -115,7 +115,7 @@ struct Foo {
|
||||
|
||||
// Wrapper code
|
||||
using namespace boost::python;
|
||||
BOOST_PYTHON_MODULE_INIT(my_module)
|
||||
BOOST_PYTHON_MODULE(my_module)
|
||||
{
|
||||
class_<Bar>("Bar");
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ template <class T> struct apply
|
||||
|
||||
<p>C++ code:</p>
|
||||
<pre>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/copy_non_const_reference.hpp>
|
||||
#include <boost/python/return_value_policy.hpp>
|
||||
@@ -116,7 +116,7 @@ struct Foo {
|
||||
|
||||
// Wrapper code
|
||||
using namespace boost::python;
|
||||
BOOST_PYTHON_MODULE_INIT(my_module)
|
||||
BOOST_PYTHON_MODULE(my_module)
|
||||
{
|
||||
class_<Bar>("Bar");
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ template <class C, class D, class Policies>
|
||||
member as functions:</p>
|
||||
<pre>
|
||||
#include <boost/python/data_members.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
|
||||
struct X
|
||||
|
||||
@@ -97,7 +97,7 @@ void f(ExceptionType x) { translate(x); }
|
||||
|
||||
<h2><a name="examples"></a>Example</h2>
|
||||
<pre>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/exception_translator.hpp>
|
||||
#include <exception>
|
||||
@@ -120,7 +120,7 @@ void something_which_throws()
|
||||
...
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(exception_translator_ext)
|
||||
BOOST_PYTHON_MODULE(exception_translator_ext)
|
||||
{
|
||||
using namespace boost::python;
|
||||
register_exception_translator<my_exception>(&translate);
|
||||
|
||||
@@ -204,7 +204,7 @@ struct X
|
||||
int v;
|
||||
};
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(extract_ext)
|
||||
BOOST_PYTHON_MODULE(extract_ext)
|
||||
{
|
||||
object x_class(
|
||||
class_<X>("X", init<int>())
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace boost { namespace python
|
||||
<h3>C++ module definition</h3>
|
||||
<pre>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/has_back_reference.hpp>
|
||||
#include <boost/python/handle.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
@@ -153,7 +153,7 @@ struct Y
|
||||
|
||||
boost::shared_ptr<Y> Y_self(boost::shared_ptr<Y> self) const { return self; }
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(back_references)
|
||||
BOOST_PYTHON_MODULE(back_references)
|
||||
{
|
||||
class_<X>("X")
|
||||
.def(init<int>())
|
||||
|
||||
@@ -103,7 +103,7 @@ void implicitly_convertible();
|
||||
<pre>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/implicit.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
@@ -121,7 +121,7 @@ int x_value(X const& x)
|
||||
|
||||
X make_x(int n) { return X(n); }
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(implicit_ext)
|
||||
BOOST_PYTHON_MODULE(implicit_ext)
|
||||
{
|
||||
def("x_value", x_value);
|
||||
def("make_x", make_x);
|
||||
|
||||
@@ -355,13 +355,13 @@ template <class Accessor1, class Accessor2>
|
||||
|
||||
<h2><a name="examples"></a>Examples</h2>
|
||||
<pre>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
using namespace boost::python;
|
||||
BOOST_PYTHON_MODULE_INIT(demo)
|
||||
BOOST_PYTHON_MODULE(demo)
|
||||
{
|
||||
class_<std::vector<double> >("dvec")
|
||||
.def("__iter__", iterator<std::vector<double> >())
|
||||
|
||||
@@ -239,7 +239,7 @@ static MemberType& execute(InstanceType& c);
|
||||
<h3>C++ module definition</h3>
|
||||
<pre>
|
||||
#include <boost/python/reference.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
|
||||
// definition lifted from the Python docs
|
||||
typedef struct {
|
||||
@@ -259,7 +259,7 @@ void set_cache(noddy_NoddyObject* x)
|
||||
cache.reset((PyObject*)x, ref::increment_count);
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(noddy_cache)
|
||||
BOOST_PYTHON_MODULE(noddy_cache)
|
||||
{
|
||||
def("is_cached", is_cached);
|
||||
def("set_cache", set_cache);
|
||||
|
||||
@@ -138,7 +138,7 @@ template <class ArgList, class Generator, class Policies>
|
||||
two functions.</p>
|
||||
<pre>
|
||||
#include <boost/python/make_function.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
|
||||
char const* foo() { return "foo"; }
|
||||
char const* bar() { return "bar"; }
|
||||
@@ -152,7 +152,7 @@ object choose_function(bool selector)
|
||||
return boost::python::make_function(bar);
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(make_function_test)
|
||||
BOOST_PYTHON_MODULE(make_function_test)
|
||||
{
|
||||
def("choose_function", choose_function);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ template <class T> struct apply
|
||||
|
||||
<p>In C++:</p>
|
||||
<pre>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/manage_new_object.hpp>
|
||||
#include <boost/python/return_value_policy.hpp>
|
||||
@@ -113,7 +113,7 @@ Foo* make_foo(int x) { return new Foo(x); }
|
||||
|
||||
// Wrapper code
|
||||
using namespace boost::python;
|
||||
BOOST_PYTHON_MODULE_INIT(my_module)
|
||||
BOOST_PYTHON_MODULE(my_module)
|
||||
{
|
||||
def("make_foo", make_foo, return_value_policy<manage_new_object>())
|
||||
class_<Foo>("Foo")
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<dd>
|
||||
<dl class="page-index">
|
||||
<dt><a href=
|
||||
"#BOOST_PYTHON_MODULE_INIT-spec">BOOST_PYTHON_MODULE_INIT</a>
|
||||
"#BOOST_PYTHON_MODULE-spec">BOOST_PYTHON_MODULE</a>
|
||||
</dl>
|
||||
|
||||
<dt><a href="#classes">Classes</a>
|
||||
@@ -66,7 +66,7 @@
|
||||
<h2><a name="macros"></a>Macros</h2>
|
||||
|
||||
<p><a name=
|
||||
"BOOST_PYTHON_MODULE_INIT-spec"><code>BOOST_PYTHON_MODULE_INIT(name)</code></a>
|
||||
"BOOST_PYTHON_MODULE-spec"><code>BOOST_PYTHON_MODULE(name)</code></a>
|
||||
is used to declare Python <a href=
|
||||
"http://www.python.org/doc/2.2/ext/methodTable.html#SECTION003400000000000000000">
|
||||
module initialization functions</a>. The <code>name</code> argument must
|
||||
@@ -81,7 +81,7 @@ void init<i>name</i>()
|
||||
</pre>
|
||||
Boost.Python modules should be initialized with
|
||||
<pre>
|
||||
BOOST_PYTHON_MODULE_INIT(<i>name</i>)
|
||||
BOOST_PYTHON_MODULE(<i>name</i>)
|
||||
{
|
||||
...
|
||||
</pre>
|
||||
@@ -134,7 +134,7 @@ module(const char* name);
|
||||
<dl class="function-semantics">
|
||||
<dt><b>Requires:</b> <code>name</code> is a ntbs whose value matches the
|
||||
argument passed to <a href=
|
||||
"#BOOST_PYTHON_MODULE_INIT-spec">BOOST_PYTHON_MODULE_INIT</a>.
|
||||
"#BOOST_PYTHON_MODULE-spec">BOOST_PYTHON_MODULE</a>.
|
||||
|
||||
<dt><b>Effects:</b> Creates a <code>module</code> object representing a
|
||||
Python module named <code>name</code>.
|
||||
@@ -238,7 +238,7 @@ char const* greet()
|
||||
return "hello, Boost.Python!";
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(boost_greet)
|
||||
BOOST_PYTHON_MODULE(boost_greet)
|
||||
{
|
||||
module("boost_greet")
|
||||
.def("greet", greet);
|
||||
|
||||
@@ -809,7 +809,7 @@ namespace boost { namespace python
|
||||
|
||||
<h2><a name="examples"></a>Example</h2>
|
||||
<pre>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/operators.hpp>
|
||||
#include <boost/operators.hpp>
|
||||
@@ -836,7 +836,7 @@ struct number
|
||||
};
|
||||
|
||||
using namespace boost::python;
|
||||
BOOST_PYTHON_MODULE_INIT(demo)
|
||||
BOOST_PYTHON_MODULE(demo)
|
||||
{
|
||||
class_<number>("number")
|
||||
// interoperate with self
|
||||
|
||||
@@ -113,7 +113,7 @@ template <class T> struct apply
|
||||
|
||||
<p>In C++:</p>
|
||||
<pre>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/reference_existing_object.hpp>
|
||||
#include <boost/python/return_value_policy.hpp>
|
||||
@@ -141,7 +141,7 @@ Singleton& get_it()
|
||||
|
||||
// Wrapper code
|
||||
using namespace boost::python;
|
||||
BOOST_PYTHON_MODULE_INIT(singleton)
|
||||
BOOST_PYTHON_MODULE(singleton)
|
||||
{
|
||||
def("get_it", get_it, reference_existing_object());
|
||||
class_<Singleton>("Singleton")
|
||||
|
||||
@@ -158,7 +158,7 @@ PyObject* postcall(PyObject* args, PyObject* result);
|
||||
|
||||
<h3>C++ module definition</h3>
|
||||
<pre>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/return_internal_reference.hpp>
|
||||
|
||||
@@ -184,7 +184,7 @@ class Foo
|
||||
};
|
||||
|
||||
using namespace boost::python;
|
||||
BOOST_PYTHON_MODULE_INIT(internal_refs)
|
||||
BOOST_PYTHON_MODULE(internal_refs)
|
||||
{
|
||||
class_<Bar>("Bar")
|
||||
.def("get_x", &Bar::get_x)
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace boost { namespace python
|
||||
|
||||
<h3>C++ Module Definition</h3>
|
||||
<pre>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/copy_const_reference.hpp>
|
||||
#include <boost/python/return_value_policy.hpp>
|
||||
@@ -133,7 +133,7 @@ struct Foo {
|
||||
|
||||
// Wrapper code
|
||||
using namespace boost::python;
|
||||
BOOST_PYTHON_MODULE_INIT(my_module)
|
||||
BOOST_PYTHON_MODULE(my_module)
|
||||
{
|
||||
class_<Bar>("Bar");
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ to_python_converter();
|
||||
<h3>C++ module definition</h3>
|
||||
<pre>
|
||||
#include <boost/python/reference.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include "noddy.h"
|
||||
|
||||
struct tag {};
|
||||
@@ -159,7 +159,7 @@ struct tag_to_noddy
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(to_python_converter)
|
||||
BOOST_PYTHON_MODULE(to_python_converter)
|
||||
{
|
||||
def("make_tag", make_tag);
|
||||
to_python_converter<tag, tag_to_noddy>();
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
# include <boost/python/object.hpp>
|
||||
|
||||
# include <boost/python/type_id.hpp>
|
||||
# include <boost/python/detail/member_function_cast.hpp>
|
||||
# include <boost/python/object/class_converters.hpp>
|
||||
# include <boost/type_traits/ice.hpp>
|
||||
# include <boost/type_traits/same_traits.hpp>
|
||||
@@ -25,17 +24,19 @@
|
||||
# include <boost/python/object/make_instance.hpp>
|
||||
# include <boost/python/data_members.hpp>
|
||||
# include <boost/utility.hpp>
|
||||
# include <boost/python/detail/operator_id.hpp>
|
||||
# include <boost/python/object/pickle_support.hpp>
|
||||
# include <boost/python/make_function.hpp>
|
||||
# include <boost/python/object/add_to_namespace.hpp>
|
||||
# include <boost/python/detail/def_helper.hpp>
|
||||
# include <boost/python/detail/force_instantiate.hpp>
|
||||
# include <boost/python/detail/defaults_def.hpp>
|
||||
# include <boost/python/signature.hpp>
|
||||
# include <boost/python/init.hpp>
|
||||
# include <boost/python/args_fwd.hpp>
|
||||
|
||||
# include <boost/python/detail/overloads_fwd.hpp>
|
||||
# include <boost/python/detail/operator_id.hpp>
|
||||
# include <boost/python/detail/member_function_cast.hpp>
|
||||
# include <boost/python/detail/def_helper.hpp>
|
||||
# include <boost/python/detail/force_instantiate.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
enum no_init_t { no_init };
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# include <boost/python/object_fwd.hpp>
|
||||
# include <boost/python/make_function.hpp>
|
||||
# include <boost/python/detail/def_helper.hpp>
|
||||
# include <boost/python/detail/defaults_def.hpp>
|
||||
# include <boost/python/detail/overloads_fwd.hpp>
|
||||
# include <boost/python/scope.hpp>
|
||||
# include <boost/python/signature.hpp>
|
||||
# include <boost/python/detail/scope.hpp>
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace detail
|
||||
char const* name,
|
||||
OverloadsT const& overloads,
|
||||
NameSpaceT& name_space,
|
||||
SigT sig)
|
||||
SigT const& sig)
|
||||
{
|
||||
typedef typename mpl::front<SigT>::type return_type;
|
||||
typedef typename OverloadsT::void_return_type void_return_type;
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
#include <boost/python/detail/type_list.hpp>
|
||||
#include <boost/python/args_fwd.hpp>
|
||||
#include <boost/python/detail/make_keyword_range_fn.hpp>
|
||||
|
||||
#include <boost/mpl/fold_backward.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/apply_if.hpp>
|
||||
|
||||
@@ -6,104 +6,7 @@
|
||||
#ifndef MODULE_DWA2001128_HPP
|
||||
# define MODULE_DWA2001128_HPP
|
||||
|
||||
# include <boost/python/errors.hpp>
|
||||
# include <boost/python/detail/config.hpp>
|
||||
# include <boost/python/make_function.hpp>
|
||||
# include <boost/python/class_fwd.hpp>
|
||||
# include <boost/python/detail/module_base.hpp>
|
||||
# include <boost/python/module_init.hpp>
|
||||
# include <boost/python/object_core.hpp>
|
||||
# include <boost/python/detail/def_helper.hpp>
|
||||
# include <boost/python/detail/defaults_def.hpp>
|
||||
# include <boost/python/signature.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
class module : public detail::module_base
|
||||
{
|
||||
public:
|
||||
typedef detail::module_base base;
|
||||
|
||||
module(char const* name, char const* doc = 0)
|
||||
: base(name, doc) {}
|
||||
|
||||
// Add elements to the module
|
||||
template <class T>
|
||||
module& setattr(const char* name, T const& x)
|
||||
{
|
||||
this->base::setattr_doc(name, python::object(x), 0);
|
||||
return *this;
|
||||
}
|
||||
|
||||
module& add(type_handle x); // just use the type's name
|
||||
|
||||
template <class T1, class T2 , class T3, class T4>
|
||||
module& add(class_<T1,T2,T3,T4> const& c)
|
||||
{
|
||||
// Soon to disappear...
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class Fn>
|
||||
module& def(char const* name, Fn fn)
|
||||
{
|
||||
this->setattr_doc(
|
||||
name, boost::python::make_function(fn), 0);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class Arg1T, class Arg2T>
|
||||
module& def(char const* name, Arg1T arg1, Arg2T const& arg2, char const* doc = 0)
|
||||
{
|
||||
dispatch_def(name, arg1, arg2, doc, &arg2);
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
template <class Fn, class CallPolicyOrDoc>
|
||||
void
|
||||
dispatch_def(
|
||||
char const* name,
|
||||
Fn fn,
|
||||
CallPolicyOrDoc const& policy_or_doc,
|
||||
char const* doc,
|
||||
void const*)
|
||||
{
|
||||
detail::def_helper<CallPolicyOrDoc,char const*> helper(policy_or_doc, doc);
|
||||
|
||||
this->setattr_doc(
|
||||
name
|
||||
, boost::python::make_function(fn, helper.policies())
|
||||
, helper.doc());
|
||||
}
|
||||
|
||||
template <typename StubsT, typename SigT>
|
||||
void
|
||||
dispatch_def(
|
||||
char const* name,
|
||||
SigT sig,
|
||||
StubsT const& stubs,
|
||||
char const* doc,
|
||||
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, stubs, *this, detail::get_signature(sig));
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// inline implementations
|
||||
//
|
||||
inline module& module::add(type_handle x)
|
||||
{
|
||||
this->base::add(x);
|
||||
return *this;
|
||||
}
|
||||
|
||||
}} // namespace boost::python
|
||||
# define BOOST_PYTHON_MODULE BOOST_PYTHON_MODULE_INIT
|
||||
|
||||
#endif // MODULE_DWA20011221_HPP
|
||||
|
||||
@@ -17,7 +17,7 @@ extern "C"
|
||||
# include <boost/python/detail/wrap_python.hpp>
|
||||
# include <boost/python/errors.hpp>
|
||||
# include <boost/python/detail/aix_init_module.hpp>
|
||||
# include <boost/python/module_init.hpp>
|
||||
# include <boost/python/module.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
// 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.
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/args.hpp>
|
||||
#include <boost/python/tuple.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/overloads.hpp>
|
||||
#include <boost/python/return_internal_reference.hpp>
|
||||
#include "test_class.hpp"
|
||||
|
||||
@@ -38,7 +39,7 @@ struct X
|
||||
|
||||
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(X_f_overloads, X::f, 0, 3)
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(args_ext)
|
||||
BOOST_PYTHON_MODULE(args_ext)
|
||||
{
|
||||
def("f", f, args("x", "y", "z")
|
||||
, "This is f's docstring"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/has_back_reference.hpp>
|
||||
#include <boost/python/back_reference.hpp>
|
||||
@@ -87,7 +87,7 @@ bool y_equality(back_reference<Y const&> y1, Y const& y2)
|
||||
return &y1.get() == &y2;
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(back_reference_ext)
|
||||
BOOST_PYTHON_MODULE(back_reference_ext)
|
||||
{
|
||||
def("copy_Y", copy_Y, return_value_policy<copy_const_reference>());
|
||||
def("copy_Z", copy_Z, return_value_policy<copy_const_reference>());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/reference_existing_object.hpp>
|
||||
@@ -18,7 +18,7 @@ struct V
|
||||
|
||||
const A* outside(const V& v) {return &v.a;}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(bienstman1_ext)
|
||||
BOOST_PYTHON_MODULE(bienstman1_ext)
|
||||
{
|
||||
using namespace boost::python;
|
||||
using boost::shared_ptr;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
|
||||
@@ -15,7 +15,7 @@ struct E
|
||||
const D fe2(const C&, const C&) {return D();}
|
||||
};
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(bienstman2_ext)
|
||||
BOOST_PYTHON_MODULE(bienstman2_ext)
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
|
||||
@@ -12,7 +12,7 @@ struct B
|
||||
B(const V&) {}
|
||||
};
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(bienstman3_ext)
|
||||
BOOST_PYTHON_MODULE(bienstman3_ext)
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/implicit.hpp>
|
||||
@@ -16,7 +16,7 @@ struct Term {Term(Type1 const&) {} };
|
||||
|
||||
struct Expression {void add(Term const&) {} };
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(bienstman4_ext)
|
||||
BOOST_PYTHON_MODULE(bienstman4_ext)
|
||||
{
|
||||
using namespace boost::python;
|
||||
using boost::mpl::list;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/mpl/list.hpp>
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
struct M {M(const std::complex<double>&) {} };
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(bienstman5_ext)
|
||||
BOOST_PYTHON_MODULE(bienstman5_ext)
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// 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.
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
//#include <boost/python/returning.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
@@ -113,7 +113,7 @@ object apply_object_object(PyObject* f, object x)
|
||||
|
||||
int X::counter;
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(callbacks_ext)
|
||||
BOOST_PYTHON_MODULE(callbacks_ext)
|
||||
{
|
||||
def("apply_object_object", apply_object_object);
|
||||
def("apply_to_own_type", apply_to_own_type);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(cltree)
|
||||
BOOST_PYTHON_MODULE(cltree)
|
||||
{
|
||||
boost::python::class_<basic>("basic")
|
||||
.def("__repr__",&basic::repr)
|
||||
|
||||
@@ -1196,7 +1196,7 @@ PyObject* raw(const boost::python::tuple& args, const boost::python::dictionary&
|
||||
return BOOST_PYTHON_CONVERSION::to_python(first->i_ + second + third + fourth);
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(boost_python_test)
|
||||
BOOST_PYTHON_MODULE(boost_python_test)
|
||||
{
|
||||
boost::python::module_builder boost_python_test("boost_python_test");
|
||||
init_module(boost_python_test);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include "test_class.hpp"
|
||||
|
||||
#if defined(_AIX) && defined(__EDG_VERSION__) && __EDG_VERSION__ < 245
|
||||
@@ -20,7 +20,7 @@ typedef test_class<1> Y;
|
||||
|
||||
double get_fair_value(X const& x) { return x.value(); }
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(data_members_ext)
|
||||
BOOST_PYTHON_MODULE(data_members_ext)
|
||||
{
|
||||
class_<X>("X", init<int>())
|
||||
.def("value", &X::value)
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
// to its suitability for any purpose.
|
||||
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/tuple.hpp>
|
||||
#include <boost/python/list.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/overloads.hpp>
|
||||
#include <boost/python/return_internal_reference.hpp>
|
||||
|
||||
#if defined(_AIX) && defined(__EDG_VERSION__) && __EDG_VERSION__ < 245
|
||||
@@ -147,17 +147,11 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(X_foo_3_stubs, foo, 2, 3)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(defaults_ext)
|
||||
BOOST_PYTHON_MODULE(defaults_ext)
|
||||
{
|
||||
def("foo", foo, foo_stubs());
|
||||
def("bar", (object(*)(int, char, std::string, double))0, bar_stubs());
|
||||
|
||||
// Show that this works with the old obsolete module version of def().
|
||||
module("defaults_ext")
|
||||
.def("foobar", foo, foo_stubs())
|
||||
.def("barfoo", (object(*)(int, char, std::string, double))0, bar_stubs())
|
||||
;
|
||||
|
||||
class_<Y>("Y", init<>("doc of Y init")) // this should work
|
||||
.def("get_state", &Y::get_state)
|
||||
;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/dict.hpp>
|
||||
@@ -68,7 +68,7 @@ void test_templates(object print)
|
||||
//print(tmp[3]);
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(dict_ext)
|
||||
BOOST_PYTHON_MODULE(dict_ext)
|
||||
{
|
||||
def("new_dict", new_dict);
|
||||
def("data_dict", data_dict);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <string>
|
||||
#include <boost/python/operators.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/scope.hpp>
|
||||
#include <boost/python/manage_new_object.hpp>
|
||||
@@ -30,7 +30,7 @@ unsigned long fact(unsigned long n)
|
||||
return n <= 1 ? n : n * fact(n - 1);
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(docstring_ext)
|
||||
BOOST_PYTHON_MODULE(docstring_ext)
|
||||
{
|
||||
scope().attr("__doc__") =
|
||||
"A simple test module for documentation strings\n"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// to its suitability for any purpose.
|
||||
#include <boost/python/enum.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
@@ -13,7 +13,7 @@ enum color { red = 1, green = 2, blue = 4 };
|
||||
|
||||
color identity_(color x) { return x; }
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(enum_ext)
|
||||
BOOST_PYTHON_MODULE(enum_ext)
|
||||
{
|
||||
enum_<color>("color")
|
||||
.value("red", red)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/exception_translator.hpp>
|
||||
|
||||
@@ -15,7 +15,7 @@ void throw_error()
|
||||
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(exception_translator_ext)
|
||||
BOOST_PYTHON_MODULE(exception_translator_ext)
|
||||
{
|
||||
using namespace boost::python;
|
||||
register_exception_translator<error>(&translate);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "test_class.hpp"
|
||||
#include <boost/python/extract.hpp>
|
||||
#include <boost/python/list.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/reference_existing_object.hpp>
|
||||
@@ -96,7 +96,7 @@ std::string x_rep(X const& x)
|
||||
return "X(" + boost::lexical_cast<std::string>(x.value()) + ")";
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(extract_ext)
|
||||
BOOST_PYTHON_MODULE(extract_ext)
|
||||
{
|
||||
implicitly_convertible<int, X>();
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// to its suitability for any purpose.
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/implicit.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include "test_class.hpp"
|
||||
|
||||
@@ -20,7 +20,7 @@ int x_value(X const& x)
|
||||
|
||||
X make_x(int n) { return X(n); }
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(implicit_ext)
|
||||
BOOST_PYTHON_MODULE(implicit_ext)
|
||||
{
|
||||
implicitly_convertible<int,X>();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// 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.
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/iterator.hpp>
|
||||
@@ -35,7 +35,7 @@ list_range2 range2(list_int& x)
|
||||
// to work around an MSVC6 linker bug, which causes it to complain
|
||||
// about a "duplicate comdat" if the input iterator is instantiated in
|
||||
// the same module with the others.
|
||||
BOOST_PYTHON_MODULE_INIT(input_iterator)
|
||||
BOOST_PYTHON_MODULE(input_iterator)
|
||||
{
|
||||
def("range2", &::range2);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// 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.
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/return_internal_reference.hpp>
|
||||
@@ -77,7 +77,7 @@ private:
|
||||
list_int two;
|
||||
};
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(iterator_ext)
|
||||
BOOST_PYTHON_MODULE(iterator_ext)
|
||||
{
|
||||
def("range", &::range);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/list.hpp>
|
||||
@@ -125,7 +125,7 @@ void exercise(list x, object y, object print)
|
||||
assert(w[3] == 'i');
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(list_ext)
|
||||
BOOST_PYTHON_MODULE(list_ext)
|
||||
{
|
||||
def("new_list", new_list);
|
||||
def("listify", listify);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/long.hpp>
|
||||
#include <cassert>
|
||||
@@ -39,7 +39,7 @@ int is_long2(char const*)
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(long_ext)
|
||||
BOOST_PYTHON_MODULE(long_ext)
|
||||
{
|
||||
def("new_long", new_long);
|
||||
def("longify", longify);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "simple_type.hpp"
|
||||
#include "complicated.hpp"
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/lvalue_from_pytype.hpp>
|
||||
#include <boost/python/copy_const_reference.hpp>
|
||||
@@ -199,7 +199,7 @@ D take_d_shared_ptr(boost::shared_ptr<D> d) { return *d; }
|
||||
|
||||
boost::shared_ptr<A> d_factory() { return boost::shared_ptr<B>(new D); }
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(m1)
|
||||
BOOST_PYTHON_MODULE(m1)
|
||||
{
|
||||
using namespace boost::python;
|
||||
using boost::shared_ptr;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// This module exercises the converters exposed in m1 at a low level
|
||||
// by exposing raw Python extension functions that use wrap<> and
|
||||
// unwrap<> objects.
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/copy_non_const_reference.hpp>
|
||||
#include <boost/python/copy_const_reference.hpp>
|
||||
@@ -61,7 +61,7 @@ struct rewrap
|
||||
static T f(T x) { return x; }
|
||||
};
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(m2)
|
||||
BOOST_PYTHON_MODULE(m2)
|
||||
{
|
||||
using boost::python::return_value_policy;
|
||||
using boost::python::copy_const_reference;
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
// 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.
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
|
||||
#if defined(_AIX) && defined(__EDG_VERSION__) && __EDG_VERSION__ < 245
|
||||
# include <iostream> // works around a KCC intermediate code generation bug
|
||||
#endif
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(minimal_ext)
|
||||
BOOST_PYTHON_MODULE(minimal_ext)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
|
||||
@@ -10,7 +10,7 @@ struct A
|
||||
) {}
|
||||
};
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(multi_arg_constructor_ext)
|
||||
BOOST_PYTHON_MODULE(multi_arg_constructor_ext)
|
||||
{
|
||||
using namespace boost::python;
|
||||
using boost::shared_ptr;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// 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.
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/operators.hpp>
|
||||
#include <boost/python/scope.hpp>
|
||||
@@ -28,7 +28,7 @@ std::ostream& operator<<(std::ostream& s, Y const& x)
|
||||
}
|
||||
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(nested_ext)
|
||||
BOOST_PYTHON_MODULE(nested_ext)
|
||||
{
|
||||
using namespace boost::python;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <boost/python/numeric.hpp>
|
||||
#include <boost/python/tuple.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
|
||||
using namespace boost::python;
|
||||
@@ -92,7 +92,7 @@ void exercise_numarray(numeric::array& y, object check)
|
||||
check(y.factory(make_tuple(1.2, 3.4), "Double", make_tuple(2), true, true));
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(numpy_ext)
|
||||
BOOST_PYTHON_MODULE(numpy_ext)
|
||||
{
|
||||
def("new_array", new_array);
|
||||
def("take_array", take_array);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// 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.
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/object.hpp>
|
||||
|
||||
@@ -279,7 +279,7 @@ bool check_inplace(object l, object o)
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(object_ext)
|
||||
BOOST_PYTHON_MODULE(object_ext)
|
||||
{
|
||||
def("call_object_3", call_object_3);
|
||||
def("message", message);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <string>
|
||||
#include <boost/python/operators.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include "test_class.hpp"
|
||||
#if __GNUC__ != 2
|
||||
@@ -57,7 +57,7 @@ std::ostream& operator<<(std::ostream& s, X const& x)
|
||||
return s << x.value();
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(operators_ext)
|
||||
BOOST_PYTHON_MODULE(operators_ext)
|
||||
{
|
||||
class_<X>("X", init<int>())
|
||||
.def("value", &X::value)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
For more information refer to boost/libs/python/doc/pickle.html.
|
||||
*/
|
||||
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/tuple.hpp>
|
||||
@@ -45,7 +45,7 @@ namespace {
|
||||
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(pickle1_ext)
|
||||
BOOST_PYTHON_MODULE(pickle1_ext)
|
||||
{
|
||||
using namespace boost::python;
|
||||
class_<world>("world", init<const std::string&>())
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/tuple.hpp>
|
||||
@@ -87,7 +87,7 @@ namespace { // Avoid cluttering the global namespace.
|
||||
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(pickle2_ext)
|
||||
BOOST_PYTHON_MODULE(pickle2_ext)
|
||||
{
|
||||
boost::python::class_<world>(
|
||||
"world", boost::python::init<const std::string&>())
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/tuple.hpp>
|
||||
@@ -95,7 +95,7 @@ namespace { // Avoid cluttering the global namespace.
|
||||
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(pickle3_ext)
|
||||
BOOST_PYTHON_MODULE(pickle3_ext)
|
||||
{
|
||||
boost::python::class_<world>(
|
||||
"world", boost::python::init<const std::string&>())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/str.hpp>
|
||||
@@ -59,7 +59,7 @@ void work_with_string(object print)
|
||||
}
|
||||
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(str_ext)
|
||||
BOOST_PYTHON_MODULE(str_ext)
|
||||
{
|
||||
def("convert_to_string",convert_to_string);
|
||||
def("work_with_string",work_with_string);
|
||||
|
||||
@@ -110,7 +110,7 @@ struct main_args {
|
||||
int python_main(main_args const &ma);
|
||||
|
||||
// python module init
|
||||
BOOST_PYTHON_MODULE_INIT(python_main)
|
||||
BOOST_PYTHON_MODULE(python_main)
|
||||
{
|
||||
DEF(python_main);
|
||||
CLASS(main_args);
|
||||
@@ -121,7 +121,7 @@ namespace sm {
|
||||
|
||||
int test_func() { return 7; }
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(sm_test)
|
||||
BOOST_PYTHON_MODULE(sm_test)
|
||||
{
|
||||
// define a submodule
|
||||
boost::python::module(".sm");
|
||||
@@ -160,7 +160,7 @@ c1::c2 test_func() {
|
||||
return c1().t;
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(sc_test)
|
||||
BOOST_PYTHON_MODULE(sc_test)
|
||||
{
|
||||
class_<c1::c2>("c1.c2")
|
||||
.def_init()
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
#include <string>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <complex>
|
||||
#include <boost/python/handle.hpp>
|
||||
@@ -57,7 +57,7 @@ handle<> return_null_handle()
|
||||
|
||||
char const* rewrap_value_mutable_cstring(char* x) { return x; }
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(builtin_converters)
|
||||
BOOST_PYTHON_MODULE(builtin_converters)
|
||||
{
|
||||
def("get_type", get_type);
|
||||
def("return_null_handle", return_null_handle);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// 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.
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/return_value_policy.hpp>
|
||||
#include <boost/python/manage_new_object.hpp>
|
||||
@@ -87,7 +87,7 @@ A* as_A(Base* b)
|
||||
return dynamic_cast<A*>(b);
|
||||
}
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(test_pointer_adoption_ext)
|
||||
BOOST_PYTHON_MODULE(test_pointer_adoption_ext)
|
||||
{
|
||||
def("num_a_instances", num_a_instances);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/tuple.hpp>
|
||||
@@ -19,7 +19,7 @@ tuple mktuple0() { return make_tuple(); }
|
||||
tuple mktuple1(int x) { return make_tuple(x); }
|
||||
tuple mktuple2(char const* a1, int x) { return make_tuple(a1, x); }
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(tuple_ext)
|
||||
BOOST_PYTHON_MODULE(tuple_ext)
|
||||
{
|
||||
def("convert_to_tuple",convert_to_tuple);
|
||||
def("test_operators",test_operators);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// "as is" without express or implied warranty, and with no claim as
|
||||
// to its suitability for any purpose.
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/module_init.hpp>
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/call_method.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
@@ -87,7 +87,7 @@ struct concrete_callback : concrete
|
||||
|
||||
int X::counter;
|
||||
|
||||
BOOST_PYTHON_MODULE_INIT(virtual_functions_ext)
|
||||
BOOST_PYTHON_MODULE(virtual_functions_ext)
|
||||
{
|
||||
class_<concrete, concrete_callback>("concrete", init<int>())
|
||||
.def("value", &concrete::value)
|
||||
|
||||
Reference in New Issue
Block a user