Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66911 - in sandbox/SOC/2010/phoenix3: boost/phoenix boost/phoenix/core boost/phoenix/scope boost/phoenix/statement libs/phoenix/test/scope
From: thom.heller_at_[hidden]
Date: 2010-11-30 14:10:30


Author: theller
Date: 2010-11-30 14:10:29 EST (Tue, 30 Nov 2010)
New Revision: 66911
URL: http://svn.boost.org/trac/boost/changeset/66911

Log:
temporary commit for let refactoring
Text files modified:
   sandbox/SOC/2010/phoenix3/boost/phoenix/core/expression.hpp | 34 ++++++-
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope.hpp | 2
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/let.hpp | 182 ++++++++++++++++++++++++++++++++++++++
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp | 184 +++++++++++++++++++++++++++++++++------
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/scoped_environment.hpp | 128 +++++++++++++--------------
   sandbox/SOC/2010/phoenix3/boost/phoenix/statement/sequence.hpp | 20 +++-
   sandbox/SOC/2010/phoenix3/boost/phoenix/statement/try_catch.hpp | 155 ++++++++++++++++++++++----------
   sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/let_tests.cpp | 18 +++
   8 files changed, 560 insertions(+), 163 deletions(-)

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/expression.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/expression.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/expression.hpp 2010-11-30 14:10:29 EST (Tue, 30 Nov 2010)
@@ -26,7 +26,11 @@
       , typename Dummy = void>
     struct expr_ext;
 
- template <typename Tag, PHOENIX_typename_A_void(PHOENIX_COMPOSITE_LIMIT), typename Dummy = void>
+ template <
+ typename Tag
+ , PHOENIX_typename_A_void(PHOENIX_COMPOSITE_LIMIT)
+ , typename Dummy = void
+ >
         struct expr : expr_ext<actor, Tag, PHOENIX_A(PHOENIX_COMPOSITE_LIMIT)> {};
 
     struct default_domain_with_basic_expr
@@ -211,7 +215,7 @@
             1 \
           , BOOST_PP_ADD(LIMIT, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(GRAMMAR))) \
           , PHOENIX_DEFINE_EXPRESSION_EXT_VARARG_R \
- , (NAME, BOOST_PP_SEQ_POP_BACK(GRAMMAR), ACTOR) \
+ , (NAME, BOOST_PP_SEQ_POP_BACK(GRAMMAR), ACTOR) \
         ) \
     } \
                                                                                 \
@@ -247,13 +251,29 @@
     struct expr_ext<Actor, Tag, PHOENIX_A>
         : proto::transform<expr_ext<Actor, Tag, PHOENIX_A>, int>
     {
- typedef typename proto::result_of::make_expr<Tag, default_domain_with_basic_expr, PHOENIX_A>::type base_type;
+ typedef
+ typename proto::result_of::make_expr<
+ Tag
+ , default_domain_with_basic_expr
+ , PHOENIX_A
+ >::type
+ base_type;
+
         typedef Actor<base_type> type;
- typedef typename proto::nary_expr<Tag, PHOENIX_A>::proto_grammar proto_grammar;
+
+ typedef
+ typename proto::nary_expr<Tag, PHOENIX_A>::proto_grammar
+ proto_grammar;
         
         static type make(PHOENIX_A_a)
         {
- actor<base_type> const e = {proto::make_expr<Tag, default_domain_with_basic_expr>(PHOENIX_a)};
+ actor<base_type> const e =
+ {
+ proto::make_expr<
+ Tag
+ , default_domain_with_basic_expr
+ >(PHOENIX_a)
+ };
             return e;
         }
 
@@ -263,7 +283,9 @@
         {};
         
         typedef Tag proto_tag;
- #define BOOST_PHOENIX_ENUM_CHILDREN(_, N, __) typedef BOOST_PP_CAT(A, N) BOOST_PP_CAT(proto_child, N);
+ #define BOOST_PHOENIX_ENUM_CHILDREN(_, N, __) \
+ typedef BOOST_PP_CAT(A, N) BOOST_PP_CAT(proto_child, N); \
+ /**/
         BOOST_PP_REPEAT(PHOENIX_ITERATION, BOOST_PHOENIX_ENUM_CHILDREN, _)
         #undef BOOST_PHOENIX_ENUM_CHILDREN
     };

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope.hpp 2010-11-30 14:10:29 EST (Tue, 30 Nov 2010)
@@ -10,7 +10,7 @@
 
 #include <boost/phoenix/version.hpp>
 #include <boost/phoenix/scope/scoped_environment.hpp>
