blob: 335cb1cb76d0098cfa4f05ac1da1d2164115fb0a [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_ENUM_HPP
15# define NDNBOOST_PREPROCESSOR_REPETITION_ENUM_HPP
Jeff Thompsona28eed82013-08-22 16:21:10 -070016#
17# include <ndnboost/preprocessor/cat.hpp>
18# include <ndnboost/preprocessor/config/config.hpp>
19# include <ndnboost/preprocessor/debug/error.hpp>
20# include <ndnboost/preprocessor/detail/auto_rec.hpp>
21# include <ndnboost/preprocessor/punctuation/comma_if.hpp>
22# include <ndnboost/preprocessor/repetition/repeat.hpp>
23# include <ndnboost/preprocessor/tuple/elem.hpp>
24# include <ndnboost/preprocessor/tuple/rem.hpp>
25#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070026# /* NDNBOOST_PP_ENUM */
Jeff Thompsona28eed82013-08-22 16:21:10 -070027#
28# if 0
Jeff Thompson3d613fd2013-10-15 15:39:04 -070029# define NDNBOOST_PP_ENUM(count, macro, data)
Jeff Thompsona28eed82013-08-22 16:21:10 -070030# endif
31#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070032# define NDNBOOST_PP_ENUM NDNBOOST_PP_CAT(NDNBOOST_PP_ENUM_, NDNBOOST_PP_AUTO_REC(NDNBOOST_PP_REPEAT_P, 4))
Jeff Thompsona28eed82013-08-22 16:21:10 -070033#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070034# if ~NDNBOOST_PP_CONFIG_FLAGS() & NDNBOOST_PP_CONFIG_EDG()
35# define NDNBOOST_PP_ENUM_1(c, m, d) NDNBOOST_PP_REPEAT_1(c, NDNBOOST_PP_ENUM_M_1, (m, d))
36# define NDNBOOST_PP_ENUM_2(c, m, d) NDNBOOST_PP_REPEAT_2(c, NDNBOOST_PP_ENUM_M_2, (m, d))
37# define NDNBOOST_PP_ENUM_3(c, m, d) NDNBOOST_PP_REPEAT_3(c, NDNBOOST_PP_ENUM_M_3, (m, d))
Jeff Thompsona28eed82013-08-22 16:21:10 -070038# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070039# define NDNBOOST_PP_ENUM_1(c, m, d) NDNBOOST_PP_ENUM_1_I(c, m, d)
40# define NDNBOOST_PP_ENUM_2(c, m, d) NDNBOOST_PP_ENUM_2_I(c, m, d)
41# define NDNBOOST_PP_ENUM_3(c, m, d) NDNBOOST_PP_ENUM_3_I(c, m, d)
42# define NDNBOOST_PP_ENUM_1_I(c, m, d) NDNBOOST_PP_REPEAT_1(c, NDNBOOST_PP_ENUM_M_1, (m, d))
43# define NDNBOOST_PP_ENUM_2_I(c, m, d) NDNBOOST_PP_REPEAT_2(c, NDNBOOST_PP_ENUM_M_2, (m, d))
44# define NDNBOOST_PP_ENUM_3_I(c, m, d) NDNBOOST_PP_REPEAT_3(c, NDNBOOST_PP_ENUM_M_3, (m, d))
Jeff Thompsona28eed82013-08-22 16:21:10 -070045# endif
46#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070047# define NDNBOOST_PP_ENUM_4(c, m, d) NDNBOOST_PP_ERROR(0x0003)
Jeff Thompsona28eed82013-08-22 16:21:10 -070048#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070049# if NDNBOOST_PP_CONFIG_FLAGS() & NDNBOOST_PP_CONFIG_STRICT()
50# define NDNBOOST_PP_ENUM_M_1(z, n, md) NDNBOOST_PP_ENUM_M_1_IM(z, n, NDNBOOST_PP_TUPLE_REM_2 md)
51# define NDNBOOST_PP_ENUM_M_2(z, n, md) NDNBOOST_PP_ENUM_M_2_IM(z, n, NDNBOOST_PP_TUPLE_REM_2 md)
52# define NDNBOOST_PP_ENUM_M_3(z, n, md) NDNBOOST_PP_ENUM_M_3_IM(z, n, NDNBOOST_PP_TUPLE_REM_2 md)
53# define NDNBOOST_PP_ENUM_M_1_IM(z, n, im) NDNBOOST_PP_ENUM_M_1_I(z, n, im)
54# define NDNBOOST_PP_ENUM_M_2_IM(z, n, im) NDNBOOST_PP_ENUM_M_2_I(z, n, im)
55# define NDNBOOST_PP_ENUM_M_3_IM(z, n, im) NDNBOOST_PP_ENUM_M_3_I(z, n, im)
Jeff Thompsona28eed82013-08-22 16:21:10 -070056# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070057# define NDNBOOST_PP_ENUM_M_1(z, n, md) NDNBOOST_PP_ENUM_M_1_I(z, n, NDNBOOST_PP_TUPLE_ELEM(2, 0, md), NDNBOOST_PP_TUPLE_ELEM(2, 1, md))
58# define NDNBOOST_PP_ENUM_M_2(z, n, md) NDNBOOST_PP_ENUM_M_2_I(z, n, NDNBOOST_PP_TUPLE_ELEM(2, 0, md), NDNBOOST_PP_TUPLE_ELEM(2, 1, md))
59# define NDNBOOST_PP_ENUM_M_3(z, n, md) NDNBOOST_PP_ENUM_M_3_I(z, n, NDNBOOST_PP_TUPLE_ELEM(2, 0, md), NDNBOOST_PP_TUPLE_ELEM(2, 1, md))
Jeff Thompsona28eed82013-08-22 16:21:10 -070060# endif
61#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070062# define NDNBOOST_PP_ENUM_M_1_I(z, n, m, d) NDNBOOST_PP_COMMA_IF(n) m(z, n, d)
63# define NDNBOOST_PP_ENUM_M_2_I(z, n, m, d) NDNBOOST_PP_COMMA_IF(n) m(z, n, d)
64# define NDNBOOST_PP_ENUM_M_3_I(z, n, m, d) NDNBOOST_PP_COMMA_IF(n) m(z, n, d)
Jeff Thompsona28eed82013-08-22 16:21:10 -070065#
66# endif