Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2007-11-08 21:40:19


Author: eric_niebler
Date: 2007-11-08 21:40:18 EST (Thu, 08 Nov 2007)
New Revision: 40952
URL: http://svn.boost.org/trac/boost/changeset/40952

Log:
port lambda2 to proto3
Text files modified:
   branches/proto/v3/boost/xpressive/proto3/context/callable.hpp | 2
   branches/proto/v3/boost/xpressive/proto3/context/null.hpp | 166 ++++++++++++++++++++--------------------
   branches/proto/v3/boost/xpressive/proto3/tags.hpp | 2
   branches/proto/v3/libs/xpressive/proto3/test/lambda2.cpp | 9 +
   branches/proto/v3/libs/xpressive/proto3/test/toy_spirit3.cpp | 1
   5 files changed, 91 insertions(+), 89 deletions(-)

Modified: branches/proto/v3/boost/xpressive/proto3/context/callable.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/context/callable.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/context/callable.hpp 2007-11-08 21:40:18 EST (Thu, 08 Nov 2007)
@@ -68,7 +68,7 @@
           : remove_cv<Context>::type
         {
             callable_context_wrapper();
- typedef private_type_ const &(*pointer_to_function)(DontCare...);
+ typedef private_type_ const &(*pointer_to_function)(dont_care, DontCare...);
             operator pointer_to_function() const;
         };
 

Modified: branches/proto/v3/boost/xpressive/proto3/context/null.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/context/null.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/context/null.hpp 2007-11-08 21:40:18 EST (Thu, 08 Nov 2007)
@@ -1,83 +1,83 @@
-#ifndef BOOST_PP_IS_ITERATING
- ///////////////////////////////////////////////////////////////////////////////
- /// \file null.hpp
- /// Definintion of null_context\<\>, an evaluation context for
- /// proto::eval() that simply evaluates each child expression, doesn't
- /// combine the results at all, and returns void.
- //
- // Copyright 2007 Eric Niebler. Distributed under the Boost
- // Software License, Version 1.0. (See accompanying file
- // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
- #ifndef BOOST_PROTO_CONTEXT_NULL_HPP_EAN_06_24_2007
- #define BOOST_PROTO_CONTEXT_NULL_HPP_EAN_06_24_2007
-
- #include <boost/xpressive/proto/detail/prefix.hpp> // must be first include
- #include <boost/preprocessor/iteration/iterate.hpp>
- #include <boost/preprocessor/repetition/repeat.hpp>
- #include <boost/xpressive/proto/proto_fwd.hpp>
- #include <boost/xpressive/proto/eval.hpp>
- #include <boost/xpressive/proto/traits.hpp>
- #include <boost/xpressive/proto/detail/suffix.hpp> // must be last include
-
- namespace boost { namespace proto { namespace context
- {
-
- template<typename Expr, typename Context, long Arity>
- struct null_eval
- {};
-
- template<typename Expr, typename Context>
- struct null_eval<Expr, Context, 0>
- {
- typedef void result_type;
- void operator()(Expr &, Context &) const
- {}
- };
-
- #define BOOST_PROTO_EVAL_N(Z, N, DATA) \
- proto::eval(proto::arg_c<N>(expr), ctx); \
- /**/
-
- #define BOOST_PP_ITERATION_PARAMS_1 \
- (3, (1, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/context/null.hpp>)) \
- /**/
-
- #include BOOST_PP_ITERATE()
-
- #undef BOOST_PROTO_EVAL_N
-
- /// null_context
- ///
- struct null_context
- {
- /// null_context::eval
- ///
- template<typename Expr, typename ThisContext = null_context const>
- struct eval
- : null_eval<Expr, ThisContext>
- {};
- };
-
- }}}
-
- #endif
-
-#else
-
- #define N BOOST_PP_ITERATION()
-
- template<typename Expr, typename Context>
- struct null_eval<Expr, Context, N>
- {
- typedef void result_type;
-
- void operator ()(Expr &expr, Context &ctx) const
- {
- BOOST_PP_REPEAT(N, BOOST_PROTO_EVAL_N, ~)
- }
- };
-
- #undef N
-
-#endif
+//#ifndef BOOST_PP_IS_ITERATING
+// ///////////////////////////////////////////////////////////////////////////////
+// /// \file null.hpp
+// /// Definintion of null_context\<\>, an evaluation context for
+// /// proto::eval() that simply evaluates each child expression, doesn't
+// /// combine the results at all, and returns void.
+// //
+// // Copyright 2007 Eric Niebler. Distributed under the Boost
+// // Software License, Version 1.0. (See accompanying file
+// // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// #ifndef BOOST_PROTO_CONTEXT_NULL_HPP_EAN_06_24_2007
+// #define BOOST_PROTO_CONTEXT_NULL_HPP_EAN_06_24_2007
+//
+// #include <boost/xpressive/proto/detail/prefix.hpp> // must be first include
+// #include <boost/preprocessor/iteration/iterate.hpp>
+// #include <boost/preprocessor/repetition/repeat.hpp>
+// #include <boost/xpressive/proto/proto_fwd.hpp>
+// #include <boost/xpressive/proto/eval.hpp>
+// #include <boost/xpressive/proto/traits.hpp>
+// #include <boost/xpressive/proto/detail/suffix.hpp> // must be last include
+//
+// namespace boost { namespace proto { namespace context
+// {
+//
+// template<typename Expr, typename Context, long Arity>
+// struct null_eval
+// {};
+//
+// template<typename Expr, typename Context>
+// struct null_eval<Expr, Context, 0>
+// {
+// typedef void result_type;
+// void operator()(Expr &, Context &) const
+// {}
+// };
+//
+// #define BOOST_PROTO_EVAL_N(Z, N, DATA) \
+// proto::eval(proto::arg_c<N>(expr), ctx); \
+// /**/
+//
+// #define BOOST_PP_ITERATION_PARAMS_1 \
+// (3, (1, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/context/null.hpp>)) \
+// /**/
+//
+// #include BOOST_PP_ITERATE()
+//
+// #undef BOOST_PROTO_EVAL_N
+//
+// /// null_context
+// ///
+// struct null_context
+// {
+// /// null_context::eval
+// ///
+// template<typename Expr, typename ThisContext = null_context const>
+// struct eval
+// : null_eval<Expr, ThisContext>
+// {};
+// };
+//
+// }}}
+//
+// #endif
+//
+//#else
+//
+// #define N BOOST_PP_ITERATION()
+//
+// template<typename Expr, typename Context>
+// struct null_eval<Expr, Context, N>
+// {
+// typedef void result_type;
+//
+// void operator ()(Expr &expr, Context &ctx) const
+// {
+// BOOST_PP_REPEAT(N, BOOST_PROTO_EVAL_N, ~)
+// }
+// };
+//
+// #undef N
+//
+//#endif

