Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68800 - in sandbox/SOC/2010/phoenix3: boost/phoenix/core boost/phoenix/scope boost/phoenix/scope/detail libs/phoenix/test/operator libs/phoenix/test/scope
From: thom.heller_at_[hidden]
Date: 2011-02-12 09:11:17


Author: theller
Date: 2011-02-12 09:11:15 EST (Sat, 12 Feb 2011)
New Revision: 68800
URL: http://svn.boost.org/trac/boost/changeset/68800

Log:
cleaned up code
Text files modified:
   sandbox/SOC/2010/phoenix3/boost/phoenix/core/argument.hpp | 8 -
   sandbox/SOC/2010/phoenix3/boost/phoenix/core/is_nullary.hpp | 18 +----
   sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp | 10 +-
   sandbox/SOC/2010/phoenix3/boost/phoenix/core/terminal.hpp | 30 +++++++++
   sandbox/SOC/2010/phoenix3/boost/phoenix/core/value.hpp | 25 -------
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/local_var_def.hpp | 117 ++++++++++++++++++++++++------------
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/make_locals.hpp | 3
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/let.hpp | 4
   sandbox/SOC/2010/phoenix3/boost/phoenix/scope/local_variable.hpp | 127 ++++++++++++++++++++-------------------
   sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/arithmetic_tests.cpp | 2
   sandbox/SOC/2010/phoenix3/libs/phoenix/test/scope/let_tests.cpp | 2
   11 files changed, 191 insertions(+), 155 deletions(-)

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/argument.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/argument.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/argument.hpp 2011-02-12 09:11:15 EST (Sat, 12 Feb 2011)
@@ -59,13 +59,9 @@
     {
         template <int I>
         struct argument
+ : expression::terminal<detail::argument<I> >
         {
- typedef
- actor<
- typename proto::terminal<detail::argument<I> >::type
- >
- type;
-
+ typedef typename expression::terminal<detail::argument<I> >::type type;
             static const type make()
             {
                 type const e = {};

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/is_nullary.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/is_nullary.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/is_nullary.hpp 2011-02-12 09:11:15 EST (Sat, 12 Feb 2011)
@@ -82,9 +82,11 @@
                     typename proto::result_of::value<Expr>::type
>::type value_type;
 
- typedef typename result_of::is_nullary<custom_terminal<value_type> > is_nullary_trait;
-
-
+ typedef
+ typename result_of::is_nullary<
+ custom_terminal<value_type>
+ >
+ is_nullary_trait;
 
             typedef
                 typename mpl::eval_if<
@@ -142,16 +144,6 @@
         {};
         
         template <typename T>
- struct is_nullary<custom_terminal<actor<T> const &> >
- : evaluator
- {};
-
- template <typename T>
- struct is_nullary<custom_terminal<actor<T> &> >
- : evaluator
- {};
-
- template <typename T>
         struct is_nullary<custom_terminal<actor<T> > >
             : evaluator
         {};

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp 2011-02-12 09:11:15 EST (Sat, 12 Feb 2011)
@@ -12,7 +12,6 @@
 #include <boost/ref.hpp>
 #include <boost/phoenix/core/actor.hpp>
 #include <boost/phoenix/core/terminal.hpp>
-#include <boost/phoenix/core/value.hpp>
 #include <boost/utility/result_of.hpp>
 
 namespace boost { namespace phoenix
@@ -24,14 +23,13 @@
     // function for evaluating references, e.g. ref(123)
     //
     /////////////////////////////////////////////////////////////////////////////
-
     namespace expression
     {
         template <typename T>
         struct reference
- : expression::value<reference_wrapper<T> >
+ : expression::terminal<reference_wrapper<T> >
         {
- typedef typename expression::value<reference_wrapper<T> >::type type;
+ typedef typename expression::terminal<reference_wrapper<T> >::type type;
 
             static const type make(T & t)
             {
@@ -42,9 +40,9 @@
         
         template <typename T>
         struct reference<T const>
- : expression::value<reference_wrapper<T const> >
+ : expression::terminal<reference_wrapper<T const> >
         {
- typedef typename expression::value<reference_wrapper<T const> >::type type;
+ typedef typename expression::terminal<reference_wrapper<T const> >::type type;
 
             static const type make(T const & t)
             {

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/terminal.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/terminal.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/terminal.hpp 2011-02-12 09:11:15 EST (Sat, 12 Feb 2011)
@@ -10,6 +10,7 @@
 
 #include <boost/phoenix/core/limits.hpp>
 #include <boost/is_placeholder.hpp>
+#include <boost/phoenix/core/actor.hpp>
 #include <boost/phoenix/core/meta_grammar.hpp>
 #include <boost/phoenix/core/terminal_fwd.hpp>
 #include <boost/proto/matches.hpp>
@@ -24,6 +25,35 @@
 
     template <typename T, typename Dummy>
     struct custom_terminal;
+
+ namespace expression
+ {
+ template <typename T>
+ struct terminal
+ : proto::terminal<T>
+ {
+ typedef actor<typename proto::terminal<T>::type> type;
+
+ static const type make(T t)
+ {
+ typename terminal<T>::type const e = {{t}};
+ return e;
+ }
+ };
+
+ template <typename T, int N>
+ struct terminal<T[N]>
+ : proto::terminal<T>
+ {
+ typedef actor<typename proto::terminal<T* >::type> type;
+
+ static const type make(T t[N])
+ {
+ typename terminal<T *>::type const e = {{t}};
+ return e;
+ }
+ };
+ }
 
     namespace rule
     {

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/value.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/value.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/value.hpp 2011-02-12 09:11:15 EST (Sat, 12 Feb 2011)
@@ -27,29 +27,8 @@
     {
         template <typename T>
         struct value
- : proto::terminal<T>
- {
- typedef actor<typename proto::terminal<T>::type> type;
-
- static const type make(T t)
- {
- typename value<T>::type const e = {{t}};
- return e;
- }
- };
-
- template <typename T, int N>
- struct value<T[N]>
- : proto::terminal<T>
- {
- typedef actor<typename proto::terminal<T* >::type> type;
-
- static const type make(T t[N])
- {
- typename value<T *>::type const e = {{t}};
- return e;
- }
- };
+ : expression::terminal<T>
+ {};
     }
 
     template <typename T>

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/local_var_def.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/local_var_def.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/local_var_def.hpp 2011-02-12 09:11:15 EST (Sat, 12 Feb 2011)
@@ -13,21 +13,39 @@
 
 #include <boost/phoenix/support/iterate.hpp>
 
-#define M0(Z, N, D) \
- fusion::pair<BOOST_PP_CAT(Tag, N), BOOST_PP_CAT(A, N)>
-
-#define M1(Z, N, D) \
- fusion::pair<BOOST_PP_CAT(Tag, N), typename evaluator::impl<BOOST_PP_CAT(A, N) const &, Context, int>::result_type >
-
-#define M2(Z, N, D) \
- typedef \
- fusion::pair< \
- BOOST_PP_CAT(Tag, N) \
- , typename evaluator::impl<BOOST_PP_CAT(A, N) const &, Context, int>::result_type \
- > \
- BOOST_PP_CAT(pair, N);
-#define M3(Z, N, D) \
- BOOST_PP_CAT(pair, N)(eval(fusion::at_key<BOOST_PP_CAT(Tag, N)>(locals), ctx))
+#define M0(Z, N, D) \
+ fusion::pair<BOOST_PP_CAT(Tag, N), BOOST_PP_CAT(A, N)> \
+/**/
+
+#define M1(Z, N, D) \
+ fusion::pair< \
+ BOOST_PP_CAT(Tag, N) \
+ , typename evaluator::impl< \
+ BOOST_PP_CAT(A, N) const & \
+ , Context \
+ , int \
+ >::result_type \
+ > \
+/**/
+
+#define M2(Z, N, D) \
+ typedef \
+ fusion::pair< \
+ BOOST_PP_CAT(Tag, N) \
+ , typename evaluator::impl< \
+ BOOST_PP_CAT(A, N) const & \
+ , Context \
+ , int \
+ >::result_type \
+ > \
+ BOOST_PP_CAT(pair, N); \
+/**/
+
+#define M3(Z, N, D) \
+ BOOST_PP_CAT(pair, N)( \
+ eval(fusion::at_key<BOOST_PP_CAT(Tag, N)>(locals), ctx) \
+ ) \
+/**/
 
         template <typename Tag0, typename A0, typename Context>
         struct local_var_def_is_nullary<
@@ -66,7 +84,11 @@
 #else
 
 #if BOOST_PP_ITERATION_FLAGS() == 1
- template <BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename Tag), PHOENIX_typename_A, typename Context>
+ template <
+ BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename Tag)
+ , PHOENIX_typename_A
+ , typename Context
+ >
         struct local_var_def_is_nullary<
             fusion::map<
                 BOOST_PP_ENUM(PHOENIX_ITERATION, M0, _)
@@ -74,15 +96,29 @@
           , Context
>
             : mpl::and_<
- typename evaluator::impl<BOOST_PP_CAT(A, BOOST_PP_DEC(PHOENIX_ITERATION)) const &, Context, int>::result_type
- , local_var_def_is_nullary<fusion::map<BOOST_PP_ENUM(BOOST_PP_DEC(PHOENIX_ITERATION), M0, _)>, Context>
+ typename evaluator::impl<
+ BOOST_PP_CAT(A, BOOST_PP_DEC(PHOENIX_ITERATION)) const &
+ , Context
+ , int
+ >::result_type
+ , local_var_def_is_nullary<
+ fusion::map<
+ BOOST_PP_ENUM(BOOST_PP_DEC(PHOENIX_ITERATION), M0, _)
+ >
+ , Context
+ >
>
         {};
 
 #endif
             
 #if BOOST_PP_ITERATION_FLAGS() == 2
- template <typename This, BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename Tag), PHOENIX_typename_A, typename Context>
+ template <
+ typename This
+ , BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename Tag)
+ , PHOENIX_typename_A
+ , typename Context
+ >
             struct result<
                 This(
                     fusion::map<
@@ -90,23 +126,6 @@
> const &
                   , Context
                 )
- > : result<
- This(
- fusion::map<
- BOOST_PP_ENUM(PHOENIX_ITERATION, M0, _)
- > &
- , Context
- )
- > {};
-
- template <typename This, BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename Tag), PHOENIX_typename_A, typename Context>
- struct result<
- This(
- fusion::map<
- BOOST_PP_ENUM(PHOENIX_ITERATION, M0, _)
- > &
- , Context
- )
>
             {
                 typedef
@@ -116,15 +135,33 @@
                     type;
             };
             
- template <BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename Tag), PHOENIX_typename_A, typename Context>
- typename result<local_var_def_eval(fusion::map<BOOST_PP_ENUM(PHOENIX_ITERATION, M0, _) > &, Context const &)>::type
- operator()(fusion::map<BOOST_PP_ENUM(PHOENIX_ITERATION, M0, _) > const & locals, Context const & ctx) const
+ template <
+ BOOST_PP_ENUM_PARAMS(PHOENIX_ITERATION, typename Tag)
+ , PHOENIX_typename_A
+ , typename Context
+ >
+ typename result<
+ local_var_def_eval(
+ fusion::map<BOOST_PP_ENUM(PHOENIX_ITERATION, M0, _) > const &
+ , Context const &)
+ >::type const
+ operator()(
+ fusion::map<
+ BOOST_PP_ENUM(PHOENIX_ITERATION, M0, _)
+ > const & locals
+ , Context const & ctx
+ ) const
             {
                 BOOST_PP_REPEAT(PHOENIX_ITERATION, M2, _)
 
                 return
                     typename result<
- local_var_def_eval(fusion::map<BOOST_PP_ENUM(PHOENIX_ITERATION, M0, _) > const&, Context const&)
+ local_var_def_eval(
+ fusion::map<
+ BOOST_PP_ENUM(PHOENIX_ITERATION, M0, _)
+ > const&
+ , Context const&
+ )
>::type(
                         BOOST_PP_ENUM(PHOENIX_ITERATION, M3, _)
                     );

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/make_locals.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/make_locals.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/scope/detail/make_locals.hpp 2011-02-12 09:11:15 EST (Sat, 12 Feb 2011)
@@ -38,13 +38,10 @@
 #define PHOENIX_TYPEDEF_LOCAL_TYPES(Z, N, D) \
             typedef \
                 typename proto::result_of::value< \
- typename proto::result_of::child_c< \
                         typename proto::result_of::child_c< \
                             BOOST_PP_CAT(A, N) \
                           , 0 \
>::type \
- , 0 \
- >::type \
>::type \
                 BOOST_PP_CAT(tag_type, N); \
 \

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 2011-02-12 09:11:15 EST (Sat, 12 Feb 2011)
@@ -44,7 +44,7 @@
                     boost::result_of<
                         detail::local_var_def_eval(
                             typename proto::result_of::value<
- Locals &
+ Locals const &
>::type
                           , Context
                         )
@@ -86,7 +86,7 @@
                             typename proto::result_of::value<
                                 Locals const &
>::type
- , Context &
+ , Context const &
                         )
>::type
                 locals_type;

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 2011-02-12 09:11:15 EST (Sat, 12 Feb 2011)
@@ -29,20 +29,20 @@
             typedef Key type;
         };
     }
-
- namespace tag
- {
- struct local_variable {};
- }
-
+
     namespace expression
     {
- template <typename Key, typename _ = proto::is_proto_expr>
+ template <typename Key>
         struct local_variable
+ : expression::terminal<detail::local<Key> >
         {
- typedef expr<tag::local_variable, Key> expr_type;
- typedef typename expr_type::type type;
- typedef typename expr_type::proto_grammar proto_grammar;
+ typedef typename expression::terminal<detail::local<Key> >::type type;
+
+ static type make()
+ {
+ type const e = {};
+ return e;
+ }
         };
     }
 
@@ -57,19 +57,17 @@
         {};
     }
 
- template <typename Dummy>
- struct meta_grammar::case_<tag::local_variable, Dummy>
- : enable_rule<rule::local_variable, Dummy>
- {};
-
- template <typename Dummy>
- struct is_nullary::when<rule::local_variable, Dummy>
- : proto::make<mpl::false_()>
- {};
+ namespace result_of
+ {
+ template <typename Key>
+ struct is_nullary<custom_terminal<detail::local<Key> > >
+ : mpl::false_
+ {};
+ }
 
     namespace detail
     {
- template <typename Locals, typename Context>
+ template <typename Map, typename Context>
         struct local_var_def_is_nullary;
 
 
@@ -86,11 +84,17 @@
         };
 
         template <typename Dummy>
- struct scope_is_nullary_actions::when<rule::local_variable, Dummy>
- : proto::make<mpl::true_()>
+ struct scope_is_nullary_actions::when<rule::custom_terminal, Dummy>
+ : proto::or_<
+ proto::when<rule::local_variable, mpl::true_()>
+ , proto::otherwise<
+ boost::phoenix::result_of::is_nullary<
+ custom_terminal<proto::_value>
+ >()
+ >
+ >
         {};
 
-
         struct local_var_not_found
         {
         };
@@ -188,67 +192,68 @@
             }
 
     };
