]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES) | |
3 | #ifndef BOOST_PHOENIX_STATEMENT_DETAIL_TRY_CATCH_EVAL_HPP | |
4 | #define BOOST_PHOENIX_STATEMENT_DETAIL_TRY_CATCH_EVAL_HPP | |
5 | ||
6 | #include <boost/phoenix/support/iterate.hpp> | |
7 | ||
8 | #include <boost/phoenix/statement/detail/preprocessed/try_catch_eval.hpp> | |
9 | ||
10 | #endif | |
11 | #else | |
12 | ||
13 | #if !BOOST_PHOENIX_IS_ITERATING | |
14 | ||
15 | #ifndef BOOST_PHOENIX_STATEMENT_DETAIL_TRY_CATCH_EVAL_HPP | |
16 | #define BOOST_PHOENIX_STATEMENT_DETAIL_TRY_CATCH_EVAL_HPP | |
17 | ||
18 | #include <boost/phoenix/support/iterate.hpp> | |
19 | ||
20 | #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) | |
21 | #pragma wave option(preserve: 2, line: 0, output: "preprocessed/try_catch_eval_" BOOST_PHOENIX_LIMIT_STR ".hpp") | |
22 | #endif | |
23 | ||
24 | /*============================================================================== | |
25 | Copyright (c) 2005-2010 Joel de Guzman | |
26 | Copyright (c) 2010 Thomas Heller | |
27 | ||
28 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
29 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
30 | ==============================================================================*/ | |
31 | ||
32 | #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) | |
33 | #pragma wave option(preserve: 1) | |
34 | #endif | |
35 | ||
36 | #define BOOST_PHOENIX_TRY_CATCH_EVAL_R(Z, N, DATA) \ | |
37 | catch( \ | |
38 | typename proto::result_of::value< \ | |
39 | typename proto::result_of::child_c< \ | |
40 | BOOST_PP_CAT(A, N) \ | |
41 | , 0 \ | |
42 | >::type \ | |
43 | >::type::type &e \ | |
44 | ) \ | |
45 | { \ | |
46 | eval_catch_body(BOOST_PP_CAT(a, N), e, ctx); \ | |
47 | } \ | |
48 | /**/ | |
49 | ||
50 | ||
51 | #define BOOST_PHOENIX_ITERATION_PARAMS \ | |
52 | (3, (1, BOOST_PHOENIX_CATCH_LIMIT, \ | |
53 | <boost/phoenix/statement/detail/try_catch_eval.hpp>)) | |
54 | #include BOOST_PHOENIX_ITERATE() | |
55 | ||
56 | #undef BOOST_PHOENIX_TRY_CATCH_EVAL_R | |
57 | ||
58 | #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) | |
59 | #pragma wave option(output: null) | |
60 | #endif | |
61 | ||
62 | #endif | |
63 | ||
64 | #else | |
65 | ||
66 | template <typename Try, BOOST_PHOENIX_typename_A, typename Context> | |
67 | typename boost::enable_if< | |
68 | proto::matches< | |
69 | BOOST_PP_CAT(A, BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)) | |
70 | , rule::catch_ | |
71 | > | |
72 | , result_type | |
73 | >::type | |
74 | operator()(Try const & try_, BOOST_PHOENIX_A_const_ref_a, Context const & ctx | |
75 | BOOST_PHOENIX_SFINAE_AND_OVERLOADS) const | |
76 | { | |
77 | try | |
78 | { | |
79 | boost::phoenix::eval(proto::child_c<0>(try_), ctx); | |
80 | } | |
81 | BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_TRY_CATCH_EVAL_R, _) | |
82 | } | |
83 | ||
84 | template <typename Try, BOOST_PHOENIX_typename_A, typename Context> | |
85 | typename boost::disable_if< | |
86 | proto::matches< | |
87 | BOOST_PP_CAT(A, BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)) | |
88 | , rule::catch_ | |
89 | > | |
90 | , result_type | |
91 | >::type | |
92 | operator()(Try const & try_, BOOST_PHOENIX_A_const_ref_a, Context const & ctx) const | |
93 | { | |
94 | try | |
95 | { | |
96 | boost::phoenix::eval(proto::child_c<0>(try_), ctx); | |
97 | } | |
98 | BOOST_PP_REPEAT( | |
99 | BOOST_PP_DEC(BOOST_PHOENIX_ITERATION) | |
100 | , BOOST_PHOENIX_TRY_CATCH_EVAL_R, _ | |
101 | ) | |
102 | catch(...) | |
103 | { | |
104 | boost::phoenix::eval( | |
105 | proto::child_c<0>( | |
106 | BOOST_PP_CAT(a, BOOST_PP_DEC(BOOST_PHOENIX_ITERATION)) | |
107 | ) | |
108 | , ctx); | |
109 | } | |
110 | } | |
111 | ||
112 | #endif | |
113 | ||
114 | #endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES |