rice 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (237) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +121 -0
  3. data/CONTRIBUTORS.md +19 -0
  4. data/Gemfile +3 -0
  5. data/README.md +44 -1025
  6. data/Rakefile +95 -12
  7. data/include/rice/rice.hpp +7766 -0
  8. data/lib/mkmf-rice.rb +127 -0
  9. data/lib/version.rb +3 -0
  10. data/rice/Address_Registration_Guard.ipp +75 -32
  11. data/rice/Address_Registration_Guard_defn.hpp +60 -56
  12. data/rice/Arg.hpp +80 -4
  13. data/rice/Arg.ipp +51 -0
  14. data/rice/Constructor.hpp +12 -14
  15. data/rice/Data_Object.ipp +234 -107
  16. data/rice/Data_Object_defn.hpp +77 -117
  17. data/rice/Data_Type.hpp +1 -2
  18. data/rice/Data_Type.ipp +251 -295
  19. data/rice/Data_Type_defn.hpp +175 -243
  20. data/rice/Director.hpp +11 -6
  21. data/rice/Enum.hpp +54 -104
  22. data/rice/Enum.ipp +104 -230
  23. data/rice/Exception.hpp +2 -8
  24. data/rice/Exception.ipp +65 -0
  25. data/rice/Exception_defn.hpp +46 -47
  26. data/rice/Identifier.hpp +28 -28
  27. data/rice/Identifier.ipp +23 -27
  28. data/rice/Return.hpp +39 -0
  29. data/rice/Return.ipp +33 -0
  30. data/rice/detail/Exception_Handler.ipp +22 -62
  31. data/rice/detail/Exception_Handler_defn.hpp +76 -91
  32. data/rice/detail/Iterator.hpp +18 -88
  33. data/rice/detail/Iterator.ipp +47 -0
  34. data/rice/detail/Jump_Tag.hpp +21 -0
  35. data/rice/detail/MethodInfo.hpp +44 -0
  36. data/rice/detail/MethodInfo.ipp +78 -0
  37. data/rice/detail/NativeAttribute.hpp +53 -0
  38. data/rice/detail/NativeAttribute.ipp +83 -0
  39. data/rice/detail/NativeFunction.hpp +69 -0
  40. data/rice/detail/NativeFunction.ipp +248 -0
  41. data/rice/detail/RubyFunction.hpp +39 -0
  42. data/rice/detail/RubyFunction.ipp +92 -0
  43. data/rice/detail/Type.hpp +29 -0
  44. data/rice/detail/Type.ipp +138 -0
  45. data/rice/detail/TypeRegistry.hpp +50 -0
  46. data/rice/detail/TypeRegistry.ipp +106 -0
  47. data/rice/detail/Wrapper.hpp +51 -0
  48. data/rice/detail/Wrapper.ipp +151 -0
  49. data/rice/detail/default_allocation_func.hpp +8 -19
  50. data/rice/detail/default_allocation_func.ipp +9 -8
  51. data/rice/detail/from_ruby.hpp +2 -37
  52. data/rice/detail/from_ruby.ipp +1020 -46
  53. data/rice/detail/from_ruby_defn.hpp +38 -0
  54. data/rice/detail/function_traits.hpp +124 -0
  55. data/rice/detail/method_data.hpp +23 -15
  56. data/rice/detail/method_data.ipp +53 -0
  57. data/rice/detail/rice_traits.hpp +116 -0
  58. data/rice/detail/ruby.hpp +9 -46
  59. data/rice/detail/to_ruby.hpp +3 -17
  60. data/rice/detail/to_ruby.ipp +409 -31
  61. data/rice/detail/to_ruby_defn.hpp +48 -0
  62. data/rice/forward_declares.ipp +82 -0
  63. data/rice/global_function.hpp +16 -20
  64. data/rice/global_function.ipp +8 -17
  65. data/rice/rice.hpp +59 -0
  66. data/rice/ruby_mark.hpp +5 -3
  67. data/rice/ruby_try_catch.hpp +4 -4
  68. data/rice/stl.hpp +11 -0
  69. data/sample/callbacks/extconf.rb +3 -0
  70. data/sample/callbacks/sample_callbacks.cpp +10 -13
  71. data/sample/enum/extconf.rb +3 -0
  72. data/sample/enum/sample_enum.cpp +3 -17
  73. data/sample/enum/test.rb +2 -2
  74. data/sample/inheritance/animals.cpp +8 -24
  75. data/sample/inheritance/extconf.rb +3 -0
  76. data/sample/inheritance/test.rb +1 -1
  77. data/sample/map/extconf.rb +3 -0
  78. data/sample/map/map.cpp +10 -18
  79. data/sample/map/test.rb +1 -1
  80. data/test/embed_ruby.cpp +18 -5
  81. data/test/ext/t1/extconf.rb +3 -0
  82. data/test/ext/t1/t1.cpp +1 -3
  83. data/test/ext/t2/extconf.rb +3 -0
  84. data/test/ext/t2/t2.cpp +1 -1
  85. data/test/extconf.rb +23 -0
  86. data/test/ruby/test_callbacks_sample.rb +28 -0
  87. data/test/ruby/test_multiple_extensions.rb +18 -0
  88. data/test/ruby/test_multiple_extensions_same_class.rb +14 -0
  89. data/test/ruby/test_multiple_extensions_with_inheritance.rb +20 -0
  90. data/test/test_Address_Registration_Guard.cpp +23 -10
  91. data/test/test_Array.cpp +129 -73
  92. data/test/test_Attribute.cpp +147 -0
  93. data/test/test_Builtin_Object.cpp +34 -14
  94. data/test/test_Class.cpp +149 -275
  95. data/test/test_Constructor.cpp +10 -9
  96. data/test/test_Data_Object.cpp +133 -192
  97. data/test/test_Data_Type.cpp +322 -252
  98. data/test/test_Director.cpp +54 -41
  99. data/test/test_Enum.cpp +228 -103
  100. data/test/test_Exception.cpp +5 -6
  101. data/test/test_Hash.cpp +31 -30
  102. data/test/test_Identifier.cpp +4 -5
  103. data/test/test_Inheritance.cpp +221 -0
  104. data/test/test_Iterator.cpp +161 -0
  105. data/test/test_Jump_Tag.cpp +1 -1
  106. data/test/test_Keep_Alive.cpp +161 -0
  107. data/test/test_Memory_Management.cpp +2 -4
  108. data/test/test_Module.cpp +167 -110
  109. data/test/test_Object.cpp +41 -21
  110. data/test/test_Ownership.cpp +275 -0
  111. data/test/test_Self.cpp +205 -0
  112. data/test/test_Stl_Optional.cpp +90 -0
  113. data/test/test_Stl_Pair.cpp +144 -0
  114. data/test/test_Stl_SmartPointer.cpp +200 -0
  115. data/test/test_Stl_String.cpp +74 -0
  116. data/test/test_Stl_Vector.cpp +652 -0
  117. data/test/test_String.cpp +1 -2
  118. data/test/test_Struct.cpp +29 -39
  119. data/test/test_Symbol.cpp +1 -2
  120. data/test/test_To_From_Ruby.cpp +249 -285
  121. data/test/test_global_functions.cpp +39 -19
  122. data/test/unittest.hpp +0 -4
  123. metadata +63 -139
  124. data/Doxyfile +0 -2268
  125. data/Makefile.am +0 -26
  126. data/Makefile.in +0 -931
  127. data/README.mingw +0 -8
  128. data/aclocal.m4 +0 -1085
  129. data/ax_cxx_compile_stdcxx.m4 +0 -951
  130. data/bootstrap +0 -8
  131. data/config.guess +0 -1421
  132. data/config.sub +0 -1807
  133. data/configure +0 -7792
  134. data/configure.ac +0 -55
  135. data/depcomp +0 -791
  136. data/doxygen.ac +0 -314
  137. data/doxygen.am +0 -186
  138. data/extconf.rb +0 -70
  139. data/install-sh +0 -501
  140. data/missing +0 -215
  141. data/post-autoconf.rb +0 -22
  142. data/post-automake.rb +0 -28
  143. data/rice/Address_Registration_Guard.cpp +0 -22
  144. data/rice/Arg_impl.hpp +0 -129
  145. data/rice/Arg_operators.cpp +0 -21
  146. data/rice/Arg_operators.hpp +0 -19
  147. data/rice/Array.hpp +0 -214
  148. data/rice/Array.ipp +0 -256
  149. data/rice/Builtin_Object.hpp +0 -8
  150. data/rice/Builtin_Object.ipp +0 -50
  151. data/rice/Builtin_Object_defn.hpp +0 -50
  152. data/rice/Class.cpp +0 -57
  153. data/rice/Class.hpp +0 -8
  154. data/rice/Class.ipp +0 -6
  155. data/rice/Class_defn.hpp +0 -84
  156. data/rice/Data_Type.cpp +0 -54
  157. data/rice/Data_Type_fwd.hpp +0 -12
  158. data/rice/Director.cpp +0 -13
  159. data/rice/Exception.cpp +0 -54
  160. data/rice/Exception_Base.hpp +0 -8
  161. data/rice/Exception_Base.ipp +0 -13
  162. data/rice/Exception_Base_defn.hpp +0 -27
  163. data/rice/Hash.hpp +0 -230
  164. data/rice/Hash.ipp +0 -329
  165. data/rice/Identifier.cpp +0 -8
  166. data/rice/Jump_Tag.hpp +0 -24
  167. data/rice/Makefile.am +0 -121
  168. data/rice/Makefile.in +0 -884
  169. data/rice/Module.cpp +0 -84
  170. data/rice/Module.hpp +0 -8
  171. data/rice/Module.ipp +0 -6
  172. data/rice/Module_defn.hpp +0 -88
  173. data/rice/Module_impl.hpp +0 -281
  174. data/rice/Module_impl.ipp +0 -345
  175. data/rice/Object.cpp +0 -169
  176. data/rice/Object.hpp +0 -8
  177. data/rice/Object.ipp +0 -33
  178. data/rice/Object_defn.hpp +0 -214
  179. data/rice/Require_Guard.hpp +0 -21
  180. data/rice/String.cpp +0 -89
  181. data/rice/String.hpp +0 -91
  182. data/rice/Struct.cpp +0 -117
  183. data/rice/Struct.hpp +0 -162
  184. data/rice/Struct.ipp +0 -26
  185. data/rice/Symbol.cpp +0 -25
  186. data/rice/Symbol.hpp +0 -66
  187. data/rice/Symbol.ipp +0 -44
  188. data/rice/config.hpp +0 -47
  189. data/rice/config.hpp.in +0 -46
  190. data/rice/detail/Arguments.hpp +0 -118
  191. data/rice/detail/Auto_Function_Wrapper.hpp +0 -898
  192. data/rice/detail/Auto_Function_Wrapper.ipp +0 -3181
  193. data/rice/detail/Auto_Member_Function_Wrapper.hpp +0 -897
  194. data/rice/detail/Auto_Member_Function_Wrapper.ipp +0 -2501
  195. data/rice/detail/Caster.hpp +0 -103
  196. data/rice/detail/Not_Copyable.hpp +0 -25
  197. data/rice/detail/Wrapped_Function.hpp +0 -33
  198. data/rice/detail/cfp.hpp +0 -24
  199. data/rice/detail/cfp.ipp +0 -51
  200. data/rice/detail/check_ruby_type.cpp +0 -27
  201. data/rice/detail/check_ruby_type.hpp +0 -23
  202. data/rice/detail/creation_funcs.hpp +0 -37
  203. data/rice/detail/creation_funcs.ipp +0 -36
  204. data/rice/detail/define_method_and_auto_wrap.hpp +0 -31
  205. data/rice/detail/define_method_and_auto_wrap.ipp +0 -30
  206. data/rice/detail/demangle.cpp +0 -56
  207. data/rice/detail/demangle.hpp +0 -19
  208. data/rice/detail/env.hpp +0 -11
  209. data/rice/detail/method_data.cpp +0 -92
  210. data/rice/detail/node.hpp +0 -13
  211. data/rice/detail/protect.cpp +0 -29
  212. data/rice/detail/protect.hpp +0 -34
  213. data/rice/detail/ruby_version_code.hpp +0 -6
  214. data/rice/detail/ruby_version_code.hpp.in +0 -6
  215. data/rice/detail/st.hpp +0 -22
  216. data/rice/detail/win32.hpp +0 -16
  217. data/rice/detail/wrap_function.hpp +0 -66
  218. data/rice/protect.hpp +0 -38
  219. data/rice/protect.ipp +0 -1134
  220. data/rice/rubypp.rb +0 -97
  221. data/rice/to_from_ruby.hpp +0 -8
  222. data/rice/to_from_ruby.ipp +0 -418
  223. data/rice/to_from_ruby_defn.hpp +0 -70
  224. data/ruby.ac +0 -135
  225. data/ruby/Makefile.am +0 -1
  226. data/ruby/Makefile.in +0 -628
  227. data/ruby/lib/Makefile.am +0 -3
  228. data/ruby/lib/Makefile.in +0 -506
  229. data/ruby/lib/mkmf-rice.rb.in +0 -217
  230. data/ruby/lib/version.rb +0 -3
  231. data/sample/Makefile.am +0 -53
  232. data/sample/Makefile.in +0 -495
  233. data/test/Makefile.am +0 -73
  234. data/test/Makefile.in +0 -1219
  235. data/test/ext/Makefile.am +0 -41
  236. data/test/ext/Makefile.in +0 -483
  237. data/test/test_rice.rb +0 -45