+
+ template<typename Key>
+ struct is_custom_terminal<detail::local<Key> >
+ : mpl::true_
+ {};
 
- struct local_var_eval
+ template <typename Key>
+ struct custom_terminal<detail::local<Key> >
     {
         template <typename Sig>
         struct result;
 
- template <typename This, typename Context, typename Local>
- struct result<This(Context, Local const &)>
+ template <typename This, typename Local, typename Context>
+ struct result<This(Local const &, Context)>
         {
             typedef
                 typename get_local::
                     template result<
                         get_local(
                             typename result_of::env<Context>::type
- , typename proto::result_of::value<Local>::type
+ , Local
                         )
>::type
                 type;
         };
 
         template <typename Local, typename Context>
- typename result<local_var_eval(Context const&, Local const &)>::type
- operator()(Context const & ctx, Local const & local)
+ typename result<custom_terminal<detail::local<Key> >(Local const &, Context const&)>::type
+ operator()(Local const& local, Context const & ctx)
         {
- return get_local()(env(ctx), proto::value(local));
+ return get_local()(env(ctx), local);
         }
     };
 
- template <typename Dummy>
- struct default_actions::when<rule::local_variable, Dummy>
- : call<local_var_eval, Dummy>
- {};
-
     namespace local_names
     {
- expression::local_variable<detail::local<struct _a_key> >::type const _a = {};
- expression::local_variable<detail::local<struct _b_key> >::type const _b = {};
- expression::local_variable<detail::local<struct _c_key> >::type const _c = {};
- expression::local_variable<detail::local<struct _d_key> >::type const _d = {};
- expression::local_variable<detail::local<struct _e_key> >::type const _e = {};
- expression::local_variable<detail::local<struct _f_key> >::type const _f = {};
- expression::local_variable<detail::local<struct _g_key> >::type const _g = {};
- expression::local_variable<detail::local<struct _h_key> >::type const _h = {};
- expression::local_variable<detail::local<struct _i_key> >::type const _i = {};
- expression::local_variable<detail::local<struct _j_key> >::type const _j = {};
- expression::local_variable<detail::local<struct _k_key> >::type const _k = {};
- expression::local_variable<detail::local<struct _l_key> >::type const _l = {};
- expression::local_variable<detail::local<struct _m_key> >::type const _m = {};
- expression::local_variable<detail::local<struct _n_key> >::type const _n = {};
- expression::local_variable<detail::local<struct _o_key> >::type const _o = {};
- expression::local_variable<detail::local<struct _p_key> >::type const _p = {};
- expression::local_variable<detail::local<struct _q_key> >::type const _q = {};
- expression::local_variable<detail::local<struct _r_key> >::type const _r = {};
- expression::local_variable<detail::local<struct _s_key> >::type const _s = {};
- expression::local_variable<detail::local<struct _t_key> >::type const _t = {};
- expression::local_variable<detail::local<struct _u_key> >::type const _u = {};
- expression::local_variable<detail::local<struct _v_key> >::type const _v = {};
- expression::local_variable<detail::local<struct _w_key> >::type const _w = {};
- expression::local_variable<detail::local<struct _x_key> >::type const _x = {};
- expression::local_variable<detail::local<struct _y_key> >::type const _y = {};
- expression::local_variable<detail::local<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 = {};
     }
     
     namespace detail

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/arithmetic_tests.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/arithmetic_tests.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/arithmetic_tests.cpp 2011-02-12 09:11:15 EST (Sat, 12 Feb 2011)
@@ -9,6 +9,8 @@
 #include <boost/phoenix/core.hpp>
 #include <boost/phoenix/operator.hpp>
 
+#include <boost/bind.hpp>
+
 namespace phoenix = boost::phoenix;
 
 int

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 2011-02-12 09:11:15 EST (Sat, 12 Feb 2011)
@@ -185,7 +185,7 @@
         let(_a = _1)[_a = _2](i, 2);
         BOOST_TEST(i == 2);
     }
-
+
     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