1 # /* **************************************************************************
\r
3 # * (C) Copyright Paul Mensonides 2002.
\r
4 # * Distributed under the Boost Software License, Version 1.0. (See
\r
5 # * accompanying file LICENSE_1_0.txt or copy at
\r
6 # * http://www.boost.org/LICENSE_1_0.txt)
\r
8 # ************************************************************************** */
\r
10 # /* See http://www.boost.org for most recent version. */
\r
12 # ifndef BOOST_PREPROCESSOR_SEQ_FOR_EACH_HPP
\r
13 # define BOOST_PREPROCESSOR_SEQ_FOR_EACH_HPP
\r
15 # include <boost/preprocessor/arithmetic/dec.hpp>
\r
16 # include <boost/preprocessor/config/config.hpp>
\r
17 # include <boost/preprocessor/repetition/for.hpp>
\r
18 # include <boost/preprocessor/seq/seq.hpp>
\r
19 # include <boost/preprocessor/seq/size.hpp>
\r
20 # include <boost/preprocessor/tuple/elem.hpp>
\r
21 # include <boost/preprocessor/tuple/rem.hpp>
\r
23 # /* BOOST_PP_SEQ_FOR_EACH */
\r
25 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
\r
26 # define BOOST_PP_SEQ_FOR_EACH(macro, data, seq) BOOST_PP_FOR((macro, data, seq (nil)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M)
\r
28 # define BOOST_PP_SEQ_FOR_EACH(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_D(macro, data, seq)
\r
29 # define BOOST_PP_SEQ_FOR_EACH_D(macro, data, seq) BOOST_PP_FOR((macro, data, seq (nil)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M)
\r
32 # define BOOST_PP_SEQ_FOR_EACH_P(r, x) BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM(3, 2, x)))
\r
34 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
\r
35 # define BOOST_PP_SEQ_FOR_EACH_O(r, x) BOOST_PP_SEQ_FOR_EACH_O_I x
\r
37 # define BOOST_PP_SEQ_FOR_EACH_O(r, x) BOOST_PP_SEQ_FOR_EACH_O_I(BOOST_PP_TUPLE_ELEM(3, 0, x), BOOST_PP_TUPLE_ELEM(3, 1, x), BOOST_PP_TUPLE_ELEM(3, 2, x))
\r
40 # define BOOST_PP_SEQ_FOR_EACH_O_I(macro, data, seq) (macro, data, BOOST_PP_SEQ_TAIL(seq))
\r
42 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
\r
43 # define BOOST_PP_SEQ_FOR_EACH_M(r, x) BOOST_PP_SEQ_FOR_EACH_M_IM(r, BOOST_PP_TUPLE_REM_3 x)
\r
44 # define BOOST_PP_SEQ_FOR_EACH_M_IM(r, im) BOOST_PP_SEQ_FOR_EACH_M_I(r, im)
\r
46 # define BOOST_PP_SEQ_FOR_EACH_M(r, x) BOOST_PP_SEQ_FOR_EACH_M_I(r, BOOST_PP_TUPLE_ELEM(3, 0, x), BOOST_PP_TUPLE_ELEM(3, 1, x), BOOST_PP_TUPLE_ELEM(3, 2, x))
\r
49 # define BOOST_PP_SEQ_FOR_EACH_M_I(r, macro, data, seq) macro(r, data, BOOST_PP_SEQ_HEAD(seq))
\r
51 # /* BOOST_PP_SEQ_FOR_EACH_R */
\r
53 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
\r
54 # define BOOST_PP_SEQ_FOR_EACH_R(r, macro, data, seq) BOOST_PP_FOR_ ## r((macro, data, seq (nil)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M)
\r
56 # define BOOST_PP_SEQ_FOR_EACH_R(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq)
\r
57 # define BOOST_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq) BOOST_PP_FOR_ ## r((macro, data, seq (nil)), BOOST_PP_SEQ_FOR_EACH_P, BOOST_PP_SEQ_FOR_EACH_O, BOOST_PP_SEQ_FOR_EACH_M)
\r