@@ -1,19 +0,0 @@
1
- #ifndef Rice__detail__demangle__hpp_
2
- #define Rice__detail__demangle__hpp_
3
-
4
- #include <string>
5
-
6
- namespace Rice
7
- {
8
-
9
- namespace detail
10
- {
11
-
12
- std::string demangle(char const * mangled_name);
13
- std::string demangle(std::string const & mangled_name);
14
-
15
- } // detail
16
-
17
- } // Rice
18
-
19
- #endif // Rice__detail__demangle__hpp_
data/rice/detail/env.hpp DELETED
@@ -1,11 +0,0 @@
1
- #ifndef Rice__detail__env__hpp_
2
- #define Rice__detail__env__hpp_
3
-
4
- /**
5
- * Helper header for the env.h ruby include file, which does
6
- * not have extern "C"
7
- */
8
-
9
- #include "ruby_version_code.hpp"
10
-
11
- #endif
@@ -1,92 +0,0 @@
1
- #include "method_data.hpp"
2
- #include "ruby.hpp"
3
-
4
- // TODO: This is silly, autoconf...
5
- #undef PACKAGE_NAME
6
- #undef PACKAGE_STRING
7
- #undef PACKAGE_TARNAME
8
- #undef PACKAGE_VERSION
9
- #include "../config.hpp"
10
-
11
- #define RICE_ID rb_intern("__rice__")
12
-
13
- VALUE
14
- Rice::detail::
15
- method_data()
16
- {
17
- ID id;
18
- VALUE klass;
19
- if (!rb_frame_method_id_and_class(&id, &klass))
20
- {
21
- rb_raise(
22
- rb_eRuntimeError,
23
- "Cannot get method id and class for function");
24
- }
25
-
26
- if (rb_type(klass) == T_ICLASS) {
27
- klass = rb_class_of(klass);
28
- }
29
-
30
- VALUE store = rb_ivar_get(klass, RICE_ID);
31
- return (store == Qnil) ? Qnil : rb_ivar_get(store, id);
32
- }
33
-
34
- // Ruby 2.7 now includes a similarly named macro that uses templates to
35
- // pick the right overload for the underlying function. That doesn't work
36
- // for our cases because we are using this method dynamically and get a
37
- // compilation error otherwise. This removes the macro and lets us fall
38
- // back to the C-API underneath again.
39
- #undef rb_define_method_id
40
-
41
- // Define a method and attach data to it.
42
- // The method looks to ruby like a normal aliased CFUNC, with a modified
43
- // origin class.
44
- //
45
- // How this works:
46
- //
47
- // To store method data and have it registered with the GC, we need a
48
- // "slot" to put it in. This "slot" must be recognized and marked by
49
- // the garbage collector. There happens to be such a place we can put
50
- // data, and it has to do with aliased methods. When Ruby creates an
51
- // alias for a method, it stores a reference to the original class in
52
- // the method entry. The form of the method entry differs from ruby
53
- // version to ruby version, but the concept is the same across all of
54
- // them.
55
- //
56
- // In Rice, we make use of this by attach the data to a dummy object
57
- // (store) in the class variables table.
58
- //
59
- // When Ruby makes a method call, it stores the class Object and method
60
- // ID in the current stack frame. When Ruby calls into Rice, we grab
61
- // the class and method ID from the stack frame, then pull the data out
62
- // of the class. The data item is then used to determine how to convert
63
- // arguments and return type, how to handle exceptions, etc.
64
- //
65
- VALUE
66
- Rice::detail::
67
- define_method_with_data(
68
- VALUE klass, ID id, VALUE (*cfunc)(ANYARGS), int arity, VALUE data)
69
- {
70
- VALUE store = rb_attr_get(klass, RICE_ID);
71
-
72
- if (store == Qnil) {
73
- store = rb_obj_alloc(rb_cObject);
74
- // store is stored in the instance variables table with
75
- // name "__rice__".
76
- // since "__rice__" does not have the @ prefix,
77
- // so it can never be read at the Ruby level.
78
- rb_ivar_set(klass, RICE_ID, store);
79
- }
80
-
81
- rb_ivar_set(store, id, data);
82
-
83
- // Create the aliased method on the origin class
84
- rb_define_method_id(
85
- klass,
86
- id,
87
- cfunc,
88
- arity);
89
-
90
- return Qnil;
91
- }
92
-
data/rice/detail/node.hpp DELETED
@@ -1,13 +0,0 @@
1
- #ifndef Rice__detail__node__hpp_
2
- #define Rice__detail__node__hpp_
3
-
4
- /**
5
- * Helper header for the node.h ruby include file, which does
6
- * not have extern "C"
7
- */
8
-
9
- extern "C" {
10
- #include "node.h"
11
- }
12
-
13
- #endif
@@ -1,29 +0,0 @@
1
- #include "protect.hpp"
2
- #include "../Exception.hpp"
3
- #include "../Jump_Tag.hpp"
4
-
5
- #ifndef TAG_RAISE
6
- #define TAG_RAISE 0x6
7
- #endif
8
-
9
- VALUE Rice::detail::
10
- protect(
11
- RUBY_VALUE_FUNC f,
12
- VALUE arg)
13
- {
14
- int state = 0;
15
- VALUE retval = rb_protect(f, arg, &state);
16
- if(state != 0)
17
- {
18
- VALUE err = rb_errinfo();
19
- if(state == TAG_RAISE && RTEST(err))
20
- {
21
- // TODO: convert NoMemoryError into bad_alloc?
22
- rb_set_errinfo(Rice::Nil);
23
- throw Rice::Exception(err);
24
- }
25
- throw Jump_Tag(state);
26
- }
27
- return retval;
28
- }
29
-
@@ -1,34 +0,0 @@
1
- #ifndef Rice__detail__protect__hpp_
2
- #define Rice__detail__protect__hpp_
3
-
4
- #include "ruby.hpp"
5
-
6
- /*! \file
7
- * \brief Functions for making exception-safe calls into Ruby code.
8
- * These are the building blocks for building other exception-safe
9
- * helper functions.
10
- */
11
-
12
- namespace Rice
13
- {
14
-
15
- namespace detail
16
- {
17
-
18
- //! Call the given function, converting Ruby exceptions to C++
19
- //! exceptions.
20
- /*! Call the function f with the parameter arg If f raises a Ruby
21
- * exception, then the exception is re-thrown as an Exception. If f
22
- * exits with any other non-zero tag (e.g. a Symbol is thrown), then the
23
- * tag is re-thrown as a Jump_Tag.
24
- */
25
- VALUE protect(
26
- RUBY_VALUE_FUNC f,
27
- VALUE arg);
28
-
29
- } // namespace detail
30
-
31
- } // namespace Rice
32
-
33
- #endif // Rice__detail__protect__hpp_
34
-
@@ -1,6 +0,0 @@
1
- #ifndef Rice__detail__ruby_version_code__hpp
2
- #define Rice__detail__ruby_version_code__hpp
3
-
4
- #define RICE__RUBY_VERSION_CODE 300
5
-
6
- #endif // Rice__detail__ruby_version_code__hpp
@@ -1,6 +0,0 @@
1
- #ifndef Rice__detail__ruby_version_code__hpp
2
- #define Rice__detail__ruby_version_code__hpp
3
-
4
- #define RICE__RUBY_VERSION_CODE @RUBY_VERSION_CODE@
5
-
6
- #endif // Rice__detail__ruby_version_code__hpp
data/rice/detail/st.hpp DELETED
@@ -1,22 +0,0 @@
1
- #ifndef Exc_Ruby___cpp__st__hpp_
2
- #define Exc_Ruby___cpp__st__hpp_
3
-
4
- /*! \file
5
- * \brief Hacks to allow functions in st.h to be called from C++
6
- * programs.
7
- */
8
-
9
- #include "ruby.hpp"
10
-
11
- // Ruby doesn't put extern "C" around st.h
12
-
13
- extern "C"
14
- {
15
- #ifdef RUBY_VM
16
- #include "ruby/st.h"
17
- #else
18
- #include "st.h"
19
- #endif
20
- }
21
-
22
- #endif // Exc_Ruby___cpp__st__hpp_
@@ -1,16 +0,0 @@
1
- #ifndef Rice__detail__win32__hpp_
2
- #define Rice__detail__win32__hpp_
3
-
4
- /*! \file
5
- * \brief Undefine all the evil macros that are defined in win32.h
6
- */
7
-
8
- // None of these macros are used in Ruby header files
9
- #undef bind
10
- #undef read
11
- #undef write
12
- #undef send
13
- #undef recv
14
- #undef times
15
-
16
- #endif // Rice__detail__win32__hpp_
@@ -1,66 +0,0 @@
1
- #ifndef Rice__detail__wrap_function__hpp_
2
- #define Rice__detail__wrap_function__hpp_
3
-
4
- // This causes problems with certain C++ libraries
5
- #undef TYPE
6
-
7
- #include "Exception_Handler.hpp"
8
- #include "Wrapped_Function.hpp"
9
- #include "../Object_defn.hpp"
10
- #include "../Data_Object.hpp"
11
- #include "Arguments.hpp"
12
- #include "Auto_Function_Wrapper.hpp"
13
- #include "Auto_Member_Function_Wrapper.hpp"
14
-
15
- namespace Rice
16
- {
17
-
18
- namespace detail
19
- {
20
-
21
- template<typename Ret_T>
22
- Wrapped_Function * wrap_function(
23
- Ret_T (*func)(),
24
- Data_Object<Exception_Handler> handler,
25
- Arguments* arguments)
26
- {
27
- typedef Ret_T (*Func)();
28
- return new Auto_Function_Wrapper<Func, Ret_T>(func, handler, arguments);
29
- }
30
-
31
- template<typename Ret_T, typename ...Arg_T>
32
- Wrapped_Function * wrap_function(
33
- Ret_T (*func)(Arg_T...),
34
- Data_Object<Exception_Handler> handler,
35
- Arguments* arguments)
36
- {
37
- typedef Ret_T (*Func)(Arg_T...);
38
- return new Auto_Function_Wrapper<Func, Ret_T, Arg_T...>(func, handler, arguments);
39
- }
40
-
41
- template<typename Ret_T, typename Self_T, typename ...Arg_T>
42
- Wrapped_Function * wrap_function(
43
- Ret_T (Self_T::*func)(Arg_T...),
44
- Data_Object<Exception_Handler> handler,
45
- Arguments* arguments)
46
- {
47
- typedef Ret_T (Self_T::*Func)(Arg_T...);
48
- return new Auto_Member_Function_Wrapper<Func, Ret_T, Self_T, Arg_T...>(func, handler, arguments);
49
- }
50
-
51
- template<typename Ret_T, typename Self_T, typename ...Arg_T>
52
- Wrapped_Function * wrap_function(
53
- Ret_T (Self_T::*func)(Arg_T...) const,
54
- Data_Object<Exception_Handler> handler,
55
- Arguments* arguments)
56
- {
57
- typedef Ret_T (Self_T::*Func)(Arg_T...) const;
58
- return new Auto_Member_Function_Wrapper<Func, Ret_T, Self_T, Arg_T...>(func, handler, arguments);
59
- }
60
-
61
- } // namespace detail
62
-
63
- } // namespace Rice
64
-
65
- #endif // Rice__detail__wrap_function__hpp_
66
-
data/rice/protect.hpp DELETED
@@ -1,38 +0,0 @@
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
-
data/rice/protect.ipp DELETED
@@ -1,1134 +0,0 @@
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
-