-#include <boost/phoenix/scope/lambda.hpp>
+//#include <boost/phoenix/scope/lambda.hpp>
 #include <boost/phoenix/scope/let.hpp>
 #include <boost/phoenix/scope/local_variable.hpp>
 

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/let.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/let.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/let.hpp 2010-11-30 14:10:29 EST (Tue, 30 Nov 2010)
@@ -9,17 +9,190 @@
 #ifndef PHOENIX_SCOPE_LET_HPP
 #define PHOENIX_SCOPE_LET_HPP
 
-#include <boost/fusion/include/transform.hpp>
-#include <boost/fusion/include/as_vector.hpp>
+//#include <boost/fusion/include/transform.hpp>
+//#include <boost/fusion/include/as_vector.hpp>
 #include <boost/phoenix/core/limits.hpp>
 #include <boost/phoenix/scope/scoped_environment.hpp>
 #include <boost/phoenix/core/actor.hpp>
-#include <boost/phoenix/scope/detail/local_variable.hpp>
-#include <boost/phoenix/support/element_at.hpp>
+#include <boost/phoenix/statement/sequence.hpp>
+#include <boost/phoenix/scope/local_variable.hpp>
+//#include <boost/phoenix/support/element_at.hpp>
 #include <boost/phoenix/support/iterate.hpp>
 
 namespace boost { namespace phoenix
 {
+ PHOENIX_DEFINE_EXPRESSION(
+ let
+ , (proto::_)//(rule::local_variables)
+ (proto::_)//(rule::let_grammar)
+ )
+
+ struct let_eval
+ {
+ typedef void result_type;
+
+ template <typename Env, typename Locals, typename Let>
+ result_type
+ operator()(Env & env, Locals const & locals, Let const & let) const
+ {
+ std::cout << "yeha!\n";
+ std::cout << typeid(Locals).name() << "\n\n";
+ std::cout << typeid(rule::local_var_def_list()(locals, functional::args()(env), functional::actions()(env))).name() << "\n\n-------\n";
+ std::cout << typeid(find_local()(rule::local_var_def_list()(locals, functional::args()(env), functional::actions()(env)), _a)).name() << "\n\n-------\n";
+ scope_grammar()(let, functional::args()(env), functional::actions()(env));
+ }
+ };
+
+ template <typename Dummy>
+ struct default_actions::when<rule::let, Dummy>
+ : proto::call<let_eval(_env, proto::_child_c<0>, proto::_child_c<1>)>
+ {};
+
+ template <typename Locals = void, typename Dummy = void>
+ struct let_actor_gen;
+
+ template <>
+ struct let_actor_gen<void, void>
+ {
+ template <typename Expr>
+ Expr const &
+ operator[](Expr const& expr) const
+ {
+ return expr;
+ }
+ };
+
+ template <typename Locals>
+ struct let_actor_gen<Locals>
+ {
+ let_actor_gen(Locals const & locals)
+ : locals(locals)
+ {}
+
+ template <typename Expr>
+ typename expression::let<Locals, Expr>::type const
+ operator[](Expr const& expr) const
+ {
+ return expression::let<Locals, Expr>::make(locals, expr);
+ }
+
+ Locals const& locals;
+ };
+
+ namespace detail
+ {
+ template <PHOENIX_typename_A_void(PHOENIX_LOCAL_LIMIT)>
+ struct make_locals;
+
+ template <typename A0, typename A1>
+ struct make_locals<A0, A1>
+ {
+ typedef
+ typename proto::result_of::make_expr<
+ proto::tag::comma
+ , default_domain_with_basic_expr
+ , A0
+ , A1
+ >::type
+ type;
+
+ static type make(A0 a0, A1 a1)
+ {
+ return proto::make_expr<proto::tag::comma, default_domain_with_basic_expr>(a0, a1);
+ }
+ };
+
+ template <typename A0, typename A1, typename A2>
+ struct make_locals<A0, A1, A2>
+ {
+ typedef
+ typename proto::result_of::make_expr<
+ proto::tag::comma
+ , default_domain_with_basic_expr
+ , typename make_locals<A0, A1>::type
+ , A2
+ >::type
+ type;
+
+ static type make(A0 a0, A1 a1, A2 a2)
+ {
+ return proto::make_expr<proto::tag::comma, default_domain_with_basic_expr>(make_locals<A0, A1>::make(a0, a1), a2);
+ }
+ };
+
+ template <typename A0, typename A1, typename A2, typename A3>
+ struct make_locals<A0, A1, A2, A3>
+ : proto::result_of::make_expr<
+ proto::tag::comma
+ , default_domain_with_basic_expr
+ , typename make_locals<A0, A1, A2>::type
+ , A3
+ >
+ {
+ typedef
+ typename proto::result_of::make_expr<
+ proto::tag::comma
+ , default_domain_with_basic_expr
+ , typename make_locals<A0, A1, A2>::type
+ , A3
+ >::type
+ type;
+
+ static type make(A0 a0, A1 a1, A2 a2, A3 a3)
+ {
+ return proto::make_expr<proto::tag::comma, default_domain_with_basic_expr>(make_locals<A0, A1, A2>::make(a0, a1, a2), a3);
+ }
+ };
+ }
+
+ struct let_local_gen
+ {
+ let_actor_gen<> const
+ operator()() const
+ {
+ return let_actor_gen<>();
+ }
+
+ template <typename Expr0>
+ let_actor_gen<Expr0> const
+ operator()(Expr0 const& expr0) const
+ {
+ return expr0;
+ }
+
+ template <typename Expr0, typename Expr1>
+ let_actor_gen<
+ typename detail::make_locals<Expr0, Expr1>::type
+ > const
+ operator()(Expr0 const& expr0, Expr1 const& expr1) const
+ {
+ std::cout << typeid(typename detail::make_locals<Expr0, Expr1>::type).name() << "\n\n";
+ return detail::make_locals<Expr0, Expr1>::make(expr0, expr1);
+ }
+
+ template <typename Expr0, typename Expr1, typename Expr2>
+ let_actor_gen<
+ typename detail::make_locals<Expr0, Expr1, Expr2>::type
+ > const
+ operator()(Expr0 const& expr0, Expr1 const& expr1, Expr2 const& expr2) const
+ {
+ std::cout << typeid(typename detail::make_locals<Expr0, Expr1, Expr2>::type).name() << "\n\n";
+ return detail::make_locals<Expr0, Expr1, Expr2>::make(expr0, expr1, expr2);
+ }
+
+ template <typename Expr0, typename Expr1, typename Expr2, typename Expr3>
+ let_actor_gen<
+ typename detail::make_locals<Expr0, Expr1, Expr2, Expr3>::type
+ > const
+ operator()(Expr0 const& expr0, Expr1 const& expr1, Expr2 const& expr2, Expr3 const & expr3) const
+ {
+ std::cout << typeid(typename detail::make_locals<Expr0, Expr1, Expr2, Expr3>::type).name() << "\n\n";
+ return detail::make_locals<Expr0, Expr1, Expr2, Expr3>::make(expr0, expr1, expr2, expr3);
+ }
+ };
+
+ let_local_gen const let = let_local_gen();
+ /*
     template <typename Map>
     struct let_eval
     {
@@ -150,6 +323,7 @@
     };
 
     let_gen const let = let_gen();
+ */
 }}
 
 #endif

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp 2010-11-30 14:10:29 EST (Tue, 30 Nov 2010)
@@ -9,10 +9,138 @@
 #define PHOENIX_SCOPE_LOCAL_VARIABLE_HPP
 
 #include <boost/phoenix/core/actor.hpp>
