Update of /cvsroot/boost/boost/boost/xpressive/proto/transform
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22331/transform

Modified Files:
        apply.hpp arg.hpp branch.hpp compose.hpp construct.hpp 
        fold.hpp fold_tree.hpp function.hpp list.hpp pass_through.hpp 
Log Message:
fix construct transform, add pod_construct

Index: apply.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/transform/apply.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- apply.hpp   23 Jun 2007 17:12:49 -0000      1.1
+++ apply.hpp   9 Jul 2007 18:11:18 -0000       1.2
@@ -140,4 +140,27 @@
 
 }}}
 
+namespace boost { namespace proto
+{
+    template<typename Grammar, typename Always, typename Factory>
+    struct is_transform<transform::always<Grammar, Always, Factory> >
+      : mpl::true_
+    {};
+
+    template<typename Grammar, typename Lambda, typename Factory>
+    struct is_transform<transform::apply1<Grammar, Lambda, Factory> >
+      : mpl::true_
+    {};
+
+    template<typename Grammar, typename Lambda, typename Factory>
+    struct is_transform<transform::apply2<Grammar, Lambda, Factory> >
+      : mpl::true_
+    {};
+
+    template<typename Grammar, typename Lambda, typename Factory>
+    struct is_transform<transform::apply3<Grammar, Lambda, Factory> >
+      : mpl::true_
+    {};
+}}
+
 #endif

Index: arg.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/transform/arg.hpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- arg.hpp     23 Jun 2007 17:12:49 -0000      1.17
+++ arg.hpp     9 Jul 2007 18:11:18 -0000       1.18
@@ -151,4 +151,42 @@
 
 }}}
 
+namespace boost { namespace proto
+{
+    template<typename Grammar, typename N>
+    struct is_transform<transform::arg<Grammar, N> >
+      : mpl::true_
+    {};
+
+    template<typename Grammar, long N>
+    struct is_transform<transform::arg_c<Grammar, N> >
+      : mpl::true_
+    {};
+
+    template<typename Grammar>
+    struct is_transform<transform::left<Grammar> >
+      : mpl::true_
+    {};
+
+    template<typename Grammar>
+    struct is_transform<transform::right<Grammar> >
+      : mpl::true_
+    {};
+
+    template<typename Grammar>
+    struct is_transform<transform::identity<Grammar> >
+      : mpl::true_
+    {};
+
+    template<typename Grammar>
+    struct is_transform<transform::state<Grammar> >
+      : mpl::true_
+    {};
+
+    template<typename Grammar>
+    struct is_transform<transform::visitor<Grammar> >
+      : mpl::true_
+    {};
+}}
+
 #endif

Index: branch.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/transform/branch.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- branch.hpp  14 Jun 2007 06:03:30 -0000      1.4
+++ branch.hpp  9 Jul 2007 18:11:18 -0000       1.5
@@ -40,4 +40,12 @@
 
 }}}
 
+namespace boost { namespace proto
+{
+    template<typename Grammar, typename BranchState>
+    struct is_transform<transform::branch<Grammar, BranchState> >
+      : mpl::true_
+    {};
+}}
+
 #endif

Index: compose.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/transform/compose.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- compose.hpp 14 Jun 2007 06:03:30 -0000      1.2
+++ compose.hpp 9 Jul 2007 18:11:19 -0000       1.3
@@ -46,4 +46,12 @@
 
 }}}
 
+namespace boost { namespace proto
+{
+    template<typename Grammar1, typename Grammar2>
+    struct is_transform<transform::compose<Grammar1, Grammar2> >
+      : mpl::true_
+    {};
+}}
+
 #endif

Index: construct.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/transform/construct.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- construct.hpp       4 Jul 2007 21:40:17 -0000       1.11
+++ construct.hpp       9 Jul 2007 18:11:19 -0000       1.12
@@ -15,8 +15,11 @@
     #include <boost/preprocessor/facilities/intercept.hpp>
     #include <boost/preprocessor/repetition/enum.hpp>
     #include <boost/preprocessor/repetition/enum_params.hpp>
+    #include <boost/preprocessor/repetition/enum_trailing.hpp>
     #include <boost/preprocessor/repetition/enum_binary_params.hpp>
     #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+    #include <boost/mpl/bool.hpp>
+    #include <boost/type_traits/is_pod.hpp>
     #include <boost/type_traits/is_function.hpp>
     #include <boost/type_traits/remove_pointer.hpp>
     #include <boost/xpressive/proto/proto_fwd.hpp>
@@ -27,15 +30,14 @@
         namespace detail
         {
             template<typename T>
-            struct is_wildcard_expression
-            {
-                BOOST_STATIC_CONSTANT(
-                    bool
-                  , value = 
(sizeof(is_wildcard_expression_fun(static_cast<T*>(0)))==                       
 \
-                             sizeof(yes_type))
-                );
-                typedef mpl::bool_<value> type;
-            };
+            struct is_aggregate
+              : is_pod<T>
+            {};
+
+            template<typename Tag, typename Args, long N>
+            struct is_aggregate<expr<Tag, Args, N> >
+              : mpl::true_
+            {};
 
             template<typename T, bool HasType = mpl::aux::has_type<T>::value>
             struct nested_type
@@ -49,6 +51,20 @@
                 typedef T type;
             };
 
