blob: 194c5b025b6601c83a6cf511a38315a6a109d117 [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001# /* Copyright (C) 2001
2# * Housemarque Oy
3# * http://www.housemarque.com
4# *
5# * Distributed under the Boost Software License, Version 1.0. (See
6# * accompanying file LICENSE_1_0.txt or copy at
7# * http://www.boost.org/LICENSE_1_0.txt)
8# */
9#
10# /* Revised by Paul Mensonides (2002) */
11#
12# /* See http://www.boost.org for most recent version. */
13#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070014# ifndef NDNBOOST_PREPROCESSOR_REPETITION_REPEAT_FROM_TO_HPP
15# define NDNBOOST_PREPROCESSOR_REPETITION_REPEAT_FROM_TO_HPP
Jeff Thompsona28eed82013-08-22 16:21:10 -070016#
17# include <ndnboost/preprocessor/arithmetic/add.hpp>
18# include <ndnboost/preprocessor/arithmetic/sub.hpp>
19# include <ndnboost/preprocessor/cat.hpp>
20# include <ndnboost/preprocessor/config/config.hpp>
21# include <ndnboost/preprocessor/control/while.hpp>
22# include <ndnboost/preprocessor/debug/error.hpp>
23# include <ndnboost/preprocessor/detail/auto_rec.hpp>
24# include <ndnboost/preprocessor/repetition/repeat.hpp>
25# include <ndnboost/preprocessor/tuple/elem.hpp>
26# include <ndnboost/preprocessor/tuple/rem.hpp>
27#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070028# /* NDNBOOST_PP_REPEAT_FROM_TO */
Jeff Thompsona28eed82013-08-22 16:21:10 -070029#
30# if 0
Jeff Thompson3d613fd2013-10-15 15:39:04 -070031# define NDNBOOST_PP_REPEAT_FROM_TO(first, last, macro, data)
Jeff Thompsona28eed82013-08-22 16:21:10 -070032# endif
33#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070034# define NDNBOOST_PP_REPEAT_FROM_TO NDNBOOST_PP_CAT(NDNBOOST_PP_REPEAT_FROM_TO_, NDNBOOST_PP_AUTO_REC(NDNBOOST_PP_REPEAT_P, 4))
Jeff Thompsona28eed82013-08-22 16:21:10 -070035#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070036# define NDNBOOST_PP_REPEAT_FROM_TO_1(f, l, m, dt) NDNBOOST_PP_REPEAT_FROM_TO_D_1(NDNBOOST_PP_AUTO_REC(NDNBOOST_PP_WHILE_P, 256), f, l, m, dt)
37# define NDNBOOST_PP_REPEAT_FROM_TO_2(f, l, m, dt) NDNBOOST_PP_REPEAT_FROM_TO_D_2(NDNBOOST_PP_AUTO_REC(NDNBOOST_PP_WHILE_P, 256), f, l, m, dt)
38# define NDNBOOST_PP_REPEAT_FROM_TO_3(f, l, m, dt) NDNBOOST_PP_REPEAT_FROM_TO_D_3(NDNBOOST_PP_AUTO_REC(NDNBOOST_PP_WHILE_P, 256), f, l, m, dt)
39# define NDNBOOST_PP_REPEAT_FROM_TO_4(f, l, m, dt) NDNBOOST_PP_ERROR(0x0003)
Jeff Thompsona28eed82013-08-22 16:21:10 -070040#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070041# define NDNBOOST_PP_REPEAT_FROM_TO_1ST NDNBOOST_PP_REPEAT_FROM_TO_1
42# define NDNBOOST_PP_REPEAT_FROM_TO_2ND NDNBOOST_PP_REPEAT_FROM_TO_2
43# define NDNBOOST_PP_REPEAT_FROM_TO_3RD NDNBOOST_PP_REPEAT_FROM_TO_3
Jeff Thompsona28eed82013-08-22 16:21:10 -070044#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070045# /* NDNBOOST_PP_REPEAT_FROM_TO_D */
Jeff Thompsona28eed82013-08-22 16:21:10 -070046#
47# if 0
Jeff Thompson3d613fd2013-10-15 15:39:04 -070048# define NDNBOOST_PP_REPEAT_FROM_TO_D(d, first, last, macro, data)
Jeff Thompsona28eed82013-08-22 16:21:10 -070049# endif
50#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070051# define NDNBOOST_PP_REPEAT_FROM_TO_D NDNBOOST_PP_CAT(NDNBOOST_PP_REPEAT_FROM_TO_D_, NDNBOOST_PP_AUTO_REC(NDNBOOST_PP_REPEAT_P, 4))
Jeff Thompsona28eed82013-08-22 16:21:10 -070052#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070053# if ~NDNBOOST_PP_CONFIG_FLAGS() & NDNBOOST_PP_CONFIG_EDG()
54# define NDNBOOST_PP_REPEAT_FROM_TO_D_1(d, f, l, m, dt) NDNBOOST_PP_REPEAT_1(NDNBOOST_PP_SUB_D(d, l, f), NDNBOOST_PP_REPEAT_FROM_TO_M_1, (d, f, m, dt))
55# define NDNBOOST_PP_REPEAT_FROM_TO_D_2(d, f, l, m, dt) NDNBOOST_PP_REPEAT_2(NDNBOOST_PP_SUB_D(d, l, f), NDNBOOST_PP_REPEAT_FROM_TO_M_2, (d, f, m, dt))
56# define NDNBOOST_PP_REPEAT_FROM_TO_D_3(d, f, l, m, dt) NDNBOOST_PP_REPEAT_3(NDNBOOST_PP_SUB_D(d, l, f), NDNBOOST_PP_REPEAT_FROM_TO_M_3, (d, f, m, dt))
Jeff Thompsona28eed82013-08-22 16:21:10 -070057# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070058# define NDNBOOST_PP_REPEAT_FROM_TO_D_1(d, f, l, m, dt) NDNBOOST_PP_REPEAT_FROM_TO_D_1_I(d, f, l, m, dt)
59# define NDNBOOST_PP_REPEAT_FROM_TO_D_2(d, f, l, m, dt) NDNBOOST_PP_REPEAT_FROM_TO_D_2_I(d, f, l, m, dt)
60# define NDNBOOST_PP_REPEAT_FROM_TO_D_3(d, f, l, m, dt) NDNBOOST_PP_REPEAT_FROM_TO_D_3_I(d, f, l, m, dt)
61# define NDNBOOST_PP_REPEAT_FROM_TO_D_1_I(d, f, l, m, dt) NDNBOOST_PP_REPEAT_1(NDNBOOST_PP_SUB_D(d, l, f), NDNBOOST_PP_REPEAT_FROM_TO_M_1, (d, f, m, dt))
62# define NDNBOOST_PP_REPEAT_FROM_TO_D_2_I(d, f, l, m, dt) NDNBOOST_PP_REPEAT_2(NDNBOOST_PP_SUB_D(d, l, f), NDNBOOST_PP_REPEAT_FROM_TO_M_2, (d, f, m, dt))
63# define NDNBOOST_PP_REPEAT_FROM_TO_D_3_I(d, f, l, m, dt) NDNBOOST_PP_REPEAT_3(NDNBOOST_PP_SUB_D(d, l, f), NDNBOOST_PP_REPEAT_FROM_TO_M_3, (d, f, m, dt))
Jeff Thompsona28eed82013-08-22 16:21:10 -070064# endif
65#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070066# if NDNBOOST_PP_CONFIG_FLAGS() & NDNBOOST_PP_CONFIG_STRICT()
67# define NDNBOOST_PP_REPEAT_FROM_TO_M_1(z, n, dfmd) NDNBOOST_PP_REPEAT_FROM_TO_M_1_IM(z, n, NDNBOOST_PP_TUPLE_REM_4 dfmd)
68# define NDNBOOST_PP_REPEAT_FROM_TO_M_2(z, n, dfmd) NDNBOOST_PP_REPEAT_FROM_TO_M_2_IM(z, n, NDNBOOST_PP_TUPLE_REM_4 dfmd)
69# define NDNBOOST_PP_REPEAT_FROM_TO_M_3(z, n, dfmd) NDNBOOST_PP_REPEAT_FROM_TO_M_3_IM(z, n, NDNBOOST_PP_TUPLE_REM_4 dfmd)
70# define NDNBOOST_PP_REPEAT_FROM_TO_M_1_IM(z, n, im) NDNBOOST_PP_REPEAT_FROM_TO_M_1_I(z, n, im)
71# define NDNBOOST_PP_REPEAT_FROM_TO_M_2_IM(z, n, im) NDNBOOST_PP_REPEAT_FROM_TO_M_2_I(z, n, im)
72# define NDNBOOST_PP_REPEAT_FROM_TO_M_3_IM(z, n, im) NDNBOOST_PP_REPEAT_FROM_TO_M_3_I(z, n, im)
Jeff Thompsona28eed82013-08-22 16:21:10 -070073# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070074# define NDNBOOST_PP_REPEAT_FROM_TO_M_1(z, n, dfmd) NDNBOOST_PP_REPEAT_FROM_TO_M_1_I(z, n, NDNBOOST_PP_TUPLE_ELEM(4, 0, dfmd), NDNBOOST_PP_TUPLE_ELEM(4, 1, dfmd), NDNBOOST_PP_TUPLE_ELEM(4, 2, dfmd), NDNBOOST_PP_TUPLE_ELEM(4, 3, dfmd))
75# define NDNBOOST_PP_REPEAT_FROM_TO_M_2(z, n, dfmd) NDNBOOST_PP_REPEAT_FROM_TO_M_2_I(z, n, NDNBOOST_PP_TUPLE_ELEM(4, 0, dfmd), NDNBOOST_PP_TUPLE_ELEM(4, 1, dfmd), NDNBOOST_PP_TUPLE_ELEM(4, 2, dfmd), NDNBOOST_PP_TUPLE_ELEM(4, 3, dfmd))
76# define NDNBOOST_PP_REPEAT_FROM_TO_M_3(z, n, dfmd) NDNBOOST_PP_REPEAT_FROM_TO_M_3_I(z, n, NDNBOOST_PP_TUPLE_ELEM(4, 0, dfmd), NDNBOOST_PP_TUPLE_ELEM(4, 1, dfmd), NDNBOOST_PP_TUPLE_ELEM(4, 2, dfmd), NDNBOOST_PP_TUPLE_ELEM(4, 3, dfmd))
Jeff Thompsona28eed82013-08-22 16:21:10 -070077# endif
78#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070079# define NDNBOOST_PP_REPEAT_FROM_TO_M_1_I(z, n, d, f, m, dt) NDNBOOST_PP_REPEAT_FROM_TO_M_1_II(z, NDNBOOST_PP_ADD_D(d, n, f), m, dt)
80# define NDNBOOST_PP_REPEAT_FROM_TO_M_2_I(z, n, d, f, m, dt) NDNBOOST_PP_REPEAT_FROM_TO_M_2_II(z, NDNBOOST_PP_ADD_D(d, n, f), m, dt)
81# define NDNBOOST_PP_REPEAT_FROM_TO_M_3_I(z, n, d, f, m, dt) NDNBOOST_PP_REPEAT_FROM_TO_M_3_II(z, NDNBOOST_PP_ADD_D(d, n, f), m, dt)
Jeff Thompsona28eed82013-08-22 16:21:10 -070082#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070083# define NDNBOOST_PP_REPEAT_FROM_TO_M_1_II(z, n, m, dt) m(z, n, dt)
84# define NDNBOOST_PP_REPEAT_FROM_TO_M_2_II(z, n, m, dt) m(z, n, dt)
85# define NDNBOOST_PP_REPEAT_FROM_TO_M_3_II(z, n, m, dt) m(z, n, dt)
Jeff Thompsona28eed82013-08-22 16:21:10 -070086#
87# endif