Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71719 - in trunk/boost/msm: . back front/euml
From: christophe.j.henry_at_[hidden]
Date: 2011-05-04 15:44:03


Author: chenry
Date: 2011-05-04 15:44:03 EDT (Wed, 04 May 2011)
New Revision: 71719
URL: http://svn.boost.org/trac/boost/changeset/71719

Log:
fixed bug with euml and state construction (see post: [msm] EUML and State construction)
Added:
   trunk/boost/msm/msm_grammar.hpp (contents, props changed)
Text files modified:
   trunk/boost/msm/back/fold_to_list.hpp | 15 ++++++++++++++-
   trunk/boost/msm/front/euml/common.hpp | 4 +++-
   2 files changed, 17 insertions(+), 2 deletions(-)

Modified: trunk/boost/msm/back/fold_to_list.hpp
==============================================================================
--- trunk/boost/msm/back/fold_to_list.hpp (original)
+++ trunk/boost/msm/back/fold_to_list.hpp 2011-05-04 15:44:03 EDT (Wed, 04 May 2011)
@@ -13,6 +13,7 @@
 #include <boost/msm/proto_config.hpp>
 #include <boost/proto/core.hpp>
 #include <boost/proto/transform.hpp>
+#include <boost/msm/msm_grammar.hpp>
 #include <boost/fusion/container/list/cons.hpp>
 
 namespace boost { namespace msm { namespace back
@@ -20,7 +21,19 @@
  struct state_copy_tag
  {
  };
- ::boost::proto::terminal<state_copy_tag>::type const states_={{}};
+
+template<class X = proto::is_proto_expr>
+struct define_states_creation
+{
+ BOOST_PROTO_BASIC_EXTENDS(
+ proto::terminal<state_copy_tag>::type
+ , define_states_creation
+ , boost::msm::msm_domain
+ )
+};
+
+define_states_creation<> const states_ = {{}};
+
  struct FoldToList
   : ::boost::proto::or_<
         // Don't add the states_ terminal to the list

Modified: trunk/boost/msm/front/euml/common.hpp
==============================================================================
--- trunk/boost/msm/front/euml/common.hpp (original)
+++ trunk/boost/msm/front/euml/common.hpp 2011-05-04 15:44:03 EDT (Wed, 04 May 2011)
@@ -60,6 +60,8 @@
 #include <boost/preprocessor/arithmetic/dec.hpp>
 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
 #include <boost/preprocessor/cat.hpp>
+
+#include <boost/msm/msm_grammar.hpp>
 #include <boost/msm/front/functor_row.hpp>
 
 namespace proto = boost::proto;
@@ -179,7 +181,7 @@
 struct euml_terminal;
 
 struct sm_domain
- : proto::domain< proto::generator<euml_terminal>, terminal_grammar >
+ : proto::domain< proto::generator<euml_terminal>, terminal_grammar, boost::msm::msm_domain >
 {};
 
 struct state_grammar :

Added: trunk/boost/msm/msm_grammar.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/msm/msm_grammar.hpp 2011-05-04 15:44:03 EDT (Wed, 04 May 2011)
@@ -0,0 +1,45 @@
+// Copyright 2008 Christophe Henry
+// henry UNDERSCORE christophe AT hotmail DOT com
+// This is an extended version of the state machine available in the boost::mpl library
+// Distributed under the same license as the original.
+// Copyright for the original version:
+// Copyright 2005 David Abrahams and Aleksey Gurtovoy. 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_MSM_GRAMMAR_H
+#define BOOST_MSM_GRAMMAR_H
+
+
+
+namespace boost { namespace msm
+{
+// base grammar for all of msm's proto-based grammars
+struct basic_grammar : proto::_
+{};
+
+// Forward-declare an expression wrapper
+template<typename Expr>
+struct msm_terminal;
+
+struct msm_domain
+ : proto::domain< proto::generator<msm_terminal>, basic_grammar >
+{};
+
+template<typename Expr>
+struct msm_terminal
+ : proto::extends<Expr, msm_terminal<Expr>, msm_domain>
+{
+ typedef
+ proto::extends<Expr, msm_terminal<Expr>, msm_domain>
+ base_type;
+ // Needs a constructor
+ msm_terminal(Expr const &e = Expr())
+ : base_type(e)
+ {}
+};
+
+} } // boost::msm
+#endif //BOOST_MSM_GRAMMAR_H
+


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