blob: 1b36baaffb63735c231ed1ad253b220ca87c5186 [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001# /* **************************************************************************
2# * *
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)
7# * *
8# ************************************************************************** */
9#
10# /* See http://www.boost.org for most recent version. */
11#
12# ifndef BOOST_PREPROCESSOR_SEQ_FOR_EACH_I_HPP
13# define BOOST_PREPROCESSOR_SEQ_FOR_EACH_I_HPP
14#
15# include <ndnboost/preprocessor/arithmetic/dec.hpp>
16# include <ndnboost/preprocessor/arithmetic/inc.hpp>
17# include <ndnboost/preprocessor/config/config.hpp>
18# include <ndnboost/preprocessor/repetition/for.hpp>
19# include <ndnboost/preprocessor/seq/seq.hpp>
20# include <ndnboost/preprocessor/seq/size.hpp>
21# include <ndnboost/preprocessor/tuple/elem.hpp>
22# include <ndnboost/preprocessor/tuple/rem.hpp>
23#
24# /* BOOST_PP_SEQ_FOR_EACH_I */
25#
26# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
27# define BOOST_PP_SEQ_FOR_EACH_I(macro, data, seq) BOOST_PP_FOR((macro, data, seq (nil), 0), BOOST_PP_SEQ_FOR_EACH_I_P, BOOST_PP_SEQ_FOR_EACH_I_O, BOOST_PP_SEQ_FOR_EACH_I_M)
28# else
29# define BOOST_PP_SEQ_FOR_EACH_I(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_I_I(macro, data, seq)
30# define BOOST_PP_SEQ_FOR_EACH_I_I(macro, data, seq) BOOST_PP_FOR((macro, data, seq (nil), 0), BOOST_PP_SEQ_FOR_EACH_I_P, BOOST_PP_SEQ_FOR_EACH_I_O, BOOST_PP_SEQ_FOR_EACH_I_M)
31# endif
32#
33# define BOOST_PP_SEQ_FOR_EACH_I_P(r, x) BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM(4, 2, x)))
34#
35# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
36# define BOOST_PP_SEQ_FOR_EACH_I_O(r, x) BOOST_PP_SEQ_FOR_EACH_I_O_I x
37# else
38# define BOOST_PP_SEQ_FOR_EACH_I_O(r, x) BOOST_PP_SEQ_FOR_EACH_I_O_I(BOOST_PP_TUPLE_ELEM(4, 0, x), BOOST_PP_TUPLE_ELEM(4, 1, x), BOOST_PP_TUPLE_ELEM(4, 2, x), BOOST_PP_TUPLE_ELEM(4, 3, x))
39# endif
40#
41# define BOOST_PP_SEQ_FOR_EACH_I_O_I(macro, data, seq, i) (macro, data, BOOST_PP_SEQ_TAIL(seq), BOOST_PP_INC(i))
42#
43# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
44# define BOOST_PP_SEQ_FOR_EACH_I_M(r, x) BOOST_PP_SEQ_FOR_EACH_I_M_IM(r, BOOST_PP_TUPLE_REM_4 x)
45# define BOOST_PP_SEQ_FOR_EACH_I_M_IM(r, im) BOOST_PP_SEQ_FOR_EACH_I_M_I(r, im)
46# else
47# define BOOST_PP_SEQ_FOR_EACH_I_M(r, x) BOOST_PP_SEQ_FOR_EACH_I_M_I(r, BOOST_PP_TUPLE_ELEM(4, 0, x), BOOST_PP_TUPLE_ELEM(4, 1, x), BOOST_PP_TUPLE_ELEM(4, 2, x), BOOST_PP_TUPLE_ELEM(4, 3, x))
48# endif
49#
50# define BOOST_PP_SEQ_FOR_EACH_I_M_I(r, macro, data, seq, i) macro(r, data, i, BOOST_PP_SEQ_HEAD(seq))
51#
52# /* BOOST_PP_SEQ_FOR_EACH_I_R */
53#
54# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
55# define BOOST_PP_SEQ_FOR_EACH_I_R(r, macro, data, seq) BOOST_PP_FOR_ ## r((macro, data, seq (nil), 0), BOOST_PP_SEQ_FOR_EACH_I_P, BOOST_PP_SEQ_FOR_EACH_I_O, BOOST_PP_SEQ_FOR_EACH_I_M)
56# else
57# define BOOST_PP_SEQ_FOR_EACH_I_R(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_I_R_I(r, macro, data, seq)
58# define BOOST_PP_SEQ_FOR_EACH_I_R_I(r, macro, data, seq) BOOST_PP_FOR_ ## r((macro, data, seq (nil), 0), BOOST_PP_SEQ_FOR_EACH_I_P, BOOST_PP_SEQ_FOR_EACH_I_O, BOOST_PP_SEQ_FOR_EACH_I_M)
59# endif
60#
61# endif