rice2 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +7 -0
  2. data/COPYING +23 -0
  3. data/Doxyfile +2268 -0
  4. data/Makefile.am +26 -0
  5. data/Makefile.in +929 -0
  6. data/README.md +1054 -0
  7. data/README.mingw +8 -0
  8. data/Rakefile +24 -0
  9. data/aclocal.m4 +1090 -0
  10. data/bootstrap +8 -0
  11. data/config.guess +1667 -0
  12. data/config.sub +1793 -0
  13. data/configure +8209 -0
  14. data/configure.ac +55 -0
  15. data/depcomp +791 -0
  16. data/doxygen.ac +314 -0
  17. data/doxygen.am +186 -0
  18. data/extconf.rb +66 -0
  19. data/install-sh +529 -0
  20. data/missing +215 -0
  21. data/post-autoconf.rb +22 -0
  22. data/post-automake.rb +28 -0
  23. data/rice/Address_Registration_Guard.cpp +22 -0
  24. data/rice/Address_Registration_Guard.hpp +7 -0
  25. data/rice/Address_Registration_Guard.ipp +37 -0
  26. data/rice/Address_Registration_Guard_defn.hpp +75 -0
  27. data/rice/Arg.hpp +8 -0
  28. data/rice/Arg_impl.hpp +129 -0
  29. data/rice/Arg_operators.cpp +21 -0
  30. data/rice/Arg_operators.hpp +19 -0
  31. data/rice/Array.hpp +214 -0
  32. data/rice/Array.ipp +256 -0
  33. data/rice/Builtin_Object.hpp +8 -0
  34. data/rice/Builtin_Object.ipp +50 -0
  35. data/rice/Builtin_Object_defn.hpp +50 -0
  36. data/rice/Class.cpp +57 -0
  37. data/rice/Class.hpp +8 -0
  38. data/rice/Class.ipp +6 -0
  39. data/rice/Class_defn.hpp +83 -0
  40. data/rice/Constructor.hpp +47 -0
  41. data/rice/Data_Object.hpp +8 -0
  42. data/rice/Data_Object.ipp +133 -0
  43. data/rice/Data_Object_defn.hpp +138 -0
  44. data/rice/Data_Type.cpp +54 -0
  45. data/rice/Data_Type.hpp +8 -0
  46. data/rice/Data_Type.ipp +365 -0
  47. data/rice/Data_Type_defn.hpp +261 -0
  48. data/rice/Data_Type_fwd.hpp +12 -0
  49. data/rice/Director.cpp +13 -0
  50. data/rice/Director.hpp +39 -0
  51. data/rice/Enum.hpp +117 -0
  52. data/rice/Enum.ipp +246 -0
  53. data/rice/Exception.cpp +59 -0
  54. data/rice/Exception.hpp +13 -0
  55. data/rice/Exception_Base.hpp +8 -0
  56. data/rice/Exception_Base.ipp +13 -0
  57. data/rice/Exception_Base_defn.hpp +27 -0
  58. data/rice/Exception_defn.hpp +69 -0
  59. data/rice/Hash.hpp +227 -0
  60. data/rice/Hash.ipp +329 -0
  61. data/rice/Identifier.cpp +8 -0
  62. data/rice/Identifier.hpp +50 -0
  63. data/rice/Identifier.ipp +33 -0
  64. data/rice/Jump_Tag.hpp +24 -0
  65. data/rice/Makefile.am +122 -0
  66. data/rice/Makefile.in +885 -0
  67. data/rice/Module.cpp +84 -0
  68. data/rice/Module.hpp +8 -0
  69. data/rice/Module.ipp +6 -0
  70. data/rice/Module_defn.hpp +88 -0
  71. data/rice/Module_impl.hpp +281 -0
  72. data/rice/Module_impl.ipp +345 -0
  73. data/rice/Object.cpp +169 -0
  74. data/rice/Object.hpp +8 -0
  75. data/rice/Object.ipp +33 -0
  76. data/rice/Object_defn.hpp +214 -0
  77. data/rice/Require_Guard.hpp +21 -0
  78. data/rice/String.cpp +94 -0
  79. data/rice/String.hpp +91 -0
  80. data/rice/Struct.cpp +117 -0
  81. data/rice/Struct.hpp +162 -0
  82. data/rice/Struct.ipp +26 -0
  83. data/rice/Symbol.cpp +25 -0
  84. data/rice/Symbol.hpp +66 -0
  85. data/rice/Symbol.ipp +44 -0
  86. data/rice/config.hpp +47 -0
  87. data/rice/config.hpp.in +46 -0
  88. data/rice/detail/Arguments.hpp +118 -0
  89. data/rice/detail/Auto_Function_Wrapper.hpp +898 -0
  90. data/rice/detail/Auto_Function_Wrapper.ipp +3694 -0
  91. data/rice/detail/Auto_Member_Function_Wrapper.hpp +897 -0
  92. data/rice/detail/Auto_Member_Function_Wrapper.ipp +2774 -0
  93. data/rice/detail/Caster.hpp +103 -0
  94. data/rice/detail/Exception_Handler.hpp +8 -0
  95. data/rice/detail/Exception_Handler.ipp +68 -0
  96. data/rice/detail/Exception_Handler_defn.hpp +96 -0
  97. data/rice/detail/Iterator.hpp +93 -0
  98. data/rice/detail/Not_Copyable.hpp +25 -0
  99. data/rice/detail/Wrapped_Function.hpp +33 -0
  100. data/rice/detail/cfp.hpp +24 -0
  101. data/rice/detail/cfp.ipp +51 -0
  102. data/rice/detail/check_ruby_type.cpp +27 -0
  103. data/rice/detail/check_ruby_type.hpp +23 -0
  104. data/rice/detail/creation_funcs.hpp +37 -0
  105. data/rice/detail/creation_funcs.ipp +36 -0
  106. data/rice/detail/default_allocation_func.hpp +23 -0
  107. data/rice/detail/default_allocation_func.ipp +11 -0
  108. data/rice/detail/define_method_and_auto_wrap.hpp +31 -0
  109. data/rice/detail/define_method_and_auto_wrap.ipp +30 -0
  110. data/rice/detail/demangle.cpp +56 -0
  111. data/rice/detail/demangle.hpp +19 -0
  112. data/rice/detail/env.hpp +11 -0
  113. data/rice/detail/from_ruby.hpp +43 -0
  114. data/rice/detail/from_ruby.ipp +60 -0
  115. data/rice/detail/method_data.cpp +92 -0
  116. data/rice/detail/method_data.hpp +21 -0
  117. data/rice/detail/node.hpp +13 -0
  118. data/rice/detail/protect.cpp +29 -0
  119. data/rice/detail/protect.hpp +34 -0
  120. data/rice/detail/ruby.hpp +74 -0
  121. data/rice/detail/ruby_version_code.hpp +6 -0
  122. data/rice/detail/ruby_version_code.hpp.in +6 -0
  123. data/rice/detail/st.hpp +22 -0
  124. data/rice/detail/to_ruby.hpp +22 -0
  125. data/rice/detail/to_ruby.ipp +36 -0
  126. data/rice/detail/traits.hpp +43 -0
  127. data/rice/detail/win32.hpp +16 -0
  128. data/rice/detail/wrap_function.hpp +66 -0
  129. data/rice/global_function.hpp +33 -0
  130. data/rice/global_function.ipp +22 -0
  131. data/rice/protect.hpp +38 -0
  132. data/rice/protect.ipp +1134 -0
  133. data/rice/ruby_mark.hpp +13 -0
  134. data/rice/ruby_try_catch.hpp +86 -0
  135. data/rice/rubypp.rb +97 -0
  136. data/rice/to_from_ruby.hpp +8 -0
  137. data/rice/to_from_ruby.ipp +418 -0
  138. data/rice/to_from_ruby_defn.hpp +70 -0
  139. data/ruby.ac +135 -0
  140. data/ruby/Makefile.am +1 -0
  141. data/ruby/Makefile.in +628 -0
  142. data/ruby/lib/Makefile.am +3 -0
  143. data/ruby/lib/Makefile.in +506 -0
  144. data/ruby/lib/mkmf-rice.rb.in +217 -0
  145. data/ruby/lib/version.rb +3 -0
  146. data/sample/Makefile.am +47 -0
  147. data/sample/Makefile.in +489 -0
  148. data/sample/enum/extconf.rb +3 -0
  149. data/sample/enum/sample_enum.cpp +54 -0
  150. data/sample/enum/test.rb +8 -0
  151. data/sample/inheritance/animals.cpp +98 -0
  152. data/sample/inheritance/extconf.rb +3 -0
  153. data/sample/inheritance/test.rb +7 -0
  154. data/sample/map/extconf.rb +3 -0
  155. data/sample/map/map.cpp +81 -0
  156. data/sample/map/test.rb +7 -0
  157. data/test/Makefile.am +72 -0
  158. data/test/Makefile.in +1213 -0
  159. data/test/ext/Makefile.am +41 -0
  160. data/test/ext/Makefile.in +483 -0
  161. data/test/ext/t1/Foo.hpp +10 -0
  162. data/test/ext/t1/extconf.rb +2 -0
  163. data/test/ext/t1/t1.cpp +15 -0
  164. data/test/ext/t2/extconf.rb +2 -0
  165. data/test/ext/t2/t2.cpp +11 -0
  166. data/test/test_Address_Registration_Guard.cpp +43 -0
  167. data/test/test_Array.cpp +248 -0
  168. data/test/test_Builtin_Object.cpp +71 -0
  169. data/test/test_Class.cpp +496 -0
  170. data/test/test_Constructor.cpp +128 -0
  171. data/test/test_Data_Object.cpp +275 -0
  172. data/test/test_Data_Type.cpp +348 -0
  173. data/test/test_Director.cpp +308 -0
  174. data/test/test_Enum.cpp +215 -0
  175. data/test/test_Exception.cpp +47 -0
  176. data/test/test_Hash.cpp +212 -0
  177. data/test/test_Identifier.cpp +70 -0
  178. data/test/test_Jump_Tag.cpp +17 -0
  179. data/test/test_Memory_Management.cpp +50 -0
  180. data/test/test_Module.cpp +497 -0
  181. data/test/test_Object.cpp +159 -0
  182. data/test/test_String.cpp +107 -0
  183. data/test/test_Struct.cpp +205 -0
  184. data/test/test_Symbol.cpp +63 -0
  185. data/test/test_To_From_Ruby.cpp +428 -0
  186. data/test/test_global_functions.cpp +114 -0
  187. data/test/test_rice.rb +41 -0
  188. data/test/unittest.cpp +136 -0
  189. data/test/unittest.hpp +294 -0
  190. metadata +297 -0
