wurlinc-rice 1.4.0.1
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/README +1119 -0
- data/README.mingw +8 -0
- data/Rakefile +33 -0
- data/bootstrap +9 -0
- data/configure.ac +52 -0
- data/doxygen.ac +314 -0
- data/doxygen.am +186 -0
- data/extconf.rb +41 -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 +127 -0
- data/rice/Arg_operators.cpp +21 -0
- data/rice/Arg_operators.hpp +19 -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 +367 -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 +54 -0
- data/rice/Data_Type.hpp +8 -0
- data/rice/Data_Type.ipp +365 -0
- data/rice/Data_Type_defn.hpp +261 -0
- data/rice/Data_Type_fwd.hpp +12 -0
- data/rice/Director.cpp +13 -0
- data/rice/Director.hpp +39 -0
- data/rice/Enum.hpp +117 -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 +129 -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 +160 -0
- data/rice/Object.hpp +8 -0
- data/rice/Object.ipp +19 -0
- data/rice/Object_defn.hpp +191 -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.in +40 -0
- data/rice/detail/Arguments.hpp +118 -0
- data/rice/detail/Auto_Function_Wrapper.hpp +829 -0
- data/rice/detail/Auto_Function_Wrapper.ipp +3391 -0
- data/rice/detail/Auto_Member_Function_Wrapper.hpp +828 -0
- data/rice/detail/Auto_Member_Function_Wrapper.ipp +2503 -0
- data/rice/detail/Caster.hpp +103 -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/cfp.hpp +24 -0
- data/rice/detail/cfp.ipp +51 -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 +159 -0
- data/rice/detail/method_data.hpp +21 -0
- data/rice/detail/mininode.cpp +1220 -0
- data/rice/detail/mininode.hpp +320 -0
- data/rice/detail/node.hpp +13 -0
- data/rice/detail/object_call.hpp +68 -0
- data/rice/detail/object_call.ipp +131 -0
- data/rice/detail/protect.cpp +29 -0
- data/rice/detail/protect.hpp +34 -0
- data/rice/detail/ruby.hpp +93 -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 +36 -0
- data/rice/detail/traits.hpp +43 -0
- data/rice/detail/win32.hpp +16 -0
- data/rice/detail/wrap_function.hpp +341 -0
- data/rice/detail/wrap_function.ipp +514 -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 +1133 -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 +297 -0
- data/rice/to_from_ruby_defn.hpp +71 -0
- data/ruby/Makefile.am +1 -0
- data/ruby/lib/Makefile.am +3 -0
- data/ruby/lib/mkmf-rice.rb.in +216 -0
- data/ruby/lib/version.rb +3 -0
- data/ruby.ac +136 -0
- data/sample/Makefile.am +47 -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 +78 -0
- data/test/ext/Makefile.am +43 -0
- data/test/ext/t1/Foo.hpp +10 -0
- data/test/ext/t1/extconf.rb +2 -0
- data/test/ext/t1/t1.cpp +15 -0
- data/test/ext/t2/extconf.rb +2 -0
- data/test/ext/t2/t2.cpp +11 -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 +498 -0
- data/test/test_Constructor.cpp +128 -0
- data/test/test_Critical_Guard.cpp +51 -0
- data/test/test_Data_Object.cpp +275 -0
- data/test/test_Data_Type.cpp +348 -0
- data/test/test_Director.cpp +301 -0
- data/test/test_Enum.cpp +195 -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_Memory_Management.cpp +50 -0
- data/test/test_Module.cpp +481 -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 +114 -0
- data/test/test_rice.rb +43 -0
- data/test/unittest.cpp +136 -0
- data/test/unittest.hpp +292 -0
- metadata +276 -0
@@ -0,0 +1,320 @@
|
|
1
|
+
#ifndef Rice__detail__mininode__hpp
|
2
|
+
#define Rice__detail__mininode__hpp
|
3
|
+
|
4
|
+
#include "ruby.hpp"
|
5
|
+
|
6
|
+
// TODO: This is silly, autoconf...
|
7
|
+
#undef PACKAGE_NAME
|
8
|
+
#undef PACKAGE_STRING
|
9
|
+
#undef PACKAGE_TARNAME
|
10
|
+
#undef PACKAGE_VERSION
|
11
|
+
|
12
|
+
#include "../config.hpp"
|
13
|
+
|
14
|
+
// TODO: This is silly, autoconf...
|
15
|
+
#undef PACKAGE_NAME
|
16
|
+
#undef PACKAGE_STRING
|
17
|
+
#undef PACKAGE_TARNAME
|
18
|
+
#undef PACKAGE_VERSION
|
19
|
+
|
20
|
+
#if !defined(HAVE_NODE_H) && !defined(REALLY_HAVE_RUBY_NODE_H)
|
21
|
+
|
22
|
+
namespace Rice
|
23
|
+
{
|
24
|
+
|
25
|
+
namespace detail
|
26
|
+
{
|
27
|
+
|
28
|
+
namespace Mininode
|
29
|
+
{
|
30
|
+
|
31
|
+
typedef struct RNode {
|
32
|
+
unsigned long flags;
|
33
|
+
void * reserved;
|
34
|
+
union {
|
35
|
+
struct RNode * node;
|
36
|
+
VALUE (*cfunc)(ANYARGS);
|
37
|
+
} u1;
|
38
|
+
union {
|
39
|
+
struct RNode * node;
|
40
|
+
VALUE value;
|
41
|
+
} u2;
|
42
|
+
union {
|
43
|
+
struct RNode * node;
|
44
|
+
} u3;
|
45
|
+
} NODE;
|
46
|
+
|
47
|
+
#define nd_cfnc u1.cfunc
|
48
|
+
#define nd_rval u2.value
|
49
|
+
|
50
|
+
/* TODO: No way to know the correct size of node_type */
|
51
|
+
enum node_type {
|
52
|
+
NODE_FOO,
|
53
|
+
};
|
54
|
+
|
55
|
+
extern "C"
|
56
|
+
void rb_add_method(VALUE, ID, NODE *, int);
|
57
|
+
|
58
|
+
extern "C"
|
59
|
+
NODE *rb_node_newnode(enum node_type, VALUE, VALUE, VALUE);
|
60
|
+
|
61
|
+
template<typename T, typename A0, typename A1, typename A2>
|
62
|
+
inline NODE * NEW_NODE(T t, A0 a0, A1 a1, A2 a2)
|
63
|
+
{
|
64
|
+
return rb_node_newnode((node_type)t, (VALUE)a0, (VALUE)a1, (VALUE)a2);
|
65
|
+
}
|
66
|
+
|
67
|
+
#define NODE_METHOD Rice::detail::Mininode::get_NODE_METHOD()
|
68
|
+
#define NODE_FBODY Rice::detail::Mininode::get_NODE_FBODY()
|
69
|
+
#define NODE_CFUNC Rice::detail::Mininode::get_NODE_CFUNC()
|
70
|
+
#define NODE_SCOPE Rice::detail::Mininode::get_NODE_SCOPE()
|
71
|
+
#define NODE_BLOCK Rice::detail::Mininode::get_NODE_BLOCK()
|
72
|
+
#define NODE_IF Rice::detail::Mininode::get_NODE_IF()
|
73
|
+
#define NODE_CASE Rice::detail::Mininode::get_NODE_CASE()
|
74
|
+
#define NODE_WHEN Rice::detail::Mininode::get_NODE_WHEN()
|
75
|
+
#define NODE_OPT_N Rice::detail::Mininode::get_NODE_OPT_N()
|
76
|
+
#define NODE_WHILE Rice::detail::Mininode::get_NODE_WHILE()
|
77
|
+
#define NODE_UNTIL Rice::detail::Mininode::get_NODE_UNTIL()
|
78
|
+
#define NODE_ITER Rice::detail::Mininode::get_NODE_ITER()
|
79
|
+
#define NODE_FOR Rice::detail::Mininode::get_NODE_FOR()
|
80
|
+
#define NODE_BREAK Rice::detail::Mininode::get_NODE_BREAK()
|
81
|
+
#define NODE_NEXT Rice::detail::Mininode::get_NODE_NEXT()
|
82
|
+
#define NODE_REDO Rice::detail::Mininode::get_NODE_REDO()
|
83
|
+
#define NODE_RETRY Rice::detail::Mininode::get_NODE_RETRY()
|
84
|
+
#define NODE_BEGIN Rice::detail::Mininode::get_NODE_BEGIN()
|
85
|
+
#define NODE_RESCUE Rice::detail::Mininode::get_NODE_RESCUE()
|
86
|
+
#define NODE_RESBODY Rice::detail::Mininode::get_NODE_RESBODY()
|
87
|
+
#define NODE_ENSURE Rice::detail::Mininode::get_NODE_ENSURE()
|
88
|
+
#define NODE_AND Rice::detail::Mininode::get_NODE_AND()
|
89
|
+
#define NODE_OR Rice::detail::Mininode::get_NODE_OR()
|
90
|
+
#define NODE_MASGN Rice::detail::Mininode::get_NODE_MASGN()
|
91
|
+
#define NODE_LASGN Rice::detail::Mininode::get_NODE_LASGN()
|
92
|
+
#define NODE_DASGN Rice::detail::Mininode::get_NODE_DASGN()
|
93
|
+
#define NODE_DASGN_CURR Rice::detail::Mininode::get_NODE_DASGN_CURR()
|
94
|
+
#define NODE_GASGN Rice::detail::Mininode::get_NODE_GASGN()
|
95
|
+
#define NODE_IASGN Rice::detail::Mininode::get_NODE_IASGN()
|
96
|
+
#define NODE_IASGN2 Rice::detail::Mininode::get_NODE_IASGN2()
|
97
|
+
#define NODE_CDECL Rice::detail::Mininode::get_NODE_CDECL()
|
98
|
+
#define NODE_CVDECL Rice::detail::Mininode::get_NODE_CVDECL()
|
99
|
+
#define NODE_OP_ASGN1 Rice::detail::Mininode::get_NODE_OP_ASGN1()
|
100
|
+
#define NODE_OP_ASGN2 Rice::detail::Mininode::get_NODE_OP_ASGN2()
|
101
|
+
#define NODE_OP_ASGN_AND Rice::detail::Mininode::get_NODE_OP_ASGN_AND()
|
102
|
+
#define NODE_OP_ASGN_OR Rice::detail::Mininode::get_NODE_OP_ASGN_OR()
|
103
|
+
#define NODE_CALL Rice::detail::Mininode::get_NODE_CALL()
|
104
|
+
#define NODE_FCALL Rice::detail::Mininode::get_NODE_FCALL()
|
105
|
+
#define NODE_VCALL Rice::detail::Mininode::get_NODE_VCALL()
|
106
|
+
#define NODE_SUPER Rice::detail::Mininode::get_NODE_SUPER()
|
107
|
+
#define NODE_ZSUPER Rice::detail::Mininode::get_NODE_ZSUPER()
|
108
|
+
#define NODE_ARRAY Rice::detail::Mininode::get_NODE_ARRAY()
|
109
|
+
#define NODE_ZARRAY Rice::detail::Mininode::get_NODE_ZARRAY()
|
110
|
+
#define NODE_VALUES Rice::detail::Mininode::get_NODE_VALUES()
|
111
|
+
#define NODE_HASH Rice::detail::Mininode::get_NODE_HASH()
|
112
|
+
#define NODE_RETURN Rice::detail::Mininode::get_NODE_RETURN()
|
113
|
+
#define NODE_YIELD Rice::detail::Mininode::get_NODE_YIELD()
|
114
|
+
#define NODE_LVAR Rice::detail::Mininode::get_NODE_LVAR()
|
115
|
+
#define NODE_DVAR Rice::detail::Mininode::get_NODE_DVAR()
|
116
|
+
#define NODE_GVAR Rice::detail::Mininode::get_NODE_GVAR()
|
117
|
+
#define NODE_IVAR Rice::detail::Mininode::get_NODE_IVAR()
|
118
|
+
#define NODE_CONST Rice::detail::Mininode::get_NODE_CONST()
|
119
|
+
#define NODE_CVAR Rice::detail::Mininode::get_NODE_CVAR()
|
120
|
+
#define NODE_NTH_REF Rice::detail::Mininode::get_NODE_NTH_REF()
|
121
|
+
#define NODE_BACK_REF Rice::detail::Mininode::get_NODE_BACK_REF()
|
122
|
+
#define NODE_MATCH Rice::detail::Mininode::get_NODE_MATCH()
|
123
|
+
#define NODE_MATCH2 Rice::detail::Mininode::get_NODE_MATCH2()
|
124
|
+
#define NODE_MATCH3 Rice::detail::Mininode::get_NODE_MATCH3()
|
125
|
+
#define NODE_LIT Rice::detail::Mininode::get_NODE_LIT()
|
126
|
+
#define NODE_STR Rice::detail::Mininode::get_NODE_STR()
|
127
|
+
#define NODE_DSTR Rice::detail::Mininode::get_NODE_DSTR()
|
128
|
+
#define NODE_XSTR Rice::detail::Mininode::get_NODE_XSTR()
|
129
|
+
#define NODE_DXSTR Rice::detail::Mininode::get_NODE_DXSTR()
|
130
|
+
#define NODE_EVSTR Rice::detail::Mininode::get_NODE_EVSTR()
|
131
|
+
#define NODE_DREGX Rice::detail::Mininode::get_NODE_DREGX()
|
132
|
+
#define NODE_DREGX_ONCE Rice::detail::Mininode::get_NODE_DREGX_ONCE()
|
133
|
+
#define NODE_ARGS Rice::detail::Mininode::get_NODE_ARGS()
|
134
|
+
#define NODE_ARGS_AUX Rice::detail::Mininode::get_NODE_ARGS_AUX()
|
135
|
+
#define NODE_OPT_ARG Rice::detail::Mininode::get_NODE_OPT_ARG()
|
136
|
+
#define NODE_POSTARG Rice::detail::Mininode::get_NODE_POSTARG()
|
137
|
+
#define NODE_ARGSCAT Rice::detail::Mininode::get_NODE_ARGSCAT()
|
138
|
+
#define NODE_ARGSPUSH Rice::detail::Mininode::get_NODE_ARGSPUSH()
|
139
|
+
#define NODE_SPLAT Rice::detail::Mininode::get_NODE_SPLAT()
|
140
|
+
#define NODE_TO_ARY Rice::detail::Mininode::get_NODE_TO_ARY()
|
141
|
+
#define NODE_BLOCK_ARG Rice::detail::Mininode::get_NODE_BLOCK_ARG()
|
142
|
+
#define NODE_BLOCK_PASS Rice::detail::Mininode::get_NODE_BLOCK_PASS()
|
143
|
+
#define NODE_DEFN Rice::detail::Mininode::get_NODE_DEFN()
|
144
|
+
#define NODE_ALIAS Rice::detail::Mininode::get_NODE_ALIAS()
|
145
|
+
#define NODE_VALIAS Rice::detail::Mininode::get_NODE_VALIAS()
|
146
|
+
#define NODE_UNDEF Rice::detail::Mininode::get_NODE_UNDEF()
|
147
|
+
#define NODE_CLASS Rice::detail::Mininode::get_NODE_CLASS()
|
148
|
+
#define NODE_MODULE Rice::detail::Mininode::get_NODE_MODULE()
|
149
|
+
#define NODE_SCLASS Rice::detail::Mininode::get_NODE_SCLASS()
|
150
|
+
#define NODE_COLON2 Rice::detail::Mininode::get_NODE_COLON2()
|
151
|
+
#define NODE_COLON3 Rice::detail::Mininode::get_NODE_COLON3()
|
152
|
+
#define NODE_DOT2 Rice::detail::Mininode::get_NODE_DOT2()
|
153
|
+
#define NODE_DOT3 Rice::detail::Mininode::get_NODE_DOT3()
|
154
|
+
#define NODE_FLIP2 Rice::detail::Mininode::get_NODE_FLIP2()
|
155
|
+
#define NODE_FLIP3 Rice::detail::Mininode::get_NODE_FLIP3()
|
156
|
+
#define NODE_ATTRSET Rice::detail::Mininode::get_NODE_ATTRSET()
|
157
|
+
#define NODE_SELF Rice::detail::Mininode::get_NODE_SELF()
|
158
|
+
#define NODE_NIL Rice::detail::Mininode::get_NODE_NIL()
|
159
|
+
#define NODE_TRUE Rice::detail::Mininode::get_NODE_TRUE()
|
160
|
+
#define NODE_FALSE Rice::detail::Mininode::get_NODE_FALSE()
|
161
|
+
#define NODE_ERRINFO Rice::detail::Mininode::get_NODE_ERRINFO()
|
162
|
+
#define NODE_DEFINED Rice::detail::Mininode::get_NODE_DEFINED()
|
163
|
+
#define NODE_POSTEXE Rice::detail::Mininode::get_NODE_POSTEXE()
|
164
|
+
#define NODE_ALLOCA Rice::detail::Mininode::get_NODE_ALLOCA()
|
165
|
+
#define NODE_BMETHOD Rice::detail::Mininode::get_NODE_BMETHOD()
|
166
|
+
#define NODE_MEMO Rice::detail::Mininode::get_NODE_MEMO()
|
167
|
+
#define NODE_IFUNC Rice::detail::Mininode::get_NODE_IFUNC()
|
168
|
+
#define NODE_DSYM Rice::detail::Mininode::get_NODE_DSYM()
|
169
|
+
#define NODE_ATTRASGN Rice::detail::Mininode::get_NODE_ATTRASGN()
|
170
|
+
#define NODE_PRELUDE Rice::detail::Mininode::get_NODE_PRELUDE()
|
171
|
+
#define NODE_LAMBDA Rice::detail::Mininode::get_NODE_LAMBDA()
|
172
|
+
#define NODE_OPTBLOCK Rice::detail::Mininode::get_NODE_OPTBLOCK()
|
173
|
+
#define NODE_LAST Rice::detail::Mininode::get_NODE_LAST()
|
174
|
+
|
175
|
+
int get_NODE_METHOD();
|
176
|
+
int get_NODE_FBODY();
|
177
|
+
int get_NODE_CFUNC();
|
178
|
+
int get_NODE_SCOPE();
|
179
|
+
int get_NODE_BLOCK();
|
180
|
+
int get_NODE_IF();
|
181
|
+
int get_NODE_CASE();
|
182
|
+
int get_NODE_WHEN();
|
183
|
+
int get_NODE_OPT_N();
|
184
|
+
int get_NODE_WHILE();
|
185
|
+
int get_NODE_UNTIL();
|
186
|
+
int get_NODE_ITER();
|
187
|
+
int get_NODE_FOR();
|
188
|
+
int get_NODE_BREAK();
|
189
|
+
int get_NODE_NEXT();
|
190
|
+
int get_NODE_REDO();
|
191
|
+
int get_NODE_RETRY();
|
192
|
+
int get_NODE_BEGIN();
|
193
|
+
int get_NODE_RESCUE();
|
194
|
+
int get_NODE_RESBODY();
|
195
|
+
int get_NODE_ENSURE();
|
196
|
+
int get_NODE_AND();
|
197
|
+
int get_NODE_OR();
|
198
|
+
int get_NODE_MASGN();
|
199
|
+
int get_NODE_LASGN();
|
200
|
+
int get_NODE_DASGN();
|
201
|
+
int get_NODE_DASGN_CURR();
|
202
|
+
int get_NODE_GASGN();
|
203
|
+
int get_NODE_IASGN();
|
204
|
+
int get_NODE_IASGN2();
|
205
|
+
int get_NODE_CDECL();
|
206
|
+
int get_NODE_CVDECL();
|
207
|
+
int get_NODE_OP_ASGN1();
|
208
|
+
int get_NODE_OP_ASGN2();
|
209
|
+
int get_NODE_OP_ASGN_AND();
|
210
|
+
int get_NODE_OP_ASGN_OR();
|
211
|
+
int get_NODE_CALL();
|
212
|
+
int get_NODE_FCALL();
|
213
|
+
int get_NODE_VCALL();
|
214
|
+
int get_NODE_SUPER();
|
215
|
+
int get_NODE_ZSUPER();
|
216
|
+
int get_NODE_ARRAY();
|
217
|
+
int get_NODE_ZARRAY();
|
218
|
+
int get_NODE_VALUES();
|
219
|
+
int get_NODE_HASH();
|
220
|
+
int get_NODE_RETURN();
|
221
|
+
int get_NODE_YIELD();
|
222
|
+
int get_NODE_LVAR();
|
223
|
+
int get_NODE_DVAR();
|
224
|
+
int get_NODE_GVAR();
|
225
|
+
int get_NODE_IVAR();
|
226
|
+
int get_NODE_CONST();
|
227
|
+
int get_NODE_CVAR();
|
228
|
+
int get_NODE_NTH_REF();
|
229
|
+
int get_NODE_BACK_REF();
|
230
|
+
int get_NODE_MATCH();
|
231
|
+
int get_NODE_MATCH2();
|
232
|
+
int get_NODE_MATCH3();
|
233
|
+
int get_NODE_LIT();
|
234
|
+
int get_NODE_STR();
|
235
|
+
int get_NODE_DSTR();
|
236
|
+
int get_NODE_XSTR();
|
237
|
+
int get_NODE_DXSTR();
|
238
|
+
int get_NODE_EVSTR();
|
239
|
+
int get_NODE_DREGX();
|
240
|
+
int get_NODE_DREGX_ONCE();
|
241
|
+
int get_NODE_ARGS();
|
242
|
+
int get_NODE_ARGS_AUX();
|
243
|
+
int get_NODE_OPT_ARG();
|
244
|
+
int get_NODE_POSTARG();
|
245
|
+
int get_NODE_ARGSCAT();
|
246
|
+
int get_NODE_ARGSPUSH();
|
247
|
+
int get_NODE_SPLAT();
|
248
|
+
int get_NODE_TO_ARY();
|
249
|
+
int get_NODE_BLOCK_ARG();
|
250
|
+
int get_NODE_BLOCK_PASS();
|
251
|
+
int get_NODE_DEFN();
|
252
|
+
int get_NODE_ALIAS();
|
253
|
+
int get_NODE_VALIAS();
|
254
|
+
int get_NODE_UNDEF();
|
255
|
+
int get_NODE_CLASS();
|
256
|
+
int get_NODE_MODULE();
|
257
|
+
int get_NODE_SCLASS();
|
258
|
+
int get_NODE_COLON2();
|
259
|
+
int get_NODE_COLON3();
|
260
|
+
int get_NODE_DOT2();
|
261
|
+
int get_NODE_DOT3();
|
262
|
+
int get_NODE_FLIP2();
|
263
|
+
int get_NODE_FLIP3();
|
264
|
+
int get_NODE_ATTRSET();
|
265
|
+
int get_NODE_SELF();
|
266
|
+
int get_NODE_NIL();
|
267
|
+
int get_NODE_TRUE();
|
268
|
+
int get_NODE_FALSE();
|
269
|
+
int get_NODE_ERRINFO();
|
270
|
+
int get_NODE_DEFINED();
|
271
|
+
int get_NODE_POSTEXE();
|
272
|
+
int get_NODE_ALLOCA();
|
273
|
+
int get_NODE_BMETHOD();
|
274
|
+
int get_NODE_MEMO();
|
275
|
+
int get_NODE_IFUNC();
|
276
|
+
int get_NODE_DSYM();
|
277
|
+
int get_NODE_ATTRASGN();
|
278
|
+
int get_NODE_PRELUDE();
|
279
|
+
int get_NODE_LAMBDA();
|
280
|
+
int get_NODE_OPTBLOCK();
|
281
|
+
int get_NODE_LAST();
|
282
|
+
|
283
|
+
static const int NOEX_PUBLIC = 0x0;
|
284
|
+
|
285
|
+
inline NODE * NEW_METHOD(NODE * body, VALUE origin, int noex)
|
286
|
+
{
|
287
|
+
return NEW_NODE(NODE_METHOD, origin, body, noex);
|
288
|
+
}
|
289
|
+
|
290
|
+
#ifdef RUBY_VM
|
291
|
+
|
292
|
+
inline NODE * NEW_FBODY(NODE * body, ID id)
|
293
|
+
{
|
294
|
+
return NEW_NODE(NODE_FBODY, id, body, 0);
|
295
|
+
}
|
296
|
+
|
297
|
+
#else
|
298
|
+
|
299
|
+
inline NODE * NEW_FBODY(NODE * body, ID id, VALUE origin)
|
300
|
+
{
|
301
|
+
return NEW_NODE(NODE_FBODY, body, id, origin);
|
302
|
+
}
|
303
|
+
|
304
|
+
#endif // RUBY_VM
|
305
|
+
|
306
|
+
inline NODE * NEW_CFUNC(RUBY_METHOD_FUNC cfunc, int arity)
|
307
|
+
{
|
308
|
+
return NEW_NODE(NODE_CFUNC, cfunc, arity, 0);
|
309
|
+
}
|
310
|
+
|
311
|
+
} // namespace Mininode
|
312
|
+
|
313
|
+
} // namespace detail
|
314
|
+
|
315
|
+
} // namespace Rice
|
316
|
+
|
317
|
+
#endif
|
318
|
+
|
319
|
+
#endif // Rice__detail__mininode__hpp
|
320
|
+
|
@@ -0,0 +1,68 @@
|
|
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
|
+
Object call(Identifier id) const;
|
22
|
+
|
23
|
+
template<typename T0>
|
24
|
+
Object call(Identifier id, T0 arg0) const;
|
25
|
+
|
26
|
+
template<typename T0, typename T1>
|
27
|
+
Object call(Identifier id, T0 arg0, T1 arg1) const;
|
28
|
+
|
29
|
+
template<typename T0, typename T1, typename T2>
|
30
|
+
Object call(Identifier id, T0 arg0, T1 arg1, T2 arg2) const;
|
31
|
+
|
32
|
+
template<typename T0, typename T1, typename T2, typename T3>
|
33
|
+
Object call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3) const;
|
34
|
+
|
35
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4>
|
36
|
+
Object call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) const;
|
37
|
+
|
38
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
39
|
+
Object call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) const;
|
40
|
+
|
41
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
42
|
+
Object call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) const;
|
43
|
+
|
44
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
45
|
+
Object call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) const;
|
46
|
+
|
47
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
48
|
+
Object call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) const;
|
49
|
+
|
50
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
51
|
+
Object call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) const;
|
52
|
+
|
53
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
|
54
|
+
Object call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10) const;
|
55
|
+
|
56
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
|
57
|
+
Object call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11) const;
|
58
|
+
|
59
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
|
60
|
+
Object call(Identifier id, T0 arg0, 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;
|
61
|
+
|
62
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13>
|
63
|
+
Object call(Identifier id, T0 arg0, 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;
|
64
|
+
|
65
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
|
66
|
+
Object call(Identifier id, T0 arg0, 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;
|
67
|
+
|
68
|
+
#endif
|
@@ -0,0 +1,131 @@
|
|
1
|
+
// This is a generated file. DO NOT EDIT!!
|
2
|
+
#include "../protect.hpp"
|
3
|
+
#include "../to_from_ruby.hpp"
|
4
|
+
|
5
|
+
inline Rice::Object Rice::Object::
|
6
|
+
call(Identifier id) const
|
7
|
+
{
|
8
|
+
VALUE args[] = { };
|
9
|
+
return protect(rb_funcall2, value(), id, 0, args);
|
10
|
+
}
|
11
|
+
|
12
|
+
template<typename T0>
|
13
|
+
inline Rice::Object Rice::Object::
|
14
|
+
call(Identifier id, T0 arg0) const
|
15
|
+
{
|
16
|
+
VALUE args[] = { to_ruby(arg0) };
|
17
|
+
return protect(rb_funcall2, value(), id, 1, args);
|
18
|
+
}
|
19
|
+
|
20
|
+
template<typename T0, typename T1>
|
21
|
+
inline Rice::Object Rice::Object::
|
22
|
+
call(Identifier id, T0 arg0, T1 arg1) const
|
23
|
+
{
|
24
|
+
VALUE args[] = { to_ruby(arg0), to_ruby(arg1) };
|
25
|
+
return protect(rb_funcall2, value(), id, 2, args);
|
26
|
+
}
|
27
|
+
|
28
|
+
template<typename T0, typename T1, typename T2>
|
29
|
+
inline Rice::Object Rice::Object::
|
30
|
+
call(Identifier id, T0 arg0, T1 arg1, T2 arg2) const
|
31
|
+
{
|
32
|
+
VALUE args[] = { to_ruby(arg0), to_ruby(arg1), to_ruby(arg2) };
|
33
|
+
return protect(rb_funcall2, value(), id, 3, args);
|
34
|
+
}
|
35
|
+
|
36
|
+
template<typename T0, typename T1, typename T2, typename T3>
|
37
|
+
inline Rice::Object Rice::Object::
|
38
|
+
call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3) const
|
39
|
+
{
|
40
|
+
VALUE args[] = { to_ruby(arg0), to_ruby(arg1), to_ruby(arg2), to_ruby(arg3) };
|
41
|
+
return protect(rb_funcall2, value(), id, 4, args);
|
42
|
+
}
|
43
|
+
|
44
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4>
|
45
|
+
inline Rice::Object Rice::Object::
|
46
|
+
call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) const
|
47
|
+
{
|
48
|
+
VALUE args[] = { to_ruby(arg0), to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4) };
|
49
|
+
return protect(rb_funcall2, value(), id, 5, args);
|
50
|
+
}
|
51
|
+
|
52
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
53
|
+
inline Rice::Object Rice::Object::
|
54
|
+
call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) const
|
55
|
+
{
|
56
|
+
VALUE args[] = { to_ruby(arg0), to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4), to_ruby(arg5) };
|
57
|
+
return protect(rb_funcall2, value(), id, 6, args);
|
58
|
+
}
|
59
|
+
|
60
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
61
|
+
inline Rice::Object Rice::Object::
|
62
|
+
call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) const
|
63
|
+
{
|
64
|
+
VALUE args[] = { to_ruby(arg0), to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4), to_ruby(arg5), to_ruby(arg6) };
|
65
|
+
return protect(rb_funcall2, value(), id, 7, args);
|
66
|
+
}
|
67
|
+
|
68
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
69
|
+
inline Rice::Object Rice::Object::
|
70
|
+
call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) const
|
71
|
+
{
|
72
|
+
VALUE args[] = { to_ruby(arg0), 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, 8, args);
|
74
|
+
}
|
75
|
+
|
76
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
77
|
+
inline Rice::Object Rice::Object::
|
78
|
+
call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) const
|
79
|
+
{
|
80
|
+
VALUE args[] = { to_ruby(arg0), to_ruby(arg1), to_ruby(arg2), to_ruby(arg3), to_ruby(arg4), to_ruby(arg5), to_ruby(arg6), to_ruby(arg7), to_ruby(arg8) };
|
81
|
+
return protect(rb_funcall2, value(), id, 9, args);
|
82
|
+
}
|
83
|
+
|
84
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
85
|
+
inline Rice::Object Rice::Object::
|
86
|
+
call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) const
|
87
|
+
{
|
88
|
+
VALUE args[] = { to_ruby(arg0), 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) };
|
89
|
+
return protect(rb_funcall2, value(), id, 10, args);
|
90
|
+
}
|
91
|
+
|
92
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10>
|
93
|
+
inline Rice::Object Rice::Object::
|
94
|
+
call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10) const
|
95
|
+
{
|
96
|
+
VALUE args[] = { to_ruby(arg0), 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) };
|
97
|
+
return protect(rb_funcall2, value(), id, 11, args);
|
98
|
+
}
|
99
|
+
|
100
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
|
101
|
+
inline Rice::Object Rice::Object::
|
102
|
+
call(Identifier id, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11) const
|
103
|
+
{
|
104
|
+
VALUE args[] = { to_ruby(arg0), 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) };
|
105
|
+
return protect(rb_funcall2, value(), id, 12, args);
|
106
|
+
}
|
107
|
+
|
108
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
|
109
|
+
inline Rice::Object Rice::Object::
|
110
|
+
call(Identifier id, T0 arg0, 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
|
111
|
+
{
|
112
|
+
VALUE args[] = { to_ruby(arg0), 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) };
|
113
|
+
return protect(rb_funcall2, value(), id, 13, args);
|
114
|
+
}
|
115
|
+
|
116
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13>
|
117
|
+
inline Rice::Object Rice::Object::
|
118
|
+
call(Identifier id, T0 arg0, 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
|
119
|
+
{
|
120
|
+
VALUE args[] = { to_ruby(arg0), 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) };
|
121
|
+
return protect(rb_funcall2, value(), id, 14, args);
|
122
|
+
}
|
123
|
+
|
124
|
+
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14>
|
125
|
+
inline Rice::Object Rice::Object::
|
126
|
+
call(Identifier id, T0 arg0, 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
|
127
|
+
{
|
128
|
+
VALUE args[] = { to_ruby(arg0), 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) };
|
129
|
+
return protect(rb_funcall2, value(), id, 15, args);
|
130
|
+
}
|
131
|
+
|
@@ -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,93 @@
|
|
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
|
+
#ifndef RCLASS_M_TBL
|
69
|
+
#define RCLASS_M_TBL(c) RCLASS(c)->m_tbl
|
70
|
+
#endif
|
71
|
+
|
72
|
+
// ruby.h has a few defines that conflict with Visual Studio's STL
|
73
|
+
#if defined(_MSC_VER)
|
74
|
+
#undef write
|
75
|
+
#undef read
|
76
|
+
#undef bind
|
77
|
+
#endif
|
78
|
+
|
79
|
+
#if RICE__RUBY_VERSION_CODE < 190
|
80
|
+
namespace Rice
|
81
|
+
{
|
82
|
+
namespace detail
|
83
|
+
{
|
84
|
+
inline VALUE rb_errinfo() { return ruby_errinfo; }
|
85
|
+
inline void rb_set_errinfo(VALUE exc) { ruby_errinfo = exc; }
|
86
|
+
} // detail
|
87
|
+
} // Rice
|
88
|
+
#define rb_errinfo() ::Rice::detail::rb_errinfo()
|
89
|
+
#define rb_set_errinfo(exc) ::Rice::detail::rb_set_errinfo(exc)
|
90
|
+
#endif
|
91
|
+
|
92
|
+
#endif // Rice__detail__ruby__hpp_
|
93
|
+
|