-#include <boost/phoenix/scope/detail/local_variable.hpp>
+#include <boost/phoenix/core/expression.hpp>
+//#include <boost/phoenix/scope/detail/local_variable.hpp>
 
 namespace boost { namespace phoenix
 {
+ template <typename Key>
+ struct local_variable
+ {
+ typedef Key type;
+ };
+
+ namespace expression
+ {
+ template <typename Key>
+ struct local_variable
+ {
+ typedef proto::terminal< ::boost::phoenix::local_variable<Key> > proto_grammar;
+ typedef typename proto_grammar::type base_type;
+ typedef base_type type;
+
+ static type make()
+ {
+ type e = {local_variable<Key>()};
+ return e;
+ }
+ };
+ }
+
+ namespace rule
+ {
+ struct local_variable
+ : proto::terminal< ::boost::phoenix::local_variable<proto::_> >
+ {};
+
+ struct local_var_def
+ : proto::assign<local_variable, meta_grammar>
+ {};
+
+ struct local_var_def_list
+ : proto::or_<
+ proto::when<
+ proto::comma<local_var_def_list, local_var_def>
+ , proto::comma<
+ local_var_def_list(proto::_left , proto::_state, proto::_data)
+ , local_var_def_list(proto::_right, proto::_state, proto::_data)
+ >(
+ local_var_def_list(proto::_left , proto::_state, proto::_data)
+ , local_var_def_list(proto::_right, proto::_state, proto::_data)
+ )
+ >
+ , proto::when<
+ local_var_def
+ , proto::assign<
+ proto::_left
+ , proto::terminal<
+ evaluator(proto::_right, _env)
+ >
+ >(
+ proto::_left
+ , proto::terminal<
+ evaluator(proto::_right, _env)
+ >(
+ evaluator(proto::_right, _env)
+ )
+ )
+ >
+ >
+ {};
+ }
+
+ namespace detail
+ {
+ struct local_var_not_found {};
+ }
+
+ struct find_local
+ : proto::or_<
+ proto::when<
+ proto::comma<find_local, rule::local_var_def>
+ , proto::if_<
+ proto::matches<proto::_right, proto::_state>()
+ , proto::_value(proto::_right(proto::_right))
+ , find_local(proto::_left, proto::_state)
+ >
+ , proto::when<
+ rule::local_var_def
+ , proto::if_<
+ proto::matches<proto::_right, proto::_state>()
+ , proto::_value(proto::_right(proto::_right))
+ , detail::local_var_not_found()
+ >
+ >
+ >
+ {};
+
+
+ struct scope_grammar
+ : proto::or_<
+ proto::when<rule::local_variable, proto::external_transform>
+ , meta_grammar
+ >
+ {};
+
+ struct local_var_eval
+ : proto::callable
+ {
+ template <typename Sig>
+ struct result;
+
+ template <typename This, typename Env, typename Local>
+ struct result<This(Env&, Local)>
+ {
+ typedef int type;
+ };
+
+ typedef int result_type;
+
+ template <typename Env, typename Local>
+ typename result<local_var_eval(Env&, Local)>::type
+ operator()(Env & env, Local local)
+ {
+ std::cout << "blubb\n";
+ return 5;
+ }
+ };
+
+ template <typename Dummy>
+ struct default_actions::when<rule::local_variable, Dummy>
+ : proto::call<local_var_eval(_env, proto::_value)>
+ {};
+
+ /*
     template <typename Env, typename OuterEnv, typename Locals, typename Map>
     struct scoped_environment;
 
@@ -66,37 +194,37 @@
     struct enable_nullary<local_variable<Key>, Dummy>
         : mpl::false_
     {};
+ */
 
     namespace local_names
     {
- make_local_variable<struct _a_key>::type const _a = {};
- make_local_variable<struct _b_key>::type const _b = {};
- make_local_variable<struct _c_key>::type const _c = {};
- make_local_variable<struct _d_key>::type const _d = {};
- make_local_variable<struct _e_key>::type const _e = {};
- make_local_variable<struct _f_key>::type const _f = {};
- make_local_variable<struct _g_key>::type const _g = {};
- make_local_variable<struct _h_key>::type const _h = {};
- make_local_variable<struct _i_key>::type const _i = {};
- make_local_variable<struct _j_key>::type const _j = {};
- make_local_variable<struct _k_key>::type const _k = {};
- make_local_variable<struct _l_key>::type const _l = {};
- make_local_variable<struct _m_key>::type const _m = {};
- make_local_variable<struct _n_key>::type const _n = {};
- make_local_variable<struct _o_key>::type const _o = {};
- make_local_variable<struct _p_key>::type const _p = {};
- make_local_variable<struct _q_key>::type const _q = {};
- make_local_variable<struct _r_key>::type const _r = {};
- make_local_variable<struct _s_key>::type const _s = {};
- make_local_variable<struct _t_key>::type const _t = {};
- make_local_variable<struct _u_key>::type const _u = {};
- make_local_variable<struct _v_key>::type const _v = {};
- make_local_variable<struct _w_key>::type const _w = {};
- make_local_variable<struct _x_key>::type const _x = {};
- make_local_variable<struct _y_key>::type const _y = {};
- make_local_variable<struct _z_key>::type const _z = {};
+ expression::local_variable<struct _a_key>::type const _a = {};
+ expression::local_variable<struct _b_key>::type const _b = {};
+ expression::local_variable<struct _c_key>::type const _c = {};
+ expression::local_variable<struct _d_key>::type const _d = {};
+ expression::local_variable<struct _e_key>::type const _e = {};
+ expression::local_variable<struct _f_key>::type const _f = {};
+ expression::local_variable<struct _g_key>::type const _g = {};
+ expression::local_variable<struct _h_key>::type const _h = {};
+ expression::local_variable<struct _i_key>::type const _i = {};
+ expression::local_variable<struct _j_key>::type const _j = {};
+ expression::local_variable<struct _k_key>::type const _k = {};
+ expression::local_variable<struct _l_key>::type const _l = {};
+ expression::local_variable<struct _m_key>::type const _m = {};
+ expression::local_variable<struct _n_key>::type const _n = {};
+ expression::local_variable<struct _o_key>::type const _o = {};
+ expression::local_variable<struct _p_key>::type const _p = {};
+ expression::local_variable<struct _q_key>::type const _q = {};
+ expression::local_variable<struct _r_key>::type const _r = {};
+ expression::local_variable<struct _s_key>::type const _s = {};
+ expression::local_variable<struct _t_key>::type const _t = {};
+ expression::local_variable<struct _u_key>::type const _u = {};
+ expression::local_variable<struct _v_key>::type const _v = {};
+ expression::local_variable<struct _w_key>::type const _w = {};
+ expression::local_variable<struct _x_key>::type const _x = {};
+ expression::local_variable<struct _y_key>::type const _y = {};
+ expression::local_variable<struct _z_key>::type const _z = {};
     }
-
 }}
 
 #endif

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/scoped_environment.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/scoped_environment.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/scoped_environment.hpp 2010-11-30 14:10:29 EST (Tue, 30 Nov 2010)
@@ -9,89 +9,87 @@
 #define PHOENIX_SCOPE_SCOPED_ENVIRONMENT_HPP
 
 #include <boost/mpl/int.hpp>