@@ -0,0 +1,33 @@
1
+ #ifndef Rice__global_function__hpp_
2
+ #define Rice__global_function__hpp_
3
+
4
+ #include "Arg.hpp"
5
+
6
+ namespace Rice
7
+ {
8
+
9
+ /**
10
+ * Helper forwarder method to easily wrap
11
+ * globally available functions. This simply
12
+ * forwards off a call to define_module_function
13
+ * on rb_mKernel
14
+ */
15
+ template<typename Func_T>
16
+ void define_global_function(
17
+ char const * name,
18
+ Func_T func,
19
+ Arguments* arguments = 0);
20
+
21
+ // FIXME: See Module::define_method with Arg
22
+ template<typename Func_T>
23
+ void define_global_function(
24
+ char const * name,
25
+ Func_T func,
26
+ Arg const& arg);
27
+
28
+
29
+ } // Rice
30
+
31
+ #include "global_function.ipp"
32
+
33
+ #endif // Rice__global_function__hpp_
@@ -0,0 +1,22 @@
1
+ #include "detail/define_method_and_auto_wrap.hpp"
2
+
3
+ template<typename Func_T>
4
+ void Rice::define_global_function(
5
+ char const * name,
6
+ Func_T func,
7
+ Arguments* arguments)
8
+ {
9
+ Module(rb_mKernel).define_module_function(name, func, arguments);
10
+ }
11
+
12
+ template<typename Func_T>
13
+ void Rice::define_global_function(
14
+ char const * name,
15
+ Func_T func,
16
+ Arg const& arg)
17
+ {
18
+ Arguments* args = new Arguments();
19
+ args->add(arg);
20
+ define_global_function(name, func, args);
21
+ }
22
+
@@ -0,0 +1,38 @@
1
+ #ifndef Rice__protect__hpp_
2
+ #define Rice__protect__hpp_
3
+
4
+ // This causes problems with certain C++ libraries
5
+ #undef TYPE
6
+
7
+ #include "Object_defn.hpp"
8
+
9
+ namespace Rice
10
+ {
11
+
12
+ /*! \file
13
+ * \brief A collection of functions (overloaded on number of
14
+ * arguments) for calling C functions that might raise Ruby exceptions.
15
+ */
16
+
17
+ //! Call the C function f with arguments (arg1, arg2, ...).
18
+ /*! E.g.:
19
+ * \code
20
+ * VALUE x = protect(rb_ary_new);
21
+ * protect(rb_ary_push, x, INT2NUM(42));
22
+ * \endcode
23
+ *
24
+ * Note that this function makes copies of all of its arguments; it
25
+ * does not take anything by reference. All of the copies are const so
26
+ * that protect will not work if f takes a non-const
27
+ * reference to any of its arguments (though you can use non-const
28
+ * pointers).
29
+ */
30
+ template<typename Fun, typename ...ArgT>
31
+ VALUE protect(Fun fun, ArgT const &... args);
32
+
33
+ } // namespace Rice
34
+
35
+ #include "protect.ipp"
36
+
37
+ #endif // Rice__protect__hpp_
38
+
@@ -0,0 +1,1134 @@
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
+
1130
+ } // namespace Rice
1131
+
1132
+
1133
+ #endif // Rice__protect__ipp_
1134
+