Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2007-12-31 15:41:01


Author: eric_niebler
Date: 2007-12-31 15:41:01 EST (Mon, 31 Dec 2007)
New Revision: 42393
URL: http://svn.boost.org/trac/boost/changeset/42393

Log:
all proto tests and examples work on msvc-7.1
Text files modified:
   branches/proto/v3/boost/xpressive/proto/context/default.hpp | 75 ++++++++++++++++++---------------------
   branches/proto/v3/boost/xpressive/regex_primitives.hpp | 72 ++++++++++++++++++++++++++-----------
   branches/proto/v3/libs/xpressive/proto/test/examples.cpp | 8 +++
   3 files changed, 92 insertions(+), 63 deletions(-)

Modified: branches/proto/v3/boost/xpressive/proto/context/default.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/context/default.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/context/default.hpp 2007-12-31 15:41:01 EST (Mon, 31 Dec 2007)
@@ -118,14 +118,6 @@
         //BOOST_MPL_ASSERT((is_same<void(*)(), result_of_fixup<void(* const &)()>::type>));
         //BOOST_MPL_ASSERT((is_same<void(*)(), result_of_fixup<void(&)()>::type>));
 
- #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
- template<typename T> T &make_ref_(T &t);
- template<typename T> T const &make_ref_(T const &t);
- #define BOOST_PROTO_REF(x) proto::detail::make_ref_(x)
- #else
- #define BOOST_PROTO_REF(x) x
- #endif
-
         template<typename Expr, typename Context, long Arity>
         struct default_eval_function_;
 