+#include <boost/fusion/sequence/sequence_facade.hpp>
+#include <boost/fusion/sequence/intrinsic/begin.hpp>
+#include <boost/fusion/sequence/intrinsic/end.hpp>
+#include <boost/fusion/sequence/intrinsic/size.hpp>
+#include <boost/fusion/sequence/intrinsic/value_at.hpp>
 #include <boost/fusion/sequence/intrinsic/at.hpp>
-#include <boost/phoenix/core/environment.hpp>
+#include <boost/phoenix/core/limits.hpp>
 
 namespace boost { namespace phoenix
 {
- template <typename Env, typename OuterEnv, typename Locals, typename Map>
- struct scoped_environment;
-
- template <typename Env, typename Dummy = void>
- struct is_scoped_environment : mpl::false_ {};
-
- template <typename Env, typename OuterEnv, typename Locals, typename Map>
- struct is_scoped_environment<scoped_environment<Env, OuterEnv, Locals, Map> >
- : mpl::true_
- {};
-
- template <typename Env, typename OuterEnv, typename Locals, typename Map>
- struct is_scoped_environment<scoped_environment<Env, OuterEnv, Locals, Map> const>
- : mpl::true_
- {};
-
- // overload result_of::get_environment_argument to return the correct result type
- namespace result_of
- {
- template <typename Env, typename OuterEnv, typename Locals, typename Map, typename N>
- struct get_environment_argument<scoped_environment<Env, OuterEnv, Locals, Map> const, N>
- : fusion::result_of::at_c<Env, N::value>
- {};
-
- template <typename Env, typename OuterEnv, typename Locals, typename Map, typename N>
- struct get_environment_argument<scoped_environment<Env, OuterEnv, Locals, Map>, N>
- : fusion::result_of::at_c<Env, N::value>
- {};
- }
-
- // overload get_environment_argument to return the correct argument
- template <typename N, typename Env, typename OuterEnv, typename Locals, typename Map>
- typename result_of::get_environment_argument<scoped_environment<Env, OuterEnv, Locals, Map>, N>::type
- get_environment_argument_c(scoped_environment<Env, OuterEnv, Locals, Map>& env)
- {
- return fusion::at_c<N::value>(env.env);
- }
-
- template <typename N, typename Env, typename OuterEnv, typename Locals, typename Map>
- typename result_of::get_environment_argument<scoped_environment<Env, OuterEnv, Locals, Map>, N>::type
- get_environment_argument_c(scoped_environment<Env, OuterEnv, Locals, Map> const& env)
- {
- return fusion::at_c<N::value>(env.env);
- }
-
-
- // overload get_environment_argument_c to return the correct argument
- template <int N, typename Env, typename OuterEnv, typename Locals, typename Map>
- typename result_of::get_environment_argument<scoped_environment<Env, OuterEnv, Locals, Map>, mpl::int_<N> >::type
- get_environment_argument_c(scoped_environment<Env, OuterEnv, Locals, Map>& env)
- {
- return fusion::at_c<N>(env.env);
- }
-
- template <int N, typename Env, typename OuterEnv, typename Locals, typename Map>
- typename result_of::get_environment_argument<scoped_environment<Env, OuterEnv, Locals, Map>, mpl::int_<N> >::type
- get_environment_argument_c(scoped_environment<Env, OuterEnv, Locals, Map> const& env)
- {
- return fusion::at_c<N>(env.env);
- }
-
- template <typename Env, typename OuterEnv, typename Locals, typename Map>
+ template<typename Env, typename OuterEnv, typename Locals>
     struct scoped_environment
+ : fusion::sequence_facade<
+ scoped_environment<Env, OuterEnv, Locals>
+ , fusion::random_access_traversal_tag
+ >
     {
+ typedef Env env_type;
         typedef OuterEnv outer_env_type;
         typedef Locals locals_type;
- typedef Map map_type;
 
         scoped_environment(Env& env, OuterEnv& outer_env, Locals const& locals)
             : env(env)
             , outer_env(outer_env)
- , locals(locals) {}
+ , locals(locals)
+ {}
 
         Env& env;
         OuterEnv& outer_env;
         Locals locals;
+
+ #define PHOENIX_ADAPT_SCOPED_ENVIRONMENT(INTRINSIC) \
+ template <typename Seq> \
+ struct INTRINSIC \
+ { \
+ typedef typename Seq::env_type env_type; \
+ typedef typename fusion::result_of::INTRINSIC<env_type>::type type; \
+ \
+ static type call(Seq & seq) \
+ { \
+ return fusion::INTRINSIC(seq); \
+ } \
+ } \
+ /**/
+ PHOENIX_ADAPT_SCOPED_ENVIRONMENT(begin);
+ PHOENIX_ADAPT_SCOPED_ENVIRONMENT(end);
+ PHOENIX_ADAPT_SCOPED_ENVIRONMENT(size);
+ #undef PHOENIX_ADAPT_SCOPED_ENVIRONMENT
+
+ template <typename Seq, typename N>
+ struct value_at
+ {
+ typedef typename Seq::env_type env_type;
+ typedef typename fusion::result_of::value_at<env_type, N>::type type;
+ };
+
+ template <typename Seq, typename N>
+ struct at
+ {
+ typedef typename Seq::env_type env_type;
+ typedef typename fusion::result_of::at<env_type, N>::type type;
+
+ static type call(Seq & seq)
+ {
+ return fusion::at<N>(seq);
+ }
+ };
     };
 
+ template <typename Env, typename Dummy = void>
+ struct is_scoped_environment : mpl::false_ {};
+
+ template <typename Env, typename OuterEnv, typename Locals>
+ struct is_scoped_environment<scoped_environment<Env, OuterEnv, Locals> >
+ : mpl::true_
+ {};
+
+ template <typename Env, typename OuterEnv, typename Locals>
+ struct is_scoped_environment<scoped_environment<Env, OuterEnv, Locals> const>
+ : mpl::true_
+ {};
 }}
 
 #endif

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/statement/sequence.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/statement/sequence.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/statement/sequence.hpp 2010-11-30 14:10:29 EST (Tue, 30 Nov 2010)
@@ -16,14 +16,22 @@
 
 namespace boost { namespace phoenix
 {
+ namespace expression
+ {
+ template <typename A0, typename A1>
+ struct sequence
+ : expr<proto::tag::comma, A0, A1>
+ {};
+ }
+
         namespace rule
         {
- struct sequence
- : proto::binary_expr<
- proto::tag::comma
- , meta_grammar
- , meta_grammar>
- {};
+ struct sequence
+ : expression::sequence<
+ meta_grammar
+ , meta_grammar
+ >
+ {};
         }
 
         template <typename Dummy>

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/statement/try_catch.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/statement/try_catch.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/statement/try_catch.hpp 2010-11-30 14:10:29 EST (Tue, 30 Nov 2010)
@@ -33,17 +33,26 @@
 
     namespace expression
     {
- template <typename Try, PHOENIX_typename_A_void(PHOENIX_CATCH_LIMIT), typename Dummy = void>
+ template <
+ typename Try
+ , PHOENIX_typename_A_void(PHOENIX_CATCH_LIMIT)
+ , typename Dummy = void
+ >
         struct try_catch;
 
-#define PHOENIX_TRY_CATCH_EXPRESSION(Z, N, DATA) \
- template <typename Try BOOST_PP_COMMA_IF(N) PHOENIX_typename_A(N)> \
- struct try_catch<Try BOOST_PP_COMMA_IF(N) PHOENIX_A(N)> \
- : expr_ext<try_catch_actor, tag::try_catch, Try BOOST_PP_COMMA_IF(N) PHOENIX_A(N)> \
+ #define PHOENIX_TRY_CATCH_EXPRESSION(Z, N, DATA) \
+ template <typename Try BOOST_PP_COMMA_IF(N) PHOENIX_typename_A(N)> \
+ struct try_catch<Try BOOST_PP_COMMA_IF(N) PHOENIX_A(N)> \
+ : expr_ext< \
+ try_catch_actor \
+ , tag::try_catch \
+ , Try \
+ BOOST_PP_COMMA_IF(N) PHOENIX_A(N)> \
         {}; \
         /**/
 
         BOOST_PP_REPEAT(PHOENIX_CATCH_LIMIT, PHOENIX_TRY_CATCH_EXPRESSION, _)
+ #undef PHOENIX_TRY_CATCH_EXPRESSION
 
         template <typename A0, typename A1>
         struct catch_
@@ -96,47 +105,61 @@
         typedef void result_type;
 
 #define PHOENIX_TRY_CATCH_EVAL_R(Z, N, DATA) \
- catch(typename proto::result_of::value<typename proto::result_of::child_c<BOOST_PP_CAT(A, N), 0>::type>::type::type &) \
- { \
- eval(proto::child_c<1>(BOOST_PP_CAT(a, N)), env); \
- } \
+ catch( \
+ typename proto::result_of::value< \
+ typename proto::result_of::child_c< \
+ BOOST_PP_CAT(A, N) \
+ , 0 \
+ >::type \
+ >::type::type & \
+ ) \
+ { \
+ eval(proto::child_c<1>(BOOST_PP_CAT(a, N)), env); \
+ } \
         /**/
 
-#define PHOENIX_TRY_CATCH_EVAL(Z, N, DATA) \
- template <typename Env, typename Try, PHOENIX_typename_A(N)> \
- typename boost::enable_if< \
- proto::matches<BOOST_PP_CAT(A, BOOST_PP_DEC(N)), rule::catch_> \
- , result_type \
- >::type \
+#define PHOENIX_TRY_CATCH_EVAL(Z, N, DATA) \
+ template <typename Env, typename Try, PHOENIX_typename_A(N)> \
+ typename boost::enable_if< \
+ proto::matches<BOOST_PP_CAT(A, BOOST_PP_DEC(N)), rule::catch_> \
+ , result_type \
+ >::type \
         operator()(Env & env, Try const & try_, PHOENIX_A_const_ref_a(N)) const \
- { \
- try \
- { \
- eval(proto::child_c<0>(try_), env); \
- } \
- BOOST_PP_REPEAT(N, PHOENIX_TRY_CATCH_EVAL_R, _) \
- } \
- \
- template <typename Env, typename Try, PHOENIX_typename_A(N)> \
- typename boost::disable_if< \
- proto::matches<BOOST_PP_CAT(A, BOOST_PP_DEC(N)), rule::catch_> \
- , result_type \
- >::type \
+ { \
+ try \
+ { \
+ eval(proto::child_c<0>(try_), env); \
+ } \
+ BOOST_PP_REPEAT(N, PHOENIX_TRY_CATCH_EVAL_R, _) \
+ } \
+ \
+ template <typename Env, typename Try, PHOENIX_typename_A(N)> \
+ typename boost::disable_if< \
+ proto::matches<BOOST_PP_CAT(A, BOOST_PP_DEC(N)), rule::catch_> \
+ , result_type \
+ >::type \
         operator()(Env & env, Try const & try_, PHOENIX_A_const_ref_a(N)) const \
- { \
- try \
- { \
- eval(proto::child_c<0>(try_), env); \
- } \
- BOOST_PP_REPEAT(BOOST_PP_DEC(N), PHOENIX_TRY_CATCH_EVAL_R, _) \
- catch(...) \
- { \
+ { \
+ try \
+ { \
+ eval(proto::child_c<0>(try_), env); \
+ } \
+ BOOST_PP_REPEAT(BOOST_PP_DEC(N), PHOENIX_TRY_CATCH_EVAL_R, _) \
+ catch(...) \
+ { \
                 eval(proto::child_c<0>(BOOST_PP_CAT(a, BOOST_PP_DEC(N))), env); \
- } \
- } \
+ } \
+ } \
         /**/
 
- BOOST_PP_REPEAT_FROM_TO(1, PHOENIX_CATCH_LIMIT, PHOENIX_TRY_CATCH_EVAL, _)
+ BOOST_PP_REPEAT_FROM_TO(
+ 1
+ , PHOENIX_CATCH_LIMIT
+ , PHOENIX_TRY_CATCH_EVAL
+ , _
+ )
+ #undef PHOENIX_TRY_CATCH_EVAL
+ #undef PHOENIX_TRY_CATCH_EVAL_R
     };
 
     template <typename Dummy>
@@ -165,7 +188,11 @@
                           , mpl::true_()
                           , mpl::and_<
                                 proto::_state
- , try_catch_is_nullary(proto::_, int(), proto::_data)
+ , try_catch_is_nullary(
+ proto::_
+ , int()
+ , proto::_data
+ )
>()
>
>()
@@ -178,7 +205,12 @@
             : proto::call<try_catch_is_nullary(proto::_, int(), _env)>
         {};
 
- template <typename TryCatch, typename Exception, typename Expr, long Arity = proto::arity_of<TryCatch>::value>
+ template <
+ typename TryCatch
+ , typename Exception
+ , typename Expr
+ , long Arity = proto::arity_of<TryCatch>::value
+ >
         struct catch_push_back;
 
         template <typename TryCatch, typename Exception, typename Expr>
@@ -214,16 +246,16 @@
             }
         };
 
