|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72797 - in branches/pplib/v2: boost/preprocessor boost/preprocessor/facilities libs/preprocessor/test
From: eldiener_at_[hidden]
Date: 2011-06-29 11:54:54
Author: eldiener
Date: 2011-06-29 11:54:54 EDT (Wed, 29 Jun 2011)
New Revision: 72797
URL: http://svn.boost.org/trac/boost/changeset/72797
Log:
Added IS_TUPLE implementation.
Added:
branches/pplib/v2/boost/preprocessor/facilities/is_tuple.hpp (contents, props changed)
Text files modified:
branches/pplib/v2/boost/preprocessor/facilities.hpp | 1
branches/pplib/v2/libs/preprocessor/test/Jamfile.v2 | 76 +++++++++++++++++++++++++++++++++++++--
branches/pplib/v2/libs/preprocessor/test/facilities.c | 18 +++++++++
branches/pplib/v2/libs/preprocessor/test/facilities.cpp | 18 +++++++++
4 files changed, 108 insertions(+), 5 deletions(-)
Modified: branches/pplib/v2/boost/preprocessor/facilities.hpp
==============================================================================
--- branches/pplib/v2/boost/preprocessor/facilities.hpp (original)
+++ branches/pplib/v2/boost/preprocessor/facilities.hpp 2011-06-29 11:54:54 EDT (Wed, 29 Jun 2011)
@@ -18,6 +18,7 @@
# include <boost/preprocessor/facilities/expand.hpp>
# include <boost/preprocessor/facilities/identity.hpp>
# include <boost/preprocessor/facilities/intercept.hpp>
+# include <boost/preprocessor/facilities/is_tuple.hpp>
# include <boost/preprocessor/facilities/overload.hpp>
#
# endif
Added: branches/pplib/v2/boost/preprocessor/facilities/is_tuple.hpp
==============================================================================
--- (empty file)
+++ branches/pplib/v2/boost/preprocessor/facilities/is_tuple.hpp 2011-06-29 11:54:54 EDT (Wed, 29 Jun 2011)
@@ -0,0 +1,68 @@
+# /* **************************************************************************
+# * *
+# * (C) Copyright Edward Diener 2011. *
+# * Distributed under the Boost Software License, Version 1.0. (See *
+# * accompanying file LICENSE_1_0.txt or copy at *
+# * http://www.boost.org/LICENSE_1_0.txt) *
+# * *
+# ************************************************************************** */
+#
+# /* See http://www.boost.org for most recent version. */
+#
+# ifndef BOOST_PREPROCESSOR_FACILITIES_IS_TUPLE_HPP
+# define BOOST_PREPROCESSOR_FACILITIES_IS_TUPLE_HPP
+#
+# include <boost/preprocessor/config/config.hpp>
+# include <boost/preprocessor/arithmetic/dec.hpp>
+# include <boost/preprocessor/control/iif.hpp>
+# include <boost/preprocessor/facilities/is_empty.hpp>
+# include <boost/preprocessor/variadic/size.hpp>
+#
+# /* BOOST_PP_IS_TUPLE */
+#
+# if BOOST_PP_VARIADICS
+# define BOOST_PP_IS_TUPLE(x) \
+ BOOST_PP_IS_TUPLE_DETAIL_HAS_ONLY_PARENS(x) \
+/**/
+#
+# define BOOST_PP_IS_TUPLE_DETAIL_HAS_ONLY_PARENS(x) \
+ BOOST_PP_IIF \
+ ( \
+ BOOST_PP_IS_TUPLE_DETAIL_HAS_PARENS_BEGIN(x), \
+ BOOST_PP_IS_TUPLE_DETAIL_IS_NOT_AFTER, \
+ BOOST_PP_IS_TUPLE_DETAIL_GEN_ZERO \
+ ) \
+ (x) \
+/**/
+#
+# define BOOST_PP_IS_TUPLE_DETAIL_HAS_PARENS_BEGIN(x) \
+ BOOST_PP_DEC \
+ ( \
+ BOOST_PP_VARIADIC_SIZE \
+ ( \
+ BOOST_PP_IS_TUPLE_DETAIL_EXPAND x \
+ ) \
+ ) \
+/**/
+#
+# define BOOST_PP_IS_TUPLE_DETAIL_AFTER_PARENS(x) \
+ BOOST_PP_IS_TUPLE_DETAIL_EXPAND_AFTER x \
+/**/
+#
+# define BOOST_PP_IS_TUPLE_DETAIL_EXPAND(...) \
+ 1,1 \
+/**/
+#
+# define BOOST_PP_IS_TUPLE_DETAIL_IS_NOT_AFTER(x) \
+ BOOST_PP_IS_EMPTY(BOOST_PP_IS_TUPLE_DETAIL_EXPAND_AFTER x) \
+/**/
+#
+# define BOOST_PP_IS_TUPLE_DETAIL_EXPAND_AFTER(...) \
+/**/
+#
+# define BOOST_PP_IS_TUPLE_DETAIL_GEN_ZERO(x) \
+ 0 \
+/**/
+#
+# endif /* BOOST_PP_VARIADICS */
+# endif /* BOOST_PREPROCESSOR_IS_TUPLE_HPP */
Modified: branches/pplib/v2/libs/preprocessor/test/Jamfile.v2
==============================================================================
--- branches/pplib/v2/libs/preprocessor/test/Jamfile.v2 (original)
+++ branches/pplib/v2/libs/preprocessor/test/Jamfile.v2 2011-06-29 11:54:54 EDT (Wed, 29 Jun 2011)
@@ -5,16 +5,14 @@
import testing ;
project preprocessor_tests : requirements <warnings>on
- <toolset>gcc-4.3.0:<warnings>all
+ <toolset>msvc:<warnings>all
+ <toolset>gcc:<warnings>all
<toolset>gcc-4.3.0:<cxxflags>-Wno-variadic-macros
- <toolset>gcc-4.4.0:<warnings>all
<toolset>gcc-4.4.0:<cxxflags>-Wno-variadic-macros
- <toolset>gcc-4.5.0:<warnings>all
<toolset>gcc-4.5.0:<cxxflags>-Wno-variadic-macros
<toolset>gcc-4.5.0:<linkflags>"-Wl,--enable-auto-import"
- <toolset>gcc-4.5.2:<warnings>all
<toolset>gcc-4.5.2:<cxxflags>-Wno-variadic-macros
- <toolset>msvc:<warnings>all
+ <toolset>gcc-4.6.0:<cxxflags>-Wno-variadic-macros
;
test-suite preprocessor
@@ -36,6 +34,74 @@
[ compile variadic.cpp ]
;
+test-suite preprocessor_gcc
+ :
+ [ compile arithmetic.cpp
+ : <cflags>-std=c++0x
+ : arithmetic_gcc
+ ]
+ [ compile array.cpp
+ : <cflags>-std=c++0x
+ : array_gcc
+ ]
+ [ compile comparison.cpp
+ : <cflags>-std=c++0x
+ : comparison_gcc
+ ]
+ [ compile control.cpp
+ : <cflags>-std=c++0x
+ : control_gcc
+ ]
+ [ compile debug.cpp
+ : <cflags>-std=c++0x
+ : debug_gcc
+ ]
+ [ compile facilities.cpp
+ : <cflags>-std=c++0x
+ : facilities_gcc
+ ]
+ [ compile iteration.cpp
+ : <cflags>-std=c++0x
+ : iteration_gcc
+ ]
+ [ compile list.cpp
+ : <cflags>-std=c++0x
+ : list_gcc
+ ]
+ [ compile logical.cpp
+ : <cflags>-std=c++0x
+ : logical_gcc
+ ]
+ [ compile repetition.cpp
+ : <cflags>-std=c++0x
+ : repetition_gcc
+ ]
+ [ compile selection.cpp
+ : <cflags>-std=c++0x
+ : selection_gcc
+ ]
+ [ compile seq.cpp
+ : <cflags>-std=c++0x
+ : seq_gcc
+ ]
+ [ compile slot.cpp
+ : <cflags>-std=c++0x
+ : slot_gcc
+ ]
+ [ compile tuple.cpp
+ : <cflags>-std=c++0x
+ : tuple_gcc
+ ]
+ [ compile variadic.cpp
+ : <cflags>-std=c++0x
+ : variadic_gcc
+ ]
+ :
+ <toolset>gcc
+ ;
+
+test-suite preprocessor_gcc ;
+
test-suite preprocessor_nvm
:
[ compile arithmetic.cpp : <define>BOOST_PP_VARIADICS=0 : arithmetic_nvm ]
Modified: branches/pplib/v2/libs/preprocessor/test/facilities.c
==============================================================================
--- branches/pplib/v2/libs/preprocessor/test/facilities.c (original)
+++ branches/pplib/v2/libs/preprocessor/test/facilities.c 2011-06-29 11:54:54 EDT (Wed, 29 Jun 2011)
@@ -13,6 +13,14 @@
# include <boost/preprocessor/facilities.hpp>
# include <libs/preprocessor/test/test.h>
+# if BOOST_PP_VARIADICS
+
+# define TUPLE (0, 1, 2, 3, 4, 5)
+# define TUPLE_LARGE (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)
+# define TUPLE_VERY_LARGE (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)
+
+#endif
+
BEGIN BOOST_PP_APPLY(BOOST_PP_NIL) 0 == 0 END
BEGIN BOOST_PP_APPLY((0)) == 0 END
@@ -26,3 +34,13 @@
BEGIN BOOST_PP_IDENTITY(1)() == 1 END
BEGIN BOOST_PP_CAT(BOOST_PP_INTERCEPT, 2) 1 == 1 END
+
+# if BOOST_PP_VARIADICS
+
+BEGIN BOOST_PP_IS_TUPLE(TUPLE) == 1 END
+BEGIN BOOST_PP_IS_TUPLE(TUPLE_LARGE) == 1 END
+BEGIN BOOST_PP_IS_TUPLE(TUPLE_VERY_LARGE) == 1 END
+BEGIN BOOST_PP_IS_TUPLE(A green test) == 0 END
+BEGIN BOOST_PP_IS_TUPLE(TUPLE_VERY_LARGE A green test) == 0 END
+
+#endif
Modified: branches/pplib/v2/libs/preprocessor/test/facilities.cpp
==============================================================================
--- branches/pplib/v2/libs/preprocessor/test/facilities.cpp (original)
+++ branches/pplib/v2/libs/preprocessor/test/facilities.cpp 2011-06-29 11:54:54 EDT (Wed, 29 Jun 2011)
@@ -13,6 +13,14 @@
# include <boost/preprocessor/facilities.hpp>
# include <libs/preprocessor/test/test.h>
+# if BOOST_PP_VARIADICS
+
+# define TUPLE (0, 1, 2, 3, 4, 5)
+# define TUPLE_LARGE (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)
+# define TUPLE_VERY_LARGE (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)
+
+#endif
+
BEGIN BOOST_PP_APPLY(BOOST_PP_NIL) 0 == 0 END
BEGIN BOOST_PP_APPLY((0)) == 0 END
@@ -26,3 +34,13 @@
BEGIN BOOST_PP_IDENTITY(1)() == 1 END
BEGIN BOOST_PP_CAT(BOOST_PP_INTERCEPT, 2) 1 == 1 END
+
+# if BOOST_PP_VARIADICS
+
+BEGIN BOOST_PP_IS_TUPLE(TUPLE) == 1 END
+BEGIN BOOST_PP_IS_TUPLE(TUPLE_LARGE) == 1 END
+BEGIN BOOST_PP_IS_TUPLE(TUPLE_VERY_LARGE) == 1 END
+BEGIN BOOST_PP_IS_TUPLE(A green test) == 0 END
+BEGIN BOOST_PP_IS_TUPLE(TUPLE_VERY_LARGE A green test) == 0 END
+
+#endif
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk