jameskilton-rice 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. data/COPYING +23 -0
  2. data/Doxyfile +1253 -0
  3. data/Makefile.am +26 -0
  4. data/Makefile.in +749 -0
  5. data/README +879 -0
  6. data/README.mingw +8 -0
  7. data/Rakefile +72 -0
  8. data/aclocal.m4 +891 -0
  9. data/bootstrap +8 -0
  10. data/config.guess +1526 -0
  11. data/config.sub +1658 -0
  12. data/configure +7668 -0
  13. data/configure.ac +52 -0
  14. data/depcomp +589 -0
  15. data/doxygen.ac +314 -0
  16. data/doxygen.am +186 -0
  17. data/extconf.rb +22 -0
  18. data/install-sh +519 -0
  19. data/missing +367 -0
  20. data/post-autoconf.rb +22 -0
  21. data/post-automake.rb +28 -0
  22. data/rice/Address_Registration_Guard.hpp +7 -0
  23. data/rice/Address_Registration_Guard.ipp +34 -0
  24. data/rice/Address_Registration_Guard_defn.hpp +65 -0
  25. data/rice/Allocation_Strategies.hpp +37 -0
  26. data/rice/Arg.hpp +8 -0
  27. data/rice/Arg_impl.hpp +116 -0
  28. data/rice/Arg_operators.cpp +21 -0
  29. data/rice/Arg_operators.hpp +18 -0
  30. data/rice/Array.hpp +220 -0
  31. data/rice/Array.ipp +263 -0
  32. data/rice/Builtin_Object.hpp +8 -0
  33. data/rice/Builtin_Object.ipp +50 -0
  34. data/rice/Builtin_Object_defn.hpp +51 -0
  35. data/rice/Class.cpp +57 -0
  36. data/rice/Class.hpp +8 -0
  37. data/rice/Class.ipp +6 -0
  38. data/rice/Class_defn.hpp +83 -0
  39. data/rice/Constructor.hpp +339 -0
  40. data/rice/Critical_Guard.hpp +40 -0
  41. data/rice/Critical_Guard.ipp +26 -0
  42. data/rice/Data_Object.hpp +8 -0
  43. data/rice/Data_Object.ipp +133 -0
  44. data/rice/Data_Object_defn.hpp +132 -0
  45. data/rice/Data_Type.cpp +21 -0
  46. data/rice/Data_Type.hpp +8 -0
  47. data/rice/Data_Type.ipp +306 -0
  48. data/rice/Data_Type_defn.hpp +219 -0
  49. data/rice/Data_Type_fwd.hpp +12 -0
  50. data/rice/Director.cpp +19 -0
  51. data/rice/Director.hpp +47 -0
  52. data/rice/Enum.hpp +118 -0
  53. data/rice/Enum.ipp +246 -0
  54. data/rice/Exception.cpp +59 -0
  55. data/rice/Exception.hpp +9 -0
  56. data/rice/Exception_Base.hpp +8 -0
  57. data/rice/Exception_Base.ipp +13 -0
  58. data/rice/Exception_Base_defn.hpp +27 -0
  59. data/rice/Exception_defn.hpp +69 -0
  60. data/rice/Hash.hpp +210 -0
  61. data/rice/Hash.ipp +338 -0
  62. data/rice/Identifier.cpp +8 -0
  63. data/rice/Identifier.hpp +50 -0
  64. data/rice/Identifier.ipp +33 -0
  65. data/rice/Jump_Tag.hpp +24 -0
  66. data/rice/Makefile.am +140 -0
  67. data/rice/Makefile.in +740 -0
  68. data/rice/Module.cpp +84 -0
  69. data/rice/Module.hpp +8 -0
  70. data/rice/Module.ipp +6 -0
  71. data/rice/Module_defn.hpp +88 -0
  72. data/rice/Module_impl.hpp +281 -0
  73. data/rice/Module_impl.ipp +348 -0
  74. data/rice/Object.cpp +153 -0
  75. data/rice/Object.hpp +8 -0
  76. data/rice/Object.ipp +19 -0
  77. data/rice/Object_defn.hpp +183 -0
  78. data/rice/Require_Guard.hpp +21 -0
  79. data/rice/String.cpp +94 -0
  80. data/rice/String.hpp +89 -0
  81. data/rice/Struct.cpp +117 -0
  82. data/rice/Struct.hpp +162 -0
  83. data/rice/Struct.ipp +26 -0
  84. data/rice/Symbol.cpp +25 -0
  85. data/rice/Symbol.hpp +66 -0
  86. data/rice/Symbol.ipp +44 -0
  87. data/rice/VM.cpp +92 -0
  88. data/rice/VM.hpp +32 -0
  89. data/rice/config.hpp +44 -0
  90. data/rice/config.hpp.in +43 -0
  91. data/rice/detail/Arguments.hpp +126 -0
  92. data/rice/detail/Auto_Function_Wrapper.hpp +861 -0
  93. data/rice/detail/Auto_Function_Wrapper.ipp +2929 -0
  94. data/rice/detail/Auto_Member_Function_Wrapper.hpp +828 -0
  95. data/rice/detail/Auto_Member_Function_Wrapper.ipp +2326 -0
  96. data/rice/detail/Caster.hpp +63 -0
  97. data/rice/detail/Exception_Handler.hpp +8 -0
  98. data/rice/detail/Exception_Handler.ipp +68 -0
  99. data/rice/detail/Exception_Handler_defn.hpp +96 -0
  100. data/rice/detail/Iterator.hpp +93 -0
  101. data/rice/detail/Not_Copyable.hpp +25 -0
  102. data/rice/detail/Wrapped_Function.hpp +33 -0
  103. data/rice/detail/check_ruby_type.cpp +27 -0
  104. data/rice/detail/check_ruby_type.hpp +23 -0
  105. data/rice/detail/creation_funcs.hpp +37 -0
  106. data/rice/detail/creation_funcs.ipp +36 -0
  107. data/rice/detail/default_allocation_func.hpp +23 -0
  108. data/rice/detail/default_allocation_func.ipp +11 -0
  109. data/rice/detail/define_method_and_auto_wrap.hpp +31 -0
  110. data/rice/detail/define_method_and_auto_wrap.ipp +30 -0
  111. data/rice/detail/demangle.cpp +56 -0
  112. data/rice/detail/demangle.hpp +19 -0
  113. data/rice/detail/env.hpp +19 -0
  114. data/rice/detail/from_ruby.hpp +43 -0
  115. data/rice/detail/from_ruby.ipp +60 -0
  116. data/rice/detail/method_data.cpp +392 -0
  117. data/rice/detail/method_data.cpp.rpp +301 -0
  118. data/rice/detail/method_data.hpp +21 -0
  119. data/rice/detail/mininode.cpp +1220 -0
  120. data/rice/detail/mininode.cpp.rpp +62 -0
  121. data/rice/detail/mininode.hpp +320 -0
  122. data/rice/detail/mininode.hpp.rpp +119 -0
  123. data/rice/detail/node.hpp +13 -0
  124. data/rice/detail/object_call.hpp +85 -0
  125. data/rice/detail/object_call.ipp +147 -0
  126. data/rice/detail/protect.cpp +29 -0
  127. data/rice/detail/protect.hpp +34 -0
  128. data/rice/detail/remove_const.hpp +21 -0
  129. data/rice/detail/ruby.hpp +89 -0
  130. data/rice/detail/ruby_version_code.hpp +6 -0
  131. data/rice/detail/ruby_version_code.hpp.in +6 -0
  132. data/rice/detail/rubysig.hpp +19 -0
  133. data/rice/detail/st.hpp +60 -0
  134. data/rice/detail/to_ruby.hpp +22 -0
  135. data/rice/detail/to_ruby.ipp +37 -0
  136. data/rice/detail/win32.hpp +16 -0
  137. data/rice/detail/wrap_function.hpp +345 -0
  138. data/rice/detail/wrap_function.ipp +531 -0
  139. data/rice/generate_code.rb +1311 -0
  140. data/rice/global_function.hpp +33 -0
  141. data/rice/global_function.ipp +22 -0
  142. data/rice/protect.hpp +91 -0
  143. data/rice/protect.ipp +803 -0
  144. data/rice/ruby_mark.hpp +13 -0
  145. data/rice/ruby_try_catch.hpp +86 -0
  146. data/rice/rubypp.rb +97 -0
  147. data/rice/to_from_ruby.hpp +8 -0
  148. data/rice/to_from_ruby.ipp +299 -0
  149. data/rice/to_from_ruby_defn.hpp +71 -0
  150. data/ruby.ac +150 -0
  151. data/ruby/Makefile.am +1 -0
  152. data/ruby/Makefile.in +497 -0
  153. data/ruby/lib/Makefile.am +3 -0
  154. data/ruby/lib/Makefile.in +374 -0
  155. data/ruby/lib/mkmf-rice.rb.in +209 -0
  156. data/ruby/lib/version.rb +3 -0
  157. data/sample/Makefile.am +47 -0
  158. data/sample/Makefile.in +380 -0
  159. data/sample/enum/extconf.rb +3 -0
  160. data/sample/enum/sample_enum.cpp +54 -0
  161. data/sample/enum/test.rb +8 -0
  162. data/sample/inheritance/animals.cpp +98 -0
  163. data/sample/inheritance/extconf.rb +3 -0
  164. data/sample/inheritance/test.rb +7 -0
  165. data/sample/map/extconf.rb +3 -0
  166. data/sample/map/map.cpp +81 -0
  167. data/sample/map/test.rb +7 -0
  168. data/test/Makefile.am +49 -0
  169. data/test/Makefile.in +603 -0
  170. data/test/test_Address_Registration_Guard.cpp +43 -0
  171. data/test/test_Allocation_Strategies.cpp +77 -0
  172. data/test/test_Array.cpp +241 -0
  173. data/test/test_Builtin_Object.cpp +72 -0
  174. data/test/test_Class.cpp +398 -0
  175. data/test/test_Constructor.cpp +238 -0
  176. data/test/test_Critical_Guard.cpp +51 -0
  177. data/test/test_Data_Object.cpp +275 -0
  178. data/test/test_Data_Type.cpp +121 -0
  179. data/test/test_Director.cpp +225 -0
  180. data/test/test_Enum.cpp +162 -0
  181. data/test/test_Exception.cpp +46 -0
  182. data/test/test_Hash.cpp +195 -0
  183. data/test/test_Identifier.cpp +70 -0
  184. data/test/test_Jump_Tag.cpp +17 -0
  185. data/test/test_Module.cpp +428 -0
  186. data/test/test_Object.cpp +148 -0
  187. data/test/test_String.cpp +94 -0
  188. data/test/test_Struct.cpp +192 -0
  189. data/test/test_Symbol.cpp +63 -0
  190. data/test/test_To_From_Ruby.cpp +263 -0
  191. data/test/test_VM.cpp +26 -0
  192. data/test/test_global_functions.cpp +97 -0
  193. data/test/test_rice.rb +35 -0
  194. data/test/unittest.cpp +136 -0
  195. data/test/unittest.hpp +292 -0
  196. metadata +247 -0
@@ -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
+