-#define PHOENIX_CATCH_PUSH_BACK_R0(Z, N, DATA) \
+ #define PHOENIX_CATCH_PUSH_BACK_R0(Z, N, DATA) \
         BOOST_PP_COMMA_IF(N) \
         typename proto::result_of::child_c<TryCatch, N>::type \
         /**/
 
-#define PHOENIX_CATCH_PUSH_BACK_R1(Z, N, DATA) \
+ #define PHOENIX_CATCH_PUSH_BACK_R1(Z, N, DATA) \
         BOOST_PP_COMMA_IF(N) proto::child_c<N>(try_catch) \
         /**/
 
-#define PHOENIX_CATCH_PUSH_BACK(Z, N, DATA) \
+ #define PHOENIX_CATCH_PUSH_BACK(Z, N, DATA) \
         template <typename TryCatch, typename Exception, typename Expr> \
         struct catch_push_back<TryCatch, Exception, Expr, N> \
         { \
@@ -259,9 +291,19 @@
         }; \
         /**/
 
- BOOST_PP_REPEAT_FROM_TO(2, PHOENIX_CATCH_LIMIT, PHOENIX_CATCH_PUSH_BACK, _)
+ BOOST_PP_REPEAT_FROM_TO(
+ 2
+ , PHOENIX_CATCH_LIMIT
+ , PHOENIX_CATCH_PUSH_BACK
+ , _
+ )
+ #undef PHOENIX_CATCH_PUSH_BACK
         
