rice 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +2 -2
- data/Doxyfile +1 -1
- data/Makefile.in +8 -3
- data/Rakefile +3 -3
- data/config.guess +30 -49
- data/config.sub +4 -22
- data/configure +319 -104
- data/configure.ac +6 -2
- data/doxygen.ac +2 -2
- data/extconf.rb +22 -0
- data/post-autoconf.rb +3 -3
- data/post-automake.rb +2 -2
- data/rice/Array.ipp +7 -6
- data/rice/Critical_Guard.hpp +6 -0
- data/rice/Critical_Guard.ipp +6 -0
- data/rice/Data_Object.hpp +1 -120
- data/rice/Data_Object.ipp +5 -1
- data/rice/Data_Object_defn.hpp +132 -0
- data/rice/Data_Type.ipp +18 -2
- data/rice/Enum.ipp +3 -3
- data/rice/Exception.hpp +1 -61
- data/rice/Exception_Base.hpp +2 -24
- data/rice/Exception_Base.ipp +2 -0
- data/rice/Exception_Base_defn.hpp +27 -0
- data/rice/Exception_defn.hpp +69 -0
- data/rice/Hash.hpp +5 -1
- data/rice/Hash.ipp +7 -7
- data/rice/Makefile.am +20 -3
- data/rice/Makefile.in +39 -4
- data/rice/Module.cpp +11 -3
- data/rice/Module_impl.hpp +20 -9
- data/rice/Module_impl.ipp +84 -87
- data/rice/Object.cpp +1 -1
- data/rice/VM.cpp +14 -1
- data/rice/VM.hpp +6 -1
- data/rice/config.hpp +24 -3
- data/rice/config.hpp.in +21 -0
- data/rice/detail/Auto_Function_Wrapper.hpp +97 -65
- data/rice/detail/Auto_Function_Wrapper.ipp +160 -128
- data/rice/detail/Auto_Member_Function_Wrapper.hpp +96 -64
- data/rice/detail/Auto_Member_Function_Wrapper.ipp +160 -128
- data/rice/detail/Exception_Handler.hpp +2 -112
- 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/check_ruby_type.cpp +8 -2
- data/rice/detail/creation_funcs.ipp +2 -2
- data/rice/detail/define_method_and_auto_wrap.hpp +4 -2
- data/rice/detail/define_method_and_auto_wrap.ipp +14 -5
- data/rice/detail/env.hpp +4 -0
- data/rice/detail/method_data.cpp +362 -75
- data/rice/detail/method_data.cpp.rpp +301 -0
- data/rice/detail/method_data.hpp +6 -18
- 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/protect.cpp +4 -2
- data/rice/detail/ruby.hpp +44 -18
- data/rice/detail/ruby_version_code.hpp +6 -0
- data/rice/detail/ruby_version_code.hpp.in +6 -0
- data/rice/detail/rubysig.hpp +6 -0
- data/rice/detail/st.hpp +6 -2
- data/rice/detail/wrap_function.hpp +50 -48
- data/rice/detail/wrap_function.ipp +48 -48
- data/rice/generate_code.rb +43 -293
- data/rice/global_function.hpp +10 -4
- data/rice/global_function.ipp +1 -2
- data/rice/ruby_mark.hpp +13 -0
- data/rice/ruby_try_catch.hpp +1 -1
- data/rice/rubypp.rb +97 -0
- data/rice/to_from_ruby.ipp +3 -3
- data/ruby.ac +44 -8
- data/ruby/Makefile.in +2 -0
- data/ruby/lib/Makefile.in +2 -0
- data/ruby/lib/mkmf-rice.rb.in +4 -1
- data/ruby/lib/version.rb +3 -0
- data/sample/Makefile.am +2 -2
- data/sample/Makefile.in +4 -2
- data/test/Makefile.am +2 -1
- data/test/Makefile.in +7 -2
- data/test/test_Array.cpp +2 -2
- data/test/test_Class.cpp +4 -1
- data/test/test_Critical_Guard.cpp +4 -0
- data/test/test_Data_Object.cpp +43 -3
- data/test/test_Hash.cpp +3 -3
- data/test/test_String.cpp +8 -8
- data/test/test_VM.cpp +1 -1
- data/test/test_global_functions.cpp +45 -0
- data/test/test_rice.rb +5 -0
- metadata +115 -98
- data/rice/detail/Iterator_Definer.hpp +0 -98
@@ -0,0 +1,62 @@
|
|
1
|
+
// TODO: This is silly, autoconf...
|
2
|
+
#undef PACKAGE_NAME
|
3
|
+
#undef PACKAGE_STRING
|
4
|
+
#undef PACKAGE_TARNAME
|
5
|
+
#undef PACKAGE_VERSION
|
6
|
+
|
7
|
+
#include "../config.hpp"
|
8
|
+
|
9
|
+
// TODO: This is silly, autoconf...
|
10
|
+
#undef PACKAGE_NAME
|
11
|
+
#undef PACKAGE_STRING
|
12
|
+
#undef PACKAGE_TARNAME
|
13
|
+
#undef PACKAGE_VERSION
|
14
|
+
|
15
|
+
#if !defined(HAVE_NODE_H) && !defined(REALLY_HAVE_RUBY_NODE_H)
|
16
|
+
|
17
|
+
#include "mininode.hpp"
|
18
|
+
#include <cstring>
|
19
|
+
|
20
|
+
extern "C"
|
21
|
+
char const * ruby_node_name(int node);
|
22
|
+
|
23
|
+
namespace
|
24
|
+
{
|
25
|
+
|
26
|
+
int node_value(char const * name)
|
27
|
+
{
|
28
|
+
/* TODO: any way to end the block? */
|
29
|
+
int j;
|
30
|
+
for(j = 0; ; ++j)
|
31
|
+
{
|
32
|
+
if(!std::strcmp(name, ruby_node_name(j)))
|
33
|
+
{
|
34
|
+
return j;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
} // namespace
|
40
|
+
|
41
|
+
#ruby <<END
|
42
|
+
require 'node_names'
|
43
|
+
NODE_NAMES.each do |name|
|
44
|
+
puts <<-END
|
45
|
+
static int NODE_#{name}_ = -1;
|
46
|
+
|
47
|
+
int Rice::detail::Mininode::get_NODE_#{name}()
|
48
|
+
{
|
49
|
+
if(NODE_#{name}_ == -1)
|
50
|
+
{
|
51
|
+
NODE_#{name}_ = node_value("NODE_#{name}");
|
52
|
+
}
|
53
|
+
|
54
|
+
return NODE_#{name}_;
|
55
|
+
}
|
56
|
+
END
|
57
|
+
end
|
58
|
+
nil
|
59
|
+
END
|
60
|
+
|
61
|
+
#endif
|
62
|
+
|
@@ -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,119 @@
|
|
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
|
+
#ruby <<END
|
68
|
+
require 'node_names'
|
69
|
+
|
70
|
+
NODE_NAMES.each do |name|
|
71
|
+
puts "#define NODE_#{name} Rice::detail::Mininode::get_NODE_#{name}()"
|
72
|
+
end
|
73
|
+
|
74
|
+
puts
|
75
|
+
|
76
|
+
NODE_NAMES.each do |name|
|
77
|
+
puts "int get_NODE_#{name}();"
|
78
|
+
end
|
79
|
+
nil
|
80
|
+
END
|
81
|
+
|
82
|
+
static const int NOEX_PUBLIC = 0x0;
|
83
|
+
|
84
|
+
inline NODE * NEW_METHOD(NODE * body, VALUE origin, int noex)
|
85
|
+
{
|
86
|
+
return NEW_NODE(NODE_METHOD, origin, body, noex);
|
87
|
+
}
|
88
|
+
|
89
|
+
#ifdef RUBY_VM
|
90
|
+
|
91
|
+
inline NODE * NEW_FBODY(NODE * body, ID id)
|
92
|
+
{
|
93
|
+
return NEW_NODE(NODE_FBODY, id, body, 0);
|
94
|
+
}
|
95
|
+
|
96
|
+
#else
|
97
|
+
|
98
|
+
inline NODE * NEW_FBODY(NODE * body, ID id, VALUE origin)
|
99
|
+
{
|
100
|
+
return NEW_NODE(NODE_FBODY, body, id, origin);
|
101
|
+
}
|
102
|
+
|
103
|
+
#endif // RUBY_VM
|
104
|
+
|
105
|
+
inline NODE * NEW_CFUNC(RUBY_METHOD_FUNC cfunc, int arity)
|
106
|
+
{
|
107
|
+
return NEW_NODE(NODE_CFUNC, cfunc, arity, 0);
|
108
|
+
}
|
109
|
+
|
110
|
+
} // namespace Mininode
|
111
|
+
|
112
|
+
} // namespace detail
|
113
|
+
|
114
|
+
} // namespace Rice
|
115
|
+
|
116
|
+
#endif
|
117
|
+
|
118
|
+
#endif // Rice__detail__mininode__hpp
|
119
|
+
|