Modified: branches/proto/v3/boost/xpressive/proto3/tags.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/tags.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/tags.hpp 2007-11-08 21:40:18 EST (Thu, 08 Nov 2007)
@@ -14,7 +14,7 @@
 namespace boost { namespace proto
 {
 
- namespace tags
+ namespace tag
     {
 
         struct terminal {};

Modified: branches/proto/v3/libs/xpressive/proto3/test/lambda2.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/test/lambda2.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/test/lambda2.cpp 2007-11-08 21:40:18 EST (Thu, 08 Nov 2007)
@@ -27,7 +27,7 @@
 #include <boost/type_traits/add_reference.hpp>
 #include <boost/xpressive/proto3/proto.hpp>
 #include <boost/xpressive/proto3/context.hpp>
-#include <boost/xpressive/proto3/transform2.hpp>
+#include <boost/xpressive/proto3/transform.hpp>
 #include <boost/test/unit_test.hpp>
 #include <boost/test/floating_point_comparison.hpp>
 
@@ -53,16 +53,19 @@
     typedef typename T::arity type;
 };
 
+struct zero : mpl::int_<0> {};
+
 namespace grammar
 {
     using namespace proto;
+ using namespace transform;
 
     // The lambda grammar, with the transforms for calculating the max arity
     struct Lambda
       : or_<
             case_< terminal< placeholder<_> >, mpl::next<placeholder_arity<_arg> >() >
- , case_< terminal<_>, mpl::int_<0>() >
- , case_< nary_expr<_, vararg<_> >, fold<_children, mpl::int_<0>(), mpl::max<Lambda,_state>()> >
+ , case_< terminal<_>, zero() >
+ , case_< nary_expr<_, vararg<_> >, fold<_, zero(), mpl::max<Lambda,_state>()> >
>
     {};
 }

Modified: branches/proto/v3/libs/xpressive/proto3/test/toy_spirit3.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/test/toy_spirit3.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/test/toy_spirit3.cpp 2007-11-08 21:40:18 EST (Thu, 08 Nov 2007)
@@ -246,7 +246,6 @@
           : case_< bitwise_or<SpiritExpr, SpiritExpr>, alternate<FoldToList>(FoldToList) >
         {};
 
-
         // Directives such as no_case are handled here
         struct SpiritDirective
           : case_< subscript<NoCase, SpiritExpr>, SpiritExpr(_right, _state, True()) >


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