Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67410 - in sandbox/SOC/2010/phoenix3: boost/phoenix boost/phoenix/scope libs/phoenix/test/scope
From: thom.heller_at_[hidden]
Date: 2010-12-22 04:16:56


Author: theller
Date: 2010-12-22 04:16:51 EST (Wed, 22 Dec 2010)
New Revision: 67410
URL: http://svn.boost.org/trac/boost/changeset/67410

Log:
temporary commit in lambda refactoring
Text files modified:
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope.hpp | 2 +-
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/lambda.hpp | 7 +++++--
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/let.hpp | 17 ++---------------
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp | 14 ++++++++++++++
   sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/lambda_tests.cpp | 38 ++++++++++++++++++++------------------
   5 files changed, 42 insertions(+), 36 deletions(-)

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-12-22 04:16:51 EST (Wed, 22 Dec 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/lambda.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/lambda.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/lambda.hpp 2010-12-22 04:16:51 EST (Wed, 22 Dec 2010)
@@ -98,9 +98,10 @@
                 );
 
             std::cout << typeid(env).name() << "\n";
+ std::cout << typeid(outer_env).name() << "\n";
             std::cout << typeid(fusion::at_c<0>(env)).name() << "\n";
             std::cout << typeid(fusion::at_c<0>(outer_env)).name() << "\n";
- std::cout << fusion::at_c<0>(fusion::at_c<0>(env)) << "\n";
+ //std::cout << fusion::at_c<0>(fusion::at_c<0>(env)) << "\n";
             std::cout << "fuuu\n";
             //std::cout << fusion::at_c<0>(fusion::at_c<0>(outer_env)) << "\n";
             //std::cout << fusion::at_c<0>(outer_env) << "\n";
@@ -133,7 +134,7 @@
                   , rule::local_var_def_list
                   , meta_grammar
>
- , evaluator(proto::_child_c<2>, _env)
+ , evaluator(proto::_child_c<2>, fusion::vector2<fusion::vector0<>&, scope_is_nullary_actions>())
>
         {};
     }
@@ -262,7 +263,9 @@
             typedef typename proto::detail::uncvref<Env>::type env_type;
             static env_type e(env);
 
+ std::cout << "outer env - begin\n";
             std::cout << typeid(env).name() << "\n";
+ std::cout << "outer env - end\n";
 
             return expression::lambda<env_type, locals_type, Lambda>::make(e, l, lambda);
         }

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-12-22 04:16:51 EST (Wed, 22 Dec 2010)
@@ -20,24 +20,11 @@
     PHOENIX_DEFINE_EXPRESSION(
         let
       , (rule::local_var_def_list)
- (scope_grammar)
- //(meta_grammar)
+ (meta_grammar)
     )
 
     namespace detail
     {
- struct let_is_nullary_actions
- {
- template <typename Rule, typename Dummy = void>
- struct when : is_nullary_::when<Rule, Dummy>
- {};
- };
-
- template <typename Dummy>
- struct let_is_nullary_actions::when<rule::local_variable, Dummy>
- : proto::make<mpl::true_()>
- {};
-
         template <typename Dummy>
         struct is_nullary_::when<rule::let, Dummy>
             : proto::make<
@@ -46,7 +33,7 @@
                     //mpl::true_()
                   //, mpl::true_()//let_evaluator(proto::_child_c<1>, _env)
                   , evaluator(proto::_child_c<1>, //fusion::vector2<scoped_environment<_env, _env, mpl::void_()>(), functional::actions(_env)>()
- fusion::vector2<fusion::vector0<>&, let_is_nullary_actions>()
+ fusion::vector2<fusion::vector0<>&, scope_is_nullary_actions>()
                           )
>()
>

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-12-22 04:16:51 EST (Wed, 22 Dec 2010)
@@ -271,6 +271,20 @@
 
     namespace detail
     {
+
+ struct scope_is_nullary_actions
+ {
+ template <typename Rule, typename Dummy = void>
+ struct when : is_nullary_::when<Rule, Dummy>
+ {};
+ };
+
+ template <typename Dummy>
+ struct scope_is_nullary_actions::when<rule::local_variable, Dummy>
+ : proto::make<mpl::true_()>
+ {};
+
+
         struct local_var_not_found
         {
             template <typename T>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/lambda_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/lambda_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/lambda_tests.cpp 2010-12-22 04:16:51 EST (Wed, 22 Dec 2010)
@@ -77,7 +77,22 @@
     using boost::phoenix::local_names::_b;
     using boost::phoenix::placeholders::arg1;
 
- /*
+ {
+ int x = 1;
+ long x2 = 2;
+ short x3 = 3;
+ char const* y = "hello";
+ zzz z;
+
+ //BOOST_TEST(lambda[_1](x)(y) == y);
+ //BOOST_TEST(lambda(_a = _1)[_a](x)(y) == x);
+ lambda(_a = _1)[lambda[_a]](x)(y)(z);
+ //BOOST_TEST(lambda(_a = _1)[lambda[_a]](x)(y)(z) == x);
+ //BOOST_TEST(lambda(_a = _1)[lambda[_a + _1]](x)(y)(x) == 2);
+ //BOOST_TEST(lambda(_a = _1)[lambda(_b = _1)[_a + _b + _1]](x)(x2)(x3) == 6);
+ }
+
+#if 0
     {
         int x = 1;
         int y = lambda[_1]()(x);
@@ -133,8 +148,8 @@
             (_1 + lambda(_a = _1)[_a + _1 + 2])(x)(y) == 1+1+10+2
         );
     }
- */
 
+ /*
     {
         int x = 1, y = 10;
         BOOST_TEST(
@@ -158,8 +173,8 @@
             )
             (x)(y)(y) << "\n";
     }
+ */
 
- /*
     {
         using boost::phoenix::for_each;
 
@@ -196,32 +211,19 @@
             (x, z)(y) == x + y + z
         );
     }
- */
 
- /*
     {
- // $$$ Fixme. This should not be failing $$$
         int x = (let(_a = lambda[val(1)])[_a])()();
- //BOOST_TEST(x == 1);
+ BOOST_TEST(x == 1);
     }
- */
 
- /*
- {
- // $$$ Fixme. This should not be failing $$$
- int x = (let(_a = lambda[val(1)])[_a])(0);
- //BOOST_TEST(x == 1);
- }
- */
-
- /*
     {
         int i = 0;
         int j = 2;
         BOOST_TEST(lambda[let(_a = _1)[_a = _2]]()(i, j) == j);
         BOOST_TEST(i == j);
     }
- */
+#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