Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-16 09:21:27

0001 // Copyright 2008 Christophe Henry
0002 // henry UNDERSCORE christophe AT hotmail DOT com
0003 // This is an extended version of the state machine available in the boost::mpl library
0004 // Distributed under the same license as the original.
0005 // Copyright for the original version:
0006 // Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
0007 // under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 
0011 #ifndef BOOST_MSM_FRONT_EUML_GUARD_GRAMMAR_H
0012 #define BOOST_MSM_FRONT_EUML_GUARD_GRAMMAR_H
0013 
0014 #include <boost/msm/front/euml/common.hpp>
0015 #include <boost/msm/front/euml/operator.hpp>
0016 #include <boost/msm/front/euml/state_grammar.hpp>
0017 
0018 namespace boost { namespace msm { namespace front { namespace euml
0019 {
0020 struct BuildGuards;
0021 struct BuildActions;
0022 
0023 struct BuildGuardsCases
0024 {
0025     // The primary template matches nothing:
0026     template<typename Tag>
0027     struct case_
0028         : proto::not_<proto::_>
0029     {};
0030 };
0031 template<>
0032 struct BuildGuardsCases::case_<proto::tag::logical_or>
0033     : proto::when<
0034                     proto::logical_or<BuildGuards,BuildGuards >,
0035                     Or_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0036                 >
0037 {};
0038 template<>
0039 struct BuildGuardsCases::case_<proto::tag::logical_and>
0040     : proto::when<
0041                     proto::logical_and<BuildGuards,BuildGuards >,
0042                     And_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0043                 >
0044 {};
0045 template<>
0046 struct BuildGuardsCases::case_<proto::tag::logical_not>
0047     : proto::when<
0048                     proto::logical_not<BuildGuards >,
0049                     Not_<BuildGuards(proto::_child)>()
0050                 >
0051 {};
0052 template<>
0053 struct BuildGuardsCases::case_<proto::tag::less>
0054     : proto::when<
0055                     proto::less<BuildGuards, BuildGuards >,
0056                     Less_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0057                 >
0058 {};
0059 template<>
0060 struct BuildGuardsCases::case_<proto::tag::less_equal>
0061     : proto::when<
0062                     proto::less_equal<BuildGuards, BuildGuards >,
0063                     LessEqual_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0064                 >
0065 {};
0066 template<>
0067 struct BuildGuardsCases::case_<proto::tag::greater>
0068     : proto::when<
0069                     proto::greater<BuildGuards, BuildGuards >,
0070                     Greater_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0071                 >
0072 {};
0073 template<>
0074 struct BuildGuardsCases::case_<proto::tag::greater_equal>
0075     : proto::when<
0076                     proto::greater_equal<BuildGuards, BuildGuards >,
0077                     GreaterEqual_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0078                 >
0079 {};
0080 template<>
0081 struct BuildGuardsCases::case_<proto::tag::equal_to>
0082     : proto::when<
0083                         proto::equal_to<BuildGuards, BuildGuards >,
0084                         EqualTo_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0085                 >
0086 {};
0087 template<>
0088 struct BuildGuardsCases::case_<proto::tag::not_equal_to>
0089     : proto::when<
0090                         proto::not_equal_to<BuildGuards, BuildGuards >,
0091                         NotEqualTo_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0092                 >
0093 {};
0094 template<>
0095 struct BuildGuardsCases::case_<proto::tag::pre_inc>
0096     : proto::when<
0097                     proto::pre_inc<BuildGuards >,
0098                     Pre_inc_<BuildGuards(proto::_child)>()
0099                 >
0100 {};
0101 template<>
0102 struct BuildGuardsCases::case_<proto::tag::dereference>
0103     : proto::when<
0104                     proto::dereference<BuildGuards >,
0105                     Deref_<BuildGuards(proto::_child)>()
0106                 >
0107 {};
0108 template<>
0109 struct BuildGuardsCases::case_<proto::tag::pre_dec>
0110     : proto::when<
0111                     proto::pre_dec<BuildGuards >,
0112                     Pre_dec_<BuildGuards(proto::_child)>()
0113                 >
0114 {};
0115 template<>
0116 struct BuildGuardsCases::case_<proto::tag::post_inc>
0117     : proto::when<
0118                     proto::post_inc<BuildGuards >,
0119                     Post_inc_<BuildGuards(proto::_child)>()
0120                 >
0121 {};
0122 template<>
0123 struct BuildGuardsCases::case_<proto::tag::post_dec>
0124     : proto::when<
0125                     proto::post_dec<BuildGuards >,
0126                     Post_dec_<BuildGuards(proto::_child)>()
0127                 >
0128 {};
0129 template<>
0130 struct BuildGuardsCases::case_<proto::tag::plus>
0131     : proto::when<
0132                     proto::plus<BuildGuards,BuildGuards >,
0133                     Plus_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0134                 >
0135 {};
0136 template<>
0137 struct BuildGuardsCases::case_<proto::tag::minus>
0138     : proto::when<
0139                     proto::minus<BuildGuards,BuildGuards >,
0140                     Minus_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0141                 >
0142 {};
0143 template<>
0144 struct BuildGuardsCases::case_<proto::tag::multiplies>
0145     : proto::when<
0146                     proto::multiplies<BuildGuards,BuildGuards >,
0147                     Multiplies_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0148                 >
0149 {};
0150 template<>
0151 struct BuildGuardsCases::case_<proto::tag::divides>
0152     : proto::when<
0153                     proto::divides<BuildGuards,BuildGuards >,
0154                     Divides_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0155                 >
0156 {};
0157 template<>
0158 struct BuildGuardsCases::case_<proto::tag::modulus>
0159     : proto::when<
0160                     proto::modulus<BuildGuards,BuildGuards >,
0161                     Modulus_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0162                 >
0163 {};
0164 template<>
0165 struct BuildGuardsCases::case_<proto::tag::bitwise_and>
0166     : proto::when<
0167                     proto::bitwise_and<BuildGuards,BuildGuards >,
0168                     Bitwise_And_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0169                 >
0170 {};
0171 template<>
0172 struct BuildGuardsCases::case_<proto::tag::bitwise_or>
0173     : proto::when<
0174                     proto::bitwise_or<BuildGuards,BuildGuards >,
0175                     Bitwise_Or_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0176                 >
0177 {};
0178 template<>
0179 struct BuildGuardsCases::case_<proto::tag::subscript>
0180     : proto::when<
0181                     proto::subscript<BuildGuards,BuildGuards >,
0182                     Subscript_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0183                 >
0184 {};
0185 template<>
0186 struct BuildGuardsCases::case_<proto::tag::plus_assign>
0187     : proto::when<
0188                     proto::plus_assign<BuildGuards,BuildGuards >,
0189                     Plus_Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0190                 >
0191 {};
0192 template<>
0193 struct BuildGuardsCases::case_<proto::tag::minus_assign>
0194     : proto::when<
0195                     proto::minus_assign<BuildGuards,BuildGuards >,
0196                     Minus_Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0197                 >
0198 {};
0199 template<>
0200 struct BuildGuardsCases::case_<proto::tag::multiplies_assign>
0201     : proto::when<
0202                     proto::multiplies_assign<BuildGuards,BuildGuards >,
0203                     Multiplies_Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0204                 >
0205 {};
0206 template<>
0207 struct BuildGuardsCases::case_<proto::tag::divides_assign>
0208     : proto::when<
0209                     proto::divides_assign<BuildGuards,BuildGuards >,
0210                     Divides_Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0211                 >
0212 {};
0213 template<>
0214 struct BuildGuardsCases::case_<proto::tag::modulus_assign>
0215     : proto::when<
0216                     proto::modulus_assign<BuildGuards,BuildGuards >,
0217                     Modulus_Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0218                 >
0219 {};
0220 template<>
0221 struct BuildGuardsCases::case_<proto::tag::shift_left_assign>
0222     : proto::when<
0223                     proto::shift_left_assign<BuildGuards,BuildGuards >,
0224                     ShiftLeft_Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0225                 >
0226 {};
0227 template<>
0228 struct BuildGuardsCases::case_<proto::tag::shift_right_assign>
0229     : proto::when<
0230                     proto::shift_right_assign<BuildGuards,BuildGuards >,
0231                     ShiftRight_Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0232                 >
0233 {};
0234 template<>
0235 struct BuildGuardsCases::case_<proto::tag::shift_left>
0236     : proto::when<
0237                     proto::shift_left<BuildGuards,BuildGuards >,
0238                     ShiftLeft_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0239                 >
0240 {};
0241 template<>
0242 struct BuildGuardsCases::case_<proto::tag::shift_right>
0243     : proto::when<
0244                     proto::shift_right<BuildGuards,BuildGuards >,
0245                     ShiftRight_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0246                 >
0247 {};
0248 template<>
0249 struct BuildGuardsCases::case_<proto::tag::assign>
0250     : proto::when<
0251                     proto::assign<BuildGuards,BuildGuards >,
0252                     Assign_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0253                 >
0254 {};
0255 template<>
0256 struct BuildGuardsCases::case_<proto::tag::bitwise_xor>
0257     : proto::when<
0258                     proto::bitwise_xor<BuildGuards,BuildGuards >,
0259                     Bitwise_Xor_<BuildGuards(proto::_left),BuildGuards(proto::_right)>()
0260                 >
0261 {};
0262 template<>
0263 struct BuildGuardsCases::case_<proto::tag::negate>
0264     : proto::when<
0265                     proto::negate<BuildGuards >,
0266                     Unary_Minus_<BuildGuards(proto::_child)>()
0267                 >
0268 {};
0269 
0270 template<>
0271 struct BuildGuardsCases::case_<proto::tag::function>
0272     : proto::or_<
0273             proto::when<
0274                     proto::function<proto::terminal<if_tag>,BuildGuards,BuildGuards,BuildGuards >,
0275                     If_Else_<BuildGuards(proto::_child_c<1>),
0276                              BuildGuards(proto::_child_c<2>),
0277                              BuildGuards(proto::_child_c<3>) >()
0278                     >,
0279             proto::when<
0280                     proto::function<proto::terminal<proto::_> >,
0281                     get_fct<proto::_child_c<0> >()
0282                     >,
0283             proto::when<
0284                     proto::function<proto::terminal<proto::_>,BuildActions >,
0285                     get_fct<proto::_child_c<0>,BuildActions(proto::_child_c<1>) >()
0286                     >,
0287             proto::when<
0288                     proto::function<proto::terminal<proto::_>,BuildActions,BuildActions >,
0289                     get_fct<proto::_child_c<0>,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>) >()
0290                     >,
0291             proto::when<
0292                     proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions >,
0293                     get_fct<proto::_child_c<0>,BuildActions(proto::_child_c<1>)
0294                                               ,BuildActions(proto::_child_c<2>),BuildActions(proto::_child_c<3>) >()
0295                     >,
0296             proto::when<
0297                     proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions,BuildActions >,
0298                     get_fct<proto::_child_c<0>
0299                             ,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>)
0300                             ,BuildActions(proto::_child_c<3>),BuildActions(proto::_child_c<4>) >()
0301                     >,
0302             proto::when<
0303                     proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions,BuildActions,BuildActions  >,
0304                     get_fct<proto::_child_c<0>
0305                             ,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>)
0306                             ,BuildActions(proto::_child_c<3>),BuildActions(proto::_child_c<4>),BuildActions(proto::_child_c<5>) >()
0307                     >
0308 #ifdef BOOST_MSVC
0309             ,proto::when<
0310                     proto::function<proto::terminal<proto::_>,BuildActions,BuildActions,BuildActions,BuildActions,BuildActions,BuildActions >,
0311                     get_fct<proto::_child_c<0>
0312                             ,BuildActions(proto::_child_c<1>),BuildActions(proto::_child_c<2>)
0313                             ,BuildActions(proto::_child_c<3>),BuildActions(proto::_child_c<4>)
0314                             ,BuildActions(proto::_child_c<5>),BuildActions(proto::_child_c<6>) >()
0315                     >
0316 #endif
0317     >
0318 {};
0319 
0320 template<>
0321 struct BuildGuardsCases::case_<proto::tag::terminal>
0322     : proto::or_<
0323         proto::when <
0324             proto::terminal<action_tag>,
0325             get_action_name<proto::_ >()
0326             >,
0327         proto::when<
0328             proto::terminal<state_tag>,
0329             get_state_name<proto::_>()
0330             >,
0331         proto::when<
0332             proto::terminal<flag_tag>,
0333             proto::_
0334             >,
0335         proto::when<
0336             proto::terminal<event_tag>,
0337             proto::_
0338             >,
0339         proto::when<
0340             proto::terminal<fsm_artefact_tag>,
0341             get_fct<proto::_ >()
0342             >,
0343         proto::when<
0344             proto::terminal<proto::_>,
0345             proto::_value
0346             >
0347     >
0348 {};
0349 
0350 struct BuildGuards
0351     : proto::switch_<BuildGuardsCases>
0352 {};
0353 
0354 }}}}
0355 
0356 #endif //BOOST_MSM_FRONT_EUML_GUARD_GRAMMAR_H