+            template<typename T 
BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(BOOST_PROTO_MAX_ARITY, typename A, = 
no_type BOOST_PP_INTERCEPT)>
+            struct nested_type_if
+              : nested_type<T>
+            {
+                typedef yes_type proto_transform_applied;
+            };
+
+            template<typename T>
+            struct nested_type_if<T 
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, no_type 
BOOST_PP_INTERCEPT)>
+            {
+                typedef T type;
+                typedef no_type proto_transform_applied;
+            };
+
             template<typename Arg, bool IsFunction = is_function<typename 
remove_pointer<Arg>::type>::value>
             struct as_transform
             {
@@ -61,31 +77,45 @@
                 typedef construct<_, typename remove_pointer<Arg>::type> type;
             };
 
+            template<typename Arg, bool IsFunction = is_function<typename 
remove_pointer<Arg>::type>::value>
+            struct as_pod_transform
+            {
+                typedef Arg type;
+            };
+
+            template<typename Arg>
+            struct as_pod_transform<Arg, true>
+            {
+                typedef pod_construct<_, typename remove_pointer<Arg>::type> 
type;
+            };
+
             template<typename R, typename Expr, typename State, typename 
Visitor
                      BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(long Arity = 
mpl::aux::template_arity<R>::value)>
-            struct apply_aux2_;
-
-            template<typename R, typename Expr, typename State, typename 
Visitor,
-                     bool IsWildcard = is_wildcard_expression<R>::value>
             struct apply_aux_
             {
                 typedef R type;
+                typedef no_type proto_transform_applied;
             };
 
-            template<typename R, typename Expr, typename State, typename 
Visitor>
-            struct apply_aux_<R, Expr, State, Visitor, true>
-              : apply_aux2_<R, Expr, State, Visitor>
-            {};
-
-            template<typename R, typename Expr, typename State, typename 
Visitor, typename EnableIf = void>
+            template<typename R, typename Expr, typename State, typename 
Visitor, bool IsTransform = is_transform<R>::value>
             struct apply_
               : apply_aux_<R, Expr, State, Visitor>
             {};
 
             template<typename R, typename Expr, typename State, typename 
Visitor>
-            struct apply_<R, Expr, State, Visitor, typename 
R::proto_is_wildcard_>
+            struct apply_<R, Expr, State, Visitor, true>
               : nested_type<typename R::template apply<Expr, State, 
Visitor>::type>
-            {};
+            {
+                typedef yes_type proto_transform_applied;
+            };
+
+            // work around GCC bug
+            template<typename Tag, typename Args, long N, typename Expr, 
typename State, typename Visitor>
+            struct apply_<expr<Tag, Args, N>, Expr, State, Visitor, false>
+            {
+                typedef expr<Tag, Args, N> type;
+                typedef no_type proto_transform_applied;
+            };
 
             template<typename T>
             void ignore_unused(T const &)
@@ -96,13 +126,31 @@
             typename apply_<BOOST_PP_CAT(DATA, N), Expr, State, Visitor>::type 
                     \
             /**/
 
+        #define BOOST_PROTO_IS_APPLIED_(Z, N, DATA)                            
                     \
+            typename apply_<BOOST_PP_CAT(DATA, N), Expr, State, 
Visitor>::proto_transform_applied   \
+            /**/
+
         #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PROTO_MAX_ARITY, 
<boost/xpressive/proto/transform/construct.hpp>))
         #include BOOST_PP_ITERATE()
 
         #undef BOOST_PROTO_APPLY_
+        #undef BOOST_PROTO_IS_APPLIED_
 
     }}}
 
+    namespace boost { namespace proto
+    {
+        template<typename Grammar, typename ConstructorFun>
+        struct is_transform<transform::construct<Grammar, ConstructorFun> >
+          : mpl::true_
+        {};
+
+        template<typename Grammar, typename ConstructorFun>
+        struct is_transform<transform::pod_construct<Grammar, ConstructorFun> >
+          : mpl::true_
+        {};
+    }}
+
     #endif
 
 #else
@@ -117,8 +165,11 @@
                 BOOST_PP_ENUM_TRAILING_PARAMS(N, typename G),
                 typename Expr, typename State, typename Visitor
             >
-            struct apply_aux2_<T<BOOST_PP_ENUM_PARAMS(N, G)>, Expr, State, 
Visitor BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(N)>
-              : nested_type<T<BOOST_PP_ENUM(N, BOOST_PROTO_APPLY_, G)> >
+            struct apply_aux_<T<BOOST_PP_ENUM_PARAMS(N, G)>, Expr, State, 
Visitor BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(N)>
+              : nested_type_if<
+                    T<BOOST_PP_ENUM(N, BOOST_PROTO_APPLY_, G)>
+                    BOOST_PP_ENUM_TRAILING(N, BOOST_PROTO_IS_APPLIED_, G)
+                >
             {};
         }
         #endif
