mirror of
https://github.com/boostorg/python.git
synced 2026-01-26 18:52:26 +00:00
Compare commits
4 Commits
boost-0.9.
...
svn-branch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74bd00489a | ||
|
|
c0066c48ad | ||
|
|
fcc1f39030 | ||
|
|
7d4094aa4a |
160
doc/index.html
Normal file
160
doc/index.html
Normal file
@@ -0,0 +1,160 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN"
|
||||
"http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
||||
<title>
|
||||
The Boost Python Library (BPL)
|
||||
</title>
|
||||
<h1>
|
||||
<img src="../../../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277"
|
||||
align="center" height="86">The Boost Python Library (BPL)
|
||||
</h1>
|
||||
|
||||
<h2>Synopsis</h2>
|
||||
<p>
|
||||
Use the Boost Python Library to quickly and easily export a C++ library to <a
|
||||
href="http://www.python.org">Python</a> such that the Python interface is
|
||||
very similar to the C++ interface. It is designed to be minimally
|
||||
intrusive on your C++ design. In most cases, you should not have to alter
|
||||
your C++ classes in any way in order to use them with BPL. The system
|
||||
<em>should</em> simply ``reflect'' your C++ classes and functions into
|
||||
Python. The major features of BPL include support for:
|
||||
<ul>
|
||||
<li><a href="inheritance.html">Subclassing extension types in Python</a>
|
||||
<li><a href="overriding.html">Overriding virtual functions in Python</a>
|
||||
<li><a href="overloading.html">[Member] function Overloading</a>
|
||||
<li><a href="special.html#numeric_auto">Automatic wrapping of numeric operators</a>
|
||||
</ul>
|
||||
among others.
|
||||
|
||||
|
||||
<h2>Supported Platforms</h2>
|
||||
<p>BPL has been tested in the following configurations:
|
||||
|
||||
<ul>
|
||||
<li>Against Python 1.5.2 using the following compiler/library:
|
||||
|
||||
<ul>
|
||||
<li><a
|
||||
href="http://msdn.microsoft.com/vstudio/sp/vs6sp4/dnldoverview.asp">MSVC++6sp4</a>
|
||||
|
||||
<li><a
|
||||
href="http://msdn.microsoft.com/vstudio/sp/vs6sp4/dnldoverview.asp">MSVC++6sp4</a>/<a
|
||||
href="http://www.stlport.org">STLport 4.0</a>
|
||||
|
||||
<li><a href="http://gcc.gnu.org/">GCC 2.95.2</a> [by <a href="mailto:koethe@informatik.uni-hamburg.de">Ullrich
|
||||
Koethe</a>]
|
||||
|
||||
<li><a href="http://gcc.gnu.org/">GCC 2.95.2</a>/<a href="http://www.stlport.org">STLport 4.0</a>
|
||||
|
||||
<li>Compaq C++ V6.2-024 for Digital UNIX V5.0 Rev. 910 (an <a
|
||||
href="http://www.edg.com/">EDG</a>-based compiler) with <a
|
||||
href="http://www.stlport.org/beta.html">STLport-4.1b3</a> [by <a
|
||||
href="mailto:rwgk@cci.lbl.gov">Ralf W. Grosse-Kunstleve</a>]
|
||||
|
||||
<li>An upcoming release of <a href="http://www.metrowerks.com/products/windows/">Metrowerks CodeWarrior
|
||||
Pro6 for Windows</a> (the first release has a bug that's fatal to BPL)
|
||||
</ul>
|
||||
<br>
|
||||
<li>Against Python 2.0 using the following compiler/library combinations:
|
||||
<ul>
|
||||
<li><a
|
||||
href="http://msdn.microsoft.com/vstudio/sp/vs6sp4/dnldoverview.asp">MSVC++6sp4</a> [by
|
||||
<a href="mailto:aleaxit@yahoo.com">Alex Martelli</a>]
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<h2>Credits</h2>
|
||||
<ul>
|
||||
<li><a href="../../../people/dave_abrahams.htm">David Abrahams</a> originated
|
||||
and wrote the library.
|
||||
|
||||
<li><a href="mailto:koethe@informatik.uni-hamburg.de">Ullrich Koethe</a>
|
||||
had independently developed a similar system. When he discovered BPL,
|
||||
he generously contributed countless hours of coding and much insight into
|
||||
improving it. He is responsible for an early version of the support for <a
|
||||
href="overloading.html">function overloading</a> and wrote the support for
|
||||
<a href="inheritance.html#implicit_conversion">reflecting C++ inheritance
|
||||
relationships</a>. He has helped to improve error-reporting from both
|
||||
Python and C++, and has designed an extremely easy-to-use way of
|
||||
exposing <a href="special.html#numeric">numeric operators</a>, including
|
||||
a way to avoid explicit coercion by means of overloading.
|
||||
|
||||
<li>The members of the boost mailing list and the Python community
|
||||
supplied invaluable early feedback. In particular, Ron Clarke, Mark Evans,
|
||||
Anton Gluck, Ralf W. Grosse-Kunstleve, Chuck Ingold, Prabhu Ramachandran,
|
||||
and Barry Scott took the brave step of trying to use BPL while it was
|
||||
still in early stages of development.
|
||||
|
||||
<li>The development of BPL wouldn't have been
|
||||
possible without the generous support of <a href="http://www.dragonsys.com/">Dragon Systems/Lernout and
|
||||
Hauspie, Inc</a> who supported its development as an open-source project.
|
||||
</ul>
|
||||
|
||||
<h2>Table of Contents</h2>
|
||||
|
||||
<ol>
|
||||
<li><a href="extending.html">A Brief Introduction to writing Python
|
||||
extension modules</a>
|
||||
|
||||
<li><a href="comparisons.html">Comparisons between BPL and other
|
||||
systems for extending Python</a>
|
||||
|
||||
<li><a href="example1.html">A Simple Example</a>
|
||||
|
||||
<li><a href="overriding.html">Overridable Virtual Functions</a>
|
||||
|
||||
<li><a href="overloading.html">Function Overloading</a>
|
||||
|
||||
<li><a href="inheritance.html">Inheritance</a>
|
||||
|
||||
<li><a href="special.html">Special Method and Operator Support</a>
|
||||
|
||||
<li><a href="under-the-hood.html">A Peek Under the Hood</a>
|
||||
|
||||
<li><a href="building.html">Building an Extension Module</a>
|
||||
|
||||
<li>Advanced Topics
|
||||
|
||||
<ol>
|
||||
<li><a href="pickle.html">Pickle Support</a>
|
||||
|
||||
<li>class_builder<>
|
||||
|
||||
<li><a href="enums.html">enums</a>
|
||||
|
||||
<li>References
|
||||
|
||||
<li><a href="pointers.html">Pointers and Smart Pointers</a>
|
||||
|
||||
<li>Built-in Python Types
|
||||
|
||||
<li>Other Extension Types
|
||||
|
||||
<li>Templates
|
||||
|
||||
<li><a href="data_structures.txt">Internal Data Structures</a>
|
||||
</ol>
|
||||
|
||||
</ol>
|
||||
|
||||
<p>
|
||||
Documentation is a major ongoing project; assistance is greatly
|
||||
appreciated! In the meantime, useful examples of every BPL feature should
|
||||
be evident in the regression test files <code>test/comprehensive.[<a
|
||||
href="../test/comprehensive.py">py</a>/<a
|
||||
href="../test/comprehensive.hpp">hpp</a>/<a
|
||||
href="../test/comprehensive.cpp">cpp</a>]</code>
|
||||
|
||||
<p>
|
||||
Questions should be directed to <a href=
|
||||
"http://www.egroups.com/list/boost">the boost mailing list</a>.
|
||||
|
||||
<p>
|
||||
© Copyright David Abrahams 2000. Permission to copy, use, modify,
|
||||
sell and distribute this document is granted provided this copyright
|
||||
notice appears in all copies. This document is provided ``as is'' without
|
||||
express or implied warranty, and with no claim as to its suitability for
|
||||
any purpose.
|
||||
<p>
|
||||
Updated: Nov 26, 2000
|
||||
|
||||
257
include/boost/python/detail/indirect_traits.hpp
Normal file
257
include/boost/python/detail/indirect_traits.hpp
Normal file
@@ -0,0 +1,257 @@
|
||||
// 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 INDIRECT_TRAITS_DWA2002131_HPP
|
||||
# define INDIRECT_TRAITS_DWA2002131_HPP
|
||||
# include <boost/type_traits/cv_traits.hpp>
|
||||
# include <boost/type_traits/composite_traits.hpp>
|
||||
# include <boost/type_traits/function_traits.hpp>
|
||||
# include <boost/mpl/select_if.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <class T>
|
||||
struct is_reference_to_const
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_const<T const&>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
|
||||
# if 0 // Corresponding code doesn't work on MSVC yet
|
||||
template <class T>
|
||||
struct is_reference_to_function
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_function<T&>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = is_function<T>::value);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_function<T const&>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = is_function<T>::value);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_function<T volatile&>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = is_function<T>::value);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_function<T const volatile&>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = is_function<T>::value);
|
||||
};
|
||||
# endif
|
||||
|
||||
template <class T>
|
||||
struct is_pointer_to_function
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_pointer_to_function<T*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = is_function<T>::value);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_pointer_to_function<T const*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = is_function<T>::value);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_pointer_to_function<T volatile*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = is_function<T>::value);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_pointer_to_function<T const volatile*>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = is_function<T>::value);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_non_const
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value = (
|
||||
::boost::type_traits::ice_and<
|
||||
::boost::is_reference<T>::value
|
||||
, ::boost::type_traits::ice_not<
|
||||
::boost::python::detail::is_reference_to_const<T>::value>::value
|
||||
>::value)
|
||||
);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_volatile
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_volatile<T volatile&>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_pointer
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_pointer<T*&>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_pointer<T* const&>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_pointer<T* volatile&>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_pointer<T* const volatile&>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
# else
|
||||
|
||||
typedef char (&inner_yes_type)[3];
|
||||
typedef char (&inner_no_type)[2];
|
||||
typedef char (&outer_no_type)[1];
|
||||
|
||||
template <typename V>
|
||||
struct is_const_help
|
||||
{
|
||||
typedef typename mpl::select_if_c<
|
||||
is_const<V>::value
|
||||
, inner_yes_type
|
||||
, inner_no_type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template <typename V>
|
||||
struct is_volatile_help
|
||||
{
|
||||
typedef typename mpl::select_if_c<
|
||||
is_volatile<V>::value
|
||||
, inner_yes_type
|
||||
, inner_no_type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template <typename V>
|
||||
struct is_pointer_help
|
||||
{
|
||||
typedef typename mpl::select_if_c<
|
||||
is_pointer<V>::value
|
||||
, inner_yes_type
|
||||
, inner_no_type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
# if 0 // doesn't seem to work yet
|
||||
template <class T>
|
||||
struct is_reference_to_function
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= sizeof(::boost::detail::is_function_tester(t)) == sizeof(::boost::type_traits::yes_type));
|
||||
# endif
|
||||
|
||||
template <class T>
|
||||
struct is_pointer_to_function
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= sizeof(::boost::detail::is_function_tester(t)) == sizeof(::boost::type_traits::yes_type));
|
||||
};
|
||||
|
||||
template <typename V>
|
||||
typename is_const_help<V>::type reference_to_const_helper(V&);
|
||||
outer_no_type
|
||||
reference_to_const_helper(...);
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_const
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= (is_reference<T>::value
|
||||
&& sizeof(reference_to_const_helper(t)) == sizeof(inner_yes_type)));
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_non_const
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= (is_reference<T>::value
|
||||
&& sizeof(reference_to_const_helper(t)) == sizeof(inner_no_type)));
|
||||
};
|
||||
|
||||
template <typename V>
|
||||
typename is_volatile_help<V>::type reference_to_volatile_helper(V&);
|
||||
outer_no_type reference_to_volatile_helper(...);
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_volatile
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= (is_reference<T>::value
|
||||
&& sizeof(reference_to_volatile_helper(t)) == sizeof(inner_yes_type)));
|
||||
};
|
||||
|
||||
|
||||
template <typename V>
|
||||
typename is_pointer_help<V>::type reference_to_pointer_helper(V&);
|
||||
outer_no_type reference_to_pointer_helper(...);
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_pointer
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= (is_reference<T>::value
|
||||
&& sizeof(reference_to_pointer_helper(t)) == sizeof(inner_yes_type))
|
||||
);
|
||||
};
|
||||
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
#endif // INDIRECT_TRAITS_DWA2002131_HPP
|
||||
107
include/boost/python/detail/preprocessor.hpp
Normal file
107
include/boost/python/detail/preprocessor.hpp
Normal file
@@ -0,0 +1,107 @@
|
||||
// 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 PREPROCESSOR_DWA200247_HPP
|
||||
# define PREPROCESSOR_DWA200247_HPP
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/preprocessor/tuple/to_list.hpp>
|
||||
# include <boost/preprocessor/tuple/elem.hpp>
|
||||
# include <boost/preprocessor/list/for_each.hpp>
|
||||
# include <boost/preprocessor/repeat_from_to.hpp>
|
||||
# include <boost/preprocessor/repeat_from_to_2nd.hpp>
|
||||
# include <boost/preprocessor/inc.hpp>
|
||||
# include <boost/preprocessor/empty.hpp>
|
||||
# include <boost/preprocessor/enum.hpp>
|
||||
# include <boost/preprocessor/comma_if.hpp>
|
||||
# include <boost/preprocessor/comparison/not_equal.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
# define BOOST_PYTHON_CONST() const
|
||||
# define BOOST_PYTHON_VOLATILE() volatile
|
||||
# define BOOST_PYTHON_CONST_VOLATILE() const volatile
|
||||
|
||||
# define BOOST_PYTHON_ALL_CV \
|
||||
BOOST_PP_TUPLE_TO_LIST(4, (BOOST_PP_EMPTY \
|
||||
, BOOST_PYTHON_CONST \
|
||||
, BOOST_PYTHON_VOLATILE \
|
||||
, BOOST_PYTHON_CONST_VOLATILE))
|
||||
|
||||
# if !defined(__MWERKS__) || __MWERKS__ > 0x2407
|
||||
# define BOOST_PYTHON_MEMBER_FUNCTION_CV BOOST_PYTHON_ALL_CV
|
||||
# else
|
||||
# define BOOST_PYTHON_MEMBER_FUNCTION_CV BOOST_PP_TUPLE_TO_LIST(1, (BOOST_PP_EMPTY))
|
||||
# endif
|
||||
|
||||
#ifndef BOOST_PYTHON_DEBUGGABLE_ARITY
|
||||
# define BOOST_PYTHON_DEBUGGABLE_ARITY 10
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_PYTHON_MAX_ARITY
|
||||
# if !defined(__EDG_VERSION__) || __EDG_VERSION__ > 245
|
||||
// Generate at least two more arguments just to test the syntax
|
||||
# define BOOST_PYTHON_MAX_ARITY 12
|
||||
# else
|
||||
// Current EDG compilers have a really slow preprocessor which makes
|
||||
// it important not to generate new functions with it unless
|
||||
// absolutely neccessary
|
||||
# define BOOST_PYTHON_MAX_ARITY BOOST_PYTHON_DEBUGGABLE_ARITY
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_PYTHON_GENERATE_CODE
|
||||
# undef BOOST_STATIC_CONSTANT
|
||||
# define BOOST_PYTHON_ARITY_START 0
|
||||
# define BOOST_PYTHON_ARITY_FINISH BOOST_PYTHON_DEBUGGABLE_ARITY
|
||||
# define BOOST_PYTHON_MF_ARITY_START 1
|
||||
# define BOOST_PYTHON_MF_ARITY_FINISH BOOST_PP_INC(BOOST_PYTHON_DEBUGGABLE_ARITY)
|
||||
#else
|
||||
# define BOOST_PYTHON_ARITY_START BOOST_PYTHON_DEBUGGABLE_ARITY
|
||||
# define BOOST_PYTHON_ARITY_FINISH BOOST_PYTHON_MAX_ARITY
|
||||
# define BOOST_PYTHON_MF_ARITY_START BOOST_PP_INC(BOOST_PYTHON_DEBUGGABLE_ARITY)
|
||||
# define BOOST_PYTHON_MF_ARITY_FINISH BOOST_PP_INC(BOOST_PYTHON_MAX_ARITY)
|
||||
#endif
|
||||
|
||||
# define BOOST_PYTHON_PROJECT_1ST(a1,a2) a1
|
||||
# define BOOST_PYTHON_PROJECT_2ND(a1,a2) a2
|
||||
|
||||
# define BOOST_PYTHON_APPEND_PARAM_INDEX(index, param_start_pair) \
|
||||
BOOST_PP_COMMA_IF( \
|
||||
BOOST_PP_NOT_EQUAL(index, BOOST_PYTHON_PROJECT_2ND param_start_pair)) \
|
||||
BOOST_PP_CAT(BOOST_PYTHON_PROJECT_1ST param_start_pair,index)
|
||||
|
||||
# define BOOST_PYTHON_FN(inner,start,count) \
|
||||
R(inner)(BOOST_PP_REPEAT_FROM_TO( \
|
||||
start,count,BOOST_PYTHON_APPEND_PARAM_INDEX,(A,start)))
|
||||
|
||||
# define BOOST_PYTHON_REPEAT_ARITY_2ND(function,data) \
|
||||
BOOST_PP_REPEAT_FROM_TO_2ND( \
|
||||
BOOST_PYTHON_ARITY_START, BOOST_PYTHON_ARITY_FINISH \
|
||||
, function, data)
|
||||
|
||||
# define BOOST_PYTHON_REPEAT_MF_ARITY_2ND(function,data) \
|
||||
BOOST_PP_REPEAT_FROM_TO_2ND( \
|
||||
BOOST_PYTHON_MF_ARITY_START, BOOST_PYTHON_MF_ARITY_FINISH \
|
||||
, function, data)
|
||||
|
||||
# define BOOST_PYTHON_REPEAT_PMF_CV(index, function, cv) \
|
||||
BOOST_PYTHON_REPEAT_MF_ARITY_2ND(function,cv)
|
||||
|
||||
# define BOOST_PYTHON_REPEAT_MF_CV_2ND(function) \
|
||||
BOOST_PP_LIST_FOR_EACH(BOOST_PYTHON_REPEAT_PMF_CV,function,BOOST_PYTHON_MEMBER_FUNCTION_CV)
|
||||
|
||||
# define BOOST_PYTHON_REPEAT_MF_ALL_CV_2ND(function) \
|
||||
BOOST_PP_LIST_FOR_EACH(BOOST_PYTHON_REPEAT_PMF_CV,function,BOOST_PYTHON_ALL_CV)
|
||||
|
||||
#define BOOST_PYTHON_NUMBER_PAIR(Index, Pair) \
|
||||
BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,0,Pair),Index) \
|
||||
BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,1,Pair),Index)
|
||||
|
||||
#define BOOST_PYTHON_ENUM_PARAMS2(N, Pair) BOOST_PP_ENUM(N, BOOST_PYTHON_NUMBER_PAIR, Pair)
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
#endif // PREPROCESSOR_DWA200247_HPP
|
||||
108
include/boost/python/object/forward.hpp
Normal file
108
include/boost/python/object/forward.hpp
Normal file
@@ -0,0 +1,108 @@
|
||||
// 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 FORWARD_DWA20011215_HPP
|
||||
# define FORWARD_DWA20011215_HPP
|
||||
|
||||
# include <boost/mpl/select_if.hpp>
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/type_traits/composite_traits.hpp>
|
||||
# include <boost/type_traits/transform_traits.hpp>
|
||||
# include <boost/ref.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace objects {
|
||||
|
||||
template <class T>
|
||||
struct reference_to_value
|
||||
{
|
||||
typedef typename add_reference<typename add_const<T>::type>::type reference;
|
||||
|
||||
reference_to_value(reference x) : m_value(x) {}
|
||||
operator reference() 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 <class T>
|
||||
struct forward
|
||||
: mpl::select_if_c<
|
||||
is_scalar<T>::value
|
||||
, T
|
||||
, reference_to_value<T> >
|
||||
{
|
||||
};
|
||||
|
||||
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template<typename T>
|
||||
class unforward
|
||||
{
|
||||
public:
|
||||
typedef typename unwrap_reference<T>::type& type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class unforward<reference_to_value<T> >
|
||||
{
|
||||
public:
|
||||
typedef T 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<typename T>
|
||||
yes_reference_to_value_t is_reference_to_value_test(type< reference_to_value<T> >);
|
||||
|
||||
template<bool wrapped>
|
||||
struct unforwarder
|
||||
{
|
||||
template <class T>
|
||||
struct apply
|
||||
{
|
||||
typedef typename unwrap_reference<T>::type& type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct unforwarder<true>
|
||||
{
|
||||
template <class T>
|
||||
struct apply
|
||||
{
|
||||
typedef typename T::reference type;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class is_reference_to_value
|
||||
{
|
||||
public:
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value = (
|
||||
sizeof(is_reference_to_value_test(type<T>()))
|
||||
== sizeof(yes_reference_to_value_t)));
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
class unforward
|
||||
: public detail::unforwarder<
|
||||
detail::is_reference_to_value<T>::value
|
||||
>::template apply<T>
|
||||
{};
|
||||
|
||||
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
}}} // namespace boost::python::objects
|
||||
|
||||
#endif // FORWARD_DWA20011215_HPP
|
||||
180
pyste/NEWS
180
pyste/NEWS
@@ -1,180 +0,0 @@
|
||||
23 October 2003
|
||||
Fixed bug where a class would appear more than one in the generated code.
|
||||
|
||||
6 October 2003
|
||||
Fixed bug reported by Niall Douglas (using his patch) about UniqueInt not
|
||||
appearing correctly with --multiple.
|
||||
|
||||
Added precompiled header support on windows systems (using #pragma hdrstop).
|
||||
Suggested by Niall Douglas.
|
||||
|
||||
Fixed a bug with -I directive and AllFromHeader. Reported by Scott Snyder.
|
||||
|
||||
4 October 2003
|
||||
Added return_self, thanks for Niall Douglas for pointing out that it was
|
||||
missing.
|
||||
|
||||
Added --file-list, where you can pass a file where the pyste files are listed
|
||||
one per line. Also suggested by Niall Douglas.
|
||||
|
||||
Documentation has been finally updated, after a long wait. Please let me know
|
||||
if you spot any mistake!
|
||||
|
||||
2 October 2003
|
||||
Scott Snyder found a typo in ClassExporter that prevented -= and *= operators
|
||||
from being exported. Thanks Scott!
|
||||
|
||||
20 September 2003
|
||||
Added return_by_value in the list of policies supported. Thanks to Niall
|
||||
Douglas for the remainder.
|
||||
|
||||
19 September 2003
|
||||
Better support for unnamed enums, plus they are by default exported to the
|
||||
parent's namespace. Normal enums can have the same behaviour using the function
|
||||
export_values on the Enum object. Feature requested by Niall Douglas.
|
||||
|
||||
10 September 2003
|
||||
A new variable is accessible in the Pyste files: INTERFACE_FILE contains the
|
||||
full path of the pyste file.
|
||||
|
||||
4 September 2003
|
||||
Now it is possible to override protected and private pure virtual functions
|
||||
in Python, as requested by Roman Yakovenko.
|
||||
|
||||
23 August 2003
|
||||
Fixed bug where some Imports where not writing their include files.
|
||||
Now whenever the declarations change, the cache files are rebuilt
|
||||
automatically.
|
||||
|
||||
19 August 2003
|
||||
Fixed a bug related to the generation of the bases<> template.
|
||||
|
||||
17 August 2003
|
||||
Added support for insertion of user code in the generated code.
|
||||
|
||||
16 August 2003
|
||||
Applied a patch by Gottfried Ganssauge that adds exception specifiers to
|
||||
wrapper functions and pointer declarations. Thanks a lot Gottfried!!
|
||||
|
||||
Applied a patch by Prabhu Ramachandran that fixes ae problem with the
|
||||
pure virtual method generation. Thanks again Prabhu!
|
||||
|
||||
10 August 2003
|
||||
Support for incremental generation of the code has been added. This changes
|
||||
how --multiple works; documentation of this new feature will follow. Thanks
|
||||
to Prabhu Ramachandran, that saw the need for this feature and discussed a
|
||||
solution.
|
||||
|
||||
Automatically convert \ to / in Windows systems before passing the paths to
|
||||
gccxml.
|
||||
|
||||
Fixed a bug reported by Prabhu Ramachandran, where in some classes the virtual
|
||||
methods were being definied incorrectly. Thanks a lot Prabhu!
|
||||
|
||||
7 July 2003
|
||||
Applied 2 patches by Prabhu Ramachandran: a fix in the new --multiple method,
|
||||
and two new functions "hold_with_shared_ptr" and its counterpart for auto_ptr.
|
||||
Thanks a lot Prabhu!
|
||||
|
||||
Fixed a bug where the macro BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID was being
|
||||
called multiple times for the same type.
|
||||
Thanks to Gottfried Ganßauge for reporting this!
|
||||
|
||||
Fixed bug where using AllFromHeader didn't use bases<> when exporting
|
||||
hierarchies.
|
||||
|
||||
Fixed the staticmethod bug.
|
||||
|
||||
5 July 2003
|
||||
Changed how --multiple works: now it generates one cpp file for each pyste
|
||||
file, makeing easier to integrate Pyste with build systems.
|
||||
|
||||
4 July 2003
|
||||
Applied patch that solved a bug in ClassExporter and added a distutils install
|
||||
script (install/setup.py), both contributed by Prabhu Ramachandran.
|
||||
Thanks Prabhu!
|
||||
|
||||
2 July 2003
|
||||
Jim Wilson found a bug where types like "char**" were being interpreted as
|
||||
"char*". Thanks Jim!
|
||||
|
||||
16 June 2003
|
||||
Thanks to discussions with David Abrahams and Roman Sulzhyk, some behaviours
|
||||
have changed:
|
||||
|
||||
- If you export a derived class without exporting its base classes, the derived
|
||||
class will explicitly export the bases's methods and attributes. Before, if
|
||||
you were interested in the bases's methods, you had to export the base
|
||||
classes too.
|
||||
|
||||
- Added a new function, no_override. When a member function is specified as
|
||||
"no_override", no virtual wrappers are generated for it, improving
|
||||
performance and letting the code more clean.
|
||||
|
||||
- There was a bug in which the policy of virtual member functions was being
|
||||
ignored (patch by Roman Sulzhyk).
|
||||
|
||||
Thanks again to Roman Sulzhyk for the patches and discussion in the c++-sig.
|
||||
|
||||
4 June 2003
|
||||
Major improvements in memory usage.
|
||||
|
||||
3 June 2003
|
||||
Appliced a patch from Giulio Eulisse that allows unnamed enumerations to be
|
||||
exported with an AllFromHeader construct. Thanks a lot Giulio!
|
||||
|
||||
2 June 2003
|
||||
Added a new construct, add_method. See documentation.
|
||||
|
||||
23 May 2003
|
||||
Support for global variables added.
|
||||
Various bug fixes.
|
||||
|
||||
08 May 2003
|
||||
Fixed bug where in a certain cases the GCCXMLParser would end up with multiple
|
||||
declarations of the same class
|
||||
|
||||
22 Apr 2003
|
||||
- Now shows a warning when the user tries to export a forward-declared class.
|
||||
Forward-declared classes are ignored by the AllFromHeader construct.
|
||||
- Fixed a bug where classes, functions and enums where being exported, even if
|
||||
excluded from a AllFromHeader construct.
|
||||
|
||||
16 Apr 2003
|
||||
Added a more generic (but ugly) code to declare the smart pointer converters.
|
||||
|
||||
07 Apr 2003
|
||||
- Removed the warnings about forward declarations: it was not accurate enough.
|
||||
Another strategy must be thought of.
|
||||
- Fixed bug in the --multiple mode, where the order of the class instantiations
|
||||
could end up wrong.
|
||||
- Lots of fixes in the documentation, pointed out by Dirk Gerrits. Thanks Dirk!
|
||||
- Fixed support for the return_opaque_pointer policy (the support macro was not
|
||||
being declared).
|
||||
|
||||
|
||||
06 Apr 2003
|
||||
Support for the improved static data members support of Boost.Python.
|
||||
|
||||
05 Apr 2003
|
||||
New option for generating the bindings: --multiple.
|
||||
|
||||
02 Apr 2003
|
||||
Forward declarations are now detected and a warning is generated.
|
||||
|
||||
24 Mar 2003
|
||||
Default policy for functions/methods that return const T& is now
|
||||
return_value_policy<copy_const_reference>().
|
||||
|
||||
22 Mar 2003
|
||||
Exporting virtual methods of the base classes in the derived classes too.
|
||||
|
||||
21 Mar 2003
|
||||
Added manual support for boost::shared_ptr and std::auto_ptr (see doc).
|
||||
|
||||
19 Mar 2003
|
||||
Added support for int, double, float and long operators acting as expected in
|
||||
python.
|
||||
|
||||
14 Mar 2003
|
||||
Fixed bug: Wrappers for protected and virtual methods were not being generated.
|
||||
Reference in New Issue
Block a user