Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2008-01-22 21:23:16


Author: eric_niebler
Date: 2008-01-22 21:23:15 EST (Tue, 22 Jan 2008)
New Revision: 42918
URL: http://svn.boost.org/trac/boost/changeset/42918

Log:
proto works with boost 1.34.1
Added:
   trunk/boost/xpressive/proto/detail/pop_front.hpp (contents, props changed)
   trunk/boost/xpressive/proto/detail/reverse.hpp (contents, props changed)
Text files modified:
   trunk/boost/xpressive/proto/expr.hpp | 44 ++++++++++++++--------------
   trunk/boost/xpressive/proto/extends.hpp | 3 -
   trunk/boost/xpressive/proto/fusion.hpp | 59 ++++++++++++++++++++++++++++++++-------
   trunk/boost/xpressive/proto/proto_fwd.hpp | 13 ++++++++
   trunk/boost/xpressive/proto/ref.hpp | 1
   trunk/boost/xpressive/proto/transform/fold.hpp | 54 +++++++++++++++++++++++++++++++++--
   trunk/boost/xpressive/proto/transform/pass_through.hpp | 29 ++++++++++++-------
   trunk/libs/xpressive/proto/test/examples.cpp | 12 +++++--
   trunk/libs/xpressive/proto/test/toy_spirit2.cpp | 5 ++-
   9 files changed, 163 insertions(+), 57 deletions(-)

