|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62538 - sandbox/SOC/2010/phoenix3/boost/phoenix/core
From: joel_at_[hidden]
Date: 2010-06-07 21:39:37
Author: djowel
Date: 2010-06-07 21:39:36 EDT (Mon, 07 Jun 2010)
New Revision: 62538
URL: http://svn.boost.org/trac/boost/changeset/62538
Log:
First shot by Thomas Heller
Added:
sandbox/SOC/2010/phoenix3/boost/phoenix/core/argument.hpp (contents, props changed)
sandbox/SOC/2010/phoenix3/boost/phoenix/core/as_actor.hpp (contents, props changed)
sandbox/SOC/2010/phoenix3/boost/phoenix/core/is_actor.hpp (contents, props changed)
sandbox/SOC/2010/phoenix3/boost/phoenix/core/limits.hpp (contents, props changed)
sandbox/SOC/2010/phoenix3/boost/phoenix/core/nothing.hpp (contents, props changed)
sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp (contents, props changed)
sandbox/SOC/2010/phoenix3/boost/phoenix/core/value.hpp (contents, props changed)
Added: sandbox/SOC/2010/phoenix3/boost/phoenix/core/argument.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/argument.hpp 2010-06-07 21:39:36 EDT (Mon, 07 Jun 2010)
@@ -0,0 +1,76 @@
+/*==============================================================================
+ Copyright (c) 2001-2010 Joel de Guzman
+ Copyright (c) 2010 Eric Niebler
+ Copyright (c) 2010 Thomas Heller
+
+ 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 PHOENIX_CORE_ARGUMENT_HPP
+#define PHOENIX_CORE_ARGUMENT_HPP
+
+#include <boost/phoenix/core/actor.hpp>
+#include <boost/phoenix/core/as_actor.hpp>
+#include <boost/phoenix/core/meta_grammar.hpp>
+
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+
+#include <boost/mpl/int.hpp>
+
+#include <boost/utility/result_of.hpp>
+
+namespace boost { namespace phoenix
+{
+ // function for evaluating argument placeholders like: _1
+ struct argument
+ {
+ template<typename N, template<typename> class Actor = actor >
+ struct as_actor : boost::phoenix::as_actor<argument, Actor, N>
+ {};
+
+ template<typename Signature>
+ struct result;
+
+ template<typename This, typename Env, typename N>
+ struct result<This(Env &, N &)>
+ : fusion::result_of::at<
+ Env, typename boost::result_of<eval_grammar(N)>::type>
+ {};
+
+ template<typename Env, typename N>
+ typename boost::result_of<argument(Env &, N &)>::type
+ operator()(Env & env, N &) const
+ {
+ return fusion::at<
+ typename boost::result_of<eval_grammar(N)>::type>(env);
+ }
+ };
+
+ namespace placeholders
+ {
+ // Phoenix style names
+ argument::as_actor<mpl::int_<0> >::result_type const arg1 = {};
+ argument::as_actor<mpl::int_<1> >::result_type const arg2 = {};
+ argument::as_actor<mpl::int_<2> >::result_type const arg3 = {};
+
+ // BLL style names
+ argument::as_actor<mpl::int_<0> >::result_type const _1 = {};
+ argument::as_actor<mpl::int_<1> >::result_type const _2 = {};
+ argument::as_actor<mpl::int_<2> >::result_type const _3 = {};
+ }
+
+ namespace arg_names
+ {
+ // bring in names for backwards compatibility
+
+ using placeholders::arg1;
+ using placeholders::arg2;
+ using placeholders::arg3;
+
+ using placeholders::_1;
+ using placeholders::_2;
+ using placeholders::_3;
+ }
+}}
+
+#endif
Added: sandbox/SOC/2010/phoenix3/boost/phoenix/core/as_actor.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/as_actor.hpp 2010-06-07 21:39:36 EDT (Mon, 07 Jun 2010)
@@ -0,0 +1,155 @@
+/*==============================================================================
+ Copyright (c) 2001-2010 Joel de Guzman
+ Copyright (c) 2010 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 PHOENIX_CORE_AS_ACTOR_HPP
+#define PHOENIX_CORE_AS_ACTOR_HPP
+
+#include <boost/call_traits.hpp>
+#include <boost/fusion/sequence/intrinsic/at.hpp>
+#include <boost/phoenix/core/actor.hpp>
+#include <boost/phoenix/core/domain.hpp>
+#include <boost/phoenix/core/meta_grammar.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
+#include <boost/preprocessor/iteration/local.hpp>
+#include <boost/proto/tags.hpp>
+#include <boost/proto/make_expr.hpp>
+
+namespace boost { namespace phoenix
+{
+ ////////////////////////////////////////////////////////////////////////////
+ // Create an actor (TR1 function) from a proto transform and data type
+ // we will associte with it (the actor).
+ ////////////////////////////////////////////////////////////////////////////
+ template<typename F, template< typename > class Actor
+ , typename A0 = void, typename A1 = void, typename A2 = void, typename A3 = void
+ /* ... more ... */
+ , typename Dummy = void>
+ struct as_actor;
+
+ template<typename F, template<typename> class Actor>
+ struct as_actor<F, Actor>
+ {
+ typedef
+ typename proto::result_of::make_expr<
+ proto::tag::function
+ , proto::default_domain
+ , funcwrap<F>
+ , env>::type
+ base_type;
+ typedef Actor<base_type> result_type;
+
+ result_type
+ operator()() const
+ {
+ actor<base_type> const e = {{funcwrap<F>(), env()}};
+ return e;
+ }
+ };
+
+ template<typename F, template<typename> class Actor, typename A0>
+ struct as_actor<F, Actor, A0>
+ {
+ typedef
+ typename proto::result_of::make_expr<
+ proto::tag::function
+ , proto::default_domain
+ , funcwrap<F>
+ , env
+ , A0>::type
+ base_type;
+ typedef Actor<base_type> result_type;
+
+ result_type
+ operator()( typename call_traits<A0>::param_type a0 ) const
+ {
+ actor<base_type> const e = {{funcwrap<F>(), env(), a0}};
+ return e;
+ }
+ };
+
+ template<typename F, template<typename> class Actor, typename A0, typename A1>
+ struct as_actor<F, Actor, A0, A1>
+ {
+ typedef
+ typename proto::result_of::make_expr<
+ proto::tag::function
+ , proto::default_domain
+ , funcwrap<F>
+ , env
+ , A0
+ , A1>::type
+ base_type;
+ typedef Actor<base_type> result_type;
+
+ result_type
+ operator()( typename call_traits<A0>::param_type a0, typename call_traits<A1>::param_type a1 ) const
+ {
+ actor<base_type> const e = {{funcwrap<F>(), env(), a0, a1}};
+ return e;
+ }
+ };
+
+ template<typename F, template<typename> class Actor, typename A0, typename A1, typename A2>
+ struct as_actor<F, Actor, A0, A1, A2>
+ {
+ typedef
+ typename proto::result_of::make_expr<
+ proto::tag::function
+ , proto::default_domain
+ , funcwrap<F>
+ , env
+ , A0
+ , A1
+ , A2>::type
+ base_type;
+ typedef Actor<base_type> result_type;
+
+ result_type
+ operator()( typename call_traits<A0>::param_type a0, typename call_traits<A1>::param_type a1, typename call_traits<A2>::param_type a2) const
+ {
+ actor<base_type> const e = {{funcwrap<F>(), env(), a0, a1, a2}};
+ return e;
+ }
+ };
+
+}}
+
+/*
+#define BOOST_PP_LOCAL_MACRO( N ) \
+ namespace boost { namespace phoenix \
+ { \
+ template<typename F, template<typename> class Actor \
+ BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> \
+ struct as_actor<F, Actor BOOST_PP_ENUM_TRAILING_PARAMS(N, A)> \
+ { \
+ typedef \
+ typename proto::result_of::make_expr< \
+ proto::tag::function \
+ , proto::default_domain \
+ , funcwrap< F > \
+ , env BOOST_PP_ENUM_TRAILING_PARAMS(N, A) \
+ >::type \
+ base_type; \
+ \
+ typedef Actor<base_type> result_type; \
+ \
+ result_type \
+ operator()( \
+ BOOST_PP_ENUM_BINARY_PARAMS(N, typename call_traits< A, >::param_type a)) const \
+ { \
+ actor<base_type> const e = {{funcwrap< F >(), env() BOOST_PP_ENUM_TRAILING_PARAMS(N, a)}};\
+ return e; \
+ } \
+ }; \
+ }}
+
+#define BOOST_PP_LOCAL_LIMITS ( 0, 3 )
+#include BOOST_PP_LOCAL_ITERATE()
+*/
+
+#endif
Added: sandbox/SOC/2010/phoenix3/boost/phoenix/core/is_actor.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/is_actor.hpp 2010-06-07 21:39:36 EDT (Mon, 07 Jun 2010)
@@ -0,0 +1,26 @@
+/*==============================================================================
+ Copyright (c) 2005-2010 Joel de Guzman
+
+ 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 PHOENIX_CORE_IS_ACTOR_HPP
+#define PHOENIX_CORE_IS_ACTOR_HPP
+
+namespace boost { namespace phoenix
+{
+///////////////////////////////////////////////////////////////////////////////
+//
+// is_actor<T>
+//
+// Tests if T is an actor. Evaluates to mpl::true_ or mpl::false_
+//
+///////////////////////////////////////////////////////////////////////////////
+ template <typename T>
+ struct is_actor : mpl::false_ {};
+
+ template <typename Expr>
+ struct is_actor<actor<Expr> > : mpl::true_ {};
+}}
+
+#endif
Added: sandbox/SOC/2010/phoenix3/boost/phoenix/core/limits.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/limits.hpp 2010-06-07 21:39:36 EDT (Mon, 07 Jun 2010)
@@ -0,0 +1,79 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+
+ 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 PHOENIX_CORE_LIMITS_HPP
+#define PHOENIX_CORE_LIMITS_HPP
+
+#include <boost/preprocessor/dec.hpp>
+
+#if !defined(PHOENIX_LIMIT)
+# define PHOENIX_LIMIT 10
+#elif (PHOENIX_LIMIT < 5)
+# error "PHOENIX_LIMIT is set too low"
+#endif
+
+#if !defined(PHOENIX_ARG_LIMIT)
+# define PHOENIX_ARG_LIMIT PHOENIX_LIMIT
+#elif (PHOENIX_ARG_LIMIT < 5)
+# error "PHOENIX_ARG_LIMIT is set too low"
+#endif
+
+#if !defined(PHOENIX_ACTOR_LIMIT)
+# define PHOENIX_ACTOR_LIMIT PHOENIX_LIMIT
+#elif (PHOENIX_ACTOR_LIMIT > PHOENIX_ARG_LIMIT)
+# error "PHOENIX_ACTOR_LIMIT > PHOENIX_ARG_LIMIT"
+#elif (PHOENIX_ACTOR_LIMIT < 3)
+# error "PHOENIX_ACTOR_LIMIT is set too low"
+#endif
+
+#if !defined(PHOENIX_COMPOSITE_LIMIT)
+# define PHOENIX_COMPOSITE_LIMIT PHOENIX_LIMIT
+#elif (PHOENIX_COMPOSITE_LIMIT < 5)
+# error "PHOENIX_COMPOSITE_LIMIT is set too low"
+#endif
+
+#if !defined(PHOENIX_MEMBER_LIMIT)
+# define PHOENIX_MEMBER_LIMIT BOOST_PP_DEC(BOOST_PP_DEC(PHOENIX_COMPOSITE_LIMIT))
+#elif (PHOENIX_MEMBER_LIMIT > PHOENIX_COMPOSITE_LIMIT)
+# error "PHOENIX_MEMBER_LIMIT > PHOENIX_COMPOSITE_LIMIT"
+#elif (PHOENIX_MEMBER_LIMIT < 3)
+# error "PHOENIX_MEMBER_LIMIT is set too low"
+#endif
+
+#if !defined(PHOENIX_CATCH_LIMIT)
+# define PHOENIX_CATCH_LIMIT BOOST_PP_DEC(PHOENIX_COMPOSITE_LIMIT)
+#elif (PHOENIX_CATCH_LIMIT < 1)
+# error "PHOENIX_CATCH_LIMIT is set too low"
+#endif
+
+#if !defined(PHOENIX_DYNAMIC_LIMIT)
+# define PHOENIX_DYNAMIC_LIMIT PHOENIX_LIMIT
+#elif (PHOENIX_DYNAMIC_LIMIT < 1)
+# error "PHOENIX_DYNAMIC_LIMIT is set too low"
+#endif
+
+#if !defined(PHOENIX_LOCAL_LIMIT)
+# define PHOENIX_LOCAL_LIMIT PHOENIX_LIMIT
+#elif (PHOENIX_LOCAL_LIMIT < 3)
+# error "PHOENIX_LOCAL_LIMIT is set too low"
+#endif
+
+
+#if !defined(FUSION_MAX_VECTOR_SIZE)
+# define FUSION_MAX_VECTOR_SIZE PHOENIX_LIMIT
+#elif (FUSION_MAX_VECTOR_SIZE < PHOENIX_LIMIT)
+# error "FUSION_MAX_VECTOR_SIZE < PHOENIX_LIMIT"
+#endif
+
+// this include will bring in mpl::vectorN and
+// fusion::vectorN where N is PHOENIX_LIMIT
+#include <boost/fusion/include/vector.hpp>
+
+// for some reason, this must be included now to make
+// detail/type_deduction.hpp compile. $$$ TODO: Investigate further $$$
+#include <boost/mpl/vector/vector20.hpp>
+
+#endif
Added: sandbox/SOC/2010/phoenix3/boost/phoenix/core/nothing.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/nothing.hpp 2010-06-07 21:39:36 EDT (Mon, 07 Jun 2010)
@@ -0,0 +1,37 @@
+/*==============================================================================
+ Copyright (c) 2005-2010 Joel de Guzman
+
+ 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 PHOENIX_CORE_NOTHING_HPP
+#define PHOENIX_CORE_NOTHING_HPP
+
+#include <boost/phoenix/core/actor.hpp>
+#include <boost/phoenix/core/as_actor.hpp>
+
+namespace boost { namespace phoenix
+{
+///////////////////////////////////////////////////////////////////////////////
+//
+// null_actor
+//
+// A actor that does nothing (a "bum", if you will :-).
+//
+///////////////////////////////////////////////////////////////////////////////
+ struct null_actor
+ {
+ typedef void result_type;
+
+ template <typename Env>
+ void
+ eval(Env const&) const
+ {
+ }
+ };
+
+ as_actor<null_actor, actor>::result_type const nothing = {};
+
+}}
+
+#endif
Added: sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp 2010-06-07 21:39:36 EDT (Mon, 07 Jun 2010)
@@ -0,0 +1,61 @@
+/*==============================================================================
+ Copyright (c) 2001-2010 Joel de Guzman
+ Copyright (c) 2010 Thomas Heller
+
+ 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 PHOENIX_CORE_REFERENCE_HPP
+#define PHOENIX_CORE_REFERENCE_HPP
+
+#include <boost/phoenix/core/actor.hpp>
+#include <boost/phoenix/core/as_actor.hpp>
+#include <boost/phoenix/core/meta_grammar.hpp>
+#include <boost/utility/result_of.hpp>
+
+namespace boost { namespace phoenix
+{
+ ////////////////////////////////////////////////////////////////////////////
+ // References
+ ////////////////////////////////////////////////////////////////////////////
+
+ // function for evaluating references, e.g. ref( 123 )
+ struct reference
+ {
+ template<typename T>
+ struct as_actor : phoenix::as_actor<reference, actor, T &>
+ {};
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Env, typename T>
+ struct result<This(Env &, T &)>
+ : boost::result_of<eval_grammar(T &)>
+ {};
+
+ template<typename Env, typename T>
+ typename boost::result_of<eval_grammar(T &)>::type
+ operator()(Env & env, T & t) const
+ {
+ return eval(t);
+ }
+ };
+
+ template<typename T>
+ typename reference::as_actor<T>::result_type
+ ref(T & t)
+ {
+ return reference::as_actor<T>()(t);
+ }
+
+ template<typename T>
+ typename reference::as_actor<T const>::result_type
+ cref(T & t)
+ {
+ return reference::as_actor<T const>()(t);
+ }
+
+}}
+
+#endif
Added: sandbox/SOC/2010/phoenix3/boost/phoenix/core/value.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/value.hpp 2010-06-07 21:39:36 EDT (Mon, 07 Jun 2010)
@@ -0,0 +1,54 @@
+/*==============================================================================
+ Copyright (c) 2001-2010 Joel de Guzman
+ Copyright (c) 2010 Thomas Heller
+
+ 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 PHOENIX_CORE_VALUE_HPP
+#define PHOENIX_CORE_VALUE_HPP
+
+#include <boost/phoenix/core/actor.hpp>
+#include <boost/phoenix/core/as_actor.hpp>
+#include <boost/phoenix/core/meta_grammar.hpp>
+#include <boost/utility/result_of.hpp>
+
+namespace boost { namespace phoenix
+{
+ ////////////////////////////////////////////////////////////////////////////
+ // Values
+ ////////////////////////////////////////////////////////////////////////////
+
+ // function for evaluating values, e.g. val( 123 )
+ struct value
+ {
+ template<typename T>
+ struct as_actor : phoenix::as_actor<value, actor, T>
+ {};
+
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Env, typename T>
+ struct result<This(Env &,T &)>
+ : boost::result_of<eval_grammar(T)>
+ {};
+
+ template<typename Env, typename T>
+ typename boost::result_of<eval_grammar(T)>::type
+ operator()(Env & env, T const & t)
+ {
+ return eval(t);
+ }
+ };
+
+ template<typename T>
+ typename value::as_actor<T>::result_type
+ val(T const & t )
+ {
+ return value::as_actor<T>()(t);
+ }
+
+}}
+
+#endif
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