- template <typename TryCatch, typename Expr, long Arity = proto::arity_of<TryCatch>::value>
+ template <
+ typename TryCatch
+ , typename Expr
+ , long Arity = proto::arity_of<TryCatch>::value
+ >
         struct catch_all_push_back;
 
         template <typename TryCatch, typename Expr>
@@ -296,7 +338,7 @@
             }
         };
 
-#define PHOENIX_CATCH_ALL_PUSH_BACK(Z, N, DATA) \
+ #define PHOENIX_CATCH_ALL_PUSH_BACK(Z, N, DATA) \
         template <typename TryCatch, typename Expr> \
         struct catch_all_push_back<TryCatch, Expr, N> \
         { \
@@ -331,7 +373,15 @@
         }; \
         /**/
         
- BOOST_PP_REPEAT_FROM_TO(2, PHOENIX_CATCH_LIMIT, PHOENIX_CATCH_ALL_PUSH_BACK, _)
+ BOOST_PP_REPEAT_FROM_TO(
+ 2
+ , PHOENIX_CATCH_LIMIT
+ , PHOENIX_CATCH_ALL_PUSH_BACK
+ , _
+ )
+ #undef PHOENIX_CATCH_ALL_PUSH_BACK
+ #undef PHOENIX_CATCH_PUSH_BACK_R0
+ #undef PHOENIX_CATCH_PUSH_BACK_R1
     }
 
     template <typename TryCatch, typename Exception>
