1 # /* ************************************************************************** 2 # * * 3 # * (C) Copyright Edward Diener 2014. 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 # 12 # include <boost/preprocessor/punctuation.hpp> 13 # include <libs/preprocessor/test/test.h> 14 15 # define A_TUPLE (*,#,zz) 16 # define A_TUPLE2 (*,#,(zz,44,(e7))) 17 # define A_TUPLE_PLUS (mmf,34,^^,!) 456 18 # define PLUS_ATUPLE yyt (j,ii%) 19 # define JDATA ggh 20 # define NOT_TUPLE y6() 21 # define NOT_TUPLE2 &(kkkgg,(e)) 22 # define A_SEQ (r)($)(#) 23 # define AN_ARRAY (4,(5,7,f,x)) 24 # define A_LIST (e,(g,(&,BOOST_PP_NIL))) 25 # define DATA (5 + 3) * 4 26 # define DATA2 4 * (5 + 3) 27 # define DATA3 4 * (5 + 3) * (2 + 1) 28 # define DATA4 (5 + 3) * (2 + 1) * 4 29 30 // is_begin_parens 31 32 BEGIN BOOST_PP_IS_BEGIN_PARENS() == 0 END 33 BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE) == 1 END 34 BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE2) == 1 END 35 BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE_PLUS) == 1 END 36 BEGIN BOOST_PP_IS_BEGIN_PARENS(PLUS_ATUPLE) == 0 END 37 BEGIN BOOST_PP_IS_BEGIN_PARENS(JDATA) == 0 END 38 BEGIN BOOST_PP_IS_BEGIN_PARENS(NOT_TUPLE) == 0 END 39 BEGIN BOOST_PP_IS_BEGIN_PARENS(NOT_TUPLE2) == 0 END 40 BEGIN BOOST_PP_IS_BEGIN_PARENS(A_SEQ) == 1 END 41 BEGIN BOOST_PP_IS_BEGIN_PARENS(AN_ARRAY) == 1 END 42 BEGIN BOOST_PP_IS_BEGIN_PARENS(A_LIST) == 1 END 43 BEGIN BOOST_PP_IS_BEGIN_PARENS((y)2(x)) == 1 END 44 45 // remove_parens 46 47 BEGIN BOOST_PP_REMOVE_PARENS(DATA) == 17 END 48 BEGIN BOOST_PP_REMOVE_PARENS(DATA2)== 32 END 49 BEGIN BOOST_PP_REMOVE_PARENS(DATA3)== 96 END 50 BEGIN BOOST_PP_REMOVE_PARENS(DATA4)== 41 END 51