Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 1 | # /* 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 Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 14 | # ifndef NDNBOOST_PREPROCESSOR_REPETITION_REPEAT_FROM_TO_HPP |
| 15 | # define NDNBOOST_PREPROCESSOR_REPETITION_REPEAT_FROM_TO_HPP |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 16 | # |
| 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 Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 28 | # /* NDNBOOST_PP_REPEAT_FROM_TO */ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 29 | # |
| 30 | # if 0 |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 31 | # define NDNBOOST_PP_REPEAT_FROM_TO(first, last, macro, data) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 32 | # endif |
| 33 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 34 | # define NDNBOOST_PP_REPEAT_FROM_TO NDNBOOST_PP_CAT(NDNBOOST_PP_REPEAT_FROM_TO_, NDNBOOST_PP_AUTO_REC(NDNBOOST_PP_REPEAT_P, 4)) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 35 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 36 | # 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 Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 40 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 41 | # 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 Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 44 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 45 | # /* NDNBOOST_PP_REPEAT_FROM_TO_D */ |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 46 | # |
| 47 | # if 0 |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 48 | # define NDNBOOST_PP_REPEAT_FROM_TO_D(d, first, last, macro, data) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 49 | # endif |
| 50 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 51 | # 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 Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 52 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 53 | # 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 Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 57 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 58 | # 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 Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 64 | # endif |
| 65 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 66 | # 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 Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 73 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 74 | # 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 Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 77 | # endif |
| 78 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 79 | # 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 Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 82 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 83 | # 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 Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 86 | # |
| 87 | # endif |