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,3694 @@
1
+ #ifndef Rice__detail__Auto_Function_Wrapper__ipp_
2
+ #define Rice__detail__Auto_Function_Wrapper__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 "method_data.hpp"
11
+ #include "../ruby_try_catch.hpp"
12
+ #include "../to_from_ruby.hpp"
13
+ #include "traits.hpp"
14
+ namespace Rice
15
+ {
16
+
17
+ namespace detail
18
+ {
19
+
20
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T, typename Arg14_T, typename Arg15_T>
21
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T, Arg15_T>::
22
+ Auto_Function_Wrapper(
23
+ Func func,
24
+ Data_Object<Exception_Handler> handler,
25
+ Arguments* arguments)
26
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
27
+ , func_(func)
28
+ , handler_(handler)
29
+ , handler_guard_(&handler_)
30
+ {
31
+ if(arguments == 0) {
32
+ arguments_ = new Arguments();
33
+ } else {
34
+ arguments_ = arguments;
35
+ }
36
+ }
37
+
38
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T, typename Arg14_T, typename Arg15_T>
39
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T, Arg15_T>::
40
+ ~Auto_Function_Wrapper()
41
+ {
42
+ if(arguments_) { delete arguments_; }
43
+ }
44
+
45
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T, typename Arg14_T, typename Arg15_T>
46
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T, Arg15_T>::
47
+ call(int argc, VALUE *argv, VALUE self)
48
+ {
49
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T, Arg15_T> * wrapper = 0;
50
+ try
51
+ {
52
+ Data_Object<Wrapped_Function> data(detail::method_data());
53
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T, Arg15_T> *)data.get();
54
+ Arguments* args = wrapper->arguments_;
55
+
56
+ bool hasSelf = (self && self != Qnil);
57
+ if(args->count() >= 0) {
58
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
59
+ } else {
60
+ hasSelf = hasSelf && argc == Num_Args -1;
61
+ }
62
+
63
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9, varg10, varg11, varg12, varg13, varg14, varg15;
64
+
65
+ if(hasSelf) {
66
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
67
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14, &varg15);
68
+
69
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
70
+
71
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
72
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
73
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
74
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
75
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
76
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
77
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
78
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
79
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
80
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
81
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
82
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
83
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
84
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
85
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
86
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
87
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
88
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(8, varg8);
89
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
90
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(9, varg9);
91
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
92
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(10, varg10);
93
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
94
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(11, varg11);
95
+ typedef typename sanitize< Arg13_T >::Type Arg13_Type;
96
+ Arg13_Type arg13 = args->getArgumentOrDefault<Arg13_Type>(12, varg12);
97
+ typedef typename sanitize< Arg14_T >::Type Arg14_Type;
98
+ Arg14_Type arg14 = args->getArgumentOrDefault<Arg14_Type>(13, varg13);
99
+ typedef typename sanitize< Arg15_T >::Type Arg15_Type;
100
+ Arg15_Type arg15 = args->getArgumentOrDefault<Arg15_Type>(14, varg14);
101
+
102
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15));
103
+ } else {
104
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
105
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14, &varg15);
106
+
107
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
108
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
109
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
110
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
111
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
112
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
113
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
114
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
115
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
116
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
117
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
118
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
119
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
120
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
121
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
122
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
123
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
124
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
125
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
126
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(9, varg9);
127
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
128
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(10, varg10);
129
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
130
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(11, varg11);
131
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
132
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(12, varg12);
133
+ typedef typename sanitize< Arg13_T >::Type Arg13_Type;
134
+ Arg13_Type arg13 = args->getArgumentOrDefault<Arg13_Type>(13, varg13);
135
+ typedef typename sanitize< Arg14_T >::Type Arg14_Type;
136
+ Arg14_Type arg14 = args->getArgumentOrDefault<Arg14_Type>(14, varg14);
137
+ typedef typename sanitize< Arg15_T >::Type Arg15_Type;
138
+ Arg15_Type arg15 = args->getArgumentOrDefault<Arg15_Type>(15, varg15);
139
+
140
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15));
141
+ }
142
+ }
143
+ catch(...)
144
+ {
145
+ RUBY_TRY
146
+ {
147
+ if(wrapper)
148
+ {
149
+ return wrapper->handler_->handle_exception();
150
+ }
151
+ else
152
+ {
153
+ throw;
154
+ }
155
+ }
156
+ RUBY_CATCH
157
+ }
158
+ }
159
+
160
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T, typename Arg14_T, typename Arg15_T>
161
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T, Arg15_T>::
162
+ Auto_Function_Wrapper(
163
+ Func func,
164
+ Data_Object<Exception_Handler> handler,
165
+ Arguments* arguments)
166
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
167
+ , func_(func)
168
+ , handler_(handler)
169
+ , handler_guard_(&handler_)
170
+ {
171
+ if(arguments == 0) {
172
+ arguments_ = new Arguments();
173
+ } else {
174
+ arguments_ = arguments;
175
+ }
176
+ }
177
+
178
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T, typename Arg14_T, typename Arg15_T>
179
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T, Arg15_T>::
180
+ ~Auto_Function_Wrapper()
181
+ {
182
+ if(arguments_) { delete arguments_; }
183
+ }
184
+
185
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T, typename Arg14_T, typename Arg15_T>
186
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T, Arg15_T>::
187
+ call(int argc, VALUE* argv, VALUE self)
188
+ {
189
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T, Arg15_T> * wrapper = 0;
190
+ try
191
+ {
192
+ Data_Object<Wrapped_Function> data(detail::method_data());
193
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T, Arg15_T> *)data.get();
194
+ Arguments* args = wrapper->arguments_;
195
+
196
+ bool hasSelf = (self && self != Qnil);
197
+ if(args->count() >= 0) {
198
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
199
+ } else {
200
+ hasSelf = hasSelf && argc == Num_Args -1;
201
+ }
202
+
203
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9, varg10, varg11, varg12, varg13, varg14, varg15;
204
+
205
+ if(hasSelf) {
206
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
207
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14, &varg15);
208
+
209
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
210
+
211
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
212
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
213
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
214
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
215
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
216
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
217
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
218
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
219
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
220
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
221
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
222
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
223
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
224
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
225
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
226
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
227
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
228
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(8, varg8);
229
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
230
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(9, varg9);
231
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
232
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(10, varg10);
233
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
234
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(11, varg11);
235
+ typedef typename sanitize< Arg13_T >::Type Arg13_Type;
236
+ Arg13_Type arg13 = args->getArgumentOrDefault<Arg13_Type>(12, varg12);
237
+ typedef typename sanitize< Arg14_T >::Type Arg14_Type;
238
+ Arg14_Type arg14 = args->getArgumentOrDefault<Arg14_Type>(13, varg13);
239
+ typedef typename sanitize< Arg15_T >::Type Arg15_Type;
240
+ Arg15_Type arg15 = args->getArgumentOrDefault<Arg15_Type>(14, varg14);
241
+
242
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15);
243
+ return Qnil;
244
+ } else {
245
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
246
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14, &varg15);
247
+
248
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
249
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
250
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
251
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
252
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
253
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
254
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
255
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
256
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
257
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
258
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
259
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
260
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
261
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
262
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
263
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
264
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
265
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
266
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
267
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(9, varg9);
268
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
269
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(10, varg10);
270
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
271
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(11, varg11);
272
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
273
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(12, varg12);
274
+ typedef typename sanitize< Arg13_T >::Type Arg13_Type;
275
+ Arg13_Type arg13 = args->getArgumentOrDefault<Arg13_Type>(13, varg13);
276
+ typedef typename sanitize< Arg14_T >::Type Arg14_Type;
277
+ Arg14_Type arg14 = args->getArgumentOrDefault<Arg14_Type>(14, varg14);
278
+ typedef typename sanitize< Arg15_T >::Type Arg15_Type;
279
+ Arg15_Type arg15 = args->getArgumentOrDefault<Arg15_Type>(15, varg15);
280
+
281
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15);
282
+ return Qnil;
283
+ }
284
+ }
285
+ catch(...)
286
+ {
287
+ RUBY_TRY
288
+ {
289
+ if(wrapper)
290
+ {
291
+ return wrapper->handler_->handle_exception();
292
+ }
293
+ else
294
+ {
295
+ throw;
296
+ }
297
+ }
298
+ RUBY_CATCH
299
+ }
300
+ }
301
+
302
+ // ---------------------------------------------------------------------
303
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T, typename Arg14_T>
304
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T>::
305
+ Auto_Function_Wrapper(
306
+ Func func,
307
+ Data_Object<Exception_Handler> handler,
308
+ Arguments* arguments)
309
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
310
+ , func_(func)
311
+ , handler_(handler)
312
+ , handler_guard_(&handler_)
313
+ {
314
+ if(arguments == 0) {
315
+ arguments_ = new Arguments();
316
+ } else {
317
+ arguments_ = arguments;
318
+ }
319
+ }
320
+
321
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T, typename Arg14_T>
322
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T>::
323
+ ~Auto_Function_Wrapper()
324
+ {
325
+ if(arguments_) { delete arguments_; }
326
+ }
327
+
328
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T, typename Arg14_T>
329
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T>::
330
+ call(int argc, VALUE *argv, VALUE self)
331
+ {
332
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T> * wrapper = 0;
333
+ try
334
+ {
335
+ Data_Object<Wrapped_Function> data(detail::method_data());
336
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T> *)data.get();
337
+ Arguments* args = wrapper->arguments_;
338
+
339
+ bool hasSelf = (self && self != Qnil);
340
+ if(args->count() >= 0) {
341
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
342
+ } else {
343
+ hasSelf = hasSelf && argc == Num_Args -1;
344
+ }
345
+
346
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9, varg10, varg11, varg12, varg13, varg14;
347
+
348
+ if(hasSelf) {
349
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
350
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14);
351
+
352
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
353
+
354
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
355
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
356
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
357
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
358
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
359
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
360
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
361
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
362
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
363
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
364
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
365
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
366
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
367
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
368
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
369
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
370
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
371
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(8, varg8);
372
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
373
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(9, varg9);
374
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
375
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(10, varg10);
376
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
377
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(11, varg11);
378
+ typedef typename sanitize< Arg13_T >::Type Arg13_Type;
379
+ Arg13_Type arg13 = args->getArgumentOrDefault<Arg13_Type>(12, varg12);
380
+ typedef typename sanitize< Arg14_T >::Type Arg14_Type;
381
+ Arg14_Type arg14 = args->getArgumentOrDefault<Arg14_Type>(13, varg13);
382
+
383
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14));
384
+ } else {
385
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
386
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14);
387
+
388
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
389
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
390
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
391
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
392
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
393
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
394
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
395
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
396
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
397
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
398
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
399
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
400
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
401
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
402
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
403
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
404
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
405
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
406
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
407
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(9, varg9);
408
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
409
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(10, varg10);
410
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
411
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(11, varg11);
412
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
413
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(12, varg12);
414
+ typedef typename sanitize< Arg13_T >::Type Arg13_Type;
415
+ Arg13_Type arg13 = args->getArgumentOrDefault<Arg13_Type>(13, varg13);
416
+ typedef typename sanitize< Arg14_T >::Type Arg14_Type;
417
+ Arg14_Type arg14 = args->getArgumentOrDefault<Arg14_Type>(14, varg14);
418
+
419
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14));
420
+ }
421
+ }
422
+ catch(...)
423
+ {
424
+ RUBY_TRY
425
+ {
426
+ if(wrapper)
427
+ {
428
+ return wrapper->handler_->handle_exception();
429
+ }
430
+ else
431
+ {
432
+ throw;
433
+ }
434
+ }
435
+ RUBY_CATCH
436
+ }
437
+ }
438
+
439
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T, typename Arg14_T>
440
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T>::
441
+ Auto_Function_Wrapper(
442
+ Func func,
443
+ Data_Object<Exception_Handler> handler,
444
+ Arguments* arguments)
445
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
446
+ , func_(func)
447
+ , handler_(handler)
448
+ , handler_guard_(&handler_)
449
+ {
450
+ if(arguments == 0) {
451
+ arguments_ = new Arguments();
452
+ } else {
453
+ arguments_ = arguments;
454
+ }
455
+ }
456
+
457
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T, typename Arg14_T>
458
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T>::
459
+ ~Auto_Function_Wrapper()
460
+ {
461
+ if(arguments_) { delete arguments_; }
462
+ }
463
+
464
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T, typename Arg14_T>
465
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T>::
466
+ call(int argc, VALUE* argv, VALUE self)
467
+ {
468
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T> * wrapper = 0;
469
+ try
470
+ {
471
+ Data_Object<Wrapped_Function> data(detail::method_data());
472
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T, Arg14_T> *)data.get();
473
+ Arguments* args = wrapper->arguments_;
474
+
475
+ bool hasSelf = (self && self != Qnil);
476
+ if(args->count() >= 0) {
477
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
478
+ } else {
479
+ hasSelf = hasSelf && argc == Num_Args -1;
480
+ }
481
+
482
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9, varg10, varg11, varg12, varg13, varg14;
483
+
484
+ if(hasSelf) {
485
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
486
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14);
487
+
488
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
489
+
490
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
491
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
492
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
493
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
494
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
495
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
496
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
497
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
498
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
499
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
500
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
501
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
502
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
503
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
504
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
505
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
506
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
507
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(8, varg8);
508
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
509
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(9, varg9);
510
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
511
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(10, varg10);
512
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
513
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(11, varg11);
514
+ typedef typename sanitize< Arg13_T >::Type Arg13_Type;
515
+ Arg13_Type arg13 = args->getArgumentOrDefault<Arg13_Type>(12, varg12);
516
+ typedef typename sanitize< Arg14_T >::Type Arg14_Type;
517
+ Arg14_Type arg14 = args->getArgumentOrDefault<Arg14_Type>(13, varg13);
518
+
519
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14);
520
+ return Qnil;
521
+ } else {
522
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
523
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13, &varg14);
524
+
525
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
526
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
527
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
528
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
529
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
530
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
531
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
532
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
533
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
534
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
535
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
536
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
537
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
538
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
539
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
540
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
541
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
542
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
543
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
544
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(9, varg9);
545
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
546
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(10, varg10);
547
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
548
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(11, varg11);
549
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
550
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(12, varg12);
551
+ typedef typename sanitize< Arg13_T >::Type Arg13_Type;
552
+ Arg13_Type arg13 = args->getArgumentOrDefault<Arg13_Type>(13, varg13);
553
+ typedef typename sanitize< Arg14_T >::Type Arg14_Type;
554
+ Arg14_Type arg14 = args->getArgumentOrDefault<Arg14_Type>(14, varg14);
555
+
556
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14);
557
+ return Qnil;
558
+ }
559
+ }
560
+ catch(...)
561
+ {
562
+ RUBY_TRY
563
+ {
564
+ if(wrapper)
565
+ {
566
+ return wrapper->handler_->handle_exception();
567
+ }
568
+ else
569
+ {
570
+ throw;
571
+ }
572
+ }
573
+ RUBY_CATCH
574
+ }
575
+ }
576
+
577
+ // ---------------------------------------------------------------------
578
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T>
579
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T>::
580
+ Auto_Function_Wrapper(
581
+ Func func,
582
+ Data_Object<Exception_Handler> handler,
583
+ Arguments* arguments)
584
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
585
+ , func_(func)
586
+ , handler_(handler)
587
+ , handler_guard_(&handler_)
588
+ {
589
+ if(arguments == 0) {
590
+ arguments_ = new Arguments();
591
+ } else {
592
+ arguments_ = arguments;
593
+ }
594
+ }
595
+
596
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T>
597
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T>::
598
+ ~Auto_Function_Wrapper()
599
+ {
600
+ if(arguments_) { delete arguments_; }
601
+ }
602
+
603
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T>
604
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T>::
605
+ call(int argc, VALUE *argv, VALUE self)
606
+ {
607
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T> * wrapper = 0;
608
+ try
609
+ {
610
+ Data_Object<Wrapped_Function> data(detail::method_data());
611
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T> *)data.get();
612
+ Arguments* args = wrapper->arguments_;
613
+
614
+ bool hasSelf = (self && self != Qnil);
615
+ if(args->count() >= 0) {
616
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
617
+ } else {
618
+ hasSelf = hasSelf && argc == Num_Args -1;
619
+ }
620
+
621
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9, varg10, varg11, varg12, varg13;
622
+
623
+ if(hasSelf) {
624
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
625
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13);
626
+
627
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
628
+
629
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
630
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
631
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
632
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
633
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
634
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
635
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
636
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
637
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
638
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
639
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
640
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
641
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
642
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
643
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
644
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
645
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
646
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(8, varg8);
647
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
648
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(9, varg9);
649
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
650
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(10, varg10);
651
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
652
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(11, varg11);
653
+ typedef typename sanitize< Arg13_T >::Type Arg13_Type;
654
+ Arg13_Type arg13 = args->getArgumentOrDefault<Arg13_Type>(12, varg12);
655
+
656
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13));
657
+ } else {
658
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
659
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13);
660
+
661
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
662
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
663
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
664
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
665
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
666
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
667
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
668
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
669
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
670
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
671
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
672
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
673
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
674
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
675
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
676
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
677
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
678
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
679
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
680
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(9, varg9);
681
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
682
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(10, varg10);
683
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
684
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(11, varg11);
685
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
686
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(12, varg12);
687
+ typedef typename sanitize< Arg13_T >::Type Arg13_Type;
688
+ Arg13_Type arg13 = args->getArgumentOrDefault<Arg13_Type>(13, varg13);
689
+
690
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13));
691
+ }
692
+ }
693
+ catch(...)
694
+ {
695
+ RUBY_TRY
696
+ {
697
+ if(wrapper)
698
+ {
699
+ return wrapper->handler_->handle_exception();
700
+ }
701
+ else
702
+ {
703
+ throw;
704
+ }
705
+ }
706
+ RUBY_CATCH
707
+ }
708
+ }
709
+
710
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T>
711
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T>::
712
+ Auto_Function_Wrapper(
713
+ Func func,
714
+ Data_Object<Exception_Handler> handler,
715
+ Arguments* arguments)
716
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
717
+ , func_(func)
718
+ , handler_(handler)
719
+ , handler_guard_(&handler_)
720
+ {
721
+ if(arguments == 0) {
722
+ arguments_ = new Arguments();
723
+ } else {
724
+ arguments_ = arguments;
725
+ }
726
+ }
727
+
728
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T>
729
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T>::
730
+ ~Auto_Function_Wrapper()
731
+ {
732
+ if(arguments_) { delete arguments_; }
733
+ }
734
+
735
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T, typename Arg13_T>
736
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T>::
737
+ call(int argc, VALUE* argv, VALUE self)
738
+ {
739
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T> * wrapper = 0;
740
+ try
741
+ {
742
+ Data_Object<Wrapped_Function> data(detail::method_data());
743
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T, Arg13_T> *)data.get();
744
+ Arguments* args = wrapper->arguments_;
745
+
746
+ bool hasSelf = (self && self != Qnil);
747
+ if(args->count() >= 0) {
748
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
749
+ } else {
750
+ hasSelf = hasSelf && argc == Num_Args -1;
751
+ }
752
+
753
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9, varg10, varg11, varg12, varg13;
754
+
755
+ if(hasSelf) {
756
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
757
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13);
758
+
759
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
760
+
761
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
762
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
763
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
764
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
765
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
766
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
767
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
768
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
769
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
770
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
771
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
772
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
773
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
774
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
775
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
776
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
777
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
778
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(8, varg8);
779
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
780
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(9, varg9);
781
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
782
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(10, varg10);
783
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
784
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(11, varg11);
785
+ typedef typename sanitize< Arg13_T >::Type Arg13_Type;
786
+ Arg13_Type arg13 = args->getArgumentOrDefault<Arg13_Type>(12, varg12);
787
+
788
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13);
789
+ return Qnil;
790
+ } else {
791
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
792
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12, &varg13);
793
+
794
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
795
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
796
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
797
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
798
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
799
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
800
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
801
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
802
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
803
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
804
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
805
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
806
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
807
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
808
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
809
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
810
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
811
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
812
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
813
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(9, varg9);
814
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
815
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(10, varg10);
816
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
817
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(11, varg11);
818
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
819
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(12, varg12);
820
+ typedef typename sanitize< Arg13_T >::Type Arg13_Type;
821
+ Arg13_Type arg13 = args->getArgumentOrDefault<Arg13_Type>(13, varg13);
822
+
823
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13);
824
+ return Qnil;
825
+ }
826
+ }
827
+ catch(...)
828
+ {
829
+ RUBY_TRY
830
+ {
831
+ if(wrapper)
832
+ {
833
+ return wrapper->handler_->handle_exception();
834
+ }
835
+ else
836
+ {
837
+ throw;
838
+ }
839
+ }
840
+ RUBY_CATCH
841
+ }
842
+ }
843
+
844
+ // ---------------------------------------------------------------------
845
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T>
846
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T>::
847
+ Auto_Function_Wrapper(
848
+ Func func,
849
+ Data_Object<Exception_Handler> handler,
850
+ Arguments* arguments)
851
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
852
+ , func_(func)
853
+ , handler_(handler)
854
+ , handler_guard_(&handler_)
855
+ {
856
+ if(arguments == 0) {
857
+ arguments_ = new Arguments();
858
+ } else {
859
+ arguments_ = arguments;
860
+ }
861
+ }
862
+
863
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T>
864
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T>::
865
+ ~Auto_Function_Wrapper()
866
+ {
867
+ if(arguments_) { delete arguments_; }
868
+ }
869
+
870
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T>
871
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T>::
872
+ call(int argc, VALUE *argv, VALUE self)
873
+ {
874
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T> * wrapper = 0;
875
+ try
876
+ {
877
+ Data_Object<Wrapped_Function> data(detail::method_data());
878
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T> *)data.get();
879
+ Arguments* args = wrapper->arguments_;
880
+
881
+ bool hasSelf = (self && self != Qnil);
882
+ if(args->count() >= 0) {
883
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
884
+ } else {
885
+ hasSelf = hasSelf && argc == Num_Args -1;
886
+ }
887
+
888
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9, varg10, varg11, varg12;
889
+
890
+ if(hasSelf) {
891
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
892
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12);
893
+
894
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
895
+
896
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
897
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
898
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
899
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
900
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
901
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
902
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
903
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
904
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
905
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
906
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
907
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
908
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
909
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
910
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
911
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
912
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
913
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(8, varg8);
914
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
915
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(9, varg9);
916
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
917
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(10, varg10);
918
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
919
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(11, varg11);
920
+
921
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12));
922
+ } else {
923
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
924
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12);
925
+
926
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
927
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
928
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
929
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
930
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
931
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
932
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
933
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
934
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
935
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
936
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
937
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
938
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
939
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
940
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
941
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
942
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
943
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
944
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
945
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(9, varg9);
946
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
947
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(10, varg10);
948
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
949
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(11, varg11);
950
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
951
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(12, varg12);
952
+
953
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12));
954
+ }
955
+ }
956
+ catch(...)
957
+ {
958
+ RUBY_TRY
959
+ {
960
+ if(wrapper)
961
+ {
962
+ return wrapper->handler_->handle_exception();
963
+ }
964
+ else
965
+ {
966
+ throw;
967
+ }
968
+ }
969
+ RUBY_CATCH
970
+ }
971
+ }
972
+
973
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T>
974
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T>::
975
+ Auto_Function_Wrapper(
976
+ Func func,
977
+ Data_Object<Exception_Handler> handler,
978
+ Arguments* arguments)
979
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
980
+ , func_(func)
981
+ , handler_(handler)
982
+ , handler_guard_(&handler_)
983
+ {
984
+ if(arguments == 0) {
985
+ arguments_ = new Arguments();
986
+ } else {
987
+ arguments_ = arguments;
988
+ }
989
+ }
990
+
991
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T>
992
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T>::
993
+ ~Auto_Function_Wrapper()
994
+ {
995
+ if(arguments_) { delete arguments_; }
996
+ }
997
+
998
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T, typename Arg12_T>
999
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T>::
1000
+ call(int argc, VALUE* argv, VALUE self)
1001
+ {
1002
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T> * wrapper = 0;
1003
+ try
1004
+ {
1005
+ Data_Object<Wrapped_Function> data(detail::method_data());
1006
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T, Arg12_T> *)data.get();
1007
+ Arguments* args = wrapper->arguments_;
1008
+
1009
+ bool hasSelf = (self && self != Qnil);
1010
+ if(args->count() >= 0) {
1011
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
1012
+ } else {
1013
+ hasSelf = hasSelf && argc == Num_Args -1;
1014
+ }
1015
+
1016
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9, varg10, varg11, varg12;
1017
+
1018
+ if(hasSelf) {
1019
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
1020
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12);
1021
+
1022
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
1023
+
1024
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1025
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
1026
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1027
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
1028
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1029
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
1030
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1031
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
1032
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1033
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
1034
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1035
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
1036
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1037
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
1038
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1039
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
1040
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
1041
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(8, varg8);
1042
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
1043
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(9, varg9);
1044
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
1045
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(10, varg10);
1046
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
1047
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(11, varg11);
1048
+
1049
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
1050
+ return Qnil;
1051
+ } else {
1052
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
1053
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11, &varg12);
1054
+
1055
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
1056
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
1057
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1058
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
1059
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1060
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
1061
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1062
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
1063
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1064
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
1065
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1066
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
1067
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1068
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
1069
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1070
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
1071
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1072
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
1073
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
1074
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(9, varg9);
1075
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
1076
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(10, varg10);
1077
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
1078
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(11, varg11);
1079
+ typedef typename sanitize< Arg12_T >::Type Arg12_Type;
1080
+ Arg12_Type arg12 = args->getArgumentOrDefault<Arg12_Type>(12, varg12);
1081
+
1082
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
1083
+ return Qnil;
1084
+ }
1085
+ }
1086
+ catch(...)
1087
+ {
1088
+ RUBY_TRY
1089
+ {
1090
+ if(wrapper)
1091
+ {
1092
+ return wrapper->handler_->handle_exception();
1093
+ }
1094
+ else
1095
+ {
1096
+ throw;
1097
+ }
1098
+ }
1099
+ RUBY_CATCH
1100
+ }
1101
+ }
1102
+
1103
+ // ---------------------------------------------------------------------
1104
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T>
1105
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T>::
1106
+ Auto_Function_Wrapper(
1107
+ Func func,
1108
+ Data_Object<Exception_Handler> handler,
1109
+ Arguments* arguments)
1110
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
1111
+ , func_(func)
1112
+ , handler_(handler)
1113
+ , handler_guard_(&handler_)
1114
+ {
1115
+ if(arguments == 0) {
1116
+ arguments_ = new Arguments();
1117
+ } else {
1118
+ arguments_ = arguments;
1119
+ }
1120
+ }
1121
+
1122
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T>
1123
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T>::
1124
+ ~Auto_Function_Wrapper()
1125
+ {
1126
+ if(arguments_) { delete arguments_; }
1127
+ }
1128
+
1129
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T>
1130
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T>::
1131
+ call(int argc, VALUE *argv, VALUE self)
1132
+ {
1133
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T> * wrapper = 0;
1134
+ try
1135
+ {
1136
+ Data_Object<Wrapped_Function> data(detail::method_data());
1137
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T> *)data.get();
1138
+ Arguments* args = wrapper->arguments_;
1139
+
1140
+ bool hasSelf = (self && self != Qnil);
1141
+ if(args->count() >= 0) {
1142
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
1143
+ } else {
1144
+ hasSelf = hasSelf && argc == Num_Args -1;
1145
+ }
1146
+
1147
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9, varg10, varg11;
1148
+
1149
+ if(hasSelf) {
1150
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
1151
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11);
1152
+
1153
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
1154
+
1155
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1156
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
1157
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1158
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
1159
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1160
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
1161
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1162
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
1163
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1164
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
1165
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1166
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
1167
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1168
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
1169
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1170
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
1171
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
1172
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(8, varg8);
1173
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
1174
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(9, varg9);
1175
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
1176
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(10, varg10);
1177
+
1178
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11));
1179
+ } else {
1180
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
1181
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11);
1182
+
1183
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
1184
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
1185
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1186
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
1187
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1188
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
1189
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1190
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
1191
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1192
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
1193
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1194
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
1195
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1196
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
1197
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1198
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
1199
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1200
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
1201
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
1202
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(9, varg9);
1203
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
1204
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(10, varg10);
1205
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
1206
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(11, varg11);
1207
+
1208
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11));
1209
+ }
1210
+ }
1211
+ catch(...)
1212
+ {
1213
+ RUBY_TRY
1214
+ {
1215
+ if(wrapper)
1216
+ {
1217
+ return wrapper->handler_->handle_exception();
1218
+ }
1219
+ else
1220
+ {
1221
+ throw;
1222
+ }
1223
+ }
1224
+ RUBY_CATCH
1225
+ }
1226
+ }
1227
+
1228
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T>
1229
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T>::
1230
+ Auto_Function_Wrapper(
1231
+ Func func,
1232
+ Data_Object<Exception_Handler> handler,
1233
+ Arguments* arguments)
1234
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
1235
+ , func_(func)
1236
+ , handler_(handler)
1237
+ , handler_guard_(&handler_)
1238
+ {
1239
+ if(arguments == 0) {
1240
+ arguments_ = new Arguments();
1241
+ } else {
1242
+ arguments_ = arguments;
1243
+ }
1244
+ }
1245
+
1246
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T>
1247
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T>::
1248
+ ~Auto_Function_Wrapper()
1249
+ {
1250
+ if(arguments_) { delete arguments_; }
1251
+ }
1252
+
1253
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T, typename Arg11_T>
1254
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T>::
1255
+ call(int argc, VALUE* argv, VALUE self)
1256
+ {
1257
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T> * wrapper = 0;
1258
+ try
1259
+ {
1260
+ Data_Object<Wrapped_Function> data(detail::method_data());
1261
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T, Arg11_T> *)data.get();
1262
+ Arguments* args = wrapper->arguments_;
1263
+
1264
+ bool hasSelf = (self && self != Qnil);
1265
+ if(args->count() >= 0) {
1266
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
1267
+ } else {
1268
+ hasSelf = hasSelf && argc == Num_Args -1;
1269
+ }
1270
+
1271
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9, varg10, varg11;
1272
+
1273
+ if(hasSelf) {
1274
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
1275
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11);
1276
+
1277
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
1278
+
1279
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1280
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
1281
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1282
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
1283
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1284
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
1285
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1286
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
1287
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1288
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
1289
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1290
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
1291
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1292
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
1293
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1294
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
1295
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
1296
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(8, varg8);
1297
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
1298
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(9, varg9);
1299
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
1300
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(10, varg10);
1301
+
1302
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11);
1303
+ return Qnil;
1304
+ } else {
1305
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
1306
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10, &varg11);
1307
+
1308
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
1309
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
1310
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1311
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
1312
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1313
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
1314
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1315
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
1316
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1317
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
1318
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1319
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
1320
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1321
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
1322
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1323
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
1324
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1325
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
1326
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
1327
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(9, varg9);
1328
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
1329
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(10, varg10);
1330
+ typedef typename sanitize< Arg11_T >::Type Arg11_Type;
1331
+ Arg11_Type arg11 = args->getArgumentOrDefault<Arg11_Type>(11, varg11);
1332
+
1333
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11);
1334
+ return Qnil;
1335
+ }
1336
+ }
1337
+ catch(...)
1338
+ {
1339
+ RUBY_TRY
1340
+ {
1341
+ if(wrapper)
1342
+ {
1343
+ return wrapper->handler_->handle_exception();
1344
+ }
1345
+ else
1346
+ {
1347
+ throw;
1348
+ }
1349
+ }
1350
+ RUBY_CATCH
1351
+ }
1352
+ }
1353
+
1354
+ // ---------------------------------------------------------------------
1355
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T>
1356
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T>::
1357
+ Auto_Function_Wrapper(
1358
+ Func func,
1359
+ Data_Object<Exception_Handler> handler,
1360
+ Arguments* arguments)
1361
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
1362
+ , func_(func)
1363
+ , handler_(handler)
1364
+ , handler_guard_(&handler_)
1365
+ {
1366
+ if(arguments == 0) {
1367
+ arguments_ = new Arguments();
1368
+ } else {
1369
+ arguments_ = arguments;
1370
+ }
1371
+ }
1372
+
1373
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T>
1374
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T>::
1375
+ ~Auto_Function_Wrapper()
1376
+ {
1377
+ if(arguments_) { delete arguments_; }
1378
+ }
1379
+
1380
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T>
1381
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T>::
1382
+ call(int argc, VALUE *argv, VALUE self)
1383
+ {
1384
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T> * wrapper = 0;
1385
+ try
1386
+ {
1387
+ Data_Object<Wrapped_Function> data(detail::method_data());
1388
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T> *)data.get();
1389
+ Arguments* args = wrapper->arguments_;
1390
+
1391
+ bool hasSelf = (self && self != Qnil);
1392
+ if(args->count() >= 0) {
1393
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
1394
+ } else {
1395
+ hasSelf = hasSelf && argc == Num_Args -1;
1396
+ }
1397
+
1398
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9, varg10;
1399
+
1400
+ if(hasSelf) {
1401
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
1402
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10);
1403
+
1404
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
1405
+
1406
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1407
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
1408
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1409
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
1410
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1411
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
1412
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1413
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
1414
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1415
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
1416
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1417
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
1418
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1419
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
1420
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1421
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
1422
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
1423
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(8, varg8);
1424
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
1425
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(9, varg9);
1426
+
1427
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10));
1428
+ } else {
1429
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
1430
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10);
1431
+
1432
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
1433
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
1434
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1435
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
1436
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1437
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
1438
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1439
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
1440
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1441
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
1442
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1443
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
1444
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1445
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
1446
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1447
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
1448
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1449
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
1450
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
1451
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(9, varg9);
1452
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
1453
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(10, varg10);
1454
+
1455
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10));
1456
+ }
1457
+ }
1458
+ catch(...)
1459
+ {
1460
+ RUBY_TRY
1461
+ {
1462
+ if(wrapper)
1463
+ {
1464
+ return wrapper->handler_->handle_exception();
1465
+ }
1466
+ else
1467
+ {
1468
+ throw;
1469
+ }
1470
+ }
1471
+ RUBY_CATCH
1472
+ }
1473
+ }
1474
+
1475
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T>
1476
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T>::
1477
+ Auto_Function_Wrapper(
1478
+ Func func,
1479
+ Data_Object<Exception_Handler> handler,
1480
+ Arguments* arguments)
1481
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
1482
+ , func_(func)
1483
+ , handler_(handler)
1484
+ , handler_guard_(&handler_)
1485
+ {
1486
+ if(arguments == 0) {
1487
+ arguments_ = new Arguments();
1488
+ } else {
1489
+ arguments_ = arguments;
1490
+ }
1491
+ }
1492
+
1493
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T>
1494
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T>::
1495
+ ~Auto_Function_Wrapper()
1496
+ {
1497
+ if(arguments_) { delete arguments_; }
1498
+ }
1499
+
1500
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T, typename Arg10_T>
1501
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T>::
1502
+ call(int argc, VALUE* argv, VALUE self)
1503
+ {
1504
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T> * wrapper = 0;
1505
+ try
1506
+ {
1507
+ Data_Object<Wrapped_Function> data(detail::method_data());
1508
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T, Arg10_T> *)data.get();
1509
+ Arguments* args = wrapper->arguments_;
1510
+
1511
+ bool hasSelf = (self && self != Qnil);
1512
+ if(args->count() >= 0) {
1513
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
1514
+ } else {
1515
+ hasSelf = hasSelf && argc == Num_Args -1;
1516
+ }
1517
+
1518
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9, varg10;
1519
+
1520
+ if(hasSelf) {
1521
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
1522
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10);
1523
+
1524
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
1525
+
1526
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1527
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
1528
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1529
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
1530
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1531
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
1532
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1533
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
1534
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1535
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
1536
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1537
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
1538
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1539
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
1540
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1541
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
1542
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
1543
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(8, varg8);
1544
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
1545
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(9, varg9);
1546
+
1547
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
1548
+ return Qnil;
1549
+ } else {
1550
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
1551
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9, &varg10);
1552
+
1553
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
1554
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
1555
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1556
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
1557
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1558
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
1559
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1560
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
1561
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1562
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
1563
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1564
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
1565
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1566
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
1567
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1568
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
1569
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1570
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
1571
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
1572
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(9, varg9);
1573
+ typedef typename sanitize< Arg10_T >::Type Arg10_Type;
1574
+ Arg10_Type arg10 = args->getArgumentOrDefault<Arg10_Type>(10, varg10);
1575
+
1576
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
1577
+ return Qnil;
1578
+ }
1579
+ }
1580
+ catch(...)
1581
+ {
1582
+ RUBY_TRY
1583
+ {
1584
+ if(wrapper)
1585
+ {
1586
+ return wrapper->handler_->handle_exception();
1587
+ }
1588
+ else
1589
+ {
1590
+ throw;
1591
+ }
1592
+ }
1593
+ RUBY_CATCH
1594
+ }
1595
+ }
1596
+
1597
+ // ---------------------------------------------------------------------
1598
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T>
1599
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T>::
1600
+ Auto_Function_Wrapper(
1601
+ Func func,
1602
+ Data_Object<Exception_Handler> handler,
1603
+ Arguments* arguments)
1604
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
1605
+ , func_(func)
1606
+ , handler_(handler)
1607
+ , handler_guard_(&handler_)
1608
+ {
1609
+ if(arguments == 0) {
1610
+ arguments_ = new Arguments();
1611
+ } else {
1612
+ arguments_ = arguments;
1613
+ }
1614
+ }
1615
+
1616
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T>
1617
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T>::
1618
+ ~Auto_Function_Wrapper()
1619
+ {
1620
+ if(arguments_) { delete arguments_; }
1621
+ }
1622
+
1623
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T>
1624
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T>::
1625
+ call(int argc, VALUE *argv, VALUE self)
1626
+ {
1627
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T> * wrapper = 0;
1628
+ try
1629
+ {
1630
+ Data_Object<Wrapped_Function> data(detail::method_data());
1631
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T> *)data.get();
1632
+ Arguments* args = wrapper->arguments_;
1633
+
1634
+ bool hasSelf = (self && self != Qnil);
1635
+ if(args->count() >= 0) {
1636
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
1637
+ } else {
1638
+ hasSelf = hasSelf && argc == Num_Args -1;
1639
+ }
1640
+
1641
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9;
1642
+
1643
+ if(hasSelf) {
1644
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
1645
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9);
1646
+
1647
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
1648
+
1649
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1650
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
1651
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1652
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
1653
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1654
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
1655
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1656
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
1657
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1658
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
1659
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1660
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
1661
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1662
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
1663
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1664
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
1665
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
1666
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(8, varg8);
1667
+
1668
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9));
1669
+ } else {
1670
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
1671
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9);
1672
+
1673
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
1674
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
1675
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1676
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
1677
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1678
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
1679
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1680
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
1681
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1682
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
1683
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1684
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
1685
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1686
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
1687
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1688
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
1689
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1690
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
1691
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
1692
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(9, varg9);
1693
+
1694
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9));
1695
+ }
1696
+ }
1697
+ catch(...)
1698
+ {
1699
+ RUBY_TRY
1700
+ {
1701
+ if(wrapper)
1702
+ {
1703
+ return wrapper->handler_->handle_exception();
1704
+ }
1705
+ else
1706
+ {
1707
+ throw;
1708
+ }
1709
+ }
1710
+ RUBY_CATCH
1711
+ }
1712
+ }
1713
+
1714
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T>
1715
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T>::
1716
+ Auto_Function_Wrapper(
1717
+ Func func,
1718
+ Data_Object<Exception_Handler> handler,
1719
+ Arguments* arguments)
1720
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
1721
+ , func_(func)
1722
+ , handler_(handler)
1723
+ , handler_guard_(&handler_)
1724
+ {
1725
+ if(arguments == 0) {
1726
+ arguments_ = new Arguments();
1727
+ } else {
1728
+ arguments_ = arguments;
1729
+ }
1730
+ }
1731
+
1732
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T>
1733
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T>::
1734
+ ~Auto_Function_Wrapper()
1735
+ {
1736
+ if(arguments_) { delete arguments_; }
1737
+ }
1738
+
1739
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T, typename Arg9_T>
1740
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T>::
1741
+ call(int argc, VALUE* argv, VALUE self)
1742
+ {
1743
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T> * wrapper = 0;
1744
+ try
1745
+ {
1746
+ Data_Object<Wrapped_Function> data(detail::method_data());
1747
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T, Arg9_T> *)data.get();
1748
+ Arguments* args = wrapper->arguments_;
1749
+
1750
+ bool hasSelf = (self && self != Qnil);
1751
+ if(args->count() >= 0) {
1752
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
1753
+ } else {
1754
+ hasSelf = hasSelf && argc == Num_Args -1;
1755
+ }
1756
+
1757
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9;
1758
+
1759
+ if(hasSelf) {
1760
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
1761
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9);
1762
+
1763
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
1764
+
1765
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1766
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
1767
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1768
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
1769
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1770
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
1771
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1772
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
1773
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1774
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
1775
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1776
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
1777
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1778
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
1779
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1780
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
1781
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
1782
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(8, varg8);
1783
+
1784
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
1785
+ return Qnil;
1786
+ } else {
1787
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
1788
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8, &varg9);
1789
+
1790
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
1791
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
1792
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1793
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
1794
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1795
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
1796
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1797
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
1798
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1799
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
1800
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1801
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
1802
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1803
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
1804
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1805
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
1806
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1807
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
1808
+ typedef typename sanitize< Arg9_T >::Type Arg9_Type;
1809
+ Arg9_Type arg9 = args->getArgumentOrDefault<Arg9_Type>(9, varg9);
1810
+
1811
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
1812
+ return Qnil;
1813
+ }
1814
+ }
1815
+ catch(...)
1816
+ {
1817
+ RUBY_TRY
1818
+ {
1819
+ if(wrapper)
1820
+ {
1821
+ return wrapper->handler_->handle_exception();
1822
+ }
1823
+ else
1824
+ {
1825
+ throw;
1826
+ }
1827
+ }
1828
+ RUBY_CATCH
1829
+ }
1830
+ }
1831
+
1832
+ // ---------------------------------------------------------------------
1833
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T>
1834
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T>::
1835
+ Auto_Function_Wrapper(
1836
+ Func func,
1837
+ Data_Object<Exception_Handler> handler,
1838
+ Arguments* arguments)
1839
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
1840
+ , func_(func)
1841
+ , handler_(handler)
1842
+ , handler_guard_(&handler_)
1843
+ {
1844
+ if(arguments == 0) {
1845
+ arguments_ = new Arguments();
1846
+ } else {
1847
+ arguments_ = arguments;
1848
+ }
1849
+ }
1850
+
1851
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T>
1852
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T>::
1853
+ ~Auto_Function_Wrapper()
1854
+ {
1855
+ if(arguments_) { delete arguments_; }
1856
+ }
1857
+
1858
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T>
1859
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T>::
1860
+ call(int argc, VALUE *argv, VALUE self)
1861
+ {
1862
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T> * wrapper = 0;
1863
+ try
1864
+ {
1865
+ Data_Object<Wrapped_Function> data(detail::method_data());
1866
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T> *)data.get();
1867
+ Arguments* args = wrapper->arguments_;
1868
+
1869
+ bool hasSelf = (self && self != Qnil);
1870
+ if(args->count() >= 0) {
1871
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
1872
+ } else {
1873
+ hasSelf = hasSelf && argc == Num_Args -1;
1874
+ }
1875
+
1876
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8;
1877
+
1878
+ if(hasSelf) {
1879
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
1880
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8);
1881
+
1882
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
1883
+
1884
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1885
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
1886
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1887
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
1888
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1889
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
1890
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1891
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
1892
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1893
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
1894
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1895
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
1896
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1897
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
1898
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1899
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
1900
+
1901
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8));
1902
+ } else {
1903
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
1904
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8);
1905
+
1906
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
1907
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
1908
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1909
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
1910
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1911
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
1912
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
1913
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
1914
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
1915
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
1916
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
1917
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
1918
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
1919
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
1920
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
1921
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
1922
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
1923
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
1924
+
1925
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8));
1926
+ }
1927
+ }
1928
+ catch(...)
1929
+ {
1930
+ RUBY_TRY
1931
+ {
1932
+ if(wrapper)
1933
+ {
1934
+ return wrapper->handler_->handle_exception();
1935
+ }
1936
+ else
1937
+ {
1938
+ throw;
1939
+ }
1940
+ }
1941
+ RUBY_CATCH
1942
+ }
1943
+ }
1944
+
1945
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T>
1946
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T>::
1947
+ Auto_Function_Wrapper(
1948
+ Func func,
1949
+ Data_Object<Exception_Handler> handler,
1950
+ Arguments* arguments)
1951
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
1952
+ , func_(func)
1953
+ , handler_(handler)
1954
+ , handler_guard_(&handler_)
1955
+ {
1956
+ if(arguments == 0) {
1957
+ arguments_ = new Arguments();
1958
+ } else {
1959
+ arguments_ = arguments;
1960
+ }
1961
+ }
1962
+
1963
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T>
1964
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T>::
1965
+ ~Auto_Function_Wrapper()
1966
+ {
1967
+ if(arguments_) { delete arguments_; }
1968
+ }
1969
+
1970
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T, typename Arg8_T>
1971
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T>::
1972
+ call(int argc, VALUE* argv, VALUE self)
1973
+ {
1974
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T> * wrapper = 0;
1975
+ try
1976
+ {
1977
+ Data_Object<Wrapped_Function> data(detail::method_data());
1978
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T, Arg8_T> *)data.get();
1979
+ Arguments* args = wrapper->arguments_;
1980
+
1981
+ bool hasSelf = (self && self != Qnil);
1982
+ if(args->count() >= 0) {
1983
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
1984
+ } else {
1985
+ hasSelf = hasSelf && argc == Num_Args -1;
1986
+ }
1987
+
1988
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8;
1989
+
1990
+ if(hasSelf) {
1991
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
1992
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8);
1993
+
1994
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
1995
+
1996
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
1997
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
1998
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
1999
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
2000
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2001
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
2002
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2003
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
2004
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
2005
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
2006
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
2007
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
2008
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
2009
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
2010
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
2011
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(7, varg7);
2012
+
2013
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
2014
+ return Qnil;
2015
+ } else {
2016
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
2017
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7, &varg8);
2018
+
2019
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
2020
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
2021
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2022
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
2023
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2024
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
2025
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2026
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
2027
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2028
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
2029
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
2030
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
2031
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
2032
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
2033
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
2034
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
2035
+ typedef typename sanitize< Arg8_T >::Type Arg8_Type;
2036
+ Arg8_Type arg8 = args->getArgumentOrDefault<Arg8_Type>(8, varg8);
2037
+
2038
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
2039
+ return Qnil;
2040
+ }
2041
+ }
2042
+ catch(...)
2043
+ {
2044
+ RUBY_TRY
2045
+ {
2046
+ if(wrapper)
2047
+ {
2048
+ return wrapper->handler_->handle_exception();
2049
+ }
2050
+ else
2051
+ {
2052
+ throw;
2053
+ }
2054
+ }
2055
+ RUBY_CATCH
2056
+ }
2057
+ }
2058
+
2059
+ // ---------------------------------------------------------------------
2060
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T>
2061
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T>::
2062
+ Auto_Function_Wrapper(
2063
+ Func func,
2064
+ Data_Object<Exception_Handler> handler,
2065
+ Arguments* arguments)
2066
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
2067
+ , func_(func)
2068
+ , handler_(handler)
2069
+ , handler_guard_(&handler_)
2070
+ {
2071
+ if(arguments == 0) {
2072
+ arguments_ = new Arguments();
2073
+ } else {
2074
+ arguments_ = arguments;
2075
+ }
2076
+ }
2077
+
2078
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T>
2079
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T>::
2080
+ ~Auto_Function_Wrapper()
2081
+ {
2082
+ if(arguments_) { delete arguments_; }
2083
+ }
2084
+
2085
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T>
2086
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T>::
2087
+ call(int argc, VALUE *argv, VALUE self)
2088
+ {
2089
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T> * wrapper = 0;
2090
+ try
2091
+ {
2092
+ Data_Object<Wrapped_Function> data(detail::method_data());
2093
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T> *)data.get();
2094
+ Arguments* args = wrapper->arguments_;
2095
+
2096
+ bool hasSelf = (self && self != Qnil);
2097
+ if(args->count() >= 0) {
2098
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
2099
+ } else {
2100
+ hasSelf = hasSelf && argc == Num_Args -1;
2101
+ }
2102
+
2103
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7;
2104
+
2105
+ if(hasSelf) {
2106
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
2107
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7);
2108
+
2109
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
2110
+
2111
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2112
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
2113
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2114
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
2115
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2116
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
2117
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2118
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
2119
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
2120
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
2121
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
2122
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
2123
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
2124
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
2125
+
2126
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7));
2127
+ } else {
2128
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
2129
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7);
2130
+
2131
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
2132
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
2133
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2134
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
2135
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2136
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
2137
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2138
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
2139
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2140
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
2141
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
2142
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
2143
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
2144
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
2145
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
2146
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
2147
+
2148
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7));
2149
+ }
2150
+ }
2151
+ catch(...)
2152
+ {
2153
+ RUBY_TRY
2154
+ {
2155
+ if(wrapper)
2156
+ {
2157
+ return wrapper->handler_->handle_exception();
2158
+ }
2159
+ else
2160
+ {
2161
+ throw;
2162
+ }
2163
+ }
2164
+ RUBY_CATCH
2165
+ }
2166
+ }
2167
+
2168
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T>
2169
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T>::
2170
+ Auto_Function_Wrapper(
2171
+ Func func,
2172
+ Data_Object<Exception_Handler> handler,
2173
+ Arguments* arguments)
2174
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
2175
+ , func_(func)
2176
+ , handler_(handler)
2177
+ , handler_guard_(&handler_)
2178
+ {
2179
+ if(arguments == 0) {
2180
+ arguments_ = new Arguments();
2181
+ } else {
2182
+ arguments_ = arguments;
2183
+ }
2184
+ }
2185
+
2186
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T>
2187
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T>::
2188
+ ~Auto_Function_Wrapper()
2189
+ {
2190
+ if(arguments_) { delete arguments_; }
2191
+ }
2192
+
2193
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T, typename Arg7_T>
2194
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T>::
2195
+ call(int argc, VALUE* argv, VALUE self)
2196
+ {
2197
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T> * wrapper = 0;
2198
+ try
2199
+ {
2200
+ Data_Object<Wrapped_Function> data(detail::method_data());
2201
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T, Arg7_T> *)data.get();
2202
+ Arguments* args = wrapper->arguments_;
2203
+
2204
+ bool hasSelf = (self && self != Qnil);
2205
+ if(args->count() >= 0) {
2206
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
2207
+ } else {
2208
+ hasSelf = hasSelf && argc == Num_Args -1;
2209
+ }
2210
+
2211
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6, varg7;
2212
+
2213
+ if(hasSelf) {
2214
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
2215
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7);
2216
+
2217
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
2218
+
2219
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2220
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
2221
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2222
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
2223
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2224
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
2225
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2226
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
2227
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
2228
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
2229
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
2230
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
2231
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
2232
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(6, varg6);
2233
+
2234
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
2235
+ return Qnil;
2236
+ } else {
2237
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
2238
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6, &varg7);
2239
+
2240
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
2241
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
2242
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2243
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
2244
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2245
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
2246
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2247
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
2248
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2249
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
2250
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
2251
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
2252
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
2253
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
2254
+ typedef typename sanitize< Arg7_T >::Type Arg7_Type;
2255
+ Arg7_Type arg7 = args->getArgumentOrDefault<Arg7_Type>(7, varg7);
2256
+
2257
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
2258
+ return Qnil;
2259
+ }
2260
+ }
2261
+ catch(...)
2262
+ {
2263
+ RUBY_TRY
2264
+ {
2265
+ if(wrapper)
2266
+ {
2267
+ return wrapper->handler_->handle_exception();
2268
+ }
2269
+ else
2270
+ {
2271
+ throw;
2272
+ }
2273
+ }
2274
+ RUBY_CATCH
2275
+ }
2276
+ }
2277
+
2278
+ // ---------------------------------------------------------------------
2279
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T>
2280
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T>::
2281
+ Auto_Function_Wrapper(
2282
+ Func func,
2283
+ Data_Object<Exception_Handler> handler,
2284
+ Arguments* arguments)
2285
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
2286
+ , func_(func)
2287
+ , handler_(handler)
2288
+ , handler_guard_(&handler_)
2289
+ {
2290
+ if(arguments == 0) {
2291
+ arguments_ = new Arguments();
2292
+ } else {
2293
+ arguments_ = arguments;
2294
+ }
2295
+ }
2296
+
2297
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T>
2298
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T>::
2299
+ ~Auto_Function_Wrapper()
2300
+ {
2301
+ if(arguments_) { delete arguments_; }
2302
+ }
2303
+
2304
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T>
2305
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T>::
2306
+ call(int argc, VALUE *argv, VALUE self)
2307
+ {
2308
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T> * wrapper = 0;
2309
+ try
2310
+ {
2311
+ Data_Object<Wrapped_Function> data(detail::method_data());
2312
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T> *)data.get();
2313
+ Arguments* args = wrapper->arguments_;
2314
+
2315
+ bool hasSelf = (self && self != Qnil);
2316
+ if(args->count() >= 0) {
2317
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
2318
+ } else {
2319
+ hasSelf = hasSelf && argc == Num_Args -1;
2320
+ }
2321
+
2322
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6;
2323
+
2324
+ if(hasSelf) {
2325
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
2326
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6);
2327
+
2328
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
2329
+
2330
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2331
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
2332
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2333
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
2334
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2335
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
2336
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2337
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
2338
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
2339
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
2340
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
2341
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
2342
+
2343
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6));
2344
+ } else {
2345
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
2346
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6);
2347
+
2348
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
2349
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
2350
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2351
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
2352
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2353
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
2354
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2355
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
2356
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2357
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
2358
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
2359
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
2360
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
2361
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
2362
+
2363
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6));
2364
+ }
2365
+ }
2366
+ catch(...)
2367
+ {
2368
+ RUBY_TRY
2369
+ {
2370
+ if(wrapper)
2371
+ {
2372
+ return wrapper->handler_->handle_exception();
2373
+ }
2374
+ else
2375
+ {
2376
+ throw;
2377
+ }
2378
+ }
2379
+ RUBY_CATCH
2380
+ }
2381
+ }
2382
+
2383
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T>
2384
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T>::
2385
+ Auto_Function_Wrapper(
2386
+ Func func,
2387
+ Data_Object<Exception_Handler> handler,
2388
+ Arguments* arguments)
2389
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
2390
+ , func_(func)
2391
+ , handler_(handler)
2392
+ , handler_guard_(&handler_)
2393
+ {
2394
+ if(arguments == 0) {
2395
+ arguments_ = new Arguments();
2396
+ } else {
2397
+ arguments_ = arguments;
2398
+ }
2399
+ }
2400
+
2401
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T>
2402
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T>::
2403
+ ~Auto_Function_Wrapper()
2404
+ {
2405
+ if(arguments_) { delete arguments_; }
2406
+ }
2407
+
2408
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T, typename Arg6_T>
2409
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T>::
2410
+ call(int argc, VALUE* argv, VALUE self)
2411
+ {
2412
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T> * wrapper = 0;
2413
+ try
2414
+ {
2415
+ Data_Object<Wrapped_Function> data(detail::method_data());
2416
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T, Arg6_T> *)data.get();
2417
+ Arguments* args = wrapper->arguments_;
2418
+
2419
+ bool hasSelf = (self && self != Qnil);
2420
+ if(args->count() >= 0) {
2421
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
2422
+ } else {
2423
+ hasSelf = hasSelf && argc == Num_Args -1;
2424
+ }
2425
+
2426
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5, varg6;
2427
+
2428
+ if(hasSelf) {
2429
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
2430
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6);
2431
+
2432
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
2433
+
2434
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2435
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
2436
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2437
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
2438
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2439
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
2440
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2441
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
2442
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
2443
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
2444
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
2445
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(5, varg5);
2446
+
2447
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
2448
+ return Qnil;
2449
+ } else {
2450
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
2451
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5, &varg6);
2452
+
2453
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
2454
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
2455
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2456
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
2457
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2458
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
2459
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2460
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
2461
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2462
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
2463
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
2464
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
2465
+ typedef typename sanitize< Arg6_T >::Type Arg6_Type;
2466
+ Arg6_Type arg6 = args->getArgumentOrDefault<Arg6_Type>(6, varg6);
2467
+
2468
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
2469
+ return Qnil;
2470
+ }
2471
+ }
2472
+ catch(...)
2473
+ {
2474
+ RUBY_TRY
2475
+ {
2476
+ if(wrapper)
2477
+ {
2478
+ return wrapper->handler_->handle_exception();
2479
+ }
2480
+ else
2481
+ {
2482
+ throw;
2483
+ }
2484
+ }
2485
+ RUBY_CATCH
2486
+ }
2487
+ }
2488
+
2489
+ // ---------------------------------------------------------------------
2490
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T>
2491
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T>::
2492
+ Auto_Function_Wrapper(
2493
+ Func func,
2494
+ Data_Object<Exception_Handler> handler,
2495
+ Arguments* arguments)
2496
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
2497
+ , func_(func)
2498
+ , handler_(handler)
2499
+ , handler_guard_(&handler_)
2500
+ {
2501
+ if(arguments == 0) {
2502
+ arguments_ = new Arguments();
2503
+ } else {
2504
+ arguments_ = arguments;
2505
+ }
2506
+ }
2507
+
2508
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T>
2509
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T>::
2510
+ ~Auto_Function_Wrapper()
2511
+ {
2512
+ if(arguments_) { delete arguments_; }
2513
+ }
2514
+
2515
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T>
2516
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T>::
2517
+ call(int argc, VALUE *argv, VALUE self)
2518
+ {
2519
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T> * wrapper = 0;
2520
+ try
2521
+ {
2522
+ Data_Object<Wrapped_Function> data(detail::method_data());
2523
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T> *)data.get();
2524
+ Arguments* args = wrapper->arguments_;
2525
+
2526
+ bool hasSelf = (self && self != Qnil);
2527
+ if(args->count() >= 0) {
2528
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
2529
+ } else {
2530
+ hasSelf = hasSelf && argc == Num_Args -1;
2531
+ }
2532
+
2533
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5;
2534
+
2535
+ if(hasSelf) {
2536
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
2537
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5);
2538
+
2539
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
2540
+
2541
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2542
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
2543
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2544
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
2545
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2546
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
2547
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2548
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
2549
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
2550
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
2551
+
2552
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5));
2553
+ } else {
2554
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
2555
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5);
2556
+
2557
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
2558
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
2559
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2560
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
2561
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2562
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
2563
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2564
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
2565
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2566
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
2567
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
2568
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
2569
+
2570
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5));
2571
+ }
2572
+ }
2573
+ catch(...)
2574
+ {
2575
+ RUBY_TRY
2576
+ {
2577
+ if(wrapper)
2578
+ {
2579
+ return wrapper->handler_->handle_exception();
2580
+ }
2581
+ else
2582
+ {
2583
+ throw;
2584
+ }
2585
+ }
2586
+ RUBY_CATCH
2587
+ }
2588
+ }
2589
+
2590
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T>
2591
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T>::
2592
+ Auto_Function_Wrapper(
2593
+ Func func,
2594
+ Data_Object<Exception_Handler> handler,
2595
+ Arguments* arguments)
2596
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
2597
+ , func_(func)
2598
+ , handler_(handler)
2599
+ , handler_guard_(&handler_)
2600
+ {
2601
+ if(arguments == 0) {
2602
+ arguments_ = new Arguments();
2603
+ } else {
2604
+ arguments_ = arguments;
2605
+ }
2606
+ }
2607
+
2608
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T>
2609
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T>::
2610
+ ~Auto_Function_Wrapper()
2611
+ {
2612
+ if(arguments_) { delete arguments_; }
2613
+ }
2614
+
2615
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T, typename Arg5_T>
2616
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T>::
2617
+ call(int argc, VALUE* argv, VALUE self)
2618
+ {
2619
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T> * wrapper = 0;
2620
+ try
2621
+ {
2622
+ Data_Object<Wrapped_Function> data(detail::method_data());
2623
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T, Arg5_T> *)data.get();
2624
+ Arguments* args = wrapper->arguments_;
2625
+
2626
+ bool hasSelf = (self && self != Qnil);
2627
+ if(args->count() >= 0) {
2628
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
2629
+ } else {
2630
+ hasSelf = hasSelf && argc == Num_Args -1;
2631
+ }
2632
+
2633
+ VALUE varg0, varg1, varg2, varg3, varg4, varg5;
2634
+
2635
+ if(hasSelf) {
2636
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
2637
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5);
2638
+
2639
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
2640
+
2641
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2642
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
2643
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2644
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
2645
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2646
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
2647
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2648
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
2649
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
2650
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(4, varg4);
2651
+
2652
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5);
2653
+ return Qnil;
2654
+ } else {
2655
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
2656
+ , &varg0, &varg1, &varg2, &varg3, &varg4, &varg5);
2657
+
2658
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
2659
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
2660
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2661
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
2662
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2663
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
2664
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2665
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
2666
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2667
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
2668
+ typedef typename sanitize< Arg5_T >::Type Arg5_Type;
2669
+ Arg5_Type arg5 = args->getArgumentOrDefault<Arg5_Type>(5, varg5);
2670
+
2671
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4, arg5);
2672
+ return Qnil;
2673
+ }
2674
+ }
2675
+ catch(...)
2676
+ {
2677
+ RUBY_TRY
2678
+ {
2679
+ if(wrapper)
2680
+ {
2681
+ return wrapper->handler_->handle_exception();
2682
+ }
2683
+ else
2684
+ {
2685
+ throw;
2686
+ }
2687
+ }
2688
+ RUBY_CATCH
2689
+ }
2690
+ }
2691
+
2692
+ // ---------------------------------------------------------------------
2693
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T>
2694
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T>::
2695
+ Auto_Function_Wrapper(
2696
+ Func func,
2697
+ Data_Object<Exception_Handler> handler,
2698
+ Arguments* arguments)
2699
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
2700
+ , func_(func)
2701
+ , handler_(handler)
2702
+ , handler_guard_(&handler_)
2703
+ {
2704
+ if(arguments == 0) {
2705
+ arguments_ = new Arguments();
2706
+ } else {
2707
+ arguments_ = arguments;
2708
+ }
2709
+ }
2710
+
2711
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T>
2712
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T>::
2713
+ ~Auto_Function_Wrapper()
2714
+ {
2715
+ if(arguments_) { delete arguments_; }
2716
+ }
2717
+
2718
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T>
2719
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T>::
2720
+ call(int argc, VALUE *argv, VALUE self)
2721
+ {
2722
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T> * wrapper = 0;
2723
+ try
2724
+ {
2725
+ Data_Object<Wrapped_Function> data(detail::method_data());
2726
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T> *)data.get();
2727
+ Arguments* args = wrapper->arguments_;
2728
+
2729
+ bool hasSelf = (self && self != Qnil);
2730
+ if(args->count() >= 0) {
2731
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
2732
+ } else {
2733
+ hasSelf = hasSelf && argc == Num_Args -1;
2734
+ }
2735
+
2736
+ VALUE varg0, varg1, varg2, varg3, varg4;
2737
+
2738
+ if(hasSelf) {
2739
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
2740
+ , &varg0, &varg1, &varg2, &varg3, &varg4);
2741
+
2742
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
2743
+
2744
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2745
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
2746
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2747
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
2748
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2749
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
2750
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2751
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
2752
+
2753
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4));
2754
+ } else {
2755
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
2756
+ , &varg0, &varg1, &varg2, &varg3, &varg4);
2757
+
2758
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
2759
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
2760
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2761
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
2762
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2763
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
2764
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2765
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
2766
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2767
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
2768
+
2769
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3, arg4));
2770
+ }
2771
+ }
2772
+ catch(...)
2773
+ {
2774
+ RUBY_TRY
2775
+ {
2776
+ if(wrapper)
2777
+ {
2778
+ return wrapper->handler_->handle_exception();
2779
+ }
2780
+ else
2781
+ {
2782
+ throw;
2783
+ }
2784
+ }
2785
+ RUBY_CATCH
2786
+ }
2787
+ }
2788
+
2789
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T>
2790
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T>::
2791
+ Auto_Function_Wrapper(
2792
+ Func func,
2793
+ Data_Object<Exception_Handler> handler,
2794
+ Arguments* arguments)
2795
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
2796
+ , func_(func)
2797
+ , handler_(handler)
2798
+ , handler_guard_(&handler_)
2799
+ {
2800
+ if(arguments == 0) {
2801
+ arguments_ = new Arguments();
2802
+ } else {
2803
+ arguments_ = arguments;
2804
+ }
2805
+ }
2806
+
2807
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T>
2808
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T>::
2809
+ ~Auto_Function_Wrapper()
2810
+ {
2811
+ if(arguments_) { delete arguments_; }
2812
+ }
2813
+
2814
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T, typename Arg4_T>
2815
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T>::
2816
+ call(int argc, VALUE* argv, VALUE self)
2817
+ {
2818
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T> * wrapper = 0;
2819
+ try
2820
+ {
2821
+ Data_Object<Wrapped_Function> data(detail::method_data());
2822
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T, Arg4_T> *)data.get();
2823
+ Arguments* args = wrapper->arguments_;
2824
+
2825
+ bool hasSelf = (self && self != Qnil);
2826
+ if(args->count() >= 0) {
2827
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
2828
+ } else {
2829
+ hasSelf = hasSelf && argc == Num_Args -1;
2830
+ }
2831
+
2832
+ VALUE varg0, varg1, varg2, varg3, varg4;
2833
+
2834
+ if(hasSelf) {
2835
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
2836
+ , &varg0, &varg1, &varg2, &varg3, &varg4);
2837
+
2838
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
2839
+
2840
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2841
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
2842
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2843
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
2844
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2845
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
2846
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2847
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(3, varg3);
2848
+
2849
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4);
2850
+ return Qnil;
2851
+ } else {
2852
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
2853
+ , &varg0, &varg1, &varg2, &varg3, &varg4);
2854
+
2855
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
2856
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
2857
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2858
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
2859
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2860
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
2861
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2862
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
2863
+ typedef typename sanitize< Arg4_T >::Type Arg4_Type;
2864
+ Arg4_Type arg4 = args->getArgumentOrDefault<Arg4_Type>(4, varg4);
2865
+
2866
+ wrapper->func_(arg0, arg1, arg2, arg3, arg4);
2867
+ return Qnil;
2868
+ }
2869
+ }
2870
+ catch(...)
2871
+ {
2872
+ RUBY_TRY
2873
+ {
2874
+ if(wrapper)
2875
+ {
2876
+ return wrapper->handler_->handle_exception();
2877
+ }
2878
+ else
2879
+ {
2880
+ throw;
2881
+ }
2882
+ }
2883
+ RUBY_CATCH
2884
+ }
2885
+ }
2886
+
2887
+ // ---------------------------------------------------------------------
2888
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T>
2889
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T>::
2890
+ Auto_Function_Wrapper(
2891
+ Func func,
2892
+ Data_Object<Exception_Handler> handler,
2893
+ Arguments* arguments)
2894
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
2895
+ , func_(func)
2896
+ , handler_(handler)
2897
+ , handler_guard_(&handler_)
2898
+ {
2899
+ if(arguments == 0) {
2900
+ arguments_ = new Arguments();
2901
+ } else {
2902
+ arguments_ = arguments;
2903
+ }
2904
+ }
2905
+
2906
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T>
2907
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T>::
2908
+ ~Auto_Function_Wrapper()
2909
+ {
2910
+ if(arguments_) { delete arguments_; }
2911
+ }
2912
+
2913
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T>
2914
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T>::
2915
+ call(int argc, VALUE *argv, VALUE self)
2916
+ {
2917
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T> * wrapper = 0;
2918
+ try
2919
+ {
2920
+ Data_Object<Wrapped_Function> data(detail::method_data());
2921
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T, Arg3_T> *)data.get();
2922
+ Arguments* args = wrapper->arguments_;
2923
+
2924
+ bool hasSelf = (self && self != Qnil);
2925
+ if(args->count() >= 0) {
2926
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
2927
+ } else {
2928
+ hasSelf = hasSelf && argc == Num_Args -1;
2929
+ }
2930
+
2931
+ VALUE varg0, varg1, varg2, varg3;
2932
+
2933
+ if(hasSelf) {
2934
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
2935
+ , &varg0, &varg1, &varg2, &varg3);
2936
+
2937
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
2938
+
2939
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2940
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
2941
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2942
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
2943
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2944
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
2945
+
2946
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3));
2947
+ } else {
2948
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
2949
+ , &varg0, &varg1, &varg2, &varg3);
2950
+
2951
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
2952
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
2953
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
2954
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
2955
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
2956
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
2957
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
2958
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
2959
+
2960
+ return to_ruby(wrapper->func_(arg0, arg1, arg2, arg3));
2961
+ }
2962
+ }
2963
+ catch(...)
2964
+ {
2965
+ RUBY_TRY
2966
+ {
2967
+ if(wrapper)
2968
+ {
2969
+ return wrapper->handler_->handle_exception();
2970
+ }
2971
+ else
2972
+ {
2973
+ throw;
2974
+ }
2975
+ }
2976
+ RUBY_CATCH
2977
+ }
2978
+ }
2979
+
2980
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T>
2981
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T>::
2982
+ Auto_Function_Wrapper(
2983
+ Func func,
2984
+ Data_Object<Exception_Handler> handler,
2985
+ Arguments* arguments)
2986
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
2987
+ , func_(func)
2988
+ , handler_(handler)
2989
+ , handler_guard_(&handler_)
2990
+ {
2991
+ if(arguments == 0) {
2992
+ arguments_ = new Arguments();
2993
+ } else {
2994
+ arguments_ = arguments;
2995
+ }
2996
+ }
2997
+
2998
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T>
2999
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T>::
3000
+ ~Auto_Function_Wrapper()
3001
+ {
3002
+ if(arguments_) { delete arguments_; }
3003
+ }
3004
+
3005
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T, typename Arg3_T>
3006
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T>::
3007
+ call(int argc, VALUE* argv, VALUE self)
3008
+ {
3009
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T> * wrapper = 0;
3010
+ try
3011
+ {
3012
+ Data_Object<Wrapped_Function> data(detail::method_data());
3013
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T, Arg3_T> *)data.get();
3014
+ Arguments* args = wrapper->arguments_;
3015
+
3016
+ bool hasSelf = (self && self != Qnil);
3017
+ if(args->count() >= 0) {
3018
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
3019
+ } else {
3020
+ hasSelf = hasSelf && argc == Num_Args -1;
3021
+ }
3022
+
3023
+ VALUE varg0, varg1, varg2, varg3;
3024
+
3025
+ if(hasSelf) {
3026
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
3027
+ , &varg0, &varg1, &varg2, &varg3);
3028
+
3029
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
3030
+
3031
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
3032
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
3033
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
3034
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
3035
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
3036
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(2, varg2);
3037
+
3038
+ wrapper->func_(arg0, arg1, arg2, arg3);
3039
+ return Qnil;
3040
+ } else {
3041
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
3042
+ , &varg0, &varg1, &varg2, &varg3);
3043
+
3044
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
3045
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
3046
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
3047
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
3048
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
3049
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
3050
+ typedef typename sanitize< Arg3_T >::Type Arg3_Type;
3051
+ Arg3_Type arg3 = args->getArgumentOrDefault<Arg3_Type>(3, varg3);
3052
+
3053
+ wrapper->func_(arg0, arg1, arg2, arg3);
3054
+ return Qnil;
3055
+ }
3056
+ }
3057
+ catch(...)
3058
+ {
3059
+ RUBY_TRY
3060
+ {
3061
+ if(wrapper)
3062
+ {
3063
+ return wrapper->handler_->handle_exception();
3064
+ }
3065
+ else
3066
+ {
3067
+ throw;
3068
+ }
3069
+ }
3070
+ RUBY_CATCH
3071
+ }
3072
+ }
3073
+
3074
+ // ---------------------------------------------------------------------
3075
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T>
3076
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T>::
3077
+ Auto_Function_Wrapper(
3078
+ Func func,
3079
+ Data_Object<Exception_Handler> handler,
3080
+ Arguments* arguments)
3081
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
3082
+ , func_(func)
3083
+ , handler_(handler)
3084
+ , handler_guard_(&handler_)
3085
+ {
3086
+ if(arguments == 0) {
3087
+ arguments_ = new Arguments();
3088
+ } else {
3089
+ arguments_ = arguments;
3090
+ }
3091
+ }
3092
+
3093
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T>
3094
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T>::
3095
+ ~Auto_Function_Wrapper()
3096
+ {
3097
+ if(arguments_) { delete arguments_; }
3098
+ }
3099
+
3100
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T, typename Arg2_T>
3101
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T>::
3102
+ call(int argc, VALUE *argv, VALUE self)
3103
+ {
3104
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T> * wrapper = 0;
3105
+ try
3106
+ {
3107
+ Data_Object<Wrapped_Function> data(detail::method_data());
3108
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T, Arg2_T> *)data.get();
3109
+ Arguments* args = wrapper->arguments_;
3110
+
3111
+ bool hasSelf = (self && self != Qnil);
3112
+ if(args->count() >= 0) {
3113
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
3114
+ } else {
3115
+ hasSelf = hasSelf && argc == Num_Args -1;
3116
+ }
3117
+
3118
+ VALUE varg0, varg1, varg2;
3119
+
3120
+ if(hasSelf) {
3121
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
3122
+ , &varg0, &varg1, &varg2);
3123
+
3124
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
3125
+
3126
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
3127
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
3128
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
3129
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
3130
+
3131
+ return to_ruby(wrapper->func_(arg0, arg1, arg2));
3132
+ } else {
3133
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
3134
+ , &varg0, &varg1, &varg2);
3135
+
3136
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
3137
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
3138
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
3139
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
3140
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
3141
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
3142
+
3143
+ return to_ruby(wrapper->func_(arg0, arg1, arg2));
3144
+ }
3145
+ }
3146
+ catch(...)
3147
+ {
3148
+ RUBY_TRY
3149
+ {
3150
+ if(wrapper)
3151
+ {
3152
+ return wrapper->handler_->handle_exception();
3153
+ }
3154
+ else
3155
+ {
3156
+ throw;
3157
+ }
3158
+ }
3159
+ RUBY_CATCH
3160
+ }
3161
+ }
3162
+
3163
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T>
3164
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T>::
3165
+ Auto_Function_Wrapper(
3166
+ Func func,
3167
+ Data_Object<Exception_Handler> handler,
3168
+ Arguments* arguments)
3169
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
3170
+ , func_(func)
3171
+ , handler_(handler)
3172
+ , handler_guard_(&handler_)
3173
+ {
3174
+ if(arguments == 0) {
3175
+ arguments_ = new Arguments();
3176
+ } else {
3177
+ arguments_ = arguments;
3178
+ }
3179
+ }
3180
+
3181
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T>
3182
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T>::
3183
+ ~Auto_Function_Wrapper()
3184
+ {
3185
+ if(arguments_) { delete arguments_; }
3186
+ }
3187
+
3188
+ template<typename Func_T, typename Arg0_T, typename Arg1_T, typename Arg2_T>
3189
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T>::
3190
+ call(int argc, VALUE* argv, VALUE self)
3191
+ {
3192
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T> * wrapper = 0;
3193
+ try
3194
+ {
3195
+ Data_Object<Wrapped_Function> data(detail::method_data());
3196
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T, Arg2_T> *)data.get();
3197
+ Arguments* args = wrapper->arguments_;
3198
+
3199
+ bool hasSelf = (self && self != Qnil);
3200
+ if(args->count() >= 0) {
3201
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
3202
+ } else {
3203
+ hasSelf = hasSelf && argc == Num_Args -1;
3204
+ }
3205
+
3206
+ VALUE varg0, varg1, varg2;
3207
+
3208
+ if(hasSelf) {
3209
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
3210
+ , &varg0, &varg1, &varg2);
3211
+
3212
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
3213
+
3214
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
3215
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
3216
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
3217
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(1, varg1);
3218
+
3219
+ wrapper->func_(arg0, arg1, arg2);
3220
+ return Qnil;
3221
+ } else {
3222
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
3223
+ , &varg0, &varg1, &varg2);
3224
+
3225
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
3226
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
3227
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
3228
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
3229
+ typedef typename sanitize< Arg2_T >::Type Arg2_Type;
3230
+ Arg2_Type arg2 = args->getArgumentOrDefault<Arg2_Type>(2, varg2);
3231
+
3232
+ wrapper->func_(arg0, arg1, arg2);
3233
+ return Qnil;
3234
+ }
3235
+ }
3236
+ catch(...)
3237
+ {
3238
+ RUBY_TRY
3239
+ {
3240
+ if(wrapper)
3241
+ {
3242
+ return wrapper->handler_->handle_exception();
3243
+ }
3244
+ else
3245
+ {
3246
+ throw;
3247
+ }
3248
+ }
3249
+ RUBY_CATCH
3250
+ }
3251
+ }
3252
+
3253
+ // ---------------------------------------------------------------------
3254
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T>
3255
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T>::
3256
+ Auto_Function_Wrapper(
3257
+ Func func,
3258
+ Data_Object<Exception_Handler> handler,
3259
+ Arguments* arguments)
3260
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
3261
+ , func_(func)
3262
+ , handler_(handler)
3263
+ , handler_guard_(&handler_)
3264
+ {
3265
+ if(arguments == 0) {
3266
+ arguments_ = new Arguments();
3267
+ } else {
3268
+ arguments_ = arguments;
3269
+ }
3270
+ }
3271
+
3272
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T>
3273
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T>::
3274
+ ~Auto_Function_Wrapper()
3275
+ {
3276
+ if(arguments_) { delete arguments_; }
3277
+ }
3278
+
3279
+ template<typename Func_T, typename Ret_T, typename Arg0_T, typename Arg1_T>
3280
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T>::
3281
+ call(int argc, VALUE *argv, VALUE self)
3282
+ {
3283
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T> * wrapper = 0;
3284
+ try
3285
+ {
3286
+ Data_Object<Wrapped_Function> data(detail::method_data());
3287
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T, Arg1_T> *)data.get();
3288
+ Arguments* args = wrapper->arguments_;
3289
+
3290
+ bool hasSelf = (self && self != Qnil);
3291
+ if(args->count() >= 0) {
3292
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
3293
+ } else {
3294
+ hasSelf = hasSelf && argc == Num_Args -1;
3295
+ }
3296
+
3297
+ VALUE varg0, varg1;
3298
+
3299
+ if(hasSelf) {
3300
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
3301
+ , &varg0, &varg1);
3302
+
3303
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
3304
+
3305
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
3306
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
3307
+
3308
+ return to_ruby(wrapper->func_(arg0, arg1));
3309
+ } else {
3310
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
3311
+ , &varg0, &varg1);
3312
+
3313
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
3314
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
3315
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
3316
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
3317
+
3318
+ return to_ruby(wrapper->func_(arg0, arg1));
3319
+ }
3320
+ }
3321
+ catch(...)
3322
+ {
3323
+ RUBY_TRY
3324
+ {
3325
+ if(wrapper)
3326
+ {
3327
+ return wrapper->handler_->handle_exception();
3328
+ }
3329
+ else
3330
+ {
3331
+ throw;
3332
+ }
3333
+ }
3334
+ RUBY_CATCH
3335
+ }
3336
+ }
3337
+
3338
+ template<typename Func_T, typename Arg0_T, typename Arg1_T>
3339
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T>::
3340
+ Auto_Function_Wrapper(
3341
+ Func func,
3342
+ Data_Object<Exception_Handler> handler,
3343
+ Arguments* arguments)
3344
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
3345
+ , func_(func)
3346
+ , handler_(handler)
3347
+ , handler_guard_(&handler_)
3348
+ {
3349
+ if(arguments == 0) {
3350
+ arguments_ = new Arguments();
3351
+ } else {
3352
+ arguments_ = arguments;
3353
+ }
3354
+ }
3355
+
3356
+ template<typename Func_T, typename Arg0_T, typename Arg1_T>
3357
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T>::
3358
+ ~Auto_Function_Wrapper()
3359
+ {
3360
+ if(arguments_) { delete arguments_; }
3361
+ }
3362
+
3363
+ template<typename Func_T, typename Arg0_T, typename Arg1_T>
3364
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T>::
3365
+ call(int argc, VALUE* argv, VALUE self)
3366
+ {
3367
+ Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T> * wrapper = 0;
3368
+ try
3369
+ {
3370
+ Data_Object<Wrapped_Function> data(detail::method_data());
3371
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T, Arg1_T> *)data.get();
3372
+ Arguments* args = wrapper->arguments_;
3373
+
3374
+ bool hasSelf = (self && self != Qnil);
3375
+ if(args->count() >= 0) {
3376
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
3377
+ } else {
3378
+ hasSelf = hasSelf && argc == Num_Args -1;
3379
+ }
3380
+
3381
+ VALUE varg0, varg1;
3382
+
3383
+ if(hasSelf) {
3384
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
3385
+ , &varg0, &varg1);
3386
+
3387
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
3388
+
3389
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
3390
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(0, varg0);
3391
+
3392
+ wrapper->func_(arg0, arg1);
3393
+ return Qnil;
3394
+ } else {
3395
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
3396
+ , &varg0, &varg1);
3397
+
3398
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
3399
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
3400
+ typedef typename sanitize< Arg1_T >::Type Arg1_Type;
3401
+ Arg1_Type arg1 = args->getArgumentOrDefault<Arg1_Type>(1, varg1);
3402
+
3403
+ wrapper->func_(arg0, arg1);
3404
+ return Qnil;
3405
+ }
3406
+ }
3407
+ catch(...)
3408
+ {
3409
+ RUBY_TRY
3410
+ {
3411
+ if(wrapper)
3412
+ {
3413
+ return wrapper->handler_->handle_exception();
3414
+ }
3415
+ else
3416
+ {
3417
+ throw;
3418
+ }
3419
+ }
3420
+ RUBY_CATCH
3421
+ }
3422
+ }
3423
+
3424
+ // ---------------------------------------------------------------------
3425
+ template<typename Func_T, typename Ret_T, typename Arg0_T>
3426
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T>::
3427
+ Auto_Function_Wrapper(
3428
+ Func func,
3429
+ Data_Object<Exception_Handler> handler,
3430
+ Arguments* arguments)
3431
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
3432
+ , func_(func)
3433
+ , handler_(handler)
3434
+ , handler_guard_(&handler_)
3435
+ {
3436
+ if(arguments == 0) {
3437
+ arguments_ = new Arguments();
3438
+ } else {
3439
+ arguments_ = arguments;
3440
+ }
3441
+ }
3442
+
3443
+ template<typename Func_T, typename Ret_T, typename Arg0_T>
3444
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T>::
3445
+ ~Auto_Function_Wrapper()
3446
+ {
3447
+ if(arguments_) { delete arguments_; }
3448
+ }
3449
+
3450
+ template<typename Func_T, typename Ret_T, typename Arg0_T>
3451
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T>::
3452
+ call(int argc, VALUE *argv, VALUE self)
3453
+ {
3454
+ Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T> * wrapper = 0;
3455
+ try
3456
+ {
3457
+ Data_Object<Wrapped_Function> data(detail::method_data());
3458
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T, Arg0_T> *)data.get();
3459
+ Arguments* args = wrapper->arguments_;
3460
+
3461
+ bool hasSelf = (self && self != Qnil);
3462
+ if(args->count() >= 0) {
3463
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
3464
+ } else {
3465
+ hasSelf = hasSelf && argc == Num_Args -1;
3466
+ }
3467
+
3468
+ VALUE varg0;
3469
+
3470
+ if(hasSelf) {
3471
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1).c_str()
3472
+ , &varg0);
3473
+
3474
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
3475
+
3476
+
3477
+ return to_ruby(wrapper->func_(arg0));
3478
+ } else {
3479
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
3480
+ , &varg0);
3481
+
3482
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
3483
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
3484
+
3485
+ return to_ruby(wrapper->func_(arg0));
3486
+ }
3487
+ }
3488
+ catch(...)
3489
+ {
3490
+ RUBY_TRY
3491
+ {
3492
+ if(wrapper)
3493
+ {
3494
+ return wrapper->handler_->handle_exception();
3495
+ }
3496
+ else
3497
+ {
3498
+ throw;
3499
+ }
3500
+ }
3501
+ RUBY_CATCH
3502
+ }
3503
+ }
3504
+
3505
+ template<typename Func_T, typename Arg0_T>
3506
+ Auto_Function_Wrapper<Func_T, void, Arg0_T>::
3507
+ Auto_Function_Wrapper(
3508
+ Func func,
3509
+ Data_Object<Exception_Handler> handler,
3510
+ Arguments* arguments)
3511
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
3512
+ , func_(func)
3513
+ , handler_(handler)
3514
+ , handler_guard_(&handler_)
3515
+ {
3516
+ if(arguments == 0) {
3517
+ arguments_ = new Arguments();
3518
+ } else {
3519
+ arguments_ = arguments;
3520
+ }
3521
+ }
3522
+
3523
+ template<typename Func_T, typename Arg0_T>
3524
+ Auto_Function_Wrapper<Func_T, void, Arg0_T>::
3525
+ ~Auto_Function_Wrapper()
3526
+ {
3527
+ if(arguments_) { delete arguments_; }
3528
+ }
3529
+
3530
+ template<typename Func_T, typename Arg0_T>
3531
+ VALUE Auto_Function_Wrapper<Func_T, void, Arg0_T>::
3532
+ call(int argc, VALUE* argv, VALUE self)
3533
+ {
3534
+ Auto_Function_Wrapper<Func_T, void, Arg0_T> * wrapper = 0;
3535
+ try
3536
+ {
3537
+ Data_Object<Wrapped_Function> data(detail::method_data());
3538
+ wrapper = (Auto_Function_Wrapper<Func_T, void, Arg0_T> *)data.get();
3539
+ Arguments* args = wrapper->arguments_;
3540
+
3541
+ bool hasSelf = (self && self != Qnil);
3542
+ if(args->count() >= 0) {
3543
+ hasSelf = hasSelf && args->count() == Num_Args - 1;
3544
+ } else {
3545
+ hasSelf = hasSelf && argc == Num_Args -1;
3546
+ }
3547
+
3548
+ VALUE varg0;
3549
+
3550
+ if(hasSelf) {
3551
+ rb_scan_args(argc, argv, args->formatString(Num_Args - 1) .c_str()
3552
+ , &varg0);
3553
+
3554
+ Arg0_T arg0 = from_ruby<Arg0_T>(self);
3555
+
3556
+
3557
+ wrapper->func_(arg0);
3558
+ return Qnil;
3559
+ } else {
3560
+ rb_scan_args(argc, argv, args->formatString(Num_Args).c_str()
3561
+ , &varg0);
3562
+
3563
+ typedef typename sanitize< Arg0_T >::Type Arg0_Type;
3564
+ Arg0_Type arg0 = args->getArgumentOrDefault<Arg0_Type>(0, varg0);
3565
+
3566
+ wrapper->func_(arg0);
3567
+ return Qnil;
3568
+ }
3569
+ }
3570
+ catch(...)
3571
+ {
3572
+ RUBY_TRY
3573
+ {
3574
+ if(wrapper)
3575
+ {
3576
+ return wrapper->handler_->handle_exception();
3577
+ }
3578
+ else
3579
+ {
3580
+ throw;
3581
+ }
3582
+ }
3583
+ RUBY_CATCH
3584
+ }
3585
+ }
3586
+
3587
+ // ---------------------------------------------------------------------
3588
+
3589
+ template<typename Func_T, typename Ret_T>
3590
+ Auto_Function_Wrapper<Func_T, Ret_T>::
3591
+ Auto_Function_Wrapper(
3592
+ Func func,
3593
+ Data_Object<Exception_Handler> handler,
3594
+ Arguments* arguments)
3595
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
3596
+ , func_(func)
3597
+ , handler_(handler ? handler : new Default_Exception_Handler)
3598
+ , arguments_(arguments)
3599
+ {
3600
+ }
3601
+
3602
+ template<typename Func_T, typename Ret_T>
3603
+ Auto_Function_Wrapper<Func_T, Ret_T>::
3604
+ ~Auto_Function_Wrapper()
3605
+ {
3606
+ if(arguments_) { delete arguments_; }
3607
+ }
3608
+
3609
+ template<typename Func_T, typename Ret_T>
3610
+ VALUE Auto_Function_Wrapper<Func_T, Ret_T>::
3611
+ call()
3612
+ {
3613
+ Auto_Function_Wrapper<Func_T, Ret_T> * wrapper = 0;
3614
+ try
3615
+ {
3616
+ Data_Object<Wrapped_Function> data(detail::method_data());
3617
+ wrapper = (Auto_Function_Wrapper<Func_T, Ret_T>*)data.get();
3618
+
3619
+ return to_ruby(wrapper->func_());
3620
+ }
3621
+ catch(...)
3622
+ {
3623
+ RUBY_TRY
3624
+ {
3625
+ if(wrapper)
3626
+ {
3627
+ return wrapper->handler_->handle_exception();
3628
+ }
3629
+ else
3630
+ {
3631
+ throw;
3632
+ }
3633
+ }
3634
+ RUBY_CATCH
3635
+ }
3636
+ }
3637
+
3638
+ template<typename Func_T>
3639
+ Auto_Function_Wrapper<Func_T, void>::
3640
+ Auto_Function_Wrapper(
3641
+ Func func,
3642
+ Data_Object<Exception_Handler> handler,
3643
+ Arguments* arguments)
3644
+ : Wrapped_Function(RUBY_METHOD_FUNC(call), Num_Args)
3645
+ , func_(func)
3646
+ , handler_(handler ? handler : new Default_Exception_Handler)
3647
+ , arguments_(arguments)
3648
+ {
3649
+ }
3650
+
3651
+ template<typename Func_T>
3652
+ Auto_Function_Wrapper<Func_T, void>::
3653
+ ~Auto_Function_Wrapper()
3654
+ {
3655
+ if(arguments_) { delete arguments_; }
3656
+ }
3657
+
3658
+ template<typename Func_T>
3659
+ VALUE Auto_Function_Wrapper<Func_T, void>::
3660
+ call()
3661
+ {
3662
+ Auto_Function_Wrapper<Func_T, void> * wrapper = 0;
3663
+ try
3664
+ {
3665
+ Data_Object<Wrapped_Function> data(detail::method_data());
3666
+ wrapper = (Auto_Function_Wrapper<Func_T, void> *)data.get();
3667
+
3668
+ wrapper->func_();
3669
+ return Qnil;
3670
+ }
3671
+ catch(...)
3672
+ {
3673
+ RUBY_TRY
3674
+ {
3675
+ if(wrapper)
3676
+ {
3677
+ return wrapper->handler_->handle_exception();
3678
+ }
3679
+ else
3680
+ {
3681
+ throw;
3682
+ }
3683
+ }
3684
+ RUBY_CATCH
3685
+ }
3686
+ }
3687
+
3688
+ } // namespace detail
3689
+
3690
+ } // namespace Rice
3691
+
3692
+
3693
+ #endif // Rice__detail__Auto_Function_Wrapper__ipp_
3694
+