expression.hpp 4.3 KB

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