Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/src/module.cpp @ 33

Last change on this file since 33 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.3 KB
Line 
1//  (C) Copyright David Abrahams 2000.
2// Distributed under the Boost Software License, Version 1.0. (See
3// accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5//
6//  The author gratefully acknowleges the support of Dragon Systems, Inc., in
7//  producing this work.
8
9#include <boost/python/scope.hpp>
10#include <boost/python/object/add_to_namespace.hpp>
11
12namespace boost { namespace python { namespace detail {
13
14BOOST_PYTHON_DECL void scope_setattr_doc(char const* name, object const& x, char const* doc)
15{
16    // Use function::add_to_namespace to achieve overloading if
17    // appropriate.
18    scope current;
19    objects::add_to_namespace(current, name, x, doc);
20}
21
22namespace
23{
24  PyMethodDef initial_methods[] = { { 0, 0, 0, 0 } };
25}
26
27BOOST_PYTHON_DECL void init_module(char const* name, void(*init_function)())
28{
29   
30    PyObject* m
31        = Py_InitModule(const_cast<char*>(name), initial_methods);
32
33    if (m != 0)
34    {
35        // Create the current module scope
36        object m_obj(((borrowed_reference_t*)m));
37        scope current_module(m_obj);
38       
39        handle_exception(init_function);
40    }
41}
42
43}}} // namespace boost::python::detail
44
45namespace boost { namespace python {
46
47namespace detail
48{
49  BOOST_PYTHON_DECL PyObject* current_scope = 0;
50}
51
52}}
Note: See TracBrowser for help on using the repository browser.