]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | |
2 | #if !BOOST_PHOENIX_IS_ITERATING | |
3 | ||
4 | #ifndef BOOST_PHOENIX_STATEMENT_DETAIL_CATCH_PUSH_BACK_HPP | |
5 | #define BOOST_PHOENIX_STATEMENT_DETAIL_CATCH_PUSH_BACK_HPP | |
6 | ||
7 | #include <boost/phoenix/support/iterate.hpp> | |
8 | ||
9 | #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES) | |
10 | ||
11 | #include <boost/phoenix/statement/detail/preprocessed/catch_push_back.hpp> | |
12 | ||
13 | #else | |
14 | ||
15 | #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) | |
16 | #pragma wave option(preserve: 2, line: 0, output: "preprocessed/catch_push_back_" BOOST_PHOENIX_LIMIT_STR ".hpp") | |
17 | #endif | |
18 | ||
19 | /*============================================================================== | |
20 | Copyright (c) 2005-2010 Joel de Guzman | |
21 | Copyright (c) 2010 Thomas Heller | |
22 | ||
23 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
24 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
25 | ==============================================================================*/ | |
26 | ||
27 | #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) | |
28 | #pragma wave option(preserve: 1) | |
29 | #endif | |
30 | ||
31 | #define BOOST_PHOENIX_CATCH_PUSH_BACK_R0(Z, N, DATA) \ | |
32 | BOOST_PP_COMMA_IF(N) \ | |
33 | typename proto::result_of::child_c<TryCatch, N>::type \ | |
34 | /**/ | |
35 | ||
36 | #define BOOST_PHOENIX_CATCH_PUSH_BACK_R1(Z, N, DATA) \ | |
37 | BOOST_PP_COMMA_IF(N) proto::child_c<N>(try_catch) \ | |
38 | /**/ | |
39 | ||
40 | #define BOOST_PHOENIX_ITERATION_PARAMS \ | |
41 | (3, (2, BOOST_PHOENIX_CATCH_LIMIT, \ | |
42 | <boost/phoenix/statement/detail/catch_push_back.hpp>)) | |
43 | #include BOOST_PHOENIX_ITERATE() | |
44 | ||
45 | #undef BOOST_PHOENIX_CATCH_PUSH_BACK_R0 | |
46 | #undef BOOST_PHOENIX_CATCH_PUSH_BACK_R1 | |
47 | ||
48 | #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) | |
49 | #pragma wave option(output: null) | |
50 | #endif | |
51 | ||
52 | #endif // BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES | |
53 | ||
54 | #endif | |
55 | ||
56 | #else | |
57 | template <typename TryCatch, typename Exception, typename Capture, typename Expr> | |
58 | struct catch_push_back<TryCatch, Exception, Capture, Expr, BOOST_PHOENIX_ITERATION> | |
59 | { | |
60 | typedef | |
61 | typename proto::result_of::make_expr< | |
62 | phoenix::tag::catch_ | |
63 | , proto::basic_default_domain | |
64 | , catch_exception<Exception> | |
65 | , Capture | |
66 | , Expr | |
67 | >::type | |
68 | catch_expr; | |
69 | ||
70 | typedef phoenix::expression::try_catch< | |
71 | BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_CATCH_PUSH_BACK_R0, _) | |
72 | , catch_expr> gen_type; | |
73 | typedef typename gen_type::type type; | |
74 | ||
75 | static type | |
76 | make( | |
77 | TryCatch const& try_catch | |
78 | , Capture const& capture | |
79 | , Expr const& catch_ | |
80 | ) | |
81 | { | |
82 | return | |
83 | gen_type::make( | |
84 | BOOST_PP_REPEAT( | |
85 | BOOST_PHOENIX_ITERATION | |
86 | , BOOST_PHOENIX_CATCH_PUSH_BACK_R1 | |
87 | , _ | |
88 | ) | |
89 | , proto::make_expr< | |
90 | phoenix::tag::catch_ | |
91 | , proto::basic_default_domain | |
92 | >(catch_exception<Exception>(), capture, catch_) | |
93 | ); | |
94 | } | |
95 | }; | |
96 | ||
97 | template <typename TryCatch, typename Exception, typename Expr> | |
98 | struct catch_push_back<TryCatch, Exception, void, Expr, BOOST_PHOENIX_ITERATION> | |
99 | { | |
100 | typedef | |
101 | typename proto::result_of::make_expr< | |
102 | phoenix::tag::catch_ | |
103 | , proto::basic_default_domain | |
104 | , catch_exception<Exception> | |
105 | , Expr | |
106 | >::type | |
107 | catch_expr; | |
108 | ||
109 | typedef phoenix::expression::try_catch< | |
110 | BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_CATCH_PUSH_BACK_R0, _) | |
111 | , catch_expr> gen_type; | |
112 | typedef typename gen_type::type type; | |
113 | ||
114 | static type | |
115 | make( | |
116 | TryCatch const& try_catch | |
117 | , Expr const& catch_ | |
118 | ) | |
119 | { | |
120 | return | |
121 | gen_type::make( | |
122 | BOOST_PP_REPEAT( | |
123 | BOOST_PHOENIX_ITERATION | |
124 | , BOOST_PHOENIX_CATCH_PUSH_BACK_R1 | |
125 | , _ | |
126 | ) | |
127 | , proto::make_expr< | |
128 | phoenix::tag::catch_ | |
129 | , proto::basic_default_domain | |
130 | >(catch_exception<Exception>(), catch_) | |
131 | ); | |
132 | } | |
133 | }; | |
134 | ||
135 | template <typename TryCatch, typename Expr> | |
136 | struct catch_all_push_back<TryCatch, Expr, BOOST_PHOENIX_ITERATION> | |
137 | { | |
138 | typedef | |
139 | typename proto::result_of::make_expr< | |
140 | phoenix::tag::catch_all | |
141 | , proto::basic_default_domain | |
142 | , Expr | |
143 | >::type | |
144 | catch_expr; | |
145 | ||
146 | typedef phoenix::expression::try_catch< | |
147 | BOOST_PP_REPEAT(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_CATCH_PUSH_BACK_R0, _) | |
148 | , catch_expr> gen_type; | |
149 | typedef typename gen_type::type type; | |
150 | ||
151 | static type | |
152 | make( | |
153 | TryCatch const& try_catch | |
154 | , Expr const& catch_ | |
155 | ) | |
156 | { | |
157 | return | |
158 | gen_type::make( | |
159 | BOOST_PP_REPEAT( | |
160 | BOOST_PHOENIX_ITERATION | |
161 | , BOOST_PHOENIX_CATCH_PUSH_BACK_R1 | |
162 | , _ | |
163 | ) | |
164 | , proto::make_expr< | |
165 | phoenix::tag::catch_all | |
166 | , proto::basic_default_domain | |
167 | >(catch_) | |
168 | ); | |
169 | } | |
170 | }; | |
171 | ||
172 | #endif |