Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame^] | 1 | # /* ************************************************************************** |
| 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_HPP |
| 13 | # define BOOST_PREPROCESSOR_SEQ_FOR_EACH_HPP |
| 14 | # |
| 15 | # include <ndnboost/preprocessor/arithmetic/dec.hpp> |
| 16 | # include <ndnboost/preprocessor/config/config.hpp> |
| 17 | # include <ndnboost/preprocessor/repetition/for.hpp> |
| 18 | # include <ndnboost/preprocessor/seq/seq.hpp> |
| 19 | # include <ndnboost/preprocessor/seq/size.hpp> |
| 20 | # include <ndnboost/preprocessor/tuple/elem.hpp> |
| 21 | # include <ndnboost/preprocessor/tuple/rem.hpp> |
| 22 | # |
| 23 | # /* BOOST_PP_SEQ_FOR_EACH */ |
| 24 | # |
| 25 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() |
| 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) |
| 27 | # else |
| 28 | # define BOOST_PP_SEQ_FOR_EACH(macro, data, seq) BOOST_PP_SEQ_FOR_EACH_D(macro, data, seq) |
| 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) |
| 30 | # endif |
| 31 | # |
| 32 | # define BOOST_PP_SEQ_FOR_EACH_P(r, x) BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_ELEM(3, 2, x))) |
| 33 | # |
| 34 | # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT() |
| 35 | # define BOOST_PP_SEQ_FOR_EACH_O(r, x) BOOST_PP_SEQ_FOR_EACH_O_I x |
| 36 | # else |
| 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)) |
| 38 | # endif |
| 39 | # |
| 40 | # define BOOST_PP_SEQ_FOR_EACH_O_I(macro, data, seq) (macro, data, BOOST_PP_SEQ_TAIL(seq)) |
| 41 | # |
| 42 | # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT() |
| 43 | # define BOOST_PP_SEQ_FOR_EACH_M(r, x) BOOST_PP_SEQ_FOR_EACH_M_IM(r, BOOST_PP_TUPLE_REM_3 x) |
| 44 | # define BOOST_PP_SEQ_FOR_EACH_M_IM(r, im) BOOST_PP_SEQ_FOR_EACH_M_I(r, im) |
| 45 | # else |
| 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)) |
| 47 | # endif |
| 48 | # |
| 49 | # define BOOST_PP_SEQ_FOR_EACH_M_I(r, macro, data, seq) macro(r, data, BOOST_PP_SEQ_HEAD(seq)) |
| 50 | # |
| 51 | # /* BOOST_PP_SEQ_FOR_EACH_R */ |
| 52 | # |
| 53 | # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() |
| 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) |
| 55 | # else |
| 56 | # define BOOST_PP_SEQ_FOR_EACH_R(r, macro, data, seq) BOOST_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq) |
| 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) |
| 58 | # endif |
| 59 | # |
| 60 | # endif |