expression.hpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #if !BOOST_PHOENIX_IS_ITERATING
  2. #include <boost/phoenix/support/iterate.hpp>
  3. #include <boost/preprocessor/comparison/equal.hpp>
  4. #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
  5. #include <boost/phoenix/core/detail/cpp03/preprocessed/expression.hpp>
  6. #else
  7. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  8. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/expression_" BOOST_PHOENIX_LIMIT_STR ".hpp")
  9. #endif
  10. /*=============================================================================
  11. Copyright (c) 2005-2010 Joel de Guzman
  12. Copyright (c) 2010 Eric Niebler
  13. Copyright (c) 2010 Thomas Heller
  14. Distributed under the Boost Software License, Version 1.0. (See accompanying
  15. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  16. ==============================================================================*/
  17. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  18. #pragma wave option(preserve: 1)
  19. #endif
  20. template <
  21. template <typename> class Actor
  22. , typename Tag
  23. , BOOST_PHOENIX_typename_A_void(BOOST_PHOENIX_COMPOSITE_LIMIT)
  24. , typename Dummy = void>
  25. struct expr_ext;
  26. template <
  27. typename Tag
  28. , BOOST_PHOENIX_typename_A_void(BOOST_PHOENIX_COMPOSITE_LIMIT)
  29. , typename Dummy = void
  30. >
  31. struct expr : expr_ext<actor, Tag, BOOST_PHOENIX_A(BOOST_PHOENIX_COMPOSITE_LIMIT)> {};
  32. #define M0(Z, N, D) \
  33. BOOST_PP_COMMA_IF(N) \
  34. typename proto::detail::uncvref<BOOST_PP_CAT(A, N)>::type
  35. #define M1(Z, N, D) \
  36. BOOST_PP_COMMA_IF(N) typename boost::add_reference<typename boost::add_const<BOOST_PP_CAT(A, N)>::type>::type BOOST_PP_CAT(a, N)
  37. #define BOOST_PHOENIX_ITERATION_PARAMS \
  38. (3, (1, BOOST_PHOENIX_COMPOSITE_LIMIT, \
  39. <boost/phoenix/core/detail/cpp03/expression.hpp>)) \
  40. /**/
  41. #include BOOST_PHOENIX_ITERATE()
  42. #undef M0
  43. #undef M1
  44. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  45. #pragma wave option(output: null)
  46. #endif
  47. #endif // PHOENIX_DONT_USE_PREPROCESSED_FILES
  48. #else
  49. template <template <typename> class Actor, typename Tag, BOOST_PHOENIX_typename_A>
  50. struct expr_ext<Actor, Tag, BOOST_PHOENIX_A>
  51. : proto::transform<expr_ext<Actor, Tag, BOOST_PHOENIX_A>, int>
  52. {
  53. typedef
  54. typename proto::result_of::make_expr<
  55. Tag
  56. , phoenix_default_domain //proto::basic_default_domain
  57. , BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, M0, _)
  58. >::type
  59. base_type;
  60. typedef Actor<base_type> type;
  61. typedef
  62. typename proto::nary_expr<Tag, BOOST_PHOENIX_A>::proto_grammar
  63. proto_grammar;
  64. static type make(BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, M1, _))
  65. { //?? actor or Actor??
  66. //Actor<base_type> const e =
  67. actor<base_type> const e =
  68. {
  69. proto::make_expr<
  70. Tag
  71. , phoenix_default_domain // proto::basic_default_domain
  72. >(BOOST_PHOENIX_a)
  73. };
  74. return e;
  75. }
  76. template<typename Expr, typename State, typename Data>
  77. struct impl
  78. : proto::pass_through<expr_ext>::template impl<Expr, State, Data>
  79. {};
  80. typedef Tag proto_tag;
  81. #define BOOST_PHOENIX_ENUM_CHILDREN(_, N, __) \
  82. typedef BOOST_PP_CAT(A, N) BOOST_PP_CAT(proto_child, N); \
  83. /**/
  84. BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_ENUM_CHILDREN, _)
  85. #undef BOOST_PHOENIX_ENUM_CHILDREN
  86. };
  87. #endif