Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63013 - sandbox/SOC/2010/phoenix3/boost/phoenix/core
From: joel_at_[hidden]
Date: 2010-06-15 23:55:42


Author: djowel
Date: 2010-06-15 23:55:40 EDT (Tue, 15 Jun 2010)
New Revision: 63013
URL: http://svn.boost.org/trac/boost/changeset/63013

Log:
more environment integration
Text files modified:
   sandbox/SOC/2010/phoenix3/boost/phoenix/core/actor.hpp | 21 ++++++++++++---------
   sandbox/SOC/2010/phoenix3/boost/phoenix/core/arity.hpp | 16 +++++++++-------
   sandbox/SOC/2010/phoenix3/boost/phoenix/core/environment.hpp | 23 ++++++++++++++++++-----
   3 files changed, 39 insertions(+), 21 deletions(-)

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/actor.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/actor.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/actor.hpp 2010-06-15 23:55:40 EDT (Tue, 15 Jun 2010)
@@ -8,11 +8,11 @@
 #ifndef PHOENIX_CORE_ACTOR_HPP
 #define PHOENIX_CORE_ACTOR_HPP
 
-#include <boost/fusion/container/vector/vector10.hpp>
 #include <boost/mpl/identity.hpp>
 #include <boost/mpl/eval_if.hpp>
 #include <boost/phoenix/core/arity.hpp>
 #include <boost/phoenix/core/domain.hpp>
+#include <boost/phoenix/core/environment.hpp>
 #include <boost/phoenix/core/meta_grammar.hpp>
 #include <boost/proto/extends.hpp>
 #include <boost/proto/debug.hpp>
@@ -36,8 +36,8 @@
     namespace result_of
     {
         template <typename Expr, typename A0 = void, typename A1 = void
- /* ... more ... */
- , typename Dummy = void>
+ /* ... more ... */,
+ typename Dummy = void>
         struct actor;
 
         template <typename Expr>
@@ -48,7 +48,8 @@
             typedef typename
                 mpl::eval_if_c<
                     arity == 0 // avoid calling result_of::actor when this is true
- , boost::result_of<eval_grammar(Expr const&, fusion::vector0<>&)>
+ , boost::result_of<eval_grammar(Expr const&,
+ typename make_basic_environment<>::type&)>
                   , mpl::identity<detail::error_expecting_arguments>
>::type
             type;
@@ -57,13 +58,15 @@
         template <typename Expr, typename A0>
         struct actor<Expr, A0>
             : boost::result_of<eval_grammar(
- ::boost::phoenix::actor<Expr> const&, fusion::vector1<A0>&)>
+ ::boost::phoenix::actor<Expr> const&,
+ typename make_basic_environment<A0>::type&)>
         {};
         
         template <typename Expr, typename A0, typename A1>
         struct actor<Expr, A0, A1>
             : boost::result_of<eval_grammar(
- ::boost::phoenix::actor<Expr> const&, fusion::vector2<A0, A1>&)>
+ ::boost::phoenix::actor<Expr> const&,
+ typename make_basic_environment<A0, A1>::type&)>
         {};
     }
 
@@ -105,7 +108,7 @@
         operator()() const
         {
             BOOST_PROTO_ASSERT_MATCHES( *this, eval_grammar );
- fusion::vector0<> args;
+ typename make_basic_environment<>::type args;
 
             return eval(this->proto_base(), args);
         }
@@ -115,7 +118,7 @@
         operator()(A0 const& a0) const
         {
             BOOST_PROTO_ASSERT_MATCHES(*this, eval_grammar);
- fusion::vector1<A0 const&> args(a0);
+ typename make_basic_environment<A0 const&>::type args(a0);
 
             return eval(*this, args);
         }
@@ -125,7 +128,7 @@
         operator()(A0 const& a0, A1 const& a1) const
         {
             BOOST_PROTO_ASSERT_MATCHES(*this, eval_grammar);
- fusion::vector2<A0 const&, A1 const &> args(a0, a1);
+ typename make_basic_environment<A0 const&, A1 const&>::type args(a0, a1);
 
             std::cout << typeid( eval( *this, args ) ).name() << "\n";
 

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/arity.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/arity.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/arity.hpp 2010-06-15 23:55:40 EDT (Tue, 15 Jun 2010)
@@ -21,9 +21,10 @@
 
 namespace boost { namespace phoenix
 {
-
     ////////////////////////////////////////////////////////////////////////////
- // Calculate the arity of an expression using proto transforms
+ //
+ // Calculate the arity of an expression using proto transforms
+ //
     ////////////////////////////////////////////////////////////////////////////
     
     struct argument;
@@ -39,10 +40,11 @@
         {};
         
         typedef proto::fold<
- proto::_
- , mpl::int_<0>()
- , mpl::max<arity, proto::_state>()>
- arity_fold;
+ proto::_,
+ mpl::int_<0>(),
+ mpl::max<arity, proto::_state>()>
+ arity_fold;
+
         typedef proto::when<proto::_, mpl::int_<0>()> arity_default;
 
         struct arity_cases
@@ -101,7 +103,7 @@
     }
 
     template <typename Expr>
- int arity( Expr const & )
+ int arity(Expr const&)
     {
         return result_of::arity<Expr>::type::value;
     }

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/environment.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/environment.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/environment.hpp 2010-06-15 23:55:40 EDT (Tue, 15 Jun 2010)
@@ -41,11 +41,24 @@
         }
     };
     
-// template <typename Actor, typename Env, typename Enable = void>
-// struct get_signature<Actor, Env,
-// typename enable_if<fusion::traits::is_sequence<T> >::type>
-// {
-// };
+ template <typename A0 = void, typename A1 = void
+ /* ... more ... */,
+ typename Dummy = void>
+ struct make_basic_environment;
+
+ template <>
+ struct make_basic_environment<>
+ : mpl::identity<fusion::vector0<> > {};
+
+ template <typename A0>
+ struct make_basic_environment<A0>
+ : mpl::identity<fusion::vector1<A0> > {};
+
+ template <typename A0, typename A1>
+ struct make_basic_environment<A0, A1>
+ : mpl::identity<fusion::vector2<A0, A1> > {};
+
+ /* ... more ... */
 }}
 
 #endif


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