wurlinc-rice 1.4.0.1

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