@@ -136,7 +187,8 @@
             static typename apply<Expr, State, Visitor>::type
             call(Expr const &expr, State const &state, Visitor &visitor)
             {
-                return construct::call_(expr, state, visitor, is_expr<typename 
apply<Expr, State, Visitor>::type>());
+                typedef typename apply<Expr, State, Visitor>::type result_type;
+                return construct::call_(expr, state, visitor, 
detail::is_aggregate<result_type>());
             }
 
         private:
@@ -170,6 +222,29 @@
             }
         };
 
+        template<typename Grammar, typename Result 
BOOST_PP_ENUM_TRAILING_PARAMS(N, typename Arg)>
+        struct pod_construct<Grammar, Result(BOOST_PP_ENUM_PARAMS(N, Arg))>
+          : Grammar
+        {
+            template<typename Expr, typename State, typename Visitor>
+            struct apply
+              : detail::apply_<Result, typename Grammar::template apply<Expr, 
State, Visitor>::type, State, Visitor>
+            {};
+
+            template<typename Expr, typename State, typename Visitor>
+            static typename apply<Expr, State, Visitor>::type
+            call(Expr const &expr, State const &state, Visitor &visitor)
+            {
+                typename Grammar::template apply<Expr, State, Visitor>::type 
const &expr2
+                    = Grammar::call(expr, state, visitor);
+                detail::ignore_unused(expr2);
+                typename apply<Expr, State, Visitor>::type that = {
+                    BOOST_PP_ENUM_BINARY_PARAMS(N, 
detail::as_pod_transform<Arg, >::type::call(expr2, state, visitor) 
BOOST_PP_INTERCEPT)
+                };
+                return that;
+            }
+        };
+
     #undef N
 
 #endif

Index: fold.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/transform/fold.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- fold.hpp    26 Jun 2007 05:44:10 -0000      1.14
+++ fold.hpp    9 Jul 2007 18:11:19 -0000       1.15
@@ -129,6 +129,19 @@
 
     }}}
 
+    namespace boost { namespace proto
+    {
+        template<typename Grammar, typename State>
+        struct is_transform<transform::fold<Grammar, State> >
+          : mpl::true_
+        {};
+
+        template<typename Grammar, typename State>
+        struct is_transform<transform::reverse_fold<Grammar, State> >
+          : mpl::true_
+        {};
+    }}
+
     #endif
 
 #else

Index: fold_tree.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/transform/fold_tree.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- fold_tree.hpp       26 Jun 2007 05:44:10 -0000      1.3
+++ fold_tree.hpp       9 Jul 2007 18:11:19 -0000       1.4
@@ -62,4 +62,17 @@
 
 }}}
 
+namespace boost { namespace proto
+{
+    template<typename Tag, typename Grammar, typename State>
+    struct is_transform<transform::fold_tree<Tag, Grammar, State> >
+      : mpl::true_
+    {};
+
+    template<typename Tag, typename Grammar, typename State>
+    struct is_transform<transform::reverse_fold_tree<Tag, Grammar, State> >
+      : mpl::true_
+    {};
+}}
+
 #endif

Index: function.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/transform/function.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- function.hpp        23 Jun 2007 07:41:20 -0000      1.1
+++ function.hpp        9 Jul 2007 18:11:19 -0000       1.2
@@ -94,4 +94,22 @@
 
 }}}
 
+namespace boost { namespace proto
+{
+    template<typename Grammar, typename Function1>
+    struct is_transform<transform::function1<Grammar, Function1> >
+      : mpl::true_
+    {};
+
+    template<typename Grammar, typename Function2>
+    struct is_transform<transform::function2<Grammar, Function2> >
+      : mpl::true_
+    {};
+
+    template<typename Grammar, typename Function3>
+    struct is_transform<transform::function3<Grammar, Function3> >
+      : mpl::true_
+    {};
+}}
+
 #endif

Index: list.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/transform/list.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- list.hpp    14 Jun 2007 06:03:30 -0000      1.6
+++ list.hpp    9 Jul 2007 18:11:26 -0000       1.7
@@ -71,4 +71,17 @@
 
 }}}
 
+namespace boost { namespace proto
+{
+    template<typename Grammar>
+    struct is_transform<transform::list<Grammar> >
+      : mpl::true_
+    {};
+
+    template<typename Grammar>
+    struct is_transform<transform::tail<Grammar> >
+      : mpl::true_
+    {};
+}}
+
 #endif

Index: pass_through.hpp
===================================================================
RCS file: 
/cvsroot/boost/boost/boost/xpressive/proto/transform/pass_through.hpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- pass_through.hpp    6 Jul 2007 08:54:43 -0000       1.14
+++ pass_through.hpp    9 Jul 2007 18:11:27 -0000       1.15
@@ -80,6 +80,11 @@
         };
     } // namespace transform
 
+    template<typename Grammar>
+    struct is_transform<transform::pass_through<Grammar> >
+      : mpl::true_
+    {};
+
     namespace has_transformns_
     {
         template<typename Grammar>
@@ -107,7 +112,7 @@
         };
 
     } // namespace has_transformns_
-    
+
     }} // namespace boost::proto
 
     #endif


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to