punctuation.cxx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. # if BOOST_PP_VARIADICS
  13. # include <boost/preprocessor/punctuation.hpp>
  14. # include <libs/preprocessor/test/test.h>
  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. // is_begin_parens
  30. BEGIN BOOST_PP_IS_BEGIN_PARENS() == 0 END
  31. BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE) == 1 END
  32. BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE2) == 1 END
  33. BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE_PLUS) == 1 END
  34. BEGIN BOOST_PP_IS_BEGIN_PARENS(PLUS_ATUPLE) == 0 END
  35. BEGIN BOOST_PP_IS_BEGIN_PARENS(JDATA) == 0 END
  36. BEGIN BOOST_PP_IS_BEGIN_PARENS(NOT_TUPLE) == 0 END
  37. BEGIN BOOST_PP_IS_BEGIN_PARENS(NOT_TUPLE2) == 0 END
  38. BEGIN BOOST_PP_IS_BEGIN_PARENS(A_SEQ) == 1 END
  39. BEGIN BOOST_PP_IS_BEGIN_PARENS(AN_ARRAY) == 1 END
  40. BEGIN BOOST_PP_IS_BEGIN_PARENS(A_LIST) == 1 END
  41. BEGIN BOOST_PP_IS_BEGIN_PARENS((y)2(x)) == 1 END
  42. // remove_parens
  43. BEGIN BOOST_PP_REMOVE_PARENS(DATA) == 17 END
  44. BEGIN BOOST_PP_REMOVE_PARENS(DATA2)== 32 END
  45. BEGIN BOOST_PP_REMOVE_PARENS(DATA3)== 96 END
  46. BEGIN BOOST_PP_REMOVE_PARENS(DATA4)== 41 END
  47. #endif