Added: trunk/boost/xpressive/proto/detail/pop_front.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/xpressive/proto/detail/pop_front.hpp 2008-01-22 21:23:15 EST (Tue, 22 Jan 2008)
@@ -0,0 +1,43 @@
+/*=============================================================================
+ Copyright (c) 2001-2006 Joel de Guzman
+ Copyright (c) 2008 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_DETAIL_FUSION_POP_FRONT_EAH_01_22_2008
+#define BOOST_PROTO_DETAIL_FUSION_POP_FRONT_EAH_01_22_2008
+
+#include <boost/spirit/fusion/sequence/range.hpp>
+#include <boost/spirit/fusion/sequence/begin.hpp>
+#include <boost/spirit/fusion/sequence/end.hpp>
+#include <boost/spirit/fusion/iterator/next.hpp>
+
+namespace boost { namespace fusion
+{
+ namespace meta
+ {
+ template <typename Sequence>
+ struct pop_front
+ {
+ typedef
+ range<
+ typename next<
+ typename begin<Sequence>::type
+ >::type
+ , typename end<Sequence>::type
+ >
+ type;
+ };
+ }
+
+ template <typename Sequence>
+ inline typename meta::pop_front<Sequence const>::type
+ pop_front(Sequence const& seq)
+ {
+ typedef typename meta::pop_front<Sequence const>::type result;
+ return result(fusion::next(fusion::begin(seq)), fusion::end(seq));
+ }
+}}
+
+#endif

Added: trunk/boost/xpressive/proto/detail/reverse.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/xpressive/proto/detail/reverse.hpp 2008-01-22 21:23:15 EST (Tue, 22 Jan 2008)
@@ -0,0 +1,189 @@
+/*=============================================================================
+ Copyright (c) 2001-2006 Joel de Guzman
+ Copyright (c) 2008 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_DETAIL_FUSION_REVERSE_EAH_01_22_2008
+#define BOOST_PROTO_DETAIL_FUSION_REVERSE_EAH_01_22_2008
+
+#include <boost/spirit/fusion/detail/access.hpp>
+#include <boost/spirit/fusion/iterator/as_fusion_iterator.hpp>
+#include <boost/spirit/fusion/iterator/detail/iterator_base.hpp>
+#include <boost/spirit/fusion/sequence/detail/sequence_base.hpp>
+#include <boost/spirit/fusion/iterator/next.hpp>
+#include <boost/spirit/fusion/iterator/prior.hpp>
+#include <boost/spirit/fusion/iterator/deref.hpp>
+#include <boost/spirit/fusion/iterator/value_of.hpp>
+#include <boost/spirit/fusion/sequence/begin.hpp>
+#include <boost/spirit/fusion/sequence/end.hpp>
+
+namespace boost { namespace fusion
+{
+ struct reverse_view_tag;
+ struct reverse_view_iterator_tag;
+
+ template <typename First>
+ struct reverse_view_iterator
+ : iterator_base<reverse_view_iterator<First> >
+ {
+ typedef as_fusion_iterator<First> converter;
+ typedef typename converter::type first_type;
+ typedef reverse_view_iterator_tag tag;
+
+ reverse_view_iterator(First const& first)
+ : first(converter::convert(first)) {}
+
+ first_type first;
+ };
+
+ template <typename Sequence>
+ struct reverse_view : sequence_base<reverse_view<Sequence> >
+ {
+ typedef as_fusion_sequence<Sequence> seq_converter;
+ typedef typename seq_converter::type seq;
+
+ typedef reverse_view_tag tag;
+ typedef typename meta::begin<seq>::type first_type;
+ typedef typename meta::end<seq>::type last_type;
+
+ reverse_view(Sequence& seq)
+ : first(fusion::begin(seq))
+ , last(fusion::end(seq))
+ {}
+
+ first_type first;
+ last_type last;
+ };
+
+ namespace meta
+ {
+ template <>
+ struct deref_impl<reverse_view_iterator_tag>
+ {
+ template <typename Iterator>
+ struct apply
+ {
+ typedef typename
+ meta::deref<
+ typename meta::prior<
+ typename Iterator::first_type
+ >::type
+ >::type
+ type;
+
+ static type
+ call(Iterator const& i)
+ {
+ return *fusion::prior(i.first);
+ }
+ };
+ };
+
+ template <>
+ struct prior_impl<reverse_view_iterator_tag>
+ {
+ template <typename Iterator>
+ struct apply
+ {
+ typedef typename Iterator::first_type first_type;
+ typedef typename next_impl<typename first_type::tag>::
+ template apply<first_type>
+ wrapped;
+
+ typedef reverse_view_iterator<typename wrapped::type> type;
+
+ static type
+ call(Iterator const& i)
+ {
+ return type(wrapped::call(i.first));
+ }
+ };
+ };
+
+ template <>
+ struct next_impl<reverse_view_iterator_tag>
+ {
+ template <typename Iterator>
+ struct apply
+ {
+ typedef typename Iterator::first_type first_type;
+ typedef typename prior_impl<typename first_type::tag>::
+ template apply<first_type>
+ wrapped;
+
+ typedef reverse_view_iterator<typename wrapped::type> type;
+
+ static type
+ call(Iterator const& i)
+ {
+ return type(wrapped::call(i.first));
+ }
+ };
+ };
+
+ template <>
+ struct value_impl<reverse_view_iterator_tag>
+ {
+ template <typename Iterator>
+ struct apply
+ {
+ typedef typename
+ meta::value_of<
+ typename meta::prior<
+ typename Iterator::first_type
+ >::type
+ >::type
+ type;
+ };
+ };
+
+ template <>
+ struct begin_impl<reverse_view_tag>
+ {
+ template <typename Sequence>
+ struct apply
+ {
+ typedef reverse_view_iterator<typename Sequence::last_type> type;
+
+ static type
+ call(Sequence const& s)
+ {
+ return type(s.last);
+ }
+ };
+ };
+
+ template <>
+ struct end_impl<reverse_view_tag>
+ {
+ template <typename Sequence>
+ struct apply
+ {
+ typedef reverse_view_iterator<typename Sequence::first_type> type;
+
+ static type
+ call(Sequence const& s)
+ {
+ return type(s.first);
+ }
+ };
+ };
+
+ template <typename Sequence>
+ struct reverse
+ {
+ typedef reverse_view<Sequence> type;
+ };
+ }
+
+ template <typename Sequence>
+ inline reverse_view<Sequence const>
+ reverse(Sequence const& view)
+ {
+ return reverse_view<Sequence const>(view);
+ }
+}}
+
+#endif

Modified: trunk/boost/xpressive/proto/expr.hpp
==============================================================================
--- trunk/boost/xpressive/proto/expr.hpp (original)
+++ trunk/boost/xpressive/proto/expr.hpp 2008-01-22 21:23:15 EST (Tue, 22 Jan 2008)
@@ -81,7 +81,7 @@
             };
 
             template<typename Expr>
- struct address_of_hack<tag::address_of, ref_<Expr> >
+ struct address_of_hack<proto::tag::address_of, ref_<Expr> >
             {
                 typedef Expr *type;
             };
@@ -168,7 +168,7 @@
             typedef expr proto_base_expr;
             typedef Args proto_args;
             typedef default_domain proto_domain;
- typedef tag::proto_expr fusion_tag;
+ BOOST_PROTO_DEFINE_FUSION_TAG(proto::tag::proto_expr)
             typedef void proto_is_expr_;
             typedef expr proto_derived_expr;
 
@@ -254,20 +254,20 @@
             /// \param a The rhs.
             /// \return A new \c expr\<\> node representing an assignment of \c a to \c *this.
             template<typename A>
- proto::expr<tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > const
+ proto::expr<proto::tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > const
             operator =(A &a) const
             {
- proto::expr<tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<proto::tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
             /// \overload
             ///
             template<typename A>
- proto::expr<tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > const
+ proto::expr<proto::tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > const
             operator =(A const &a) const
             {
- proto::expr<tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<proto::tag::assign, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
@@ -275,20 +275,20 @@
             /// \overload
             ///
             template<typename A>
- proto::expr<tag::assign, args2<ref_<expr>, typename result_of::as_arg<A>::type> > const
+ proto::expr<proto::tag::assign, args2<ref_<expr>, typename result_of::as_arg<A>::type> > const
             operator =(A &a)
             {
- proto::expr<tag::assign, args2<ref_<expr>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<proto::tag::assign, args2<ref_<expr>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
             /// \overload
             ///
             template<typename A>
- proto::expr<tag::assign, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > const
+ proto::expr<proto::tag::assign, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > const
             operator =(A const &a)
             {
- proto::expr<tag::assign, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<proto::tag::assign, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
         #endif
@@ -298,20 +298,20 @@
             /// \param a The rhs.
             /// \return A new \c expr\<\> node representing \c *this subscripted with \c a.
             template<typename A>
- proto::expr<tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > const
+ proto::expr<proto::tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > const
             operator [](A &a) const
             {
- proto::expr<tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<proto::tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
             /// \overload
             ///
             template<typename A>
- proto::expr<tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > const
+ proto::expr<proto::tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > const
             operator [](A const &a) const
             {
- proto::expr<tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<proto::tag::subscript, args2<ref_<expr const>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
@@ -319,20 +319,20 @@
             /// \overload
             ///
             template<typename A>
- proto::expr<tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A>::type> > const
+ proto::expr<proto::tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A>::type> > const
             operator [](A &a)
             {
- proto::expr<tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<proto::tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
 
             /// \overload
             ///
             template<typename A>
- proto::expr<tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > const
+ proto::expr<proto::tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > const
             operator [](A const &a)
             {
- proto::expr<tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
+ proto::expr<proto::tag::subscript, args2<ref_<expr>, typename result_of::as_arg<A const>::type> > that = {{*this}, proto::as_arg(a)};
                 return that;
             }
         #endif
@@ -348,20 +348,20 @@
             /// Function call
             ///
             /// \return A new \c expr\<\> node representing the function invocation of \c (*this)().
- proto::expr<tag::function, args1<ref_<expr const> > > const
+ proto::expr<proto::tag::function, args1<ref_<expr const> > > const
             operator ()() const
             {
- proto::expr<tag::function, args1<ref_<expr const> > > that = {{*this}};
+ proto::expr<proto::tag::function, args1<ref_<expr const> > > that = {{*this}};
                 return that;
             }
 
         #if IS_TERMINAL
             /// \overload
             ///
- proto::expr<tag::function, args1<ref_<expr> > > const
+ proto::expr<proto::tag::function, args1<ref_<expr> > > const
             operator ()()
             {
- proto::expr<tag::function, args1<ref_<expr> > > that = {{*this}};
+ proto::expr<proto::tag::function, args1<ref_<expr> > > that = {{*this}};
                 return that;
             }
         #endif

Modified: trunk/boost/xpressive/proto/extends.hpp
==============================================================================
--- trunk/boost/xpressive/proto/extends.hpp (original)
+++ trunk/boost/xpressive/proto/extends.hpp 2008-01-22 21:23:15 EST (Tue, 22 Jan 2008)
@@ -104,8 +104,7 @@
         typedef typename Expr::proto_args proto_args;\
         typedef typename Expr::proto_arity proto_arity;\
         typedef void proto_is_expr_;\
- typedef boost::proto::tag::proto_expr fusion_tag;\
- \
+ BOOST_PROTO_DEFINE_FUSION_TAG(boost::proto::tag::proto_expr)\
         BOOST_PP_REPEAT(BOOST_PROTO_MAX_ARITY, BOOST_PROTO_EXTENDS_ARG, Expr)\
         \
         static Derived const make(Expr const &expr)\

Modified: trunk/boost/xpressive/proto/fusion.hpp
==============================================================================
--- trunk/boost/xpressive/proto/fusion.hpp (original)
+++ trunk/boost/xpressive/proto/fusion.hpp 2008-01-22 21:23:15 EST (Tue, 22 Jan 2008)
@@ -10,8 +10,10 @@
 #define BOOST_PROTO_FUSION_HPP_EAN_11_04_2006
 
 #include <boost/xpressive/proto/detail/prefix.hpp>
+#include <boost/version.hpp>
 #include <boost/type_traits/remove_reference.hpp>
 #include <boost/mpl/long.hpp>
+#if BOOST_VERSION >= 103500
 #include <boost/fusion/include/is_view.hpp>
 #include <boost/fusion/include/tag_of_fwd.hpp>
 #include <boost/fusion/include/category_of.hpp>
@@ -25,6 +27,17 @@
 #include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
 #include <boost/fusion/sequence/intrinsic/ext_/size_s.hpp>
 #include <boost/fusion/view/ext_/segmented_iterator.hpp>
+#else
+#include <boost/spirit/fusion/sequence/is_sequence.hpp>
+#include <boost/spirit/fusion/sequence/begin.hpp>
+#include <boost/spirit/fusion/sequence/end.hpp>
+#include <boost/spirit/fusion/sequence/at.hpp>
+#include <boost/spirit/fusion/sequence/value_at.hpp>
+#include <boost/spirit/fusion/sequence/single_view.hpp>
+#include <boost/spirit/fusion/sequence/transform_view.hpp>
+#include <boost/xpressive/proto/detail/reverse.hpp>
+#include <boost/xpressive/proto/detail/pop_front.hpp>
+#endif
 #include <boost/xpressive/proto/proto_fwd.hpp>
 #include <boost/xpressive/proto/traits.hpp>
 #include <boost/xpressive/proto/eval.hpp>
@@ -33,7 +46,7 @@
 namespace boost { namespace proto
 {
 
-/// INTERNAL MACRO
+/// INTERNAL ONLY
 ///
 #define UNREF(x) typename boost::remove_reference<x>::type
 
@@ -46,8 +59,8 @@
         {
             typedef Expr expr_type;
             static long const index = Pos;
- typedef fusion::random_access_traversal_tag category;
- typedef tag::proto_expr_iterator fusion_tag;
+ BOOST_PROTO_DEFINE_FUSION_CATEGORY(fusion::random_access_traversal_tag)
+ BOOST_PROTO_DEFINE_FUSION_TAG(tag::proto_expr_iterator)
 
             expr_iterator(Expr const &e)
               : expr(e)
@@ -63,8 +76,8 @@
     {
         typedef Expr expr_type;
         typedef typename Expr::proto_tag proto_tag;
- typedef fusion::forward_traversal_tag category;
- typedef tag::proto_flat_view fusion_tag;
+ BOOST_PROTO_DEFINE_FUSION_CATEGORY(fusion::forward_traversal_tag)
+ BOOST_PROTO_DEFINE_FUSION_TAG(tag::proto_flat_view)
 
         explicit flat_view(Expr &expr)
           : expr_(expr)
@@ -100,11 +113,11 @@
 
             template<typename This, typename Expr>
             struct result<This(Expr)>
- : fusion::result_of::pop_front<UNREF(Expr) const>
+ : fusion::BOOST_PROTO_FUSION_RESULT_OF::pop_front<UNREF(Expr) const>
             {};
 
             template<typename Expr>
- typename fusion::result_of::pop_front<Expr const>::type
+ typename fusion::BOOST_PROTO_FUSION_RESULT_OF::pop_front<Expr const>::type
             operator ()(Expr const &expr) const
             {
                 return fusion::pop_front(expr);
@@ -118,17 +131,16 @@
 
             template<typename This, typename Expr>
             struct result<This(Expr)>
- : fusion::result_of::reverse<UNREF(Expr) const>
+ : fusion::BOOST_PROTO_FUSION_RESULT_OF::reverse<UNREF(Expr) const>
             {};
 
             template<typename Expr>
- typename fusion::result_of::reverse<Expr const>::type
+ typename fusion::BOOST_PROTO_FUSION_RESULT_OF::reverse<Expr const>::type
             operator ()(Expr const &expr) const
             {
                 return fusion::reverse(expr);
             }
         };
-
     }
 
     template<>
@@ -177,8 +189,19 @@
 
 namespace boost { namespace fusion
 {
+ #if BOOST_VERSION < 103500
+ template<typename Tag, typename Args, long Arity>
+ struct is_sequence<proto::expr<Tag, Args, Arity> >
+ : mpl::true_
+ {};
+
+ template<typename Tag, typename Args, long Arity>
+ struct is_sequence<proto::expr<Tag, Args, Arity> const>
+ : mpl::true_
+ {};
+ #endif
 
- namespace extension
+ namespace BOOST_PROTO_FUSION_EXTENSION
     {
 
         template<typename Tag>
@@ -217,6 +240,16 @@
             {};
         };
 
+ #if BOOST_VERSION < 103500
+ template<typename Tag>
+ struct value_impl;
+
+ template<>
+ struct value_impl<proto::tag::proto_expr_iterator>
+ : value_of_impl<proto::tag::proto_expr_iterator>
+ {};
+ #endif
+
         template<typename Tag>
         struct deref_impl;
 
@@ -299,6 +332,7 @@
             {};
         };
 
+ #if BOOST_VERSION >= 103500
         template<typename Tag>
         struct category_of_impl;
 
@@ -311,6 +345,7 @@
                 typedef random_access_traversal_tag type;
             };
         };
+ #endif
 
         template<typename Tag>
         struct size_impl;
@@ -395,6 +430,7 @@
             };
         };
 
+ #if BOOST_VERSION >= 103500
         template<typename Tag>
         struct is_segmented_impl;
 
@@ -489,6 +525,7 @@
               : fusion::segmented_size<Sequence>
             {};
         };
+ #endif
 
     }
 

Modified: trunk/boost/xpressive/proto/proto_fwd.hpp
==============================================================================
--- trunk/boost/xpressive/proto/proto_fwd.hpp (original)
+++ trunk/boost/xpressive/proto/proto_fwd.hpp 2008-01-22 21:23:15 EST (Tue, 22 Jan 2008)
@@ -13,6 +13,7 @@
 #include <cstddef>
 #include <climits>
 #include <boost/config.hpp>
+#include <boost/version.hpp>
 #include <boost/detail/workaround.hpp>
 #include <boost/preprocessor/arithmetic/sub.hpp>
 #include <boost/preprocessor/punctuation/comma.hpp>
@@ -44,6 +45,18 @@
 # define BOOST_PROTO_DISABLE_IF_IS_CONST(T)
 #endif
 
+#if BOOST_VERSION < 103500
+#define BOOST_PROTO_DEFINE_FUSION_TAG(X) typedef X tag;
+#define BOOST_PROTO_DEFINE_FUSION_CATEGORY(X)
+#define BOOST_PROTO_FUSION_RESULT_OF meta
+#define BOOST_PROTO_FUSION_EXTENSION meta
+#else
+#define BOOST_PROTO_DEFINE_FUSION_TAG(X) typedef X fusion_tag;
+#define BOOST_PROTO_DEFINE_FUSION_CATEGORY(X) typedef X category;
+#define BOOST_PROTO_FUSION_RESULT_OF result_of
+#define BOOST_PROTO_FUSION_EXTENSION extension
+#endif
+
 #include <boost/xpressive/proto/detail/suffix.hpp> // must be last include
 
 namespace boost { namespace proto

Modified: trunk/boost/xpressive/proto/ref.hpp
==============================================================================
--- trunk/boost/xpressive/proto/ref.hpp (original)
+++ trunk/boost/xpressive/proto/ref.hpp 2008-01-22 21:23:15 EST (Tue, 22 Jan 2008)
@@ -43,7 +43,6 @@
             typedef typename Expr::proto_args proto_args;
             typedef typename Expr::proto_arity proto_arity;
             typedef typename Expr::proto_domain proto_domain;
- //typedef tag::proto_expr fusion_tag;
             typedef void proto_is_ref_;
             typedef void proto_is_expr_;
             typedef Expr proto_derived_expr;

Modified: trunk/boost/xpressive/proto/transform/fold.hpp
==============================================================================
--- trunk/boost/xpressive/proto/transform/fold.hpp (original)
+++ trunk/boost/xpressive/proto/transform/fold.hpp 2008-01-22 21:23:15 EST (Tue, 22 Jan 2008)
@@ -11,13 +11,17 @@
     #define BOOST_PROTO_TRANSFORM_FOLD_HPP_EAN_11_04_2007
 
     #include <boost/xpressive/proto/detail/prefix.hpp>
+ #include <boost/version.hpp>
     #include <boost/preprocessor/cat.hpp>
     #include <boost/preprocessor/iteration/iterate.hpp>
     #include <boost/preprocessor/arithmetic/inc.hpp>
     #include <boost/preprocessor/arithmetic/sub.hpp>
     #include <boost/preprocessor/repetition/repeat.hpp>
+ #if BOOST_VERSION >= 103500
     #include <boost/fusion/include/fold.hpp>
- #include <boost/fusion/include/reverse.hpp>
+ #else
+ #include <boost/spirit/fusion/algorithm/fold.hpp>
+ #endif
     #include <boost/xpressive/proto/proto_fwd.hpp>
     #include <boost/xpressive/proto/fusion.hpp>
     #include <boost/xpressive/proto/traits.hpp>
@@ -53,6 +57,11 @@
                         type;
                     };
 
+ #if BOOST_VERSION < 103500
+ template<typename Expr, typename State>
+ struct apply : result<void(Expr, State)> {};
+ #endif
+
                     template<typename Expr, typename State>
                     typename when<_, Transform>::template result<void(Expr, State, Visitor)>::type
                     operator ()(Expr const &expr, State const &state) const
@@ -64,6 +73,38 @@
                     Visitor &v_;
                 };
 
+ #if BOOST_VERSION < 103500
+ template<typename Sequence, typename EnableIf = void>
+ struct as_fusion_sequence_type
+ {
+ typedef Sequence const type;
+ };
+
+ template<typename Sequence>
+ Sequence const &as_fusion_sequence(Sequence const &sequence, ...)
+ {
+ return sequence;
+ }
+
+ template<typename Sequence>
+ struct as_fusion_sequence_type<Sequence, typename Sequence::proto_is_expr_>
+ {
+ typedef typename Sequence::proto_base_expr const type;
+ };
+
+ template<typename Sequence>
+ typename Sequence::proto_base_expr const &as_fusion_sequence(Sequence const &sequence, int)
+ {
+ return sequence.proto_base();
+ }
+
+ #define BOOST_PROTO_AS_FUSION_SEQUENCE_TYPE(X) typename detail::as_fusion_sequence_type<X>::type
+ #define BOOST_PROTO_AS_FUSION_SEQUENCE(X) detail::as_fusion_sequence(X, 0)
+ #else
+ #define BOOST_PROTO_AS_FUSION_SEQUENCE_TYPE(X) X
+ #define BOOST_PROTO_AS_FUSION_SEQUENCE(X) X
+ #endif
+
                 template<typename Fun, typename Expr, typename State, typename Visitor, long Arity = Expr::proto_arity::value>
                 struct fold_impl
                 {};
@@ -126,8 +167,12 @@
                 struct result<This(Expr, State, Visitor)>
                 {
                     typedef
- typename fusion::result_of::fold<
- typename when<_, Sequence>::template result<void(Expr, State, Visitor)>::type
+ typename when<_, Sequence>::template result<void(Expr, State, Visitor)>::type
+ sequence;
+
+ typedef
+ typename fusion::BOOST_PROTO_FUSION_RESULT_OF::fold<
+ BOOST_PROTO_AS_FUSION_SEQUENCE_TYPE(sequence)
                           , typename when<_, State0>::template result<void(Expr, State, Visitor)>::type
                           , detail::as_callable<Fun, Visitor>
>::type
@@ -138,9 +183,10 @@
                 typename result<void(Expr, State, Visitor)>::type
                 operator ()(Expr const &expr, State const &state, Visitor &visitor) const
                 {
+ when<_, Sequence> sequence;
                     detail::as_callable<Fun, Visitor> fun(visitor);
                     return fusion::fold(
- when<_, Sequence>()(expr, state, visitor)
+ BOOST_PROTO_AS_FUSION_SEQUENCE(sequence(expr, state, visitor))
                       , when<_, State0>()(expr, state, visitor)
                       , fun
                     );

Modified: trunk/boost/xpressive/proto/transform/pass_through.hpp
==============================================================================
--- trunk/boost/xpressive/proto/transform/pass_through.hpp (original)
+++ trunk/boost/xpressive/proto/transform/pass_through.hpp 2008-01-22 21:23:15 EST (Tue, 22 Jan 2008)
@@ -23,19 +23,26 @@
     {
         namespace detail
         {
- template<typename Grammar, typename Expr, typename State, typename Visitor, long Arity = Expr::proto_arity::value>
- struct pass_through_impl {};
-
- #define BOOST_PROTO_DEFINE_TRANSFORM_TYPE(z, n, data)\
- typename Grammar::BOOST_PP_CAT(proto_arg, n)::template result<void(\
- typename Expr::BOOST_PP_CAT(proto_arg, n)::proto_base_expr\
- , State\
- , Visitor\
+ template<
+ typename Grammar
+ , typename Expr
+ , typename State
+ , typename Visitor
+ , long Arity = Expr::proto_arity::value
+ >
+ struct pass_through_impl
+ {};
+
+ #define BOOST_PROTO_DEFINE_TRANSFORM_TYPE(z, n, data) \
+ typename Grammar::BOOST_PP_CAT(proto_arg, n)::template result<void( \
+ typename Expr::BOOST_PP_CAT(proto_arg, n)::proto_base_expr \
+ , State \
+ , Visitor \
                 )>::type
 
- #define BOOST_PROTO_DEFINE_TRANSFORM(z, n, data)\
- typename Grammar::BOOST_PP_CAT(proto_arg, n)()(\
- expr.BOOST_PP_CAT(arg, n).proto_base(), state, visitor\
+ #define BOOST_PROTO_DEFINE_TRANSFORM(z, n, data) \
+ typename Grammar::BOOST_PP_CAT(proto_arg, n)()( \
+ expr.BOOST_PP_CAT(arg, n).proto_base(), state, visitor \
                 )
 
             #define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_PROTO_MAX_ARITY, <boost/xpressive/proto/transform/pass_through.hpp>))

Modified: trunk/libs/xpressive/proto/test/examples.cpp
==============================================================================
--- trunk/libs/xpressive/proto/test/examples.cpp (original)
+++ trunk/libs/xpressive/proto/test/examples.cpp 2008-01-22 21:23:15 EST (Tue, 22 Jan 2008)
@@ -11,8 +11,12 @@
 #include <boost/xpressive/proto/proto.hpp>
 #include <boost/xpressive/proto/transform.hpp>
 #include <boost/utility/result_of.hpp>
-#include <boost/fusion/include/cons.hpp>
-#include <boost/fusion/include/pop_front.hpp>
+#if BOOST_VERSION < 103500
+# include <boost/spirit/fusion/sequence/cons.hpp>
+#else
+# include <boost/fusion/include/cons.hpp>
+# include <boost/fusion/include/pop_front.hpp>
+#endif
 #include <boost/test/unit_test.hpp>
 
 namespace proto = boost::proto;
@@ -392,9 +396,9 @@
     BOOST_CHECK_EQUAL(p3.second, 3.14);
 
     NegateInt()(lit(1), i, i);
-#ifndef BOOST_MSVC
+ #ifndef BOOST_MSVC
     SquareAndPromoteInt()(lit(1), i, i);
-#endif
+ #endif
 }
 
 using namespace boost::unit_test;

Modified: trunk/libs/xpressive/proto/test/toy_spirit2.cpp
==============================================================================
--- trunk/libs/xpressive/proto/test/toy_spirit2.cpp (original)
+++ trunk/libs/xpressive/proto/test/toy_spirit2.cpp 2008-01-22 21:23:15 EST (Tue, 22 Jan 2008)
@@ -21,6 +21,7 @@
 # include <boost/spirit/fusion/algorithm/for_each.hpp>
 # include <boost/spirit/fusion/algorithm/fold.hpp>
 # include <boost/spirit/fusion/algorithm/any.hpp>
+# include <boost/spirit/fusion/sequence/cons.hpp>
 #else
 # include <boost/fusion/include/for_each.hpp>
 # include <boost/fusion/include/fold.hpp>
@@ -183,11 +184,11 @@
         {};
 
         struct CharParser
- : function<AnyChar, CharLiteral>
+ : proto::function<AnyChar, CharLiteral>
         {};
 
         struct CharRangeParser
- : function<AnyChar, CharLiteral, CharLiteral>
+ : proto::function<AnyChar, CharLiteral, CharLiteral>
         {};
 
         struct NoCase


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