annotate DEPENDENCIES/generic/include/boost/phoenix/scope/lambda.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 #ifndef BOOST_PHOENIX_SCOPE_LAMBDA_HPP
Chris@16 2 #define BOOST_PHOENIX_SCOPE_LAMBDA_HPP
Chris@16 3
Chris@16 4 #include <boost/phoenix/core/limits.hpp>
Chris@16 5 #include <boost/fusion/include/transform.hpp>
Chris@16 6 #include <boost/fusion/include/as_vector.hpp>
Chris@16 7 #include <boost/mpl/int.hpp>
Chris@16 8 #include <boost/phoenix/core/call.hpp>
Chris@16 9 #include <boost/phoenix/core/expression.hpp>
Chris@16 10 #include <boost/phoenix/core/meta_grammar.hpp>
Chris@16 11 #include <boost/phoenix/scope/local_variable.hpp>
Chris@16 12 #include <boost/phoenix/scope/scoped_environment.hpp>
Chris@16 13
Chris@16 14 #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
Chris@16 15
Chris@16 16 #include <boost/phoenix/scope/preprocessed/lambda.hpp>
Chris@16 17
Chris@16 18 #else
Chris@16 19
Chris@16 20 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
Chris@16 21 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/lambda_" BOOST_PHOENIX_LIMIT_STR ".hpp")
Chris@16 22 #endif
Chris@16 23 /*==============================================================================
Chris@16 24 Copyright (c) 2001-2010 Joel de Guzman
Chris@16 25 Copyright (c) 2004 Daniel Wallin
Chris@16 26 Copyright (c) 2010 Thomas Heller
Chris@16 27
Chris@16 28 Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 29 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 30 ==============================================================================*/
Chris@16 31 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
Chris@16 32 #pragma wave option(preserve: 1)
Chris@16 33 #endif
Chris@16 34
Chris@16 35 BOOST_PHOENIX_DEFINE_EXPRESSION(
Chris@16 36 (boost)(phoenix)(lambda_actor)
Chris@16 37 , (proto::terminal<proto::_>) // Locals
Chris@16 38 (proto::terminal<proto::_>) // Map
Chris@16 39 (meta_grammar) // Lambda
Chris@16 40 )
Chris@16 41
Chris@16 42 BOOST_PHOENIX_DEFINE_EXPRESSION(
Chris@16 43 (boost)(phoenix)(lambda)
Chris@16 44 , (proto::terminal<proto::_>) // OuterEnv
Chris@16 45 (proto::terminal<proto::_>) // Locals
Chris@16 46 (proto::terminal<proto::_>) // Map
Chris@16 47 (meta_grammar) // Lambda
Chris@16 48 )
Chris@16 49
Chris@16 50 namespace boost { namespace phoenix
Chris@16 51 {
Chris@16 52 struct lambda_eval
Chris@16 53 {
Chris@16 54 BOOST_PROTO_CALLABLE()
Chris@16 55
Chris@16 56 template <typename Sig>
Chris@16 57 struct result;
Chris@16 58
Chris@16 59 template <
Chris@16 60 typename This
Chris@16 61 , typename OuterEnv
Chris@16 62 , typename Locals
Chris@16 63 , typename Map
Chris@16 64 , typename Lambda
Chris@16 65 , typename Context
Chris@16 66 >
Chris@16 67 struct result<This(OuterEnv, Locals, Map, Lambda, Context)>
Chris@16 68 {
Chris@16 69 typedef
Chris@16 70 typename proto::detail::uncvref<
Chris@16 71 typename proto::result_of::value<
Chris@16 72 OuterEnv
Chris@16 73 >::type
Chris@16 74 >::type
Chris@16 75 outer_env_type;
Chris@16 76
Chris@16 77 typedef
Chris@16 78 typename proto::detail::uncvref<
Chris@16 79 typename proto::result_of::value<
Chris@16 80 Locals
Chris@16 81 >::type
Chris@16 82 >::type
Chris@16 83 locals_type;
Chris@16 84
Chris@16 85 typedef
Chris@16 86 typename proto::detail::uncvref<
Chris@16 87 typename proto::result_of::value<
Chris@16 88 Map
Chris@16 89 >::type
Chris@16 90 >::type
Chris@16 91 map_type;
Chris@16 92
Chris@16 93 typedef
Chris@16 94 typename proto::detail::uncvref<
Chris@16 95 typename result_of::env<Context>::type
Chris@16 96 >::type
Chris@16 97 env_type;
Chris@16 98
Chris@101 99 typedef
Chris@101 100 typename result_of::eval<
Chris@101 101 Lambda
Chris@101 102 , typename result_of::context<
Chris@101 103 scoped_environment<
Chris@101 104 env_type
Chris@101 105 , outer_env_type
Chris@101 106 , locals_type
Chris@101 107 , map_type
Chris@101 108 >
Chris@101 109 , typename result_of::actions<
Chris@101 110 Context
Chris@101 111 >::type
Chris@101 112 >::type
Chris@101 113 >::type
Chris@101 114 type;
Chris@16 115 };
Chris@16 116
Chris@16 117 template <typename OuterEnv, typename Locals, typename Map, typename Lambda, typename Context>
Chris@16 118 typename result<lambda_eval(OuterEnv const &, Locals const &, Map const &, Lambda const &, Context const &)>::type
Chris@16 119 operator()(OuterEnv const & outer_env, Locals const & locals, Map const &, Lambda const & lambda, Context const & ctx) const
Chris@16 120 {
Chris@16 121 typedef
Chris@16 122 typename proto::detail::uncvref<
Chris@16 123 typename proto::result_of::value<
Chris@16 124 OuterEnv
Chris@16 125 >::type
Chris@16 126 >::type
Chris@16 127 outer_env_type;
Chris@16 128
Chris@16 129 typedef
Chris@16 130 typename proto::detail::uncvref<
Chris@16 131 typename proto::result_of::value<
Chris@16 132 Locals
Chris@16 133 >::type
Chris@16 134 >::type
Chris@16 135 locals_type;
Chris@16 136
Chris@16 137 typedef
Chris@16 138 typename proto::detail::uncvref<
Chris@16 139 typename proto::result_of::value<
Chris@16 140 Map
Chris@16 141 >::type
Chris@16 142 >::type
Chris@16 143 map_type;
Chris@16 144
Chris@16 145 typedef
Chris@16 146 typename proto::detail::uncvref<
Chris@16 147 typename result_of::env<Context>::type
Chris@16 148 >::type
Chris@16 149 env_type;
Chris@16 150
Chris@101 151 scoped_environment<
Chris@16 152 env_type
Chris@16 153 , outer_env_type
Chris@16 154 , locals_type
Chris@16 155 , map_type
Chris@16 156 >
Chris@16 157 env(phoenix::env(ctx), proto::value(outer_env), proto::value(locals));
Chris@16 158
Chris@16 159 return eval(lambda, phoenix::context(env, phoenix::actions(ctx)));
Chris@16 160 }
Chris@16 161 };
Chris@16 162
Chris@16 163 template <typename Dummy>
Chris@16 164 struct default_actions::when<rule::lambda, Dummy>
Chris@16 165 : call<lambda_eval, Dummy>
Chris@16 166 {};
Chris@16 167
Chris@16 168 template <typename Dummy>
Chris@16 169 struct is_nullary::when<rule::lambda, Dummy>
Chris@16 170 : proto::call<
Chris@16 171 evaluator(
Chris@16 172 proto::_child_c<3>
Chris@16 173 , proto::call<
Chris@16 174 functional::context(
Chris@16 175 proto::make<
Chris@16 176 mpl::true_()
Chris@16 177 >
Chris@16 178 , proto::make<
Chris@16 179 detail::scope_is_nullary_actions()
Chris@16 180 >
Chris@16 181 )
Chris@16 182 >
Chris@16 183 , proto::make<
Chris@16 184 proto::empty_env()
Chris@16 185 >
Chris@16 186 )
Chris@16 187 >
Chris@16 188 {};
Chris@16 189
Chris@16 190 template <typename Dummy>
Chris@16 191 struct is_nullary::when<rule::lambda_actor, Dummy>
Chris@16 192 : proto::or_<
Chris@16 193 proto::when<
Chris@16 194 expression::lambda_actor<
Chris@16 195 proto::terminal<vector0<> >
Chris@16 196 , proto::terminal<proto::_>
Chris@16 197 , meta_grammar
Chris@16 198 >
Chris@16 199 , mpl::true_()
Chris@16 200 >
Chris@16 201 , proto::when<
Chris@16 202 expression::lambda_actor<
Chris@16 203 proto::terminal<proto::_>
Chris@16 204 , proto::terminal<proto::_>
Chris@16 205 , meta_grammar
Chris@16 206 >
Chris@16 207 , proto::fold<
Chris@16 208 proto::call<proto::_value(proto::_child_c<0>)>
Chris@16 209 , proto::make<mpl::true_()>
Chris@16 210 , proto::make<
Chris@16 211 mpl::and_<
Chris@16 212 proto::_state
Chris@16 213 , proto::call<
Chris@16 214 evaluator(
Chris@16 215 proto::_
Chris@16 216 , _context
Chris@16 217 , proto::make<proto::empty_env()>
Chris@16 218 )
Chris@16 219 >
Chris@16 220 >()
Chris@16 221 >
Chris@16 222 >
Chris@16 223 >
Chris@16 224 >
Chris@16 225 {};
Chris@16 226
Chris@16 227 struct lambda_actor_eval
Chris@16 228 {
Chris@16 229 template <typename Sig>
Chris@16 230 struct result;
Chris@16 231
Chris@16 232 template <typename This, typename Vars, typename Map, typename Lambda, typename Context>
Chris@16 233 struct result<This(Vars, Map, Lambda, Context)>
Chris@16 234 {
Chris@16 235 typedef
Chris@16 236 typename proto::detail::uncvref<
Chris@16 237 typename result_of::env<Context>::type
Chris@16 238 >::type
Chris@16 239 env_type;
Chris@16 240 typedef
Chris@16 241 typename proto::detail::uncvref<
Chris@16 242 typename result_of::actions<Context>::type
Chris@16 243 >::type
Chris@16 244 actions_type;
Chris@16 245 typedef
Chris@16 246 typename proto::detail::uncvref<
Chris@16 247 typename proto::result_of::value<Vars>::type
Chris@16 248 >::type
Chris@16 249 vars_type;
Chris@16 250
Chris@101 251 typedef typename
Chris@16 252 detail::result_of::initialize_locals<
Chris@16 253 vars_type
Chris@16 254 , Context
Chris@16 255 >::type
Chris@16 256 locals_type;
Chris@16 257
Chris@16 258 typedef
Chris@16 259 typename expression::lambda<
Chris@16 260 env_type
Chris@16 261 , locals_type
Chris@16 262 , Map
Chris@16 263 , Lambda
Chris@16 264 >::type const
Chris@16 265 type;
Chris@16 266 };
Chris@16 267
Chris@16 268 template <
Chris@16 269 typename Vars
Chris@16 270 , typename Map
Chris@16 271 , typename Lambda
Chris@16 272 , typename Context
Chris@16 273 >
Chris@16 274 typename result<
Chris@16 275 lambda_actor_eval(Vars const&, Map const &, Lambda const&, Context const &)
Chris@16 276 >::type const
Chris@16 277 operator()(Vars const& vars, Map const& map, Lambda const& lambda, Context const & ctx) const
Chris@16 278 {
Chris@16 279 typedef
Chris@16 280 typename proto::detail::uncvref<
Chris@16 281 typename result_of::env<Context>::type
Chris@16 282 >::type
Chris@16 283 env_type;
Chris@101 284 /*typedef
Chris@16 285 typename proto::detail::uncvref<
Chris@16 286 typename result_of::actions<Context>::type
Chris@16 287 >::type
Chris@101 288 actions_type;*/
Chris@16 289 typedef
Chris@16 290 typename proto::detail::uncvref<
Chris@16 291 typename proto::result_of::value<Vars>::type
Chris@16 292 >::type
Chris@16 293 vars_type;
Chris@101 294 /*typedef
Chris@16 295 typename proto::detail::uncvref<
Chris@16 296 typename proto::result_of::value<Map>::type
Chris@16 297 >::type
Chris@101 298 map_type;*/
Chris@101 299
Chris@101 300 typedef typename
Chris@16 301 detail::result_of::initialize_locals<
Chris@16 302 vars_type
Chris@16 303 , Context
Chris@16 304 >::type
Chris@16 305 locals_type;
Chris@16 306
Chris@16 307 locals_type locals = initialize_locals(proto::value(vars), ctx);
Chris@16 308
Chris@16 309 return
Chris@16 310 expression::
Chris@16 311 lambda<env_type, locals_type, Map, Lambda>::
Chris@16 312 make(phoenix::env(ctx), locals, map, lambda);
Chris@16 313 }
Chris@16 314 };
Chris@16 315
Chris@16 316 template <typename Dummy>
Chris@16 317 struct default_actions::when<rule::lambda_actor, Dummy>
Chris@16 318 : call<lambda_actor_eval, Dummy>
Chris@16 319 {};
Chris@16 320
Chris@16 321 template <typename Locals = void, typename Map = void, typename Dummy = void>
Chris@16 322 struct lambda_actor_gen;
Chris@16 323
Chris@16 324 template <>
Chris@16 325 struct lambda_actor_gen<void, void, void>
Chris@16 326 {
Chris@16 327 template <typename Expr>
Chris@16 328 typename expression::lambda_actor<vector0<>, detail::map_local_index_to_tuple<>, Expr>::type const
Chris@16 329 operator[](Expr const & expr) const
Chris@16 330 {
Chris@16 331 typedef vector0<> locals_type;
Chris@16 332 typedef detail::map_local_index_to_tuple<> map_type;
Chris@16 333 return expression::lambda_actor<locals_type, map_type, Expr>::make(locals_type(), map_type(), expr);
Chris@16 334 }
Chris@16 335 };
Chris@16 336
Chris@16 337 template <typename Locals, typename Map>
Chris@16 338 struct lambda_actor_gen<Locals, Map>
Chris@16 339 {
Chris@101 340 lambda_actor_gen(Locals const & locals_)
Chris@101 341 : locals(locals_)
Chris@16 342 {}
Chris@16 343
Chris@16 344 lambda_actor_gen(lambda_actor_gen const & o)
Chris@16 345 : locals(o.locals)
Chris@16 346 {};
Chris@16 347
Chris@16 348 template <typename Expr>
Chris@16 349 typename expression::lambda_actor<
Chris@16 350 Locals
Chris@16 351 , Map
Chris@16 352 , Expr
Chris@16 353 >::type const
Chris@16 354 operator[](Expr const & expr) const
Chris@16 355 {
Chris@16 356 return expression::lambda_actor<Locals, Map, Expr>::make(locals, Map(), expr);
Chris@16 357 }
Chris@16 358
Chris@16 359 Locals locals;
Chris@16 360 };
Chris@16 361
Chris@16 362 struct lambda_local_gen
Chris@16 363 : lambda_actor_gen<>
Chris@16 364 {
Chris@16 365 lambda_actor_gen<> const
Chris@16 366 operator()() const
Chris@16 367 {
Chris@16 368 return lambda_actor_gen<>();
Chris@16 369 }
Chris@16 370
Chris@16 371 #define BOOST_PHOENIX_SCOPE_ACTOR_GEN_NAME lambda_actor_gen
Chris@16 372 #define BOOST_PHOENIX_SCOPE_ACTOR_GEN_FUNCTION operator()
Chris@16 373 #define BOOST_PHOENIX_SCOPE_ACTOR_GEN_CONST const
Chris@16 374 #include <boost/phoenix/scope/detail/local_gen.hpp>
Chris@16 375 #undef BOOST_PHOENIX_SCOPE_ACTOR_GEN_NAME
Chris@16 376 #undef BOOST_PHOENIX_SCOPE_ACTOR_GEN_FUNCTION
Chris@16 377 #undef BOOST_PHOENIX_SCOPE_ACTOR_GEN_CONST
Chris@16 378
Chris@16 379
Chris@16 380 };
Chris@16 381
Chris@16 382 typedef lambda_local_gen lambda_type;
Chris@16 383 lambda_local_gen const lambda = lambda_local_gen();
Chris@16 384
Chris@16 385 }}
Chris@16 386
Chris@16 387 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
Chris@16 388 #pragma wave option(output: null)
Chris@16 389 #endif
Chris@16 390
Chris@16 391 #endif
Chris@16 392
Chris@16 393 #endif