wurlinc-rice 1.4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +23 -0
- data/Doxyfile +1253 -0
- data/Makefile.am +26 -0
- data/README +1119 -0
- data/README.mingw +8 -0
- data/Rakefile +33 -0
- data/bootstrap +9 -0
- data/configure.ac +52 -0
- data/doxygen.ac +314 -0
- data/doxygen.am +186 -0
- data/extconf.rb +41 -0
- data/post-autoconf.rb +22 -0
- data/post-automake.rb +28 -0
- data/rice/Address_Registration_Guard.hpp +7 -0
- data/rice/Address_Registration_Guard.ipp +34 -0
- data/rice/Address_Registration_Guard_defn.hpp +65 -0
- data/rice/Allocation_Strategies.hpp +37 -0
- data/rice/Arg.hpp +8 -0
- data/rice/Arg_impl.hpp +127 -0
- data/rice/Arg_operators.cpp +21 -0
- data/rice/Arg_operators.hpp +19 -0
- data/rice/Array.hpp +220 -0
- data/rice/Array.ipp +263 -0
- data/rice/Builtin_Object.hpp +8 -0
- data/rice/Builtin_Object.ipp +50 -0
- data/rice/Builtin_Object_defn.hpp +51 -0
- data/rice/Class.cpp +57 -0
- data/rice/Class.hpp +8 -0
- data/rice/Class.ipp +6 -0
- data/rice/Class_defn.hpp +83 -0
- data/rice/Constructor.hpp +367 -0
- data/rice/Critical_Guard.hpp +40 -0
- data/rice/Critical_Guard.ipp +26 -0
- data/rice/Data_Object.hpp +8 -0
- data/rice/Data_Object.ipp +133 -0
- data/rice/Data_Object_defn.hpp +132 -0
- data/rice/Data_Type.cpp +54 -0
- data/rice/Data_Type.hpp +8 -0
- data/rice/Data_Type.ipp +365 -0
- data/rice/Data_Type_defn.hpp +261 -0
- data/rice/Data_Type_fwd.hpp +12 -0
- data/rice/Director.cpp +13 -0
- data/rice/Director.hpp +39 -0
- data/rice/Enum.hpp +117 -0
- data/rice/Enum.ipp +246 -0
- data/rice/Exception.cpp +59 -0
- data/rice/Exception.hpp +9 -0
- data/rice/Exception_Base.hpp +8 -0
- data/rice/Exception_Base.ipp +13 -0
- data/rice/Exception_Base_defn.hpp +27 -0
- data/rice/Exception_defn.hpp +69 -0
- data/rice/Hash.hpp +210 -0
- data/rice/Hash.ipp +338 -0
- data/rice/Identifier.cpp +8 -0
- data/rice/Identifier.hpp +50 -0
- data/rice/Identifier.ipp +33 -0
- data/rice/Jump_Tag.hpp +24 -0
- data/rice/Makefile.am +129 -0
- data/rice/Module.cpp +84 -0
- data/rice/Module.hpp +8 -0
- data/rice/Module.ipp +6 -0
- data/rice/Module_defn.hpp +88 -0
- data/rice/Module_impl.hpp +281 -0
- data/rice/Module_impl.ipp +348 -0
- data/rice/Object.cpp +160 -0
- data/rice/Object.hpp +8 -0
- data/rice/Object.ipp +19 -0
- data/rice/Object_defn.hpp +191 -0
- data/rice/Require_Guard.hpp +21 -0
- data/rice/String.cpp +94 -0
- data/rice/String.hpp +89 -0
- data/rice/Struct.cpp +117 -0
- data/rice/Struct.hpp +162 -0
- data/rice/Struct.ipp +26 -0
- data/rice/Symbol.cpp +25 -0
- data/rice/Symbol.hpp +66 -0
- data/rice/Symbol.ipp +44 -0
- data/rice/VM.cpp +92 -0
- data/rice/VM.hpp +32 -0
- data/rice/config.hpp.in +40 -0
- data/rice/detail/Arguments.hpp +118 -0
- data/rice/detail/Auto_Function_Wrapper.hpp +829 -0
- data/rice/detail/Auto_Function_Wrapper.ipp +3391 -0
- data/rice/detail/Auto_Member_Function_Wrapper.hpp +828 -0
- data/rice/detail/Auto_Member_Function_Wrapper.ipp +2503 -0
- data/rice/detail/Caster.hpp +103 -0
- data/rice/detail/Exception_Handler.hpp +8 -0
- data/rice/detail/Exception_Handler.ipp +68 -0
- data/rice/detail/Exception_Handler_defn.hpp +96 -0
- data/rice/detail/Iterator.hpp +93 -0
- data/rice/detail/Not_Copyable.hpp +25 -0
- data/rice/detail/Wrapped_Function.hpp +33 -0
- data/rice/detail/cfp.hpp +24 -0
- data/rice/detail/cfp.ipp +51 -0
- data/rice/detail/check_ruby_type.cpp +27 -0
- data/rice/detail/check_ruby_type.hpp +23 -0
- data/rice/detail/creation_funcs.hpp +37 -0
- data/rice/detail/creation_funcs.ipp +36 -0
- data/rice/detail/default_allocation_func.hpp +23 -0
- data/rice/detail/default_allocation_func.ipp +11 -0
- data/rice/detail/define_method_and_auto_wrap.hpp +31 -0
- data/rice/detail/define_method_and_auto_wrap.ipp +30 -0
- data/rice/detail/demangle.cpp +56 -0
- data/rice/detail/demangle.hpp +19 -0
- data/rice/detail/env.hpp +19 -0
- data/rice/detail/from_ruby.hpp +43 -0
- data/rice/detail/from_ruby.ipp +60 -0
- data/rice/detail/method_data.cpp +159 -0
- data/rice/detail/method_data.hpp +21 -0
- data/rice/detail/mininode.cpp +1220 -0
- data/rice/detail/mininode.hpp +320 -0
- data/rice/detail/node.hpp +13 -0
- data/rice/detail/object_call.hpp +68 -0
- data/rice/detail/object_call.ipp +131 -0
- data/rice/detail/protect.cpp +29 -0
- data/rice/detail/protect.hpp +34 -0
- data/rice/detail/ruby.hpp +93 -0
- data/rice/detail/ruby_version_code.hpp.in +6 -0
- data/rice/detail/rubysig.hpp +19 -0
- data/rice/detail/st.hpp +60 -0
- data/rice/detail/to_ruby.hpp +22 -0
- data/rice/detail/to_ruby.ipp +36 -0
- data/rice/detail/traits.hpp +43 -0
- data/rice/detail/win32.hpp +16 -0
- data/rice/detail/wrap_function.hpp +341 -0
- data/rice/detail/wrap_function.ipp +514 -0
- data/rice/global_function.hpp +33 -0
- data/rice/global_function.ipp +22 -0
- data/rice/protect.hpp +91 -0
- data/rice/protect.ipp +1133 -0
- data/rice/ruby_mark.hpp +13 -0
- data/rice/ruby_try_catch.hpp +86 -0
- data/rice/rubypp.rb +97 -0
- data/rice/to_from_ruby.hpp +8 -0
- data/rice/to_from_ruby.ipp +297 -0
- data/rice/to_from_ruby_defn.hpp +71 -0
- data/ruby/Makefile.am +1 -0
- data/ruby/lib/Makefile.am +3 -0
- data/ruby/lib/mkmf-rice.rb.in +216 -0
- data/ruby/lib/version.rb +3 -0
- data/ruby.ac +136 -0
- data/sample/Makefile.am +47 -0
- data/sample/enum/extconf.rb +3 -0
- data/sample/enum/sample_enum.cpp +54 -0
- data/sample/enum/test.rb +8 -0
- data/sample/inheritance/animals.cpp +98 -0
- data/sample/inheritance/extconf.rb +3 -0
- data/sample/inheritance/test.rb +7 -0
- data/sample/map/extconf.rb +3 -0
- data/sample/map/map.cpp +81 -0
- data/sample/map/test.rb +7 -0
- data/test/Makefile.am +78 -0
- data/test/ext/Makefile.am +43 -0
- data/test/ext/t1/Foo.hpp +10 -0
- data/test/ext/t1/extconf.rb +2 -0
- data/test/ext/t1/t1.cpp +15 -0
- data/test/ext/t2/extconf.rb +2 -0
- data/test/ext/t2/t2.cpp +11 -0
- data/test/test_Address_Registration_Guard.cpp +43 -0
- data/test/test_Allocation_Strategies.cpp +77 -0
- data/test/test_Array.cpp +241 -0
- data/test/test_Builtin_Object.cpp +72 -0
- data/test/test_Class.cpp +498 -0
- data/test/test_Constructor.cpp +128 -0
- data/test/test_Critical_Guard.cpp +51 -0
- data/test/test_Data_Object.cpp +275 -0
- data/test/test_Data_Type.cpp +348 -0
- data/test/test_Director.cpp +301 -0
- data/test/test_Enum.cpp +195 -0
- data/test/test_Exception.cpp +46 -0
- data/test/test_Hash.cpp +195 -0
- data/test/test_Identifier.cpp +70 -0
- data/test/test_Jump_Tag.cpp +17 -0
- data/test/test_Memory_Management.cpp +50 -0
- data/test/test_Module.cpp +481 -0
- data/test/test_Object.cpp +148 -0
- data/test/test_String.cpp +94 -0
- data/test/test_Struct.cpp +192 -0
- data/test/test_Symbol.cpp +63 -0
- data/test/test_To_From_Ruby.cpp +263 -0
- data/test/test_VM.cpp +26 -0
- data/test/test_global_functions.cpp +114 -0
- data/test/test_rice.rb +43 -0
- data/test/unittest.cpp +136 -0
- data/test/unittest.hpp +292 -0
- metadata +276 -0
data/rice/protect.ipp
ADDED
@@ -0,0 +1,1133 @@
|
|
1
|
+
#ifndef Rice__protect__ipp_
|
2
|
+
#define Rice__protect__ipp_
|
3
|
+
|
4
|
+
// This is a generated file. DO NOT EDIT!!
|
5
|
+
|
6
|
+
|
7
|
+
// This causes problems with certain C++ libraries
|
8
|
+
#undef TYPE
|
9
|
+
|
10
|
+
#include "detail/protect.hpp"
|
11
|
+
namespace Rice
|
12
|
+
{
|
13
|
+
|
14
|
+
namespace detail
|
15
|
+
{
|
16
|
+
|
17
|
+
template<typename Ret_T, typename Fun>
|
18
|
+
class Ruby_Function_0
|
19
|
+
{
|
20
|
+
public:
|
21
|
+
Ruby_Function_0(Fun f);
|
22
|
+
inline void operator()();
|
23
|
+
static inline VALUE call(Ruby_Function_0 * f);
|
24
|
+
Ret_T const & result() const { return result_; }
|
25
|
+
|
26
|
+
private:
|
27
|
+
Fun f_;
|
28
|
+
|
29
|
+
Ret_T result_; // TODO: use placement new
|
30
|
+
};
|
31
|
+
|
32
|
+
template<typename Ret_T, typename Fun>
|
33
|
+
inline Ruby_Function_0<Ret_T, Fun>::
|
34
|
+
Ruby_Function_0(Fun f)
|
35
|
+
: f_(f)
|
36
|
+
{ }
|
37
|
+
|
38
|
+
template<typename Ret_T, typename Fun>
|
39
|
+
inline void Ruby_Function_0<Ret_T, Fun>::
|
40
|
+
operator()()
|
41
|
+
{
|
42
|
+
result_ = f_();
|
43
|
+
}
|
44
|
+
|
45
|
+
template<typename Ret_T, typename Fun>
|
46
|
+
inline VALUE Ruby_Function_0<Ret_T, Fun>::
|
47
|
+
call(Ruby_Function_0 * f)
|
48
|
+
{
|
49
|
+
(*f)();
|
50
|
+
return Qnil;
|
51
|
+
}
|
52
|
+
|
53
|
+
} // namespace detail
|
54
|
+
|
55
|
+
template<typename Ret_T, typename Fun>
|
56
|
+
inline Ret_T protect(Fun fun)
|
57
|
+
{
|
58
|
+
typedef detail::Ruby_Function_0<Ret_T, Fun> RF;
|
59
|
+
RF f(fun);
|
60
|
+
detail::protect(
|
61
|
+
RUBY_VALUE_FUNC(RF::call),
|
62
|
+
reinterpret_cast<VALUE>(&f));
|
63
|
+
return f.result();
|
64
|
+
}
|
65
|
+
|
66
|
+
template<typename Fun>
|
67
|
+
inline VALUE protect(Fun fun)
|
68
|
+
{
|
69
|
+
typedef detail::Ruby_Function_0<VALUE, Fun> RF;
|
70
|
+
RF f(fun);
|
71
|
+
detail::protect(
|
72
|
+
RUBY_VALUE_FUNC(RF::call),
|
73
|
+
reinterpret_cast<VALUE>(&f));
|
74
|
+
return f.result();
|
75
|
+
}
|
76
|
+
|
77
|
+
// ---------------------------------------------------------------------
|
78
|
+
|
79
|
+
namespace detail
|
80
|
+
{
|
81
|
+
|
82
|
+
template<typename Ret_T, typename Fun, typename T0>
|
83
|
+
class Ruby_Function_1
|
84
|
+
{
|
85
|
+
public:
|
86
|
+
Ruby_Function_1(Fun f, T0 const & t0);
|
87
|
+
inline void operator()();
|
88
|
+
static inline VALUE call(Ruby_Function_1 * f);
|
89
|
+
Ret_T const & result() const { return result_; }
|
90
|
+
|
91
|
+
private:
|
92
|
+
Fun f_;
|
93
|
+
T0 const & t0_;
|
94
|
+
Ret_T result_; // TODO: use placement new
|
95
|
+
};
|
96
|
+
|
97
|
+
template<typename Ret_T, typename Fun, typename T0>
|
98
|
+
inline Ruby_Function_1<Ret_T, Fun, T0>::
|
99
|
+
Ruby_Function_1(Fun f, T0 const & t0)
|
100
|
+
: f_(f), t0_(t0)
|
101
|
+
{ }
|
102
|
+
|
103
|
+
template<typename Ret_T, typename Fun, typename T0>
|
104
|
+
inline void Ruby_Function_1<Ret_T, Fun, T0>::
|
105
|
+
operator()()
|
106
|
+
{
|
107
|
+
result_ = f_(t0_);
|
108
|
+
}
|
109
|
+
|
110
|
+
template<typename Ret_T, typename Fun, typename T0>
|
111
|
+
inline VALUE Ruby_Function_1<Ret_T, Fun, T0>::
|
112
|
+
call(Ruby_Function_1 * f)
|
113
|
+
{
|
114
|
+
(*f)();
|
115
|
+
return Qnil;
|
116
|
+
}
|
117
|
+
|
118
|
+
} // namespace detail
|
119
|
+
|
120
|
+
/**
|
121
|
+
* protect on a function with a return type
|
122
|
+
*/
|
123
|
+
template<typename Ret_T, typename Fun, typename T0>
|
124
|
+
inline Ret_T protect(Fun fun, T0 const & t0)
|
125
|
+
{
|
126
|
+
typedef detail::Ruby_Function_1<Ret_T, Fun, T0> RF;
|
127
|
+
RF f(fun, t0);
|
128
|
+
detail::protect(
|
129
|
+
RUBY_VALUE_FUNC(RF::call),
|
130
|
+
reinterpret_cast<VALUE>(&f));
|
131
|
+
return f.result();
|
132
|
+
}
|
133
|
+
|
134
|
+
/**
|
135
|
+
* protect on a function with VALUE return type
|
136
|
+
*/
|
137
|
+
template<typename Fun, typename T0>
|
138
|
+
inline VALUE protect(Fun fun, T0 const & t0)
|
139
|
+
{
|
140
|
+
typedef detail::Ruby_Function_1<VALUE, Fun, T0> RF;
|
141
|
+
RF f(fun, t0);
|
142
|
+
detail::protect(
|
143
|
+
RUBY_VALUE_FUNC(RF::call),
|
144
|
+
reinterpret_cast<VALUE>(&f));
|
145
|
+
return f.result();
|
146
|
+
}
|
147
|
+
|
148
|
+
// ---------------------------------------------------------------------
|
149
|
+
namespace detail
|
150
|
+
{
|
151
|
+
|
152
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1>
|
153
|
+
class Ruby_Function_2
|
154
|
+
{
|
155
|
+
public:
|
156
|
+
Ruby_Function_2(Fun f, T0 const & t0, T1 const & t1);
|
157
|
+
inline void operator()();
|
158
|
+
static inline VALUE call(Ruby_Function_2 * f);
|
159
|
+
Ret_T const & result() const { return result_; }
|
160
|
+
|
161
|
+
private:
|
162
|
+
Fun f_;
|
163
|
+
T0 const & t0_; T1 const & t1_;
|
164
|
+
Ret_T result_; // TODO: use placement new
|
165
|
+
};
|
166
|
+
|
167
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1>
|
168
|
+
inline Ruby_Function_2<Ret_T, Fun, T0, T1>::
|
169
|
+
Ruby_Function_2(Fun f, T0 const & t0, T1 const & t1)
|
170
|
+
: f_(f), t0_(t0), t1_(t1)
|
171
|
+
{ }
|
172
|
+
|
173
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1>
|
174
|
+
inline void Ruby_Function_2<Ret_T, Fun, T0, T1>::
|
175
|
+
operator()()
|
176
|
+
{
|
177
|
+
result_ = f_(t0_, t1_);
|
178
|
+
}
|
179
|
+
|
180
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1>
|
181
|
+
inline VALUE Ruby_Function_2<Ret_T, Fun, T0, T1>::
|
182
|
+
call(Ruby_Function_2 * f)
|
183
|
+
{
|
184
|
+
(*f)();
|
185
|
+
return Qnil;
|
186
|
+
}
|
187
|
+
|
188
|
+
} // namespace detail
|
189
|
+
|
190
|
+
/**
|
191
|
+
* protect on a function with a return type
|
192
|
+
*/
|
193
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1>
|
194
|
+
inline Ret_T protect(Fun fun, T0 const & t0, T1 const & t1)
|
195
|
+
{
|
196
|
+
typedef detail::Ruby_Function_2<Ret_T, Fun, T0, T1> RF;
|
197
|
+
RF f(fun, t0, t1);
|
198
|
+
detail::protect(
|
199
|
+
RUBY_VALUE_FUNC(RF::call),
|
200
|
+
reinterpret_cast<VALUE>(&f));
|
201
|
+
return f.result();
|
202
|
+
}
|
203
|
+
|
204
|
+
/**
|
205
|
+
* protect on a function with VALUE return type
|
206
|
+
*/
|
207
|
+
template<typename Fun, typename T0, typename T1>
|
208
|
+
inline VALUE protect(Fun fun, T0 const & t0, T1 const & t1)
|
209
|
+
{
|
210
|
+
typedef detail::Ruby_Function_2<VALUE, Fun, T0, T1> RF;
|
211
|
+
RF f(fun, t0, t1);
|
212
|
+
detail::protect(
|
213
|
+
RUBY_VALUE_FUNC(RF::call),
|
214
|
+
reinterpret_cast<VALUE>(&f));
|
215
|
+
return f.result();
|
216
|
+
}
|
217
|
+
|
218
|
+
// ---------------------------------------------------------------------
|
219
|
+
namespace detail
|
220
|
+
{
|
221
|
+
|
222
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2>
|
223
|
+
class Ruby_Function_3
|
224
|
+
{
|
225
|
+
public:
|
226
|
+
Ruby_Function_3(Fun f, T0 const & t0, T1 const & t1, T2 const & t2);
|
227
|
+
inline void operator()();
|
228
|
+
static inline VALUE call(Ruby_Function_3 * f);
|
229
|
+
Ret_T const & result() const { return result_; }
|
230
|
+
|
231
|
+
private:
|
232
|
+
Fun f_;
|
233
|
+
T0 const & t0_; T1 const & t1_; T2 const & t2_;
|
234
|
+
Ret_T result_; // TODO: use placement new
|
235
|
+
};
|
236
|
+
|
237
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2>
|
238
|
+
inline Ruby_Function_3<Ret_T, Fun, T0, T1, T2>::
|
239
|
+
Ruby_Function_3(Fun f, T0 const & t0, T1 const & t1, T2 const & t2)
|
240
|
+
: f_(f), t0_(t0), t1_(t1), t2_(t2)
|
241
|
+
{ }
|
242
|
+
|
243
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2>
|
244
|
+
inline void Ruby_Function_3<Ret_T, Fun, T0, T1, T2>::
|
245
|
+
operator()()
|
246
|
+
{
|
247
|
+
result_ = f_(t0_, t1_, t2_);
|
248
|
+
}
|
249
|
+
|
250
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2>
|
251
|
+
inline VALUE Ruby_Function_3<Ret_T, Fun, T0, T1, T2>::
|
252
|
+
call(Ruby_Function_3 * f)
|
253
|
+
{
|
254
|
+
(*f)();
|
255
|
+
return Qnil;
|
256
|
+
}
|
257
|
+
|
258
|
+
} // namespace detail
|
259
|
+
|
260
|
+
/**
|
261
|
+
* protect on a function with a return type
|
262
|
+
*/
|
263
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2>
|
264
|
+
inline Ret_T protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2)
|
265
|
+
{
|
266
|
+
typedef detail::Ruby_Function_3<Ret_T, Fun, T0, T1, T2> RF;
|
267
|
+
RF f(fun, t0, t1, t2);
|
268
|
+
detail::protect(
|
269
|
+
RUBY_VALUE_FUNC(RF::call),
|
270
|
+
reinterpret_cast<VALUE>(&f));
|
271
|
+
return f.result();
|
272
|
+
}
|
273
|
+
|
274
|
+
/**
|
275
|
+
* protect on a function with VALUE return type
|
276
|
+
*/
|
277
|
+
template<typename Fun, typename T0, typename T1, typename T2>
|
278
|
+
inline VALUE protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2)
|
279
|
+
{
|
280
|
+
typedef detail::Ruby_Function_3<VALUE, Fun, T0, T1, T2> RF;
|
281
|
+
RF f(fun, t0, t1, t2);
|
282
|
+
detail::protect(
|
283
|
+
RUBY_VALUE_FUNC(RF::call),
|
284
|
+
reinterpret_cast<VALUE>(&f));
|
285
|
+
return f.result();
|
286
|
+
}
|
287
|
+
|
288
|
+
// ---------------------------------------------------------------------
|
289
|
+
namespace detail
|
290
|
+
{
|
291
|
+
|
292
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3>
|
293
|
+
class Ruby_Function_4
|
294
|
+
{
|
295
|
+
public:
|
296
|
+
Ruby_Function_4(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3);
|
297
|
+
inline void operator()();
|
298
|
+
static inline VALUE call(Ruby_Function_4 * f);
|
299
|
+
Ret_T const & result() const { return result_; }
|
300
|
+
|
301
|
+
private:
|
302
|
+
Fun f_;
|
303
|
+
T0 const & t0_; T1 const & t1_; T2 const & t2_; T3 const & t3_;
|
304
|
+
Ret_T result_; // TODO: use placement new
|
305
|
+
};
|
306
|
+
|
307
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3>
|
308
|
+
inline Ruby_Function_4<Ret_T, Fun, T0, T1, T2, T3>::
|
309
|
+
Ruby_Function_4(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3)
|
310
|
+
: f_(f), t0_(t0), t1_(t1), t2_(t2), t3_(t3)
|
311
|
+
{ }
|
312
|
+
|
313
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3>
|
314
|
+
inline void Ruby_Function_4<Ret_T, Fun, T0, T1, T2, T3>::
|
315
|
+
operator()()
|
316
|
+
{
|
317
|
+
result_ = f_(t0_, t1_, t2_, t3_);
|
318
|
+
}
|
319
|
+
|
320
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3>
|
321
|
+
inline VALUE Ruby_Function_4<Ret_T, Fun, T0, T1, T2, T3>::
|
322
|
+
call(Ruby_Function_4 * f)
|
323
|
+
{
|
324
|
+
(*f)();
|
325
|
+
return Qnil;
|
326
|
+
}
|
327
|
+
|
328
|
+
} // namespace detail
|
329
|
+
|
330
|
+
/**
|
331
|
+
* protect on a function with a return type
|
332
|
+
*/
|
333
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3>
|
334
|
+
inline Ret_T protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3)
|
335
|
+
{
|
336
|
+
typedef detail::Ruby_Function_4<Ret_T, Fun, T0, T1, T2, T3> RF;
|
337
|
+
RF f(fun, t0, t1, t2, t3);
|
338
|
+
detail::protect(
|
339
|
+
RUBY_VALUE_FUNC(RF::call),
|
340
|
+
reinterpret_cast<VALUE>(&f));
|
341
|
+
return f.result();
|
342
|
+
}
|
343
|
+
|
344
|
+
/**
|
345
|
+
* protect on a function with VALUE return type
|
346
|
+
*/
|
347
|
+
template<typename Fun, typename T0, typename T1, typename T2, typename T3>
|
348
|
+
inline VALUE protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3)
|
349
|
+
{
|
350
|
+
typedef detail::Ruby_Function_4<VALUE, Fun, T0, T1, T2, T3> RF;
|
351
|
+
RF f(fun, t0, t1, t2, t3);
|
352
|
+
detail::protect(
|
353
|
+
RUBY_VALUE_FUNC(RF::call),
|
354
|
+
reinterpret_cast<VALUE>(&f));
|
355
|
+
return f.result();
|
356
|
+
}
|
357
|
+
|
358
|
+
// ---------------------------------------------------------------------
|
359
|
+
namespace detail
|
360
|
+
{
|
361
|
+
|
362
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4>
|
363
|
+
class Ruby_Function_5
|
364
|
+
{
|
365
|
+
public:
|
366
|
+
Ruby_Function_5(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4);
|
367
|
+
inline void operator()();
|
368
|
+
static inline VALUE call(Ruby_Function_5 * f);
|
369
|
+
Ret_T const & result() const { return result_; }
|
370
|
+
|
371
|
+
private:
|
372
|
+
Fun f_;
|
373
|
+
T0 const & t0_; T1 const & t1_; T2 const & t2_; T3 const & t3_; T4 const & t4_;
|
374
|
+
Ret_T result_; // TODO: use placement new
|
375
|
+
};
|
376
|
+
|
377
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4>
|
378
|
+
inline Ruby_Function_5<Ret_T, Fun, T0, T1, T2, T3, T4>::
|
379
|
+
Ruby_Function_5(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4)
|
380
|
+
: f_(f), t0_(t0), t1_(t1), t2_(t2), t3_(t3), t4_(t4)
|
381
|
+
{ }
|
382
|
+
|
383
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4>
|
384
|
+
inline void Ruby_Function_5<Ret_T, Fun, T0, T1, T2, T3, T4>::
|
385
|
+
operator()()
|
386
|
+
{
|
387
|
+
result_ = f_(t0_, t1_, t2_, t3_, t4_);
|
388
|
+
}
|
389
|
+
|
390
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4>
|
391
|
+
inline VALUE Ruby_Function_5<Ret_T, Fun, T0, T1, T2, T3, T4>::
|
392
|
+
call(Ruby_Function_5 * f)
|
393
|
+
{
|
394
|
+
(*f)();
|
395
|
+
return Qnil;
|
396
|
+
}
|
397
|
+
|
398
|
+
} // namespace detail
|
399
|
+
|
400
|
+
/**
|
401
|
+
* protect on a function with a return type
|
402
|
+
*/
|
403
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4>
|
404
|
+
inline Ret_T protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4)
|
405
|
+
{
|
406
|
+
typedef detail::Ruby_Function_5<Ret_T, Fun, T0, T1, T2, T3, T4> RF;
|
407
|
+
RF f(fun, t0, t1, t2, t3, t4);
|
408
|
+
detail::protect(
|
409
|
+
RUBY_VALUE_FUNC(RF::call),
|
410
|
+
reinterpret_cast<VALUE>(&f));
|
411
|
+
return f.result();
|
412
|
+
}
|
413
|
+
|
414
|
+
/**
|
415
|
+
* protect on a function with VALUE return type
|
416
|
+
*/
|
417
|
+
template<typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4>
|
418
|
+
inline VALUE protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4)
|
419
|
+
{
|
420
|
+
typedef detail::Ruby_Function_5<VALUE, Fun, T0, T1, T2, T3, T4> RF;
|
421
|
+
RF f(fun, t0, t1, t2, t3, t4);
|
422
|
+
detail::protect(
|
423
|
+
RUBY_VALUE_FUNC(RF::call),
|
424
|
+
reinterpret_cast<VALUE>(&f));
|
425
|
+
return f.result();
|
426
|
+
}
|
427
|
+
|
428
|
+
// ---------------------------------------------------------------------
|
429
|
+
namespace detail
|
430
|
+
{
|
431
|
+
|
432
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
433
|
+
class Ruby_Function_6
|
434
|
+
{
|
435
|
+
public:
|
436
|
+
Ruby_Function_6(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5);
|
437
|
+
inline void operator()();
|
438
|
+
static inline VALUE call(Ruby_Function_6 * f);
|
439
|
+
Ret_T const & result() const { return result_; }
|
440
|
+
|
441
|
+
private:
|
442
|
+
Fun f_;
|
443
|
+
T0 const & t0_; T1 const & t1_; T2 const & t2_; T3 const & t3_; T4 const & t4_; T5 const & t5_;
|
444
|
+
Ret_T result_; // TODO: use placement new
|
445
|
+
};
|
446
|
+
|
447
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
448
|
+
inline Ruby_Function_6<Ret_T, Fun, T0, T1, T2, T3, T4, T5>::
|
449
|
+
Ruby_Function_6(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5)
|
450
|
+
: f_(f), t0_(t0), t1_(t1), t2_(t2), t3_(t3), t4_(t4), t5_(t5)
|
451
|
+
{ }
|
452
|
+
|
453
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
454
|
+
inline void Ruby_Function_6<Ret_T, Fun, T0, T1, T2, T3, T4, T5>::
|
455
|
+
operator()()
|
456
|
+
{
|
457
|
+
result_ = f_(t0_, t1_, t2_, t3_, t4_, t5_);
|
458
|
+
}
|
459
|
+
|
460
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
461
|
+
inline VALUE Ruby_Function_6<Ret_T, Fun, T0, T1, T2, T3, T4, T5>::
|
462
|
+
call(Ruby_Function_6 * f)
|
463
|
+
{
|
464
|
+
(*f)();
|
465
|
+
return Qnil;
|
466
|
+
}
|
467
|
+
|
468
|
+
} // namespace detail
|
469
|
+
|
470
|
+
/**
|
471
|
+
* protect on a function with a return type
|
472
|
+
*/
|
473
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
474
|
+
inline Ret_T protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5)
|
475
|
+
{
|
476
|
+
typedef detail::Ruby_Function_6<Ret_T, Fun, T0, T1, T2, T3, T4, T5> RF;
|
477
|
+
RF f(fun, t0, t1, t2, t3, t4, t5);
|
478
|
+
detail::protect(
|
479
|
+
RUBY_VALUE_FUNC(RF::call),
|
480
|
+
reinterpret_cast<VALUE>(&f));
|
481
|
+
return f.result();
|
482
|
+
}
|
483
|
+
|
484
|
+
/**
|
485
|
+
* protect on a function with VALUE return type
|
486
|
+
*/
|
487
|
+
template<typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
488
|
+
inline VALUE protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5)
|
489
|
+
{
|
490
|
+
typedef detail::Ruby_Function_6<VALUE, Fun, T0, T1, T2, T3, T4, T5> RF;
|
491
|
+
RF f(fun, t0, t1, t2, t3, t4, t5);
|
492
|
+
detail::protect(
|
493
|
+
RUBY_VALUE_FUNC(RF::call),
|
494
|
+
reinterpret_cast<VALUE>(&f));
|
495
|
+
return f.result();
|
496
|
+
}
|
497
|
+
|
498
|
+
// ---------------------------------------------------------------------
|
499
|
+
namespace detail
|
500
|
+
{
|
501
|
+
|
502
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
503
|
+
class Ruby_Function_7
|
504
|
+
{
|
505
|
+
public:
|
506
|
+
Ruby_Function_7(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6);
|
507
|
+
inline void operator()();
|
508
|
+
static inline VALUE call(Ruby_Function_7 * f);
|
509
|
+
Ret_T const & result() const { return result_; }
|
510
|
+
|
511
|
+
private:
|
512
|
+
Fun f_;
|
513
|
+
T0 const & t0_; T1 const & t1_; T2 const & t2_; T3 const & t3_; T4 const & t4_; T5 const & t5_; T6 const & t6_;
|
514
|
+
Ret_T result_; // TODO: use placement new
|
515
|
+
};
|
516
|
+
|
517
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
518
|
+
inline Ruby_Function_7<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6>::
|
519
|
+
Ruby_Function_7(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6)
|
520
|
+
: f_(f), t0_(t0), t1_(t1), t2_(t2), t3_(t3), t4_(t4), t5_(t5), t6_(t6)
|
521
|
+
{ }
|
522
|
+
|
523
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
524
|
+
inline void Ruby_Function_7<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6>::
|
525
|
+
operator()()
|
526
|
+
{
|
527
|
+
result_ = f_(t0_, t1_, t2_, t3_, t4_, t5_, t6_);
|
528
|
+
}
|
529
|
+
|
530
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
531
|
+
inline VALUE Ruby_Function_7<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6>::
|
532
|
+
call(Ruby_Function_7 * f)
|
533
|
+
{
|
534
|
+
(*f)();
|
535
|
+
return Qnil;
|
536
|
+
}
|
537
|
+
|
538
|
+
} // namespace detail
|
539
|
+
|
540
|
+
/**
|
541
|
+
* protect on a function with a return type
|
542
|
+
*/
|
543
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
544
|
+
inline Ret_T protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6)
|
545
|
+
{
|
546
|
+
typedef detail::Ruby_Function_7<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6> RF;
|
547
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6);
|
548
|
+
detail::protect(
|
549
|
+
RUBY_VALUE_FUNC(RF::call),
|
550
|
+
reinterpret_cast<VALUE>(&f));
|
551
|
+
return f.result();
|
552
|
+
}
|
553
|
+
|
554
|
+
/**
|
555
|
+
* protect on a function with VALUE return type
|
556
|
+
*/
|
557
|
+
template<typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
558
|
+
inline VALUE protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6)
|
559
|
+
{
|
560
|
+
typedef detail::Ruby_Function_7<VALUE, Fun, T0, T1, T2, T3, T4, T5, T6> RF;
|
561
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6);
|
562
|
+
detail::protect(
|
563
|
+
RUBY_VALUE_FUNC(RF::call),
|
564
|
+
reinterpret_cast<VALUE>(&f));
|
565
|
+
return f.result();
|
566
|
+
}
|
567
|
+
|
568
|
+
// ---------------------------------------------------------------------
|
569
|
+
namespace detail
|
570
|
+
{
|
571
|
+
|
572
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
573
|
+
class Ruby_Function_8
|
574
|
+
{
|
575
|
+
public:
|
576
|
+
Ruby_Function_8(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7);
|
577
|
+
inline void operator()();
|
578
|
+
static inline VALUE call(Ruby_Function_8 * f);
|
579
|
+
Ret_T const & result() const { return result_; }
|
580
|
+
|
581
|
+
private:
|
582
|
+
Fun f_;
|
583
|
+
T0 const & t0_; T1 const & t1_; T2 const & t2_; T3 const & t3_; T4 const & t4_; T5 const & t5_; T6 const & t6_; T7 const & t7_;
|
584
|
+
Ret_T result_; // TODO: use placement new
|
585
|
+
};
|
586
|
+
|
587
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
588
|
+
inline Ruby_Function_8<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7>::
|
589
|
+
Ruby_Function_8(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7)
|
590
|
+
: f_(f), t0_(t0), t1_(t1), t2_(t2), t3_(t3), t4_(t4), t5_(t5), t6_(t6), t7_(t7)
|
591
|
+
{ }
|
592
|
+
|
593
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
594
|
+
inline void Ruby_Function_8<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7>::
|
595
|
+
operator()()
|
596
|
+
{
|
597
|
+
result_ = f_(t0_, t1_, t2_, t3_, t4_, t5_, t6_, t7_);
|
598
|
+
}
|
599
|
+
|
600
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
601
|
+
inline VALUE Ruby_Function_8<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7>::
|
602
|
+
call(Ruby_Function_8 * f)
|
603
|
+
{
|
604
|
+
(*f)();
|
605
|
+
return Qnil;
|
606
|
+
}
|
607
|
+
|
608
|
+
} // namespace detail
|
609
|
+
|
610
|
+
/**
|
611
|
+
* protect on a function with a return type
|
612
|
+
*/
|
613
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
614
|
+
inline Ret_T protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7)
|
615
|
+
{
|
616
|
+
typedef detail::Ruby_Function_8<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7> RF;
|
617
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7);
|
618
|
+
detail::protect(
|
619
|
+
RUBY_VALUE_FUNC(RF::call),
|
620
|
+
reinterpret_cast<VALUE>(&f));
|
621
|
+
return f.result();
|
622
|
+
}
|
623
|
+
|
624
|
+
/**
|
625
|
+
* protect on a function with VALUE return type
|
626
|
+
*/
|
627
|
+
template<typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
628
|
+
inline VALUE protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7)
|
629
|
+
{
|
630
|
+
typedef detail::Ruby_Function_8<VALUE, Fun, T0, T1, T2, T3, T4, T5, T6, T7> RF;
|
631
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7);
|
632
|
+
detail::protect(
|
633
|
+
RUBY_VALUE_FUNC(RF::call),
|
634
|
+
reinterpret_cast<VALUE>(&f));
|
635
|
+
return f.result();
|
636
|
+
}
|
637
|
+
|
638
|
+
// ---------------------------------------------------------------------
|
639
|
+
namespace detail
|
640
|
+
{
|
641
|
+
|
642
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
643
|
+
class Ruby_Function_9
|
644
|
+
{
|
645
|
+
public:
|
646
|
+
Ruby_Function_9(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8);
|
647
|
+
inline void operator()();
|
648
|
+
static inline VALUE call(Ruby_Function_9 * f);
|
649
|
+
Ret_T const & result() const { return result_; }
|
650
|
+
|
651
|
+
private:
|
652
|
+
Fun f_;
|
653
|
+
T0 const & t0_; T1 const & t1_; T2 const & t2_; T3 const & t3_; T4 const & t4_; T5 const & t5_; T6 const & t6_; T7 const & t7_; T8 const & t8_;
|
654
|
+
Ret_T result_; // TODO: use placement new
|
655
|
+
};
|
656
|
+
|
657
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
658
|
+
inline Ruby_Function_9<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8>::
|
659
|
+
Ruby_Function_9(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8)
|
660
|
+
: f_(f), t0_(t0), t1_(t1), t2_(t2), t3_(t3), t4_(t4), t5_(t5), t6_(t6), t7_(t7), t8_(t8)
|
661
|
+
{ }
|
662
|
+
|
663
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
664
|
+
inline void Ruby_Function_9<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8>::
|
665
|
+
operator()()
|
666
|
+
{
|
667
|
+
result_ = f_(t0_, t1_, t2_, t3_, t4_, t5_, t6_, t7_, t8_);
|
668
|
+
}
|
669
|
+
|
670
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
671
|
+
inline VALUE Ruby_Function_9<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8>::
|
672
|
+
call(Ruby_Function_9 * f)
|
673
|
+
{
|
674
|
+
(*f)();
|
675
|
+
return Qnil;
|
676
|
+
}
|
677
|
+
|
678
|
+
} // namespace detail
|
679
|
+
|
680
|
+
/**
|
681
|
+
* protect on a function with a return type
|
682
|
+
*/
|
683
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
684
|
+
inline Ret_T protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8)
|
685
|
+
{
|
686
|
+
typedef detail::Ruby_Function_9<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8> RF;
|
687
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7, t8);
|
688
|
+
detail::protect(
|
689
|
+
RUBY_VALUE_FUNC(RF::call),
|
690
|
+
reinterpret_cast<VALUE>(&f));
|
691
|
+
return f.result();
|
692
|
+
}
|
693
|
+
|
694
|
+
/**
|
695
|
+
* protect on a function with VALUE return type
|
696
|
+
*/
|
697
|
+
template<typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
698
|
+
inline VALUE protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8)
|
699
|
+
{
|
700
|
+
typedef detail::Ruby_Function_9<VALUE, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8> RF;
|
701
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7, t8);
|
702
|
+
detail::protect(
|
703
|
+
RUBY_VALUE_FUNC(RF::call),
|
704
|
+
reinterpret_cast<VALUE>(&f));
|
705
|
+
return f.result();
|
706
|
+
}
|
707
|
+
|
708
|
+
// ---------------------------------------------------------------------
|
709
|
+
namespace detail
|
710
|
+
{
|
711
|
+
|
712
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
713
|
+
class Ruby_Function_10
|
714
|
+
{
|
715
|
+
public:
|
716
|
+
Ruby_Function_10(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9);
|
717
|
+
inline void operator()();
|
718
|
+
static inline VALUE call(Ruby_Function_10 * f);
|
719
|
+
Ret_T const & result() const { return result_; }
|
720
|
+
|
721
|
+
private:
|
722
|
+
Fun f_;
|
723
|
+
T0 const & t0_; T1 const & t1_; T2 const & t2_; T3 const & t3_; T4 const & t4_; T5 const & t5_; T6 const & t6_; T7 const & t7_; T8 const & t8_; T9 const & t9_;
|
724
|
+
Ret_T result_; // TODO: use placement new
|
725
|
+
};
|
726
|
+
|
727
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
728
|
+
inline Ruby_Function_10<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>::
|
729
|
+
Ruby_Function_10(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9)
|
730
|
+
: f_(f), t0_(t0), t1_(t1), t2_(t2), t3_(t3), t4_(t4), t5_(t5), t6_(t6), t7_(t7), t8_(t8), t9_(t9)
|
731
|
+
{ }
|
732
|
+
|
733
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
734
|
+
inline void Ruby_Function_10<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>::
|
735
|
+
operator()()
|
736
|
+
{
|
737
|
+
result_ = f_(t0_, t1_, t2_, t3_, t4_, t5_, t6_, t7_, t8_, t9_);
|
738
|
+
}
|
739
|
+
|
740
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
741
|
+
inline VALUE Ruby_Function_10<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>::
|
742
|
+
call(Ruby_Function_10 * f)
|
743
|
+
{
|
744
|
+
(*f)();
|
745
|
+
return Qnil;
|
746
|
+
}
|
747
|
+
|
748
|
+
} // namespace detail
|
749
|
+
|
750
|
+
/**
|
751
|
+
* protect on a function with a return type
|
752
|
+
*/
|
753
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
754
|
+
inline Ret_T protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9)
|
755
|
+
{
|
756
|
+
typedef detail::Ruby_Function_10<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> RF;
|
757
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9);
|
758
|
+
detail::protect(
|
759
|
+
RUBY_VALUE_FUNC(RF::call),
|
760
|
+
reinterpret_cast<VALUE>(&f));
|
761
|
+
return f.result();
|
762
|
+
}
|
763
|
+
|
764
|
+
/**
|
765
|
+
* protect on a function with VALUE return type
|
766
|
+
*/
|
767
|
+
template<typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
768
|
+
inline VALUE protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9)
|
769
|
+
{
|
770
|
+
typedef detail::Ruby_Function_10<VALUE, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> RF;
|
771
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9);
|
772
|
+
detail::protect(
|
773
|
+
RUBY_VALUE_FUNC(RF::call),
|
774
|
+
reinterpret_cast<VALUE>(&f));
|
775
|
+
return f.result();
|
776
|
+
}
|
777
|
+
|
778
|
+
// ---------------------------------------------------------------------
|
779
|
+
namespace detail
|
780
|
+
{
|
781
|
+
|
782
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
|
783
|
+
class Ruby_Function_11
|
784
|
+
{
|
785
|
+
public:
|
786
|
+
Ruby_Function_11(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10);
|
787
|
+
inline void operator()();
|
788
|
+
static inline VALUE call(Ruby_Function_11 * f);
|
789
|
+
Ret_T const & result() const { return result_; }
|
790
|
+
|
791
|
+
private:
|
792
|
+
Fun f_;
|
793
|
+
T0 const & t0_; T1 const & t1_; T2 const & t2_; T3 const & t3_; T4 const & t4_; T5 const & t5_; T6 const & t6_; T7 const & t7_; T8 const & t8_; T9 const & t9_; T10 const & t10_;
|
794
|
+
Ret_T result_; // TODO: use placement new
|
795
|
+
};
|
796
|
+
|
797
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
|
798
|
+
inline Ruby_Function_11<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::
|
799
|
+
Ruby_Function_11(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10)
|
800
|
+
: f_(f), t0_(t0), t1_(t1), t2_(t2), t3_(t3), t4_(t4), t5_(t5), t6_(t6), t7_(t7), t8_(t8), t9_(t9), t10_(t10)
|
801
|
+
{ }
|
802
|
+
|
803
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
|
804
|
+
inline void Ruby_Function_11<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::
|
805
|
+
operator()()
|
806
|
+
{
|
807
|
+
result_ = f_(t0_, t1_, t2_, t3_, t4_, t5_, t6_, t7_, t8_, t9_, t10_);
|
808
|
+
}
|
809
|
+
|
810
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
|
811
|
+
inline VALUE Ruby_Function_11<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::
|
812
|
+
call(Ruby_Function_11 * f)
|
813
|
+
{
|
814
|
+
(*f)();
|
815
|
+
return Qnil;
|
816
|
+
}
|
817
|
+
|
818
|
+
} // namespace detail
|
819
|
+
|
820
|
+
/**
|
821
|
+
* protect on a function with a return type
|
822
|
+
*/
|
823
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
|
824
|
+
inline Ret_T protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10)
|
825
|
+
{
|
826
|
+
typedef detail::Ruby_Function_11<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> RF;
|
827
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10);
|
828
|
+
detail::protect(
|
829
|
+
RUBY_VALUE_FUNC(RF::call),
|
830
|
+
reinterpret_cast<VALUE>(&f));
|
831
|
+
return f.result();
|
832
|
+
}
|
833
|
+
|
834
|
+
/**
|
835
|
+
* protect on a function with VALUE return type
|
836
|
+
*/
|
837
|
+
template<typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
|
838
|
+
inline VALUE protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10)
|
839
|
+
{
|
840
|
+
typedef detail::Ruby_Function_11<VALUE, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> RF;
|
841
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10);
|
842
|
+
detail::protect(
|
843
|
+
RUBY_VALUE_FUNC(RF::call),
|
844
|
+
reinterpret_cast<VALUE>(&f));
|
845
|
+
return f.result();
|
846
|
+
}
|
847
|
+
|
848
|
+
// ---------------------------------------------------------------------
|
849
|
+
namespace detail
|
850
|
+
{
|
851
|
+
|
852
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
|
853
|
+
class Ruby_Function_12
|
854
|
+
{
|
855
|
+
public:
|
856
|
+
Ruby_Function_12(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11);
|
857
|
+
inline void operator()();
|
858
|
+
static inline VALUE call(Ruby_Function_12 * f);
|
859
|
+
Ret_T const & result() const { return result_; }
|
860
|
+
|
861
|
+
private:
|
862
|
+
Fun f_;
|
863
|
+
T0 const & t0_; T1 const & t1_; T2 const & t2_; T3 const & t3_; T4 const & t4_; T5 const & t5_; T6 const & t6_; T7 const & t7_; T8 const & t8_; T9 const & t9_; T10 const & t10_; T11 const & t11_;
|
864
|
+
Ret_T result_; // TODO: use placement new
|
865
|
+
};
|
866
|
+
|
867
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
|
868
|
+
inline Ruby_Function_12<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::
|
869
|
+
Ruby_Function_12(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11)
|
870
|
+
: f_(f), t0_(t0), t1_(t1), t2_(t2), t3_(t3), t4_(t4), t5_(t5), t6_(t6), t7_(t7), t8_(t8), t9_(t9), t10_(t10), t11_(t11)
|
871
|
+
{ }
|
872
|
+
|
873
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
|
874
|
+
inline void Ruby_Function_12<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::
|
875
|
+
operator()()
|
876
|
+
{
|
877
|
+
result_ = f_(t0_, t1_, t2_, t3_, t4_, t5_, t6_, t7_, t8_, t9_, t10_, t11_);
|
878
|
+
}
|
879
|
+
|
880
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
|
881
|
+
inline VALUE Ruby_Function_12<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>::
|
882
|
+
call(Ruby_Function_12 * f)
|
883
|
+
{
|
884
|
+
(*f)();
|
885
|
+
return Qnil;
|
886
|
+
}
|
887
|
+
|
888
|
+
} // namespace detail
|
889
|
+
|
890
|
+
/**
|
891
|
+
* protect on a function with a return type
|
892
|
+
*/
|
893
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
|
894
|
+
inline Ret_T protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11)
|
895
|
+
{
|
896
|
+
typedef detail::Ruby_Function_12<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> RF;
|
897
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11);
|
898
|
+
detail::protect(
|
899
|
+
RUBY_VALUE_FUNC(RF::call),
|
900
|
+
reinterpret_cast<VALUE>(&f));
|
901
|
+
return f.result();
|
902
|
+
}
|
903
|
+
|
904
|
+
/**
|
905
|
+
* protect on a function with VALUE return type
|
906
|
+
*/
|
907
|
+
template<typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
|
908
|
+
inline VALUE protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11)
|
909
|
+
{
|
910
|
+
typedef detail::Ruby_Function_12<VALUE, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> RF;
|
911
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11);
|
912
|
+
detail::protect(
|
913
|
+
RUBY_VALUE_FUNC(RF::call),
|
914
|
+
reinterpret_cast<VALUE>(&f));
|
915
|
+
return f.result();
|
916
|
+
}
|
917
|
+
|
918
|
+
// ---------------------------------------------------------------------
|
919
|
+
namespace detail
|
920
|
+
{
|
921
|
+
|
922
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
|
923
|
+
class Ruby_Function_13
|
924
|
+
{
|
925
|
+
public:
|
926
|
+
Ruby_Function_13(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11, T12 const & t12);
|
927
|
+
inline void operator()();
|
928
|
+
static inline VALUE call(Ruby_Function_13 * f);
|
929
|
+
Ret_T const & result() const { return result_; }
|
930
|
+
|
931
|
+
private:
|
932
|
+
Fun f_;
|
933
|
+
T0 const & t0_; T1 const & t1_; T2 const & t2_; T3 const & t3_; T4 const & t4_; T5 const & t5_; T6 const & t6_; T7 const & t7_; T8 const & t8_; T9 const & t9_; T10 const & t10_; T11 const & t11_; T12 const & t12_;
|
934
|
+
Ret_T result_; // TODO: use placement new
|
935
|
+
};
|
936
|
+
|
937
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
|
938
|
+
inline Ruby_Function_13<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::
|
939
|
+
Ruby_Function_13(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11, T12 const & t12)
|
940
|
+
: f_(f), t0_(t0), t1_(t1), t2_(t2), t3_(t3), t4_(t4), t5_(t5), t6_(t6), t7_(t7), t8_(t8), t9_(t9), t10_(t10), t11_(t11), t12_(t12)
|
941
|
+
{ }
|
942
|
+
|
943
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
|
944
|
+
inline void Ruby_Function_13<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::
|
945
|
+
operator()()
|
946
|
+
{
|
947
|
+
result_ = f_(t0_, t1_, t2_, t3_, t4_, t5_, t6_, t7_, t8_, t9_, t10_, t11_, t12_);
|
948
|
+
}
|
949
|
+
|
950
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
|
951
|
+
inline VALUE Ruby_Function_13<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>::
|
952
|
+
call(Ruby_Function_13 * f)
|
953
|
+
{
|
954
|
+
(*f)();
|
955
|
+
return Qnil;
|
956
|
+
}
|
957
|
+
|
958
|
+
} // namespace detail
|
959
|
+
|
960
|
+
/**
|
961
|
+
* protect on a function with a return type
|
962
|
+
*/
|
963
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
|
964
|
+
inline Ret_T protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11, T12 const & t12)
|
965
|
+
{
|
966
|
+
typedef detail::Ruby_Function_13<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> RF;
|
967
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12);
|
968
|
+
detail::protect(
|
969
|
+
RUBY_VALUE_FUNC(RF::call),
|
970
|
+
reinterpret_cast<VALUE>(&f));
|
971
|
+
return f.result();
|
972
|
+
}
|
973
|
+
|
974
|
+
/**
|
975
|
+
* protect on a function with VALUE return type
|
976
|
+
*/
|
977
|
+
template<typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
|
978
|
+
inline VALUE protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11, T12 const & t12)
|
979
|
+
{
|
980
|
+
typedef detail::Ruby_Function_13<VALUE, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> RF;
|
981
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12);
|
982
|
+
detail::protect(
|
983
|
+
RUBY_VALUE_FUNC(RF::call),
|
984
|
+
reinterpret_cast<VALUE>(&f));
|
985
|
+
return f.result();
|
986
|
+
}
|
987
|
+
|
988
|
+
// ---------------------------------------------------------------------
|
989
|
+
namespace detail
|
990
|
+
{
|
991
|
+
|
992
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13>
|
993
|
+
class Ruby_Function_14
|
994
|
+
{
|
995
|
+
public:
|
996
|
+
Ruby_Function_14(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11, T12 const & t12, T13 const & t13);
|
997
|
+
inline void operator()();
|
998
|
+
static inline VALUE call(Ruby_Function_14 * f);
|
999
|
+
Ret_T const & result() const { return result_; }
|
1000
|
+
|
1001
|
+
private:
|
1002
|
+
Fun f_;
|
1003
|
+
T0 const & t0_; T1 const & t1_; T2 const & t2_; T3 const & t3_; T4 const & t4_; T5 const & t5_; T6 const & t6_; T7 const & t7_; T8 const & t8_; T9 const & t9_; T10 const & t10_; T11 const & t11_; T12 const & t12_; T13 const & t13_;
|
1004
|
+
Ret_T result_; // TODO: use placement new
|
1005
|
+
};
|
1006
|
+
|
1007
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13>
|
1008
|
+
inline Ruby_Function_14<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::
|
1009
|
+
Ruby_Function_14(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11, T12 const & t12, T13 const & t13)
|
1010
|
+
: f_(f), t0_(t0), t1_(t1), t2_(t2), t3_(t3), t4_(t4), t5_(t5), t6_(t6), t7_(t7), t8_(t8), t9_(t9), t10_(t10), t11_(t11), t12_(t12), t13_(t13)
|
1011
|
+
{ }
|
1012
|
+
|
1013
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13>
|
1014
|
+
inline void Ruby_Function_14<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::
|
1015
|
+
operator()()
|
1016
|
+
{
|
1017
|
+
result_ = f_(t0_, t1_, t2_, t3_, t4_, t5_, t6_, t7_, t8_, t9_, t10_, t11_, t12_, t13_);
|
1018
|
+
}
|
1019
|
+
|
1020
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13>
|
1021
|
+
inline VALUE Ruby_Function_14<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>::
|
1022
|
+
call(Ruby_Function_14 * f)
|
1023
|
+
{
|
1024
|
+
(*f)();
|
1025
|
+
return Qnil;
|
1026
|
+
}
|
1027
|
+
|
1028
|
+
} // namespace detail
|
1029
|
+
|
1030
|
+
/**
|
1031
|
+
* protect on a function with a return type
|
1032
|
+
*/
|
1033
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13>
|
1034
|
+
inline Ret_T protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11, T12 const & t12, T13 const & t13)
|
1035
|
+
{
|
1036
|
+
typedef detail::Ruby_Function_14<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> RF;
|
1037
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13);
|
1038
|
+
detail::protect(
|
1039
|
+
RUBY_VALUE_FUNC(RF::call),
|
1040
|
+
reinterpret_cast<VALUE>(&f));
|
1041
|
+
return f.result();
|
1042
|
+
}
|
1043
|
+
|
1044
|
+
/**
|
1045
|
+
* protect on a function with VALUE return type
|
1046
|
+
*/
|
1047
|
+
template<typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13>
|
1048
|
+
inline VALUE protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11, T12 const & t12, T13 const & t13)
|
1049
|
+
{
|
1050
|
+
typedef detail::Ruby_Function_14<VALUE, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> RF;
|
1051
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13);
|
1052
|
+
detail::protect(
|
1053
|
+
RUBY_VALUE_FUNC(RF::call),
|
1054
|
+
reinterpret_cast<VALUE>(&f));
|
1055
|
+
return f.result();
|
1056
|
+
}
|
1057
|
+
|
1058
|
+
// ---------------------------------------------------------------------
|
1059
|
+
namespace detail
|
1060
|
+
{
|
1061
|
+
|
1062
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
|
1063
|
+
class Ruby_Function_15
|
1064
|
+
{
|
1065
|
+
public:
|
1066
|
+
Ruby_Function_15(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11, T12 const & t12, T13 const & t13, T14 const & t14);
|
1067
|
+
inline void operator()();
|
1068
|
+
static inline VALUE call(Ruby_Function_15 * f);
|
1069
|
+
Ret_T const & result() const { return result_; }
|
1070
|
+
|
1071
|
+
private:
|
1072
|
+
Fun f_;
|
1073
|
+
T0 const & t0_; T1 const & t1_; T2 const & t2_; T3 const & t3_; T4 const & t4_; T5 const & t5_; T6 const & t6_; T7 const & t7_; T8 const & t8_; T9 const & t9_; T10 const & t10_; T11 const & t11_; T12 const & t12_; T13 const & t13_; T14 const & t14_;
|
1074
|
+
Ret_T result_; // TODO: use placement new
|
1075
|
+
};
|
1076
|
+
|
1077
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
|
1078
|
+
inline Ruby_Function_15<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::
|
1079
|
+
Ruby_Function_15(Fun f, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11, T12 const & t12, T13 const & t13, T14 const & t14)
|
1080
|
+
: f_(f), t0_(t0), t1_(t1), t2_(t2), t3_(t3), t4_(t4), t5_(t5), t6_(t6), t7_(t7), t8_(t8), t9_(t9), t10_(t10), t11_(t11), t12_(t12), t13_(t13), t14_(t14)
|
1081
|
+
{ }
|
1082
|
+
|
1083
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
|
1084
|
+
inline void Ruby_Function_15<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::
|
1085
|
+
operator()()
|
1086
|
+
{
|
1087
|
+
result_ = f_(t0_, t1_, t2_, t3_, t4_, t5_, t6_, t7_, t8_, t9_, t10_, t11_, t12_, t13_, t14_);
|
1088
|
+
}
|
1089
|
+
|
1090
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
|
1091
|
+
inline VALUE Ruby_Function_15<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>::
|
1092
|
+
call(Ruby_Function_15 * f)
|
1093
|
+
{
|
1094
|
+
(*f)();
|
1095
|
+
return Qnil;
|
1096
|
+
}
|
1097
|
+
|
1098
|
+
} // namespace detail
|
1099
|
+
|
1100
|
+
/**
|
1101
|
+
* protect on a function with a return type
|
1102
|
+
*/
|
1103
|
+
template<typename Ret_T, typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
|
1104
|
+
inline Ret_T protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11, T12 const & t12, T13 const & t13, T14 const & t14)
|
1105
|
+
{
|
1106
|
+
typedef detail::Ruby_Function_15<Ret_T, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> RF;
|
1107
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14);
|
1108
|
+
detail::protect(
|
1109
|
+
RUBY_VALUE_FUNC(RF::call),
|
1110
|
+
reinterpret_cast<VALUE>(&f));
|
1111
|
+
return f.result();
|
1112
|
+
}
|
1113
|
+
|
1114
|
+
/**
|
1115
|
+
* protect on a function with VALUE return type
|
1116
|
+
*/
|
1117
|
+
template<typename Fun, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
|
1118
|
+
inline VALUE protect(Fun fun, T0 const & t0, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5, T6 const & t6, T7 const & t7, T8 const & t8, T9 const & t9, T10 const & t10, T11 const & t11, T12 const & t12, T13 const & t13, T14 const & t14)
|
1119
|
+
{
|
1120
|
+
typedef detail::Ruby_Function_15<VALUE, Fun, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> RF;
|
1121
|
+
RF f(fun, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14);
|
1122
|
+
detail::protect(
|
1123
|
+
RUBY_VALUE_FUNC(RF::call),
|
1124
|
+
reinterpret_cast<VALUE>(&f));
|
1125
|
+
return f.result();
|
1126
|
+
}
|
1127
|
+
|
1128
|
+
// ---------------------------------------------------------------------
|
1129
|
+
} // namespace Rice
|
1130
|
+
|
1131
|
+
|
1132
|
+
#endif // Rice__protect__ipp_
|
1133
|
+
|