check.hpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # /* **************************************************************************
  2. # * *
  3. # * (C) Copyright Paul Mensonides 2002.
  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. # ifndef BOOST_PREPROCESSOR_DETAIL_CHECK_HPP
  13. # define BOOST_PREPROCESSOR_DETAIL_CHECK_HPP
  14. #
  15. # include <boost/preprocessor/cat.hpp>
  16. # include <boost/preprocessor/config/config.hpp>
  17. #
  18. # /* BOOST_PP_CHECK */
  19. #
  20. # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
  21. # define BOOST_PP_CHECK(x, type) BOOST_PP_CHECK_D(x, type)
  22. # else
  23. # define BOOST_PP_CHECK(x, type) BOOST_PP_CHECK_OO((x, type))
  24. # define BOOST_PP_CHECK_OO(par) BOOST_PP_CHECK_D ## par
  25. # endif
  26. #
  27. # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_DMC()
  28. # define BOOST_PP_CHECK_D(x, type) BOOST_PP_CHECK_1(BOOST_PP_CAT(BOOST_PP_CHECK_RESULT_, type x))
  29. # define BOOST_PP_CHECK_1(chk) BOOST_PP_CHECK_2(chk)
  30. # define BOOST_PP_CHECK_2(res, _) res
  31. # elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
  32. # define BOOST_PP_CHECK_D(x, type) BOOST_PP_CHECK_1(type x)
  33. # define BOOST_PP_CHECK_1(chk) BOOST_PP_CHECK_2(chk)
  34. # define BOOST_PP_CHECK_2(chk) BOOST_PP_CHECK_3((BOOST_PP_CHECK_RESULT_ ## chk))
  35. # define BOOST_PP_CHECK_3(im) BOOST_PP_CHECK_5(BOOST_PP_CHECK_4 im)
  36. # define BOOST_PP_CHECK_4(res, _) res
  37. # define BOOST_PP_CHECK_5(res) res
  38. # else /* DMC */
  39. # define BOOST_PP_CHECK_D(x, type) BOOST_PP_CHECK_OO((type x))
  40. # define BOOST_PP_CHECK_OO(par) BOOST_PP_CHECK_0 ## par
  41. # define BOOST_PP_CHECK_0(chk) BOOST_PP_CHECK_1(BOOST_PP_CAT(BOOST_PP_CHECK_RESULT_, chk))
  42. # define BOOST_PP_CHECK_1(chk) BOOST_PP_CHECK_2(chk)
  43. # define BOOST_PP_CHECK_2(res, _) res
  44. # endif
  45. #
  46. # define BOOST_PP_CHECK_RESULT_1 1, BOOST_PP_NIL
  47. #
  48. # endif