blob: 24df067bfefca2a75f8c5244aee1474e607336bb [file] [log] [blame]
Jeff Thompsonef2d5a42013-08-22 19:09:24 -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#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070012# ifndef NDNBOOST_PREPROCESSOR_SEQ_FOR_EACH_HPP
13# define NDNBOOST_PREPROCESSOR_SEQ_FOR_EACH_HPP
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070014#
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#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070023# /* NDNBOOST_PP_SEQ_FOR_EACH */
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070024#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070025# if ~NDNBOOST_PP_CONFIG_FLAGS() & NDNBOOST_PP_CONFIG_EDG()
26# define NDNBOOST_PP_SEQ_FOR_EACH(macro, data, seq) NDNBOOST_PP_FOR((macro, data, seq (nil)), NDNBOOST_PP_SEQ_FOR_EACH_P, NDNBOOST_PP_SEQ_FOR_EACH_O, NDNBOOST_PP_SEQ_FOR_EACH_M)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070027# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070028# define NDNBOOST_PP_SEQ_FOR_EACH(macro, data, seq) NDNBOOST_PP_SEQ_FOR_EACH_D(macro, data, seq)
29# define NDNBOOST_PP_SEQ_FOR_EACH_D(macro, data, seq) NDNBOOST_PP_FOR((macro, data, seq (nil)), NDNBOOST_PP_SEQ_FOR_EACH_P, NDNBOOST_PP_SEQ_FOR_EACH_O, NDNBOOST_PP_SEQ_FOR_EACH_M)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070030# endif
31#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070032# define NDNBOOST_PP_SEQ_FOR_EACH_P(r, x) NDNBOOST_PP_DEC(NDNBOOST_PP_SEQ_SIZE(NDNBOOST_PP_TUPLE_ELEM(3, 2, x)))
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070033#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070034# if NDNBOOST_PP_CONFIG_FLAGS() & NDNBOOST_PP_CONFIG_STRICT()
35# define NDNBOOST_PP_SEQ_FOR_EACH_O(r, x) NDNBOOST_PP_SEQ_FOR_EACH_O_I x
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070036# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070037# define NDNBOOST_PP_SEQ_FOR_EACH_O(r, x) NDNBOOST_PP_SEQ_FOR_EACH_O_I(NDNBOOST_PP_TUPLE_ELEM(3, 0, x), NDNBOOST_PP_TUPLE_ELEM(3, 1, x), NDNBOOST_PP_TUPLE_ELEM(3, 2, x))
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070038# endif
39#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070040# define NDNBOOST_PP_SEQ_FOR_EACH_O_I(macro, data, seq) (macro, data, NDNBOOST_PP_SEQ_TAIL(seq))
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070041#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070042# if NDNBOOST_PP_CONFIG_FLAGS() & NDNBOOST_PP_CONFIG_STRICT()
43# define NDNBOOST_PP_SEQ_FOR_EACH_M(r, x) NDNBOOST_PP_SEQ_FOR_EACH_M_IM(r, NDNBOOST_PP_TUPLE_REM_3 x)
44# define NDNBOOST_PP_SEQ_FOR_EACH_M_IM(r, im) NDNBOOST_PP_SEQ_FOR_EACH_M_I(r, im)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070045# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070046# define NDNBOOST_PP_SEQ_FOR_EACH_M(r, x) NDNBOOST_PP_SEQ_FOR_EACH_M_I(r, NDNBOOST_PP_TUPLE_ELEM(3, 0, x), NDNBOOST_PP_TUPLE_ELEM(3, 1, x), NDNBOOST_PP_TUPLE_ELEM(3, 2, x))
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070047# endif
48#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070049# define NDNBOOST_PP_SEQ_FOR_EACH_M_I(r, macro, data, seq) macro(r, data, NDNBOOST_PP_SEQ_HEAD(seq))
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070050#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070051# /* NDNBOOST_PP_SEQ_FOR_EACH_R */
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070052#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070053# if ~NDNBOOST_PP_CONFIG_FLAGS() & NDNBOOST_PP_CONFIG_EDG()
54# define NDNBOOST_PP_SEQ_FOR_EACH_R(r, macro, data, seq) NDNBOOST_PP_FOR_ ## r((macro, data, seq (nil)), NDNBOOST_PP_SEQ_FOR_EACH_P, NDNBOOST_PP_SEQ_FOR_EACH_O, NDNBOOST_PP_SEQ_FOR_EACH_M)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070055# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070056# define NDNBOOST_PP_SEQ_FOR_EACH_R(r, macro, data, seq) NDNBOOST_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq)
57# define NDNBOOST_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq) NDNBOOST_PP_FOR_ ## r((macro, data, seq (nil)), NDNBOOST_PP_SEQ_FOR_EACH_P, NDNBOOST_PP_SEQ_FOR_EACH_O, NDNBOOST_PP_SEQ_FOR_EACH_M)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070058# endif
59#
60# endif