1 # /* **************************************************************************
3 # * (C) Copyright Paul Mensonides 2002.
4 # * Distributed under the Boost Software License, Version 1.0. (See
5 # * accompanying file LICENSE_1_0.txt or copy at
6 # * http://www.boost.org/LICENSE_1_0.txt)
8 # ************************************************************************** */
10 # /* See http://www.boost.org for most recent version. */
12 # ifndef BOOST_PREPROCESSOR_SEQ_FOR_EACH_I_HPP
13 # define BOOST_PREPROCESSOR_SEQ_FOR_EACH_I_HPP
15 # include <boost/preprocessor/arithmetic/dec.hpp>
16 # include <boost/preprocessor/arithmetic/inc.hpp>
17 # include <boost/preprocessor/config/config.hpp>
18 # include <boost/preprocessor/control/if.hpp>
19 # include <boost/preprocessor/control/iif.hpp>
20 # include <boost/preprocessor/repetition/for.hpp>
21 # include <boost/preprocessor/seq/seq.hpp>
22 # include <boost/preprocessor/seq/size.hpp>
23 # include <boost/preprocessor/seq/detail/is_empty.hpp>
24 # include <boost/preprocessor/tuple/elem.hpp>
25 # include <boost/preprocessor/tuple/rem.hpp>
27 # /* BOOST_PP_SEQ_FOR_EACH_I */
29 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
30 # define BOOST_PP_SEQ_FOR_EACH_I(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK(macro, data, seq)
32 # define BOOST_PP_SEQ_FOR_EACH_I(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_I_I(macro, data, seq)
33 # define BOOST_PP_SEQ_FOR_EACH_I_I(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK(macro, data, seq)
36 # define BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK_EXEC(macro, data, seq) BOOST_PP_FOR((macro, data, seq, 0, BOOST_PP_SEQ_SIZE(seq)), BOOST_PP_SEQ_FOR_EACH_I_P, BOOST_PP_SEQ_FOR_EACH_I_O, BOOST_PP_SEQ_FOR_EACH_I_M)
37 # define BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK_EMPTY(macro, data, seq)
39 # define BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK(macro, data, seq) \
42 BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \
43 BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK_EXEC, \
44 BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK_EMPTY \
49 # define BOOST_PP_SEQ_FOR_EACH_I_P(r, x) BOOST_PP_TUPLE_ELEM(5, 4, x)
51 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
52 # define BOOST_PP_SEQ_FOR_EACH_I_O(r, x) BOOST_PP_SEQ_FOR_EACH_I_O_I x
54 # define BOOST_PP_SEQ_FOR_EACH_I_O(r, x) BOOST_PP_SEQ_FOR_EACH_I_O_I(BOOST_PP_TUPLE_ELEM(5, 0, x), BOOST_PP_TUPLE_ELEM(5, 1, x), BOOST_PP_TUPLE_ELEM(5, 2, x), BOOST_PP_TUPLE_ELEM(5, 3, x), BOOST_PP_TUPLE_ELEM(5, 4, x))
57 # define BOOST_PP_SEQ_FOR_EACH_I_O_I(macro, data, seq, i, sz) \
58 BOOST_PP_SEQ_FOR_EACH_I_O_I_DEC(macro, data, seq, i, BOOST_PP_DEC(sz)) \
60 # define BOOST_PP_SEQ_FOR_EACH_I_O_I_DEC(macro, data, seq, i, sz) \
67 BOOST_PP_SEQ_FOR_EACH_I_O_I_TAIL, \
68 BOOST_PP_SEQ_FOR_EACH_I_O_I_NIL \
75 # define BOOST_PP_SEQ_FOR_EACH_I_O_I_TAIL(seq) BOOST_PP_SEQ_TAIL(seq)
76 # define BOOST_PP_SEQ_FOR_EACH_I_O_I_NIL(seq) BOOST_PP_NIL
78 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
79 # define BOOST_PP_SEQ_FOR_EACH_I_M(r, x) BOOST_PP_SEQ_FOR_EACH_I_M_IM(r, BOOST_PP_TUPLE_REM_5 x)
80 # define BOOST_PP_SEQ_FOR_EACH_I_M_IM(r, im) BOOST_PP_SEQ_FOR_EACH_I_M_I(r, im)
82 # define BOOST_PP_SEQ_FOR_EACH_I_M(r, x) BOOST_PP_SEQ_FOR_EACH_I_M_I(r, BOOST_PP_TUPLE_ELEM(5, 0, x), BOOST_PP_TUPLE_ELEM(5, 1, x), BOOST_PP_TUPLE_ELEM(5, 2, x), BOOST_PP_TUPLE_ELEM(5, 3, x), BOOST_PP_TUPLE_ELEM(5, 4, x))
85 # define BOOST_PP_SEQ_FOR_EACH_I_M_I(r, macro, data, seq, i, sz) macro(r, data, i, BOOST_PP_SEQ_HEAD(seq))
87 # /* BOOST_PP_SEQ_FOR_EACH_I_R */
89 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
90 # define BOOST_PP_SEQ_FOR_EACH_I_R(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK(r, macro, data, seq)
92 # define BOOST_PP_SEQ_FOR_EACH_I_R(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_I_R_I(r, macro, data, seq)
93 # define BOOST_PP_SEQ_FOR_EACH_I_R_I(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK(r, macro, data, seq)
96 # define BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK_EXEC(r, macro, data, seq) BOOST_PP_FOR_ ## r((macro, data, seq, 0, BOOST_PP_SEQ_SIZE(seq)), BOOST_PP_SEQ_FOR_EACH_I_P, BOOST_PP_SEQ_FOR_EACH_I_O, BOOST_PP_SEQ_FOR_EACH_I_M)
97 # define BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK_EMPTY(r, macro, data, seq)
99 # define BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK(r, macro, data, seq) \
102 BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \
103 BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK_EXEC, \
104 BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK_EMPTY \
106 (r, macro, data, seq) \