@@ -352,7 +402,10 @@
>::type
         operator[](Expr const& expr) const
         {
- return detail::catch_push_back<TryCatch, Exception, Expr>::make(try_catch, expr);
+ return
+ detail::catch_push_back<TryCatch, Exception, Expr>::make(
+ try_catch, expr
+ );
         }
 
         TryCatch const & try_catch;
@@ -376,7 +429,9 @@
>::type
         operator[](Expr const& expr) const
         {
- return detail::catch_all_push_back<TryCatch, Expr>::make(try_catch, expr);
+ return detail::catch_all_push_back<TryCatch, Expr>::make(
+ try_catch, expr
+ );
         }
 
         TryCatch const & try_catch;

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/let_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/let_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/let_tests.cpp 2010-11-30 14:10:29 EST (Tue, 30 Nov 2010)
@@ -11,15 +11,17 @@
 
 #define PHOENIX_LIMIT 6
 #include <boost/detail/lightweight_test.hpp>
-#include <boost/fusion/tuple.hpp>
-#include <boost/phoenix/scope.hpp>
 #include <boost/phoenix/core.hpp>
 #include <boost/phoenix/operator.hpp>
 #include <boost/phoenix/function.hpp>
-#include <boost/phoenix/fusion.hpp>
+//#include <boost/phoenix/fusion.hpp>
+#include <boost/phoenix/scope.hpp>
 
 #include <typeinfo>
 
+namespace fusion = boost::fusion;
+namespace mpl = boost::mpl;
+
 int
 main()
 {
@@ -37,6 +39,15 @@
     using boost::phoenix::local_names::_y;
     using boost::phoenix::local_names::_z;
     using boost::phoenix::placeholders::arg1;
+
+ {
+ BOOST_TEST(let()[val(1)]() == 1);
+
+ //_a();
+ let(_a = val(9)+ 10, _b = val(9) + 3.0)[_a]();
+ }
+
+#if 0
 /*
     {
         int x = 1;
@@ -185,6 +196,7 @@
         BOOST_TEST(i == 2);
     }
 */
+#endif
     return boost::report_errors();
 }
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk