source: NonGTP/Boost/boost/python/detail/preprocessor.hpp @ 857

Revision 857, 2.4 KB checked in by igarcia, 19 years ago (diff)
Line 
1// Copyright David Abrahams 2002.
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#ifndef PREPROCESSOR_DWA200247_HPP
6# define PREPROCESSOR_DWA200247_HPP
7
8# include <boost/preprocessor/cat.hpp>
9# include <boost/preprocessor/comma_if.hpp>
10# include <boost/preprocessor/repeat.hpp>
11# include <boost/preprocessor/tuple/elem.hpp>
12
13// stuff that should be in the preprocessor library
14
15# define BOOST_PYTHON_APPLY(x) BOOST_PP_CAT(BOOST_PYTHON_APPLY_, x)
16
17# define BOOST_PYTHON_APPLY_BOOST_PYTHON_ITEM(v) v
18# define BOOST_PYTHON_APPLY_BOOST_PYTHON_NIL
19
20// cv-qualifiers
21
22# if !defined(__MWERKS__) || __MWERKS__ > 0x2407
23#  define BOOST_PYTHON_CV_COUNT 4
24# else
25#  define BOOST_PYTHON_CV_COUNT 1
26# endif
27
28# ifndef BOOST_PYTHON_MAX_ARITY
29#  define BOOST_PYTHON_MAX_ARITY 15
30# endif
31
32# ifndef BOOST_PYTHON_MAX_BASES
33#  define BOOST_PYTHON_MAX_BASES 10
34# endif
35
36# define BOOST_PYTHON_CV_QUALIFIER(i)                          \
37    BOOST_PYTHON_APPLY(                                        \
38        BOOST_PP_TUPLE_ELEM(4, i, BOOST_PYTHON_CV_QUALIFIER_I) \
39    )
40
41# define BOOST_PYTHON_CV_QUALIFIER_I      \
42    (                                     \
43        BOOST_PYTHON_NIL,                 \
44        BOOST_PYTHON_ITEM(const),         \
45        BOOST_PYTHON_ITEM(volatile),      \
46        BOOST_PYTHON_ITEM(const volatile) \
47    )
48
49// enumerators
50# define BOOST_PYTHON_UNARY_ENUM(c, text) BOOST_PP_REPEAT(c, BOOST_PYTHON_UNARY_ENUM_I, text)
51# define BOOST_PYTHON_UNARY_ENUM_I(z, n, text) BOOST_PP_COMMA_IF(n) text ## n
52
53# define BOOST_PYTHON_BINARY_ENUM(c, a, b) BOOST_PP_REPEAT(c, BOOST_PYTHON_BINARY_ENUM_I, (a, b))
54# define BOOST_PYTHON_BINARY_ENUM_I(z, n, _) BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, _), n) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 1, _), n)
55
56# define BOOST_PYTHON_ENUM_WITH_DEFAULT(c, text, def) BOOST_PP_REPEAT(c, BOOST_PYTHON_ENUM_WITH_DEFAULT_I, (text, def))
57# define BOOST_PYTHON_ENUM_WITH_DEFAULT_I(z, n, _) BOOST_PP_COMMA_IF(n) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, _), n) = BOOST_PP_TUPLE_ELEM(2, 1, _)
58
59// fixed text (no commas)
60# define BOOST_PYTHON_FIXED(z, n, text) text
61
62// flags
63# define BOOST_PYTHON_FUNCTION_POINTER 0x0001
64# define BOOST_PYTHON_POINTER_TO_MEMBER 0x0002
65
66#endif // PREPROCESSOR_DWA200247_HPP
Note: See TracBrowser for help on using the repository browser.