make_locals.hpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
  2. #ifndef BOOST_PHOENIX_SCOPE_DETAIL_MAKE_LOCALS_HPP
  3. #define BOOST_PHOENIX_SCOPE_DETAIL_MAKE_LOCALS_HPP
  4. #include <boost/phoenix/support/iterate.hpp>
  5. #include <boost/phoenix/scope/detail/preprocessed/make_locals.hpp>
  6. #endif
  7. #else
  8. #if !BOOST_PHOENIX_IS_ITERATING
  9. #ifndef BOOST_PHOENIX_SCOPE_DETAIL_MAKE_LOCALS_HPP
  10. #define BOOST_PHOENIX_SCOPE_DETAIL_MAKE_LOCALS_HPP
  11. #include <boost/phoenix/support/iterate.hpp>
  12. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  13. #pragma wave option(preserve: 2, line: 0, output: "preprocessed/make_locals_" BOOST_PHOENIX_LIMIT_STR ".hpp")
  14. #endif
  15. /*==============================================================================
  16. Copyright (c) 2005-2010 Joel de Guzman
  17. Copyright (c) 2010 Thomas Heller
  18. Distributed under the Boost Software License, Version 1.0. (See accompanying
  19. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  20. ==============================================================================*/
  21. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  22. #pragma wave option(preserve: 1)
  23. #endif
  24. #define BOOST_PHOENIX_TYPEDEF_LOCAL_TYPES(Z, N, D) \
  25. typedef \
  26. typename proto::result_of::value< \
  27. typename proto::result_of::child_c< \
  28. BOOST_PP_CAT(A, N) \
  29. , 0 \
  30. >::type \
  31. >::type \
  32. BOOST_PP_CAT(tag_type, N); \
  33. \
  34. typedef \
  35. typename proto::result_of::child_c< \
  36. BOOST_PP_CAT(A, N) \
  37. , 1 \
  38. >::type \
  39. BOOST_PP_CAT(var_type, N); \
  40. /**/
  41. #define BOOST_PHOENIX_TYPEDEF_LOCAL_PAIR_TYPES(Z, N, D) \
  42. BOOST_PP_COMMA_IF(N) \
  43. fusion::pair<BOOST_PP_CAT(tag_type, N), BOOST_PP_CAT(var_type, N)> \
  44. /**/
  45. #define BOOST_PHOENIX_CHILD_OF(Z, N, D) \
  46. BOOST_PP_COMMA_IF(N) proto::child_c<1>(BOOST_PP_CAT(a, N)) \
  47. /**/
  48. #define BOOST_PHOENIX_ITERATION_PARAMS \
  49. (3, (1, BOOST_PHOENIX_LOCAL_LIMIT, \
  50. <boost/phoenix/scope/detail/make_locals.hpp>))
  51. #include BOOST_PHOENIX_ITERATE()
  52. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  53. #pragma wave option(output: null)
  54. #endif
  55. #endif
  56. #else
  57. template <BOOST_PHOENIX_typename_A>
  58. struct make_locals<BOOST_PHOENIX_A>
  59. {
  60. BOOST_PP_REPEAT(
  61. BOOST_PHOENIX_ITERATION
  62. , BOOST_PHOENIX_TYPEDEF_LOCAL_TYPES
  63. , _
  64. )
  65. typedef fusion::map<
  66. BOOST_PP_REPEAT(
  67. BOOST_PHOENIX_ITERATION
  68. , BOOST_PHOENIX_TYPEDEF_LOCAL_PAIR_TYPES
  69. , _
  70. )
  71. > type;
  72. static type const make(BOOST_PHOENIX_A_a)
  73. {
  74. return
  75. type(
  76. BOOST_PP_REPEAT(
  77. BOOST_PHOENIX_ITERATION
  78. , BOOST_PHOENIX_CHILD_OF
  79. , _
  80. )
  81. );
  82. }
  83. };
  84. #endif
  85. #endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES