jameskilton-rice 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +23 -0
- data/Doxyfile +1253 -0
- data/Makefile.am +26 -0
- data/Makefile.in +749 -0
- data/README +879 -0
- data/README.mingw +8 -0
- data/Rakefile +72 -0
- data/aclocal.m4 +891 -0
- data/bootstrap +8 -0
- data/config.guess +1526 -0
- data/config.sub +1658 -0
- data/configure +7668 -0
- data/configure.ac +52 -0
- data/depcomp +589 -0
- data/doxygen.ac +314 -0
- data/doxygen.am +186 -0
- data/extconf.rb +22 -0
- data/install-sh +519 -0
- data/missing +367 -0
- data/post-autoconf.rb +22 -0
- data/post-automake.rb +28 -0
- data/rice/Address_Registration_Guard.hpp +7 -0
- data/rice/Address_Registration_Guard.ipp +34 -0
- data/rice/Address_Registration_Guard_defn.hpp +65 -0
- data/rice/Allocation_Strategies.hpp +37 -0
- data/rice/Arg.hpp +8 -0
- data/rice/Arg_impl.hpp +116 -0
- data/rice/Arg_operators.cpp +21 -0
- data/rice/Arg_operators.hpp +18 -0
- data/rice/Array.hpp +220 -0
- data/rice/Array.ipp +263 -0
- data/rice/Builtin_Object.hpp +8 -0
- data/rice/Builtin_Object.ipp +50 -0
- data/rice/Builtin_Object_defn.hpp +51 -0
- data/rice/Class.cpp +57 -0
- data/rice/Class.hpp +8 -0
- data/rice/Class.ipp +6 -0
- data/rice/Class_defn.hpp +83 -0
- data/rice/Constructor.hpp +339 -0
- data/rice/Critical_Guard.hpp +40 -0
- data/rice/Critical_Guard.ipp +26 -0
- data/rice/Data_Object.hpp +8 -0
- data/rice/Data_Object.ipp +133 -0
- data/rice/Data_Object_defn.hpp +132 -0
- data/rice/Data_Type.cpp +21 -0
- data/rice/Data_Type.hpp +8 -0
- data/rice/Data_Type.ipp +306 -0
- data/rice/Data_Type_defn.hpp +219 -0
- data/rice/Data_Type_fwd.hpp +12 -0
- data/rice/Director.cpp +19 -0
- data/rice/Director.hpp +47 -0
- data/rice/Enum.hpp +118 -0
- data/rice/Enum.ipp +246 -0
- data/rice/Exception.cpp +59 -0
- data/rice/Exception.hpp +9 -0
- data/rice/Exception_Base.hpp +8 -0
- data/rice/Exception_Base.ipp +13 -0
- data/rice/Exception_Base_defn.hpp +27 -0
- data/rice/Exception_defn.hpp +69 -0
- data/rice/Hash.hpp +210 -0
- data/rice/Hash.ipp +338 -0
- data/rice/Identifier.cpp +8 -0
- data/rice/Identifier.hpp +50 -0
- data/rice/Identifier.ipp +33 -0
- data/rice/Jump_Tag.hpp +24 -0
- data/rice/Makefile.am +140 -0
- data/rice/Makefile.in +740 -0
- data/rice/Module.cpp +84 -0
- data/rice/Module.hpp +8 -0
- data/rice/Module.ipp +6 -0
- data/rice/Module_defn.hpp +88 -0
- data/rice/Module_impl.hpp +281 -0
- data/rice/Module_impl.ipp +348 -0
- data/rice/Object.cpp +153 -0
- data/rice/Object.hpp +8 -0
- data/rice/Object.ipp +19 -0
- data/rice/Object_defn.hpp +183 -0
- data/rice/Require_Guard.hpp +21 -0
- data/rice/String.cpp +94 -0
- data/rice/String.hpp +89 -0
- data/rice/Struct.cpp +117 -0
- data/rice/Struct.hpp +162 -0
- data/rice/Struct.ipp +26 -0
- data/rice/Symbol.cpp +25 -0
- data/rice/Symbol.hpp +66 -0
- data/rice/Symbol.ipp +44 -0
- data/rice/VM.cpp +92 -0
- data/rice/VM.hpp +32 -0
- data/rice/config.hpp +44 -0
- data/rice/config.hpp.in +43 -0
- data/rice/detail/Arguments.hpp +126 -0
- data/rice/detail/Auto_Function_Wrapper.hpp +861 -0
- data/rice/detail/Auto_Function_Wrapper.ipp +2929 -0
- data/rice/detail/Auto_Member_Function_Wrapper.hpp +828 -0
- data/rice/detail/Auto_Member_Function_Wrapper.ipp +2326 -0
- data/rice/detail/Caster.hpp +63 -0
- data/rice/detail/Exception_Handler.hpp +8 -0
- data/rice/detail/Exception_Handler.ipp +68 -0
- data/rice/detail/Exception_Handler_defn.hpp +96 -0
- data/rice/detail/Iterator.hpp +93 -0
- data/rice/detail/Not_Copyable.hpp +25 -0
- data/rice/detail/Wrapped_Function.hpp +33 -0
- data/rice/detail/check_ruby_type.cpp +27 -0
- data/rice/detail/check_ruby_type.hpp +23 -0
- data/rice/detail/creation_funcs.hpp +37 -0
- data/rice/detail/creation_funcs.ipp +36 -0
- data/rice/detail/default_allocation_func.hpp +23 -0
- data/rice/detail/default_allocation_func.ipp +11 -0
- data/rice/detail/define_method_and_auto_wrap.hpp +31 -0
- data/rice/detail/define_method_and_auto_wrap.ipp +30 -0
- data/rice/detail/demangle.cpp +56 -0
- data/rice/detail/demangle.hpp +19 -0
- data/rice/detail/env.hpp +19 -0
- data/rice/detail/from_ruby.hpp +43 -0
- data/rice/detail/from_ruby.ipp +60 -0
- data/rice/detail/method_data.cpp +392 -0
- data/rice/detail/method_data.cpp.rpp +301 -0
- data/rice/detail/method_data.hpp +21 -0
- data/rice/detail/mininode.cpp +1220 -0
- data/rice/detail/mininode.cpp.rpp +62 -0
- data/rice/detail/mininode.hpp +320 -0
- data/rice/detail/mininode.hpp.rpp +119 -0
- data/rice/detail/node.hpp +13 -0
- data/rice/detail/object_call.hpp +85 -0
- data/rice/detail/object_call.ipp +147 -0
- data/rice/detail/protect.cpp +29 -0
- data/rice/detail/protect.hpp +34 -0
- data/rice/detail/remove_const.hpp +21 -0
- data/rice/detail/ruby.hpp +89 -0
- data/rice/detail/ruby_version_code.hpp +6 -0
- data/rice/detail/ruby_version_code.hpp.in +6 -0
- data/rice/detail/rubysig.hpp +19 -0
- data/rice/detail/st.hpp +60 -0
- data/rice/detail/to_ruby.hpp +22 -0
- data/rice/detail/to_ruby.ipp +37 -0
- data/rice/detail/win32.hpp +16 -0
- data/rice/detail/wrap_function.hpp +345 -0
- data/rice/detail/wrap_function.ipp +531 -0
- data/rice/generate_code.rb +1311 -0
- data/rice/global_function.hpp +33 -0
- data/rice/global_function.ipp +22 -0
- data/rice/protect.hpp +91 -0
- data/rice/protect.ipp +803 -0
- data/rice/ruby_mark.hpp +13 -0
- data/rice/ruby_try_catch.hpp +86 -0
- data/rice/rubypp.rb +97 -0
- data/rice/to_from_ruby.hpp +8 -0
- data/rice/to_from_ruby.ipp +299 -0
- data/rice/to_from_ruby_defn.hpp +71 -0
- data/ruby.ac +150 -0
- data/ruby/Makefile.am +1 -0
- data/ruby/Makefile.in +497 -0
- data/ruby/lib/Makefile.am +3 -0
- data/ruby/lib/Makefile.in +374 -0
- data/ruby/lib/mkmf-rice.rb.in +209 -0
- data/ruby/lib/version.rb +3 -0
- data/sample/Makefile.am +47 -0
- data/sample/Makefile.in +380 -0
- data/sample/enum/extconf.rb +3 -0
- data/sample/enum/sample_enum.cpp +54 -0
- data/sample/enum/test.rb +8 -0
- data/sample/inheritance/animals.cpp +98 -0
- data/sample/inheritance/extconf.rb +3 -0
- data/sample/inheritance/test.rb +7 -0
- data/sample/map/extconf.rb +3 -0
- data/sample/map/map.cpp +81 -0
- data/sample/map/test.rb +7 -0
- data/test/Makefile.am +49 -0
- data/test/Makefile.in +603 -0
- data/test/test_Address_Registration_Guard.cpp +43 -0
- data/test/test_Allocation_Strategies.cpp +77 -0
- data/test/test_Array.cpp +241 -0
- data/test/test_Builtin_Object.cpp +72 -0
- data/test/test_Class.cpp +398 -0
- data/test/test_Constructor.cpp +238 -0
- data/test/test_Critical_Guard.cpp +51 -0
- data/test/test_Data_Object.cpp +275 -0
- data/test/test_Data_Type.cpp +121 -0
- data/test/test_Director.cpp +225 -0
- data/test/test_Enum.cpp +162 -0
- data/test/test_Exception.cpp +46 -0
- data/test/test_Hash.cpp +195 -0
- data/test/test_Identifier.cpp +70 -0
- data/test/test_Jump_Tag.cpp +17 -0
- data/test/test_Module.cpp +428 -0
- data/test/test_Object.cpp +148 -0
- data/test/test_String.cpp +94 -0
- data/test/test_Struct.cpp +192 -0
- data/test/test_Symbol.cpp +63 -0
- data/test/test_To_From_Ruby.cpp +263 -0
- data/test/test_VM.cpp +26 -0
- data/test/test_global_functions.cpp +97 -0
- data/test/test_rice.rb +35 -0
- data/test/unittest.cpp +136 -0
- data/test/unittest.hpp +292 -0
- metadata +247 -0
@@ -0,0 +1,85 @@
|
|
1
|
+
// This is a generated file. DO NOT EDIT!!
|
2
|
+
#ifdef DOXYGEN
|
3
|
+
|
4
|
+
//! Call the Ruby method specified by 'id' on object 'obj'.
|
5
|
+
/*! Pass in arguments (arg1, arg2, ...). The arguments will be converted to
|
6
|
+
* Ruby objects with to_ruby<>. The return value will automatically be
|
7
|
+
* converted to type Retval_T with from_ruby<>.
|
8
|
+
*
|
9
|
+
* E.g.:
|
10
|
+
* \code
|
11
|
+
* float y = x.call<float>("foo", z, 42);
|
12
|
+
* \endcode
|
13
|
+
*/
|
14
|
+
template<typename Retval_T>
|
15
|
+
Retval_T call(Identifier id, T1 arg1, T2 arg2, ...) const;
|
16
|
+
|
17
|
+
//! Version of call which defaults to Object return type.
|
18
|
+
Object call(Identifier id, T1 arg1, T2 arg2, ...) const;
|
19
|
+
#else
|
20
|
+
|
21
|
+
|
22
|
+
Object call(Identifier id) const;
|
23
|
+
|
24
|
+
|
25
|
+
template<typename T1>
|
26
|
+
Object call(Identifier id, T1 arg1) const;
|
27
|
+
|
28
|
+
|
29
|
+
template<typename T1, typename T2>
|
30
|
+
Object call(Identifier id, T1 arg1, T2 arg2) const;
|
31
|
+
|
32
|
+
|
33
|
+
template<typename T1, typename T2, typename T3>
|
34
|
+
Object call(Identifier id, T1 arg1, T2 arg2, T3 arg3) const;
|
35
|
+
|
36
|
+
|
37
|
+
template<typename T1, typename T2, typename T3, typename T4>
|
38
|
+
Object call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4) const;
|
39
|
+
|
40
|
+
|
41
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5>
|
42
|
+
Object call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) const;
|
43
|
+
|
44
|
+
|
45
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
46
|
+
Object call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) const;
|
47
|
+
|
48
|
+
|
49
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
50
|
+
Object call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) const;
|
51
|
+
|
52
|
+
|
53
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
54
|
+
Object call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) const;
|
55
|
+
|
56
|
+
|
57
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
58
|
+
Object call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) const;
|
59
|
+
|
60
|
+
|
61
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
|
62
|
+
Object call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10) const;
|
63
|
+
|
64
|
+
|
65
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
|
66
|
+
Object call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11) const;
|
67
|
+
|
68
|
+
|
69
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
|
70
|
+
Object call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12) const;
|
71
|
+
|
72
|
+
|
73
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13>
|
74
|
+
Object call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13) const;
|
75
|
+
|
76
|
+
|
77
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
|
78
|
+
Object call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14) const;
|
79
|
+
|
80
|
+
|
81
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15>
|
82
|
+
Object call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15) const;
|
83
|
+
|
84
|
+
|
85
|
+
#endif // DOXYGEN
|
@@ -0,0 +1,147 @@
|
|
1
|
+
// This is a generated file. DO NOT EDIT!!
|
2
|
+
#include "../protect.hpp"
|
3
|
+
#include "../to_from_ruby.hpp"
|
4
|
+
|
5
|
+
|
6
|
+
inline Rice::Object Rice::Object::
|
7
|
+
call(Identifier id) const
|
8
|
+
{
|
9
|
+
VALUE args[] = { };
|
10
|
+
return protect(rb_funcall2, value(), id, 0, args);
|
11
|
+
}
|
12
|
+
|
13
|
+
|
14
|
+
template<typename T1>
|
15
|
+
inline Rice::Object Rice::Object::
|
16
|
+
call(Identifier id, T1 arg1) const
|
17
|
+
{
|
18
|
+
VALUE args[] = { to_ruby(arg1) };
|
19
|
+
return protect(rb_funcall2, value(), id, 1, args);
|
20
|
+
}
|
21
|
+
|
22
|
+
|
23
|
+
template<typename T1, typename T2>
|
24
|
+
inline Rice::Object Rice::Object::
|
25
|
+
call(Identifier id, T1 arg1, T2 arg2) const
|
26
|
+
{
|
27
|
+
VALUE args[] = { to_ruby(arg1), to_ruby(arg2) };
|
28
|
+
return protect(rb_funcall2, value(), id, 2, args);
|
29
|
+
}
|
30
|
+
|
31
|
+
|
32
|
+
template<typename T1, typename T2, typename T3>
|
33
|
+
inline Rice::Object Rice::Object::
|
34
|
+
call(Identifier id, T1 arg1, T2 arg2, T3 arg3) const
|
35
|
+
{
|
36
|
+
VALUE args[] = { to_ruby(arg1), to_ruby(arg2), to_ruby(arg3) };
|
37
|
+
return protect(rb_funcall2, value(), id, 3, args);
|
38
|
+
}
|
39
|
+
|
40
|
+
|
41
|
+
template<typename T1, typename T2, typename T3, typename T4>
|
42
|
+
inline Rice::Object Rice::Object::
|
43
|
+
call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4) const
|
44
|
+
{
|
45
|
+
VALUE args[] = { to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4) };
|
46
|
+
return protect(rb_funcall2, value(), id, 4, args);
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5>
|
51
|
+
inline Rice::Object Rice::Object::
|
52
|
+
call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) const
|
53
|
+
{
|
54
|
+
VALUE args[] = { to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4), to_ruby(arg5) };
|
55
|
+
return protect(rb_funcall2, value(), id, 5, args);
|
56
|
+
}
|
57
|
+
|
58
|
+
|
59
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
60
|
+
inline Rice::Object Rice::Object::
|
61
|
+
call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) const
|
62
|
+
{
|
63
|
+
VALUE args[] = { to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4), to_ruby(arg5), to_ruby(arg6) };
|
64
|
+
return protect(rb_funcall2, value(), id, 6, args);
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
69
|
+
inline Rice::Object Rice::Object::
|
70
|
+
call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) const
|
71
|
+
{
|
72
|
+
VALUE args[] = { to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4), to_ruby(arg5), to_ruby(arg6), to_ruby(arg7) };
|
73
|
+
return protect(rb_funcall2, value(), id, 7, args);
|
74
|
+
}
|
75
|
+
|
76
|
+
|
77
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
78
|
+
inline Rice::Object Rice::Object::
|
79
|
+
call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) const
|
80
|
+
{
|
81
|
+
VALUE args[] = { to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4), to_ruby(arg5), to_ruby(arg6), to_ruby(arg7), to_ruby(arg8) };
|
82
|
+
return protect(rb_funcall2, value(), id, 8, args);
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
87
|
+
inline Rice::Object Rice::Object::
|
88
|
+
call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) const
|
89
|
+
{
|
90
|
+
VALUE args[] = { to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4), to_ruby(arg5), to_ruby(arg6), to_ruby(arg7), to_ruby(arg8), to_ruby(arg9) };
|
91
|
+
return protect(rb_funcall2, value(), id, 9, args);
|
92
|
+
}
|
93
|
+
|
94
|
+
|
95
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
|
96
|
+
inline Rice::Object Rice::Object::
|
97
|
+
call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10) const
|
98
|
+
{
|
99
|
+
VALUE args[] = { to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4), to_ruby(arg5), to_ruby(arg6), to_ruby(arg7), to_ruby(arg8), to_ruby(arg9), to_ruby(arg10) };
|
100
|
+
return protect(rb_funcall2, value(), id, 10, args);
|
101
|
+
}
|
102
|
+
|
103
|
+
|
104
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
|
105
|
+
inline Rice::Object Rice::Object::
|
106
|
+
call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11) const
|
107
|
+
{
|
108
|
+
VALUE args[] = { to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4), to_ruby(arg5), to_ruby(arg6), to_ruby(arg7), to_ruby(arg8), to_ruby(arg9), to_ruby(arg10), to_ruby(arg11) };
|
109
|
+
return protect(rb_funcall2, value(), id, 11, args);
|
110
|
+
}
|
111
|
+
|
112
|
+
|
113
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
|
114
|
+
inline Rice::Object Rice::Object::
|
115
|
+
call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12) const
|
116
|
+
{
|
117
|
+
VALUE args[] = { to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4), to_ruby(arg5), to_ruby(arg6), to_ruby(arg7), to_ruby(arg8), to_ruby(arg9), to_ruby(arg10), to_ruby(arg11), to_ruby(arg12) };
|
118
|
+
return protect(rb_funcall2, value(), id, 12, args);
|
119
|
+
}
|
120
|
+
|
121
|
+
|
122
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13>
|
123
|
+
inline Rice::Object Rice::Object::
|
124
|
+
call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13) const
|
125
|
+
{
|
126
|
+
VALUE args[] = { to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4), to_ruby(arg5), to_ruby(arg6), to_ruby(arg7), to_ruby(arg8), to_ruby(arg9), to_ruby(arg10), to_ruby(arg11), to_ruby(arg12), to_ruby(arg13) };
|
127
|
+
return protect(rb_funcall2, value(), id, 13, args);
|
128
|
+
}
|
129
|
+
|
130
|
+
|
131
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
|
132
|
+
inline Rice::Object Rice::Object::
|
133
|
+
call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14) const
|
134
|
+
{
|
135
|
+
VALUE args[] = { to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4), to_ruby(arg5), to_ruby(arg6), to_ruby(arg7), to_ruby(arg8), to_ruby(arg9), to_ruby(arg10), to_ruby(arg11), to_ruby(arg12), to_ruby(arg13), to_ruby(arg14) };
|
136
|
+
return protect(rb_funcall2, value(), id, 14, args);
|
137
|
+
}
|
138
|
+
|
139
|
+
|
140
|
+
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15>
|
141
|
+
inline Rice::Object Rice::Object::
|
142
|
+
call(Identifier id, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15) const
|
143
|
+
{
|
144
|
+
VALUE args[] = { to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4), to_ruby(arg5), to_ruby(arg6), to_ruby(arg7), to_ruby(arg8), to_ruby(arg9), to_ruby(arg10), to_ruby(arg11), to_ruby(arg12), to_ruby(arg13), to_ruby(arg14), to_ruby(arg15) };
|
145
|
+
return protect(rb_funcall2, value(), id, 15, args);
|
146
|
+
}
|
147
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#include "protect.hpp"
|
2
|
+
#include "../Exception.hpp"
|
3
|
+
#include "../Jump_Tag.hpp"
|
4
|
+
|
5
|
+
#ifndef TAG_RAISE
|
6
|
+
#define TAG_RAISE 0x6
|
7
|
+
#endif
|
8
|
+
|
9
|
+
VALUE Rice::detail::
|
10
|
+
protect(
|
11
|
+
RUBY_VALUE_FUNC f,
|
12
|
+
VALUE arg)
|
13
|
+
{
|
14
|
+
int state = 0;
|
15
|
+
VALUE retval = rb_protect(f, arg, &state);
|
16
|
+
if(state != 0)
|
17
|
+
{
|
18
|
+
VALUE err = rb_errinfo();
|
19
|
+
if(state == TAG_RAISE && RTEST(err))
|
20
|
+
{
|
21
|
+
// TODO: convert NoMemoryError into bad_alloc?
|
22
|
+
rb_set_errinfo(Rice::Nil);
|
23
|
+
throw Rice::Exception(err);
|
24
|
+
}
|
25
|
+
throw Jump_Tag(state);
|
26
|
+
}
|
27
|
+
return retval;
|
28
|
+
}
|
29
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#ifndef Rice__detail__protect__hpp_
|
2
|
+
#define Rice__detail__protect__hpp_
|
3
|
+
|
4
|
+
#include "ruby.hpp"
|
5
|
+
|
6
|
+
/*! \file
|
7
|
+
* \brief Functions for making exception-safe calls into Ruby code.
|
8
|
+
* These are the building blocks for building other exception-safe
|
9
|
+
* helper functions.
|
10
|
+
*/
|
11
|
+
|
12
|
+
namespace Rice
|
13
|
+
{
|
14
|
+
|
15
|
+
namespace detail
|
16
|
+
{
|
17
|
+
|
18
|
+
//! Call the given function, converting Ruby exceptions to C++
|
19
|
+
//! exceptions.
|
20
|
+
/*! Call the function f with the parameter arg If f raises a Ruby
|
21
|
+
* exception, then the exception is re-thrown as an Exception. If f
|
22
|
+
* exits with any other non-zero tag (e.g. a Symbol is thrown), then the
|
23
|
+
* tag is re-thrown as a Jump_Tag.
|
24
|
+
*/
|
25
|
+
VALUE protect(
|
26
|
+
RUBY_VALUE_FUNC f,
|
27
|
+
VALUE arg);
|
28
|
+
|
29
|
+
} // namespace detail
|
30
|
+
|
31
|
+
} // namespace Rice
|
32
|
+
|
33
|
+
#endif // Rice__detail__protect__hpp_
|
34
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#ifndef Rice__detail__remove_const__hpp_
|
2
|
+
#define Rice__detail__remove_const__hpp_
|
3
|
+
|
4
|
+
namespace Rice
|
5
|
+
{
|
6
|
+
|
7
|
+
namespace detail
|
8
|
+
{
|
9
|
+
|
10
|
+
template<typename T>
|
11
|
+
struct remove_const { typedef T Type; };
|
12
|
+
|
13
|
+
template<typename T>
|
14
|
+
struct remove_const<T const> { typedef T Type; };
|
15
|
+
|
16
|
+
} // namespace detail
|
17
|
+
|
18
|
+
} // namespace Rice
|
19
|
+
|
20
|
+
#endif // Rice__detail__remove_const__hpp_
|
21
|
+
|
@@ -0,0 +1,89 @@
|
|
1
|
+
#ifndef Rice__detail__ruby__hpp_
|
2
|
+
#define Rice__detail__ruby__hpp_
|
3
|
+
|
4
|
+
/*! \file
|
5
|
+
* \brief Hacks for addressing incompatibilities between various Ruby
|
6
|
+
* versions.
|
7
|
+
*/
|
8
|
+
|
9
|
+
#include <cmath>
|
10
|
+
|
11
|
+
// missing.h that comes with the one-click installer doesn't properly
|
12
|
+
// check for double-definition of isinf
|
13
|
+
#ifdef isinf
|
14
|
+
#define HAVE_ISINF
|
15
|
+
#endif
|
16
|
+
|
17
|
+
#include "ruby_version_code.hpp"
|
18
|
+
|
19
|
+
// workaround for ruby 1.8.4, which defines eaccess and shouldn't
|
20
|
+
#if RICE__RUBY_VERSION_CODE <= 184
|
21
|
+
#define eaccess ruby_eaccess
|
22
|
+
#endif
|
23
|
+
|
24
|
+
#include <ruby.h>
|
25
|
+
|
26
|
+
#if RICE__RUBY_VERSION_CODE <= 184
|
27
|
+
#undef eaccess
|
28
|
+
#endif
|
29
|
+
|
30
|
+
#ifdef WIN32
|
31
|
+
#include "win32.hpp"
|
32
|
+
#endif
|
33
|
+
|
34
|
+
// This causes problems with certain C++ libraries
|
35
|
+
#undef TYPE
|
36
|
+
|
37
|
+
//! A function that takes a VALUE as a parameter and returns a VALUE.
|
38
|
+
// TODO: Casting from a C++ function to an extern "C" function won't
|
39
|
+
// work on all platforms. I'm not sure what to do about this.
|
40
|
+
extern "C" typedef VALUE (*RUBY_VALUE_FUNC)(VALUE);
|
41
|
+
|
42
|
+
// Fix Ruby RUBY_METHOD_FUNC from macro to typedef
|
43
|
+
#if defined(RUBY_METHOD_FUNC)
|
44
|
+
# undef RUBY_METHOD_FUNC
|
45
|
+
extern "C" typedef VALUE (*RUBY_METHOD_FUNC)(ANYARGS);
|
46
|
+
#endif
|
47
|
+
|
48
|
+
#ifndef RSTRING_LEN
|
49
|
+
#define RSTRING_LEN(str) RSTRING(str)->len
|
50
|
+
#endif
|
51
|
+
|
52
|
+
#ifndef RSTRING_PTR
|
53
|
+
#define RSTRING_PTR(str) RSTRING(str)->ptr
|
54
|
+
#endif
|
55
|
+
|
56
|
+
#ifndef RARRAY_LEN
|
57
|
+
#define RARRAY_LEN(arr) RARRAY(arr)->len
|
58
|
+
#endif
|
59
|
+
|
60
|
+
#ifndef RARRAY_PTR
|
61
|
+
#define RARRAY_PTR(arr) RARRAY(arr)->ptr
|
62
|
+
#endif
|
63
|
+
|
64
|
+
#ifndef RHASH_TBL
|
65
|
+
#define RHASH_TBL(hsh) RHASH(hsh)->tbl
|
66
|
+
#endif
|
67
|
+
|
68
|
+
// ruby.h has a few defines that conflict with Visual Studio's STL
|
69
|
+
#if defined(_MSC_VER)
|
70
|
+
#undef write
|
71
|
+
#undef read
|
72
|
+
#undef bind
|
73
|
+
#endif
|
74
|
+
|
75
|
+
#if RICE__RUBY_VERSION_CODE < 190
|
76
|
+
namespace Rice
|
77
|
+
{
|
78
|
+
namespace detail
|
79
|
+
{
|
80
|
+
inline VALUE rb_errinfo() { return ruby_errinfo; }
|
81
|
+
inline void rb_set_errinfo(VALUE exc) { ruby_errinfo = exc; }
|
82
|
+
} // detail
|
83
|
+
} // Rice
|
84
|
+
#define rb_errinfo() ::Rice::detail::rb_errinfo()
|
85
|
+
#define rb_set_errinfo(exc) ::Rice::detail::rb_set_errinfo(exc)
|
86
|
+
#endif
|
87
|
+
|
88
|
+
#endif // Rice__detail__ruby__hpp_
|
89
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#ifndef Rice__detail__rubysig__hpp_
|
2
|
+
#define Rice__detail__rubysig__hpp_
|
3
|
+
|
4
|
+
#include "ruby_version_code.hpp"
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Helper header for the rubysig.h ruby include file, which does
|
8
|
+
* not have extern "C"
|
9
|
+
*/
|
10
|
+
|
11
|
+
#if RICE__RUBY_VERSION_CODE < 190
|
12
|
+
|
13
|
+
extern "C" {
|
14
|
+
#include "rubysig.h"
|
15
|
+
}
|
16
|
+
|
17
|
+
#endif
|
18
|
+
|
19
|
+
#endif
|