|
| 1 | +// Copyright David Abrahams 2002. Permission to copy, use, |
| 2 | +// modify, sell and distribute this software is granted provided this |
| 3 | +// copyright notice appears in all copies. This software is provided |
| 4 | +// "as is" without express or implied warranty, and with no claim as |
| 5 | +// to its suitability for any purpose. |
| 6 | +#ifndef PREPROCESSOR_DWA200247_HPP |
| 7 | +# define PREPROCESSOR_DWA200247_HPP |
| 8 | + |
| 9 | +# include <boost/config.hpp> |
| 10 | +# include <boost/preprocessor/tuple/to_list.hpp> |
| 11 | +# include <boost/preprocessor/repeat_from_to_2nd.hpp> |
| 12 | +# include <boost/preprocessor/inc.hpp> |
| 13 | +# include <boost/preprocessor/empty.hpp> |
| 14 | + |
| 15 | +namespace boost { namespace python { namespace detail { |
| 16 | + |
| 17 | +# define BOOST_PYTHON_CONST() const |
| 18 | +# define BOOST_PYTHON_VOLATILE() volatile |
| 19 | +# define BOOST_PYTHON_CONST_VOLATILE() const volatile |
| 20 | + |
| 21 | +# if !defined(__MWERKS__) || __MWERKS__ > 0x2407 |
| 22 | +# define BOOST_PYTHON_MEMBER_FUNCTION_CV \ |
| 23 | + BOOST_PP_TUPLE_TO_LIST(4, (BOOST_PP_EMPTY \ |
| 24 | + , BOOST_PYTHON_CONST \ |
| 25 | + , BOOST_PYTHON_VOLATILE \ |
| 26 | + , BOOST_PYTHON_CONST_VOLATILE)) |
| 27 | +# else |
| 28 | +# define BOOST_PYTHON_MEMBER_FUNCTION_CV \ |
| 29 | + BOOST_PP_TUPLE_TO_LIST(1, (BOOST_PP_EMPTY)) |
| 30 | +# endif |
| 31 | + |
| 32 | +#ifndef BOOST_PYTHON_DEBUGGABLE_ARITY |
| 33 | +# define BOOST_PYTHON_DEBUGGABLE_ARITY 10 |
| 34 | +#endif |
| 35 | + |
| 36 | +#ifndef BOOST_PYTHON_MAX_ARITY |
| 37 | +# if !defined(__EDG_VERSION__) || __EDG_VERSION__ > 245 |
| 38 | +// Generate at least two more arguments just to test the syntax |
| 39 | +# define BOOST_PYTHON_MAX_ARITY 12 |
| 40 | +# else |
| 41 | +// Current EDG compilers have a really slow preprocessor which makes |
| 42 | +// it important not to generate new functions with it unless |
| 43 | +// absolutely neccessary |
| 44 | +# define BOOST_PYTHON_MAX_ARITY BOOST_PYTHON_DEBUGGABLE_ARITY |
| 45 | +# endif |
| 46 | +#endif |
| 47 | + |
| 48 | +#ifdef BOOST_PYTHON_GENERATE_CODE |
| 49 | +# undef BOOST_STATIC_CONSTANT |
| 50 | +# define BOOST_PYTHON_ARITY_START 0 |
| 51 | +# define BOOST_PYTHON_ARITY_FINISH BOOST_PYTHON_DEBUGGABLE_ARITY |
| 52 | +# define BOOST_PYTHON_MF_ARITY_START 1 |
| 53 | +# define BOOST_PYTHON_MF_ARITY_FINISH BOOST_PP_INC(BOOST_PYTHON_DEBUGGABLE_ARITY) |
| 54 | +#else |
| 55 | +# define BOOST_PYTHON_ARITY_START BOOST_PYTHON_DEBUGGABLE_ARITY |
| 56 | +# define BOOST_PYTHON_ARITY_FINISH BOOST_PYTHON_MAX_ARITY |
| 57 | +# define BOOST_PYTHON_MF_ARITY_START BOOST_PP_INC(BOOST_PYTHON_DEBUGGABLE_ARITY) |
| 58 | +# define BOOST_PYTHON_MF_ARITY_FINISH BOOST_PP_INC(BOOST_PYTHON_MAX_ARITY) |
| 59 | +#endif |
| 60 | + |
| 61 | +# define BOOST_PYTHON_PF(Count) R(*)(BOOST_MPL_TEMPLATE_PARAMETERS(0,Count,A)) |
| 62 | +# define BOOST_PYTHON_PMF(Count, cv) R(A0::*)(BOOST_MPL_TEMPLATE_PARAMETERS(1,Count,A))cv() |
| 63 | + |
| 64 | +# define BOOST_PYTHON_REPEAT_ARITY_2ND(function,data) \ |
| 65 | + BOOST_PP_REPEAT_FROM_TO_2ND(BOOST_PYTHON_ARITY_START, BOOST_PYTHON_ARITY_FINISH, function, data) |
| 66 | + |
| 67 | +# define BOOST_PYTHON_REPEAT_MF_ARITY_2ND(function,data) \ |
| 68 | + BOOST_PP_REPEAT_FROM_TO_2ND(BOOST_PYTHON_MF_ARITY_START, BOOST_PYTHON_MF_ARITY_FINISH, function, data) |
| 69 | + |
| 70 | + |
| 71 | +}}} // namespace boost::python::detail |
| 72 | + |
| 73 | +#endif // PREPROCESSOR_DWA200247_HPP |
0 commit comments