@@ -187,10 +179,10 @@
         struct default_eval<Expr, Context, Tag> \
         { \
         private: \
- static Expr &sexpr; \
- static Context &sctx; \
+ typedef typename proto::result_of::arg_c<Expr, 0>::type e0; \
+ typedef typename proto::result_of::eval<UNREF(e0), Context>::type r0; \
         public: \
- BOOST_PROTO_DECLTYPE_(Op proto::eval(BOOST_PROTO_REF(proto::arg_c<0>(sexpr)), sctx), result_type)\
+ BOOST_PROTO_DECLTYPE_(Op proto::detail::make<r0>(), result_type) \
             result_type operator()(Expr &expr, Context &ctx) const \
             { \
                 return Op proto::eval(proto::arg_c<0>(expr), ctx); \
@@ -205,10 +197,12 @@
         struct default_eval<Expr, Context, Tag> \
         { \
         private: \
- static Expr &sexpr; \
- static Context &sctx; \
+ typedef typename proto::result_of::arg_c<Expr, 0>::type e0; \
+ typedef typename proto::result_of::arg_c<Expr, 1>::type e1; \
+ typedef typename proto::result_of::eval<UNREF(e0), Context>::type r0; \
+ typedef typename proto::result_of::eval<UNREF(e1), Context>::type r1; \
         public: \
- BOOST_PROTO_DECLTYPE_(proto::eval(BOOST_PROTO_REF(proto::arg_c<0>(sexpr)), sctx) Op proto::eval(BOOST_PROTO_REF(proto::arg_c<1>(sexpr)), sctx), result_type)\
+ BOOST_PROTO_DECLTYPE_(proto::detail::make<r0>() Op proto::detail::make<r1>(), result_type)\
             result_type operator()(Expr &expr, Context &ctx) const \
             { \
                 return proto::eval(proto::arg_c<0>(expr), ctx) Op proto::eval(proto::arg_c<1>(expr), ctx);\
@@ -273,10 +267,10 @@
         struct default_eval<Expr, Context, proto::tag::post_inc>
         {
         private:
- static Expr &sexpr;
- static Context &sctx;
+ typedef typename proto::result_of::arg_c<Expr, 0>::type e0;
+ typedef typename proto::result_of::eval<UNREF(e0), Context>::type r0;
         public:
- BOOST_PROTO_DECLTYPE_(proto::eval(BOOST_PROTO_REF(proto::arg_c<0>(sexpr)), sctx) ++, result_type)
+ BOOST_PROTO_DECLTYPE_(proto::detail::make<r0>() ++, result_type)
             result_type operator()(Expr &expr, Context &ctx) const
             {
                 return proto::eval(proto::arg_c<0>(expr), ctx) ++;
@@ -288,10 +282,10 @@
         struct default_eval<Expr, Context, proto::tag::post_dec>
         {
         private:
- static Expr &sexpr;
- static Context &sctx;
+ typedef typename proto::result_of::arg_c<Expr, 0>::type e0;
+ typedef typename proto::result_of::eval<UNREF(e0), Context>::type r0;
         public:
- BOOST_PROTO_DECLTYPE_(proto::eval(BOOST_PROTO_REF(proto::arg_c<0>(sexpr)), sctx) --, result_type)
+ BOOST_PROTO_DECLTYPE_(proto::detail::make<r0>() --, result_type)
             result_type operator()(Expr &expr, Context &ctx) const
             {
                 return proto::eval(proto::arg_c<0>(expr), ctx) --;
@@ -303,10 +297,12 @@
         struct default_eval<Expr, Context, proto::tag::subscript>
         {
         private:
- static Expr &sexpr;
- static Context &sctx;
+ typedef typename proto::result_of::arg_c<Expr, 0>::type e0;
+ typedef typename proto::result_of::arg_c<Expr, 1>::type e1;
+ typedef typename proto::result_of::eval<UNREF(e0), Context>::type r0;
+ typedef typename proto::result_of::eval<UNREF(e1), Context>::type r1;
         public:
- BOOST_PROTO_DECLTYPE_(proto::eval(BOOST_PROTO_REF(proto::arg_c<0>(sexpr)), sctx)[proto::eval(BOOST_PROTO_REF(proto::arg_c<1>(sexpr)), sctx)], result_type)
+ BOOST_PROTO_DECLTYPE_(proto::detail::make<r0>()[proto::detail::make<r1>()], result_type)
             result_type operator()(Expr &expr, Context &ctx) const
             {
                 return proto::eval(proto::arg_c<0>(expr), ctx)[proto::eval(proto::arg_c<1>(expr), ctx)];
@@ -318,13 +314,17 @@
         struct default_eval<Expr, Context, proto::tag::if_else_>
         {
         private:
- static Expr &sexpr;
- static Context &sctx;
+ typedef typename proto::result_of::arg_c<Expr, 0>::type e0;
+ typedef typename proto::result_of::arg_c<Expr, 1>::type e1;
+ typedef typename proto::result_of::arg_c<Expr, 2>::type e2;
+ typedef typename proto::result_of::eval<UNREF(e0), Context>::type r0;
+ typedef typename proto::result_of::eval<UNREF(e1), Context>::type r1;
+ typedef typename proto::result_of::eval<UNREF(e2), Context>::type r2;
         public:
             BOOST_PROTO_DECLTYPE_(
- proto::eval(BOOST_PROTO_REF(proto::arg_c<0>(sexpr)), sctx)
- ? proto::eval(BOOST_PROTO_REF(proto::arg_c<1>(sexpr)), sctx)
- : proto::eval(BOOST_PROTO_REF(proto::arg_c<2>(sexpr)), sctx)
+ proto::detail::make<r0>()
+ ? proto::detail::make<r1>()
+ : proto::detail::make<r2>()
               , result_type
             )
             result_type operator()(Expr &expr, Context &ctx) const
@@ -339,18 +339,13 @@
         template<typename Expr, typename Context>
         struct default_eval<Expr, Context, proto::tag::comma>
         {
- typedef typename proto::result_of::eval<
- typename remove_reference<typename proto::result_of::arg_c<Expr, 0>::type>::type
- , Context
- >::type proto_arg0;
-
- typedef typename proto::result_of::eval<
- typename remove_reference<typename proto::result_of::arg_c<Expr, 1>::type>::type
- , Context
- >::type proto_arg1;
-
- typedef typename proto::detail::comma_result<proto_arg0, proto_arg1>::type result_type;
-
+ private:
+ typedef typename proto::result_of::arg_c<Expr, 0>::type e0;
+ typedef typename proto::result_of::arg_c<Expr, 1>::type e1;
+ typedef typename proto::result_of::eval<UNREF(e0), Context>::type r0;
+ typedef typename proto::result_of::eval<UNREF(e1), Context>::type r1;
+ public:
+ typedef typename proto::detail::comma_result<r0, r1>::type result_type;
             result_type operator()(Expr &expr, Context &ctx) const
             {
                 return proto::eval(proto::arg_c<0>(expr), ctx), proto::eval(proto::arg_c<1>(expr), ctx);

Modified: branches/proto/v3/boost/xpressive/regex_primitives.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/regex_primitives.hpp (original)
+++ branches/proto/v3/boost/xpressive/regex_primitives.hpp 2007-12-31 15:41:01 EST (Mon, 31 Dec 2007)
@@ -492,11 +492,16 @@
 /// \brief Make a sub-expression optional. Equivalent to !as_xpr(expr).
 ///
 /// \param expr The sub-expression to make optional.
-#ifdef BOOST_XPRESSIVE_DOXYGEN_INVOKED
-template<typename Expr> detail::unspecified optional(Expr const &expr) { return 0; }
-#else
-proto::functional::make_expr_ref<proto::tag::logical_not, proto::default_domain> const optional = {};
-#endif
+template<typename Expr>
+typename proto::result_of::make_expr_ref<
+ proto::tag::logical_not
+ , proto::default_domain
+ , Expr const &
+>::type const
+optional(Expr const &expr)
+{
+ return !proto::as_expr(expr);
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Repeat a sub-expression multiple times.
@@ -510,7 +515,11 @@
 ///
 /// \param expr The sub-expression to repeat.
 template<unsigned int Min, unsigned int Max, typename Expr>
-typename proto::result_of::make_expr_ref<detail::generic_quant_tag<Min, Max>, proto::default_domain, Expr const>::type const
+typename proto::result_of::make_expr_ref<
+ detail::generic_quant_tag<Min, Max>
+ , proto::default_domain
+ , Expr const &
+>::type const
 repeat(Expr const &expr)
 {
     return proto::make_expr_ref<detail::generic_quant_tag<Min, Max>, proto::default_domain>(expr);
@@ -519,7 +528,11 @@
 /// \overload
 ///
 template<unsigned int Count, typename Expr2>
-typename proto::result_of::make_expr_ref<detail::generic_quant_tag<Count, Count>, proto::default_domain, Expr2 const>::type const
+typename proto::result_of::make_expr_ref<
+ detail::generic_quant_tag<Count, Count>
+ , proto::default_domain
+ , Expr2 const &
+>::type const
 repeat(Expr2 const &expr2)
 {
     return proto::make_expr_ref<detail::generic_quant_tag<Count, Count>, proto::default_domain>(expr2);
@@ -535,11 +548,16 @@
 /// \attention keep(expr) is equivalent to the perl (?>...) extension.
 ///
 /// \param expr The sub-expression to modify.
-#ifdef BOOST_XPRESSIVE_DOXYGEN_INVOKED
-template<typename Expr> detail::unspecified keep(Expr const &expr) { return 0; }
-#else
-proto::functional::make_expr_ref<detail::keeper_tag, proto::default_domain> const keep = {};
-#endif
+template<typename Expr>
+typename proto::result_of::make_expr_ref<
+ detail::keeper_tag
+ , proto::default_domain
+ , Expr const &
+>::type const
+keep(Expr const &expr)
+{
+ return proto::make_expr_ref<detail::keeper_tag, proto::default_domain>(expr);
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Look-ahead assertion.
@@ -554,11 +572,16 @@
 /// perl (?!...) extension.
 ///
 /// \param expr The sub-expression to put in the look-ahead assertion.
-#ifdef BOOST_XPRESSIVE_DOXYGEN_INVOKED
-template<typename Expr> detail::unspecified before(Expr const &expr) { return 0; }
-#else
-proto::functional::make_expr_ref<detail::lookahead_tag, proto::default_domain> const before = {};
-#endif
+template<typename Expr>
+typename proto::result_of::make_expr_ref<
+ detail::lookahead_tag
+ , proto::default_domain
+ , Expr const &
+>::type const
+before(Expr const &expr)
+{
+ return proto::make_expr_ref<detail::lookahead_tag, proto::default_domain>(expr);
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Look-behind assertion.
@@ -575,11 +598,16 @@
 /// \param expr The sub-expression to put in the look-ahead assertion.
 ///
 /// \pre expr cannot match a variable number of characters.
-#ifdef BOOST_XPRESSIVE_DOXYGEN_INVOKED
-template<typename Expr> detail::unspecified after(Expr const &expr) { return 0; }
-#else
-proto::functional::make_expr_ref<detail::lookbehind_tag, proto::default_domain> const after = {};
-#endif
+template<typename Expr>
+typename proto::result_of::make_expr_ref<
+ detail::lookbehind_tag
+ , proto::default_domain
+ , Expr const &
+>::type const
+after(Expr const &expr)
+{
+ return proto::make_expr_ref<detail::lookbehind_tag, proto::default_domain>(expr);
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 /// \brief Specify a regex traits or a std::locale.

Modified: branches/proto/v3/libs/xpressive/proto/test/examples.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto/test/examples.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto/test/examples.cpp 2007-12-31 15:41:01 EST (Mon, 31 Dec 2007)
@@ -161,6 +161,12 @@
 {};
 //]
 
+// BUGBUG find workaround for this
+#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
+#define _pop_front(x) call<_pop_front(x)>
+#define _arg(x) call<_arg(x)>
+#endif
+
 //[ AsArgList
 // This transform matches function invocations such as foo(1,'a',"b")
 // and transforms them into Fusion cons lists of their arguments. In this
@@ -175,7 +181,7 @@
             /*<< The first child expression of a `function<>` node is the
             function being invoked. We don't want that in our list, so use
             the `pop_front()` to remove it. >>*/
- _pop_front(_) // make (_) optional
+ _pop_front(_)
           /*<< `nil` is the initial state used by the `reverse_fold<>`
           transform. >>*/
           , fusion::nil()


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